• 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.display.BrightnessConfiguration;
22 import android.hardware.display.BrightnessInfo;
23 import android.hardware.display.Curve;
24 import android.hardware.graphics.common.DisplayDecorationSupport;
25 import android.hardware.display.IDisplayManagerCallback;
26 import android.hardware.display.IVirtualDisplayCallback;
27 import android.hardware.display.VirtualDisplayConfig;
28 import android.hardware.display.WifiDisplay;
29 import android.hardware.display.WifiDisplayStatus;
30 import android.media.projection.IMediaProjection;
31 import android.view.Display.Mode;
32 import android.view.DisplayInfo;
33 import android.view.Surface;
34 
35 /** @hide */
36 interface IDisplayManager {
37     @UnsupportedAppUsage
getDisplayInfo(int displayId)38     DisplayInfo getDisplayInfo(int displayId);
getDisplayIds(boolean includeDisabled)39     int[] getDisplayIds(boolean includeDisabled);
40 
isUidPresentOnDisplay(int uid, int displayId)41     boolean isUidPresentOnDisplay(int uid, int displayId);
42 
registerCallback(in IDisplayManagerCallback callback)43     void registerCallback(in IDisplayManagerCallback callback);
registerCallbackWithEventMask(in IDisplayManagerCallback callback, long eventsMask)44     void registerCallbackWithEventMask(in IDisplayManagerCallback callback, long eventsMask);
45 
46     // Requires CONFIGURE_WIFI_DISPLAY permission.
47     // The process must have previously registered a callback.
startWifiDisplayScan()48     void startWifiDisplayScan();
49 
50     // Requires CONFIGURE_WIFI_DISPLAY permission.
stopWifiDisplayScan()51     void stopWifiDisplayScan();
52 
53     // Requires CONFIGURE_WIFI_DISPLAY permission.
connectWifiDisplay(String address)54     void connectWifiDisplay(String address);
55 
56     // No permissions required.
disconnectWifiDisplay()57     void disconnectWifiDisplay();
58 
59     // Requires CONFIGURE_WIFI_DISPLAY permission.
renameWifiDisplay(String address, String alias)60     void renameWifiDisplay(String address, String alias);
61 
62     // Requires CONFIGURE_WIFI_DISPLAY permission.
forgetWifiDisplay(String address)63     void forgetWifiDisplay(String address);
64 
65     // Requires CONFIGURE_WIFI_DISPLAY permission.
pauseWifiDisplay()66     void pauseWifiDisplay();
67 
68     // Requires CONFIGURE_WIFI_DISPLAY permission.
resumeWifiDisplay()69     void resumeWifiDisplay();
70 
71     // No permissions required.
getWifiDisplayStatus()72     WifiDisplayStatus getWifiDisplayStatus();
73 
74     // Requires WRITE_SECURE_SETTINGS permission.
setUserDisabledHdrTypes(in int[] userDisabledTypes)75     void setUserDisabledHdrTypes(in int[] userDisabledTypes);
76 
77     // Requires WRITE_SECURE_SETTINGS permission.
setAreUserDisabledHdrTypesAllowed(boolean areUserDisabledHdrTypesAllowed)78     void setAreUserDisabledHdrTypesAllowed(boolean areUserDisabledHdrTypesAllowed);
79 
80     // No permissions required.
areUserDisabledHdrTypesAllowed()81     boolean areUserDisabledHdrTypesAllowed();
82 
83     // No permissions required.
getUserDisabledHdrTypes()84     int[] getUserDisabledHdrTypes();
85 
86     // Requires CONFIGURE_DISPLAY_COLOR_MODE
requestColorMode(int displayId, int colorMode)87     void requestColorMode(int displayId, int colorMode);
88 
89     // Requires CAPTURE_VIDEO_OUTPUT, CAPTURE_SECURE_VIDEO_OUTPUT, or an appropriate
90     // MediaProjection token for certain combinations of flags.
createVirtualDisplay(in VirtualDisplayConfig virtualDisplayConfig, in IVirtualDisplayCallback callback, in IMediaProjection projectionToken, String packageName)91     int createVirtualDisplay(in VirtualDisplayConfig virtualDisplayConfig,
92             in IVirtualDisplayCallback callback, in IMediaProjection projectionToken,
93             String packageName);
94 
95     // No permissions required, but must be same Uid as the creator.
resizeVirtualDisplay(in IVirtualDisplayCallback token, int width, int height, int densityDpi)96     void resizeVirtualDisplay(in IVirtualDisplayCallback token,
97             int width, int height, int densityDpi);
98 
99     // No permissions required but must be same Uid as the creator.
setVirtualDisplaySurface(in IVirtualDisplayCallback token, in Surface surface)100     void setVirtualDisplaySurface(in IVirtualDisplayCallback token, in Surface surface);
101 
102     // No permissions required but must be same Uid as the creator.
releaseVirtualDisplay(in IVirtualDisplayCallback token)103     void releaseVirtualDisplay(in IVirtualDisplayCallback token);
104 
105     // No permissions required but must be same Uid as the creator.
setVirtualDisplayState(in IVirtualDisplayCallback token, boolean isOn)106     void setVirtualDisplayState(in IVirtualDisplayCallback token, boolean isOn);
107 
108     // Get a stable metric for the device's display size. No permissions required.
getStableDisplaySize()109     Point getStableDisplaySize();
110 
111     // Requires BRIGHTNESS_SLIDER_USAGE permission.
getBrightnessEvents(String callingPackage)112     ParceledListSlice getBrightnessEvents(String callingPackage);
113 
114     // Requires ACCESS_AMBIENT_LIGHT_STATS permission.
getAmbientBrightnessStats()115     ParceledListSlice getAmbientBrightnessStats();
116 
117     // Sets the global brightness configuration for a given user. Requires
118     // CONFIGURE_DISPLAY_BRIGHTNESS, and INTERACT_ACROSS_USER if the user being configured is not
119     // the same as the calling user.
setBrightnessConfigurationForUser(in BrightnessConfiguration c, int userId, String packageName)120     void setBrightnessConfigurationForUser(in BrightnessConfiguration c, int userId,
121             String packageName);
122 
123     // Sets the global brightness configuration for a given display. Requires
124     // CONFIGURE_DISPLAY_BRIGHTNESS.
setBrightnessConfigurationForDisplay(in BrightnessConfiguration c, String uniqueDisplayId, int userId, String packageName)125     void setBrightnessConfigurationForDisplay(in BrightnessConfiguration c, String uniqueDisplayId,
126             int userId, String packageName);
127 
128     // Gets the brightness configuration for a given display. Requires
129     // CONFIGURE_DISPLAY_BRIGHTNESS.
getBrightnessConfigurationForDisplay(String uniqueDisplayId, int userId)130     BrightnessConfiguration getBrightnessConfigurationForDisplay(String uniqueDisplayId,
131             int userId);
132 
133     // Gets the global brightness configuration for a given user. Requires
134     // CONFIGURE_DISPLAY_BRIGHTNESS, and INTERACT_ACROSS_USER if the user is not
135     // the same as the calling user.
getBrightnessConfigurationForUser(int userId)136     BrightnessConfiguration getBrightnessConfigurationForUser(int userId);
137 
138     // Gets the default brightness configuration if configured.
getDefaultBrightnessConfiguration()139     BrightnessConfiguration getDefaultBrightnessConfiguration();
140 
141     // Gets the last requested minimal post processing settings for display with displayId.
isMinimalPostProcessingRequested(int displayId)142     boolean isMinimalPostProcessingRequested(int displayId);
143 
144     // Temporarily sets the display brightness.
setTemporaryBrightness(int displayId, float brightness)145     void setTemporaryBrightness(int displayId, float brightness);
146 
147     // Saves the display brightness.
setBrightness(int displayId, float brightness)148     void setBrightness(int displayId, float brightness);
149 
150     // Retrieves the display brightness.
getBrightness(int displayId)151     float getBrightness(int displayId);
152 
153     // Temporarily sets the auto brightness adjustment factor.
setTemporaryAutoBrightnessAdjustment(float adjustment)154     void setTemporaryAutoBrightnessAdjustment(float adjustment);
155 
156     // Get the minimum brightness curve.
getMinimumBrightnessCurve()157     Curve getMinimumBrightnessCurve();
158 
159     // Get Brightness Information for the specified display.
getBrightnessInfo(int displayId)160     BrightnessInfo getBrightnessInfo(int displayId);
161 
162     // Gets the id of the preferred wide gamut color space for all displays.
163     // The wide gamut color space is returned from composition pipeline
164     // based on hardware capability.
getPreferredWideGamutColorSpaceId()165     int getPreferredWideGamutColorSpaceId();
166 
167     // Sets the user preferred display mode.
168     // Requires MODIFY_USER_PREFERRED_DISPLAY_MODE permission.
setUserPreferredDisplayMode(int displayId, in Mode mode)169     void setUserPreferredDisplayMode(int displayId, in Mode mode);
getUserPreferredDisplayMode(int displayId)170     Mode getUserPreferredDisplayMode(int displayId);
getSystemPreferredDisplayMode(int displayId)171     Mode getSystemPreferredDisplayMode(int displayId);
172 
173     // When enabled the app requested display resolution and refresh rate is always selected
174     // in DisplayModeDirector regardless of user settings and policies for low brightness, low
175     // battery etc.
setShouldAlwaysRespectAppRequestedMode(boolean enabled)176     void setShouldAlwaysRespectAppRequestedMode(boolean enabled);
shouldAlwaysRespectAppRequestedMode()177     boolean shouldAlwaysRespectAppRequestedMode();
178 
179     // Sets the refresh rate switching type.
setRefreshRateSwitchingType(int newValue)180     void setRefreshRateSwitchingType(int newValue);
181 
182     // Returns the refresh rate switching type.
getRefreshRateSwitchingType()183     int getRefreshRateSwitchingType();
184 
185     // Query for DISPLAY_DECORATION support.
getDisplayDecorationSupport(int displayId)186     DisplayDecorationSupport getDisplayDecorationSupport(int displayId);
187 }
188