Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ab4f202c authored by android-build-team Robot's avatar android-build-team Robot
Browse files

Snap for 4778776 from bf2e1e8d to pi-release

Change-Id: Ibfcdc3ea294f6860f33135578e069c98beef6419
parents c49b650d bf2e1e8d
Loading
Loading
Loading
Loading
+20 −4
Original line number Diff line number Diff line
@@ -253,7 +253,7 @@ int32_t CryptoHal::setHeapBase(const sp<IMemoryHeap>& heap) {

    int32_t seqNum = mHeapSeqNum++;
    sp<HidlMemory> hidlMemory = fromHeap(heap);
    mHeapBases.add(seqNum, mNextBufferId);
    mHeapBases.add(seqNum, HeapBase(mNextBufferId, heap->getSize()));
    Return<void> hResult = mPlugin->setSharedBufferBase(*hidlMemory, mNextBufferId++);
    ALOGE_IF(!hResult.isOk(), "setSharedBufferBase(): remote call failed");
    return seqNum;
@@ -278,10 +278,26 @@ status_t CryptoHal::toSharedBuffer(const sp<IMemory>& memory, int32_t seqNum, ::
        return UNEXPECTED_NULL;
    }

    // memory must be in the declared heap
    CHECK(mHeapBases.indexOfKey(seqNum) >= 0);
    // memory must be in one of the heaps that have been set
    if (mHeapBases.indexOfKey(seqNum) < 0) {
        return UNKNOWN_ERROR;
    }

    // heap must be the same size as the one that was set in setHeapBase
    if (mHeapBases.valueFor(seqNum).getSize() != heap->getSize()) {
        android_errorWriteLog(0x534e4554, "76221123");
        return UNKNOWN_ERROR;
     }

    // memory must be within the address space of the heap
    if (memory->pointer() != static_cast<uint8_t *>(heap->getBase()) + memory->offset()  ||
            heap->getSize() < memory->offset() + memory->size() ||
            SIZE_MAX - memory->offset() < memory->size()) {
        android_errorWriteLog(0x534e4554, "76221123");
        return UNKNOWN_ERROR;
    }

    buffer->bufferId = mHeapBases.valueFor(seqNum);
    buffer->bufferId = mHeapBases.valueFor(seqNum).getBufferId();
    buffer->offset = offset >= 0 ? offset : 0;
    buffer->size = size;
    return OK;
+23 −5
Original line number Diff line number Diff line
@@ -29,6 +29,7 @@
using ::android::String16;
using ::android::String8;
using ::android::drm_metrics::DrmFrameworkMetrics;
using ::android::hardware::hidl_string;
using ::android::hardware::hidl_vec;
using ::android::hardware::drm::V1_0::EventType;
using ::android::hardware::drm::V1_0::KeyStatusType;
@@ -192,6 +193,13 @@ void SetValue(const String16 &name, DrmMetricGroup::ValueType type,
    }
}

inline String16 MakeIndexString(unsigned int index) {
  std::string str("[");
  str.append(std::to_string(index));
  str.append("]");
  return String16(str.c_str());
}

} // namespace

namespace android {
@@ -370,9 +378,11 @@ status_t MediaDrmMetrics::HidlMetricsToBundle(
    }

    int groupIndex = 0;
    std::map<String16, int> indexMap;
    for (const auto &hidlMetricGroup : hidlMetricGroups) {
        PersistableBundle bundleMetricGroup;
        for (const auto &hidlMetric : hidlMetricGroup.metrics) {
            String16 metricName(hidlMetric.name.c_str());
            PersistableBundle bundleMetric;
            // Add metric component values.
            for (const auto &value : hidlMetric.values) {
@@ -388,14 +398,22 @@ status_t MediaDrmMetrics::HidlMetricsToBundle(
            // Add attributes to the bundle metric.
            bundleMetric.putPersistableBundle(String16("attributes"),
                                              bundleMetricAttributes);
            // Add one layer of indirection, allowing for repeated metric names.
            PersistableBundle repeatedMetrics;
            bundleMetricGroup.getPersistableBundle(metricName,
                                                   &repeatedMetrics);
            int index = indexMap[metricName];
            repeatedMetrics.putPersistableBundle(MakeIndexString(index),
                                                 bundleMetric);
            indexMap[metricName] = ++index;

            // Add the bundle metric to the group of metrics.
            bundleMetricGroup.putPersistableBundle(
                String16(hidlMetric.name.c_str()), bundleMetric);
            bundleMetricGroup.putPersistableBundle(metricName,
                                                   repeatedMetrics);
        }
        // Add the bundle metric group to the collection of groups.
        bundleMetricGroups->putPersistableBundle(
            String16(std::to_string(groupIndex).c_str()), bundleMetricGroup);
        groupIndex++;
        bundleMetricGroups->putPersistableBundle(MakeIndexString(groupIndex++),
                                                 bundleMetricGroup);
    }

    return OK;
+10 −6
Original line number Diff line number Diff line
@@ -429,7 +429,8 @@ TEST_F(MediaDrmMetricsTest, HidlToBundleMetricsMultiple) {
  DrmMetricGroup hidlMetricGroup =
      { { {
              "open_session_ok",
              { { "status", DrmMetricGroup::ValueType::INT64_TYPE, (int64_t) Status::OK, 0.0, "" } },
              { { "status", DrmMetricGroup::ValueType::INT64_TYPE,
                  (int64_t) Status::OK, 0.0, "" } },
              { { "count", DrmMetricGroup::ValueType::INT64_TYPE, 3, 0.0, "" } }
          },
          {
@@ -444,25 +445,28 @@ TEST_F(MediaDrmMetricsTest, HidlToBundleMetricsMultiple) {
                                                     &bundleMetricGroups));
  ASSERT_EQ(1U, bundleMetricGroups.size());
  PersistableBundle bundleMetricGroup;
  ASSERT_TRUE(bundleMetricGroups.getPersistableBundle(String16("0"), &bundleMetricGroup));
  ASSERT_TRUE(bundleMetricGroups.getPersistableBundle(String16("[0]"), &bundleMetricGroup));
  ASSERT_EQ(2U, bundleMetricGroup.size());

  // Verify each metric.
  PersistableBundle metric;
  ASSERT_TRUE(bundleMetricGroup.getPersistableBundle(String16("open_session_ok"), &metric));
  PersistableBundle metricInstance;
  ASSERT_TRUE(metric.getPersistableBundle(String16("[0]"), &metricInstance));
  int64_t value = 0;
  ASSERT_TRUE(metric.getLong(String16("count"), &value));
  ASSERT_TRUE(metricInstance.getLong(String16("count"), &value));
  ASSERT_EQ(3, value);
  PersistableBundle attributeBundle;
  ASSERT_TRUE(metric.getPersistableBundle(String16("attributes"), &attributeBundle));
  ASSERT_TRUE(metricInstance.getPersistableBundle(String16("attributes"), &attributeBundle));
  ASSERT_TRUE(attributeBundle.getLong(String16("status"), &value));
  ASSERT_EQ((int64_t) Status::OK, value);

  ASSERT_TRUE(bundleMetricGroup.getPersistableBundle(String16("close_session_not_opened"),
                                                     &metric));
  ASSERT_TRUE(metric.getLong(String16("count"), &value));
  ASSERT_TRUE(metric.getPersistableBundle(String16("[0]"), &metricInstance));
  ASSERT_TRUE(metricInstance.getLong(String16("count"), &value));
  ASSERT_EQ(7, value);
  ASSERT_TRUE(metric.getPersistableBundle(String16("attributes"), &attributeBundle));
  ASSERT_TRUE(metricInstance.getPersistableBundle(String16("attributes"), &attributeBundle));
  value = 0;
  ASSERT_TRUE(attributeBundle.getLong(String16("status"), &value));
  ASSERT_EQ((int64_t) Status::ERROR_DRM_SESSION_NOT_OPENED, value);
+2 −1
Original line number Diff line number Diff line
@@ -1397,7 +1397,8 @@ status_t ItemTable::buildImageItemsIfPossible(uint32_t type) {
        ALOGV("adding %s: itemId %d", image.isGrid() ? "grid" : "image", info.itemId);

        if (image.isGrid()) {
            if (size > 12) {
            // ImageGrid struct is at least 8-byte, at most 12-byte (if flags&1)
            if (size < 8 || size > 12) {
                return ERROR_MALFORMED;
            }
            uint8_t buf[12];
+1 −1
Original line number Diff line number Diff line
@@ -350,7 +350,7 @@ aaudio_result_t AudioStreamRecord::requestStop() {
    mTimestampPosition.set(getFramesRead());
    mAudioRecord->stop();
    mCallbackEnabled.store(false);
    mFramesRead.reset32();
    mFramesWritten.reset32(); // service writes frames, service position reset on flush
    mTimestampPosition.reset32();
    // Pass false to prevent errorCallback from being called after disconnect
    // when app has already requested a stop().
Loading