Merge "Spatializer: Fix lost settings after reboot"
This commit is contained in:
@@ -9142,11 +9142,8 @@ public class AudioService extends IAudioService.Stub
|
|||||||
Settings.Secure.SPATIAL_AUDIO_ENABLED, UserHandle.USER_CURRENT);
|
Settings.Secure.SPATIAL_AUDIO_ENABLED, UserHandle.USER_CURRENT);
|
||||||
if (settings == null) {
|
if (settings == null) {
|
||||||
Log.e(TAG, "error reading spatial audio device settings");
|
Log.e(TAG, "error reading spatial audio device settings");
|
||||||
} else {
|
|
||||||
Log.v(TAG, "restoring spatial audio device settings: " + settings);
|
|
||||||
mSpatializerHelper.setSADeviceSettings(settings);
|
|
||||||
}
|
}
|
||||||
mSpatializerHelper.init(/*effectExpected*/ mHasSpatializerEffect);
|
mSpatializerHelper.init(/*effectExpected*/ mHasSpatializerEffect, settings);
|
||||||
mSpatializerHelper.setFeatureEnabled(mHasSpatializerEffect);
|
mSpatializerHelper.setFeatureEnabled(mHasSpatializerEffect);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -185,7 +185,7 @@ public class SpatializerHelper {
|
|||||||
mTransauralSupported = hasTransaural;
|
mTransauralSupported = hasTransaural;
|
||||||
}
|
}
|
||||||
|
|
||||||
synchronized void init(boolean effectExpected) {
|
synchronized void init(boolean effectExpected, @Nullable String settings) {
|
||||||
loglogi("init effectExpected=" + effectExpected);
|
loglogi("init effectExpected=" + effectExpected);
|
||||||
if (!effectExpected) {
|
if (!effectExpected) {
|
||||||
loglogi("init(): setting state to STATE_NOT_SUPPORTED due to effect not expected");
|
loglogi("init(): setting state to STATE_NOT_SUPPORTED due to effect not expected");
|
||||||
@@ -288,6 +288,13 @@ public class SpatializerHelper {
|
|||||||
mSACapableDeviceTypes.add(SPAT_MODE_FOR_DEVICE_TYPE.keyAt(i));
|
mSACapableDeviceTypes.add(SPAT_MODE_FOR_DEVICE_TYPE.keyAt(i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// When initialized from AudioService, the settings string will be non-null.
|
||||||
|
// Saved settings need to be applied after spatialization support is initialized above.
|
||||||
|
if (settings != null) {
|
||||||
|
setSADeviceSettings(settings);
|
||||||
|
}
|
||||||
|
|
||||||
// for both transaural / binaural, we are not forcing enablement as the init() method
|
// for both transaural / binaural, we are not forcing enablement as the init() method
|
||||||
// could have been called another time after boot in case of audioserver restart
|
// could have been called another time after boot in case of audioserver restart
|
||||||
addCompatibleAudioDevice(
|
addCompatibleAudioDevice(
|
||||||
@@ -326,7 +333,7 @@ public class SpatializerHelper {
|
|||||||
mState = STATE_UNINITIALIZED;
|
mState = STATE_UNINITIALIZED;
|
||||||
mSpatLevel = Spatializer.SPATIALIZER_IMMERSIVE_LEVEL_NONE;
|
mSpatLevel = Spatializer.SPATIALIZER_IMMERSIVE_LEVEL_NONE;
|
||||||
mActualHeadTrackingMode = Spatializer.HEAD_TRACKING_MODE_UNSUPPORTED;
|
mActualHeadTrackingMode = Spatializer.HEAD_TRACKING_MODE_UNSUPPORTED;
|
||||||
init(true);
|
init(true, null /* settings */);
|
||||||
setSpatializerEnabledInt(featureEnabled);
|
setSpatializerEnabledInt(featureEnabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -752,7 +759,7 @@ public class SpatializerHelper {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (mState == STATE_UNINITIALIZED) {
|
if (mState == STATE_UNINITIALIZED) {
|
||||||
init(true);
|
init(true, null /* settings */);
|
||||||
}
|
}
|
||||||
setSpatializerEnabledInt(true);
|
setSpatializerEnabledInt(true);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user