| 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 |
| 38 |
DisplayInfo getDisplayInfo(int displayId); |
| 39 |
int[] getDisplayIds(boolean includeDisabled); |
| 40 |
|
| 41 |
boolean isUidPresentOnDisplay(int uid, int displayId); |
| 42 |
|
| 43 |
void registerCallback(in IDisplayManagerCallback callback); |
| 44 |
void registerCallbackWithEventMask(in IDisplayManagerCallback callback, long eventsMask); |
| 45 |
|
| 46 |
// Requires CONFIGURE_WIFI_DISPLAY permission. |
| 47 |
// The process must have previously registered a callback. |
| 48 |
void startWifiDisplayScan(); |
| 49 |
|
| 50 |
// Requires CONFIGURE_WIFI_DISPLAY permission. |
| 51 |
void stopWifiDisplayScan(); |
| 52 |
|
| 53 |
// Requires CONFIGURE_WIFI_DISPLAY permission. |
| 54 |
void connectWifiDisplay(String address); |
| 55 |
|
| 56 |
// No permissions required. |
| 57 |
void disconnectWifiDisplay(); |
| 58 |
|
| 59 |
// Requires CONFIGURE_WIFI_DISPLAY permission. |
| 60 |
void renameWifiDisplay(String address, String alias); |
| 61 |
|
| 62 |
// Requires CONFIGURE_WIFI_DISPLAY permission. |
| 63 |
void forgetWifiDisplay(String address); |
| 64 |
|
| 65 |
// Requires CONFIGURE_WIFI_DISPLAY permission. |
| 66 |
void pauseWifiDisplay(); |
| 67 |
|
| 68 |
// Requires CONFIGURE_WIFI_DISPLAY permission. |
| 69 |
void resumeWifiDisplay(); |
| 70 |
|
| 71 |
// No permissions required. |
| 72 |
WifiDisplayStatus getWifiDisplayStatus(); |
| 73 |
|
| 74 |
// Requires WRITE_SECURE_SETTINGS permission. |
| 75 |
void setUserDisabledHdrTypes(in int[] userDisabledTypes); |
| 76 |
|
| 77 |
// Requires WRITE_SECURE_SETTINGS permission. |
| 78 |
void setAreUserDisabledHdrTypesAllowed(boolean areUserDisabledHdrTypesAllowed); |
| 79 |
|
| 80 |
// No permissions required. |
| 81 |
boolean areUserDisabledHdrTypesAllowed(); |
| 82 |
|
| 83 |
// No permissions required. |
| 84 |
int[] getUserDisabledHdrTypes(); |
| 85 |
|
| 86 |
// Requires CONFIGURE_DISPLAY_COLOR_MODE |
| 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. |
| 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. |
| 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. |
| 100 |
void setVirtualDisplaySurface(in IVirtualDisplayCallback token, in Surface surface); |
| 101 |
|
| 102 |
// No permissions required but must be same Uid as the creator. |
| 103 |
void releaseVirtualDisplay(in IVirtualDisplayCallback token); |
| 104 |
|
| 105 |
// No permissions required but must be same Uid as the creator. |
| 106 |
void setVirtualDisplayState(in IVirtualDisplayCallback token, boolean isOn); |
| 107 |
|
| 108 |
// Get a stable metric for the device's display size. No permissions required. |
| 109 |
Point getStableDisplaySize(); |
| 110 |
|
| 111 |
// Requires BRIGHTNESS_SLIDER_USAGE permission. |
| 112 |
ParceledListSlice getBrightnessEvents(String callingPackage); |
| 113 |
|
| 114 |
// Requires ACCESS_AMBIENT_LIGHT_STATS permission. |
| 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. |
| 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. |
| 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. |
| 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. |
| 136 |
BrightnessConfiguration getBrightnessConfigurationForUser(int userId); |
| 137 |
|
| 138 |
// Gets the default brightness configuration if configured. |
| 139 |
BrightnessConfiguration getDefaultBrightnessConfiguration(); |
| 140 |
|
| 141 |
// Gets the last requested minimal post processing settings for display with displayId. |
| 142 |
boolean isMinimalPostProcessingRequested(int displayId); |
| 143 |
|
| 144 |
// Temporarily sets the display brightness. |
| 145 |
void setTemporaryBrightness(int displayId, float brightness); |
| 146 |
|
| 147 |
// Saves the display brightness. |
| 148 |
void setBrightness(int displayId, float brightness); |
| 149 |
|
| 150 |
// Retrieves the display brightness. |
| 151 |
float getBrightness(int displayId); |
| 152 |
|
| 153 |
// Temporarily sets the auto brightness adjustment factor. |
| 154 |
void setTemporaryAutoBrightnessAdjustment(float adjustment); |
| 155 |
|
| 156 |
// Get the minimum brightness curve. |
| 157 |
Curve getMinimumBrightnessCurve(); |
| 158 |
|
| 159 |
// Get Brightness Information for the specified display. |
| 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. |
| 165 |
int getPreferredWideGamutColorSpaceId(); |
| 166 |
|
| 167 |
// Sets the user preferred display mode. |
| 168 |
// Requires MODIFY_USER_PREFERRED_DISPLAY_MODE permission. |
| 169 |
void setUserPreferredDisplayMode(int displayId, in Mode mode); |
| 170 |
Mode getUserPreferredDisplayMode(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. |
| 176 |
void setShouldAlwaysRespectAppRequestedMode(boolean enabled); |
| 177 |
boolean shouldAlwaysRespectAppRequestedMode(); |
| 178 |
|
| 179 |
// Sets the refresh rate switching type. |
| 180 |
void setRefreshRateSwitchingType(int newValue); |
| 181 |
|
| 182 |
// Returns the refresh rate switching type. |
| 183 |
int getRefreshRateSwitchingType(); |
| 184 |
|
| 185 |
// Query for DISPLAY_DECORATION support. |
| 186 |
DisplayDecorationSupport getDisplayDecorationSupport(int displayId); |
| 187 |
} |