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

Commit d3ee26b6 authored by Adrian Roos's avatar Adrian Roos Committed by Android (Google) Code Review
Browse files

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"
parents 302019d9 122d8445
Loading
Loading
Loading
Loading
+4 −5
Original line number Diff line number Diff line
@@ -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,12 +76,10 @@ 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);
    }
    }

    @SmallTest
    public void testSetPersistentVrThreadAPISuccess() throws Throwable {
+4 −6
Original line number Diff line number Diff line
@@ -732,13 +732,11 @@ 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);
        }
        }

        IWallpaperManager wallpaperManager = IWallpaperManager.Stub.asInterface(
                ServiceManager.getService(Context.WALLPAPER_SERVICE));
+4 −5
Original line number Diff line number Diff line
@@ -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.");
        }
    }
}

+1 −4
Original line number Diff line number Diff line
@@ -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();