summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Lee <matthewhlee@google.com>2023-08-11 14:58:43 -0700
committerMatt Lee <matthewhlee@google.com>2023-08-11 14:58:43 -0700
commite0878b6e8d615950686db6d9816b0f58b3a234b3 (patch)
treead7d7ee9ee94d8a22e202ad5d32560bf569e016c
parent9b7b2d9faba45da04a1dfa2609c1ed04e817d094 (diff)
parent227bd18d97c25d37c2c163a86497532d2c68691b (diff)
Merge t-mpr-2023-08
Change-Id: Ibfc9a8c6ae793405e7b6ffdc796998c87e22de63
-rw-r--r--media/mtp/MtpProperty.h3
-rw-r--r--services/audiopolicy/service/AudioPolicyInterfaceImpl.cpp21
2 files changed, 24 insertions, 0 deletions
diff --git a/media/mtp/MtpProperty.h b/media/mtp/MtpProperty.h
index 36d736065f..2bdbfd3262 100644
--- a/media/mtp/MtpProperty.h
+++ b/media/mtp/MtpProperty.h
@@ -26,6 +26,9 @@ namespace android {
class MtpDataPacket;
struct MtpPropertyValue {
+ // pointer str initialized to NULL so that free operation
+ // is not called for pre-assigned value
+ MtpPropertyValue() : str (NULL) {}
union {
int8_t i8;
uint8_t u8;
diff --git a/services/audiopolicy/service/AudioPolicyInterfaceImpl.cpp b/services/audiopolicy/service/AudioPolicyInterfaceImpl.cpp
index c33dba8096..d9981eab67 100644
--- a/services/audiopolicy/service/AudioPolicyInterfaceImpl.cpp
+++ b/services/audiopolicy/service/AudioPolicyInterfaceImpl.cpp
@@ -813,8 +813,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;