Skip to content

Commit

Permalink
Merge cherrypicks of ['googleplex-android-review.googlesource.com/232…
Browse files Browse the repository at this point in the history
…45979'] into tm-qpr3-release.

Change-Id: Iaaa9e293de48fba89fb8d2fb2579685349a6e575
  • Loading branch information
Android Build Coastguard Worker committed May 27, 2023
2 parents 8984025 + a476924 commit 95be9ba
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions services/audiopolicy/service/AudioPolicyInterfaceImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -793,8 +793,29 @@ Status AudioPolicyService::startInput(int32_t portIdAidl)

Mutex::Autolock _l(mLock);

ALOGW_IF(client->silenced, "startInput on silenced input for port %d, uid %d. Unsilencing.",
portIdAidl,
client->attributionSource.uid);

if (client->active) {
ALOGE("Client should never be active before startInput. Uid %d port %d",
client->attributionSource.uid, portId);
finishRecording(client->attributionSource, client->attributes.source);
return binderStatusFromStatusT(INVALID_OPERATION);
}

// Force the possibly silenced client to be unsilenced since we just called
// startRecording (i.e. we have assumed it is unsilenced).
// At this point in time, the client is inactive, so no calls to appops are sent in
// setAppState_l.
// This ensures existing clients have the same behavior as new clients (starting unsilenced).
// TODO(b/282076713)
setAppState_l(client, APP_STATE_TOP);

client->active = true;
client->startTimeNs = systemTime();
// This call updates the silenced state, and since we are active, appropriately notifies appops
// if we silence the track.
updateUidStates_l();

status_t status;
Expand Down

0 comments on commit 95be9ba

Please sign in to comment.