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