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

Commit 377e9e8d authored by Robin Lee's avatar Robin Lee Committed by Android Git Automerger
Browse files

am 65d05c92: am 51533e26: am 96251e35: Stop double-loading device admins

* commit '65d05c923be7a044bee2503394396ff94e29bf5f':
  Stop double-loading device admins
parents 8a69d8f8 ea697d72
Loading
Loading
Loading
Loading
+13 −13
Original line number Diff line number Diff line
@@ -1103,6 +1103,8 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
            type = parser.next();
            int outerDepth = parser.getDepth();
            policy.mLockTaskPackages.clear();
            policy.mAdminList.clear();
            policy.mAdminMap.clear();
            while ((type=parser.next()) != XmlPullParser.END_DOCUMENT
                   && (type != XmlPullParser.END_TAG || parser.getDepth() > outerDepth)) {
                if (type == XmlPullParser.END_TAG || type == XmlPullParser.TEXT) {
@@ -1124,7 +1126,6 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
                            ActiveAdmin ap = new ActiveAdmin(dai);
                            ap.readFromXml(parser);
                            policy.mAdminMap.put(ap.info.getComponent(), ap);
                            policy.mAdminList.add(ap);
                        }
                    } catch (RuntimeException e) {
                        Slog.w(LOG_TAG, "Failed loading admin " + name, e);
@@ -1184,6 +1185,9 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
            // Ignore
        }

        // Generate a list of admins from the admin map
        policy.mAdminList.addAll(policy.mAdminMap.values());

        // Validate that what we stored for the password quality matches
        // sufficiently what is currently set.  Note that this is only
        // a sanity check in case the two get out of sync; this should
@@ -1268,10 +1272,8 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
        if (!mHasFeature) {
            return;
        }
        synchronized (this) {
            loadSettingsLocked(getUserData(UserHandle.USER_OWNER), UserHandle.USER_OWNER);
        getUserData(UserHandle.USER_OWNER);
        loadDeviceOwner();
        }
        cleanUpOldUsers();
        mAppOpsService = IAppOpsService.Stub.asInterface(
                ServiceManager.getService(Context.APP_OPS_SERVICE));
@@ -1436,7 +1438,6 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
                ActiveAdmin newAdmin = new ActiveAdmin(info);
                policy.mAdminMap.put(adminReceiver, newAdmin);
                int replaceIndex = -1;
                if (refreshing) {
                final int N = policy.mAdminList.size();
                for (int i=0; i < N; i++) {
                    ActiveAdmin oldAdmin = policy.mAdminList.get(i);
@@ -1445,7 +1446,6 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
                        break;
                    }
                }
                }
                if (replaceIndex == -1) {
                    policy.mAdminList.add(newAdmin);
                    enableIfNecessary(info.getPackageName(), userHandle);