Show work profile apps only on app list.

For the work profile drilldown, we used to show all apps when the user
drilled down into the categories. This makes it so that the drill down
only shows the work apps when that deep.

Change-Id: I492cd3e9b9b923b87b68645a871dcfb2b91b4f95
Fixes: 62963093
Test: Settings robotest
This commit is contained in:
Daniel Nishi
2017-08-10 18:32:25 -07:00
parent f664c77f31
commit 83ceab82e4
4 changed files with 54 additions and 5 deletions

View File

@@ -16,12 +16,12 @@
package com.android.settings.deviceinfo.storage;
import static com.android.settings.applications.ManageApplications.EXTRA_WORK_ONLY;
import static com.android.settings.utils.FileSizeFormatter.MEGABYTE_IN_BYTES;
import static com.google.common.truth.Truth.assertThat;
import static org.mockito.ArgumentMatchers.nullable;
import static org.mockito.Matchers.any;
import static org.mockito.Matchers.eq;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.spy;
@@ -171,6 +171,29 @@ public class StorageItemPreferenceControllerTest {
.isEqualTo(R.string.apps_storage);
}
@Test
public void testClickAppsForWork() {
mController = new StorageItemPreferenceController(mContext, mFragment, mVolume, mSvp, true);
mPreference.setKey("pref_other_apps");
mController.handlePreferenceTreeClick(mPreference);
final ArgumentCaptor<Intent> argumentCaptor = ArgumentCaptor.forClass(Intent.class);
verify(mFragment.getActivity())
.startActivityAsUser(argumentCaptor.capture(), nullable(UserHandle.class));
Intent intent = argumentCaptor.getValue();
assertThat(intent.getAction()).isEqualTo(Intent.ACTION_MAIN);
assertThat(intent.getComponent().getClassName()).isEqualTo(SubSettings.class.getName());
assertThat(intent.getStringExtra(SettingsActivity.EXTRA_SHOW_FRAGMENT))
.isEqualTo(ManageApplications.class.getName());
assertThat(intent.getIntExtra(SettingsActivity.EXTRA_SHOW_FRAGMENT_TITLE_RESID, 0))
.isEqualTo(R.string.apps_storage);
assertThat(
intent.getBundleExtra(SettingsActivity.EXTRA_SHOW_FRAGMENT_ARGUMENTS)
.getBoolean(EXTRA_WORK_ONLY))
.isTrue();
}
@Test
public void handlePreferenceTreeClick_tappingAppsWhileUninitializedDoesntCrash() {
mController.setVolume(null);