Loading services/core/java/com/android/server/audio/AudioService.java +16 −0 Original line number Diff line number Diff line Loading @@ -346,6 +346,7 @@ public class AudioService extends IAudioService.Stub private static final int MSG_REMOVE_ASSISTANT_SERVICE_UID = 45; private static final int MSG_UPDATE_ACTIVE_ASSISTANT_SERVICE_UID = 46; private static final int MSG_DISPATCH_DEVICE_VOLUME_BEHAVIOR = 47; private static final int MSG_RESET_SPATIALIZER = 50; // start of messages handled under wakelock // these messages can only be queued, i.e. sent with queueMsgUnderWakeLock(), Loading @@ -353,6 +354,7 @@ public class AudioService extends IAudioService.Stub private static final int MSG_DISABLE_AUDIO_FOR_UID = 100; private static final int MSG_INIT_STREAMS_VOLUMES = 101; private static final int MSG_INIT_SPATIALIZER = 102; // end of messages handled under wakelock // retry delay in case of failure to indicate system ready to AudioFlinger Loading Loading @@ -8169,6 +8171,10 @@ public class AudioService extends IAudioService.Stub onPersistSpatialAudioDeviceSettings(); break; case MSG_RESET_SPATIALIZER: mSpatializerHelper.reset(/* featureEnabled */ mHasSpatializerEffect); break; case MSG_CHECK_MUSIC_ACTIVE: onCheckMusicActive((String) msg.obj); break; Loading Loading @@ -9137,6 +9143,16 @@ public class AudioService extends IAudioService.Stub /*arg1*/ 0, /*arg2*/ 0, TAG, /*delay*/ 0); } /** * post a message to schedule a reset of the spatializer state */ void postResetSpatializer() { sendMsg(mAudioHandler, MSG_RESET_SPATIALIZER, SENDMSG_REPLACE, /*arg1*/ 0, /*arg2*/ 0, TAG, /*delay*/ 0); } void onInitSpatializer() { final String settings = mSettings.getSecureStringForUser(mContentResolver, Settings.Secure.SPATIAL_AUDIO_ENABLED, UserHandle.USER_CURRENT); Loading services/core/java/com/android/server/audio/SpatializerHelper.java +17 −10 Original line number Diff line number Diff line Loading @@ -408,10 +408,10 @@ public class SpatializerHelper { try { mSpat.setLevel(level); } catch (RemoteException e) { Log.e(TAG, "Can't set spatializer level", e); mState = STATE_NOT_SUPPORTED; mCapableSpatLevel = Spatializer.SPATIALIZER_IMMERSIVE_LEVEL_NONE; enabled = false; Log.e(TAG, "onRoutingUpdated() Can't set spatializer level", e); // try to recover by resetting the native spatializer state postReset(); return; } } Loading @@ -423,6 +423,10 @@ public class SpatializerHelper { } } private void postReset() { mAudioService.postResetSpatializer(); } //------------------------------------------------------ // spatializer callback from native private final class SpatializerCallback extends INativeSpatializerCallback.Stub { Loading Loading @@ -1182,8 +1186,11 @@ public class SpatializerHelper { case STATE_DISABLED_AVAILABLE: case STATE_ENABLED_AVAILABLE: if (mSpat == null) { throw (new IllegalStateException( "null Spatializer when calling " + funcName)); // try to recover by resetting the native spatializer state Log.e(TAG, "checkSpatForHeadTracking(): " + "native spatializer should not be null in state: " + mState); postReset(); return false; } break; } Loading Loading @@ -1273,8 +1280,8 @@ public class SpatializerHelper { case STATE_DISABLED_AVAILABLE: case STATE_ENABLED_AVAILABLE: if (mSpat == null) { throw (new IllegalStateException( "null Spatializer for setParameter for key:" + key)); Log.e(TAG, "setParameter(" + key + "): null spatializer in state: " + mState); return; } break; } Loading @@ -1297,8 +1304,8 @@ public class SpatializerHelper { case STATE_DISABLED_AVAILABLE: case STATE_ENABLED_AVAILABLE: if (mSpat == null) { throw (new IllegalStateException( "null Spatializer for getParameter for key:" + key)); Log.e(TAG, "getParameter(" + key + "): null spatializer in state: " + mState); return; } break; } Loading Loading
services/core/java/com/android/server/audio/AudioService.java +16 −0 Original line number Diff line number Diff line Loading @@ -346,6 +346,7 @@ public class AudioService extends IAudioService.Stub private static final int MSG_REMOVE_ASSISTANT_SERVICE_UID = 45; private static final int MSG_UPDATE_ACTIVE_ASSISTANT_SERVICE_UID = 46; private static final int MSG_DISPATCH_DEVICE_VOLUME_BEHAVIOR = 47; private static final int MSG_RESET_SPATIALIZER = 50; // start of messages handled under wakelock // these messages can only be queued, i.e. sent with queueMsgUnderWakeLock(), Loading @@ -353,6 +354,7 @@ public class AudioService extends IAudioService.Stub private static final int MSG_DISABLE_AUDIO_FOR_UID = 100; private static final int MSG_INIT_STREAMS_VOLUMES = 101; private static final int MSG_INIT_SPATIALIZER = 102; // end of messages handled under wakelock // retry delay in case of failure to indicate system ready to AudioFlinger Loading Loading @@ -8169,6 +8171,10 @@ public class AudioService extends IAudioService.Stub onPersistSpatialAudioDeviceSettings(); break; case MSG_RESET_SPATIALIZER: mSpatializerHelper.reset(/* featureEnabled */ mHasSpatializerEffect); break; case MSG_CHECK_MUSIC_ACTIVE: onCheckMusicActive((String) msg.obj); break; Loading Loading @@ -9137,6 +9143,16 @@ public class AudioService extends IAudioService.Stub /*arg1*/ 0, /*arg2*/ 0, TAG, /*delay*/ 0); } /** * post a message to schedule a reset of the spatializer state */ void postResetSpatializer() { sendMsg(mAudioHandler, MSG_RESET_SPATIALIZER, SENDMSG_REPLACE, /*arg1*/ 0, /*arg2*/ 0, TAG, /*delay*/ 0); } void onInitSpatializer() { final String settings = mSettings.getSecureStringForUser(mContentResolver, Settings.Secure.SPATIAL_AUDIO_ENABLED, UserHandle.USER_CURRENT); Loading
services/core/java/com/android/server/audio/SpatializerHelper.java +17 −10 Original line number Diff line number Diff line Loading @@ -408,10 +408,10 @@ public class SpatializerHelper { try { mSpat.setLevel(level); } catch (RemoteException e) { Log.e(TAG, "Can't set spatializer level", e); mState = STATE_NOT_SUPPORTED; mCapableSpatLevel = Spatializer.SPATIALIZER_IMMERSIVE_LEVEL_NONE; enabled = false; Log.e(TAG, "onRoutingUpdated() Can't set spatializer level", e); // try to recover by resetting the native spatializer state postReset(); return; } } Loading @@ -423,6 +423,10 @@ public class SpatializerHelper { } } private void postReset() { mAudioService.postResetSpatializer(); } //------------------------------------------------------ // spatializer callback from native private final class SpatializerCallback extends INativeSpatializerCallback.Stub { Loading Loading @@ -1182,8 +1186,11 @@ public class SpatializerHelper { case STATE_DISABLED_AVAILABLE: case STATE_ENABLED_AVAILABLE: if (mSpat == null) { throw (new IllegalStateException( "null Spatializer when calling " + funcName)); // try to recover by resetting the native spatializer state Log.e(TAG, "checkSpatForHeadTracking(): " + "native spatializer should not be null in state: " + mState); postReset(); return false; } break; } Loading Loading @@ -1273,8 +1280,8 @@ public class SpatializerHelper { case STATE_DISABLED_AVAILABLE: case STATE_ENABLED_AVAILABLE: if (mSpat == null) { throw (new IllegalStateException( "null Spatializer for setParameter for key:" + key)); Log.e(TAG, "setParameter(" + key + "): null spatializer in state: " + mState); return; } break; } Loading @@ -1297,8 +1304,8 @@ public class SpatializerHelper { case STATE_DISABLED_AVAILABLE: case STATE_ENABLED_AVAILABLE: if (mSpat == null) { throw (new IllegalStateException( "null Spatializer for getParameter for key:" + key)); Log.e(TAG, "getParameter(" + key + "): null spatializer in state: " + mState); return; } break; } Loading