Hide "Phone number" from About page if not call enabled.
Bug: None Test: make RunSettingsRoboTests ROBOTEST_FILTER=com.android.settings.deviceinfo Change-Id: Ib056bae12d23fe68e71fe78c92741b8dc7887de0
This commit is contained in:
@@ -58,7 +58,7 @@ public class PhoneNumberPreferenceController extends AbstractPreferenceControlle
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isAvailable() {
|
public boolean isAvailable() {
|
||||||
return true;
|
return mTelephonyManager.isVoiceCapable();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@@ -16,6 +16,9 @@
|
|||||||
|
|
||||||
package com.android.settings.deviceinfo;
|
package com.android.settings.deviceinfo;
|
||||||
|
|
||||||
|
import static junit.framework.Assert.assertFalse;
|
||||||
|
import static junit.framework.Assert.assertTrue;
|
||||||
|
|
||||||
import static org.mockito.ArgumentMatchers.anyInt;
|
import static org.mockito.ArgumentMatchers.anyInt;
|
||||||
import static org.mockito.Mockito.doReturn;
|
import static org.mockito.Mockito.doReturn;
|
||||||
import static org.mockito.Mockito.spy;
|
import static org.mockito.Mockito.spy;
|
||||||
@@ -73,6 +76,20 @@ public class PhoneNumberPreferenceControllerTest {
|
|||||||
when(mPreference.isVisible()).thenReturn(true);
|
when(mPreference.isVisible()).thenReturn(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void isAvailable_shouldBeTrueIfCallCapable() {
|
||||||
|
when(mTelephonyManager.isVoiceCapable()).thenReturn(true);
|
||||||
|
|
||||||
|
assertTrue(mController.isAvailable());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void isAvailable_shouldBeFalseIfNotCallCapable() {
|
||||||
|
when(mTelephonyManager.isVoiceCapable()).thenReturn(false);
|
||||||
|
|
||||||
|
assertFalse(mController.isAvailable());
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void displayPreference_multiSim_shouldAddSecondPreference() {
|
public void displayPreference_multiSim_shouldAddSecondPreference() {
|
||||||
when(mTelephonyManager.getPhoneCount()).thenReturn(2);
|
when(mTelephonyManager.getPhoneCount()).thenReturn(2);
|
||||||
|
Reference in New Issue
Block a user