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 // Sets the global brightness configuration for a given display. Requires 122 // CONFIGURE_DISPLAY_BRIGHTNESS. setBrightnessConfigurationForDisplay(in BrightnessConfiguration c, String uniqueDisplayId, int userId, String packageName)123 void setBrightnessConfigurationForDisplay(in BrightnessConfiguration c, String uniqueDisplayId, 124 int userId, String packageName); 125 126 // Gets the brightness configuration for a given display. Requires 127 // CONFIGURE_DISPLAY_BRIGHTNESS. getBrightnessConfigurationForDisplay(String uniqueDisplayId, int userId)128 BrightnessConfiguration getBrightnessConfigurationForDisplay(String uniqueDisplayId, 129 int userId); 130 131 // Gets the global brightness configuration for a given user. Requires 132 // CONFIGURE_DISPLAY_BRIGHTNESS, and INTERACT_ACROSS_USER if the user is not 133 // the same as the calling user. getBrightnessConfigurationForUser(int userId)134 BrightnessConfiguration getBrightnessConfigurationForUser(int userId); 135 136 // Gets the default brightness configuration if configured. getDefaultBrightnessConfiguration()137 BrightnessConfiguration getDefaultBrightnessConfiguration(); 138 139 // Gets the last requested minimal post processing settings for display with displayId. isMinimalPostProcessingRequested(int displayId)140 boolean isMinimalPostProcessingRequested(int displayId); 141 142 // Temporarily sets the display brightness. setTemporaryBrightness(int displayId, float brightness)143 void setTemporaryBrightness(int displayId, float brightness); 144 145 // Saves the display brightness. setBrightness(int displayId, float brightness)146 void setBrightness(int displayId, float brightness); 147 148 // Retrieves the display brightness. getBrightness(int displayId)149 float getBrightness(int displayId); 150 151 // Temporarily sets the auto brightness adjustment factor. setTemporaryAutoBrightnessAdjustment(float adjustment)152 void setTemporaryAutoBrightnessAdjustment(float adjustment); 153 154 // Get the minimum brightness curve. getMinimumBrightnessCurve()155 Curve getMinimumBrightnessCurve(); 156 157 // Get Brightness Information for the specified display. getBrightnessInfo(int displayId)158 BrightnessInfo getBrightnessInfo(int displayId); 159 160 // Gets the id of the preferred wide gamut color space for all displays. 161 // The wide gamut color space is returned from composition pipeline 162 // based on hardware capability. getPreferredWideGamutColorSpaceId()163 int getPreferredWideGamutColorSpaceId(); 164 165 // When enabled the app requested display resolution and refresh rate is always selected 166 // in DisplayModeDirector regardless of user settings and policies for low brightness, low 167 // battery etc. setShouldAlwaysRespectAppRequestedMode(boolean enabled)168 void setShouldAlwaysRespectAppRequestedMode(boolean enabled); shouldAlwaysRespectAppRequestedMode()169 boolean shouldAlwaysRespectAppRequestedMode(); 170 171 // Sets the refresh rate switching type. setRefreshRateSwitchingType(int newValue)172 void setRefreshRateSwitchingType(int newValue); 173 174 // Returns the refresh rate switching type. getRefreshRateSwitchingType()175 int getRefreshRateSwitchingType(); 176 } 177