Enabling Private Space Container in Launcher.

This CL adds the following:
1. Adds filtering and addition of Private Profile apps in main user
all apps recycler view
2. Enables decoration of Private Profile apps
3. Enables hiding Private Space container based upon a settings entry.

Flag: ACONFIG com.android.launcher3.Flags.enable_private_space DEVELOPMENT
Bug: 289223923
Test: Ran Launcher3 tests
Change-Id: I33dc55a3a39e75d3fc336ca6a488b282e2dd322c
This commit is contained in:
Himanshu Gupta committed 2023-11-15 15:08:59 +00:00
1 parent 8ed8d67d63
commit 739b3c9f22
12 files changed
+412 -55

No files matched your search

@@ -21,6 +21,7 @@ import static androidx.test.core.app.ApplicationProvider.getApplicationContext;
import static com.android.launcher3.allapps.UserProfileManager.STATE_DISABLED;
import static com.android.launcher3.allapps.UserProfileManager.STATE_ENABLED;
import static com.android.launcher3.allapps.UserProfileManager.STATE_TRANSITION;
import static com.android.launcher3.util.Executors.UI_HELPER_EXECUTOR;
import static org.junit.Assert.assertEquals;
import static org.mockito.Mockito.when;
@@ -75,11 +76,12 @@ public class PrivateSpaceHeaderViewControllerTest {
}
@Test
public void privateProfileDisabled_psHeaderContainsLockedView() {
public void privateProfileDisabled_psHeaderContainsLockedView() throws Exception {
Bitmap unlockButton = getBitmap(mContext.getDrawable(R.drawable.bg_ps_unlock_button));
when(mPrivateProfileManager.getCurrentState()).thenReturn(STATE_DISABLED);
mPsHeaderViewController.addPrivateSpaceHeaderViewElements(mPsHeaderLayout);
awaitTasksCompleted();
int totalContainerHeaderView = 0;
int totalLockUnlockButtonView = 0;
@@ -102,13 +104,14 @@ public class PrivateSpaceHeaderViewControllerTest {
}
@Test
public void privateProfileEnabled_psHeaderContainsUnlockedView() {
public void privateProfileEnabled_psHeaderContainsUnlockedView() throws Exception {
Bitmap lockImage = getBitmap(mContext.getDrawable(R.drawable.bg_ps_lock_button));
Bitmap settingsImage = getBitmap(mContext.getDrawable(R.drawable.bg_ps_settings_button));
when(mPrivateProfileManager.getCurrentState()).thenReturn(STATE_ENABLED);
when(mPrivateProfileManager.isPrivateSpaceSettingsButtonVisible()).thenReturn(true);
mPsHeaderViewController.addPrivateSpaceHeaderViewElements(mPsHeaderLayout);
awaitTasksCompleted();
int totalContainerHeaderView = 0;
int totalLockUnlockButtonView = 0;
@@ -138,12 +141,14 @@ public class PrivateSpaceHeaderViewControllerTest {
}
@Test
public void privateProfileEnabledAndNoSettingsIntent_psHeaderContainsUnlockedView() {
public void privateProfileEnabledAndNoSettingsIntent_psHeaderContainsUnlockedView()
throws Exception {
Bitmap lockImage = getBitmap(mContext.getDrawable(R.drawable.bg_ps_lock_button));
when(mPrivateProfileManager.getCurrentState()).thenReturn(STATE_ENABLED);
when(mPrivateProfileManager.isPrivateSpaceSettingsButtonVisible()).thenReturn(false);
mPsHeaderViewController.addPrivateSpaceHeaderViewElements(mPsHeaderLayout);
awaitTasksCompleted();
int totalContainerHeaderView = 0;
int totalLockUnlockButtonView = 0;
@@ -168,11 +173,12 @@ public class PrivateSpaceHeaderViewControllerTest {
}
@Test
public void privateProfileTransitioning_psHeaderContainsTransitionView() {
public void privateProfileTransitioning_psHeaderContainsTransitionView() throws Exception {
Bitmap transitionImage = getBitmap(mContext.getDrawable(R.drawable.bg_ps_transition_image));
when(mPrivateProfileManager.getCurrentState()).thenReturn(STATE_TRANSITION);
mPsHeaderViewController.addPrivateSpaceHeaderViewElements(mPsHeaderLayout);
awaitTasksCompleted();
int totalContainerHeaderView = 0;
int totalLockUnlockButtonView = 0;
@@ -216,4 +222,8 @@ public class PrivateSpaceHeaderViewControllerTest {
}
return result;
}
private static void awaitTasksCompleted() throws Exception {
UI_HELPER_EXECUTOR.submit(() -> null).get();
}
}