summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Spurlock <jspurlock@google.com>2012-10-19 11:08:33 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2012-10-19 11:08:33 -0700
commit9055dd74f4ac42e422de941259d9f9c437ef9eca (patch)
tree40ebed270590a98cb73566a615ab73dab6424e84
parent049ccb55361de3ef41b01875569b341c4f06d1db (diff)
parent76f99688cfc0f0c3a7e3782e8b9bcd640a0e4653 (diff)
downloadpackages_apps_Settings-9055dd74f4ac42e422de941259d9f9c437ef9eca.zip
packages_apps_Settings-9055dd74f4ac42e422de941259d9f9c437ef9eca.tar.gz
packages_apps_Settings-9055dd74f4ac42e422de941259d9f9c437ef9eca.tar.bz2
am 76f99688: am d983e1d1: Settings: Use new shared dream setting defaults.
* commit '76f99688cfc0f0c3a7e3782e8b9bcd640a0e4653': Settings: Use new shared dream setting defaults.
-rw-r--r--src/com/android/settings/DisplaySettings.java2
-rw-r--r--src/com/android/settings/DreamBackend.java19
2 files changed, 15 insertions, 6 deletions
diff --git a/src/com/android/settings/DisplaySettings.java b/src/com/android/settings/DisplaySettings.java
index 6ee60b5..9f812fe 100644
--- a/src/com/android/settings/DisplaySettings.java
+++ b/src/com/android/settings/DisplaySettings.java
@@ -104,7 +104,7 @@ public class DisplaySettings extends SettingsPreferenceFragment implements
mScreenSaverPreference = findPreference(KEY_SCREEN_SAVER);
if (mScreenSaverPreference != null
&& getResources().getBoolean(
- com.android.internal.R.bool.config_enableDreams) == false) {
+ com.android.internal.R.bool.config_dreamsSupported) == false) {
getPreferenceScreen().removePreference(mScreenSaverPreference);
}
diff --git a/src/com/android/settings/DreamBackend.java b/src/com/android/settings/DreamBackend.java
index a866174..70124ef 100644
--- a/src/com/android/settings/DreamBackend.java
+++ b/src/com/android/settings/DreamBackend.java
@@ -75,12 +75,21 @@ public class DreamBackend {
private final Context mContext;
private final IDreamManager mDreamManager;
private final DreamInfoComparator mComparator;
+ private final boolean mDreamsEnabledByDefault;
+ private final boolean mDreamsActivatedOnSleepByDefault;
+ private final boolean mDreamsActivatedOnDockByDefault;
public DreamBackend(Context context) {
mContext = context;
mDreamManager = IDreamManager.Stub.asInterface(
ServiceManager.getService(DreamService.DREAM_SERVICE));
mComparator = new DreamInfoComparator(getDefaultDream());
+ mDreamsEnabledByDefault = context.getResources()
+ .getBoolean(com.android.internal.R.bool.config_dreamsEnabledByDefault);
+ mDreamsActivatedOnSleepByDefault = context.getResources()
+ .getBoolean(com.android.internal.R.bool.config_dreamsActivatedOnSleepByDefault);
+ mDreamsActivatedOnDockByDefault = context.getResources()
+ .getBoolean(com.android.internal.R.bool.config_dreamsActivatedOnDockByDefault);
}
public List<DreamInfo> getDreamInfos() {
@@ -134,7 +143,7 @@ public class DreamBackend {
}
public boolean isEnabled() {
- return getBoolean(SCREENSAVER_ENABLED);
+ return getBoolean(SCREENSAVER_ENABLED, mDreamsEnabledByDefault);
}
public void setEnabled(boolean value) {
@@ -143,7 +152,7 @@ public class DreamBackend {
}
public boolean isActivatedOnDock() {
- return getBoolean(SCREENSAVER_ACTIVATE_ON_DOCK);
+ return getBoolean(SCREENSAVER_ACTIVATE_ON_DOCK, mDreamsActivatedOnDockByDefault);
}
public void setActivatedOnDock(boolean value) {
@@ -152,7 +161,7 @@ public class DreamBackend {
}
public boolean isActivatedOnSleep() {
- return getBoolean(SCREENSAVER_ACTIVATE_ON_SLEEP);
+ return getBoolean(SCREENSAVER_ACTIVATE_ON_SLEEP, mDreamsActivatedOnSleepByDefault);
}
public void setActivatedOnSleep(boolean value) {
@@ -160,8 +169,8 @@ public class DreamBackend {
setBoolean(SCREENSAVER_ACTIVATE_ON_SLEEP, value);
}
- private boolean getBoolean(String key) {
- return Settings.Secure.getInt(mContext.getContentResolver(), key, 1) == 1;
+ private boolean getBoolean(String key, boolean def) {
+ return Settings.Secure.getInt(mContext.getContentResolver(), key, def ? 1 : 0) == 1;
}
private void setBoolean(String key, boolean value) {