Loading Android.mk +2 −0 Original line number Diff line number Diff line Loading @@ -244,6 +244,8 @@ LOCAL_SRC_FILES += \ core/java/android/service/notification/IConditionListener.aidl \ core/java/android/service/notification/IConditionProvider.aidl \ core/java/android/service/vr/IVrListener.aidl \ core/java/android/service/vr/IVrManager.aidl \ core/java/android/service/vr/IVrStateCallbacks.aidl \ core/java/android/print/ILayoutResultCallback.aidl \ core/java/android/print/IPrinterDiscoveryObserver.aidl \ core/java/android/print/IPrintDocumentAdapter.aidl \ Loading core/java/android/service/vr/IVrManager.aidl 0 → 100644 +46 −0 Original line number Diff line number Diff line /** * Copyright (c) 2016, The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package android.service.vr; import android.service.vr.IVrStateCallbacks; /** @hide */ interface IVrManager { /** * Add a callback to be notified when VR mode state changes. * * @param cb the callback instance to add. */ void registerListener(in IVrStateCallbacks cb); /** * Remove the callack from the current set of registered callbacks. * * @param cb the callback to remove. */ void unregisterListener(in IVrStateCallbacks cb); /** * Return current VR mode state. * * @return {@code true} if VR mode is enabled. */ boolean getVrModeState(); } core/java/android/service/vr/IVrStateCallbacks.aidl 0 → 100644 +24 −0 Original line number Diff line number Diff line /** * Copyright (c) 2016, The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package android.service.vr; /** @hide */ oneway interface IVrStateCallbacks { void onVrStateChanged(in boolean enabled); } core/res/AndroidManifest.xml +5 −0 Original line number Diff line number Diff line Loading @@ -2997,6 +2997,11 @@ <permission android:name="android.permission.BIND_VR_LISTENER_SERVICE" android:protectionLevel="signature" /> <!-- Required to make calls to {@link android.service.vr.IVrManager}. @hide --> <permission android:name="android.permission.ACCESS_VR_MANAGER" android:protectionLevel="signature" /> <!-- Allows an application to whitelist tasks during lock task mode @hide <p>Not for use by third-party applications.</p> --> <permission android:name="android.permission.UPDATE_LOCK_TASK_PACKAGES" Loading services/core/java/com/android/server/lights/LightsService.java +14 −3 Original line number Diff line number Diff line Loading @@ -18,12 +18,17 @@ package com.android.server.lights; import com.android.server.SystemService; import com.android.server.vr.VrManagerInternal; import com.android.server.vr.VrManagerService; import com.android.server.vr.VrStateListener; import android.content.Context; import android.os.Handler; import android.os.IBinder; import android.os.Message; import android.os.RemoteException; import android.os.Trace; import android.service.vr.IVrManager; import android.service.vr.IVrStateCallbacks; import android.util.Slog; public class LightsService extends SystemService { Loading Loading @@ -164,13 +169,19 @@ public class LightsService extends SystemService { @Override public void onBootPhase(int phase) { if (phase == PHASE_SYSTEM_SERVICES_READY) { getLocalService(VrManagerInternal.class).registerListener(mVrStateListener); 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); } } } private final VrStateListener mVrStateListener = new VrStateListener() { private final IVrStateCallbacks mVrStateCallbacks = new IVrStateCallbacks.Stub() { @Override public void onVrStateChanged(boolean enabled) { public void onVrStateChanged(boolean enabled) throws RemoteException { LightImpl l = mLights[LightsManager.LIGHT_ID_BACKLIGHT]; if (enabled) { if (DEBUG) Slog.v(TAG, "VR mode enabled, setting brightness to low persistence"); Loading Loading
Android.mk +2 −0 Original line number Diff line number Diff line Loading @@ -244,6 +244,8 @@ LOCAL_SRC_FILES += \ core/java/android/service/notification/IConditionListener.aidl \ core/java/android/service/notification/IConditionProvider.aidl \ core/java/android/service/vr/IVrListener.aidl \ core/java/android/service/vr/IVrManager.aidl \ core/java/android/service/vr/IVrStateCallbacks.aidl \ core/java/android/print/ILayoutResultCallback.aidl \ core/java/android/print/IPrinterDiscoveryObserver.aidl \ core/java/android/print/IPrintDocumentAdapter.aidl \ Loading
core/java/android/service/vr/IVrManager.aidl 0 → 100644 +46 −0 Original line number Diff line number Diff line /** * Copyright (c) 2016, The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package android.service.vr; import android.service.vr.IVrStateCallbacks; /** @hide */ interface IVrManager { /** * Add a callback to be notified when VR mode state changes. * * @param cb the callback instance to add. */ void registerListener(in IVrStateCallbacks cb); /** * Remove the callack from the current set of registered callbacks. * * @param cb the callback to remove. */ void unregisterListener(in IVrStateCallbacks cb); /** * Return current VR mode state. * * @return {@code true} if VR mode is enabled. */ boolean getVrModeState(); }
core/java/android/service/vr/IVrStateCallbacks.aidl 0 → 100644 +24 −0 Original line number Diff line number Diff line /** * Copyright (c) 2016, The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package android.service.vr; /** @hide */ oneway interface IVrStateCallbacks { void onVrStateChanged(in boolean enabled); }
core/res/AndroidManifest.xml +5 −0 Original line number Diff line number Diff line Loading @@ -2997,6 +2997,11 @@ <permission android:name="android.permission.BIND_VR_LISTENER_SERVICE" android:protectionLevel="signature" /> <!-- Required to make calls to {@link android.service.vr.IVrManager}. @hide --> <permission android:name="android.permission.ACCESS_VR_MANAGER" android:protectionLevel="signature" /> <!-- Allows an application to whitelist tasks during lock task mode @hide <p>Not for use by third-party applications.</p> --> <permission android:name="android.permission.UPDATE_LOCK_TASK_PACKAGES" Loading
services/core/java/com/android/server/lights/LightsService.java +14 −3 Original line number Diff line number Diff line Loading @@ -18,12 +18,17 @@ package com.android.server.lights; import com.android.server.SystemService; import com.android.server.vr.VrManagerInternal; import com.android.server.vr.VrManagerService; import com.android.server.vr.VrStateListener; import android.content.Context; import android.os.Handler; import android.os.IBinder; import android.os.Message; import android.os.RemoteException; import android.os.Trace; import android.service.vr.IVrManager; import android.service.vr.IVrStateCallbacks; import android.util.Slog; public class LightsService extends SystemService { Loading Loading @@ -164,13 +169,19 @@ public class LightsService extends SystemService { @Override public void onBootPhase(int phase) { if (phase == PHASE_SYSTEM_SERVICES_READY) { getLocalService(VrManagerInternal.class).registerListener(mVrStateListener); 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); } } } private final VrStateListener mVrStateListener = new VrStateListener() { private final IVrStateCallbacks mVrStateCallbacks = new IVrStateCallbacks.Stub() { @Override public void onVrStateChanged(boolean enabled) { public void onVrStateChanged(boolean enabled) throws RemoteException { LightImpl l = mLights[LightsManager.LIGHT_ID_BACKLIGHT]; if (enabled) { if (DEBUG) Slog.v(TAG, "VR mode enabled, setting brightness to low persistence"); Loading