Merge "AudioService: fix VolumeShaper operation for muteAwaitConnection" into tm-dev

This commit is contained in:
TreeHugger Robot
2022-05-27 23:45:36 +00:00
committed by Android (Google) Code Review
2 changed files with 7 additions and 7 deletions

View File

@@ -9171,7 +9171,7 @@ public class AudioService extends IAudioService.Stub
throw new IllegalArgumentException("Invalid timeOutMs/usagesToMute"); throw new IllegalArgumentException("Invalid timeOutMs/usagesToMute");
} }
Log.i(TAG, "muteAwaitConnection dev:" + device + " timeOutMs:" + timeOutMs Log.i(TAG, "muteAwaitConnection dev:" + device + " timeOutMs:" + timeOutMs
+ " usages:" + usages); + " usages:" + Arrays.toString(usages));
if (mDeviceBroker.isDeviceConnected(device)) { if (mDeviceBroker.isDeviceConnected(device)) {
// not throwing an exception as there could be a race between a connection (server-side, // not throwing an exception as there could be a race between a connection (server-side,
@@ -9223,7 +9223,7 @@ public class AudioService extends IAudioService.Stub
mutedUsages = mMutedUsagesAwaitingConnection; mutedUsages = mMutedUsagesAwaitingConnection;
mMutingExpectedDevice = null; mMutingExpectedDevice = null;
mMutedUsagesAwaitingConnection = null; mMutedUsagesAwaitingConnection = null;
mPlaybackMonitor.cancelMuteAwaitConnection(); mPlaybackMonitor.cancelMuteAwaitConnection("cancelMuteAwaitConnection dev:" + device);
} }
dispatchMuteAwaitConnection(cb -> { try { cb.dispatchOnUnmutedEvent( dispatchMuteAwaitConnection(cb -> { try { cb.dispatchOnUnmutedEvent(
AudioManager.MuteAwaitConnectionCallback.EVENT_CANCEL, device, mutedUsages); AudioManager.MuteAwaitConnectionCallback.EVENT_CANCEL, device, mutedUsages);
@@ -9259,8 +9259,8 @@ public class AudioService extends IAudioService.Stub
} }
mMutingExpectedDevice = null; mMutingExpectedDevice = null;
mMutedUsagesAwaitingConnection = null; mMutedUsagesAwaitingConnection = null;
Log.i(TAG, "muteAwaitConnection device " + device + " connected, unmuting"); mPlaybackMonitor.cancelMuteAwaitConnection(
mPlaybackMonitor.cancelMuteAwaitConnection(); "checkMuteAwaitConnection device " + device + " connected, unmuting");
} }
dispatchMuteAwaitConnection(cb -> { try { cb.dispatchOnUnmutedEvent( dispatchMuteAwaitConnection(cb -> { try { cb.dispatchOnUnmutedEvent(
AudioManager.MuteAwaitConnectionCallback.EVENT_CONNECTION, device, mutedUsages); AudioManager.MuteAwaitConnectionCallback.EVENT_CONNECTION, device, mutedUsages);

View File

@@ -1170,8 +1170,8 @@ public final class PlaybackActivityMonitor
} }
} }
void cancelMuteAwaitConnection() { void cancelMuteAwaitConnection(String source) {
sEventLogger.loglogi("cancelMuteAwaitConnection()", TAG); sEventLogger.loglogi("cancelMuteAwaitConnection() from:" + source, TAG);
synchronized (mPlayerLock) { synchronized (mPlayerLock) {
// cancel scheduled timeout, ignore device, only one expected device at a time // cancel scheduled timeout, ignore device, only one expected device at a time
mEventHandler.removeMessages(MSG_L_TIMEOUT_MUTE_AWAIT_CONNECTION); mEventHandler.removeMessages(MSG_L_TIMEOUT_MUTE_AWAIT_CONNECTION);
@@ -1223,7 +1223,7 @@ public final class PlaybackActivityMonitor
+ " uid:" + apc.getClientUid())).printLog(TAG)); + " uid:" + apc.getClientUid())).printLog(TAG));
apc.getPlayerProxy().applyVolumeShaper( apc.getPlayerProxy().applyVolumeShaper(
MUTE_AWAIT_CONNECTION_VSHAPE, MUTE_AWAIT_CONNECTION_VSHAPE,
PLAY_CREATE_IF_NEEDED); PLAY_SKIP_RAMP);
mMutedPlayersAwaitingConnection.add(apc.getPlayerInterfaceId()); mMutedPlayersAwaitingConnection.add(apc.getPlayerInterfaceId());
} catch (Exception e) { } catch (Exception e) {
Log.e(TAG, "awaiting connection: error muting player " Log.e(TAG, "awaiting connection: error muting player "