1 /* 2 * Copyright (C) 2017 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 #include <android-base/logging.h> 18 19 #include <android/hardware/radio/1.0/types.h> 20 #include <android/log.h> 21 #include <gtest/gtest.h> 22 23 using ::android::hardware::radio::V1_0::RadioError; 24 using ::android::hardware::radio::V1_0::SapResultCode; 25 using namespace std; 26 27 enum CheckFlag { 28 CHECK_DEFAULT = 0, 29 CHECK_GENERAL_ERROR = 1, 30 CHECK_OEM_ERROR = 2, 31 CHECK_OEM_AND_GENERAL_ERROR = 3, 32 CHECK_SAP_ERROR = 4, 33 }; 34 35 static constexpr const char* FEATURE_VOICE_CALL = "android.software.connectionservice"; 36 37 /* 38 * Generate random serial number for radio test 39 */ 40 int GetRandomSerialNumber(); 41 42 /* 43 * Check multiple radio error codes which are possibly returned because of the different 44 * vendor/devices implementations. It allows optional checks for general errors or/and oem errors. 45 */ 46 ::testing::AssertionResult CheckAnyOfErrors(RadioError err, std::vector<RadioError> generalError, 47 CheckFlag flag = CHECK_DEFAULT); 48 /* 49 * Check multiple sap error codes which are possibly returned because of the different 50 * vendor/devices implementations. 51 */ 52 ::testing::AssertionResult CheckAnyOfErrors(SapResultCode err, std::vector<SapResultCode> errors); 53 54 /* 55 * Check if device supports feature. 56 */ 57 bool deviceSupportsFeature(const char* feature); 58