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

Commit cc791bc4 authored by Xiaohui Chen's avatar Xiaohui Chen
Browse files

More cleanup USER_OWNER

Bug: 19913735
Change-Id: I7fe1bb2a66231b7d1ae0670dff5e2ec736b2e541
parent 02fc5fef
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -107,7 +107,7 @@ public final class Dpm extends BaseCommand {

    private void runSetDeviceOwner() throws RemoteException {
        ComponentName component = parseComponentName(nextArgRequired());
        mDevicePolicyManager.setActiveAdmin(component, true /*refreshing*/, UserHandle.USER_OWNER);
        mDevicePolicyManager.setActiveAdmin(component, true /*refreshing*/, UserHandle.USER_SYSTEM);

        String packageName = component.getPackageName();
        try {
@@ -117,7 +117,7 @@ public final class Dpm extends BaseCommand {
            }
        } catch (Exception e) {
            // Need to remove the admin that we just added.
            mDevicePolicyManager.removeActiveAdmin(component, UserHandle.USER_OWNER);
            mDevicePolicyManager.removeActiveAdmin(component, UserHandle.USER_SYSTEM);
            throw e;
        }
        System.out.println("Success: Device owner set to package " + packageName);
+2 −1
Original line number Diff line number Diff line
@@ -94,8 +94,9 @@ public final class NetworkScorerAppManager {

        PackageManager pm = context.getPackageManager();
        // Only apps installed under the primary user of the device can be scorers.
        // TODO: http://b/23422763
        List<ResolveInfo> receivers =
                pm.queryBroadcastReceivers(SCORE_INTENT, 0 /* flags */, UserHandle.USER_OWNER);
                pm.queryBroadcastReceivers(SCORE_INTENT, 0 /* flags */, UserHandle.USER_SYSTEM);
        for (ResolveInfo receiver : receivers) {
            // This field is a misnomer, see android.content.pm.ResolveInfo#activityInfo
            final ActivityInfo receiverInfo = receiver.activityInfo;
+2 −3
Original line number Diff line number Diff line
@@ -255,7 +255,6 @@ public class KeyguardSecurityContainer extends FrameLayout implements KeyguardSe

        if (DEBUG) Log.d(TAG, "reportFailedPatternAttempt: #" + failedAttempts);

        SecurityMode mode = mSecurityModel.getSecurityMode();
        final int currentUser = KeyguardUpdateMonitor.getCurrentUser();
        final DevicePolicyManager dpm = mLockPatternUtils.getDevicePolicyManager();
        final int failedAttemptsBeforeWipe =
@@ -264,7 +263,6 @@ public class KeyguardSecurityContainer extends FrameLayout implements KeyguardSe
        final int remainingBeforeWipe = failedAttemptsBeforeWipe > 0 ?
                (failedAttemptsBeforeWipe - failedAttempts)
                : Integer.MAX_VALUE; // because DPM returns 0 if no restriction
        boolean showTimeout = false;
        if (remainingBeforeWipe < LockPatternUtils.FAILED_ATTEMPTS_BEFORE_WIPE_GRACE) {
            // The user has installed a DevicePolicyManager that requests a user/profile to be wiped
            // N attempts. Once we get below the grace period, we post this dialog every time as a
@@ -273,7 +271,8 @@ public class KeyguardSecurityContainer extends FrameLayout implements KeyguardSe
            final int expiringUser = dpm.getProfileWithMinimumFailedPasswordsForWipe(currentUser);
            int userType = USER_TYPE_PRIMARY;
            if (expiringUser == currentUser) {
                if (expiringUser != UserHandle.USER_OWNER) {
                // TODO: http://b/23522538
                if (expiringUser != UserHandle.USER_SYSTEM) {
                    userType = USER_TYPE_SECONDARY_USER;
                }
            } else if (expiringUser != UserHandle.USER_NULL) {