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
This commit is contained in:
d34d 2016-01-06 10:25:50 -08:00 committed by Gerrit Code Review
parent dbb87e233d
commit ccf16f85ac

View File

@ -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);
}
/**