Fix app pair launches with certain apps
This CL changes the way app pairs are saved. Previously, we saved the app pair using WorkspaceItemInfos directly from Recents, which caused certain apps to fail on launch because they weren't being launched with the correct Intent. Now, we look up a proper launchable WorkspaceItemInfo from the AllAppsStore and save that to the app pair, which should fix the launch issues. Bug: 323112914 Bug: 323110399 Test: Can launch Slides, Play Store, and Calendar when part of an app pair. Flag: ACONFIG com.android.wm.shell.enable_app_pairs TEAMFOOD Change-Id: I475afa1a237c50ffb0ffaf85af43912a803b8011
This commit is contained in:
1 parent
1d6f76f811
commit
1a98a9d874
3 files changed
+94
-6
No files matched your search
@@ -40,6 +40,7 @@ import java.io.PrintWriter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
@@ -138,12 +139,22 @@ public class AllAppsStore<T extends Context & ActivityContext> {
|
||||
/**
|
||||
* Returns {@link AppInfo} if any apps matches with provided {@link ComponentKey}, otherwise
|
||||
* null.
|
||||
*
|
||||
* Uses {@link AppInfo#COMPONENT_KEY_COMPARATOR} as a default comparator.
|
||||
*/
|
||||
@Nullable
|
||||
public AppInfo getApp(ComponentKey key) {
|
||||
return getApp(key, COMPONENT_KEY_COMPARATOR);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generic version of {@link #getApp(ComponentKey)} that allows comparator to be specified.
|
||||
*/
|
||||
@Nullable
|
||||
public AppInfo getApp(ComponentKey key, Comparator<AppInfo> comparator) {
|
||||
mTempInfo.componentName = key.componentName;
|
||||
mTempInfo.user = key.user;
|
||||
int index = Arrays.binarySearch(mApps, mTempInfo, COMPONENT_KEY_COMPARATOR);
|
||||
int index = Arrays.binarySearch(mApps, mTempInfo, comparator);
|
||||
return index < 0 ? null : mApps[index];
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user