Update CtsShim to use sharedUserId
For testing system apps migrating out of sharedUserId through an
upgrade, we need to have CtsShim first be a shared UID app.
This is necessary to test ag/15936308
Bug: 179284822
Test: tapas CtsShim CtsShimUpgrade; m
Change-Id: Ibcd8dba32a2e0e3ae2a7d1f5a19fac57dff8bca3
diff --git a/packages/CtsShim/build/Android.bp b/packages/CtsShim/build/Android.bp
index 0b3f9bb..68b6091 100644
--- a/packages/CtsShim/build/Android.bp
+++ b/packages/CtsShim/build/Android.bp
@@ -48,13 +48,13 @@
}
genrule {
- name: "generate_priv_manifest",
- srcs: [
- "shim_priv/AndroidManifest.xml",
- ":CtsShimPrivUpgrade"
- ],
- out: ["AndroidManifest.xml"],
- cmd: "sed -e s/__HASH__/`sha512sum -b $(location :CtsShimPrivUpgrade) | cut -d' ' -f1`/ $(location shim_priv/AndroidManifest.xml) > $(out)",
+ name: "generate_priv_manifest",
+ srcs: [
+ "shim_priv/AndroidManifest.xml",
+ ":CtsShimPrivUpgrade",
+ ],
+ out: ["AndroidManifest.xml"],
+ cmd: "sed -e s/__HASH__/`sha512sum -b $(location :CtsShimPrivUpgrade) | cut -d' ' -f1`/ $(location shim_priv/AndroidManifest.xml) > $(out)",
}
//##########################################################
@@ -141,6 +141,34 @@
}
//##########################################################
+// Variant: System app upgrade
+
+android_app {
+ name: "CtsShimUpgrade",
+
+ sdk_version: "current",
+ optimize: {
+ enabled: false,
+ },
+ dex_preopt: {
+ enabled: false,
+ },
+
+ manifest: "shim/AndroidManifestUpgrade.xml",
+ min_sdk_version: "24",
+}
+
+genrule {
+ name: "generate_shim_manifest",
+ srcs: [
+ "shim/AndroidManifest.xml",
+ ":CtsShimUpgrade",
+ ],
+ out: ["AndroidManifest.xml"],
+ cmd: "sed -e s/__HASH__/`sha512sum -b $(location :CtsShimUpgrade) | cut -d' ' -f1`/ $(location shim/AndroidManifest.xml) > $(out)",
+}
+
+//##########################################################
// Variant: System app
android_app {
@@ -154,7 +182,7 @@
enabled: false,
},
- manifest: "shim/AndroidManifest.xml",
+ manifest: ":generate_shim_manifest",
apex_available: [
"//apex_available:platform",
"com.android.apex.cts.shim.v1",
diff --git a/packages/CtsShim/build/shim/AndroidManifest.xml b/packages/CtsShim/build/shim/AndroidManifest.xml
index 1ffe56c..3b8276b6 100644
--- a/packages/CtsShim/build/shim/AndroidManifest.xml
+++ b/packages/CtsShim/build/shim/AndroidManifest.xml
@@ -17,13 +17,15 @@
<!-- Manifest for the system CTS shim -->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
- package="com.android.cts.ctsshim" >
+ package="com.android.cts.ctsshim"
+ android:sharedUserId="com.android.cts.ctsshim" >
- <uses-sdk android:minSdkVersion="24"
+ <uses-sdk
+ android:minSdkVersion="24"
android:targetSdkVersion="28" />
<restrict-update
- android:hash="__CAN_NOT_BE_UPDATED__" />
+ android:hash="__HASH__" />
<application
android:hasCode="false"
diff --git a/packages/CtsShim/build/shim/AndroidManifestUpgrade.xml b/packages/CtsShim/build/shim/AndroidManifestUpgrade.xml
new file mode 100644
index 0000000..7f3644a
--- /dev/null
+++ b/packages/CtsShim/build/shim/AndroidManifestUpgrade.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2016 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 for the system CTS shim -->
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:tools="http://schemas.android.com/tools"
+ package="com.android.cts.ctsshim" >
+
+ <uses-sdk
+ android:minSdkVersion="24"
+ android:targetSdkVersion="28" />
+
+ <application
+ android:hasCode="false"
+ tools:ignore="AllowBackup,MissingApplicationIcon" />
+</manifest>
+