|
|
|
@ -10,6 +10,11 @@ public final class SurfaceControl {
|
|
|
|
|
|
|
|
|
|
private static final Class<?> CLASS;
|
|
|
|
|
|
|
|
|
|
public static final int POWER_MODE_OFF = 0;
|
|
|
|
|
public static final int POWER_MODE_DOZE = 1;
|
|
|
|
|
public static final int POWER_MODE_NORMAL = 2;
|
|
|
|
|
public static final int POWER_MODE_DOZE_SUSPEND = 3;
|
|
|
|
|
|
|
|
|
|
static {
|
|
|
|
|
try {
|
|
|
|
|
CLASS = Class.forName("android.view.SurfaceControl");
|
|
|
|
@ -71,6 +76,22 @@ public final class SurfaceControl {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static IBinder getBuiltInDisplay(int builtInDisplayId) {
|
|
|
|
|
try {
|
|
|
|
|
return (IBinder) CLASS.getMethod("getBuiltInDisplay", int.class).invoke(null, builtInDisplayId);
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
throw new AssertionError(e);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static void setDisplayPowerMode(IBinder displayToken, int mode) {
|
|
|
|
|
try {
|
|
|
|
|
CLASS.getMethod("setDisplayPowerMode", IBinder.class, int.class).invoke(null, displayToken, mode);
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
throw new AssertionError(e);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static void destroyDisplay(IBinder displayToken) {
|
|
|
|
|
try {
|
|
|
|
|
CLASS.getMethod("destroyDisplay", IBinder.class).invoke(null, displayToken);
|
|
|
|
|