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
This commit is contained in:
Brandon Dayauon
2025-03-13 21:20:22 +00:00
parent 0e3de56211
commit 59ed963a06
2 changed files with 9 additions and 5 deletions
@@ -435,6 +435,7 @@ public class AlphabeticalAppsList<T extends Context & ActivityContext> 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();
@@ -190,15 +190,11 @@ public class PrivateProfileManager extends UserProfileManager {
/** Adds Private Space install app button to the layout. */
public void addPrivateSpaceInstallAppButton(List<BaseAllAppsAdapter.AdapterItem> 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