diff options
| author | Jim Miller <jaggies@google.com> | 2012-09-21 14:47:54 -0700 |
|---|---|---|
| committer | Jim Miller <jaggies@google.com> | 2012-09-21 14:47:54 -0700 |
| commit | 25645d8bbcced4416122d5dadedcf030a7bc12e5 (patch) | |
| tree | 69704bfe47aa6b9732861024945703729d7ff3f1 /core/java | |
| parent | 3034d45104f954eb15937e03ec74d86ca37894dc (diff) | |
Remove UID checks from LockPatternUtils
The UID checks should be unnecessary because LockPatternUtils already relies
on system permission checks in Settings, LockSettings, DevicePolicyManager
and Keystore. These checks should already catch illegal operations.
This was interfering with the stand-alone test app for keyguard.
Change-Id: I2da2a729ca29feae9e962c2e360ec47490bcbbf0
Diffstat (limited to 'core/java')
| -rw-r--r-- | core/java/com/android/internal/widget/LockPatternUtils.java | 40 |
1 files changed, 13 insertions, 27 deletions
diff --git a/core/java/com/android/internal/widget/LockPatternUtils.java b/core/java/com/android/internal/widget/LockPatternUtils.java index 8756950b3654..bc71162db9bc 100644 --- a/core/java/com/android/internal/widget/LockPatternUtils.java +++ b/core/java/com/android/internal/widget/LockPatternUtils.java @@ -215,36 +215,26 @@ public class LockPatternUtils { } public void setCurrentUser(int userId) { - if (Process.myUid() == Process.SYSTEM_UID) { - mCurrentUserId = userId; - } else { - throw new SecurityException("Only the system process can set the current user"); - } + mCurrentUserId = userId; } public int getCurrentUser() { - if (Process.myUid() == Process.SYSTEM_UID) { - if (mCurrentUserId != UserHandle.USER_NULL) { - // Someone is regularly updating using setCurrentUser() use that value. - return mCurrentUserId; - } - try { - return ActivityManagerNative.getDefault().getCurrentUser().id; - } catch (RemoteException re) { - return UserHandle.USER_OWNER; - } - } else { - throw new SecurityException("Only the system process can get the current user"); + if (mCurrentUserId != UserHandle.USER_NULL) { + // Someone is regularly updating using setCurrentUser() use that value. + return mCurrentUserId; + } + try { + return ActivityManagerNative.getDefault().getCurrentUser().id; + } catch (RemoteException re) { + return UserHandle.USER_OWNER; } } public void removeUser(int userId) { - if (Process.myUid() == Process.SYSTEM_UID) { - try { - getLockSettings().removeUser(userId); - } catch (RemoteException re) { - Log.e(TAG, "Couldn't remove lock settings for user " + userId); - } + try { + getLockSettings().removeUser(userId); + } catch (RemoteException re) { + Log.e(TAG, "Couldn't remove lock settings for user " + userId); } } @@ -591,10 +581,6 @@ public class LockPatternUtils { // Compute the hash final byte[] hash = passwordToHash(password); try { - if (Process.myUid() != Process.SYSTEM_UID && userHandle != UserHandle.myUserId()) { - throw new SecurityException( - "Only the system process can save lock password for another user"); - } getLockSettings().setLockPassword(hash, userHandle); DevicePolicyManager dpm = getDevicePolicyManager(); KeyStore keyStore = KeyStore.getInstance(); |
