summaryrefslogtreecommitdiff
path: root/cmds/vr
diff options
context:
space:
mode:
Diffstat (limited to 'cmds/vr')
-rw-r--r--cmds/vr/src/com/android/commands/vr/Vr.java32
1 files changed, 30 insertions, 2 deletions
diff --git a/cmds/vr/src/com/android/commands/vr/Vr.java b/cmds/vr/src/com/android/commands/vr/Vr.java
index 3fb40fbc2ca9..bf97bbaa019b 100644
--- a/cmds/vr/src/com/android/commands/vr/Vr.java
+++ b/cmds/vr/src/com/android/commands/vr/Vr.java
@@ -16,6 +16,7 @@
package com.android.commands.vr;
+import android.app.CompatibilityDisplayProperties;
import android.content.Context;
import android.os.RemoteException;
import android.os.ServiceManager;
@@ -36,7 +37,10 @@ public final class Vr extends BaseCommand {
(new Vr()).run(args);
}
- private static final String COMMAND_SET_PERSISTENT_VR_MODE_ENABLED = "set-persistent-vr-mode-enabled";
+ private static final String COMMAND_SET_PERSISTENT_VR_MODE_ENABLED =
+ "set-persistent-vr-mode-enabled";
+ private static final String COMMAND_SET_COMPATIBILITY_DISPLAY_PROPERTIES =
+ "set-display-props";
private IVrManager mVrService;
@@ -44,7 +48,8 @@ public final class Vr extends BaseCommand {
public void onShowUsage(PrintStream out) {
out.println(
"usage: vr [subcommand]\n" +
- "usage: vr set-persistent-vr-mode-enabled [true|false]\n"
+ "usage: vr set-persistent-vr-mode-enabled [true|false]\n" +
+ "usage: vr set-display-props [width] [height] [dpi]\n"
);
}
@@ -58,6 +63,9 @@ public final class Vr extends BaseCommand {
String command = nextArgRequired();
switch (command) {
+ case COMMAND_SET_COMPATIBILITY_DISPLAY_PROPERTIES:
+ runSetCompatibilityDisplayProperties();
+ break;
case COMMAND_SET_PERSISTENT_VR_MODE_ENABLED:
runSetPersistentVrModeEnabled();
break;
@@ -66,6 +74,26 @@ public final class Vr extends BaseCommand {
}
}
+ private void runSetCompatibilityDisplayProperties() throws RemoteException {
+ String widthStr = nextArgRequired();
+ int width = Integer.parseInt(widthStr);
+
+ String heightStr = nextArgRequired();
+ int height = Integer.parseInt(heightStr);
+
+ String dpiStr = nextArgRequired();
+ int dpi = Integer.parseInt(dpiStr);
+
+ CompatibilityDisplayProperties compatDisplayProperties =
+ new CompatibilityDisplayProperties(width, height, dpi);
+
+ try {
+ mVrService.setCompatibilityDisplayProperties(compatDisplayProperties);
+ } catch (RemoteException re) {
+ System.err.println("Error: Can't set persistent mode " + re);
+ }
+ }
+
private void runSetPersistentVrModeEnabled() throws RemoteException {
String enableStr = nextArg();
boolean enabled = Boolean.parseBoolean(enableStr);