AudioService Spatializer: disable by default

Also release the spatializer used for checking level.

Bug: 188502620
Test: adb logcat | grep Spatializer, check for no spat init messages
Change-Id: I858661f206ae04b9bf7d8c9f2857e9028addd2c7
This commit is contained in:
Jean-Michel Trivi
2021-09-14 07:26:41 -07:00
parent d9dede17af
commit a12a816a91
2 changed files with 12 additions and 3 deletions

View File

@@ -1431,7 +1431,7 @@ public class AudioService extends IAudioService.Stub
}
// TODO check property if feature enabled
mSpatializerHelper.reset(/* featureEnabled */ true);
mSpatializerHelper.reset(/* featureEnabled */ SPATIALIZER_FEATURE_ENABLED_DEFAULT);
onIndicateSystemReady();
// indicate the end of reconfiguration phase to audio HAL
@@ -7569,7 +7569,7 @@ public class AudioService extends IAudioService.Stub
case MSG_INIT_SPATIALIZER:
mSpatializerHelper.init();
// TODO read property to see if enabled
mSpatializerHelper.setFeatureEnabled(true);
mSpatializerHelper.setFeatureEnabled(SPATIALIZER_FEATURE_ENABLED_DEFAULT);
mAudioEventWakeLock.release();
break;
@@ -8278,6 +8278,7 @@ public class AudioService extends IAudioService.Stub
//==========================================================================================
private final @NonNull SpatializerHelper mSpatializerHelper;
private static final boolean SPATIALIZER_FEATURE_ENABLED_DEFAULT = false;
private void enforceModifyDefaultAudioEffectsPermission() {
if (mContext.checkCallingOrSelfPermission(

View File

@@ -124,7 +124,15 @@ public class SpatializerHelper {
break;
}
}
} catch (RemoteException e) { /* capable level remains at NONE*/ }
} catch (RemoteException e) {
/* capable level remains at NONE*/
} finally {
if (spat != null) {
try {
spat.release();
} catch (RemoteException e) { /* capable level remains at NONE*/ }
}
}
if (mCapableSpatLevel == Spatializer.SPATIALIZER_IMMERSIVE_LEVEL_NONE) {
mState = STATE_NOT_SUPPORTED;
return;