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

Commit 31bc40f1 authored by Android Build Coastguard Worker's avatar Android Build Coastguard Worker
Browse files

Snap for 10162339 from 563a844e to udc-release

Change-Id: I2542f70cb7ef2fdd873960befeb51c608dbc0b56
parents 0a4b1a8d 563a844e
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -345,6 +345,7 @@
            <name>IRemotelyProvisionedComponent</name>
            <instance>default</instance>
            <instance>strongbox</instance>
            <instance>widevine</instance>
        </interface>
    </hal>
    <hal format="aidl" optional="true">
+10 −4
Original line number Diff line number Diff line
@@ -80,7 +80,13 @@ string get_imei(int slot) {
        return "";
    }

    return ::android::base::Trim(out[0]);
    string imei = ::android::base::Trim(out[0]);
    if (imei.compare("null") == 0) {
        LOG(ERROR) << "Error in getting IMEI from Telephony service: value is null. Cmd: " << cmd;
        return "";
    }

    return imei;
}

}  // namespace
@@ -972,7 +978,7 @@ TEST_P(AttestKeyTest, SecondIMEIAttestationIDSuccess) {

    // Skip the test if there is no second IMEI exists.
    string second_imei = get_imei(1);
    if (second_imei.empty() || second_imei.compare("null") == 0) {
    if (second_imei.empty()) {
        GTEST_SKIP() << "Test not applicable as there is no second IMEI";
    }

@@ -1050,13 +1056,13 @@ TEST_P(AttestKeyTest, MultipleIMEIAttestationIDSuccess) {

    // Skip the test if there is no first IMEI exists.
    string imei = get_imei(0);
    if (imei.empty() || imei.compare("null") == 0) {
    if (imei.empty()) {
        GTEST_SKIP() << "Test not applicable as there is no first IMEI";
    }

    // Skip the test if there is no second IMEI exists.
    string second_imei = get_imei(1);
    if (second_imei.empty() || second_imei.compare("null") == 0) {
    if (second_imei.empty()) {
        GTEST_SKIP() << "Test not applicable as there is no second IMEI";
    }

+11 −2
Original line number Diff line number Diff line
@@ -68,7 +68,13 @@ void TvInput::init() {
::ndk::ScopedAStatus TvInput::setTvMessageEnabled(int32_t deviceId, int32_t streamId,
                                                  TvMessageEventType in_type, bool enabled) {
    ALOGV("%s", __FUNCTION__);
    // TODO: Implement this

    if (mStreamConfigs.count(deviceId) == 0) {
        ALOGW("Device with id %d isn't available", deviceId);
        return ::ndk::ScopedAStatus::fromServiceSpecificError(STATUS_INVALID_ARGUMENTS);
    }

    mTvMessageEventEnabled[deviceId][streamId][in_type] = enabled;
    return ::ndk::ScopedAStatus::ok();
}

@@ -76,7 +82,10 @@ void TvInput::init() {
        MQDescriptor<int8_t, SynchronizedReadWrite>* out_queue, int32_t in_deviceId,
        int32_t in_streamId) {
    ALOGV("%s", __FUNCTION__);
    // TODO: Implement this
    if (mStreamConfigs.count(in_deviceId) == 0) {
        ALOGW("Device with id %d isn't available", in_deviceId);
        return ::ndk::ScopedAStatus::fromServiceSpecificError(STATUS_INVALID_ARGUMENTS);
    }
    return ::ndk::ScopedAStatus::ok();
}

+5 −1
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@
#include <aidl/android/hardware/tv/input/TvMessageEventType.h>
#include <fmq/AidlMessageQueue.h>
#include <map>
#include <unordered_map>
#include "TvInputDeviceInfoWrapper.h"
#include "TvStreamConfigWrapper.h"

@@ -38,6 +39,9 @@ namespace hardware {
namespace tv {
namespace input {

using TvMessageEnabledMap = std::unordered_map<
        int32_t, std::unordered_map<int32_t, std::unordered_map<TvMessageEventType, bool>>>;

class TvInput : public BnTvInput {
  public:
    TvInput();
@@ -53,7 +57,6 @@ class TvInput : public BnTvInput {
    ::ndk::ScopedAStatus openStream(int32_t in_deviceId, int32_t in_streamId,
                                    NativeHandle* _aidl_return) override;
    ::ndk::ScopedAStatus closeStream(int32_t in_deviceId, int32_t in_streamId) override;

    void init();

  private:
@@ -62,6 +65,7 @@ class TvInput : public BnTvInput {
    shared_ptr<ITvInputCallback> mCallback;
    map<int32_t, shared_ptr<TvInputDeviceInfoWrapper>> mDeviceInfos;
    map<int32_t, map<int32_t, shared_ptr<TvStreamConfigWrapper>>> mStreamConfigs;
    TvMessageEnabledMap mTvMessageEventEnabled;
};

}  // namespace input
+47 −3
Original line number Diff line number Diff line
@@ -259,8 +259,11 @@ TEST_P(TvInputAidlTest, OpenAnOpenedStreamsTest) {
        return;
    }
    int32_t device_id = stream_config_.keyAt(indices[0]);
    int32_t stream_id = stream_config_.valueAt(indices[0])[0].streamId;

    vector<TvStreamConfig> streamConfigs = stream_config_.valueAt(indices[0]);
    if (streamConfigs.empty()) {
        return;
    }
    int32_t stream_id = streamConfigs[0].streamId;
    NativeHandle handle;

    ALOGD("OpenAnOpenedStreamsTest: open stream, device_id=%d, stream_id=%d", device_id, stream_id);
@@ -291,7 +294,11 @@ TEST_P(TvInputAidlTest, CloseStreamBeforeOpenTest) {
        return;
    }
    int32_t device_id = stream_config_.keyAt(indices[0]);
    int32_t stream_id = stream_config_.valueAt(indices[0])[0].streamId;
    vector<TvStreamConfig> streamConfigs = stream_config_.valueAt(indices[0]);
    if (streamConfigs.empty()) {
        return;
    }
    int32_t stream_id = streamConfigs[0].streamId;

    ALOGD("CloseStreamBeforeOpenTest: close stream, device_id=%d, stream_id=%d", device_id,
          stream_id);
@@ -299,6 +306,43 @@ TEST_P(TvInputAidlTest, CloseStreamBeforeOpenTest) {
                ITvInput::STATUS_INVALID_STATE);
}

TEST_P(TvInputAidlTest, SetTvMessageEnabledTest) {
    unique_lock<mutex> lock(mutex_);

    updateAllStreamConfigurations();
    vector<size_t> indices = getConfigIndices();
    if (indices.empty()) {
        return;
    }
    int32_t device_id = stream_config_.keyAt(indices[0]);
    vector<TvStreamConfig> streamConfigs = stream_config_.valueAt(indices[0]);
    if (streamConfigs.empty()) {
        return;
    }
    int32_t stream_id = streamConfigs[0].streamId;
    ALOGD("SetTvMessageEnabledTest: device_id=%d, stream_id=%d", device_id, stream_id);
    tv_input_->setTvMessageEnabled(device_id, stream_id, TvMessageEventType::WATERMARK, true);
}

TEST_P(TvInputAidlTest, GetTvMessageQueueTest) {
    unique_lock<mutex> lock(mutex_);

    updateAllStreamConfigurations();
    vector<size_t> indices = getConfigIndices();
    if (indices.empty()) {
        return;
    }
    int32_t device_id = stream_config_.keyAt(indices[0]);
    vector<TvStreamConfig> streamConfigs = stream_config_.valueAt(indices[0]);
    if (streamConfigs.empty()) {
        return;
    }
    int32_t stream_id = streamConfigs[0].streamId;
    ALOGD("GetTvMessageQueueTest: device_id=%d, stream_id=%d", device_id, stream_id);
    MQDescriptor<int8_t, SynchronizedReadWrite> queue;
    tv_input_->getTvMessageQueueDesc(&queue, device_id, stream_id);
}

INSTANTIATE_TEST_SUITE_P(PerInstance, TvInputAidlTest,
                         testing::ValuesIn(android::getAidlHalInstanceNames(ITvInput::descriptor)),
                         android::PrintInstanceNameToString);
Loading