1 /* 2 * Copyright (C) 2016 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 package com.android.cts.verifier.bluetooth; 18 19 import android.bluetooth.BluetoothAdapter; 20 import android.content.pm.PackageManager; 21 import android.os.Build; 22 import android.os.Bundle; 23 import android.os.SystemProperties; 24 25 import com.android.cts.verifier.ManifestTestListAdapter; 26 import com.android.cts.verifier.PassFailButtons; 27 import com.android.cts.verifier.R; 28 29 import java.util.ArrayList; 30 import java.util.List; 31 32 public class BleSecureClientTestListActivity extends PassFailButtons.TestListActivity { 33 34 @Override onCreate(Bundle savedInstanceState)35 protected void onCreate(Bundle savedInstanceState) { 36 super.onCreate(savedInstanceState); 37 setContentView(R.layout.pass_fail_list); 38 setPassFailButtonClickListeners(); 39 setInfoResources(R.string.ble_secure_client_test_list_name, R.string.ble_secure_client_test_list_info, -1); 40 41 BluetoothAdapter adapter = BluetoothAdapter.getDefaultAdapter(); 42 List<String> disabledTest = new ArrayList<String>(); 43 44 // Temporarily disable this test (b/235763737). 45 disabledTest.add( 46 "com.android.cts.verifier.bluetooth.BleSecureConnectionPriorityClientTestActivity"); 47 disabledTest.add( 48 "com.android.cts.verifier.bluetooth.BleSecureEncryptedClientTestActivity"); 49 50 if (adapter == null || !adapter.isOffloadedFilteringSupported()) { 51 disabledTest.add( 52 "com.android.cts.verifier.bluetooth.BleAdvertiserHardwareScanFilterActivity."); 53 } 54 55 // RPA is optional on TVs already released before Android 11 56 boolean isTv = getPackageManager().hasSystemFeature(PackageManager.FEATURE_LEANBACK); 57 int firstSdk = SystemProperties.getInt("ro.product.first_api_level", 0); 58 if (isTv && (firstSdk <= Build.VERSION_CODES.Q)) { 59 disabledTest.add( 60 "com.android.cts.verifier.bluetooth.BleSecureConnectionPriorityClientTestActivity"); 61 disabledTest.add( 62 "com.android.cts.verifier.bluetooth.BleSecureEncryptedClientTestActivity"); 63 } 64 65 setTestListAdapter(new ManifestTestListAdapter(this, getClass().getName(), 66 disabledTest.toArray(new String[disabledTest.size()]))); 67 } 68 } 69