1// 2// Copyright (C) 2020 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 17package { 18 default_team: "trendy_team_android_permissions", 19 // See: http://go/android-license-faq 20 // A large-scale-change added 'default_applicable_licenses' to import 21 // all of the 'license_kinds' from "packages_modules_Permission_PermissionController_license" 22 // to get the below license kinds: 23 // SPDX-license-identifier-Apache-2.0 24 default_applicable_licenses: [ 25 "packages_modules_Permission_PermissionController_license", 26 ], 27} 28 29android_test { 30 name: "PermissionControllerMockingTests", 31 32 sdk_version: "system_current", 33 target_sdk_version: "30", 34 min_sdk_version: "30", 35 36 resource_dirs: [ 37 "test_res", 38 ], 39 40 srcs: [ 41 "src/**/*.kt", 42 ], 43 44 libs: [ 45 "android.test.base.stubs.system", 46 "android.test.runner.stubs.system", 47 "safety-center-annotations", 48 ], 49 50 static_libs: [ 51 "PermissionController-lib", 52 "androidx.lifecycle_lifecycle-extensions", 53 // The PermissionController build file includes android.car-stubs in its libs dependency 54 // and that works since the phone code does not initialize any classes with a android.car 55 // dependency at runtime. If it did, the class loading would throw an exception. The "libs" 56 // usage in the main module means that the dependency is loaded from the device, instead of 57 // being statically included, which helps avoid apk bloat and conflicting dependencies. 58 // To use just one test target, without any form-factor-specific configuration, we need to 59 // statically include this car dependency. Otherwise running these unit tests against a 60 // phone will cause the tests to fail due to an initialization exception for unfound car 61 // dependency classes. Here we use the android.car target instead of android.car-stubs so 62 // that we can utilize some data classes within the car dependency. If all dependencies were 63 // mocked, then the stubs dependency would be suitable. Note that on Auto device the boot 64 // class path will always override the static dependency. 65 "android.car", 66 "android.permission.flags-aconfig-java-export", 67 "com.android.permission.flags-aconfig-java-export", 68 "platform-test-annotations", 69 "flag-junit", 70 "androidx.test.rules", 71 "androidx.test.ext.truth", 72 "androidx.test.ext.junit", 73 "kotlinx_coroutines_test", 74 "mockito-target-extended-minus-junit4", 75 ], 76 77 jni_libs: [ 78 "libdexmakerjvmtiagent", 79 "libstaticjvmtiagent", 80 ], 81 compile_multilib: "both", 82 83 test_suites: [ 84 "device-tests", 85 "mts-permission", 86 ], 87 88 kotlincflags: ["-Xjvm-default=all"], 89 90 // TODO(b/313706381): Remove jarjar once flagging lib is fixed 91 jarjar_rules: ":PermissionController-jarjar-rules", 92} 93