Implement work-profile infra in BasePreferenceController

- Add settings:forWork in xml
- Set mIsForWork based on xml attribute
- Delete WorkProfilePreferenceController and move its function to
BasePreferenceController

Fixes: 123376083
Test: Add work profile, go to Settings->System->Language&input,
UI should show work profile related items
Change-Id: Id2dcbb0e158c117cdfd363466a275f4e133c345e
This commit is contained in:
Raff Tsai
2019-12-02 10:55:29 +08:00
parent 9700435b4d
commit f71db73025
13 changed files with 132 additions and 149 deletions

View File

@@ -15,8 +15,6 @@
*/
package com.android.settings.location;
import static com.google.common.truth.Truth.assertThat;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyInt;
import static org.mockito.Mockito.doReturn;
@@ -114,17 +112,6 @@ public class LocationForWorkPreferenceControllerTest {
verify(mPreference).setSummary(R.string.switch_off_text);
}
@Test
public void isAvailable_noManagedProfile_shouldReturnFalse() {
when(mUserManager.getUserProfiles()).thenReturn(new ArrayList<>());
assertThat(mController.isAvailable()).isFalse();
}
@Test
public void isAvailable_hasManagedProfile_shouldReturnTrue() {
assertThat(mController.isAvailable()).isTrue();
}
@Test
public void onLocationModeChanged_disabledByAdmin_shouldDisablePreference() {
mController.displayPreference(mScreen);