Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7f11f6fe authored by William McVicker's avatar William McVicker Committed by Bruno Martins
Browse files

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
parent 368894d2
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -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);
    }