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

Commit 40e9d2ec authored by Android Build Coastguard Worker's avatar Android Build Coastguard Worker
Browse files

Snap for 8617226 from 479ec9e1 to tm-release

Change-Id: I19f77f0e09c60b0cbf7341cc3f4fa6143831144c
parents bf8f6149 479ec9e1
Loading
Loading
Loading
Loading
+0 −13
Original line number Diff line number Diff line
@@ -59,16 +59,3 @@ cc_test {
    ],
    require_root: true,
}

java_test_host {
    name: "IdentityCredentialImplementedTest",
    libs: [
        "tradefed",
        "vts-core-tradefed-harness",
    ],
    srcs: ["src/**/*.java"],
    test_suites: [
        "vts",
    ],
    test_config: "IdentityCredentialImplementedTest.xml",
}
+0 −22
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2022 The Android Open Source Project

     Licensed under the Apache License, Version 2.0 (the "License");
     you may not use this file except in compliance with the License.
     You may obtain a copy of the License at

          http://www.apache.org/licenses/LICENSE-2.0

     Unless required by applicable law or agreed to in writing, software
     distributed under the License is distributed on an "AS IS" BASIS,
     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     See the License for the specific language governing permissions and
     limitations under the License.
-->
<configuration description="Runs IdentityCredentialImplementedTest">
  <target_preparer class="com.android.tradefed.targetprep.RootTargetPreparer" />

  <test class="com.android.tradefed.testtype.HostTest" >
    <option name="jar" value="IdentityCredentialImplementedTest.jar" />
  </test>
</configuration>
+0 −64
Original line number Diff line number Diff line
/*
 * Copyright (C) 2020 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.android.tests.security.identity;

import static org.junit.Assert.fail;
import static org.junit.Assume.assumeTrue;

import android.platform.test.annotations.RequiresDevice;
import com.android.tradefed.device.DeviceNotAvailableException;
import com.android.tradefed.testtype.DeviceJUnit4ClassRunner;
import com.android.tradefed.testtype.junit4.BaseHostJUnit4Test;
import org.junit.Test;
import org.junit.runner.RunWith;

@RunWith(DeviceJUnit4ClassRunner.class)
public class IdentityCredentialImplementedTest extends BaseHostJUnit4Test {
    // Returns the ro.vendor.api_level or 0 if not set.
    //
    // Throws NumberFormatException if ill-formatted.
    //
    // Throws DeviceNotAvailableException if device is not available.
    //
    private int getVendorApiLevel() throws NumberFormatException, DeviceNotAvailableException {
        String vendorApiLevelString =
                getDevice().executeShellCommand("getprop ro.vendor.api_level").trim();
        if (vendorApiLevelString.isEmpty()) {
            return 0;
        }
        return Integer.parseInt(vendorApiLevelString);
    }

    // As of Android 13 (API level 32), Identity Credential is required at feature version 202201
    // or newer.
    //
    @RequiresDevice
    @Test
    public void testIdentityCredentialIsImplemented() throws Exception {
        int vendorApiLevel = getVendorApiLevel();
        assumeTrue(vendorApiLevel >= 32);

        final String minimumFeatureVersionNeeded = "202201";

        String result = getDevice().executeShellCommand(
                "pm has-feature android.hardware.identity_credential "
                + minimumFeatureVersionNeeded);
        if (!result.trim().equals("true")) {
            fail("Identity Credential feature version " + minimumFeatureVersionNeeded
                    + " required but not found");
        }
    }
}
+2 −1
Original line number Diff line number Diff line
@@ -109,8 +109,9 @@ ndk::ScopedAStatus RadioNetworkResponse::getSignalStrengthResponse(
}

ndk::ScopedAStatus RadioNetworkResponse::getSystemSelectionChannelsResponse(
        const RadioResponseInfo& info, const std::vector<RadioAccessSpecifier>& /*specifier*/) {
        const RadioResponseInfo& info, const std::vector<RadioAccessSpecifier>& specifiers) {
    rspInfo = info;
    this->specifiers = specifiers;
    parent_network.notify(info.serial);
    return ndk::ScopedAStatus::ok();
}
+20 −4
Original line number Diff line number Diff line
@@ -769,6 +769,16 @@ TEST_P(RadioNetworkTest, setLinkCapacityReportingCriteria_Geran) {
 */
TEST_P(RadioNetworkTest, setSystemSelectionChannels) {
    serial = GetRandomSerialNumber();
    ndk::ScopedAStatus res = radio_network->getSystemSelectionChannels(serial);
    EXPECT_EQ(std::cv_status::no_timeout, wait());
    EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_network->rspInfo.type);
    EXPECT_EQ(serial, radioRsp_network->rspInfo.serial);
    if (radioRsp_network->specifiers.size() == 0) {
        // TODO (b/189255895): Throw an error once getSystemSelectionChannels is functional.
        ALOGI("Skipped the test due to empty system selection channels.");
        GTEST_SKIP();
    }
    std::vector<RadioAccessSpecifier> originalSpecifiers = radioRsp_network->specifiers;

    RadioAccessSpecifierBands bandP900 =
            RadioAccessSpecifierBands::make<RadioAccessSpecifierBands::geranBands>(
@@ -781,8 +791,8 @@ TEST_P(RadioNetworkTest, setSystemSelectionChannels) {
    RadioAccessSpecifier specifier850 = {
            .accessNetwork = AccessNetwork::GERAN, .bands = band850, .channels = {128, 129}};

    ndk::ScopedAStatus res =
            radio_network->setSystemSelectionChannels(serial, true, {specifierP900, specifier850});
    serial = GetRandomSerialNumber();
    res = radio_network->setSystemSelectionChannels(serial, true, {specifierP900, specifier850});
    ASSERT_OK(res);
    EXPECT_EQ(std::cv_status::no_timeout, wait());
    EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_network->rspInfo.type);
@@ -795,8 +805,8 @@ TEST_P(RadioNetworkTest, setSystemSelectionChannels) {

    if (radioRsp_network->rspInfo.error == RadioError::NONE) {
        serial = GetRandomSerialNumber();
        ndk::ScopedAStatus res = radio_network->setSystemSelectionChannels(
                serial, false, {specifierP900, specifier850});
        res = radio_network->setSystemSelectionChannels(serial, false,
                                                        {specifierP900, specifier850});
        ASSERT_OK(res);
        EXPECT_EQ(std::cv_status::no_timeout, wait());
        EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_network->rspInfo.type);
@@ -805,6 +815,12 @@ TEST_P(RadioNetworkTest, setSystemSelectionChannels) {
              toString(radioRsp_network->rspInfo.error).c_str());
        EXPECT_EQ(RadioError::NONE, radioRsp_network->rspInfo.error);
    }

    serial = GetRandomSerialNumber();
    res = radio_network->setSystemSelectionChannels(serial, true, originalSpecifiers);
    EXPECT_EQ(std::cv_status::no_timeout, wait());
    EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_network->rspInfo.type);
    EXPECT_EQ(serial, radioRsp_network->rspInfo.serial);
}

/*
Loading