diff options
author | Roman Birg <roman@cyngn.com> | 2015-08-10 11:18:55 -0700 |
---|---|---|
committer | Gerrit Code Review <gerrit@cyanogenmod.org> | 2015-08-13 10:49:17 -0700 |
commit | 307941c0fdb03f316693142a0076345e9be52add (patch) | |
tree | e6e6609e9dbf510d98ce6dd6eb97dcff36d0e069 /src/java/cyanogenmod/app | |
parent | f304ef2ac94ec4c2aef48047a3e21bcaf703d483 (diff) | |
download | vendor_cmsdk-307941c0fdb03f316693142a0076345e9be52add.zip vendor_cmsdk-307941c0fdb03f316693142a0076345e9be52add.tar.gz vendor_cmsdk-307941c0fdb03f316693142a0076345e9be52add.tar.bz2 |
cmsdk: fix enabling/disabling keyguard
We cannot create a new WindowManagerPolicy every time since the method
isn't called from the main thread every time, which could lead to
exceptions being thrown when trying to create PhoneWindowManager.
Instead of creating a new policy, bind to the keyguard service on bind,
and then pass it to the profile to operate on.
Ref: NIGHTLIES-1640
Change-Id: I3ac58bfa534755eaa73890cc5ddf05987a7d0d8c
Signed-off-by: Roman Birg <roman@cyngn.com>
Diffstat (limited to 'src/java/cyanogenmod/app')
-rwxr-xr-x | src/java/cyanogenmod/app/Profile.java | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/java/cyanogenmod/app/Profile.java b/src/java/cyanogenmod/app/Profile.java index bd51ca2..908110a 100755 --- a/src/java/cyanogenmod/app/Profile.java +++ b/src/java/cyanogenmod/app/Profile.java @@ -26,6 +26,7 @@ import android.provider.Settings; import android.text.TextUtils; import android.util.Log; +import com.android.internal.policy.IKeyguardService; import cyanogenmod.os.Build; import cyanogenmod.profiles.AirplaneModeSettings; import cyanogenmod.profiles.BrightnessSettings; @@ -1168,7 +1169,7 @@ public final class Profile implements Parcelable, Comparable { } /** @hide */ - public void doSelect(Context context) { + public void doSelect(Context context, IKeyguardService keyguardService) { // Set stream volumes AudioManager am = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE); for (StreamSettings sd : streams.values()) { @@ -1190,8 +1191,12 @@ public final class Profile implements Parcelable, Comparable { // Set brightness mBrightness.processOverride(context); - // Set lock screen mode - mScreenLockMode.processOverride(context); + if (keyguardService != null) { + // Set lock screen mode + mScreenLockMode.processOverride(context, keyguardService); + } else { + Log.e(TAG, "cannot process screen lock override without a keyguard service."); + } // Set expanded desktop // if (mExpandedDesktopMode != ExpandedDesktopMode.DEFAULT) { |