diff options
| author | Adam Stone <blueeyes@google.com> | 2018-01-31 12:57:16 -0800 |
|---|---|---|
| committer | Adam Stone <blueeyes@google.com> | 2018-02-12 14:35:27 -0800 |
| commit | 568b3c45d48fab64c80b2780e8547564d35722e9 (patch) | |
| tree | 18cb767806a83262cb74a7d1ab25bcd0e1334ab8 /drm/libmediadrm/IDrm.cpp | |
| parent | 637b7855829920114a8863b93fe52203b7471eea (diff) | |
| download | frameworks_av-568b3c45d48fab64c80b2780e8547564d35722e9.tar.gz frameworks_av-568b3c45d48fab64c80b2780e8547564d35722e9.tar.bz2 frameworks_av-568b3c45d48fab64c80b2780e8547564d35722e9.zip | |
Fix Metrics with PersistableBundle support
Some metrics required a conversion to using PersistableBundle to support
slightly richer structure (lists, and nested PBs).
BUG: 64001676
Test: Ran updated CTS test and verified Google Play works.
Change-Id: I8f8d67ba04b234f2ac5ac348a8945e20837f98d6
Diffstat (limited to 'drm/libmediadrm/IDrm.cpp')
| -rw-r--r-- | drm/libmediadrm/IDrm.cpp | 34 |
1 files changed, 29 insertions, 5 deletions
diff --git a/drm/libmediadrm/IDrm.cpp b/drm/libmediadrm/IDrm.cpp index 802e16fdad..7da52ea875 100644 --- a/drm/libmediadrm/IDrm.cpp +++ b/drm/libmediadrm/IDrm.cpp @@ -509,6 +509,9 @@ struct BpDrm : public BpInterface<IDrm> { } virtual status_t getMetrics(os::PersistableBundle *metrics) { + if (metrics == NULL) { + return BAD_VALUE; + } Parcel data, reply; data.writeInterfaceToken(IDrm::getInterfaceDescriptor()); @@ -516,9 +519,23 @@ struct BpDrm : public BpInterface<IDrm> { if (status != OK) { return status; } + // The reply data is ordered as + // 1) 32 bit integer reply followed by + // 2) Serialized PersistableBundle containing metrics. + status_t reply_status; + if (reply.readInt32(&reply_status) != OK + || reply_status != OK) { + ALOGE("Failed to read getMetrics response code from parcel. %d", + reply_status); + return reply_status; + } - metrics->readFromParcel(&reply); - return reply.readInt32(); + status = metrics->readFromParcel(&reply); + if (status != OK) { + ALOGE("Failed to read metrics from parcel. %d", status); + return status; + } + return reply_status; } virtual status_t setCipherAlgorithm(Vector<uint8_t> const &sessionId, @@ -1036,9 +1053,16 @@ status_t BnDrm::onTransact( os::PersistableBundle metrics; status_t result = getMetrics(&metrics); - metrics.writeToParcel(reply); - reply->writeInt32(result); - return OK; + // The reply data is ordered as + // 1) 32 bit integer reply followed by + // 2) Serialized PersistableBundle containing metrics. + // Only write the metrics if the getMetrics result was + // OK and we successfully added the status to reply. + status_t parcel_result = reply->writeInt32(result); + if (result == OK && parcel_result == OK) { + parcel_result = metrics.writeToParcel(reply); + } + return parcel_result; } case SET_CIPHER_ALGORITHM: |
