diff options
| author | 2016-05-16 17:28:04 +0100 | |
|---|---|---|
| committer | 2016-05-16 17:29:17 +0100 | |
| commit | b0cdf3845fd33cc40a929a2b9b882bf0a3a994d3 (patch) | |
| tree | bdd7c23d536ddb08595df80488b770c1b0edbe65 | |
| parent | cef3337cb5e27d4f571fb350be055c26d339833d (diff) | |
Do not tie managed profile synchronously in onUnlockUser()
Bug: 28736098
Change-Id: I2c687c11b9991d0771cfe721e80ac1541c477f2e
| -rw-r--r-- | services/core/java/com/android/server/LockSettingsService.java | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/services/core/java/com/android/server/LockSettingsService.java b/services/core/java/com/android/server/LockSettingsService.java index 5b6117d55633..7e39a914d98e 100644 --- a/services/core/java/com/android/server/LockSettingsService.java +++ b/services/core/java/com/android/server/LockSettingsService.java @@ -43,6 +43,7 @@ import static com.android.internal.widget.LockPatternUtils.StrongAuthTracker.STR import android.database.sqlite.SQLiteDatabase; import android.os.Binder; import android.os.Bundle; +import android.os.Handler; import android.os.IBinder; import android.os.IProgressListener; import android.os.Parcel; @@ -118,6 +119,7 @@ public class LockSettingsService extends ILockSettings.Stub { private final Object mSeparateChallengeLock = new Object(); private final Context mContext; + private final Handler mHandler; private final LockSettingsStorage mStorage; private final LockSettingsStrongAuth mStrongAuth; @@ -219,6 +221,7 @@ public class LockSettingsService extends ILockSettings.Stub { public LockSettingsService(Context context) { mContext = context; + mHandler = new Handler(); mStrongAuth = new LockSettingsStrongAuth(context); // Open the database @@ -339,10 +342,20 @@ public class LockSettingsService extends ILockSettings.Stub { hideEncryptionNotification(new UserHandle(userId)); } - public void onUnlockUser(int userId) { + public void onUnlockUser(final int userId) { // Hide notification first, as tie managed profile lock takes time hideEncryptionNotification(new UserHandle(userId)); - tieManagedProfileLockIfNecessary(userId, null); + + if (mUserManager.getUserInfo(userId).isManagedProfile()) { + // As tieManagedProfileLockIfNecessary() may try to unlock user, we should not do it + // in onUnlockUser() synchronously, otherwise it may cause a deadlock + mHandler.post(new Runnable() { + @Override + public void run() { + tieManagedProfileLockIfNecessary(userId, null); + } + }); + } // Now we have unlocked the parent user we should show notifications // about any profiles that exist. |