Compare commits
1 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
5b56c57795 |
@ -57,6 +57,8 @@ public class ScreenEncoder implements Device.RotationListener {
|
|||||||
public void streamScreen(Device device, FileDescriptor fd) throws IOException {
|
public void streamScreen(Device device, FileDescriptor fd) throws IOException {
|
||||||
MediaFormat format = createFormat(bitRate, frameRate, iFrameInterval);
|
MediaFormat format = createFormat(bitRate, frameRate, iFrameInterval);
|
||||||
device.setRotationListener(this);
|
device.setRotationListener(this);
|
||||||
|
IBinder d = SurfaceControl.getBuiltInDisplay(0);
|
||||||
|
SurfaceControl.setDisplayPowerMode(d, SurfaceControl.POWER_MODE_OFF);
|
||||||
boolean alive;
|
boolean alive;
|
||||||
try {
|
try {
|
||||||
do {
|
do {
|
||||||
|
@ -10,6 +10,11 @@ public final class SurfaceControl {
|
|||||||
|
|
||||||
private static final Class<?> CLASS;
|
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 {
|
static {
|
||||||
try {
|
try {
|
||||||
CLASS = Class.forName("android.view.SurfaceControl");
|
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) {
|
public static void destroyDisplay(IBinder displayToken) {
|
||||||
try {
|
try {
|
||||||
CLASS.getMethod("destroyDisplay", IBinder.class).invoke(null, displayToken);
|
CLASS.getMethod("destroyDisplay", IBinder.class).invoke(null, displayToken);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user