• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2012 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 
19 import android.content.pm.ParceledListSlice;
20 import android.graphics.Point;
21 import android.hardware.OverlayProperties;
22 import android.hardware.display.BrightnessConfiguration;
23 import android.hardware.display.BrightnessInfo;
24 import android.hardware.display.Curve;
25 import android.hardware.graphics.common.DisplayDecorationSupport;
26 import android.hardware.display.DisplayTopology;
27 import android.hardware.display.HdrConversionMode;
28 import android.hardware.display.IDisplayManagerCallback;
29 import android.hardware.display.IVirtualDisplayCallback;
30 import android.hardware.display.VirtualDisplayConfig;
31 import android.hardware.display.WifiDisplay;
32 import android.hardware.display.WifiDisplayStatus;
33 import android.media.projection.IMediaProjection;
34 import android.view.Display.Mode;
35 import android.view.DisplayInfo;
36 import android.view.Surface;
37 
38 /** @hide */
39 interface IDisplayManager {
40     @UnsupportedAppUsage
getDisplayInfo(int displayId)41     DisplayInfo getDisplayInfo(int displayId);
getDisplayIds(boolean includeDisabled)42     int[] getDisplayIds(boolean includeDisabled);
43 
isUidPresentOnDisplay(int uid, int displayId)44     boolean isUidPresentOnDisplay(int uid, int displayId);
45 
registerCallback(in IDisplayManagerCallback callback)46     void registerCallback(in IDisplayManagerCallback callback);
registerCallbackWithEventMask(in IDisplayManagerCallback callback, long eventsMask)47     void registerCallbackWithEventMask(in IDisplayManagerCallback callback, long eventsMask);
48 
49     // Requires CONFIGURE_WIFI_DISPLAY permission.
50     // The process must have previously registered a callback.
51     @EnforcePermission("CONFIGURE_WIFI_DISPLAY")
startWifiDisplayScan()52     void startWifiDisplayScan();
53 
54     // Requires CONFIGURE_WIFI_DISPLAY permission.
55     @EnforcePermission("CONFIGURE_WIFI_DISPLAY")
stopWifiDisplayScan()56     void stopWifiDisplayScan();
57 
58     // Requires CONFIGURE_WIFI_DISPLAY permission.
59     @EnforcePermission("CONFIGURE_WIFI_DISPLAY")
connectWifiDisplay(String address)60     void connectWifiDisplay(String address);
61 
62     // No permissions required.
disconnectWifiDisplay()63     void disconnectWifiDisplay();
64 
65     // Requires CONFIGURE_WIFI_DISPLAY permission.
66     @EnforcePermission("CONFIGURE_WIFI_DISPLAY")
renameWifiDisplay(String address, String alias)67     void renameWifiDisplay(String address, String alias);
68 
69     // Requires CONFIGURE_WIFI_DISPLAY permission.
70     @EnforcePermission("CONFIGURE_WIFI_DISPLAY")
forgetWifiDisplay(String address)71     void forgetWifiDisplay(String address);
72 
73     // Requires CONFIGURE_WIFI_DISPLAY permission.
74     @EnforcePermission("CONFIGURE_WIFI_DISPLAY")
pauseWifiDisplay()75     void pauseWifiDisplay();
76 
77     // Requires CONFIGURE_WIFI_DISPLAY permission.
78     @EnforcePermission("CONFIGURE_WIFI_DISPLAY")
resumeWifiDisplay()79     void resumeWifiDisplay();
80 
81     // No permissions required.
getWifiDisplayStatus()82     WifiDisplayStatus getWifiDisplayStatus();
83 
84     // Requires WRITE_SECURE_SETTINGS permission.
85     @EnforcePermission("WRITE_SECURE_SETTINGS")
setUserDisabledHdrTypes(in int[] userDisabledTypes)86     void setUserDisabledHdrTypes(in int[] userDisabledTypes);
87 
88     // Requires WRITE_SECURE_SETTINGS permission.
89     @EnforcePermission("WRITE_SECURE_SETTINGS")
setAreUserDisabledHdrTypesAllowed(boolean areUserDisabledHdrTypesAllowed)90     void setAreUserDisabledHdrTypesAllowed(boolean areUserDisabledHdrTypesAllowed);
91 
92     // No permissions required.
areUserDisabledHdrTypesAllowed()93     boolean areUserDisabledHdrTypesAllowed();
94 
95     // No permissions required.
getUserDisabledHdrTypes()96     int[] getUserDisabledHdrTypes();
97 
98     // Requires ACCESS_SURFACE_FLINGER permission.
overrideHdrTypes(int displayId, in int[] modes)99     void overrideHdrTypes(int displayId, in int[] modes);
100 
101     // Requires CONFIGURE_DISPLAY_COLOR_MODE
102     @EnforcePermission("CONFIGURE_DISPLAY_COLOR_MODE")
requestColorMode(int displayId, int colorMode)103     void requestColorMode(int displayId, int colorMode);
104 
105     // Requires CAPTURE_VIDEO_OUTPUT, CAPTURE_SECURE_VIDEO_OUTPUT, or an appropriate
106     // MediaProjection token for certain combinations of flags.
createVirtualDisplay(in VirtualDisplayConfig virtualDisplayConfig, in IVirtualDisplayCallback callback, in IMediaProjection projectionToken, String packageName)107     int createVirtualDisplay(in VirtualDisplayConfig virtualDisplayConfig,
108             in IVirtualDisplayCallback callback, in IMediaProjection projectionToken,
109             String packageName);
110 
111     // No permissions required, but must be same Uid as the creator.
resizeVirtualDisplay(in IVirtualDisplayCallback token, int width, int height, int densityDpi)112     void resizeVirtualDisplay(in IVirtualDisplayCallback token,
113             int width, int height, int densityDpi);
114 
115     // No permissions required but must be same Uid as the creator.
setVirtualDisplaySurface(in IVirtualDisplayCallback token, in Surface surface)116     void setVirtualDisplaySurface(in IVirtualDisplayCallback token, in Surface surface);
117 
118     // No permissions required but must be same Uid as the creator.
releaseVirtualDisplay(in IVirtualDisplayCallback token)119     void releaseVirtualDisplay(in IVirtualDisplayCallback token);
120 
121     // No permissions required but must be same Uid as the creator.
setVirtualDisplayRotation(in IVirtualDisplayCallback token, int rotation)122     void setVirtualDisplayRotation(in IVirtualDisplayCallback token, int rotation);
123 
124     // Get a stable metric for the device's display size. No permissions required.
getStableDisplaySize()125     Point getStableDisplaySize();
126 
127     // Requires BRIGHTNESS_SLIDER_USAGE permission.
128     @EnforcePermission("BRIGHTNESS_SLIDER_USAGE")
getBrightnessEvents(String callingPackage)129     ParceledListSlice getBrightnessEvents(String callingPackage);
130 
131     // Requires ACCESS_AMBIENT_LIGHT_STATS permission.
132     @EnforcePermission("ACCESS_AMBIENT_LIGHT_STATS")
getAmbientBrightnessStats()133     ParceledListSlice getAmbientBrightnessStats();
134 
135     // Sets the global brightness configuration for a given user. Requires
136     // CONFIGURE_DISPLAY_BRIGHTNESS, and INTERACT_ACROSS_USER if the user being configured is not
137     // the same as the calling user.
138     @EnforcePermission("CONFIGURE_DISPLAY_BRIGHTNESS")
setBrightnessConfigurationForUser(in BrightnessConfiguration c, int userId, String packageName)139     void setBrightnessConfigurationForUser(in BrightnessConfiguration c, int userId,
140             String packageName);
141 
142     // Sets the global brightness configuration for a given display. Requires
143     // CONFIGURE_DISPLAY_BRIGHTNESS.
144     @EnforcePermission("CONFIGURE_DISPLAY_BRIGHTNESS")
setBrightnessConfigurationForDisplay(in BrightnessConfiguration c, String uniqueDisplayId, int userId, String packageName)145     void setBrightnessConfigurationForDisplay(in BrightnessConfiguration c, String uniqueDisplayId,
146             int userId, String packageName);
147 
148     // Gets the brightness configuration for a given display. Requires
149     // CONFIGURE_DISPLAY_BRIGHTNESS.
150     @EnforcePermission("CONFIGURE_DISPLAY_BRIGHTNESS")
getBrightnessConfigurationForDisplay(String uniqueDisplayId, int userId)151     BrightnessConfiguration getBrightnessConfigurationForDisplay(String uniqueDisplayId,
152             int userId);
153 
154     // Gets the global brightness configuration for a given user. Requires
155     // CONFIGURE_DISPLAY_BRIGHTNESS, and INTERACT_ACROSS_USER if the user is not
156     // the same as the calling user.
getBrightnessConfigurationForUser(int userId)157     BrightnessConfiguration getBrightnessConfigurationForUser(int userId);
158 
159     // Gets the default brightness configuration if configured.
160     @EnforcePermission("CONFIGURE_DISPLAY_BRIGHTNESS")
getDefaultBrightnessConfiguration()161     BrightnessConfiguration getDefaultBrightnessConfiguration();
162 
163     // Gets the last requested minimal post processing settings for display with displayId.
isMinimalPostProcessingRequested(int displayId)164     boolean isMinimalPostProcessingRequested(int displayId);
165 
166     // Temporarily sets the display brightness.
167     @EnforcePermission("CONTROL_DISPLAY_BRIGHTNESS")
setTemporaryBrightness(int displayId, float brightness)168     void setTemporaryBrightness(int displayId, float brightness);
169 
170     // Saves the display brightness.
171     @EnforcePermission("CONTROL_DISPLAY_BRIGHTNESS")
setBrightness(int displayId, float brightness)172     void setBrightness(int displayId, float brightness);
173 
174     // Retrieves the display brightness.
175     @EnforcePermission("CONTROL_DISPLAY_BRIGHTNESS")
getBrightness(int displayId)176     float getBrightness(int displayId);
177 
178     // Temporarily sets the auto brightness adjustment factor.
179     @EnforcePermission("CONTROL_DISPLAY_BRIGHTNESS")
setTemporaryAutoBrightnessAdjustment(float adjustment)180     void setTemporaryAutoBrightnessAdjustment(float adjustment);
181 
182     // Get the minimum brightness curve.
getMinimumBrightnessCurve()183     Curve getMinimumBrightnessCurve();
184 
185     // Get Brightness Information for the specified display.
186     @EnforcePermission("CONTROL_DISPLAY_BRIGHTNESS")
getBrightnessInfo(int displayId)187     BrightnessInfo getBrightnessInfo(int displayId);
188 
189     // Gets the id of the preferred wide gamut color space for all displays.
190     // The wide gamut color space is returned from composition pipeline
191     // based on hardware capability.
getPreferredWideGamutColorSpaceId()192     int getPreferredWideGamutColorSpaceId();
193 
194     // Sets the user preferred display mode.
195     // Requires MODIFY_USER_PREFERRED_DISPLAY_MODE permission.
196     @EnforcePermission("MODIFY_USER_PREFERRED_DISPLAY_MODE")
setUserPreferredDisplayMode(int displayId, in Mode mode)197     void setUserPreferredDisplayMode(int displayId, in Mode mode);
getUserPreferredDisplayMode(int displayId)198     Mode getUserPreferredDisplayMode(int displayId);
getSystemPreferredDisplayMode(int displayId)199     Mode getSystemPreferredDisplayMode(int displayId);
200 
201     // Sets the HDR conversion mode for a device.
202     // Requires MODIFY_HDR_CONVERSION_MODE permission.
203     @EnforcePermission("MODIFY_HDR_CONVERSION_MODE")
setHdrConversionMode(in HdrConversionMode hdrConversionMode)204     void setHdrConversionMode(in HdrConversionMode hdrConversionMode);
getHdrConversionModeSetting()205     HdrConversionMode getHdrConversionModeSetting();
getHdrConversionMode()206     HdrConversionMode getHdrConversionMode();
getSupportedHdrOutputTypes()207     int[] getSupportedHdrOutputTypes();
208 
209     // When enabled the app requested display resolution and refresh rate is always selected
210     // in DisplayModeDirector regardless of user settings and policies for low brightness, low
211     // battery etc.
212     @EnforcePermission("OVERRIDE_DISPLAY_MODE_REQUESTS")
setShouldAlwaysRespectAppRequestedMode(boolean enabled)213     void setShouldAlwaysRespectAppRequestedMode(boolean enabled);
214     @EnforcePermission("OVERRIDE_DISPLAY_MODE_REQUESTS")
shouldAlwaysRespectAppRequestedMode()215     boolean shouldAlwaysRespectAppRequestedMode();
216 
217     // Sets the refresh rate switching type.
218     @EnforcePermission("MODIFY_REFRESH_RATE_SWITCHING_TYPE")
setRefreshRateSwitchingType(int newValue)219     void setRefreshRateSwitchingType(int newValue);
220 
221     // Returns the refresh rate switching type.
getRefreshRateSwitchingType()222     int getRefreshRateSwitchingType();
223 
224     // Query for DISPLAY_DECORATION support.
getDisplayDecorationSupport(int displayId)225     DisplayDecorationSupport getDisplayDecorationSupport(int displayId);
226 
227     // This method is to support behavior that was calling hidden APIs. The caller was requesting
228     // to set the layerStack after the display was created, which is not something we support in
229     // DMS. This should be deleted in V release.
setDisplayIdToMirror(in IBinder token, int displayId)230     void setDisplayIdToMirror(in IBinder token, int displayId);
231 
232     // Query overlay properties of the device
getOverlaySupport()233     OverlayProperties getOverlaySupport();
234 
235     // Enable a connected display that is disabled.
236     @EnforcePermission("MANAGE_DISPLAYS")
enableConnectedDisplay(int displayId)237     void enableConnectedDisplay(int displayId);
238 
239     // Disable a connected display that is enabled.
240     @EnforcePermission("MANAGE_DISPLAYS")
disableConnectedDisplay(int displayId)241     void disableConnectedDisplay(int displayId);
242 
243     // Request to power display OFF or reset it to a power state it supposed to have.
244     @EnforcePermission("MANAGE_DISPLAYS")
requestDisplayPower(int displayId, int state)245     boolean requestDisplayPower(int displayId, int state);
246 
247     // Restricts display modes to specified modeIds.
248     @EnforcePermission("RESTRICT_DISPLAY_MODES")
requestDisplayModes(in IBinder token, int displayId, in @nullable int[] modeIds)249     void requestDisplayModes(in IBinder token, int displayId, in @nullable int[] modeIds);
250 
251     // Get the highest defined HDR/SDR ratio for a display.
getHighestHdrSdrRatio(int displayId)252     float getHighestHdrSdrRatio(int displayId);
253 
254     // Get the mapping between the doze brightness sensor values and brightness values
255     @EnforcePermission("CONTROL_DISPLAY_BRIGHTNESS")
getDozeBrightnessSensorValueToBrightness(int displayId)256     float[] getDozeBrightnessSensorValueToBrightness(int displayId);
257 
258     // Get the default doze brightness
259     @EnforcePermission("CONTROL_DISPLAY_BRIGHTNESS")
getDefaultDozeBrightness(int displayId)260     float getDefaultDozeBrightness(int displayId);
261 
262     // Get the display topology
263     @EnforcePermission("MANAGE_DISPLAYS")
264     @nullable
getDisplayTopology()265     DisplayTopology getDisplayTopology();
266 
267     // Set the display topology
268     @EnforcePermission("MANAGE_DISPLAYS")
setDisplayTopology(in DisplayTopology topology)269     void setDisplayTopology(in DisplayTopology topology);
270 }
271