From 59ed963a06f58d9efdc7e981bb1f0233f3dc2f16 Mon Sep 17 00:00:00 2001 From: Brandon Dayauon Date: Thu, 13 Mar 2025 21:20:22 +0000 Subject: [PATCH] Let psApp change according to theme. Since psApp is supposedly a system app, private space team requests that the icon changes according to theme like previous "install" icon. To do so Launcher can apply the same treatment to the bitmapInfo as for the private space app. bug: 360313403 Test: manually video in bug Flag: android.multiuser.enable_moving_content_into_private_space Change-Id: I78f0d0dbb12d5cfba2cac7e7b53714e424a49660 --- .../launcher3/allapps/AlphabeticalAppsList.java | 1 + .../launcher3/allapps/PrivateProfileManager.java | 13 ++++++++----- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/com/android/launcher3/allapps/AlphabeticalAppsList.java b/src/com/android/launcher3/allapps/AlphabeticalAppsList.java index f223eaa600..bf02e03f99 100644 --- a/src/com/android/launcher3/allapps/AlphabeticalAppsList.java +++ b/src/com/android/launcher3/allapps/AlphabeticalAppsList.java @@ -435,6 +435,7 @@ public class AlphabeticalAppsList implement } if (currentItem.itemInfo != null && Objects.equals( currentItem.itemInfo.getTargetPackage(), PRIVATE_SPACE_PACKAGE)) { + currentItem.itemInfo.bitmap = mPrivateProviderManager.preparePSBitmapInfo(); currentItem.itemInfo.bitmap.creationFlags |= FLAG_NO_BADGE; currentItem.itemInfo.contentDescription = mPrivateProviderManager.getPsAppContentDesc(); diff --git a/src/com/android/launcher3/allapps/PrivateProfileManager.java b/src/com/android/launcher3/allapps/PrivateProfileManager.java index 1bc1b17d15..0e6a5b867b 100644 --- a/src/com/android/launcher3/allapps/PrivateProfileManager.java +++ b/src/com/android/launcher3/allapps/PrivateProfileManager.java @@ -190,15 +190,11 @@ public class PrivateProfileManager extends UserProfileManager { /** Adds Private Space install app button to the layout. */ public void addPrivateSpaceInstallAppButton(List adapterItems) { Context context = mAllApps.getContext(); - // Prepare bitmapInfo - Intent.ShortcutIconResource shortcut = Intent.ShortcutIconResource.fromContext( - context, com.android.launcher3.R.drawable.private_space_install_app_icon); - BitmapInfo bitmapInfo = LauncherIcons.obtain(context).createIconBitmap(shortcut); PrivateSpaceInstallAppButtonInfo itemInfo = new PrivateSpaceInstallAppButtonInfo(); itemInfo.title = context.getResources().getString(R.string.ps_add_button_label); itemInfo.intent = mAppInstallerIntent; - itemInfo.bitmap = bitmapInfo; + itemInfo.bitmap = preparePSBitmapInfo(); itemInfo.contentDescription = context.getResources().getString( com.android.launcher3.R.string.ps_add_button_content_description); itemInfo.runtimeStatusFlags |= FLAG_NOT_PINNABLE; @@ -218,6 +214,13 @@ public class PrivateProfileManager extends UserProfileManager { .get(mAllApps.getContext()).getValue(PRIVATE_SPACE_HIDE_WHEN_LOCKED_URI, 0); } + BitmapInfo preparePSBitmapInfo() { + Context context = mAllApps.getContext(); + Intent.ShortcutIconResource shortcut = Intent.ShortcutIconResource.fromContext( + context, com.android.launcher3.R.drawable.private_space_install_app_icon); + return LauncherIcons.obtain(context).createIconBitmap(shortcut); + } + /** * Resets the current state of Private Profile, w.r.t. to Launcher. The decorator should only * be applied upon expand before animating. When collapsing, reset() will remove the decorator