Improve app pairs disabled state

This CL fixes 2 issues with app pairs:
- When an app pair is incompatible with the screen size due to a non-resizeable app (e.g. Camera), the app pair will now be properly disabled and display an error message. If the user is on a foldable, it will prompt the user to unfold their phone.
- The app pair icon will now properly redraw with lower opacity when it is disabled.

Fixes: 323088270
Test: Manually paused and unpaused apps, created Camera app pairs and tested with foldable
Flag: ACONFIG com.android.wm.shell.enable_app_pairs TEAMFOOD
Change-Id: I66514c96bc19f480c9788661e4dffaa5b1cdc2ca
This commit is contained in:
Jeremy Sim
2024-02-16 17:39:56 -08:00
parent cda8adfad3
commit 3c1ee0dad4
11 changed files with 116 additions and 7 deletions
@@ -48,6 +48,7 @@ import com.android.launcher3.model.data.WorkspaceItemInfo;
import com.android.launcher3.pm.PackageInstallInfo;
import com.android.launcher3.pm.UserCache;
import com.android.launcher3.shortcuts.ShortcutRequest;
import com.android.launcher3.uioverrides.ApiWrapper;
import com.android.launcher3.util.FlagOp;
import com.android.launcher3.util.IntSet;
import com.android.launcher3.util.ItemInfoMatcher;
@@ -284,6 +285,12 @@ public class PackageUpdatedTask extends BaseModelUpdateTask {
}
}
if (si.itemType == Favorites.ITEM_TYPE_APPLICATION) {
if (activities != null && !activities.isEmpty()) {
si.status = ApiWrapper
.isNonResizeableActivity(activities.get(0))
? si.status | WorkspaceItemInfo.FLAG_NON_RESIZEABLE
: si.status & ~WorkspaceItemInfo.FLAG_NON_RESIZEABLE;
}
iconCache.getTitleAndIcon(si, si.usingLowResIcon());
infoUpdated = true;
}