• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#
2# Copyright (C) 2010 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
17LOCAL_PATH:= $(call my-dir)
18include $(CLEAR_VARS)
19
20LOCAL_MODULE_TAGS := optional
21
22LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
23
24LOCAL_MULTILIB := both
25
26LOCAL_SRC_FILES := $(call all-java-files-under, src) $(call all-Iaidl-files-under, src) \
27                    ../ForceStopHelperApp/src/com/android/cts/forcestophelper/Constants.java
28
29LOCAL_AIDL_INCLUDES := \
30    frameworks/native/aidl/gui
31
32LOCAL_USE_AAPT2 := true
33
34LOCAL_STATIC_JAVA_LIBRARIES := android-ex-camera2 \
35                               compatibility-common-util-devicesidelib \
36                               cts-sensors-tests \
37                               cts-location-tests \
38                               cts-camera-performance-tests \
39                               ctstestrunner-axt \
40                               apache-commons-math \
41                               androidplot \
42                               ctsverifier-opencv \
43                               core-tests-support \
44                               androidx.legacy_legacy-support-v4  \
45                               mockito-target-minus-junit4 \
46                               mockwebserver \
47                               compatibility-device-util-axt \
48                               platform-test-annotations \
49                               cts-security-test-support-library \
50                               cts-midi-lib
51
52LOCAL_STATIC_ANDROID_LIBRARIES := \
53    androidx.legacy_legacy-support-v4
54
55LOCAL_JAVA_LIBRARIES += telephony-common
56LOCAL_JAVA_LIBRARIES += android.test.runner.stubs
57LOCAL_JAVA_LIBRARIES += android.test.base.stubs
58LOCAL_JAVA_LIBRARIES += android.test.mock.stubs
59LOCAL_JAVA_LIBRARIES += voip-common
60
61LOCAL_PACKAGE_NAME := CtsVerifier
62LOCAL_PRIVATE_PLATFORM_APIS := true
63
64LOCAL_JNI_SHARED_LIBRARIES := \
65	libctsverifier_jni \
66	libctsnativemidi_jni \
67	libaudioloopback_jni \
68
69LOCAL_PROGUARD_FLAG_FILES := proguard.flags
70
71LOCAL_DEX_PREOPT := false
72-include cts/error_prone_rules_tests.mk
73include $(BUILD_PACKAGE)
74
75# Build CTS verifier framework as a libary.
76
77include $(CLEAR_VARS)
78
79define java-files-in
80$(sort $(patsubst ./%,%, \
81  $(shell cd $(LOCAL_PATH) ; \
82          find -L $(1) -maxdepth 1 -name *.java -and -not -name ".*") \
83 ))
84endef
85
86LOCAL_MODULE := cts-verifier-framework
87LOCAL_AAPT_FLAGS := --auto-add-overlay --extra-packages android.support.v4
88LOCAL_SDK_VERSION := current
89LOCAL_MIN_SDK_VERSION := 19
90LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res
91LOCAL_SRC_FILES := \
92    $(call java-files-in, src/com/android/cts/verifier) \
93    $(call all-Iaidl-files-under, src)
94
95LOCAL_STATIC_JAVA_LIBRARIES := androidx.legacy_legacy-support-v4 \
96                               compatibility-common-util-devicesidelib \
97                               compatibility-device-util-axt
98
99include $(BUILD_STATIC_JAVA_LIBRARY)
100
101# opencv library
102include $(CLEAR_VARS)
103
104LOCAL_PREBUILT_STATIC_JAVA_LIBRARIES := \
105        ctsverifier-opencv:libs/opencv3-android.jar
106
107include $(BUILD_MULTI_PREBUILT)
108
109pre-installed-apps := \
110    CtsEmptyDeviceAdmin \
111    CtsEmptyDeviceOwner \
112    CtsPermissionApp \
113    CtsForceStopHelper \
114    NotificationBot
115
116# Apps to be installed as Instant App using adb install --instant
117pre-installed-instant-app := CtsVerifierInstantApp
118
119other-required-apps := \
120    CtsVerifierUSBCompanion \
121    CtsVpnFirewallAppApi23 \
122    CtsVpnFirewallAppApi24 \
123    CtsVpnFirewallAppNotAlwaysOn
124
125apps-to-include := \
126    $(pre-installed-apps) \
127    $(pre-installed-instant-app) \
128    $(other-required-apps)
129
130define apk-location-for
131    $(call intermediates-dir-for,APPS,$(1))/package.apk
132endef
133
134# Builds and launches CTS Verifier on a device.
135.PHONY: cts-verifier
136cts-verifier: CtsVerifier adb $(pre-installed-apps) $(pre-installed-instant-app)
137	adb install -r $(PRODUCT_OUT)/data/app/CtsVerifier/CtsVerifier.apk \
138		$(foreach app,$(pre-installed-apps), \
139		    && adb install -r -t $(call apk-location-for,$(app))) \
140		&& adb install -r --instant $(call apk-location-for,$(pre-installed-instant-app)) \
141		&& adb shell "am start -n com.android.cts.verifier/.CtsVerifierActivity"
142
143#
144# Creates a "cts-verifier" directory that will contain:
145#
146# 1. Out directory with a "android-cts-verifier" containing the CTS Verifier
147#    and other binaries it needs.
148#
149# 2. Zipped version of the android-cts-verifier directory to be included with
150#    the build distribution.
151#
152cts-dir := $(HOST_OUT)/cts-verifier
153verifier-dir-name := android-cts-verifier
154verifier-dir := $(cts-dir)/$(verifier-dir-name)
155verifier-zip-name := $(verifier-dir-name).zip
156verifier-zip := $(cts-dir)/$(verifier-zip-name)
157
158# turned off sensor power tests in initial L release
159#$(PRODUCT_OUT)/data/app/CtsVerifier.apk $(verifier-zip): $(verifier-dir)/power/execute_power_tests.py
160#$(PRODUCT_OUT)/data/app/CtsVerifier.apk $(verifier-zip): $(verifier-dir)/power/power_monitors/monsoon.py
161
162# Copy the necessary host-side scripts to include in the zip file:
163#$(verifier-dir)/power/power_monitors/monsoon.py: cts/apps/CtsVerifier/assets/scripts/power_monitors/monsoon.py | $(ACP)
164#	$(hide) mkdir -p $(verifier-dir)/power/power_monitors
165#	$(hide) $(ACP) -fp cts/apps/CtsVerifier/assets/scripts/power_monitors/*.py $(verifier-dir)/power/power_monitors/.
166#
167#$(verifier-dir)/power/execute_power_tests.py: cts/apps/CtsVerifier/assets/scripts/execute_power_tests.py | $(ACP)
168#	$(hide) mkdir -p $(verifier-dir)/power
169#	$(hide) $(ACP) -fp cts/apps/CtsVerifier/assets/scripts/execute_power_tests.py $@
170
171cts : $(verifier-zip)
172$(verifier-zip) : $(HOST_OUT)/CameraITS
173$(verifier-zip) : $(foreach app,$(apps-to-include),$(call apk-location-for,$(app)))
174$(verifier-zip) : $(call intermediates-dir-for,APPS,CtsVerifier)/package.apk | $(ACP)
175		$(hide) mkdir -p $(verifier-dir)
176		$(hide) $(ACP) -fp $< $(verifier-dir)/CtsVerifier.apk
177		$(foreach app,$(apps-to-include), \
178		    $(ACP) -fp $(call apk-location-for,$(app)) $(verifier-dir)/$(app).apk;)
179		$(hide) $(ACP) -fpr $(HOST_OUT)/CameraITS $(verifier-dir)
180		$(hide) cd $(cts-dir) && zip -rq $(verifier-dir-name) $(verifier-dir-name)
181
182$(call dist-for-goals, cts, $(verifier-zip):$(verifier-zip-name))
183
184include $(call all-makefiles-under,$(LOCAL_PATH))
185