diff options
| author | 2018-09-10 17:04:21 +0000 | |
|---|---|---|
| committer | 2018-09-10 17:04:21 +0000 | |
| commit | d3ee26b6168f9a07dde2d04ebcbe0c3cce1fbb41 (patch) | |
| tree | 42646c2addcb66d07a9a407362c0f80483786fea | |
| parent | 302019d97d8642a2533e6117507a72a4eb5a6a82 (diff) | |
| parent | 122d844516d980ff2f010be2d0f0ec63cc6ca588 (diff) | |
Merge changes Ieda9c99d,I3e6777ac,I6c4d0a52,Ie7912c05
* changes:
Revert "Add null check for vrManager"
Revert "Add null check for vrManager"
Revert "Add null check for vrManager"
Revert "Do not start VrManagerService if VR is not supported"
4 files changed, 13 insertions, 20 deletions
diff --git a/core/tests/coretests/src/android/os/SetPersistentVrThreadTest.java b/core/tests/coretests/src/android/os/SetPersistentVrThreadTest.java index 9e445541ad3a..920988be2eb3 100644 --- a/core/tests/coretests/src/android/os/SetPersistentVrThreadTest.java +++ b/core/tests/coretests/src/android/os/SetPersistentVrThreadTest.java @@ -24,6 +24,7 @@ import android.os.Process; import android.provider.Settings; import android.test.ActivityInstrumentationTestCase2; import android.test.suitebuilder.annotation.SmallTest; +import android.util.Log; /** * Tests ActivityManager#setPersistentVrThread and ActivityManager#setVrThread's @@ -75,11 +76,9 @@ public class SetPersistentVrThreadTest extends ActivityInstrumentationTestCase2< } private void setPersistentVrModeEnabled(boolean enable) throws Throwable { - if (mVrManager != null) { - mVrManager.setPersistentVrModeEnabled(enable); - // Allow the system time to send out callbacks for persistent VR mode. - Thread.sleep(200); - } + mVrManager.setPersistentVrModeEnabled(enable); + // Allow the system time to send out callbacks for persistent VR mode. + Thread.sleep(200); } @SmallTest diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java index 7316c02dd226..7ec4db21b694 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java @@ -732,12 +732,10 @@ public class StatusBar extends SystemUI implements DemoMode, IVrManager vrManager = IVrManager.Stub.asInterface(ServiceManager.getService( Context.VR_SERVICE)); - if (vrManager != null) { - try { - vrManager.registerListener(mVrStateCallbacks); - } catch (RemoteException e) { - Slog.e(TAG, "Failed to register VR mode state listener: " + e); - } + try { + vrManager.registerListener(mVrStateCallbacks); + } catch (RemoteException e) { + Slog.e(TAG, "Failed to register VR mode state listener: " + e); } IWallpaperManager wallpaperManager = IWallpaperManager.Stub.asInterface( diff --git a/services/core/java/com/android/server/HardwarePropertiesManagerService.java b/services/core/java/com/android/server/HardwarePropertiesManagerService.java index c593af7cda0a..4016d29fd2e6 100644 --- a/services/core/java/com/android/server/HardwarePropertiesManagerService.java +++ b/services/core/java/com/android/server/HardwarePropertiesManagerService.java @@ -26,6 +26,7 @@ import static android.os.HardwarePropertiesManager.TEMPERATURE_THROTTLING; import static android.os.HardwarePropertiesManager.TEMPERATURE_THROTTLING_BELOW_VR_MIN; import android.Manifest; +import android.app.ActivityManager; import android.app.AppOpsManager; import android.app.admin.DevicePolicyManager; import android.content.Context; @@ -33,8 +34,8 @@ import android.content.pm.PackageManager; import android.os.Binder; import android.os.CpuUsageInfo; import android.os.IHardwarePropertiesManager; +import android.os.Process; import android.os.UserHandle; - import com.android.internal.util.DumpUtils; import com.android.server.vr.VrManagerInternal; @@ -165,14 +166,12 @@ public class HardwarePropertiesManagerService extends IHardwarePropertiesManager final VrManagerInternal vrService = LocalServices.getService(VrManagerInternal.class); final DevicePolicyManager dpm = mContext.getSystemService(DevicePolicyManager.class); if (!dpm.isDeviceOwnerApp(callingPackage) + && !vrService.isCurrentVrListener(callingPackage, userId) && mContext.checkCallingOrSelfPermission(Manifest.permission.DEVICE_POWER) != PackageManager.PERMISSION_GRANTED) { - throw new SecurityException("The caller is not a device owner" + throw new SecurityException("The caller is not a device owner, bound VrListenerService" + ", or holding the DEVICE_POWER permission."); } - if (vrService != null && !vrService.isCurrentVrListener(callingPackage, userId)) { - throw new SecurityException("The caller is not bound VrListenerService."); - } } } diff --git a/services/java/com/android/server/SystemServer.java b/services/java/com/android/server/SystemServer.java index c426ef33ee0e..0b6a33f8c013 100644 --- a/services/java/com/android/server/SystemServer.java +++ b/services/java/com/android/server/SystemServer.java @@ -794,9 +794,6 @@ public final class SystemServer { boolean isWatch = context.getPackageManager().hasSystemFeature( PackageManager.FEATURE_WATCH); - boolean enableVrService = context.getPackageManager().hasSystemFeature( - PackageManager.FEATURE_VR_MODE_HIGH_PERFORMANCE); - // For debugging RescueParty if (Build.IS_DEBUGGABLE && SystemProperties.getBoolean("debug.crash_system", false)) { throw new RuntimeException(); @@ -930,7 +927,7 @@ public final class SystemServer { traceLog.traceEnd(); }, START_HIDL_SERVICES); - if (!isWatch && enableVrService) { + if (!isWatch) { traceBeginAndSlog("StartVrManagerService"); mSystemServiceManager.startService(VrManagerService.class); traceEnd(); |