From 2952cbeb8e42558d78e5897a7f860b8b32e81e5f Mon Sep 17 00:00:00 2001 From: Todd Kennedy Date: Wed, 5 Apr 2017 07:44:19 -0700 Subject: [PATCH] look for old intent values the instant app installer/resolver/setting components haven't updated to the new values yet. Need to continue looking for the previous intent values. Test: boot and see ephemeral enabled Change-Id: Id88191a4878a138fa90bbd9816805ff76665ada9 --- .../server/pm/PackageManagerService.java | 34 ++++++++++++++++--- 1 file changed, 30 insertions(+), 4 deletions(-) diff --git a/services/core/java/com/android/server/pm/PackageManagerService.java b/services/core/java/com/android/server/pm/PackageManagerService.java index 3303081314a5d..d5c4fb913b2f3 100644 --- a/services/core/java/com/android/server/pm/PackageManagerService.java +++ b/services/core/java/com/android/server/pm/PackageManagerService.java @@ -3057,9 +3057,17 @@ public class PackageManagerService extends IPackageManager.Stub { | MATCH_DIRECT_BOOT_UNAWARE | (!Build.IS_DEBUGGABLE ? MATCH_SYSTEM_ONLY : 0); final Intent resolverIntent = new Intent(Intent.ACTION_RESOLVE_INSTANT_APP_PACKAGE); - final List resolvers = queryIntentServicesInternal(resolverIntent, null, + List resolvers = queryIntentServicesInternal(resolverIntent, null, resolveFlags, UserHandle.USER_SYSTEM, callingUid, false /*includeInstantApps*/); - + // temporarily look for the old action + if (resolvers.size() == 0) { + if (DEBUG_EPHEMERAL) { + Slog.d(TAG, "Ephemeral resolver not found with new action; try old one"); + } + resolverIntent.setAction(Intent.ACTION_RESOLVE_EPHEMERAL_PACKAGE); + resolvers = queryIntentServicesInternal(resolverIntent, null, + resolveFlags, UserHandle.USER_SYSTEM, callingUid, false /*includeInstantApps*/); + } final int N = resolvers.size(); if (N == 0) { if (DEBUG_EPHEMERAL) { @@ -3106,8 +3114,17 @@ public class PackageManagerService extends IPackageManager.Stub { MATCH_DIRECT_BOOT_AWARE | MATCH_DIRECT_BOOT_UNAWARE | (!Build.IS_DEBUGGABLE ? MATCH_SYSTEM_ONLY : 0); - final List matches = queryIntentActivitiesInternal(intent, PACKAGE_MIME_TYPE, + List matches = queryIntentActivitiesInternal(intent, PACKAGE_MIME_TYPE, resolveFlags, UserHandle.USER_SYSTEM); + // temporarily look for the old action + if (matches.isEmpty()) { + if (DEBUG_EPHEMERAL) { + Slog.d(TAG, "Ephemeral installer not found with new action; try old one"); + } + intent.setAction(Intent.ACTION_INSTALL_EPHEMERAL_PACKAGE); + matches = queryIntentActivitiesInternal(intent, PACKAGE_MIME_TYPE, + resolveFlags, UserHandle.USER_SYSTEM); + } Iterator iter = matches.iterator(); while (iter.hasNext()) { final ResolveInfo rInfo = iter.next(); @@ -3136,8 +3153,17 @@ public class PackageManagerService extends IPackageManager.Stub { .addCategory(Intent.CATEGORY_DEFAULT) .setPackage(resolver.getPackageName()); final int resolveFlags = MATCH_DIRECT_BOOT_AWARE | MATCH_DIRECT_BOOT_UNAWARE; - final List matches = queryIntentActivitiesInternal(intent, null, resolveFlags, + List matches = queryIntentActivitiesInternal(intent, null, resolveFlags, UserHandle.USER_SYSTEM); + // temporarily look for the old action + if (matches.isEmpty()) { + if (DEBUG_EPHEMERAL) { + Slog.d(TAG, "Ephemeral resolver settings not found with new action; try old one"); + } + intent.setAction(Intent.ACTION_EPHEMERAL_RESOLVER_SETTINGS); + matches = queryIntentActivitiesInternal(intent, null, resolveFlags, + UserHandle.USER_SYSTEM); + } if (matches.isEmpty()) { return null; }