• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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    // See: http://go/android-license-faq
19    // A large-scale-change added 'default_applicable_licenses' to import
20    // all of the 'license_kinds' from "packages_modules_Permission_PermissionController_license"
21    // to get the below license kinds:
22    //   SPDX-license-identifier-Apache-2.0
23    default_applicable_licenses: [
24        "packages_modules_Permission_PermissionController_license",
25    ],
26}
27
28android_test {
29    name: "PermissionControllerMockingTests",
30
31    sdk_version: "system_current",
32    target_sdk_version: "30",
33    min_sdk_version: "30",
34
35    resource_dirs: [
36        "main_res",
37        "test_res",
38    ],
39
40    srcs: [
41        ":permissioncontroller-sources",
42
43        "src/**/*.kt",
44    ],
45
46    libs: [
47        "android.test.base",
48        "android.test.runner",
49    ],
50
51    static_libs: [
52        "iconloader",
53        "com.google.android.material_material",
54        "androidx.transition_transition",
55        "androidx-constraintlayout_constraintlayout",
56        "androidx.core_core",
57        "androidx.media_media",
58        "androidx.legacy_legacy-support-core-utils",
59        "androidx.legacy_legacy-support-core-ui",
60        "androidx.fragment_fragment",
61        "androidx.appcompat_appcompat",
62        "androidx.preference_preference",
63        "androidx.recyclerview_recyclerview",
64        "androidx.legacy_legacy-preference-v14",
65        "androidx.leanback_leanback",
66        "androidx.leanback_leanback-preference",
67        "androidx.lifecycle_lifecycle-extensions",
68        "androidx.lifecycle_lifecycle-common-java8",
69        "kotlin-stdlib",
70        "kotlinx-coroutines-android",
71        "androidx.navigation_navigation-common-ktx",
72        "androidx.navigation_navigation-fragment-ktx",
73        "androidx.navigation_navigation-runtime-ktx",
74        "androidx.navigation_navigation-ui-ktx",
75        "SettingsLibHelpUtils",
76        "SettingsLibRestrictedLockUtils",
77        "SettingsLibAppPreference",
78        "SettingsLibSearchWidget",
79        "SettingsLibLayoutPreference",
80        "SettingsLibBarChartPreference",
81        "SettingsLibActionBarShadow",
82        "SettingsLibProgressBar",
83        "SettingsLibCollapsingToolbarBaseActivity",
84        "SettingsLibSettingsTheme",
85        "SettingsLibFooterPreference",
86        "SettingsLibSelectorWithWidgetPreference",
87        "SettingsLibTwoTargetPreference",
88        "androidx.annotation_annotation",
89        "permissioncontroller-statsd",
90        // The PermissionController build file includes android.car-stubs in its libs dependency
91        // and that works since the phone code does not initialize any classes with a android.car
92        // dependency at runtime. If it did, the class loading would throw an exception. The "libs"
93        // usage in the main module means that the dependency is loaded from the device, instead of
94        // being statically included, which helps avoid apk bloat and conflicting dependencies.
95        // To use just one test target, without any form-factor-specific configuration, we need to
96        // statically include this car dependency. Otherwise running these unit tests against a
97        // phone will cause the tests to fail due to an initialization exception for unfound car
98        // dependency classes. Here we use the android.car target instead of android.car-stubs so
99        // that we can utilize some data classes within the car dependency. If all dependencies were
100        // mocked, then the stubs dependency would be suitable. Note that on Auto device the boot
101        // class path will always override the static dependency.
102        "android.car",
103        "car-ui-lib",
104        "libprotobuf-java-lite",
105        "SettingsLibUtils",
106        "modules-utils-build_system",
107
108        "androidx.test.rules",
109        "androidx.test.ext.truth",
110        "androidx.test.ext.junit",
111        "kotlinx_coroutines_test",
112        "mockito-target-extended-minus-junit4",
113    ],
114
115    jni_libs: [
116        "libdexmakerjvmtiagent",
117        "libstaticjvmtiagent",
118    ],
119    compile_multilib: "both",
120
121    aaptflags: ["--custom-package com.android.permissioncontroller"],
122
123    test_suites: [
124        "device-tests",
125        "mts-permission",
126    ],
127
128    kotlincflags: ["-Xjvm-default=enable"],
129}
130