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
28LOCAL_STATIC_JAVA_LIBRARIES := android-ex-camera2 \
29                               android-support-v4 \
30                               compatibility-common-util-devicesidelib_v2 \
31                               cts-sensors-tests \
32                               ctstestrunner \
33                               apache-commons-math \
34                               androidplot \
35                               ctsverifier-opencv \
36                               core-tests \
37                               android-support-v4  \
38                               mockito-target \
39                               mockwebserver \
40                               compatibility-device-util_v2 \
41
42LOCAL_PACKAGE_NAME := CtsVerifier
43
44LOCAL_AAPT_FLAGS += --version-name "6.0_r0 $(BUILD_NUMBER)"
45
46LOCAL_JNI_SHARED_LIBRARIES := libctsverifier_jni libaudioloopback_jni
47
48LOCAL_PROGUARD_FLAG_FILES := proguard.flags
49
50LOCAL_SDK_VERSION := current
51
52LOCAL_DEX_PREOPT := false
53
54include $(BUILD_PACKAGE)
55
56
57# opencv library
58include $(CLEAR_VARS)
59
60LOCAL_PREBUILT_STATIC_JAVA_LIBRARIES := \
61        ctsverifier-opencv:libs/opencv-android.jar
62
63include $(BUILD_MULTI_PREBUILT)
64
65
66notification-bot := $(call intermediates-dir-for,APPS,NotificationBot)/package.apk
67permission-app := $(call intermediates-dir-for,APPS,CtsPermissionApp)/package.apk
68
69# Builds and launches CTS Verifier on a device.
70.PHONY: cts-verifier
71cts-verifier: CtsVerifier adb NotificationBot CtsPermissionApp
72	adb install -r $(PRODUCT_OUT)/data/app/CtsVerifier/CtsVerifier.apk \
73		&& adb install -r $(notification-bot) \
74		&& adb install -r $(permission-app) \
75		&& adb shell "am start -n com.android.cts.verifier/.CtsVerifierActivity"
76
77#
78# Creates a "cts-verifier" directory that will contain:
79#
80# 1. Out directory with a "android-cts-verifier" containing the CTS Verifier
81#    and other binaries it needs.
82#
83# 2. Zipped version of the android-cts-verifier directory to be included with
84#    the build distribution.
85#
86cts-dir := $(HOST_OUT)/cts-verifier
87verifier-dir-name := android-cts-verifier
88verifier-dir := $(cts-dir)/$(verifier-dir-name)
89verifier-zip-name := $(verifier-dir-name).zip
90verifier-zip := $(cts-dir)/$(verifier-zip-name)
91
92# turned off sensor power tests in initial L release
93#$(PRODUCT_OUT)/data/app/CtsVerifier.apk $(verifier-zip): $(verifier-dir)/power/execute_power_tests.py
94#$(PRODUCT_OUT)/data/app/CtsVerifier.apk $(verifier-zip): $(verifier-dir)/power/power_monitors/monsoon.py
95
96# Copy the necessary host-side scripts to include in the zip file:
97#$(verifier-dir)/power/power_monitors/monsoon.py: cts/apps/CtsVerifier/assets/scripts/power_monitors/monsoon.py | $(ACP)
98#	$(hide) mkdir -p $(verifier-dir)/power/power_monitors
99#	$(hide) $(ACP) -fp cts/apps/CtsVerifier/assets/scripts/power_monitors/*.py $(verifier-dir)/power/power_monitors/.
100#
101#$(verifier-dir)/power/execute_power_tests.py: cts/apps/CtsVerifier/assets/scripts/execute_power_tests.py | $(ACP)
102#	$(hide) mkdir -p $(verifier-dir)/power
103#	$(hide) $(ACP) -fp cts/apps/CtsVerifier/assets/scripts/execute_power_tests.py $@
104
105cts : $(verifier-zip)
106ifeq ($(HOST_OS),linux)
107$(verifier-zip) : $(HOST_OUT)/bin/cts-usb-accessory
108endif
109$(verifier-zip) : $(HOST_OUT)/CameraITS
110$(verifier-zip) : $(notification-bot)
111$(verifier-zip) : $(permission-app)
112$(verifier-zip) : $(call intermediates-dir-for,APPS,CtsVerifier)/package.apk | $(ACP)
113		$(hide) mkdir -p $(verifier-dir)
114		$(hide) $(ACP) -fp $< $(verifier-dir)/CtsVerifier.apk
115		$(ACP) -fp $(notification-bot) $(verifier-dir)/NotificationBot.apk
116		$(ACP) -fp $(permission-app) $(verifier-dir)/CtsPermissionApp.apk
117ifeq ($(HOST_OS),linux)
118		$(hide) $(ACP) -fp $(HOST_OUT)/bin/cts-usb-accessory $(verifier-dir)/cts-usb-accessory
119endif
120		$(hide) $(ACP) -fpr $(HOST_OUT)/CameraITS $(verifier-dir)
121		$(hide) cd $(cts-dir) && zip -rq $(verifier-dir-name) $(verifier-dir-name)
122
123ifneq ($(filter cts, $(MAKECMDGOALS)),)
124  $(call dist-for-goals, cts, $(verifier-zip):$(verifier-zip-name))
125endif
126
127include $(call all-makefiles-under,$(LOCAL_PATH))
128