From ccf16f85ac1990e3af9980f68f729d91db16610b Mon Sep 17 00:00:00 2001 From: d34d Date: Wed, 6 Jan 2016 10:25:50 -0800 Subject: [PATCH] Keyguard: Broadcast when external keyguard changes Since the locksettings database is not backed by a provider, we cannot use a ContentObserver to know when a change to the third party keyguard component has occurred. Instead we broadcast that it has changed. Change-Id: I1384b8ba445dcb8d0c571ded1c68b297182f086a TICKET: CYNGNOS-1481 --- .../internal/util/CmLockPatternUtils.java | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/java/org/cyanogenmod/internal/util/CmLockPatternUtils.java b/src/java/org/cyanogenmod/internal/util/CmLockPatternUtils.java index 9c8b9df..6569336 100644 --- a/src/java/org/cyanogenmod/internal/util/CmLockPatternUtils.java +++ b/src/java/org/cyanogenmod/internal/util/CmLockPatternUtils.java @@ -17,7 +17,7 @@ package org.cyanogenmod.internal.util; import android.content.ComponentName; import android.content.Context; -import android.content.pm.PackageInfo; +import android.content.Intent; import android.content.pm.PackageManager; import android.os.UserHandle; import android.text.TextUtils; @@ -33,6 +33,12 @@ public class CmLockPatternUtils extends LockPatternUtils { */ public static final String THIRD_PARTY_KEYGUARD_COMPONENT = "lockscreen.third_party"; + /** + * Action to be broadcasted when the third party keyguard component has been changed + */ + public static final String ACTION_THIRD_PARTY_KEYGUARD_COMPONENT_CHANGED = + "org.cyanogenmod.internal.action.THIRD_PARTY_KEYGUARD_COMPONENT_CHANGED"; + private Context mContext; public CmLockPatternUtils(Context context) { @@ -60,6 +66,12 @@ public class CmLockPatternUtils extends LockPatternUtils { setString(THIRD_PARTY_KEYGUARD_COMPONENT, component != null ? component.flattenToString() : "", getCurrentUser()); + + // notify systemui, or whatever other process needs to know, that the third party keyguard + // component has changed. What it changed to is up to the receiver to figure out using + // the methods provided in this class. + mContext.sendOrderedBroadcast(new Intent(ACTION_THIRD_PARTY_KEYGUARD_COMPONENT_CHANGED), + null); } /**