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",
46        "android.test.runner",
47        "safety-center-annotations",
48    ],
49
50    static_libs: [
51        "PermissionController-lib",
52        "iconloader_sc_mainline_prod",
53        "com.google.android.material_material",
54        "androidx.transition_transition",
55        "androidx.compose.foundation_foundation",
56        "androidx.compose.runtime_runtime",
57        "androidx.compose.runtime_runtime-livedata",
58        "androidx.compose.ui_ui",
59        "androidx-constraintlayout_constraintlayout",
60        "androidx.core_core",
61        "androidx.media_media",
62        "androidx.legacy_legacy-support-core-utils",
63        "androidx.legacy_legacy-support-core-ui",
64        "androidx.fragment_fragment",
65        "androidx.appcompat_appcompat",
66        "androidx.preference_preference",
67        "androidx.recyclerview_recyclerview",
68        "androidx.legacy_legacy-preference-v14",
69        "androidx.leanback_leanback",
70        "androidx.leanback_leanback-preference",
71        "androidx.lifecycle_lifecycle-extensions",
72        "androidx.lifecycle_lifecycle-common-java8",
73        "androidx.wear.compose_compose-material",
74        "kotlin-stdlib",
75        "kotlinx-coroutines-android",
76        "androidx.navigation_navigation-common-ktx",
77        "androidx.navigation_navigation-fragment-ktx",
78        "androidx.navigation_navigation-runtime-ktx",
79        "androidx.navigation_navigation-ui-ktx",
80        "SettingsLibHelpUtils",
81        "SettingsLibRestrictedLockUtils",
82        "SettingsLibAppPreference",
83        "SettingsLibSearchWidget",
84        "SettingsLibLayoutPreference",
85        "SettingsLibBarChartPreference",
86        "SettingsLibActionBarShadow",
87        "SettingsLibProgressBar",
88        "SettingsLibCollapsingToolbarBaseActivity",
89        "SettingsLibSettingsTheme",
90        "SettingsLibFooterPreference",
91        "SettingsLibSelectorWithWidgetPreference",
92        "SettingsLibTwoTargetPreference",
93        "SettingsLibActivityEmbedding",
94        "SettingsLibIllustrationPreference",
95        "androidx.annotation_annotation",
96        "permissioncontroller-statsd",
97        // The PermissionController build file includes android.car-stubs in its libs dependency
98        // and that works since the phone code does not initialize any classes with a android.car
99        // dependency at runtime. If it did, the class loading would throw an exception. The "libs"
100        // usage in the main module means that the dependency is loaded from the device, instead of
101        // being statically included, which helps avoid apk bloat and conflicting dependencies.
102        // To use just one test target, without any form-factor-specific configuration, we need to
103        // statically include this car dependency. Otherwise running these unit tests against a
104        // phone will cause the tests to fail due to an initialization exception for unfound car
105        // dependency classes. Here we use the android.car target instead of android.car-stubs so
106        // that we can utilize some data classes within the car dependency. If all dependencies were
107        // mocked, then the stubs dependency would be suitable. Note that on Auto device the boot
108        // class path will always override the static dependency.
109        "android.car",
110        "car-ui-lib",
111        "libprotobuf-java-lite",
112        "SettingsLibUtils",
113        "modules-utils-build_system",
114        "safety-center-internal-data",
115        "safety-center-pending-intents",
116        "safety-center-resources-lib",
117        "safety-label",
118        "role-controller",
119        "lottie",
120        "android.permission.flags-aconfig-java-export",
121        "com.android.permission.flags-aconfig-java-export",
122        "platform-test-annotations",
123        "flag-junit",
124        "androidx.test.rules",
125        "androidx.test.ext.truth",
126        "androidx.test.ext.junit",
127        "kotlinx_coroutines_test",
128        "mockito-target-extended-minus-junit4",
129    ],
130
131    jni_libs: [
132        "libdexmakerjvmtiagent",
133        "libstaticjvmtiagent",
134    ],
135    compile_multilib: "both",
136
137    test_suites: [
138        "device-tests",
139        "mts-permission",
140    ],
141
142    kotlincflags: ["-Xjvm-default=all"],
143}
144