Merge "AudioService: fix VolumeShaper operation for muteAwaitConnection" into tm-dev am: 57961f0cf5
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/18624718 Change-Id: I5b92c18438dea3528c45d49afdcc72295cb885c6 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -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);
|
||||||
|
|||||||
@@ -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 "
|
||||||
|
|||||||
Reference in New Issue
Block a user