summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2021-11-19 00:41:23 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2021-11-19 00:41:23 +0000
commit9052b6a2f6c21cac537a1acec4a9c4a27a8a7c66 (patch)
treeeec36c9282186f4987f317e2599973bf09c84358
parent31cb060ec588024d2890f83b6e518f16e716a75f (diff)
parentf39ed8aa21acf120a47b67097da885d2c1cf3779 (diff)
downloadMessenger-android12L-gsi.tar.gz
Snap for 7929330 from aab2bdbb820776745f178eced9f9cd61780254b7 to sc-v2-release am: f39ed8aa21android12L-gsi
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Car/Messenger/+/16301901 Change-Id: I9f88731a37291f0626aaa496f06d1153393fce9f
-rw-r--r--Android.bp69
-rw-r--r--AndroidManifest.xml7
-rw-r--r--build.gradle30
-rw-r--r--tests/Android.bp43
-rw-r--r--tests/AndroidManifest.xml30
-rw-r--r--tests/src/com/android/car/messenger/BuildTest.java33
6 files changed, 208 insertions, 4 deletions
diff --git a/Android.bp b/Android.bp
index 750a871..1d9412d 100644
--- a/Android.bp
+++ b/Android.bp
@@ -25,10 +25,69 @@ android_app {
resource_dirs: ["res"],
+ min_sdk_version: "30",
+
+ target_sdk_version: "31",
+
+ sdk_version: "system_current",
+
+ required: ["allowed_privapp_com.android.car.messenger"],
+
+ certificate: "platform",
+
+ overrides: ["messaging"],
+
+ optimize: {
+ enabled: false,
+ },
+
+ privileged: true,
+
+ libs: ["android.car-system-stubs"],
+
+ // must be unbundled dependencies
+ static_libs: [
+ "androidx-constraintlayout_constraintlayout",
+ "androidx.lifecycle_lifecycle-common-java8",
+ "androidx.lifecycle_lifecycle-extensions",
+ "androidx.legacy_legacy-support-v4",
+ "androidx.preference_preference",
+ "androidx.recyclerview_recyclerview",
+ "car-assist-lib",
+ "car-messenger-common",
+ "car-telephony-common",
+ "car-ui-lib",
+ "androidx.annotation_annotation",
+ ],
+
+ dex_preopt: {
+ enabled: false,
+ },
+
+ product_variables: {
+ pdk: {
+ enabled: false,
+ },
+ },
+}
+
+android_test_helper_app {
+ name: "CarMessengerAppForTesting",
+
+ srcs: ["src/**/*.java"],
+
+ resource_dirs: ["res"],
+
+ min_sdk_version: "30",
+
+ target_sdk_version: "31",
+
sdk_version: "system_current",
required: ["allowed_privapp_com.android.car.messenger"],
+ certificate: "platform",
+
overrides: ["messaging"],
optimize: {
@@ -63,4 +122,14 @@ android_app {
enabled: false,
},
},
+
+ // runtime cc library which is used by mockito-target-extended.
+ jni_libs: [
+ // For mockito extended
+ "libdexmakerjvmtiagent",
+ "libstaticjvmtiagent",
+ ],
+
+ // Enforce the jni libraries to be grouped into the APK file.
+ use_embedded_native_libs: true,
}
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index d48bd17..11014dd 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -16,7 +16,9 @@
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="com.android.car.messenger">
+ package="com.android.car.messenger"
+ android:versionCode="10000"
+ android:versionName="1.0.0">
<application
android:name="com.android.car.messenger.impl.CarMessengerApp"
@@ -131,7 +133,4 @@
-->
<uses-permission android:name="android.permission.READ_PRIVILEGED_PHONE_STATE" />
- <uses-sdk
- android:minSdkVersion="30"
- android:targetSdkVersion="30" />
</manifest>
diff --git a/build.gradle b/build.gradle
index b0e8bc2..88e8ced 100644
--- a/build.gradle
+++ b/build.gradle
@@ -44,6 +44,29 @@ android {
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
}
+
+ androidTest {
+ java.srcDirs = ['tests/src']
+ setRoot('tests')
+ }
+ }
+
+ testOptions {
+ animationsDisabled = true
+ }
+
+ buildTypes {
+ debug {
+ testCoverageEnabled = true
+ }
+ }
+
+ signingConfigs {
+ debug {
+ // The following signs the apk with platform key.
+ storeFile file('../../../../vendor/google/certs/devkeys/platform.keystore')
+ storePassword 'android'
+ }
}
}
@@ -65,4 +88,11 @@ dependencies {
implementation project(":car-messenger-common:model")
implementation project(":car-telephony-common")
implementation project(":car-ui-lib")
+
+ androidTestImplementation 'androidx.test.ext:junit:1.1.3'
+ androidTestImplementation 'androidx.test:core:1.4.0'
+ androidTestImplementation 'androidx.test:rules:1.4.0'
+ androidTestImplementation 'androidx.test:runner:1.4.0'
+ androidTestImplementation 'com.google.truth:truth:1.1.3'
+ androidTestImplementation 'com.linkedin.dexmaker:dexmaker-mockito-inline:2.28.1'
}
diff --git a/tests/Android.bp b/tests/Android.bp
new file mode 100644
index 0000000..8dac782
--- /dev/null
+++ b/tests/Android.bp
@@ -0,0 +1,43 @@
+//
+// Copyright (C) 2021 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+package {
+ default_applicable_licenses: ["Android-Apache-2.0"],
+}
+
+android_test {
+ name: "CarMessengerUnitTests",
+
+ min_sdk_version: "30",
+
+ target_sdk_version: "31",
+
+ srcs: ["src/**/*.java"],
+
+ libs: ["android.car-system-stubs"],
+
+ static_libs: [
+ "androidx.test.core",
+ "androidx.test.rules",
+ "androidx.test.runner",
+ "androidx.test.ext.junit",
+ "androidx.test.ext.truth",
+ "mockito-target-extended-minus-junit4",
+ "truth-prebuilt",
+ ],
+
+ instrumentation_for: "CarMessengerAppForTesting",
+}
diff --git a/tests/AndroidManifest.xml b/tests/AndroidManifest.xml
new file mode 100644
index 0000000..e59c7c4
--- /dev/null
+++ b/tests/AndroidManifest.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ Copyright (C) 2021 The Android Open Source Project
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ -->
+
+<manifest
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.android.car.messenger.unittests">
+
+ <application android:testOnly="false"
+ android:debuggable="true">
+ <uses-library android:name="android.test.runner" />
+ </application>
+
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
+ android:targetPackage="com.android.car.messenger"
+ android:label="Car Messenger Unit Tests" />
+</manifest>
diff --git a/tests/src/com/android/car/messenger/BuildTest.java b/tests/src/com/android/car/messenger/BuildTest.java
new file mode 100644
index 0000000..3d35ddb
--- /dev/null
+++ b/tests/src/com/android/car/messenger/BuildTest.java
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.car.messenger;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import androidx.test.ext.junit.runners.AndroidJUnit4;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+@RunWith(AndroidJUnit4.class)
+public class BuildTest {
+
+ @Test
+ public void test() {
+ assertThat(true).isEqualTo(true);
+ }
+}