Fixing Launcher crases due to methods being called on Ui Threads.

This CL fixes the following two issues:
1. Launcher crashing while calling `addPrivateSpaceSettingsButton` from
   BaseAllAppsAdapter as the thread is UI
2. Decorator is not removed from Private Space Header during reset to
   paused state. https://screenshot.googleplex.com/BZdLqaZQwdDApfV

Flag: ACONFIG com.android.launcher3.Flags.enable_private_space DEVELOPMENT
Bug: 311337961, 311342946
Test: Ran Launcher3 tests
Change-Id: I2763338ebf0f5468ad38f61a781e8a8334194c5c
This commit is contained in:
Himanshu Gupta committed 2023-11-20 18:59:13 +00:00
1 parent 172eb5896b
commit 2b5620b295
4 files changed
+31 -10

No files matched your search

@@ -108,7 +108,7 @@ public class PrivateSpaceHeaderViewControllerTest {
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);
when(mPrivateProfileManager.isPrivateSpaceSettingsAvailable()).thenReturn(true);
mPsHeaderViewController.addPrivateSpaceHeaderViewElements(mPsHeaderLayout);
awaitTasksCompleted();
@@ -145,7 +145,7 @@ public class PrivateSpaceHeaderViewControllerTest {
throws Exception {
Bitmap lockImage = getBitmap(mContext.getDrawable(R.drawable.bg_ps_lock_button));
when(mPrivateProfileManager.getCurrentState()).thenReturn(STATE_ENABLED);
when(mPrivateProfileManager.isPrivateSpaceSettingsButtonVisible()).thenReturn(false);
when(mPrivateProfileManager.isPrivateSpaceSettingsAvailable()).thenReturn(false);
mPsHeaderViewController.addPrivateSpaceHeaderViewElements(mPsHeaderLayout);
awaitTasksCompleted();