Make app pairs respond properly to disabled state

1) App pair member icons are now always redrawn when app pair icon is redrawn, allowing greyed out icons to be updated immediately when an app is disabled.
2) App pairs now check for disabled status when clicked. If one or both of the apps is disabled, app pair will not be launched, and the appropriate error message or affordance will be displayed.

Fixes: 323088270
Test: Manual
Flag: ACONFIG com.android.wm.shell.enable_app_pairs TEAMFOOD
Change-Id: I7f2af75db0d8579d5d04583c0d3ead32714768e4
This commit is contained in:
Jeremy Sim
2024-01-31 18:13:09 +08:00
parent ae741dec9f
commit e96d30bddb
3 changed files with 25 additions and 11 deletions

View File

@@ -149,7 +149,20 @@ public class ItemClickHandler {
private static void onClickAppPairIcon(View v) {
Launcher launcher = Launcher.getLauncher(v.getContext());
AppPairIcon appPairIcon = (AppPairIcon) v;
launcher.launchAppPair(appPairIcon);
if (appPairIcon.getInfo().isDisabled()) {
WorkspaceItemInfo app1 = appPairIcon.getInfo().contents.get(0);
WorkspaceItemInfo app2 = appPairIcon.getInfo().contents.get(1);
// Show the user why the app pair is disabled.
if (app1.isDisabled() && !handleDisabledItemClicked(app1, launcher)) {
// If handleDisabledItemClicked() did not handle the error message, we initiate an
// app launch so Framework can tell the user why the app is suspended.
onClickAppShortcut(v, app1, launcher);
} else if (app2.isDisabled() && !handleDisabledItemClicked(app2, launcher)) {
onClickAppShortcut(v, app2, launcher);
}
} else {
launcher.launchAppPair(appPairIcon);
}
}
/**