PowerManagerInternal.java revision 5ce1cb240b13db98fbdc21e1ef069b5f9cec8d72
1/*
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
19import android.view.Display;
20
21/**
22 * Power manager local system service interface.
23 *
24 * @hide Only for use within the system server.
25 */
26public abstract class PowerManagerInternal {
27    /**
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     */
35    public abstract void setScreenBrightnessOverrideFromWindowManager(int brightness);
36
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     */
45    public abstract void setButtonBrightnessOverrideFromWindowManager(int brightness);
46
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     */
56    public abstract void setUserActivityTimeoutOverrideFromWindowManager(long timeoutMillis);
57
58    /**
59     * Used by device administration to set the maximum screen off timeout.
60     *
61     * This method must only be called by the device administration policy manager.
62     */
63    public abstract void setMaximumScreenOffTimeoutFromDeviceAdmin(int timeMs);
64
65    /**
66     * Used by the dream manager to override certain properties while dozing.
67     *
68     * @param screenState The overridden screen state, or {@link Display.STATE_UNKNOWN}
69     * to disable the override.
70     * @param screenBrightness The overridden screen brightness, or
71     * {@link PowerManager#BRIGHTNESS_DEFAULT} to disable the override.
72     */
73    public abstract void setDozeOverrideFromDreamManager(
74            int screenState, int screenBrightness);
75
76    public abstract boolean getLowPowerModeEnabled();
77
78    public abstract void registerLowPowerModeObserver(LowPowerModeListener listener);
79
80    public interface LowPowerModeListener {
81        public void onLowPowerModeChanged(boolean enabled);
82    }
83}
84