Loading core/java/android/app/VrManager.java +16 −0 Original line number Diff line number Diff line Loading @@ -198,4 +198,20 @@ public class VrManager { e.rethrowFromSystemServer(); } } /** * Sets the current standby status of the VR device. Standby mode is only used on standalone vr * devices. Standby mode is a deep sleep state where it's appropriate to turn off vr mode. * * @param standby True if the device is entering standby, false if it's exiting standby. * @hide */ @RequiresPermission(android.Manifest.permission.ACCESS_VR_MANAGER) public void setStandbyEnabled(boolean standby) { try { mService.setStandbyEnabled(standby); } catch (RemoteException e) { e.rethrowFromSystemServer(); } } } core/java/android/service/vr/IVrManager.aidl +8 −0 Original line number Diff line number Diff line Loading @@ -101,5 +101,13 @@ interface IVrManager { * application's compositor process to bind to, or null to clear the current binding. */ void setAndBindCompositor(in String componentName); /** * Sets the current standby status of the VR device. Standby mode is only used on standalone vr * devices. Standby mode is a deep sleep state where it's appropriate to turn off vr mode. * * @param standy True if the device is entering standby, false if it's exiting standby. */ void setStandbyEnabled(boolean standby); } services/core/java/com/android/server/vr/VrManagerService.java +25 −1 Original line number Diff line number Diff line Loading @@ -166,6 +166,8 @@ public class VrManagerService extends SystemService implements EnabledComponentC private boolean mUserUnlocked; private Vr2dDisplay mVr2dDisplay; private boolean mBootsToVr; private boolean mStandby; private boolean mUseStandbyToExitVrMode; // Handles events from the managed services (e.g. VrListenerService and any bound VR compositor // service). Loading Loading @@ -203,7 +205,10 @@ public class VrManagerService extends SystemService implements EnabledComponentC * */ private void updateVrModeAllowedLocked() { boolean allowed = mSystemSleepFlags == FLAG_ALL && mUserUnlocked; boolean ignoreSleepFlags = mBootsToVr && mUseStandbyToExitVrMode; boolean disallowedByStandby = mStandby && mUseStandbyToExitVrMode; boolean allowed = (mSystemSleepFlags == FLAG_ALL || ignoreSleepFlags) && mUserUnlocked && !disallowedByStandby; if (mVrModeAllowed != allowed) { mVrModeAllowed = allowed; if (DBG) Slog.d(TAG, "VR mode is " + ((allowed) ? "allowed" : "disallowed")); Loading Loading @@ -273,6 +278,17 @@ public class VrManagerService extends SystemService implements EnabledComponentC } } private void setStandbyEnabled(boolean standby) { synchronized(mLock) { if (!mBootsToVr) { Slog.e(TAG, "Attempting to set standby mode on a non-standalone device"); return; } mStandby = standby; updateVrModeAllowedLocked(); } } private final Handler mHandler = new Handler() { @Override public void handleMessage(Message msg) { Loading Loading @@ -586,6 +602,12 @@ public class VrManagerService extends SystemService implements EnabledComponentC (componentName == null) ? null : ComponentName.unflattenFromString(componentName)); } @Override public void setStandbyEnabled(boolean standby) { enforceCallerPermissionAnyOf(Manifest.permission.ACCESS_VR_MANAGER); VrManagerService.this.setStandbyEnabled(standby); } @Override protected void dump(FileDescriptor fd, PrintWriter pw, String[] args) { if (!DumpUtils.checkDumpPermission(mContext, TAG, pw)) return; Loading Loading @@ -733,6 +755,8 @@ public class VrManagerService extends SystemService implements EnabledComponentC } mBootsToVr = SystemProperties.getBoolean("ro.boot.vr", false); mUseStandbyToExitVrMode = mBootsToVr && SystemProperties.getBoolean("persist.vr.use_standby_to_exit_vr_mode", false); publishLocalService(VrManagerInternal.class, new LocalService()); publishBinderService(Context.VR_SERVICE, mVrManager.asBinder()); } Loading Loading
core/java/android/app/VrManager.java +16 −0 Original line number Diff line number Diff line Loading @@ -198,4 +198,20 @@ public class VrManager { e.rethrowFromSystemServer(); } } /** * Sets the current standby status of the VR device. Standby mode is only used on standalone vr * devices. Standby mode is a deep sleep state where it's appropriate to turn off vr mode. * * @param standby True if the device is entering standby, false if it's exiting standby. * @hide */ @RequiresPermission(android.Manifest.permission.ACCESS_VR_MANAGER) public void setStandbyEnabled(boolean standby) { try { mService.setStandbyEnabled(standby); } catch (RemoteException e) { e.rethrowFromSystemServer(); } } }
core/java/android/service/vr/IVrManager.aidl +8 −0 Original line number Diff line number Diff line Loading @@ -101,5 +101,13 @@ interface IVrManager { * application's compositor process to bind to, or null to clear the current binding. */ void setAndBindCompositor(in String componentName); /** * Sets the current standby status of the VR device. Standby mode is only used on standalone vr * devices. Standby mode is a deep sleep state where it's appropriate to turn off vr mode. * * @param standy True if the device is entering standby, false if it's exiting standby. */ void setStandbyEnabled(boolean standby); }
services/core/java/com/android/server/vr/VrManagerService.java +25 −1 Original line number Diff line number Diff line Loading @@ -166,6 +166,8 @@ public class VrManagerService extends SystemService implements EnabledComponentC private boolean mUserUnlocked; private Vr2dDisplay mVr2dDisplay; private boolean mBootsToVr; private boolean mStandby; private boolean mUseStandbyToExitVrMode; // Handles events from the managed services (e.g. VrListenerService and any bound VR compositor // service). Loading Loading @@ -203,7 +205,10 @@ public class VrManagerService extends SystemService implements EnabledComponentC * */ private void updateVrModeAllowedLocked() { boolean allowed = mSystemSleepFlags == FLAG_ALL && mUserUnlocked; boolean ignoreSleepFlags = mBootsToVr && mUseStandbyToExitVrMode; boolean disallowedByStandby = mStandby && mUseStandbyToExitVrMode; boolean allowed = (mSystemSleepFlags == FLAG_ALL || ignoreSleepFlags) && mUserUnlocked && !disallowedByStandby; if (mVrModeAllowed != allowed) { mVrModeAllowed = allowed; if (DBG) Slog.d(TAG, "VR mode is " + ((allowed) ? "allowed" : "disallowed")); Loading Loading @@ -273,6 +278,17 @@ public class VrManagerService extends SystemService implements EnabledComponentC } } private void setStandbyEnabled(boolean standby) { synchronized(mLock) { if (!mBootsToVr) { Slog.e(TAG, "Attempting to set standby mode on a non-standalone device"); return; } mStandby = standby; updateVrModeAllowedLocked(); } } private final Handler mHandler = new Handler() { @Override public void handleMessage(Message msg) { Loading Loading @@ -586,6 +602,12 @@ public class VrManagerService extends SystemService implements EnabledComponentC (componentName == null) ? null : ComponentName.unflattenFromString(componentName)); } @Override public void setStandbyEnabled(boolean standby) { enforceCallerPermissionAnyOf(Manifest.permission.ACCESS_VR_MANAGER); VrManagerService.this.setStandbyEnabled(standby); } @Override protected void dump(FileDescriptor fd, PrintWriter pw, String[] args) { if (!DumpUtils.checkDumpPermission(mContext, TAG, pw)) return; Loading Loading @@ -733,6 +755,8 @@ public class VrManagerService extends SystemService implements EnabledComponentC } mBootsToVr = SystemProperties.getBoolean("ro.boot.vr", false); mUseStandbyToExitVrMode = mBootsToVr && SystemProperties.getBoolean("persist.vr.use_standby_to_exit_vr_mode", false); publishLocalService(VrManagerInternal.class, new LocalService()); publishBinderService(Context.VR_SERVICE, mVrManager.asBinder()); } Loading