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