blob: 14f4a83e29ec3187cc649cd050ce4c71ebadc31c [file] [log] [blame]
Jeff Brown6f357d32014-01-15 20:40:55 -08001/*
2 * Copyright (C) 2014 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package android.os;
18
Jeff Brown970d4132014-07-19 11:33:47 -070019import android.view.Display;
20
Jeff Brown6f357d32014-01-15 20:40:55 -080021/**
22 * Power manager local system service interface.
23 *
24 * @hide Only for use within the system server.
25 */
Jeff Brown4ccb8232014-01-16 22:16:42 -080026public abstract class PowerManagerInternal {
Jeff Brown6f357d32014-01-15 20:40:55 -080027 /**
28 * Used by the window manager to override the screen brightness based on the
29 * current foreground activity.
30 *
31 * This method must only be called by the window manager.
32 *
33 * @param brightness The overridden brightness, or -1 to disable the override.
34 */
Jeff Brown4ccb8232014-01-16 22:16:42 -080035 public abstract void setScreenBrightnessOverrideFromWindowManager(int brightness);
Jeff Brown6f357d32014-01-15 20:40:55 -080036
37 /**
38 * Used by the window manager to override the button brightness based on the
39 * current foreground activity.
40 *
41 * This method must only be called by the window manager.
42 *
43 * @param brightness The overridden brightness, or -1 to disable the override.
44 */
Jeff Brown4ccb8232014-01-16 22:16:42 -080045 public abstract void setButtonBrightnessOverrideFromWindowManager(int brightness);
Jeff Brown6f357d32014-01-15 20:40:55 -080046
47 /**
48 * Used by the window manager to override the user activity timeout based on the
49 * current foreground activity. It can only be used to make the timeout shorter
50 * than usual, not longer.
51 *
52 * This method must only be called by the window manager.
53 *
54 * @param timeoutMillis The overridden timeout, or -1 to disable the override.
55 */
Jeff Brown4ccb8232014-01-16 22:16:42 -080056 public abstract void setUserActivityTimeoutOverrideFromWindowManager(long timeoutMillis);
Jeff Brown6f357d32014-01-15 20:40:55 -080057
Jeff Brown970d4132014-07-19 11:33:47 -070058 /**
59 * Used by the dream manager to override certain properties while dozing.
60 *
61 * @param screenState The overridden screen state, or {@link Display.STATE_UNKNOWN}
62 * to disable the override.
63 * @param screenBrightness The overridden screen brightness, or
64 * {@link PowerManager#BRIGHTNESS_DEFAULT} to disable the override.
65 */
66 public abstract void setDozeOverrideFromDreamManager(
67 int screenState, int screenBrightness);
68
Dianne Hackborncbefd8d2014-05-14 11:42:00 -070069 public abstract boolean getLowPowerModeEnabled();
70
Jeff Brown2c43c332014-06-12 22:38:59 -070071 public abstract void registerLowPowerModeObserver(LowPowerModeListener listener);
72
Dianne Hackborncbefd8d2014-05-14 11:42:00 -070073 public interface LowPowerModeListener {
74 public void onLowPowerModeChanged(boolean enabled);
75 }
Jeff Brown6f357d32014-01-15 20:40:55 -080076}