SecureSettingpublic abstract class SecureSetting extends android.database.ContentObserver implements com.android.systemui.statusbar.policy.ListenableHelper for managing a secure setting. |
Fields Summary |
---|
private static final int | DEFAULT | private final android.content.Context | mContext | private final String | mSettingName | private boolean | mListening | private int | mUserId | private int | mObservedValue |
Methods Summary |
---|
public int | getValue()
return Secure.getIntForUser(mContext.getContentResolver(), mSettingName, DEFAULT, mUserId);
| protected abstract void | handleValueChanged(int value, boolean observedChange)
| public void | onChange(boolean selfChange)
final int value = getValue();
handleValueChanged(value, value != mObservedValue);
mObservedValue = value;
| public void | setListening(boolean listening)
if (listening == mListening) return;
mListening = listening;
if (listening) {
mObservedValue = getValue();
mContext.getContentResolver().registerContentObserver(
Secure.getUriFor(mSettingName), false, this, mUserId);
} else {
mContext.getContentResolver().unregisterContentObserver(this);
mObservedValue = DEFAULT;
}
| public void | setUserId(int userId)
mUserId = userId;
if (mListening) {
setListening(false);
setListening(true);
}
| public void | setValue(int value)
Secure.putIntForUser(mContext.getContentResolver(), mSettingName, value, mUserId);
|
|