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_MODULE_TAGS := tests
19
20LOCAL_JACK_FLAGS := --multi-dex native
21
22LOCAL_PROTOC_OPTIMIZE_TYPE := nano
23LOCAL_PROTOC_FLAGS := -I$(LOCAL_PATH)/..
24LOCAL_PROTO_JAVA_OUTPUT_PARAMS := optional_field_style=accessors
25
26LOCAL_AAPT_FLAGS := --auto-add-overlay \
27    --extra-packages com.android.systemui:com.android.keyguard:android.support.v14.preference:android.support.v7.preference:android.support.v7.appcompat:android.support.v7.recyclerview \
28    --extra-packages android.support.v17.leanback
29
30LOCAL_SRC_FILES := $(call all-java-files-under, src) \
31    $(call all-Iaidl-files-under, src) \
32    $(call all-java-files-under, ../src)
33
34LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res \
35    frameworks/support/v7/preference/res \
36    frameworks/support/v14/preference/res \
37    frameworks/support/v7/appcompat/res \
38    frameworks/support/v7/recyclerview/res \
39    frameworks/support/v17/leanback/res \
40    frameworks/base/packages/SystemUI/res \
41    frameworks/base/packages/Keyguard/res
42
43LOCAL_JAVA_LIBRARIES := android.test.runner telephony-common
44
45LOCAL_PACKAGE_NAME := SystemUITests
46
47LOCAL_STATIC_JAVA_LIBRARIES := \
48    mockito-target \
49    Keyguard \
50    android-support-v7-recyclerview \
51    android-support-v7-preference \
52    android-support-v7-appcompat \
53    android-support-v14-preference \
54    android-support-v17-leanback \
55    SystemUI-proto-tags
56
57# sign this with platform cert, so this test is allowed to inject key events into
58# UI it doesn't own. This is necessary to allow screenshots to be taken
59LOCAL_CERTIFICATE := platform
60
61# Provide jack a list of classes to exclude from code coverage.
62# This is needed because the SystemUITests compile SystemUI source directly, rather than using
63# LOCAL_INSTRUMENTATION_FOR := SystemUI.
64#
65# We want to exclude the test classes from code coverage measurements, but they share the same
66# package as the rest of SystemUI so they can't be easily filtered by package name.
67#
68# Generate a comma separated list of patterns based on the test source files under src/
69# SystemUI classes are in ../src/ so they won't be excluded.
70# Example:
71#   Input files: src/com/android/systemui/Test.java src/com/android/systemui/AnotherTest.java
72#   Generated exclude list: com.android.systemui.Test*,com.android.systemui.AnotherTest*
73
74# Filter all src files under src/ to just java files
75local_java_files := $(filter %.java,$(call all-java-files-under, src))
76# Transform java file names into full class names.
77# This only works if the class name matches the file name and the directory structure
78# matches the package.
79local_classes := $(subst /,.,$(patsubst src/%.java,%,$(local_java_files)))
80local_comma := ,
81local_empty :=
82local_space := $(local_empty) $(local_empty)
83# Convert class name list to jacoco exclude list
84# This appends a * to all classes and replace the space separators with commas.
85jacoco_exclude := $(subst $(space),$(comma),$(patsubst %,%*,$(local_classes)))
86
87LOCAL_JACK_COVERAGE_INCLUDE_FILTER := com.android.systemui.*
88LOCAL_JACK_COVERAGE_EXCLUDE_FILTER := com.android.systemui.tests.*,$(jacoco_exclude)
89
90include frameworks/base/packages/SettingsLib/common.mk
91
92include $(BUILD_PACKAGE)
93
94# Reset variables
95local_java_files :=
96local_classes :=
97local_comma :=
98local_space :=
99jacoco_exclude :=
100