Loading api/current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -20056,6 +20056,7 @@ package android.service.dreams { method public void setContentView(android.view.View, android.view.ViewGroup.LayoutParams); method public void setInteractive(boolean); field public static final java.lang.String SERVICE_INTERFACE = "android.service.dreams.Dream"; field public static final java.lang.String METADATA_NAME_CONFIG_ACTIVITY = "android.service.dreams.config_activity"; } } core/java/android/provider/Settings.java +19 −6 Original line number Diff line number Diff line Loading @@ -4248,27 +4248,40 @@ public final class Settings { "setup_prepaid_detection_redir_host"; /** * Whether the screensaver is enabled. * Whether screensavers are enabled. * @hide */ public static final String SCREENSAVER_ENABLED = "screensaver_enabled"; /** * The user's chosen screensaver component. * The user's chosen screensaver components. * * This component will be launched by the PhoneWindowManager after a timeout when not on * These will be launched by the PhoneWindowManager after a timeout when not on * battery, or upon dock insertion (if SCREENSAVER_ACTIVATE_ON_DOCK is set to 1). * @hide */ public static final String SCREENSAVER_COMPONENT = "screensaver_component"; public static final String SCREENSAVER_COMPONENTS = "screensaver_components"; /** * Whether the screensaver should be automatically launched when the device is inserted * into a (desk) dock. * If screensavers are enabled, whether the screensaver should be automatically launched * when the device is inserted into a (desk) dock. * @hide */ public static final String SCREENSAVER_ACTIVATE_ON_DOCK = "screensaver_activate_on_dock"; /** * If screensavers are enabled, whether the screensaver should be automatically launched * when the screen times out when not on battery. * @hide */ public static final String SCREENSAVER_ACTIVATE_ON_SLEEP = "screensaver_activate_on_sleep"; /** * If screensavers are enabled, the default screensaver component. * @hide */ public static final String SCREENSAVER_DEFAULT_COMPONENT = "screensaver_default_component"; /** {@hide} */ public static final String NETSTATS_ENABLED = "netstats_enabled"; /** {@hide} */ Loading core/java/android/service/dreams/Dream.java +4 −0 Original line number Diff line number Diff line Loading @@ -56,6 +56,10 @@ public class Dream extends Service implements Window.Callback { public static final String SERVICE_INTERFACE = "android.service.dreams.Dream"; /** Service meta-data key for declaring an optional configuration activity. */ public static final String METADATA_NAME_CONFIG_ACTIVITY = "android.service.dreams.config_activity"; private Window mWindow; private WindowManager mWindowManager; Loading core/java/android/service/dreams/DreamManagerService.java +38 −13 Original line number Diff line number Diff line package android.service.dreams; import static android.provider.Settings.Secure.SCREENSAVER_COMPONENT; import static android.provider.Settings.Secure.SCREENSAVER_COMPONENTS; import static android.provider.Settings.Secure.SCREENSAVER_DEFAULT_COMPONENT; import java.io.FileDescriptor; import java.io.PrintWriter; Loading Loading @@ -58,7 +58,8 @@ public class DreamManagerService // IDreamManager method @Override public void dream() { ComponentName name = getDreamComponent(); ComponentName[] dreams = getDreamComponents(); ComponentName name = dreams != null && dreams.length > 0 ? dreams[0] : null; if (name != null) { synchronized (mLock) { final long ident = Binder.clearCallingIdentity(); Loading @@ -73,21 +74,45 @@ public class DreamManagerService // IDreamManager method @Override public void setDreamComponent(ComponentName name) { Settings.Secure.putString(mContext.getContentResolver(), SCREENSAVER_COMPONENT, name.flattenToString()); public void setDreamComponents(ComponentName[] componentNames) { Settings.Secure.putString(mContext.getContentResolver(), SCREENSAVER_COMPONENTS, componentsToString(componentNames)); } private static String componentsToString(ComponentName[] componentNames) { StringBuilder names = new StringBuilder(); if (componentNames != null) { for (ComponentName componentName : componentNames) { if (names.length() > 0) names.append(','); names.append(componentName.flattenToString()); } } return names.toString(); } private static ComponentName[] componentsFromString(String names) { String[] namesArray = names.split(","); ComponentName[] componentNames = new ComponentName[namesArray.length]; for (int i = 0; i < namesArray.length; i++) componentNames[i] = ComponentName.unflattenFromString(namesArray[i]); return componentNames; } // IDreamManager method @Override public ComponentName getDreamComponent() { public ComponentName[] getDreamComponents() { // TODO(dsandler) don't load this every time, watch the value String component = Settings.Secure.getString(mContext.getContentResolver(), SCREENSAVER_COMPONENT); if (component != null) { return ComponentName.unflattenFromString(component); } else { // We rely on DatabaseHelper to set a sane default for us when the settings DB is upgraded return null; String names = Settings.Secure.getString(mContext.getContentResolver(), SCREENSAVER_COMPONENTS); return componentsFromString(names); } // IDreamManager method @Override public ComponentName getDefaultDreamComponent() { String name = Settings.Secure.getString(mContext.getContentResolver(), SCREENSAVER_DEFAULT_COMPONENT); return name == null ? null : ComponentName.unflattenFromString(name); } // IDreamManager method Loading core/java/android/service/dreams/IDreamManager.aidl +3 −2 Original line number Diff line number Diff line Loading @@ -24,8 +24,9 @@ import android.content.ComponentName; interface IDreamManager { void dream(); void awaken(); void setDreamComponent(in ComponentName componentName); ComponentName getDreamComponent(); void setDreamComponents(in ComponentName[] componentNames); ComponentName[] getDreamComponents(); ComponentName getDefaultDreamComponent(); void testDream(in ComponentName componentName); boolean isDreaming(); } No newline at end of file Loading
api/current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -20056,6 +20056,7 @@ package android.service.dreams { method public void setContentView(android.view.View, android.view.ViewGroup.LayoutParams); method public void setInteractive(boolean); field public static final java.lang.String SERVICE_INTERFACE = "android.service.dreams.Dream"; field public static final java.lang.String METADATA_NAME_CONFIG_ACTIVITY = "android.service.dreams.config_activity"; } }
core/java/android/provider/Settings.java +19 −6 Original line number Diff line number Diff line Loading @@ -4248,27 +4248,40 @@ public final class Settings { "setup_prepaid_detection_redir_host"; /** * Whether the screensaver is enabled. * Whether screensavers are enabled. * @hide */ public static final String SCREENSAVER_ENABLED = "screensaver_enabled"; /** * The user's chosen screensaver component. * The user's chosen screensaver components. * * This component will be launched by the PhoneWindowManager after a timeout when not on * These will be launched by the PhoneWindowManager after a timeout when not on * battery, or upon dock insertion (if SCREENSAVER_ACTIVATE_ON_DOCK is set to 1). * @hide */ public static final String SCREENSAVER_COMPONENT = "screensaver_component"; public static final String SCREENSAVER_COMPONENTS = "screensaver_components"; /** * Whether the screensaver should be automatically launched when the device is inserted * into a (desk) dock. * If screensavers are enabled, whether the screensaver should be automatically launched * when the device is inserted into a (desk) dock. * @hide */ public static final String SCREENSAVER_ACTIVATE_ON_DOCK = "screensaver_activate_on_dock"; /** * If screensavers are enabled, whether the screensaver should be automatically launched * when the screen times out when not on battery. * @hide */ public static final String SCREENSAVER_ACTIVATE_ON_SLEEP = "screensaver_activate_on_sleep"; /** * If screensavers are enabled, the default screensaver component. * @hide */ public static final String SCREENSAVER_DEFAULT_COMPONENT = "screensaver_default_component"; /** {@hide} */ public static final String NETSTATS_ENABLED = "netstats_enabled"; /** {@hide} */ Loading
core/java/android/service/dreams/Dream.java +4 −0 Original line number Diff line number Diff line Loading @@ -56,6 +56,10 @@ public class Dream extends Service implements Window.Callback { public static final String SERVICE_INTERFACE = "android.service.dreams.Dream"; /** Service meta-data key for declaring an optional configuration activity. */ public static final String METADATA_NAME_CONFIG_ACTIVITY = "android.service.dreams.config_activity"; private Window mWindow; private WindowManager mWindowManager; Loading
core/java/android/service/dreams/DreamManagerService.java +38 −13 Original line number Diff line number Diff line package android.service.dreams; import static android.provider.Settings.Secure.SCREENSAVER_COMPONENT; import static android.provider.Settings.Secure.SCREENSAVER_COMPONENTS; import static android.provider.Settings.Secure.SCREENSAVER_DEFAULT_COMPONENT; import java.io.FileDescriptor; import java.io.PrintWriter; Loading Loading @@ -58,7 +58,8 @@ public class DreamManagerService // IDreamManager method @Override public void dream() { ComponentName name = getDreamComponent(); ComponentName[] dreams = getDreamComponents(); ComponentName name = dreams != null && dreams.length > 0 ? dreams[0] : null; if (name != null) { synchronized (mLock) { final long ident = Binder.clearCallingIdentity(); Loading @@ -73,21 +74,45 @@ public class DreamManagerService // IDreamManager method @Override public void setDreamComponent(ComponentName name) { Settings.Secure.putString(mContext.getContentResolver(), SCREENSAVER_COMPONENT, name.flattenToString()); public void setDreamComponents(ComponentName[] componentNames) { Settings.Secure.putString(mContext.getContentResolver(), SCREENSAVER_COMPONENTS, componentsToString(componentNames)); } private static String componentsToString(ComponentName[] componentNames) { StringBuilder names = new StringBuilder(); if (componentNames != null) { for (ComponentName componentName : componentNames) { if (names.length() > 0) names.append(','); names.append(componentName.flattenToString()); } } return names.toString(); } private static ComponentName[] componentsFromString(String names) { String[] namesArray = names.split(","); ComponentName[] componentNames = new ComponentName[namesArray.length]; for (int i = 0; i < namesArray.length; i++) componentNames[i] = ComponentName.unflattenFromString(namesArray[i]); return componentNames; } // IDreamManager method @Override public ComponentName getDreamComponent() { public ComponentName[] getDreamComponents() { // TODO(dsandler) don't load this every time, watch the value String component = Settings.Secure.getString(mContext.getContentResolver(), SCREENSAVER_COMPONENT); if (component != null) { return ComponentName.unflattenFromString(component); } else { // We rely on DatabaseHelper to set a sane default for us when the settings DB is upgraded return null; String names = Settings.Secure.getString(mContext.getContentResolver(), SCREENSAVER_COMPONENTS); return componentsFromString(names); } // IDreamManager method @Override public ComponentName getDefaultDreamComponent() { String name = Settings.Secure.getString(mContext.getContentResolver(), SCREENSAVER_DEFAULT_COMPONENT); return name == null ? null : ComponentName.unflattenFromString(name); } // IDreamManager method Loading
core/java/android/service/dreams/IDreamManager.aidl +3 −2 Original line number Diff line number Diff line Loading @@ -24,8 +24,9 @@ import android.content.ComponentName; interface IDreamManager { void dream(); void awaken(); void setDreamComponent(in ComponentName componentName); ComponentName getDreamComponent(); void setDreamComponents(in ComponentName[] componentNames); ComponentName[] getDreamComponents(); ComponentName getDefaultDreamComponent(); void testDream(in ComponentName componentName); boolean isDreaming(); } No newline at end of file