@amazon-devices/kepler-graphics 2.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +7 -0
- package/README.md +272 -0
- package/SystemBundles/e1224d435abddb7360ba588396252be76566b2cdc8373c285491d1711dc251d0.bundle +1742 -0
- package/SystemBundles/e1224d435abddb7360ba588396252be76566b2cdc8373c285491d1711dc251d0.bundle.map +1 -0
- package/SystemModules/amzn__kepler-graphics-2.modules.txt +7 -0
- package/SystemModules/amzn__kepler-graphics-2.private.modules.txt +11 -0
- package/SystemModules/keplerscript-system-bundle-config.json +7 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +34 -0
- package/dist/kepler/tm-manifest.json +1 -0
- package/dist/turbo-modules/AmazonGraphicsTurboModule.d.ts +47 -0
- package/dist/turbo-modules/AmazonGraphicsTurboModule.js +13 -0
- package/dist/turbo-modules/Display.d.ts +147 -0
- package/dist/turbo-modules/Display.js +249 -0
- package/dist/turbo-modules/DisplayController.d.ts +25 -0
- package/dist/turbo-modules/DisplayController.js +56 -0
- package/dist/turbo-modules/DisplayManager.d.ts +103 -0
- package/dist/turbo-modules/DisplayManager.js +149 -0
- package/dist/turbo-modules/__mocks__/AmazonGraphicsTurboModule.d.ts +17 -0
- package/dist/turbo-modules/__mocks__/AmazonGraphicsTurboModule.js +25 -0
- package/dist/types/GraphicsTypes.d.ts +350 -0
- package/dist/types/GraphicsTypes.js +221 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/index.js +20 -0
- package/kepler-compatibility.json +8 -0
- package/kepler-transformed-package-info.json +3 -0
- package/package.json +1 -0
- package/react-native.config.js +16 -0
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.Display = void 0;
|
|
7
|
+
/*
|
|
8
|
+
* Copyright (c) 2024 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
9
|
+
*
|
|
10
|
+
* PROPRIETARY/CONFIDENTIAL
|
|
11
|
+
*
|
|
12
|
+
* Use is subject to license terms.
|
|
13
|
+
*/
|
|
14
|
+
const types_1 = require("../types");
|
|
15
|
+
const AmazonGraphicsTurboModule_1 = __importDefault(require("./AmazonGraphicsTurboModule"));
|
|
16
|
+
if (!AmazonGraphicsTurboModule_1.default) {
|
|
17
|
+
throw new Error(`AmazonGraphicsTurboModule turbo-module is null.`);
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Display Listener callback cancellation is handled through
|
|
21
|
+
* Subscription object returned after calling
|
|
22
|
+
* {@link DisplayController.addListener}.
|
|
23
|
+
*/
|
|
24
|
+
class DisplayListenerSubscription {
|
|
25
|
+
token;
|
|
26
|
+
constructor(token) {
|
|
27
|
+
this.token = token;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Unsubscribes the listener.
|
|
31
|
+
*/
|
|
32
|
+
unsubscribe() {
|
|
33
|
+
AmazonGraphicsTurboModule_1.default.removeDisplayListener(this.token);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Class that retrieves properties of the primary display.
|
|
38
|
+
* Note only primary display is supported by this turbomodule.
|
|
39
|
+
*/
|
|
40
|
+
class Display {
|
|
41
|
+
constructor() { }
|
|
42
|
+
/**
|
|
43
|
+
* Query the display connector name.
|
|
44
|
+
* @return The name of the display connector (not the panel name).
|
|
45
|
+
*/
|
|
46
|
+
static getName() {
|
|
47
|
+
return AmazonGraphicsTurboModule_1.default.getName();
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Get current color depth.
|
|
51
|
+
* @return color depth.
|
|
52
|
+
*/
|
|
53
|
+
static getColorDepth() {
|
|
54
|
+
return AmazonGraphicsTurboModule_1.default.getColorDepth();
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Get current color space.
|
|
58
|
+
* @return color space.
|
|
59
|
+
*/
|
|
60
|
+
static getColorSpace() {
|
|
61
|
+
return AmazonGraphicsTurboModule_1.default.getColorSpace();
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Get current HDR mode.
|
|
65
|
+
* @return HDR mode.
|
|
66
|
+
*/
|
|
67
|
+
static getHdrMode() {
|
|
68
|
+
return AmazonGraphicsTurboModule_1.default.getHdrMode();
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Query the current Low latency mode state of the display.
|
|
72
|
+
* @return Low latency mode state being used for the display.
|
|
73
|
+
*/
|
|
74
|
+
static getLowLatencyModeState() {
|
|
75
|
+
return AmazonGraphicsTurboModule_1.default.getLowLatencyModeState();
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Query if any kind of display low latency mode is supported for this display.
|
|
79
|
+
* @return true if supported otherwise false
|
|
80
|
+
*/
|
|
81
|
+
static isLowLatencyModeSupported() {
|
|
82
|
+
return AmazonGraphicsTurboModule_1.default.isLowLatencyModeSupported();
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Query the Multiple Refresh Rate (MRR) state for this display.
|
|
86
|
+
* It allows clients to request alternate refresh rate which might be more
|
|
87
|
+
* appropriate for their content.
|
|
88
|
+
* @return MRR state being used for the display.
|
|
89
|
+
*/
|
|
90
|
+
static isMultipleRefreshRateEnabled() {
|
|
91
|
+
return AmazonGraphicsTurboModule_1.default.isMultipleRefreshRateEnabled();
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Query the current vertical refresh rate in mHz (millihertz) for this display
|
|
95
|
+
* @return Returns current refresh rate for this display in mHz.
|
|
96
|
+
* If the current refresh rate changes, {@link IDisplayListener.onRefreshRateChange}
|
|
97
|
+
* will be called.
|
|
98
|
+
*/
|
|
99
|
+
static getCurrentRefreshRateInMillihertz() {
|
|
100
|
+
return AmazonGraphicsTurboModule_1.default.getCurrentRefreshRateInMillihertz();
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Query the current HDCP (High-bandwidth Digital Content Protection) level for this display.
|
|
104
|
+
* @return Returns current HDCP level for this display
|
|
105
|
+
* @see HdcpLevel
|
|
106
|
+
*/
|
|
107
|
+
static getCurrentHdcpLevel() {
|
|
108
|
+
return AmazonGraphicsTurboModule_1.default.getCurrentHdcpLevel();
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Query the list of all supported configs for this display.
|
|
112
|
+
* @return Returns list of all supported configs for this display.
|
|
113
|
+
*/
|
|
114
|
+
static getAllSupportedConfigs() {
|
|
115
|
+
return AmazonGraphicsTurboModule_1.default.getAllSupportedConfigs();
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Query the current config for this display.
|
|
119
|
+
* @return Returns current config
|
|
120
|
+
* @see IDisplayConfig
|
|
121
|
+
*/
|
|
122
|
+
static getCurrentConfig() {
|
|
123
|
+
return AmazonGraphicsTurboModule_1.default.getCurrentConfig();
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Query if auto config switch is enabled.
|
|
127
|
+
* @return true, if auto config switch is enabled, false otherwise
|
|
128
|
+
* @see IDisplayConfig
|
|
129
|
+
*/
|
|
130
|
+
static isAutoConfigSwitchEnabled() {
|
|
131
|
+
return AmazonGraphicsTurboModule_1.default.isAutoConfigSwitchEnabled();
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Query for allowed color spaces which are obtained based on
|
|
135
|
+
* the connected display/TV capabilities and the device capabilities.
|
|
136
|
+
* If the resolution, the refresh rate or the HDR setting changes then
|
|
137
|
+
* clients are expected to query this API again to get updated allowed color spaces.
|
|
138
|
+
* @returns {ColorSpace[]} An array of ColorSpace values representing the allowed color spaces
|
|
139
|
+
* {@link DisplayManager.setColorSpace()}
|
|
140
|
+
*/
|
|
141
|
+
static getAllowedColorSpaces() {
|
|
142
|
+
return AmazonGraphicsTurboModule_1.default.getAllowedColorSpaces();
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Query for allowed color depths for given color space, which are obtained based on
|
|
146
|
+
* the connected display/TV capabilities and the device capabilities.
|
|
147
|
+
* If the resolution, the refresh rate or the HDR setting changes then
|
|
148
|
+
* clients are expected to query this API again to get updated allowed color depth.
|
|
149
|
+
* @param {ColorSpace} colorSpace - the color space for which allowed color depths are queried.
|
|
150
|
+
* @returns {ColorDepth[]} An array of ColorDepth values available for the specified color space
|
|
151
|
+
* {@link DisplayManager.setColorDepth()}
|
|
152
|
+
*/
|
|
153
|
+
static getAllowedColorDepths(colorSpace) {
|
|
154
|
+
return AmazonGraphicsTurboModule_1.default.getAllowedColorDepths(colorSpace);
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Returns the current overscan border values of the display.
|
|
158
|
+
* The border value (left, top, right and bottom) represent the fraction of
|
|
159
|
+
* the width or height of the display that acts like a margin for the visible
|
|
160
|
+
* region on the display.
|
|
161
|
+
* @return The current overscan border configuration.
|
|
162
|
+
* @throws DeviceError if the display device is not in active state
|
|
163
|
+
* @see IOverscanBorder
|
|
164
|
+
*/
|
|
165
|
+
static getOverscanBorder() {
|
|
166
|
+
return AmazonGraphicsTurboModule_1.default.getOverscanBorder();
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Check if the display sink port where this display source device is connected is active or not.
|
|
170
|
+
* A display sink (e.g. TV or monitor) may have multiple display ports. The port where this source
|
|
171
|
+
* device is connected may be inactive even if display source (this device) is powered ON.
|
|
172
|
+
* @return Returns true if display sink is active.
|
|
173
|
+
*/
|
|
174
|
+
static isSinkActive() {
|
|
175
|
+
return AmazonGraphicsTurboModule_1.default.isSinkActive();
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Adds display listener object {@link IDisplayListener} to receive
|
|
179
|
+
* callbacks when display properties change. It returns a
|
|
180
|
+
* {@link ISubscription} object, which is used to unsubscribe the listener
|
|
181
|
+
* from receiving events through {@link ISubscription.unsubscribe()}.
|
|
182
|
+
* @param listener IDisplayListener interface
|
|
183
|
+
* @return ISubscription object related to this listener @see DisplayListenerSubscription
|
|
184
|
+
*/
|
|
185
|
+
static addDisplayListener(listener) {
|
|
186
|
+
let token = AmazonGraphicsTurboModule_1.default.addDisplayListener(listener.onConfigChange, listener.onRefreshRateChange, listener.onColorDepthChange, listener.onColorSpaceChange, listener.onHdcpLevelChange, listener.onAutoConfigSwitchStateChange, listener.onMultipleRefreshRateStateChange, listener.onLowLatencyModeStateChange, listener.onHdrModeChange);
|
|
187
|
+
return new DisplayListenerSubscription(token);
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* Adds display listener object {@link IDisplayListener} to receive
|
|
191
|
+
* callbacks when display properties change. It returns a
|
|
192
|
+
* {@link ISubscription} object, which is used to unsubscribe the listener
|
|
193
|
+
* from receiving events through {@link ISubscription.unsubscribe()}.
|
|
194
|
+
* @param listener IDisplayListener interface
|
|
195
|
+
* @return ISubscription object related to this listener @see DisplayListenerSubscription
|
|
196
|
+
*/
|
|
197
|
+
static addDisplayListener2(listener) {
|
|
198
|
+
let token = AmazonGraphicsTurboModule_1.default.addDisplayListener2(listener.onConfigChange, listener.onRefreshRateChange, listener.onColorDepthChange, listener.onColorSpaceChange, listener.onHdcpLevelChange, listener.onAutoConfigSwitchStateChange, listener.onMultipleRefreshRateStateChange, listener.onLowLatencyModeStateChange, listener.onHdrModeChange, listener.onSinkStateChange || (() => { })); // Provide a no-op function if onSinkStateChange is undefined
|
|
199
|
+
return new DisplayListenerSubscription(token);
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* Below APIs are just wrapper APIs and does not have direct 1:1 mapping
|
|
203
|
+
* with native APIs.
|
|
204
|
+
*/
|
|
205
|
+
/**
|
|
206
|
+
* Check if display supports HDR (High Definition Range) or not.
|
|
207
|
+
*/
|
|
208
|
+
static isHDRSupported() {
|
|
209
|
+
const displayConfigList = AmazonGraphicsTurboModule_1.default.getAllSupportedConfigs();
|
|
210
|
+
for (const displayConfig of displayConfigList) {
|
|
211
|
+
for (const hdrType of displayConfig.supportedHdrType) {
|
|
212
|
+
if (hdrType !== types_1.HdrType.NONE) {
|
|
213
|
+
// Found a HDR type which is either HDR10, HDR10+, Dolby Vision or HLG
|
|
214
|
+
// and all these HDR types support BT.2020 color gamut.
|
|
215
|
+
return true;
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
return false;
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* Check if the display supports BT.2020 / Rec.2020 colorimetry standard.
|
|
223
|
+
*/
|
|
224
|
+
static isBT2020ColorimetrySupported() {
|
|
225
|
+
// Any of the HDR types (HDR10, HDR10+, Dolby Vision, HLG) support BT.2020 color gamut.
|
|
226
|
+
return this.isHDRSupported();
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* Query the supported transfer functions by the display.
|
|
230
|
+
*/
|
|
231
|
+
static getTransferFunctions() {
|
|
232
|
+
let transferFunctionList = [types_1.TransferFunction.SRGB];
|
|
233
|
+
const displayConfigList = AmazonGraphicsTurboModule_1.default.getAllSupportedConfigs();
|
|
234
|
+
for (const displayConfig of displayConfigList) {
|
|
235
|
+
for (const hdrType of displayConfig.supportedHdrType) {
|
|
236
|
+
if (hdrType === types_1.HdrType.HLG) {
|
|
237
|
+
transferFunctionList.push(types_1.TransferFunction.HLG);
|
|
238
|
+
}
|
|
239
|
+
else if (hdrType !== types_1.HdrType.NONE) {
|
|
240
|
+
// HDR10 / HDR10+ / Dolby Vision
|
|
241
|
+
transferFunctionList.push(types_1.TransferFunction.PQ);
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
return transferFunctionList;
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
exports.Display = Display;
|
|
249
|
+
exports.default = Display;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { type ISubscription, type IDisplayControllerListener } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* DisplayController specific operations are done through this
|
|
4
|
+
* class abstraction.
|
|
5
|
+
*/
|
|
6
|
+
export declare class DisplayController {
|
|
7
|
+
constructor();
|
|
8
|
+
/**
|
|
9
|
+
* Adds display controller listener object {@link IDisplayControllerListener}
|
|
10
|
+
* to receive callbacks when primary display is added (connected) or removed (disconnected).
|
|
11
|
+
* It returns a {@link ISubscription} object, which is used to unsubscribe
|
|
12
|
+
* the listener from receiving the events through {@link ISubscription.unsubscribe}.
|
|
13
|
+
*
|
|
14
|
+
* @param listener IDisplayControllerListener object to listen for display
|
|
15
|
+
* controller events.
|
|
16
|
+
* @return ISubscription object corresponding to the listener @see DisplayControllerListenerSubscription
|
|
17
|
+
*/
|
|
18
|
+
static addListener(listener: IDisplayControllerListener): ISubscription;
|
|
19
|
+
/**
|
|
20
|
+
* Check if primary display is connected to the device and ready to use.
|
|
21
|
+
* @return return true if display is connected, false otherwise.
|
|
22
|
+
*/
|
|
23
|
+
static isPrimaryDisplayConnected(): boolean;
|
|
24
|
+
}
|
|
25
|
+
export default DisplayController;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.DisplayController = void 0;
|
|
7
|
+
const AmazonGraphicsTurboModule_1 = __importDefault(require("./AmazonGraphicsTurboModule"));
|
|
8
|
+
if (!AmazonGraphicsTurboModule_1.default) {
|
|
9
|
+
throw new Error(`AmazonGraphicsTurboModule turbo-module is null.`);
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Display Controller Listener callback cancellation is handled through
|
|
13
|
+
* this Subscription object retuned after calling {@link DisplayController#addListener}
|
|
14
|
+
*/
|
|
15
|
+
class DisplayControllerListenerSubscription {
|
|
16
|
+
token;
|
|
17
|
+
constructor(token) {
|
|
18
|
+
this.token = token;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Unsubscribes the listener.
|
|
22
|
+
*/
|
|
23
|
+
unsubscribe() {
|
|
24
|
+
AmazonGraphicsTurboModule_1.default.removeDisplayControllerListener(this.token);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* DisplayController specific operations are done through this
|
|
29
|
+
* class abstraction.
|
|
30
|
+
*/
|
|
31
|
+
class DisplayController {
|
|
32
|
+
constructor() { }
|
|
33
|
+
/**
|
|
34
|
+
* Adds display controller listener object {@link IDisplayControllerListener}
|
|
35
|
+
* to receive callbacks when primary display is added (connected) or removed (disconnected).
|
|
36
|
+
* It returns a {@link ISubscription} object, which is used to unsubscribe
|
|
37
|
+
* the listener from receiving the events through {@link ISubscription.unsubscribe}.
|
|
38
|
+
*
|
|
39
|
+
* @param listener IDisplayControllerListener object to listen for display
|
|
40
|
+
* controller events.
|
|
41
|
+
* @return ISubscription object corresponding to the listener @see DisplayControllerListenerSubscription
|
|
42
|
+
*/
|
|
43
|
+
static addListener(listener) {
|
|
44
|
+
let token = AmazonGraphicsTurboModule_1.default.addDisplayControllerListener(listener.onAddDisplay, listener.onRemoveDisplay);
|
|
45
|
+
return new DisplayControllerListenerSubscription(token);
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Check if primary display is connected to the device and ready to use.
|
|
49
|
+
* @return return true if display is connected, false otherwise.
|
|
50
|
+
*/
|
|
51
|
+
static isPrimaryDisplayConnected() {
|
|
52
|
+
return AmazonGraphicsTurboModule_1.default.isPrimaryDisplayConnected();
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
exports.DisplayController = DisplayController;
|
|
56
|
+
exports.default = DisplayController;
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { ColorDepth, ColorSpace, HdrMode, LlmState, type IDisplayConfig, type IDisplayManagerListener, type ISubscription } from '../types';
|
|
2
|
+
import { Int32, Double } from 'react-native-tscodegen-types';
|
|
3
|
+
/**
|
|
4
|
+
* DisplayManager provides APIs to change the display configuration/settings.
|
|
5
|
+
* Clients require the application privilege "com.amazon.graphics.privilege.display.manager"
|
|
6
|
+
* to invoke APIs of this class.
|
|
7
|
+
*/
|
|
8
|
+
export declare class DisplayManager {
|
|
9
|
+
constructor();
|
|
10
|
+
/**
|
|
11
|
+
* Request Display Server to switch to a certain color depth.
|
|
12
|
+
* This API requires the client to have "com.amazon.graphics.privilege.display.manager"
|
|
13
|
+
* application privilege.
|
|
14
|
+
* @param colorDepth Requested new color depth.
|
|
15
|
+
*/
|
|
16
|
+
static setColorDepth(colorDepth: ColorDepth): void;
|
|
17
|
+
/**
|
|
18
|
+
* Requests Display Server to switch to the supplied color space e.g. RGB or YUV etc.
|
|
19
|
+
* This API requires the client to have "com.amazon.graphics.privilege.display.manager"
|
|
20
|
+
* application privilege.
|
|
21
|
+
* @param colorSpace Requested new color space.
|
|
22
|
+
*/
|
|
23
|
+
static setColorSpace(colorSpace: ColorSpace): void;
|
|
24
|
+
/**
|
|
25
|
+
* Enable or disable HDR mode.
|
|
26
|
+
* This API requires the client to have "com.amazon.graphics.privilege.display.manager"
|
|
27
|
+
* application privilege.
|
|
28
|
+
* @param mode Requested HDR mode.
|
|
29
|
+
*/
|
|
30
|
+
static setHdrMode(hdrMode: HdrMode): void;
|
|
31
|
+
/**
|
|
32
|
+
* Enable or disable Low latency mode.
|
|
33
|
+
* This API requires the client to have "com.amazon.graphics.privilege.display.manager"
|
|
34
|
+
* application privilege.
|
|
35
|
+
* @param state Requested latency mode.
|
|
36
|
+
*/
|
|
37
|
+
static setLowLatencyModeState(llmState: LlmState): void;
|
|
38
|
+
/**
|
|
39
|
+
* Set the MRR state of the display. MRR is a feature which allows clients to request
|
|
40
|
+
* alternate refresh rate which might be more appropriate for their content.
|
|
41
|
+
* This is a global MRR state for a display and controls if applications can request display server
|
|
42
|
+
* to switch to one of the other supported refresh rates which closely matches original content frame rate.
|
|
43
|
+
* This API requires the client to have "com.amazon.graphics.privilege.display.manager"
|
|
44
|
+
* application privilege.
|
|
45
|
+
* @param state MRR state being requested to be used for this display.
|
|
46
|
+
*/
|
|
47
|
+
static setMultipleRefreshRateState(mrrState: boolean): void;
|
|
48
|
+
/**
|
|
49
|
+
* Request the display to switch to a new config.
|
|
50
|
+
* {@link IDisplayListener.onConfigChange} will be called upon successful completion.
|
|
51
|
+
* This API requires the client to have "com.amazon.graphics.privilege.display.manager"
|
|
52
|
+
* application privilege.
|
|
53
|
+
* @param displayConfig The new requested display config.
|
|
54
|
+
*/
|
|
55
|
+
static requestConfigChange(displayConfig: IDisplayConfig, refreshRateInMillihertz: Int32): void;
|
|
56
|
+
/**
|
|
57
|
+
* Request the display to switch to a new config automatically. In this mode, display server selects
|
|
58
|
+
* the most appropriate config dynamically based on various factors. IDisplayListener.onConfigChange
|
|
59
|
+
* will still be called upon a successful config switch. Please note, calling enableAutoConfigSwitch(true)
|
|
60
|
+
* would override previous requestConfigChange() call.
|
|
61
|
+
* The default state is "true".
|
|
62
|
+
* This API requires the client to have "com.amazon.graphics.privilege.display.manager" application privilege.
|
|
63
|
+
* @param enable If true, display subsystem would choose appropriate config automatically.
|
|
64
|
+
*/
|
|
65
|
+
static enableAutoConfigSwitch(enable: boolean): void;
|
|
66
|
+
/**
|
|
67
|
+
* Requests display server to adjust the visible area of the display to
|
|
68
|
+
* ensure content is not lost beyond the screen's physical borders. The API takes the
|
|
69
|
+
* widths of the four borders or margins as a percentage of width or height.
|
|
70
|
+
* This API requires the client to have "com.amazon.graphics.privilege.display.manager"
|
|
71
|
+
* application privilege.
|
|
72
|
+
* @param leftBorderAsPercentageWidth The left border as percentage of width.
|
|
73
|
+
* @param topBorderAsPercentageOfHeight The top border as percentage of
|
|
74
|
+
* height.
|
|
75
|
+
* @param rightBorderAsPercentageOfWidth The right border as percentage of
|
|
76
|
+
* width.
|
|
77
|
+
* @param bottomBorderAsPercentageOfHeight The bottom border as percentage of
|
|
78
|
+
* height.
|
|
79
|
+
*/
|
|
80
|
+
static setOverscanBorder(leftBorderAsPercentageOfWidth: Double, topBorderAsPercentageOfHeight: Double, rightBorderAsPercentageOfWidth: Double, bottomBorderAsPercentageOfHeight: Double): void;
|
|
81
|
+
/**
|
|
82
|
+
* Adds display manager listener object {@link IDisplayManagerListener} to receive
|
|
83
|
+
* callbacks when display manager properties change.
|
|
84
|
+
* It returns a {@link ISubscription} object, which is used to unsubscribe the listener
|
|
85
|
+
* from receiving events through {@link ISubscription.unsubscribe()}.
|
|
86
|
+
* @param listener IDisplayManagerListener interface
|
|
87
|
+
* @return ISubscription object related to this listener @see DisplayManagerListenerSubscription
|
|
88
|
+
*/
|
|
89
|
+
static addListener(listener: IDisplayManagerListener): ISubscription;
|
|
90
|
+
/**
|
|
91
|
+
* Request the display manager to commit all pending states.
|
|
92
|
+
* Please note, this function has to be called for any changes to be applied.
|
|
93
|
+
* This API will only update the pending states and it will actually try to apply all the pending
|
|
94
|
+
* states change requests made since last commitStates() call.
|
|
95
|
+
* The benefit of having a single commit call is that fact that clients can apply multiple dependent states
|
|
96
|
+
* together on display hardware.
|
|
97
|
+
* Client can know the result of the commit request through {@link IDisplayManagerListener}.
|
|
98
|
+
* This API requires the client to have "com.amazon.graphics.privilege.display.manager" application privilege.
|
|
99
|
+
* @return commit id which can be used to track the commit status.
|
|
100
|
+
*/
|
|
101
|
+
static commitStates(): number;
|
|
102
|
+
}
|
|
103
|
+
export default DisplayManager;
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.DisplayManager = void 0;
|
|
7
|
+
const AmazonGraphicsTurboModule_1 = __importDefault(require("./AmazonGraphicsTurboModule"));
|
|
8
|
+
if (!AmazonGraphicsTurboModule_1.default) {
|
|
9
|
+
throw new Error(`AmazonGraphicsTurboModule turbo-module is null.`);
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Display Manager Listener callback cancellation is handled through
|
|
13
|
+
* this Subscription object retuned after calling {@link DisplayController#addListener}
|
|
14
|
+
*/
|
|
15
|
+
class DisplayManagerListenerSubscription {
|
|
16
|
+
token;
|
|
17
|
+
constructor(token) {
|
|
18
|
+
this.token = token;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Unsubscribes the listener.
|
|
22
|
+
*/
|
|
23
|
+
unsubscribe() {
|
|
24
|
+
AmazonGraphicsTurboModule_1.default.removeDisplayManagerListener(this.token);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* DisplayManager provides APIs to change the display configuration/settings.
|
|
29
|
+
* Clients require the application privilege "com.amazon.graphics.privilege.display.manager"
|
|
30
|
+
* to invoke APIs of this class.
|
|
31
|
+
*/
|
|
32
|
+
class DisplayManager {
|
|
33
|
+
constructor() { }
|
|
34
|
+
/**
|
|
35
|
+
* Request Display Server to switch to a certain color depth.
|
|
36
|
+
* This API requires the client to have "com.amazon.graphics.privilege.display.manager"
|
|
37
|
+
* application privilege.
|
|
38
|
+
* @param colorDepth Requested new color depth.
|
|
39
|
+
*/
|
|
40
|
+
static setColorDepth(colorDepth) {
|
|
41
|
+
AmazonGraphicsTurboModule_1.default.setColorDepth(colorDepth);
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Requests Display Server to switch to the supplied color space e.g. RGB or YUV etc.
|
|
45
|
+
* This API requires the client to have "com.amazon.graphics.privilege.display.manager"
|
|
46
|
+
* application privilege.
|
|
47
|
+
* @param colorSpace Requested new color space.
|
|
48
|
+
*/
|
|
49
|
+
static setColorSpace(colorSpace) {
|
|
50
|
+
AmazonGraphicsTurboModule_1.default.setColorSpace(colorSpace);
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Enable or disable HDR mode.
|
|
54
|
+
* This API requires the client to have "com.amazon.graphics.privilege.display.manager"
|
|
55
|
+
* application privilege.
|
|
56
|
+
* @param mode Requested HDR mode.
|
|
57
|
+
*/
|
|
58
|
+
static setHdrMode(hdrMode) {
|
|
59
|
+
AmazonGraphicsTurboModule_1.default.setHdrMode(hdrMode);
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Enable or disable Low latency mode.
|
|
63
|
+
* This API requires the client to have "com.amazon.graphics.privilege.display.manager"
|
|
64
|
+
* application privilege.
|
|
65
|
+
* @param state Requested latency mode.
|
|
66
|
+
*/
|
|
67
|
+
static setLowLatencyModeState(llmState) {
|
|
68
|
+
AmazonGraphicsTurboModule_1.default.setLowLatencyModeState(llmState);
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Set the MRR state of the display. MRR is a feature which allows clients to request
|
|
72
|
+
* alternate refresh rate which might be more appropriate for their content.
|
|
73
|
+
* This is a global MRR state for a display and controls if applications can request display server
|
|
74
|
+
* to switch to one of the other supported refresh rates which closely matches original content frame rate.
|
|
75
|
+
* This API requires the client to have "com.amazon.graphics.privilege.display.manager"
|
|
76
|
+
* application privilege.
|
|
77
|
+
* @param state MRR state being requested to be used for this display.
|
|
78
|
+
*/
|
|
79
|
+
static setMultipleRefreshRateState(mrrState) {
|
|
80
|
+
AmazonGraphicsTurboModule_1.default.setMultipleRefreshRateState(mrrState);
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Request the display to switch to a new config.
|
|
84
|
+
* {@link IDisplayListener.onConfigChange} will be called upon successful completion.
|
|
85
|
+
* This API requires the client to have "com.amazon.graphics.privilege.display.manager"
|
|
86
|
+
* application privilege.
|
|
87
|
+
* @param displayConfig The new requested display config.
|
|
88
|
+
*/
|
|
89
|
+
static requestConfigChange(displayConfig, refreshRateInMillihertz) {
|
|
90
|
+
return AmazonGraphicsTurboModule_1.default.requestConfigChange(displayConfig, refreshRateInMillihertz);
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Request the display to switch to a new config automatically. In this mode, display server selects
|
|
94
|
+
* the most appropriate config dynamically based on various factors. IDisplayListener.onConfigChange
|
|
95
|
+
* will still be called upon a successful config switch. Please note, calling enableAutoConfigSwitch(true)
|
|
96
|
+
* would override previous requestConfigChange() call.
|
|
97
|
+
* The default state is "true".
|
|
98
|
+
* This API requires the client to have "com.amazon.graphics.privilege.display.manager" application privilege.
|
|
99
|
+
* @param enable If true, display subsystem would choose appropriate config automatically.
|
|
100
|
+
*/
|
|
101
|
+
static enableAutoConfigSwitch(enable) {
|
|
102
|
+
AmazonGraphicsTurboModule_1.default.enableAutoConfigSwitch(enable);
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Requests display server to adjust the visible area of the display to
|
|
106
|
+
* ensure content is not lost beyond the screen's physical borders. The API takes the
|
|
107
|
+
* widths of the four borders or margins as a percentage of width or height.
|
|
108
|
+
* This API requires the client to have "com.amazon.graphics.privilege.display.manager"
|
|
109
|
+
* application privilege.
|
|
110
|
+
* @param leftBorderAsPercentageWidth The left border as percentage of width.
|
|
111
|
+
* @param topBorderAsPercentageOfHeight The top border as percentage of
|
|
112
|
+
* height.
|
|
113
|
+
* @param rightBorderAsPercentageOfWidth The right border as percentage of
|
|
114
|
+
* width.
|
|
115
|
+
* @param bottomBorderAsPercentageOfHeight The bottom border as percentage of
|
|
116
|
+
* height.
|
|
117
|
+
*/
|
|
118
|
+
static setOverscanBorder(leftBorderAsPercentageOfWidth, topBorderAsPercentageOfHeight, rightBorderAsPercentageOfWidth, bottomBorderAsPercentageOfHeight) {
|
|
119
|
+
return AmazonGraphicsTurboModule_1.default.setOverscanBorder(leftBorderAsPercentageOfWidth, topBorderAsPercentageOfHeight, rightBorderAsPercentageOfWidth, bottomBorderAsPercentageOfHeight);
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Adds display manager listener object {@link IDisplayManagerListener} to receive
|
|
123
|
+
* callbacks when display manager properties change.
|
|
124
|
+
* It returns a {@link ISubscription} object, which is used to unsubscribe the listener
|
|
125
|
+
* from receiving events through {@link ISubscription.unsubscribe()}.
|
|
126
|
+
* @param listener IDisplayManagerListener interface
|
|
127
|
+
* @return ISubscription object related to this listener @see DisplayManagerListenerSubscription
|
|
128
|
+
*/
|
|
129
|
+
static addListener(listener) {
|
|
130
|
+
let token = AmazonGraphicsTurboModule_1.default.addDisplayManagerListener(listener.onCommitSuccess, listener.onCommitFailure);
|
|
131
|
+
return new DisplayManagerListenerSubscription(token);
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Request the display manager to commit all pending states.
|
|
135
|
+
* Please note, this function has to be called for any changes to be applied.
|
|
136
|
+
* This API will only update the pending states and it will actually try to apply all the pending
|
|
137
|
+
* states change requests made since last commitStates() call.
|
|
138
|
+
* The benefit of having a single commit call is that fact that clients can apply multiple dependent states
|
|
139
|
+
* together on display hardware.
|
|
140
|
+
* Client can know the result of the commit request through {@link IDisplayManagerListener}.
|
|
141
|
+
* This API requires the client to have "com.amazon.graphics.privilege.display.manager" application privilege.
|
|
142
|
+
* @return commit id which can be used to track the commit status.
|
|
143
|
+
*/
|
|
144
|
+
static commitStates() {
|
|
145
|
+
return AmazonGraphicsTurboModule_1.default.commitStates();
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
exports.DisplayManager = DisplayManager;
|
|
149
|
+
exports.default = DisplayManager;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ColorDepth, ColorSpace, HdrMode, LlmState } from '../../types';
|
|
2
|
+
declare const _default: {
|
|
3
|
+
getMajorVersion: () => number;
|
|
4
|
+
getMinorVersion: () => number;
|
|
5
|
+
getPatchVersion: () => number;
|
|
6
|
+
setColorDepth: ColorDepth;
|
|
7
|
+
setColorSpace: ColorSpace;
|
|
8
|
+
setHdrMode: HdrMode;
|
|
9
|
+
setLowLatencyModeState: LlmState;
|
|
10
|
+
setMultipleRefreshRateState: boolean;
|
|
11
|
+
getColorDepth: () => ColorDepth;
|
|
12
|
+
getColorSpace: () => ColorSpace;
|
|
13
|
+
getHdrMode: () => HdrMode;
|
|
14
|
+
getLowLatencyModeState: () => LlmState;
|
|
15
|
+
isMultipleRefreshRateEnabled: () => boolean;
|
|
16
|
+
};
|
|
17
|
+
export default _default;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright (c) 2024 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
4
|
+
*
|
|
5
|
+
* PROPRIETARY/CONFIDENTIAL
|
|
6
|
+
*
|
|
7
|
+
* Use is subject to license terms.
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
const types_1 = require("../../types");
|
|
11
|
+
exports.default = {
|
|
12
|
+
getMajorVersion: () => 1,
|
|
13
|
+
getMinorVersion: () => 0,
|
|
14
|
+
getPatchVersion: () => 0,
|
|
15
|
+
setColorDepth: (types_1.ColorDepth.COLORDEPTH_8),
|
|
16
|
+
setColorSpace: (types_1.ColorSpace.AUTO),
|
|
17
|
+
setHdrMode: (types_1.HdrMode.DISABLED),
|
|
18
|
+
setLowLatencyModeState: (types_1.LlmState.LLM_AUTO),
|
|
19
|
+
setMultipleRefreshRateState: (false),
|
|
20
|
+
getColorDepth: () => types_1.ColorDepth.COLORDEPTH_8,
|
|
21
|
+
getColorSpace: () => types_1.ColorSpace.AUTO,
|
|
22
|
+
getHdrMode: () => types_1.HdrMode.DISABLED,
|
|
23
|
+
getLowLatencyModeState: () => types_1.LlmState.LLM_OFF,
|
|
24
|
+
isMultipleRefreshRateEnabled: () => false,
|
|
25
|
+
};
|