AudioService: fix VolumeShaper operation for muteAwaitConnection
PlaybackActivityMonitor defines a VolumeShaper configuration to be used for mute/unmute for the muteAwaitConnection feature. It define a 100ms ramp that is supposed to be skipped for muting (by using X offset to end of ramp) and used for unmuting. Offset in the end of the ramp is defined in the PLAY_SKIP_RAMP Configuration, was documented at line 93 in the initialization of MUTE_AWAIT_CONNECTION_VSHAPE, but wasn't used when muting in maybeMutePlayerAwaitingConnection. AudioService.java: better logs of feature. Bug: 229814445 Test: repro in bug Change-Id: Id6d28f5ecd7edf9d7afb834f295a5b7388319bde
This commit is contained in:
@@ -9171,7 +9171,7 @@ public class AudioService extends IAudioService.Stub
|
||||
throw new IllegalArgumentException("Invalid timeOutMs/usagesToMute");
|
||||
}
|
||||
Log.i(TAG, "muteAwaitConnection dev:" + device + " timeOutMs:" + timeOutMs
|
||||
+ " usages:" + usages);
|
||||
+ " usages:" + Arrays.toString(usages));
|
||||
|
||||
if (mDeviceBroker.isDeviceConnected(device)) {
|
||||
// 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;
|
||||
mMutingExpectedDevice = null;
|
||||
mMutedUsagesAwaitingConnection = null;
|
||||
mPlaybackMonitor.cancelMuteAwaitConnection();
|
||||
mPlaybackMonitor.cancelMuteAwaitConnection("cancelMuteAwaitConnection dev:" + device);
|
||||
}
|
||||
dispatchMuteAwaitConnection(cb -> { try { cb.dispatchOnUnmutedEvent(
|
||||
AudioManager.MuteAwaitConnectionCallback.EVENT_CANCEL, device, mutedUsages);
|
||||
@@ -9259,8 +9259,8 @@ public class AudioService extends IAudioService.Stub
|
||||
}
|
||||
mMutingExpectedDevice = 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(
|
||||
AudioManager.MuteAwaitConnectionCallback.EVENT_CONNECTION, device, mutedUsages);
|
||||
|
||||
@@ -1170,8 +1170,8 @@ public final class PlaybackActivityMonitor
|
||||
}
|
||||
}
|
||||
|
||||
void cancelMuteAwaitConnection() {
|
||||
sEventLogger.loglogi("cancelMuteAwaitConnection()", TAG);
|
||||
void cancelMuteAwaitConnection(String source) {
|
||||
sEventLogger.loglogi("cancelMuteAwaitConnection() from:" + source, TAG);
|
||||
synchronized (mPlayerLock) {
|
||||
// cancel scheduled timeout, ignore device, only one expected device at a time
|
||||
mEventHandler.removeMessages(MSG_L_TIMEOUT_MUTE_AWAIT_CONNECTION);
|
||||
@@ -1223,7 +1223,7 @@ public final class PlaybackActivityMonitor
|
||||
+ " uid:" + apc.getClientUid())).printLog(TAG));
|
||||
apc.getPlayerProxy().applyVolumeShaper(
|
||||
MUTE_AWAIT_CONNECTION_VSHAPE,
|
||||
PLAY_CREATE_IF_NEEDED);
|
||||
PLAY_SKIP_RAMP);
|
||||
mMutedPlayersAwaitingConnection.add(apc.getPlayerInterfaceId());
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "awaiting connection: error muting player "
|
||||
|
||||
Reference in New Issue
Block a user