diff options
author | Roman Birg <roman@cyngn.com> | 2015-09-18 12:28:10 -0700 |
---|---|---|
committer | Roman Birg <roman@cyngn.com> | 2016-03-17 08:39:42 -0700 |
commit | e45d8f20f1dc3bb424cfab7611cdeb00a0f82e92 (patch) | |
tree | e5d2d4c40961beece65cd995f111a720ca79bff7 /packages/SystemUI/src | |
parent | 7f4697c2889bb8fef2c0951513a5952a74329e58 (diff) | |
download | frameworks_base-e45d8f20f1dc3bb424cfab7611cdeb00a0f82e92.zip frameworks_base-e45d8f20f1dc3bb424cfab7611cdeb00a0f82e92.tar.gz frameworks_base-e45d8f20f1dc3bb424cfab7611cdeb00a0f82e92.tar.bz2 |
SystemUI: fix crypt keeper race condition
We check package manager whether crypt keeper has disabled itself, but
if crypt keeper is in the process of disabling itself, the lockscreen
might get in a bad state.
Instead of checking package manager, let's use the same check that
CryptKeeper uses to decide whether to disable itself.
Change-Id: I9de09a1248b28fa14db9f69fb1313778895e2438
Signed-off-by: Roman Birg <roman@cyngn.com>
Diffstat (limited to 'packages/SystemUI/src')
-rwxr-xr-x | packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java index 36eac87..06ce8cc 100755 --- a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java +++ b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java @@ -26,13 +26,11 @@ import android.app.StatusBarManager; import android.app.admin.DevicePolicyManager; import android.app.trust.TrustManager; import android.content.BroadcastReceiver; -import android.content.ComponentName; import android.content.ContentResolver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.content.SharedPreferences; -import android.content.pm.PackageManager; import android.content.pm.UserInfo; import android.database.ContentObserver; import android.media.AudioManager; @@ -153,8 +151,7 @@ public class KeyguardViewMediator extends SystemUI { "com.android.internal.action.KEYGUARD_SERVICE_STATE_CHANGED"; private static final String KEYGUARD_SERVICE_EXTRA_ACTIVE = "active"; - private static final String SETTINGS_PACKAGE = "com.android.settings"; - private static final String CRYPT_KEEPER_ACTIVITY = SETTINGS_PACKAGE + ".CryptKeeper"; + private static final String DECRYPT_STATE = "trigger_restart_framework"; // used for handler messages private static final int SHOW = 2; @@ -348,7 +345,7 @@ public class KeyguardViewMediator extends SystemUI { */ private boolean mPendingLock; - private int mCyrptKeeperEnabledState = -1; + private boolean mCryptKeeperEnabled = true; private boolean mWakeAndUnlocking; private IKeyguardDrawnCallback mDrawnCallback; @@ -929,13 +926,14 @@ public class KeyguardViewMediator extends SystemUI { } private boolean isCryptKeeperEnabled() { - if (mCyrptKeeperEnabledState == -1) { - PackageManager pm = mContext.getPackageManager(); - mCyrptKeeperEnabledState = pm.getComponentEnabledSetting( - new ComponentName(SETTINGS_PACKAGE, CRYPT_KEEPER_ACTIVITY)); - } - - return mCyrptKeeperEnabledState != PackageManager.COMPONENT_ENABLED_STATE_DISABLED; + if (!mCryptKeeperEnabled) { + // once it's disabled, it's disabled. + return false; + } + final String state = SystemProperties.get("vold.decrypt"); + mCryptKeeperEnabled = !"".equals(state) && !DECRYPT_STATE.equals(state); + if (DEBUG) Log.w(TAG, "updated crypt keeper state to: " + mCryptKeeperEnabled); + return mCryptKeeperEnabled; } /** |