summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilliam McVicker <william.mcvicker@razer.com>2019-01-15 22:09:36 (GMT)
committerBruno Martins <bgcngm@gmail.com>2019-08-20 09:46:57 (GMT)
commit7f11f6fe38192d4fcb363c4543297f32ad26df89 (patch)
treeca1817f2542e5f5d05a89346a669aa6e7b66aa57
parent368894d2a94ce3028243f7506a55e623a576865c (diff)
downloadframeworks_base-7f11f6fe38192d4fcb363c4543297f32ad26df89.zip
frameworks_base-7f11f6fe38192d4fcb363c4543297f32ad26df89.tar.gz
frameworks_base-7f11f6fe38192d4fcb363c4543297f32ad26df89.tar.bz2
Set default VR_MODE based on VR feature support
If a device doesn't support VR low persistence mode, then don't enable it by default. Tested: * run vts -m VtsHalLightV2_0Target Change-Id: Ic5e275aea5484391e9162dc64467244b226680f1
-rw-r--r--services/core/java/com/android/server/lights/LightsService.java8
1 files changed, 7 insertions, 1 deletions
diff --git a/services/core/java/com/android/server/lights/LightsService.java b/services/core/java/com/android/server/lights/LightsService.java
index 960f405..9dee017 100644
--- a/services/core/java/com/android/server/lights/LightsService.java
+++ b/services/core/java/com/android/server/lights/LightsService.java
@@ -20,6 +20,7 @@ import com.android.server.SystemService;
import android.app.ActivityManager;
import android.content.Context;
+import android.content.pm.PackageManager;
import android.os.Handler;
import android.os.Message;
import android.os.Trace;
@@ -201,9 +202,14 @@ public class LightsService extends SystemService {
private int getVrDisplayMode() {
int currentUser = ActivityManager.getCurrentUser();
+
+ final PackageManager pm = getContext().getPackageManager();
+ boolean lpEnable = pm.hasSystemFeature(PackageManager.FEATURE_VR_MODE_HIGH_PERFORMANCE);
+
return Settings.Secure.getIntForUser(getContext().getContentResolver(),
Settings.Secure.VR_DISPLAY_MODE,
- /*default*/Settings.Secure.VR_DISPLAY_MODE_LOW_PERSISTENCE,
+ lpEnable ? Settings.Secure.VR_DISPLAY_MODE_LOW_PERSISTENCE :
+ Settings.Secure.VR_DISPLAY_MODE_OFF,
currentUser);
}