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

Commit 47a17eb0 authored by Rick Yiu's avatar Rick Yiu
Browse files

Add null check for vrManager

If VrManagerService is not started, vrManager will be null. Need
add check for it.

Test: build pass
Bug: 116427118
Change-Id: If834d0f061c99c61043696afc8f737be2f85459a
Merged-In: If834d0f061c99c61043696afc8f737be2f85459a
parent ee1df63a
Loading
Loading
Loading
Loading
+5 −4
Original line number Diff line number Diff line
@@ -24,7 +24,6 @@ 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
@@ -76,10 +75,12 @@ 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 {