Revert "Allow the Instant App installer to be dynamic"

Breaks work profile creation among other multi user issues

Bug: 36530935

This reverts commit 85942c2bc69385eb326cfe0e15ad9223bf1cffb5.

Change-Id: I0b5901a02ca590b7e8121aa8babe5b1c5819eca7
diff --git a/services/core/java/com/android/server/pm/PackageManagerService.java b/services/core/java/com/android/server/pm/PackageManagerService.java
index a02978c..837aa32 100644
--- a/services/core/java/com/android/server/pm/PackageManagerService.java
+++ b/services/core/java/com/android/server/pm/PackageManagerService.java
@@ -2879,17 +2879,24 @@
             }
 
             mInstallerService = new PackageInstallerService(context, this);
+
             final ComponentName ephemeralResolverComponent = getEphemeralResolverLPr();
             if (ephemeralResolverComponent != null) {
                 if (DEBUG_EPHEMERAL) {
-                    Slog.d(TAG, "Set ephemeral resolver: " + ephemeralResolverComponent);
+                    Slog.i(TAG, "Ephemeral resolver: " + ephemeralResolverComponent);
                 }
                 mInstantAppResolverConnection =
                         new EphemeralResolverConnection(mContext, ephemeralResolverComponent);
             } else {
                 mInstantAppResolverConnection = null;
             }
-            updateInstantAppInstallerLocked();
+            mInstantAppInstallerComponent = getEphemeralInstallerLPr();
+            if (mInstantAppInstallerComponent != null) {
+                if (DEBUG_EPHEMERAL) {
+                    Slog.i(TAG, "Ephemeral installer: " + mInstantAppInstallerComponent);
+                }
+                setUpInstantAppInstallerActivityLP(mInstantAppInstallerComponent);
+            }
 
             // Read and update the usage of dex files.
             // Do this at the end of PM init so that all the packages have their
@@ -2929,21 +2936,6 @@
         Trace.traceEnd(TRACE_TAG_PACKAGE_MANAGER);
     }
 
-    private void updateInstantAppInstallerLocked() {
-        final ComponentName oldInstantAppInstallerComponent = mInstantAppInstallerComponent;
-        final ComponentName newInstantAppInstallerComponent = getEphemeralInstallerLPr();
-        if (newInstantAppInstallerComponent != null
-                && !newInstantAppInstallerComponent.equals(oldInstantAppInstallerComponent)) {
-            if (DEBUG_EPHEMERAL) {
-                Slog.d(TAG, "Set ephemeral installer: " + newInstantAppInstallerComponent);
-            }
-            setUpInstantAppInstallerActivityLP(newInstantAppInstallerComponent);
-        } else if (DEBUG_EPHEMERAL && newInstantAppInstallerComponent == null) {
-            Slog.d(TAG, "Unset ephemeral installer; none available");
-        }
-        mInstantAppInstallerComponent = newInstantAppInstallerComponent;
-    }
-
     private static File preparePackageParserCache(boolean isUpgrade) {
         if (!DEFAULT_PACKAGE_PARSER_CACHE_ENABLED) {
             return null;
@@ -16926,7 +16918,6 @@
 
             if (res.returnCode == PackageManager.INSTALL_SUCCEEDED) {
                 updateSequenceNumberLP(pkgName, res.newUsers);
-                updateInstantAppInstallerLocked();
             }
         }
     }
@@ -17502,7 +17493,6 @@
                         mInstantAppRegistry.onPackageUninstalledLPw(pkg, info.removedUsers);
                     }
                     updateSequenceNumberLP(packageName, info.removedUsers);
-                    updateInstantAppInstallerLocked();
                 }
             }
         }
@@ -19848,7 +19838,6 @@
             }
             scheduleWritePackageRestrictionsLocked(userId);
             updateSequenceNumberLP(packageName, new int[] { userId });
-            updateInstantAppInstallerLocked();
             components = mPendingBroadcasts.get(userId, packageName);
             final boolean newPackage = components == null;
             if (newPackage) {