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

Commit 2fc7c3f7 authored by Todd Kennedy's avatar Todd Kennedy
Browse files

don't call settings provider with pkg mgr lock

Bug: 34739922
Test: manual
Change-Id: I8bd5ad76d1db5125d75c086b7f0aa24b7ac3919a
parent 339dc75d
Loading
Loading
Loading
Loading
+11 −8
Original line number Diff line number Diff line
@@ -5633,6 +5633,11 @@ public class PackageManagerService extends IPackageManager.Stub {
                false, false, false, userId);
    }
    /**
     * Returns whether or not instant apps have been disabled remotely.
     * <p><em>IMPORTANT</em> This should not be called with the package manager lock
     * held. Otherwise we run the risk of deadlock.
     */
    private boolean isEphemeralDisabled() {
        // ephemeral apps have been disabled across the board
        if (DISABLE_EPHEMERAL_APPS) {
@@ -5653,10 +5658,6 @@ public class PackageManagerService extends IPackageManager.Stub {
    private boolean isEphemeralAllowed(
            Intent intent, List<ResolveInfo> resolvedActivities, int userId,
            boolean skipPackageCheck) {
        // Short circuit and return early if possible.
        if (isEphemeralDisabled()) {
            return false;
        }
        final int callingUser = UserHandle.getCallingUserId();
        if (callingUser != UserHandle.USER_SYSTEM) {
            return false;
@@ -6148,6 +6149,7 @@ public class PackageManagerService extends IPackageManager.Stub {
        boolean addEphemeral = false;
        List<ResolveInfo> result;
        final String pkgName = intent.getPackage();
        final boolean ephemeralDisabled = isEphemeralDisabled();
        synchronized (mPackages) {
            if (pkgName == null) {
                List<CrossProfileIntentFilter> matchingFilters =
@@ -6165,8 +6167,8 @@ public class PackageManagerService extends IPackageManager.Stub {
                // Check for results in the current profile.
                result = filterIfNotSystemUser(mActivities.queryIntent(
                        intent, resolvedType, flags, userId), userId);
                addEphemeral =
                        isEphemeralAllowed(intent, result, userId, false /*skipPackageCheck*/);
                addEphemeral = !ephemeralDisabled
                        && isEphemeralAllowed(intent, result, userId, false /*skipPackageCheck*/);
                // Check for cross profile results.
                boolean hasNonNegativePriorityResult = hasNonNegativePriority(result);
@@ -6223,7 +6225,8 @@ public class PackageManagerService extends IPackageManager.Stub {
                } else {
                    // the caller wants to resolve for a particular package; however, there
                    // were no installed results, so, try to find an ephemeral result
                    addEphemeral = isEphemeralAllowed(
                    addEphemeral =  !ephemeralDisabled
                            && isEphemeralAllowed(
                                    intent, null /*result*/, userId, true /*skipPackageCheck*/);
                    result = new ArrayList<ResolveInfo>();
                }