Add ability to show/hide default_home preference.

This adds a new boolean flag, config_show_default_home, which when set
to false will hide the default_home preference item.

Bug: 62378256
Test: make RunSettingsRoboTests
ROBOTEST_FILTER=DefaultHomePreferenceControllerTest

Change-Id: Ibbf17ebb76b61fc8b2eac84016e3d874ca15a513
This commit is contained in:
Ben Lin
2017-12-18 17:55:40 -08:00
parent 86097b0e19
commit b60d2cbb5b
5 changed files with 21 additions and 10 deletions

View File

@@ -147,20 +147,19 @@ public class DefaultAppSettingsTest {
@Test
public void testNonIndexableKeys_existInXmlLayout() {
final Context context = spy(RuntimeEnvironment.application);
final Context mockContext = mock(Context.class);
when(mockContext.getApplicationContext()).thenReturn(mockContext);
when(context.getApplicationContext()).thenReturn(context);
final UserManager userManager = mock(UserManager.class, RETURNS_DEEP_STUBS);
when(mockContext.getSystemService(Context.USER_SERVICE))
when(context.getSystemService(Context.USER_SERVICE))
.thenReturn(userManager);
when(userManager.getUserInfo(anyInt()).isRestricted()).thenReturn(true);
when(mockContext.getSystemService(Context.TELEPHONY_SERVICE))
when(context.getSystemService(Context.TELEPHONY_SERVICE))
.thenReturn(mock(TelephonyManager.class));
when(mockContext.getPackageManager())
when(context.getPackageManager())
.thenReturn(mock(PackageManager.class));
final List<String> niks = DefaultAppSettings.SEARCH_INDEX_DATA_PROVIDER
.getNonIndexableKeys(mockContext);
.getNonIndexableKeys(context);
final int xmlId = (new DefaultAppSettings()).getPreferenceScreenResId();