Fix the problem that the SIM status and IMEI after the "Build number".

- Adding the SIM status and IMEI items of SIM2 to the PreferenceScreen
  can not put these items in the correct categories. We have to put
  these items directly into the correct categories.

Fix: 193384705
Test: robotest and see the UI

Merged-In: I2de7ee72fc1315eeef01288b386f8756ca366e33
Change-Id: I9472ecd604afe2f2e2eaf08c92ec11e439e8fc1d
This commit is contained in:
Stanley Wang
2021-07-13 17:06:22 +08:00
parent bc7e4bcd46
commit 1fcdafbcda
8 changed files with 237 additions and 7 deletions

View File

@@ -24,6 +24,7 @@ import android.telephony.TelephonyManager;
import androidx.annotation.VisibleForTesting;
import androidx.fragment.app.Fragment;
import androidx.preference.Preference;
import androidx.preference.PreferenceCategory;
import androidx.preference.PreferenceScreen;
import com.android.settings.R;
@@ -37,6 +38,7 @@ public class SimStatusPreferenceController extends
AbstractSimStatusImeiInfoPreferenceController implements PreferenceControllerMixin {
private static final String KEY_SIM_STATUS = "sim_status";
private static final String KEY_PREFERENCE_CATEGORY = "device_detail_category";
private final TelephonyManager mTelephonyManager;
private final SubscriptionManager mSubscriptionManager;
@@ -64,6 +66,7 @@ public class SimStatusPreferenceController extends
if (!isAvailable() || preference == null || !preference.isVisible()) {
return;
}
final PreferenceCategory category = screen.findPreference(KEY_PREFERENCE_CATEGORY);
mPreferenceList.add(preference);
@@ -74,7 +77,7 @@ public class SimStatusPreferenceController extends
final Preference multiSimPreference = createNewPreference(screen.getContext());
multiSimPreference.setOrder(simStatusOrder + simSlotNumber);
multiSimPreference.setKey(KEY_SIM_STATUS + simSlotNumber);
screen.addPreference(multiSimPreference);
category.addPreference(multiSimPreference);
mPreferenceList.add(multiSimPreference);
}
}