SurfaceControl: add setAllowedDisplayConfigs

expose ISurfaceComposer::setAllowedDisplayConfigs to SurfaceControl.
This API is expected to be called by DisplayManager depends on the
current policy in place. Once setAllowedDisplayConfigs is called,
SF can only set a new display config if it is part of the allowed
configurations list.

Test: call setAllowedDisplayConfigs() from SurfaceControl and
observe config change.
Bug: 122905403
Change-Id: I7f8cc09dbec352701f5dcf2595bee66b8380bc00
This commit is contained in:
Ady Abraham
2019-01-24 18:48:58 -08:00
parent 01dd1a233d
commit 6070ce1be3
2 changed files with 37 additions and 0 deletions

View File

@@ -157,6 +157,8 @@ public final class SurfaceControl implements Parcelable {
IBinder displayToken, long numFrames, long timestamp);
private static native int nativeGetActiveConfig(IBinder displayToken);
private static native boolean nativeSetActiveConfig(IBinder displayToken, int id);
private static native boolean nativeSetAllowedDisplayConfigs(IBinder displayToken,
int[] allowedConfigs);
private static native int[] nativeGetDisplayColorModes(IBinder displayToken);
private static native SurfaceControl.DisplayPrimaries nativeGetDisplayNativePrimaries(
IBinder displayToken);
@@ -1518,6 +1520,20 @@ public final class SurfaceControl implements Parcelable {
return nativeSetActiveConfig(displayToken, id);
}
/**
* @hide
*/
public static boolean setAllowedDisplayConfigs(IBinder displayToken, int[] allowedConfigs) {
if (displayToken == null) {
throw new IllegalArgumentException("displayToken must not be null");
}
if (allowedConfigs == null) {
throw new IllegalArgumentException("allowedConfigs must not be null");
}
return nativeSetAllowedDisplayConfigs(displayToken, allowedConfigs);
}
/**
* @hide
*/