diff options
Diffstat (limited to 'services/java')
3 files changed, 46 insertions, 1 deletions
diff --git a/services/java/com/android/server/PowerManagerService.java b/services/java/com/android/server/PowerManagerService.java index 52a4110..bebce7e 100644 --- a/services/java/com/android/server/PowerManagerService.java +++ b/services/java/com/android/server/PowerManagerService.java @@ -1752,7 +1752,7 @@ public class PowerManagerService extends IPowerManager.Stub + " noChangeLights=" + noChangeLights + " reason=" + reason); } - + if (noChangeLights) { newState = (newState & ~LIGHTS_MASK) | (mPowerState & LIGHTS_MASK); } @@ -1794,6 +1794,19 @@ public class PowerManagerService extends IPowerManager.Stub final boolean stateChanged = mPowerState != newState; + if (stateChanged && reason == WindowManagerPolicy.OFF_BECAUSE_OF_TIMEOUT) { + if (mPolicy.isScreenSaverEnabled()) { + if (mSpew) { + Slog.d(TAG, "setPowerState: running screen saver instead of turning off screen"); + } + if (mPolicy.startScreenSaver()) { + // was successful + return; + } + } + } + + if (oldScreenOn != newScreenOn) { if (newScreenOn) { // When the user presses the power button, we need to always send out the diff --git a/services/java/com/android/server/SystemServer.java b/services/java/com/android/server/SystemServer.java index 7dd736d..68bbb571 100644 --- a/services/java/com/android/server/SystemServer.java +++ b/services/java/com/android/server/SystemServer.java @@ -38,6 +38,7 @@ import android.provider.Settings; import android.server.BluetoothA2dpService; import android.server.BluetoothService; import android.server.search.SearchManagerService; +import android.service.dreams.DreamManagerService; import android.util.DisplayMetrics; import android.util.EventLog; import android.util.Log; @@ -269,6 +270,7 @@ class ServerThread extends Thread { CountryDetectorService countryDetector = null; TextServicesManagerService tsms = null; LockSettingsService lockSettings = null; + DreamManagerService dreamy = null; // Bring up services needed for UI. if (factoryTest != SystemServer.FACTORY_TEST_LOW_LEVEL) { @@ -613,6 +615,18 @@ class ServerThread extends Thread { } catch (Throwable e) { reportWtf("starting CommonTimeManagementService service", e); } + + if (context.getResources().getBoolean( + com.android.internal.R.bool.config_enableDreams)) { + try { + Slog.i(TAG, "Dreams Service"); + // Dreams (interactive idle-time views, a/k/a screen savers) + dreamy = new DreamManagerService(context); + ServiceManager.addService("dreams", dreamy); + } catch (Throwable e) { + reportWtf("starting DreamManagerService", e); + } + } } // Before things start rolling, be sure we have decided whether @@ -699,6 +713,7 @@ class ServerThread extends Thread { final CommonTimeManagementService commonTimeMgmtServiceF = commonTimeMgmtService; final TextServicesManagerService textServiceManagerServiceF = tsms; final StatusBarManagerService statusBarF = statusBar; + final DreamManagerService dreamyF = dreamy; // We now tell the activity manager it is okay to run third party // code. It will call back into us once it has gotten to the state @@ -805,6 +820,11 @@ class ServerThread extends Thread { } catch (Throwable e) { reportWtf("making Text Services Manager Service ready", e); } + try { + if (dreamyF != null) dreamyF.systemReady(); + } catch (Throwable e) { + reportWtf("making DreamManagerService ready", e); + } } }); diff --git a/services/java/com/android/server/wm/WindowManagerService.java b/services/java/com/android/server/wm/WindowManagerService.java index 6f7852d..5fa8111 100644 --- a/services/java/com/android/server/wm/WindowManagerService.java +++ b/services/java/com/android/server/wm/WindowManagerService.java @@ -28,6 +28,7 @@ import static android.view.WindowManager.LayoutParams.LAST_APPLICATION_WINDOW; import static android.view.WindowManager.LayoutParams.LAST_SUB_WINDOW; import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_STARTING; import static android.view.WindowManager.LayoutParams.TYPE_BASE_APPLICATION; +import static android.view.WindowManager.LayoutParams.TYPE_DREAM; import static android.view.WindowManager.LayoutParams.TYPE_INPUT_METHOD; import static android.view.WindowManager.LayoutParams.TYPE_INPUT_METHOD_DIALOG; import static android.view.WindowManager.LayoutParams.TYPE_WALLPAPER; @@ -2131,6 +2132,11 @@ public class WindowManagerService extends IWindowManager.Stub + attrs.token + ". Aborting."); return WindowManagerImpl.ADD_BAD_APP_TOKEN; } + if (attrs.type == TYPE_DREAM) { + Slog.w(TAG, "Attempted to add Dream window with unknown token " + + attrs.token + ". Aborting."); + return WindowManagerImpl.ADD_BAD_APP_TOKEN; + } token = new WindowToken(this, attrs.token, -1, false); addToken = true; } else if (attrs.type >= FIRST_APPLICATION_WINDOW @@ -2163,6 +2169,12 @@ public class WindowManagerService extends IWindowManager.Stub + attrs.token + ". Aborting."); return WindowManagerImpl.ADD_BAD_APP_TOKEN; } + } else if (attrs.type == TYPE_DREAM) { + if (token.windowType != TYPE_DREAM) { + Slog.w(TAG, "Attempted to add Dream window with bad token " + + attrs.token + ". Aborting."); + return WindowManagerImpl.ADD_BAD_APP_TOKEN; + } } win = new WindowState(this, session, client, token, |