1# Copyright (C) 2011 The Android Open Source Project
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7#      http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15LOCAL_PATH := $(call my-dir)
16include $(CLEAR_VARS)
17
18LOCAL_USE_AAPT2 := true
19LOCAL_MODULE_TAGS := tests
20
21LOCAL_JACK_FLAGS := --multi-dex native
22LOCAL_DX_FLAGS := --multi-dex
23
24LOCAL_PROTOC_OPTIMIZE_TYPE := nano
25LOCAL_PROTOC_FLAGS := -I$(LOCAL_PATH)/..
26LOCAL_PROTO_JAVA_OUTPUT_PARAMS := optional_field_style=accessors
27
28LOCAL_PACKAGE_NAME := SystemUITests
29LOCAL_COMPATIBILITY_SUITE := device-tests
30
31LOCAL_SRC_FILES := $(call all-java-files-under, src) \
32    $(call all-Iaidl-files-under, src) \
33    $(call all-java-files-under, ../src)
34
35LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res \
36    frameworks/base/packages/SystemUI/res \
37    frameworks/base/packages/SystemUI/res-keyguard \
38
39LOCAL_STATIC_ANDROID_LIBRARIES := \
40    SystemUIPluginLib \
41    android-support-v4 \
42    android-support-v7-recyclerview \
43    android-support-v7-preference \
44    android-support-v7-appcompat \
45    android-support-v7-mediarouter \
46    android-support-v7-palette \
47    android-support-v14-preference \
48    android-support-v17-leanback
49
50LOCAL_STATIC_JAVA_LIBRARIES := \
51    metrics-helper-lib \
52    android-support-test \
53    mockito-target-minus-junit4 \
54    SystemUI-proto \
55    SystemUI-tags \
56    legacy-android-test \
57    testables \
58    truth-prebuilt \
59
60LOCAL_JAVA_LIBRARIES := android.test.runner telephony-common android.car
61
62LOCAL_AAPT_FLAGS := --extra-packages com.android.systemui:com.android.keyguard
63
64# sign this with platform cert, so this test is allowed to inject key events into
65# UI it doesn't own. This is necessary to allow screenshots to be taken
66LOCAL_CERTIFICATE := platform
67
68# Provide jack a list of classes to exclude from code coverage.
69# This is needed because the SystemUITests compile SystemUI source directly, rather than using
70# LOCAL_INSTRUMENTATION_FOR := SystemUI.
71#
72# We want to exclude the test classes from code coverage measurements, but they share the same
73# package as the rest of SystemUI so they can't be easily filtered by package name.
74#
75# Generate a comma separated list of patterns based on the test source files under src/
76# SystemUI classes are in ../src/ so they won't be excluded.
77# Example:
78#   Input files: src/com/android/systemui/Test.java src/com/android/systemui/AnotherTest.java
79#   Generated exclude list: com.android.systemui.Test*,com.android.systemui.AnotherTest*
80
81# Filter all src files under src/ to just java files
82local_java_files := $(filter %.java,$(call all-java-files-under, src))
83# Transform java file names into full class names.
84# This only works if the class name matches the file name and the directory structure
85# matches the package.
86local_classes := $(subst /,.,$(patsubst src/%.java,%,$(local_java_files)))
87local_comma := ,
88local_empty :=
89local_space := $(local_empty) $(local_empty)
90# Convert class name list to jacoco exclude list
91# This appends a * to all classes and replace the space separators with commas.
92jacoco_exclude := $(subst $(space),$(comma),$(patsubst %,%*,$(local_classes)))
93
94LOCAL_JACK_COVERAGE_INCLUDE_FILTER := com.android.systemui.*
95LOCAL_JACK_COVERAGE_EXCLUDE_FILTER := com.android.systemui.tests.*,$(jacoco_exclude)
96
97include frameworks/base/packages/SettingsLib/common.mk
98
99ifeq ($(EXCLUDE_SYSTEMUI_TESTS),)
100    include $(BUILD_PACKAGE)
101endif
102
103# Reset variables
104local_java_files :=
105local_classes :=
106local_comma :=
107local_space :=
108jacoco_exclude :=
109