diff options
| -rw-r--r-- | services/core/java/com/android/server/pm/PackageManagerService.java | 55 |
1 files changed, 26 insertions, 29 deletions
diff --git a/services/core/java/com/android/server/pm/PackageManagerService.java b/services/core/java/com/android/server/pm/PackageManagerService.java index ce7df89d9a3e..ab66d700e910 100644 --- a/services/core/java/com/android/server/pm/PackageManagerService.java +++ b/services/core/java/com/android/server/pm/PackageManagerService.java @@ -774,13 +774,11 @@ public class PackageManagerService extends IPackageManager.Stub { private int mIntentFilterVerificationToken = 0; - /** Component that knows whether or not an ephemeral application exists */ - final ComponentName mEphemeralResolverComponent; /** The service connection to the ephemeral resolver */ final EphemeralResolverConnection mEphemeralResolverConnection; /** Component used to install ephemeral applications */ - final ComponentName mEphemeralInstallerComponent; + ComponentName mEphemeralInstallerComponent; final ActivityInfo mEphemeralInstallerActivity = new ActivityInfo(); final ResolveInfo mEphemeralInstallerInfo = new ResolveInfo(); @@ -2740,32 +2738,22 @@ public class PackageManagerService extends IPackageManager.Stub { mInstallerService = new PackageInstallerService(context, this); final ComponentName ephemeralResolverComponent = getEphemeralResolverLPr(); - final ComponentName ephemeralInstallerComponent = getEphemeralInstallerLPr(); - // both the installer and resolver must be present to enable ephemeral - if (ephemeralInstallerComponent != null && ephemeralResolverComponent != null) { + if (ephemeralResolverComponent != null) { if (DEBUG_EPHEMERAL) { - Slog.i(TAG, "Ephemeral activated; resolver: " + ephemeralResolverComponent - + " installer:" + ephemeralInstallerComponent); + Slog.i(TAG, "Ephemeral resolver: " + ephemeralResolverComponent); } - mEphemeralResolverComponent = ephemeralResolverComponent; - mEphemeralInstallerComponent = ephemeralInstallerComponent; - setUpEphemeralInstallerActivityLP(mEphemeralInstallerComponent); mEphemeralResolverConnection = - new EphemeralResolverConnection(mContext, mEphemeralResolverComponent); + new EphemeralResolverConnection(mContext, ephemeralResolverComponent); } else { - if (DEBUG_EPHEMERAL) { - final String missingComponent = - (ephemeralResolverComponent == null) - ? (ephemeralInstallerComponent == null) - ? "resolver and installer" - : "resolver" - : "installer"; - Slog.i(TAG, "Ephemeral deactivated; missing " + missingComponent); - } - mEphemeralResolverComponent = null; - mEphemeralInstallerComponent = null; mEphemeralResolverConnection = null; } + mEphemeralInstallerComponent = getEphemeralInstallerLPr(); + if (mEphemeralInstallerComponent != null) { + if (DEBUG_EPHEMERAL) { + Slog.i(TAG, "Ephemeral installer: " + mEphemeralInstallerComponent); + } + setUpEphemeralInstallerActivityLP(mEphemeralInstallerComponent); + } mEphemeralApplicationRegistry = new EphemeralApplicationRegistry(this); } // synchronized (mPackages) @@ -5031,6 +5019,9 @@ public class PackageManagerService extends IPackageManager.Stub { if (mEphemeralResolverConnection == null) { return false; } + if (mEphemeralInstallerComponent == null) { + return false; + } if (intent.getComponent() != null) { return false; } @@ -9600,11 +9591,21 @@ public class PackageManagerService extends IPackageManager.Stub { } private void setUpEphemeralInstallerActivityLP(ComponentName installerComponent) { - final PackageParser.Package pkg = mPackages.get(installerComponent.getPackageName()); + if (installerComponent == null) { + if (DEBUG_EPHEMERAL) { + Slog.d(TAG, "Clear ephemeral installer activity"); + } + mEphemeralInstallerActivity.applicationInfo = null; + return; + } + if (DEBUG_EPHEMERAL) { + Slog.d(TAG, "Set ephemeral installer activity: " + installerComponent); + } + final PackageParser.Package pkg = mPackages.get(installerComponent.getPackageName()); // Set up information for ephemeral installer activity mEphemeralInstallerActivity.applicationInfo = pkg.applicationInfo; - mEphemeralInstallerActivity.name = mEphemeralInstallerComponent.getClassName(); + mEphemeralInstallerActivity.name = installerComponent.getClassName(); mEphemeralInstallerActivity.packageName = pkg.applicationInfo.packageName; mEphemeralInstallerActivity.processName = pkg.applicationInfo.packageName; mEphemeralInstallerActivity.launchMode = ActivityInfo.LAUNCH_MULTIPLE; @@ -9619,10 +9620,6 @@ public class PackageManagerService extends IPackageManager.Stub { mEphemeralInstallerInfo.isDefault = true; mEphemeralInstallerInfo.match = IntentFilter.MATCH_CATEGORY_SCHEME_SPECIFIC_PART | IntentFilter.MATCH_ADJUSTMENT_NORMAL; - - if (DEBUG_EPHEMERAL) { - Slog.d(TAG, "Set ephemeral installer activity: " + mEphemeralInstallerComponent); - } } private static String calculateBundledApkRoot(final String codePathString) { |