am b2f21c53: Merge "Use settings to persist sticky widget." into jb-mr1-lockscreen-dev

* commit 'b2f21c53cf423cad5cf2f5d92579258decb40631':
  Use settings to persist sticky widget.
This commit is contained in:
John Spurlock
2012-10-30 08:49:05 -07:00
committed by Android Git Automerger
4 changed files with 76 additions and 58 deletions

View File

@ -3216,20 +3216,27 @@ public final class Settings {
/**
* This preference contains the string that shows for owner info on LockScren.
* This preference contains the string that shows for owner info on LockScreen.
* @hide
*/
public static final String LOCK_SCREEN_OWNER_INFO = "lock_screen_owner_info";
/**
* Id of the user-selected appwidget on the lockscreen, or -1 if none
* Ids of the user-selected appwidgets on the lockscreen (comma-delimited).
* @hide
*/
public static final String LOCK_SCREEN_APPWIDGET_IDS =
"lock_screen_appwidget_ids";
/**
* This preference enables showing the owner info on LockScren.
* Index of the lockscreen appwidget to restore, -1 if none.
* @hide
*/
public static final String LOCK_SCREEN_STICKY_APPWIDGET =
"lock_screen_sticky_appwidget";
/**
* This preference enables showing the owner info on LockScreen.
* @hide
*/
public static final String LOCK_SCREEN_OWNER_INFO_ENABLED =

View File

@ -150,7 +150,6 @@ public class LockPatternUtils {
private final ContentResolver mContentResolver;
private DevicePolicyManager mDevicePolicyManager;
private ILockSettings mLockSettingsService;
private int mStickyWidgetIndex = -1;
// The current user is set by KeyguardViewMediator and shared by all LockPatternUtils.
private static volatile int sCurrentUserId = UserHandle.USER_NULL;
@ -1162,6 +1161,21 @@ public class LockPatternUtils {
return true;
}
public int getStickyAppWidgetIndex() {
return Settings.Secure.getIntForUser(
mContentResolver,
Settings.Secure.LOCK_SCREEN_STICKY_APPWIDGET,
-1,
UserHandle.USER_CURRENT);
}
public void setStickyAppWidgetIndex(int value) {
Settings.Secure.putIntForUser(mContentResolver,
Settings.Secure.LOCK_SCREEN_STICKY_APPWIDGET,
value,
UserHandle.USER_CURRENT);
}
private long getLong(String secureSettingKey, long defaultValue) {
try {
return getLockSettings().getLong(secureSettingKey, defaultValue,
@ -1311,12 +1325,4 @@ public class LockPatternUtils {
return getBoolean(LOCKSCREEN_POWER_BUTTON_INSTANTLY_LOCKS, true);
}
public int getStickyWidgetIndex() {
return mStickyWidgetIndex;
}
public void setStickyWidgetIndex(int stickyWidgetIndex) {
mStickyWidgetIndex = stickyWidgetIndex;
}
}