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

Commit 058ebf6e authored by Ayush Sharma's avatar Ayush Sharma
Browse files

Fix deadlock between DPMS and AMS

Fixing deadlock between DevicePolicyManagerService and
AccessibilityManagerService.

(HOLD_AMS_LOCK)AMS.isAccessibilityTargetAllowed - > DPMS.getPermittedAccessibilityServicesForUser(WAIT_FOR_DPMS_LOCK)

(HOLD_DPMS_LOCK)DPMS.dump -> AMS (WAIT_FOR_AMS_LOCK)

Bug: 284777986
Test: NA
Change-Id: I0aa2e397ac49d90b5f89ba10e11cab665cc2e915
parent 5bdd53f6
Loading
Loading
Loading
Loading
+9 −14
Original line number Diff line number Diff line
@@ -241,6 +241,7 @@ import static android.provider.Telephony.Carriers.ENFORCE_KEY;
import static android.provider.Telephony.Carriers.ENFORCE_MANAGED_URI;
import static android.provider.Telephony.Carriers.INVALID_APN_ID;
import static android.security.keystore.AttestationUtils.USE_INDIVIDUAL_ATTESTATION;
import static com.android.internal.logging.nano.MetricsProto.MetricsEvent.PROVISIONING_ENTRY_POINT_ADB;
import static com.android.internal.widget.LockPatternUtils.CREDENTIAL_TYPE_NONE;
import static com.android.internal.widget.LockPatternUtils.StrongAuthTracker.STRONG_AUTH_REQUIRED_AFTER_DPM_LOCK_NOW;
@@ -11280,25 +11281,18 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
        }
    }
    private void dumpPerUserData(IndentingPrintWriter pw) {
    private void dumpPersonalAppInfoForSystemUserNoLock(IndentingPrintWriter pw) {
        wtfIfInLock();
        PersonalAppsSuspensionHelper.forUser(mContext, UserHandle.USER_SYSTEM).dump(pw);
    }
    private void dumpPerUserPolicyData(IndentingPrintWriter pw) {
        int userCount = mUserData.size();
        for (int i = 0; i < userCount; i++) {
            int userId = mUserData.keyAt(i);
            DevicePolicyData policy = getUserData(userId);
            policy.dump(pw);
            pw.println();
            if (userId == UserHandle.USER_SYSTEM) {
                pw.increaseIndent();
                PersonalAppsSuspensionHelper.forUser(mContext, userId).dump(pw);
                pw.decreaseIndent();
                pw.println();
            } else {
                // pm.getUnsuspendablePackages() will fail if it's called for a different user;
                // as this dump is mostly useful for system user anyways, we can just ignore the
                // others (rather than changing the permission check in the PM method)
                Slogf.d(LOG_TAG, "skipping PersonalAppsSuspensionHelper.dump() for user " + userId);
            }
        }
    }
@@ -11316,7 +11310,7 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
                pw.println();
                mDeviceAdminServiceController.dump(pw);
                pw.println();
                dumpPerUserData(pw);
                dumpPerUserPolicyData(pw);
                pw.println();
                mConstants.dump(pw);
                pw.println();
@@ -11343,6 +11337,7 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
                mStateCache.dump(pw);
                pw.println();
            }
            dumpPersonalAppInfoForSystemUserNoLock(pw);
            synchronized (mSubscriptionsChangedListenerLock) {
                pw.println("Subscription changed listener : " + mSubscriptionsChangedListener);