diff options
5 files changed, 21 insertions, 14 deletions
diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java index f65fab8d98aa..45a4e5862e66 100644 --- a/services/core/java/com/android/server/am/ActivityManagerService.java +++ b/services/core/java/com/android/server/am/ActivityManagerService.java @@ -2313,6 +2313,9 @@ public final class ActivityManagerService extends ActivityManagerNative } break; case VR_MODE_CHANGE_MSG: { VrManagerInternal vrService = LocalServices.getService(VrManagerInternal.class); + if (vrService == null) { + break; + } final ActivityRecord r = (ActivityRecord) msg.obj; boolean vrMode; ComponentName requestedPackage; diff --git a/services/core/java/com/android/server/lights/LightsService.java b/services/core/java/com/android/server/lights/LightsService.java index 07048a491543..ca6481792dfe 100644 --- a/services/core/java/com/android/server/lights/LightsService.java +++ b/services/core/java/com/android/server/lights/LightsService.java @@ -172,10 +172,12 @@ public class LightsService extends SystemService { if (phase == PHASE_SYSTEM_SERVICES_READY) { IVrManager vrManager = (IVrManager) getBinderService(VrManagerService.VR_MANAGER_BINDER_SERVICE); - try { - vrManager.registerListener(mVrStateCallbacks); - } catch (RemoteException e) { - Slog.e(TAG, "Failed to register VR mode state listener: " + e); + if (vrManager != null) { + try { + vrManager.registerListener(mVrStateCallbacks); + } catch (RemoteException e) { + Slog.e(TAG, "Failed to register VR mode state listener: " + e); + } } } } diff --git a/services/core/java/com/android/server/notification/NotificationManagerService.java b/services/core/java/com/android/server/notification/NotificationManagerService.java index eb85f191304e..b1468f182fd3 100644 --- a/services/core/java/com/android/server/notification/NotificationManagerService.java +++ b/services/core/java/com/android/server/notification/NotificationManagerService.java @@ -140,7 +140,6 @@ import com.android.server.lights.LightsManager; import com.android.server.notification.ManagedServices.ManagedServiceInfo; import com.android.server.policy.PhoneWindowManager; import com.android.server.statusbar.StatusBarManagerInternal; -import com.android.server.vr.VrManagerInternal; import com.android.server.notification.ManagedServices.UserProfiles; import libcore.io.IoUtils; @@ -232,7 +231,6 @@ public class NotificationManagerService extends SystemService { AudioManagerInternal mAudioManagerInternal; @Nullable StatusBarManagerInternal mStatusBar; Vibrator mVibrator; - private VrManagerInternal mVrManagerInternal; private WindowManagerInternal mWindowManagerInternal; final IBinder mForegroundToken = new Binder(); @@ -1128,7 +1126,6 @@ public class NotificationManagerService extends SystemService { // Grab our optional AudioService mAudioManager = (AudioManager) getContext().getSystemService(Context.AUDIO_SERVICE); mAudioManagerInternal = getLocalService(AudioManagerInternal.class); - mVrManagerInternal = getLocalService(VrManagerInternal.class); mWindowManagerInternal = LocalServices.getService(WindowManagerInternal.class); mZenModeHelper.onSystemReady(); } else if (phase == SystemService.PHASE_THIRD_PARTY_APPS_CAN_START) { diff --git a/services/core/java/com/android/server/power/PowerManagerService.java b/services/core/java/com/android/server/power/PowerManagerService.java index 570b93c09c9a..994994926a0e 100644 --- a/services/core/java/com/android/server/power/PowerManagerService.java +++ b/services/core/java/com/android/server/power/PowerManagerService.java @@ -669,10 +669,12 @@ public final class PowerManagerService extends SystemService false, mSettingsObserver, UserHandle.USER_ALL); IVrManager vrManager = (IVrManager) getBinderService(VrManagerService.VR_MANAGER_BINDER_SERVICE); - try { - vrManager.registerListener(mVrStateCallbacks); - } catch (RemoteException e) { - Slog.e(TAG, "Failed to register VR mode state listener: " + e); + if (vrManager != null) { + try { + vrManager.registerListener(mVrStateCallbacks); + } catch (RemoteException e) { + Slog.e(TAG, "Failed to register VR mode state listener: " + e); + } } // Go. readConfigurationLocked(); diff --git a/services/java/com/android/server/SystemServer.java b/services/java/com/android/server/SystemServer.java index 8a596480ee2c..53117e19d999 100644 --- a/services/java/com/android/server/SystemServer.java +++ b/services/java/com/android/server/SystemServer.java @@ -553,6 +553,7 @@ public final class SystemServer { false); boolean disableConsumerIr = SystemProperties.getBoolean("config.disable_consumerir", false); + boolean disableVrManager = SystemProperties.getBoolean("config.disable_vrmanager", false); boolean isEmulator = SystemProperties.get("ro.kernel.qemu").equals("1"); @@ -626,9 +627,11 @@ public final class SystemServer { ServiceManager.addService(Context.INPUT_SERVICE, inputManager); Trace.traceEnd(Trace.TRACE_TAG_SYSTEM_SERVER); - traceBeginAndSlog("StartVrManagerService"); - mSystemServiceManager.startService(VrManagerService.class); - Trace.traceEnd(Trace.TRACE_TAG_SYSTEM_SERVER); + if (!disableVrManager) { + traceBeginAndSlog("StartVrManagerService"); + mSystemServiceManager.startService(VrManagerService.class); + Trace.traceEnd(Trace.TRACE_TAG_SYSTEM_SERVER); + } mActivityManagerService.setWindowManager(wm); |