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

Commit f426ace9 authored by Amith Yamasani's avatar Amith Yamasani Committed by Android (Google) Code Review
Browse files

Merge "Only wipe device if primary user (for failed password attempts)" into jb-mr1.1-dev

parents 09a526fa 32f0742e
Loading
Loading
Loading
Loading
+21 −17
Original line number Diff line number Diff line
@@ -1875,6 +1875,14 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
                    DeviceAdminInfo.USES_POLICY_WIPE_DATA);
            long ident = Binder.clearCallingIdentity();
            try {
                wipeDeviceOrUserLocked(flags, userHandle);
            } finally {
                Binder.restoreCallingIdentity(ident);
            }
        }
    }

    private void wipeDeviceOrUserLocked(int flags, final int userHandle) {
        if (userHandle == UserHandle.USER_OWNER) {
            wipeDataLocked(flags);
        } else {
@@ -1891,10 +1899,6 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
                }
            });
        }
            } finally {
                Binder.restoreCallingIdentity(ident);
            }
        }
    }

    public void getRemoveWarning(ComponentName comp, final RemoteCallback result, int userHandle) {
@@ -1996,7 +2000,7 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
                saveSettingsLocked(userHandle);
                int max = getMaximumFailedPasswordsForWipe(null, userHandle);
                if (max > 0 && policy.mFailedPasswordAttempts >= max) {
                    wipeDataLocked(0);
                    wipeDeviceOrUserLocked(0, userHandle);
                }
                sendAdminCommandLocked(DeviceAdminReceiver.ACTION_PASSWORD_FAILED,
                        DeviceAdminInfo.USES_POLICY_WATCH_LOGIN, userHandle);