Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9a4b2ab1 authored by Todd Kennedy's avatar Todd Kennedy Committed by Android (Google) Code Review
Browse files

Merge "Allow the Instant App installer to be dynamic"

parents 26a547d5 85942c2b
Loading
Loading
Loading
Loading
+20 −9
Original line number Original line Diff line number Diff line
@@ -2879,24 +2879,17 @@ public class PackageManagerService extends IPackageManager.Stub {
            }
            }
            mInstallerService = new PackageInstallerService(context, this);
            mInstallerService = new PackageInstallerService(context, this);
            final ComponentName ephemeralResolverComponent = getEphemeralResolverLPr();
            final ComponentName ephemeralResolverComponent = getEphemeralResolverLPr();
            if (ephemeralResolverComponent != null) {
            if (ephemeralResolverComponent != null) {
                if (DEBUG_EPHEMERAL) {
                if (DEBUG_EPHEMERAL) {
                    Slog.i(TAG, "Ephemeral resolver: " + ephemeralResolverComponent);
                    Slog.d(TAG, "Set ephemeral resolver: " + ephemeralResolverComponent);
                }
                }
                mInstantAppResolverConnection =
                mInstantAppResolverConnection =
                        new EphemeralResolverConnection(mContext, ephemeralResolverComponent);
                        new EphemeralResolverConnection(mContext, ephemeralResolverComponent);
            } else {
            } else {
                mInstantAppResolverConnection = null;
                mInstantAppResolverConnection = null;
            }
            }
            mInstantAppInstallerComponent = getEphemeralInstallerLPr();
            updateInstantAppInstallerLocked();
            if (mInstantAppInstallerComponent != null) {
                if (DEBUG_EPHEMERAL) {
                    Slog.i(TAG, "Ephemeral installer: " + mInstantAppInstallerComponent);
                }
                setUpInstantAppInstallerActivityLP(mInstantAppInstallerComponent);
            }
            // Read and update the usage of dex files.
            // Read and update the usage of dex files.
            // Do this at the end of PM init so that all the packages have their
            // Do this at the end of PM init so that all the packages have their
@@ -2936,6 +2929,21 @@ public class PackageManagerService extends IPackageManager.Stub {
        Trace.traceEnd(TRACE_TAG_PACKAGE_MANAGER);
        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) {
    private static File preparePackageParserCache(boolean isUpgrade) {
        if (!DEFAULT_PACKAGE_PARSER_CACHE_ENABLED) {
        if (!DEFAULT_PACKAGE_PARSER_CACHE_ENABLED) {
            return null;
            return null;
@@ -16918,6 +16926,7 @@ public class PackageManagerService extends IPackageManager.Stub {
            if (res.returnCode == PackageManager.INSTALL_SUCCEEDED) {
            if (res.returnCode == PackageManager.INSTALL_SUCCEEDED) {
                updateSequenceNumberLP(pkgName, res.newUsers);
                updateSequenceNumberLP(pkgName, res.newUsers);
                updateInstantAppInstallerLocked();
            }
            }
        }
        }
    }
    }
@@ -17493,6 +17502,7 @@ public class PackageManagerService extends IPackageManager.Stub {
                        mInstantAppRegistry.onPackageUninstalledLPw(pkg, info.removedUsers);
                        mInstantAppRegistry.onPackageUninstalledLPw(pkg, info.removedUsers);
                    }
                    }
                    updateSequenceNumberLP(packageName, info.removedUsers);
                    updateSequenceNumberLP(packageName, info.removedUsers);
                    updateInstantAppInstallerLocked();
                }
                }
            }
            }
        }
        }
@@ -19838,6 +19848,7 @@ Slog.v(TAG, ":: stepped forward, applying functor at tag " + parser.getName());
            }
            }
            scheduleWritePackageRestrictionsLocked(userId);
            scheduleWritePackageRestrictionsLocked(userId);
            updateSequenceNumberLP(packageName, new int[] { userId });
            updateSequenceNumberLP(packageName, new int[] { userId });
            updateInstantAppInstallerLocked();
            components = mPendingBroadcasts.get(userId, packageName);
            components = mPendingBroadcasts.get(userId, packageName);
            final boolean newPackage = components == null;
            final boolean newPackage = components == null;
            if (newPackage) {
            if (newPackage) {