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. Bug: 193384705 Test: robotest and see the UI Change-Id: I2de7ee72fc1315eeef01288b386f8756ca366e33
This commit is contained in:
@@ -36,6 +36,7 @@ import android.telephony.SubscriptionManager;
|
||||
import android.telephony.TelephonyManager;
|
||||
|
||||
import androidx.preference.Preference;
|
||||
import androidx.preference.PreferenceCategory;
|
||||
import androidx.preference.PreferenceManager;
|
||||
import androidx.preference.PreferenceScreen;
|
||||
import androidx.test.annotation.UiThreadTest;
|
||||
@@ -67,6 +68,7 @@ public class PhoneNumberPreferenceControllerTest {
|
||||
private SubscriptionInfo mSubscriptionInfo;
|
||||
@Mock
|
||||
private SubscriptionManager mSubscriptionManager;
|
||||
private PreferenceCategory mCategory;
|
||||
private PreferenceScreen mScreen;
|
||||
|
||||
private Context mContext;
|
||||
@@ -92,6 +94,10 @@ public class PhoneNumberPreferenceControllerTest {
|
||||
mPreference.setKey(mController.getPreferenceKey());
|
||||
mPreference.setVisible(true);
|
||||
mScreen.addPreference(mPreference);
|
||||
final String categoryKey = "basic_info_category";
|
||||
mCategory = new PreferenceCategory(mContext);
|
||||
mCategory.setKey(categoryKey);
|
||||
mScreen.addPreference(mCategory);
|
||||
|
||||
doReturn(mSubscriptionInfo).when(mController).getSubscriptionInfo(anyInt());
|
||||
doReturn(mSecondPreference).when(mController).createNewPreference(mContext);
|
||||
@@ -117,9 +123,11 @@ public class PhoneNumberPreferenceControllerTest {
|
||||
public void displayPreference_multiSim_shouldAddSecondPreference() {
|
||||
when(mTelephonyManager.getPhoneCount()).thenReturn(2);
|
||||
|
||||
final Preference sim1Preference = new Preference(mContext);
|
||||
mCategory.addItemFromInflater(sim1Preference);
|
||||
mController.displayPreference(mScreen);
|
||||
|
||||
assertThat(mScreen.getPreferenceCount()).isEqualTo(2);
|
||||
assertThat(mCategory.getPreferenceCount()).isEqualTo(2);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
Reference in New Issue
Block a user