Jeff Brown | 4ccb823 | 2014-01-16 22:16:42 -0800 | [diff] [blame] | 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 | |
| 17 | package android.hardware.display; |
| 18 | |
Jeff Brown | ad9ef19 | 2014-04-08 17:26:30 -0700 | [diff] [blame] | 19 | import android.hardware.SensorManager; |
| 20 | import android.os.Handler; |
| 21 | import android.os.PowerManager; |
Andrii Kulian | fb1bf69 | 2017-01-17 11:17:34 -0800 | [diff] [blame] | 22 | import android.util.IntArray; |
| 23 | import android.util.SparseArray; |
Jeff Brown | 970d413 | 2014-07-19 11:33:47 -0700 | [diff] [blame] | 24 | import android.view.Display; |
Jeff Brown | 4ccb823 | 2014-01-16 22:16:42 -0800 | [diff] [blame] | 25 | import android.view.DisplayInfo; |
| 26 | |
| 27 | /** |
| 28 | * Display manager local system service interface. |
| 29 | * |
| 30 | * @hide Only for use within the system server. |
| 31 | */ |
| 32 | public abstract class DisplayManagerInternal { |
| 33 | /** |
Jeff Brown | ad9ef19 | 2014-04-08 17:26:30 -0700 | [diff] [blame] | 34 | * Called by the power manager to initialize power management facilities. |
| 35 | */ |
| 36 | public abstract void initPowerManagement(DisplayPowerCallbacks callbacks, |
| 37 | Handler handler, SensorManager sensorManager); |
| 38 | |
| 39 | /** |
| 40 | * Called by the power manager to request a new power state. |
| 41 | * <p> |
| 42 | * The display power controller makes a copy of the provided object and then |
| 43 | * begins adjusting the power state to match what was requested. |
| 44 | * </p> |
| 45 | * |
| 46 | * @param request The requested power state. |
| 47 | * @param waitForNegativeProximity If true, issues a request to wait for |
| 48 | * negative proximity before turning the screen back on, assuming the screen |
| 49 | * was turned off by the proximity sensor. |
| 50 | * @return True if display is ready, false if there are important changes that must |
| 51 | * be made asynchronously (such as turning the screen on), in which case the caller |
| 52 | * should grab a wake lock, watch for {@link DisplayPowerCallbacks#onStateChanged()} |
| 53 | * then try the request again later until the state converges. |
| 54 | */ |
| 55 | public abstract boolean requestPowerState(DisplayPowerRequest request, |
| 56 | boolean waitForNegativeProximity); |
| 57 | |
| 58 | /** |
| 59 | * Returns true if the proximity sensor screen-off function is available. |
| 60 | */ |
| 61 | public abstract boolean isProximitySensorAvailable(); |
| 62 | |
| 63 | /** |
Jeff Brown | 4ccb823 | 2014-01-16 22:16:42 -0800 | [diff] [blame] | 64 | * Returns information about the specified logical display. |
| 65 | * |
| 66 | * @param displayId The logical display id. |
| 67 | * @return The logical display info, or null if the display does not exist. The |
| 68 | * returned object must be treated as immutable. |
| 69 | */ |
| 70 | public abstract DisplayInfo getDisplayInfo(int displayId); |
| 71 | |
| 72 | /** |
| 73 | * Registers a display transaction listener to provide the client a chance to |
| 74 | * update its surfaces within the same transaction as any display layout updates. |
| 75 | * |
| 76 | * @param listener The listener to register. |
| 77 | */ |
| 78 | public abstract void registerDisplayTransactionListener(DisplayTransactionListener listener); |
| 79 | |
| 80 | /** |
| 81 | * Unregisters a display transaction listener to provide the client a chance to |
| 82 | * update its surfaces within the same transaction as any display layout updates. |
| 83 | * |
| 84 | * @param listener The listener to unregister. |
| 85 | */ |
| 86 | public abstract void unregisterDisplayTransactionListener(DisplayTransactionListener listener); |
| 87 | |
| 88 | /** |
| 89 | * Overrides the display information of a particular logical display. |
| 90 | * This is used by the window manager to control the size and characteristics |
| 91 | * of the default display. It is expected to apply the requested change |
| 92 | * to the display information synchronously so that applications will immediately |
| 93 | * observe the new state. |
| 94 | * |
| 95 | * NOTE: This method must be the only entry point by which the window manager |
| 96 | * influences the logical configuration of displays. |
| 97 | * |
| 98 | * @param displayId The logical display id. |
| 99 | * @param info The new data to be stored. |
| 100 | */ |
| 101 | public abstract void setDisplayInfoOverrideFromWindowManager( |
| 102 | int displayId, DisplayInfo info); |
| 103 | |
| 104 | /** |
Andrii Kulian | cd09799 | 2017-03-23 18:31:59 -0700 | [diff] [blame] | 105 | * Get current display info without override from WindowManager. |
| 106 | * Current implementation of LogicalDisplay#getDisplayInfoLocked() always returns display info |
| 107 | * with overrides from WM if set. This method can be used for getting real display size without |
| 108 | * overrides to determine if real changes to display metrics happened. |
| 109 | * @param displayId Id of the target display. |
| 110 | * @param outInfo {@link DisplayInfo} to fill. |
| 111 | */ |
| 112 | public abstract void getNonOverrideDisplayInfo(int displayId, DisplayInfo outInfo); |
| 113 | |
| 114 | /** |
Jeff Brown | 4ccb823 | 2014-01-16 22:16:42 -0800 | [diff] [blame] | 115 | * Called by the window manager to perform traversals while holding a |
| 116 | * surface flinger transaction. |
| 117 | */ |
| 118 | public abstract void performTraversalInTransactionFromWindowManager(); |
| 119 | |
| 120 | /** |
Michael Wright | 3f145a2 | 2014-07-22 19:46:03 -0700 | [diff] [blame] | 121 | * Tells the display manager about properties of the display that depend on the windows on it. |
| 122 | * This includes whether there is interesting unique content on the specified logical display, |
| 123 | * and whether the one of the windows has a preferred refresh rate. |
Jeff Brown | 4ccb823 | 2014-01-16 22:16:42 -0800 | [diff] [blame] | 124 | * <p> |
| 125 | * If the display has unique content, then the display manager arranges for it |
| 126 | * to be presented on a physical display if appropriate. Otherwise, the display manager |
| 127 | * may choose to make the physical display mirror some other logical display. |
| 128 | * </p> |
| 129 | * |
Michael Wright | 3f145a2 | 2014-07-22 19:46:03 -0700 | [diff] [blame] | 130 | * <p> |
| 131 | * If one of the windows on the display has a preferred refresh rate that's supported by the |
| 132 | * display, then the display manager will request its use. |
| 133 | * </p> |
| 134 | * |
Jeff Brown | 4ccb823 | 2014-01-16 22:16:42 -0800 | [diff] [blame] | 135 | * @param displayId The logical display id to update. |
Michael Wright | 3f145a2 | 2014-07-22 19:46:03 -0700 | [diff] [blame] | 136 | * @param hasContent True if the logical display has content. This is used to control automatic |
| 137 | * mirroring. |
| 138 | * @param requestedRefreshRate The preferred refresh rate for the top-most visible window that |
| 139 | * has a preference. |
P.Y. Laligand | 5c7773d | 2015-05-04 13:30:58 -0700 | [diff] [blame] | 140 | * @param requestedModeId The preferred mode id for the top-most visible window that has a |
| 141 | * preference. |
Jeff Brown | 4ccb823 | 2014-01-16 22:16:42 -0800 | [diff] [blame] | 142 | * @param inTraversal True if called from WindowManagerService during a window traversal |
| 143 | * prior to call to performTraversalInTransactionFromWindowManager. |
| 144 | */ |
Michael Wright | 3f145a2 | 2014-07-22 19:46:03 -0700 | [diff] [blame] | 145 | public abstract void setDisplayProperties(int displayId, boolean hasContent, |
P.Y. Laligand | 5c7773d | 2015-05-04 13:30:58 -0700 | [diff] [blame] | 146 | float requestedRefreshRate, int requestedModeId, boolean inTraversal); |
Jeff Brown | 4ccb823 | 2014-01-16 22:16:42 -0800 | [diff] [blame] | 147 | |
| 148 | /** |
Filip Gruszczynski | d2e8640 | 2015-02-19 13:05:03 -0800 | [diff] [blame] | 149 | * Applies an offset to the contents of a display, for example to avoid burn-in. |
| 150 | * <p> |
| 151 | * TODO: Technically this should be associated with a physical rather than logical |
| 152 | * display but this is good enough for now. |
| 153 | * </p> |
| 154 | * |
| 155 | * @param displayId The logical display id to update. |
| 156 | * @param x The X offset by which to shift the contents of the display. |
| 157 | * @param y The Y offset by which to shift the contents of the display. |
| 158 | */ |
| 159 | public abstract void setDisplayOffsets(int displayId, int x, int y); |
| 160 | |
| 161 | /** |
Andrii Kulian | fb1bf69 | 2017-01-17 11:17:34 -0800 | [diff] [blame] | 162 | * Provide a list of UIDs that are present on the display and are allowed to access it. |
| 163 | * |
| 164 | * @param displayAccessUIDs Mapping displayId -> int array of UIDs. |
| 165 | */ |
| 166 | public abstract void setDisplayAccessUIDs(SparseArray<IntArray> displayAccessUIDs); |
| 167 | |
| 168 | /** |
| 169 | * Check if specified UID's content is present on display and should be granted access to it. |
| 170 | * |
| 171 | * @param uid UID to be checked. |
| 172 | * @param displayId id of the display where presence of the content is checked. |
| 173 | * */ |
| 174 | public abstract boolean isUidPresentOnDisplay(int uid, int displayId); |
| 175 | |
| 176 | /** |
Kenny Guy | cfe7b70 | 2017-11-14 21:04:58 +0000 | [diff] [blame] | 177 | * Persist brightness slider events. |
| 178 | */ |
| 179 | public abstract void persistBrightnessSliderEvents(); |
| 180 | |
| 181 | /** |
Adrian Roos | e1d68cd | 2018-01-17 12:54:50 +0100 | [diff] [blame] | 182 | * Notifies the display manager that resource overlays have changed. |
| 183 | */ |
| 184 | public abstract void onOverlayChanged(); |
| 185 | |
| 186 | /** |
Jeff Brown | ad9ef19 | 2014-04-08 17:26:30 -0700 | [diff] [blame] | 187 | * Describes the requested power state of the display. |
| 188 | * |
| 189 | * This object is intended to describe the general characteristics of the |
| 190 | * power state, such as whether the screen should be on or off and the current |
| 191 | * brightness controls leaving the DisplayPowerController to manage the |
| 192 | * details of how the transitions between states should occur. The goal is for |
| 193 | * the PowerManagerService to focus on the global power state and not |
| 194 | * have to micro-manage screen off animations, auto-brightness and other effects. |
| 195 | */ |
| 196 | public static final class DisplayPowerRequest { |
Jeff Brown | 970d413 | 2014-07-19 11:33:47 -0700 | [diff] [blame] | 197 | // Policy: Turn screen off as if the user pressed the power button |
| 198 | // including playing a screen off animation if applicable. |
| 199 | public static final int POLICY_OFF = 0; |
| 200 | // Policy: Enable dozing and always-on display functionality. |
| 201 | public static final int POLICY_DOZE = 1; |
| 202 | // Policy: Make the screen dim when the user activity timeout is |
| 203 | // about to expire. |
| 204 | public static final int POLICY_DIM = 2; |
| 205 | // Policy: Make the screen bright as usual. |
| 206 | public static final int POLICY_BRIGHT = 3; |
Santos Cordon | 3107d29 | 2016-09-20 15:50:35 -0700 | [diff] [blame] | 207 | // Policy: Keep the screen and display optimized for VR mode. |
| 208 | public static final int POLICY_VR = 4; |
Jeff Brown | ad9ef19 | 2014-04-08 17:26:30 -0700 | [diff] [blame] | 209 | |
Jeff Brown | 970d413 | 2014-07-19 11:33:47 -0700 | [diff] [blame] | 210 | // The basic overall policy to apply: off, doze, dim or bright. |
| 211 | public int policy; |
Jeff Brown | ad9ef19 | 2014-04-08 17:26:30 -0700 | [diff] [blame] | 212 | |
| 213 | // If true, the proximity sensor overrides the screen state when an object is |
| 214 | // nearby, turning it off temporarily until the object is moved away. |
| 215 | public boolean useProximitySensor; |
| 216 | |
| 217 | // The desired screen brightness in the range 0 (minimum / off) to 255 (brightest). |
| 218 | // The display power controller may choose to clamp the brightness. |
| 219 | // When auto-brightness is enabled, this field should specify a nominal default |
| 220 | // value to use while waiting for the light sensor to report enough data. |
| 221 | public int screenBrightness; |
| 222 | |
| 223 | // The screen auto-brightness adjustment factor in the range -1 (dimmer) to 1 (brighter). |
| 224 | public float screenAutoBrightnessAdjustment; |
| 225 | |
Jeff Brown | a576b4d | 2015-04-23 19:58:06 -0700 | [diff] [blame] | 226 | // Set to true if screenBrightness and screenAutoBrightnessAdjustment were both |
| 227 | // set by the user as opposed to being programmatically controlled by apps. |
| 228 | public boolean brightnessSetByUser; |
| 229 | |
Michael Wright | 144aac9 | 2017-12-21 18:37:41 +0000 | [diff] [blame] | 230 | // Set to true if screenBrightness or screenAutoBrightnessAdjustment are being set |
| 231 | // temporarily. This is typically set while the user has their finger on the brightness |
| 232 | // control, before they've selected the final brightness value. |
| 233 | public boolean brightnessIsTemporary; |
| 234 | |
Jeff Brown | ad9ef19 | 2014-04-08 17:26:30 -0700 | [diff] [blame] | 235 | // If true, enables automatic brightness control. |
| 236 | public boolean useAutoBrightness; |
| 237 | |
Jeff Brown | e333e67 | 2014-10-28 13:48:55 -0700 | [diff] [blame] | 238 | // If true, scales the brightness to half of desired. |
Ruchi Kandoi | f974cc8 | 2014-05-01 11:25:10 -0700 | [diff] [blame] | 239 | public boolean lowPowerMode; |
| 240 | |
jackqdyulei | 92681e8 | 2017-02-28 11:26:28 -0800 | [diff] [blame] | 241 | // The factor to adjust the screen brightness in low power mode in the range |
| 242 | // 0 (screen off) to 1 (no change) |
| 243 | public float screenLowPowerBrightnessFactor; |
| 244 | |
Jeff Brown | e333e67 | 2014-10-28 13:48:55 -0700 | [diff] [blame] | 245 | // If true, applies a brightness boost. |
| 246 | public boolean boostScreenBrightness; |
| 247 | |
Jeff Brown | ad9ef19 | 2014-04-08 17:26:30 -0700 | [diff] [blame] | 248 | // If true, prevents the screen from completely turning on if it is currently off. |
| 249 | // The display does not enter a "ready" state if this flag is true and screen on is |
| 250 | // blocked. The window manager policy blocks screen on while it prepares the keyguard to |
| 251 | // prevent the user from seeing intermediate updates. |
| 252 | // |
| 253 | // Technically, we may not block the screen itself from turning on (because that introduces |
| 254 | // extra unnecessary latency) but we do prevent content on screen from becoming |
| 255 | // visible to the user. |
| 256 | public boolean blockScreenOn; |
| 257 | |
Jeff Brown | 970d413 | 2014-07-19 11:33:47 -0700 | [diff] [blame] | 258 | // Overrides the policy for adjusting screen brightness and state while dozing. |
| 259 | public int dozeScreenBrightness; |
| 260 | public int dozeScreenState; |
| 261 | |
Jeff Brown | ad9ef19 | 2014-04-08 17:26:30 -0700 | [diff] [blame] | 262 | public DisplayPowerRequest() { |
Jeff Brown | 970d413 | 2014-07-19 11:33:47 -0700 | [diff] [blame] | 263 | policy = POLICY_BRIGHT; |
Jeff Brown | ad9ef19 | 2014-04-08 17:26:30 -0700 | [diff] [blame] | 264 | useProximitySensor = false; |
| 265 | screenBrightness = PowerManager.BRIGHTNESS_ON; |
| 266 | screenAutoBrightnessAdjustment = 0.0f; |
jackqdyulei | 92681e8 | 2017-02-28 11:26:28 -0800 | [diff] [blame] | 267 | screenLowPowerBrightnessFactor = 0.5f; |
Jeff Brown | ad9ef19 | 2014-04-08 17:26:30 -0700 | [diff] [blame] | 268 | useAutoBrightness = false; |
| 269 | blockScreenOn = false; |
Jeff Brown | 970d413 | 2014-07-19 11:33:47 -0700 | [diff] [blame] | 270 | dozeScreenBrightness = PowerManager.BRIGHTNESS_DEFAULT; |
| 271 | dozeScreenState = Display.STATE_UNKNOWN; |
Jeff Brown | ad9ef19 | 2014-04-08 17:26:30 -0700 | [diff] [blame] | 272 | } |
| 273 | |
| 274 | public DisplayPowerRequest(DisplayPowerRequest other) { |
| 275 | copyFrom(other); |
| 276 | } |
| 277 | |
Jeff Brown | 970d413 | 2014-07-19 11:33:47 -0700 | [diff] [blame] | 278 | public boolean isBrightOrDim() { |
| 279 | return policy == POLICY_BRIGHT || policy == POLICY_DIM; |
Jeff Brown | ad9ef19 | 2014-04-08 17:26:30 -0700 | [diff] [blame] | 280 | } |
| 281 | |
Santos Cordon | 3107d29 | 2016-09-20 15:50:35 -0700 | [diff] [blame] | 282 | public boolean isVr() { |
| 283 | return policy == POLICY_VR; |
| 284 | } |
| 285 | |
Jeff Brown | ad9ef19 | 2014-04-08 17:26:30 -0700 | [diff] [blame] | 286 | public void copyFrom(DisplayPowerRequest other) { |
Jeff Brown | 970d413 | 2014-07-19 11:33:47 -0700 | [diff] [blame] | 287 | policy = other.policy; |
Jeff Brown | ad9ef19 | 2014-04-08 17:26:30 -0700 | [diff] [blame] | 288 | useProximitySensor = other.useProximitySensor; |
| 289 | screenBrightness = other.screenBrightness; |
| 290 | screenAutoBrightnessAdjustment = other.screenAutoBrightnessAdjustment; |
jackqdyulei | 92681e8 | 2017-02-28 11:26:28 -0800 | [diff] [blame] | 291 | screenLowPowerBrightnessFactor = other.screenLowPowerBrightnessFactor; |
Jeff Brown | a576b4d | 2015-04-23 19:58:06 -0700 | [diff] [blame] | 292 | brightnessSetByUser = other.brightnessSetByUser; |
Michael Wright | 144aac9 | 2017-12-21 18:37:41 +0000 | [diff] [blame] | 293 | brightnessIsTemporary = other.brightnessIsTemporary; |
Jeff Brown | ad9ef19 | 2014-04-08 17:26:30 -0700 | [diff] [blame] | 294 | useAutoBrightness = other.useAutoBrightness; |
| 295 | blockScreenOn = other.blockScreenOn; |
Ruchi Kandoi | f974cc8 | 2014-05-01 11:25:10 -0700 | [diff] [blame] | 296 | lowPowerMode = other.lowPowerMode; |
Jeff Brown | e333e67 | 2014-10-28 13:48:55 -0700 | [diff] [blame] | 297 | boostScreenBrightness = other.boostScreenBrightness; |
Jeff Brown | 970d413 | 2014-07-19 11:33:47 -0700 | [diff] [blame] | 298 | dozeScreenBrightness = other.dozeScreenBrightness; |
| 299 | dozeScreenState = other.dozeScreenState; |
Jeff Brown | ad9ef19 | 2014-04-08 17:26:30 -0700 | [diff] [blame] | 300 | } |
| 301 | |
| 302 | @Override |
| 303 | public boolean equals(Object o) { |
| 304 | return o instanceof DisplayPowerRequest |
| 305 | && equals((DisplayPowerRequest)o); |
| 306 | } |
| 307 | |
| 308 | public boolean equals(DisplayPowerRequest other) { |
| 309 | return other != null |
Jeff Brown | 970d413 | 2014-07-19 11:33:47 -0700 | [diff] [blame] | 310 | && policy == other.policy |
Jeff Brown | ad9ef19 | 2014-04-08 17:26:30 -0700 | [diff] [blame] | 311 | && useProximitySensor == other.useProximitySensor |
| 312 | && screenBrightness == other.screenBrightness |
| 313 | && screenAutoBrightnessAdjustment == other.screenAutoBrightnessAdjustment |
jackqdyulei | 92681e8 | 2017-02-28 11:26:28 -0800 | [diff] [blame] | 314 | && screenLowPowerBrightnessFactor |
| 315 | == other.screenLowPowerBrightnessFactor |
Jeff Brown | a576b4d | 2015-04-23 19:58:06 -0700 | [diff] [blame] | 316 | && brightnessSetByUser == other.brightnessSetByUser |
Michael Wright | 144aac9 | 2017-12-21 18:37:41 +0000 | [diff] [blame] | 317 | && brightnessIsTemporary == other.brightnessIsTemporary |
Jeff Brown | ad9ef19 | 2014-04-08 17:26:30 -0700 | [diff] [blame] | 318 | && useAutoBrightness == other.useAutoBrightness |
Ruchi Kandoi | f974cc8 | 2014-05-01 11:25:10 -0700 | [diff] [blame] | 319 | && blockScreenOn == other.blockScreenOn |
Jeff Brown | 970d413 | 2014-07-19 11:33:47 -0700 | [diff] [blame] | 320 | && lowPowerMode == other.lowPowerMode |
Jeff Brown | e333e67 | 2014-10-28 13:48:55 -0700 | [diff] [blame] | 321 | && boostScreenBrightness == other.boostScreenBrightness |
Jeff Brown | 970d413 | 2014-07-19 11:33:47 -0700 | [diff] [blame] | 322 | && dozeScreenBrightness == other.dozeScreenBrightness |
Justin Klaassen | 5483cea | 2017-02-02 09:02:35 -0800 | [diff] [blame] | 323 | && dozeScreenState == other.dozeScreenState; |
Jeff Brown | ad9ef19 | 2014-04-08 17:26:30 -0700 | [diff] [blame] | 324 | } |
| 325 | |
| 326 | @Override |
| 327 | public int hashCode() { |
| 328 | return 0; // don't care |
| 329 | } |
| 330 | |
| 331 | @Override |
| 332 | public String toString() { |
Jeff Brown | 970d413 | 2014-07-19 11:33:47 -0700 | [diff] [blame] | 333 | return "policy=" + policyToString(policy) |
Jeff Brown | ad9ef19 | 2014-04-08 17:26:30 -0700 | [diff] [blame] | 334 | + ", useProximitySensor=" + useProximitySensor |
| 335 | + ", screenBrightness=" + screenBrightness |
| 336 | + ", screenAutoBrightnessAdjustment=" + screenAutoBrightnessAdjustment |
jackqdyulei | 92681e8 | 2017-02-28 11:26:28 -0800 | [diff] [blame] | 337 | + ", screenLowPowerBrightnessFactor=" + screenLowPowerBrightnessFactor |
Jeff Brown | a576b4d | 2015-04-23 19:58:06 -0700 | [diff] [blame] | 338 | + ", brightnessSetByUser=" + brightnessSetByUser |
Michael Wright | 144aac9 | 2017-12-21 18:37:41 +0000 | [diff] [blame] | 339 | + ", brightnessIsTemporary=" + brightnessIsTemporary |
Jeff Brown | ad9ef19 | 2014-04-08 17:26:30 -0700 | [diff] [blame] | 340 | + ", useAutoBrightness=" + useAutoBrightness |
Ruchi Kandoi | f974cc8 | 2014-05-01 11:25:10 -0700 | [diff] [blame] | 341 | + ", blockScreenOn=" + blockScreenOn |
Jeff Brown | 970d413 | 2014-07-19 11:33:47 -0700 | [diff] [blame] | 342 | + ", lowPowerMode=" + lowPowerMode |
Jeff Brown | e333e67 | 2014-10-28 13:48:55 -0700 | [diff] [blame] | 343 | + ", boostScreenBrightness=" + boostScreenBrightness |
Jeff Brown | 970d413 | 2014-07-19 11:33:47 -0700 | [diff] [blame] | 344 | + ", dozeScreenBrightness=" + dozeScreenBrightness |
Justin Klaassen | 5483cea | 2017-02-02 09:02:35 -0800 | [diff] [blame] | 345 | + ", dozeScreenState=" + Display.stateToString(dozeScreenState); |
Jeff Brown | 970d413 | 2014-07-19 11:33:47 -0700 | [diff] [blame] | 346 | } |
| 347 | |
| 348 | public static String policyToString(int policy) { |
| 349 | switch (policy) { |
| 350 | case POLICY_OFF: |
| 351 | return "OFF"; |
| 352 | case POLICY_DOZE: |
| 353 | return "DOZE"; |
| 354 | case POLICY_DIM: |
| 355 | return "DIM"; |
| 356 | case POLICY_BRIGHT: |
| 357 | return "BRIGHT"; |
Santos Cordon | 3107d29 | 2016-09-20 15:50:35 -0700 | [diff] [blame] | 358 | case POLICY_VR: |
| 359 | return "VR"; |
Jeff Brown | 970d413 | 2014-07-19 11:33:47 -0700 | [diff] [blame] | 360 | default: |
| 361 | return Integer.toString(policy); |
| 362 | } |
Jeff Brown | ad9ef19 | 2014-04-08 17:26:30 -0700 | [diff] [blame] | 363 | } |
| 364 | } |
| 365 | |
| 366 | /** |
| 367 | * Asynchronous callbacks from the power controller to the power manager service. |
| 368 | */ |
| 369 | public interface DisplayPowerCallbacks { |
| 370 | void onStateChanged(); |
| 371 | void onProximityPositive(); |
| 372 | void onProximityNegative(); |
Jeff Brown | 037c33e | 2014-04-09 00:31:55 -0700 | [diff] [blame] | 373 | void onDisplayStateChange(int state); // one of the Display state constants |
Jeff Brown | ad9ef19 | 2014-04-08 17:26:30 -0700 | [diff] [blame] | 374 | |
| 375 | void acquireSuspendBlocker(); |
| 376 | void releaseSuspendBlocker(); |
Jeff Brown | ad9ef19 | 2014-04-08 17:26:30 -0700 | [diff] [blame] | 377 | } |
| 378 | |
| 379 | /** |
Jeff Brown | 4ccb823 | 2014-01-16 22:16:42 -0800 | [diff] [blame] | 380 | * Called within a Surface transaction whenever the size or orientation of a |
| 381 | * display may have changed. Provides an opportunity for the client to |
| 382 | * update the position of its surfaces as part of the same transaction. |
| 383 | */ |
| 384 | public interface DisplayTransactionListener { |
| 385 | void onDisplayTransaction(); |
| 386 | } |
| 387 | } |