summaryrefslogtreecommitdiff
path: root/cmds/vr/src
diff options
context:
space:
mode:
authorSantos Cordon <santoscordon@google.com>2017-06-12 17:57:17 -0700
committerSantos Cordon <santoscordon@google.com>2017-06-29 19:01:39 +0000
commit627a68f8525d3d0125f23f83e88bb9682da7b0a4 (patch)
treef3f2e11246a707f93305fb9b2e909fdd03f49502 /cmds/vr/src
parent98b181b25f6d88d200f61a082dec86aad0d703c0 (diff)
Add ability to turn off VR virtual display functionality.
Add flag to enable/disable virtual displays via the existing setDisplayProperties API. This makes it possible for the VR system to turn off virtual displays if necessary after we ship. Bug: 62546364 Test: Run 'adb shell vr enable-virtual-display [true|false] to toggle while 2d in 3d runs. Change-Id: Iae029be501d61189fced981dbc554e984fa7ed4b
Diffstat (limited to 'cmds/vr/src')
-rw-r--r--cmds/vr/src/com/android/commands/vr/Vr.java24
1 files changed, 23 insertions, 1 deletions
diff --git a/cmds/vr/src/com/android/commands/vr/Vr.java b/cmds/vr/src/com/android/commands/vr/Vr.java
index b765866faef9..8fb1b7b80618 100644
--- a/cmds/vr/src/com/android/commands/vr/Vr.java
+++ b/cmds/vr/src/com/android/commands/vr/Vr.java
@@ -41,6 +41,7 @@ public final class Vr extends BaseCommand {
"set-persistent-vr-mode-enabled";
private static final String COMMAND_SET_VR2D_DISPLAY_PROPERTIES =
"set-display-props";
+ private static final String COMMAND_ENABLE_VD = "enable-virtual-display";
private IVrManager mVrService;
@@ -49,7 +50,8 @@ public final class Vr extends BaseCommand {
out.println(
"usage: vr [subcommand]\n" +
"usage: vr set-persistent-vr-mode-enabled [true|false]\n" +
- "usage: vr set-display-props [width] [height] [dpi]\n"
+ "usage: vr set-display-props [width] [height] [dpi]\n" +
+ "usage: vr enable-virtual-display [true|false]\n"
);
}
@@ -69,6 +71,9 @@ public final class Vr extends BaseCommand {
case COMMAND_SET_PERSISTENT_VR_MODE_ENABLED:
runSetPersistentVrModeEnabled();
break;
+ case COMMAND_ENABLE_VD:
+ runEnableVd();
+ break;
default:
throw new IllegalArgumentException ("unknown command '" + command + "'");
}
@@ -94,6 +99,23 @@ public final class Vr extends BaseCommand {
}
}
+ private void runEnableVd() throws RemoteException {
+ Vr2dDisplayProperties.Builder builder = new Vr2dDisplayProperties.Builder();
+
+ String value = nextArgRequired();
+ if ("true".equals(value)) {
+ builder.setEnabled(true);
+ } else if ("false".equals(value)) {
+ builder.setEnabled(false);
+ } // Don't do anything if not exactly true/false
+
+ try {
+ mVrService.setVr2dDisplayProperties(builder.build());
+ } catch (RemoteException re) {
+ System.err.println("Error: Can't enable (" + value +") virtual display" + re);
+ }
+ }
+
private void runSetPersistentVrModeEnabled() throws RemoteException {
String enableStr = nextArg();
boolean enabled = Boolean.parseBoolean(enableStr);