Add shared uid app install test to cts.

This host test uses hosttestlib to verify that an apk which declares
a shared user id fails to install if its signed with a different certificate
than an existing app that declares the same shared userid.

Included in this CL are:
 - InstallTests.java, which is the test itself
 - two empty test apps that declare the same user id
 - two test certificates

The change to actually include this test in the CTS distribution will be
forthcoming in a separate CL, once b/1781345 is implemented.

For now, the test can be run via the 'runtest cts-appinstall' command.
diff --git a/tests/install-tests/Android.mk b/tests/install-tests/Android.mk
new file mode 100644
index 0000000..f7af0e1
--- /dev/null
+++ b/tests/install-tests/Android.mk
@@ -0,0 +1,32 @@
+# Copyright (C) 2009 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.
+
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+
+#LOCAL_TEST_TYPE := hostSideOnly
+
+# Only compile source java files in this apk.
+LOCAL_SRC_FILES := $(call all-java-files-under, src)
+
+LOCAL_MODULE := CtsInstallTests
+
+LOCAL_JAVA_LIBRARIES := hosttestlib ddmlib junit
+
+include $(BUILD_HOST_JAVA_LIBRARY)
+
+# Build the test APKs using their own makefiles
+include $(call all-makefiles-under,$(LOCAL_PATH))
+
diff --git a/tests/install-tests/certs/cts-testkey1.pem b/tests/install-tests/certs/cts-testkey1.pem
new file mode 100644
index 0000000..8f05b92
--- /dev/null
+++ b/tests/install-tests/certs/cts-testkey1.pem
@@ -0,0 +1,27 @@
+-----BEGIN RSA PRIVATE KEY-----
+MIIEogIBAAKCAQEAnnHPmaTDJzXEdIIjdUGLhKwpBeZ9A+9CT7cEt75bKyj3RPGl
+rblWo4E+wB/r4KN5JAWfmKb26StSnoASKAXyDRuYvdtWMzut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qi+LpVF7GYTq7wv50nspyU69Htg3CeOp1M8iOU7vnV3SSO7uArw7WV7
+3tsO5rGIneZVqDEn4bNzAoGBAIB/25zHTljE54AFCXqqdjW9v9zySZXHtcfVrA4k
+qQSwumyMJONSXcqyeUGPfKmAEUKMwv0LRMepcmGyWi+bwWcv1ObemoubMt4YMvRB
+6/x4ZdBTd1wYIHdVzqJSNaJE3ibtKH48FG9LJKMdg7Z2y5R6hLRmhOO315wt0SIc
+ICl/AoGARDZBKJkl0XY2tHw4iQq5zV6JbwnhpkDw8T2vlYF2l+BGx8eCFA/3wcWk
+IWjanaYqU8vUrd4A+z6PB9Ejmpgf+/z0FGtt3N3D6yvH6Sp9BusKFE7aUMxqaP/r
+DfyficqcxhkFu2LUXK3et3aFnQmx+6e4shY+FSZbKUXhrcKGWfg=
+-----END RSA PRIVATE KEY-----
diff --git a/tests/install-tests/certs/cts-testkey1.pk8 b/tests/install-tests/certs/cts-testkey1.pk8
new file mode 100644
index 0000000..fbd687c
--- /dev/null
+++ b/tests/install-tests/certs/cts-testkey1.pk8
Binary files differ
diff --git a/tests/install-tests/certs/cts-testkey1.x509.pem b/tests/install-tests/certs/cts-testkey1.x509.pem
new file mode 100644
index 0000000..0f92bd3
--- /dev/null
+++ b/tests/install-tests/certs/cts-testkey1.x509.pem
@@ -0,0 +1,27 @@
+-----BEGIN CERTIFICATE-----
+MIIEqDCCA5CgAwIBAgIJAL5Z3LPWTOU0MA0GCSqGSIb3DQEBBQUAMIGUMQswCQYD
+VQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNTW91bnRhaW4g
+VmlldzEQMA4GA1UEChMHQW5kcm9pZDEQMA4GA1UECxMHQW5kcm9pZDEQMA4GA1UE
+AxMHQW5kcm9pZDEiMCAGCSqGSIb3DQEJARYTYW5kcm9pZEBhbmRyb2lkLmNvbTAe
+Fw0wOTA2MDcyMjM4MjJaFw0zNjEwMjMyMjM4MjJaMIGUMQswCQYDVQQGEw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5cMC0QWrs3nTvlEzj1Kwr6WtO6xLaWHccf3ktc8Wb6DdQzKb
+FHjy55L0CfblJRHvdQC6ZjfNATaYGVqMF75MZNxX+n/uRxcM/76vmB+UkfBFfEjB
+Bukytfg1oihw1IBjlhfQUeWk//XpCgkZEjJzmUkcV2N9TLyVKxWAnng2J1j+f4E8
+YETsMgYsBBPLM8c8u6NxMBUrpFUb8WStf8lOuR3/VrBdx+Kcf/vK7Wndh/s=
+-----END CERTIFICATE-----
diff --git a/tests/install-tests/certs/cts-testkey2.pem b/tests/install-tests/certs/cts-testkey2.pem
new file mode 100644
index 0000000..e8df904
--- /dev/null
+++ b/tests/install-tests/certs/cts-testkey2.pem
@@ -0,0 +1,27 @@
+-----BEGIN RSA PRIVATE KEY-----
+MIIEogIBAAKCAQEAsXJwi/6BSmmrmZR2hWYYDh2FPmUNnX6but1Mda+q016k5E+O
+tRjCop/h+76uBthjlyxByjoxbu2IXtORVyEjPaZTyKlm2+rdZsZ/QKJ457MGHaeJ
+FrhO7vERusfWZXO5jCm0KLPUmLiO1cw5Rm7JewnUneHT26kJ4qs0eU1UPzp0ch/p
+/ZRR/vODdFhygW3yJdn7ejotH/TcFS1x2LjXbJKPYSwLOS+9TdVSwVsyyo6adk2w
+GQAer6hy53XVdaJB0nhjKCt3JhkjQD/CnEJ2AR2FqTSNw0b0Qk40GLeehF2BvNAo
+RIV9te8xRfX6Bbwgq4IQng361M4oZY7t13sG+wIBAwKCAQB2TEsH/wDcRnJmYvmu
+RBAJaQN+7gkTqb0nPjL5H8c3lG3til8jZdcXFUFSfx6vOu0PctaG0XZJ87A/N7Y6
+Fhd+buKFxkSSnJOZ2aorFvtFIgQTxQYPJYn0oLZ8hTmY99EIG81wd+MQewnj3XuE
+SdunW+MT6+KScLFBx3hQ3jgqJds06AoHS1n9m8XYRTUAjq1FV+G9VTMh8/dl0hP1
+Bfikc3CwBkbt72b3JnQ7BFsOsUu3++/r9YOKygp1x1a/PhZKUnaEmM7Or9Jiv81+
+XjltXhO/0xAVtwHi5DvZRftQXWNOAr+NlOkkFzme4N+8S+gHLJCnyzhGm8aBUjCN
+dfz7AoGBAOblU7SNlb+HWpi+yQIsmzUws748HnDIsDNVxTdddPCS5gAsQKjrS4jk
+w4lHkMp59SJxQcrydu5psfCIT3zbN6EReeCKzdU1GXfnMt26TCC9Dy+TKLwN7y98
+Q9BM5Yp1sAr9W+m/jc4kLf+PejfNn446xMXWxIjufC0vRZTMW1W/AoGBAMS9cCZl
+DYt7L0HxJ6DT/LkNImqiG++kVrWmrRyLuvHi/2Ys4ffo/Rn2WBshQ9+6j4ZxEf1E
+mOr1x3Kue1Z7jX9RgtDWeGu69+/E7TCkaP8gATh2TzmUxUHxtAoF6RsWIWHKcB8w
+mFHbnltIKnKdqrZl+nHLmJ18aFF0ThA27rXFAoGBAJnuN82zuSpaPGXUhgFzEiN1
+zSl9aaCFyszj2M+To0sMmVVy1cXyMltDLQYvtdxRThb2K9yhpJ7xIUsFilM8z8C2
+UUBciTjOEPqaIekm3WsotMpiGygJSh+oLTWImQb5IAdTkpvVCTQYHqpfps/eal7R
+2IPkgwX0UsjKLmMy545/AoGBAIMo9W7uCQendNagxRXiqHteFvHBZ/UYOc5vHhMH
+0faXVO7IlqVF/hFO5WdrgpUnClmgtqjYZfH5L6HJp479CP+LrIs5pZ0nT/Ut83XC
+8KoVViWkNNEN2NahIrFZRhIOwOvcSr91uuE9FDzaxvcTxyRD/EvdEGj9muD4NArP
+Sc6DAoGASY34wDPp2mKkAzKiRaxN+H7tmPKbc2ud1ynUQyrys/atDiO+RdOuBzL3
+lBln2iYRzqir/q5HeUnSmckM2V8KlWPKlgZh0Conkcm8b1SZu+330cbvdt4pRlvJ
+DVpX//8WhofSZgkgeWXPJsoNWQRRChtDi/DL9gwJtgyYKF0avbA=
+-----END RSA PRIVATE KEY-----
diff --git a/tests/install-tests/certs/cts-testkey2.pk8 b/tests/install-tests/certs/cts-testkey2.pk8
new file mode 100644
index 0000000..ea4dbe1
--- /dev/null
+++ b/tests/install-tests/certs/cts-testkey2.pk8
Binary files differ
diff --git a/tests/install-tests/certs/cts-testkey2.x509.pem b/tests/install-tests/certs/cts-testkey2.x509.pem
new file mode 100644
index 0000000..92fd22e
--- /dev/null
+++ b/tests/install-tests/certs/cts-testkey2.x509.pem
@@ -0,0 +1,27 @@
+-----BEGIN CERTIFICATE-----
+MIIEqDCCA5CgAwIBAgIJAPveo+UHsXEGMA0GCSqGSIb3DQEBBQUAMIGUMQswCQYD
+VQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNTW91bnRhaW4g
+VmlldzEQMA4GA1UEChMHQW5kcm9pZDEQMA4GA1UECxMHQW5kcm9pZDEQMA4GA1UE
+AxMHQW5kcm9pZDEiMCAGCSqGSIb3DQEJARYTYW5kcm9pZEBhbmRyb2lkLmNvbTAe
+Fw0wOTA2MDcyMjM4MzhaFw0zNjEwMjMyMjM4MzhaMIGUMQswCQYDVQQGEwJVUzET
+MBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNTW91bnRhaW4gVmlldzEQMA4G
+A1UEChMHQW5kcm9pZDEQMA4GA1UECxMHQW5kcm9pZDEQMA4GA1UEAxMHQW5kcm9p
+ZDEiMCAGCSqGSIb3DQEJARYTYW5kcm9pZEBhbmRyb2lkLmNvbTCCASAwDQYJKoZI
+hvcNAQEBBQADggENADCCAQgCggEBALFycIv+gUppq5mUdoVmGA4dhT5lDZ1+m7rd
+THWvqtNepORPjrUYwqKf4fu+rgbYY5csQco6MW7tiF7TkVchIz2mU8ipZtvq3WbG
+f0CieOezBh2niRa4Tu7xEbrH1mVzuYwptCiz1Ji4jtXMOUZuyXsJ1J3h09upCeKr
+NHlNVD86dHIf6f2UUf7zg3RYcoFt8iXZ+3o6LR/03BUtcdi412ySj2EsCzkvvU3V
+UsFbMsqOmnZNsBkAHq+ocud11XWiQdJ4YygrdyYZI0A/wpxCdgEdhak0jcNG9EJO
+NBi3noRdgbzQKESFfbXvMUX1+gW8IKuCEJ4N+tTOKGWO7dd7BvsCAQOjgfwwgfkw
+HQYDVR0OBBYEFIhpyGfvtlBC1e6r0/Shq26/wCGwMIHJBgNVHSMEgcEwgb6AFIhp
+yGfvtlBC1e6r0/Shq26/wCGwoYGapIGXMIGUMQswCQYDVQQGEwJVUzETMBEGA1UE
+CBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNTW91bnRhaW4gVmlldzEQMA4GA1UEChMH
+QW5kcm9pZDEQMA4GA1UECxMHQW5kcm9pZDEQMA4GA1UEAxMHQW5kcm9pZDEiMCAG
+CSqGSIb3DQEJARYTYW5kcm9pZEBhbmRyb2lkLmNvbYIJAPveo+UHsXEGMAwGA1Ud
+EwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADggEBADZhBj/1U0Km1ohk5K80VKRGgiSI
+O8V9oGt2o9/p9vg+v1COWM9UsFUmpn1Uo+smRcBOL9emHSasWAE1LeKO7QRss2EF
+ZwLN3L0bii7DePP7BnRLWgDW5UIP/j8tVVacXKMNUBfqGnAcCLdhqMVapvROhPLy
+SecqwHyj2Eu6dxXEhI0B5IX42C27EUmkh/vJ+YMyCutnWZl92AE3NmF3etcYwwhO
+JditxFv6ObGyZzDosFPW2KtKNVW8dcaSByOwp7BWZW/9dQ+6g/4FLP090yfx6+UA
+LaTnXvOpe+S544xjfqJf9w42iB2taDBQ052wjgL+XV4EccbqWWaTOV2i8zs=
+-----END CERTIFICATE-----
diff --git a/tests/install-tests/src/com/android/cts/install/InstallTests.java b/tests/install-tests/src/com/android/cts/install/InstallTests.java
new file mode 100644
index 0000000..189a693
--- /dev/null
+++ b/tests/install-tests/src/com/android/cts/install/InstallTests.java
@@ -0,0 +1,79 @@
+/*
+ * Copyright (C) 2009 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.cts.install;
+
+import java.io.File;
+import java.io.IOException;
+
+import junit.framework.Test;
+
+import com.android.ddmlib.Log;
+import com.android.hosttest.DeviceTestCase;
+import com.android.hosttest.DeviceTestSuite;
+
+/**
+ * Set of tests that verify install results when installing different apps
+ */
+public class InstallTests extends DeviceTestCase {
+
+    private static final String SHARED_UI_APK = "SharedUidInstall.apk";
+    private static final String SHARED_UI_PKG = "com.android.cts.shareuidinstall";
+    private static final String SHARED_UI_DIFF_CERT_APK = "SharedUidInstallDiffCert.apk";
+    private static final String SHARED_UI_DIFF_CERT_PKG =
+        "com.android.cts.shareuidinstalldiffcert";
+
+    private static final String LOG_TAG = "InstallTests";
+
+    @Override
+    protected void setUp() throws Exception {
+        super.setUp();
+        // ensure apk path has been set before test is run
+        assertNotNull(getTestAppPath());
+        // clean up files from any previous partial test run
+        getDevice().uninstallPackage(SHARED_UI_PKG);
+        getDevice().uninstallPackage(SHARED_UI_DIFF_CERT_PKG);
+    }
+
+    /**
+     * Test that an apps that declares the same shared uid as an existing app, cannot be installed
+     * if it is signed with a different certificate
+     */
+    public void testSharedUidDifferentCerts() throws IOException {
+        Log.i(LOG_TAG, "installing apks with shared uid, but different certs");
+        try {
+            String sharedAppPath = String.format("%s%s%s", getTestAppPath(), File.separator,
+                    SHARED_UI_APK);
+            String sharedDiffPath = String.format("%s%s%s", getTestAppPath(), File.separator,
+                    SHARED_UI_DIFF_CERT_APK);
+
+            assertNull("failed to install shared uid app",
+                    getDevice().installPackage(sharedAppPath, false));
+            String installResult = getDevice().installPackage(sharedDiffPath, false);
+            assertNotNull("shared uid app with different cert than existing app installed " +
+                    "successfully", installResult);
+            assertEquals("INSTALL_FAILED_UPDATE_INCOMPATIBLE", installResult);
+        }
+        finally {
+            getDevice().uninstallPackage(SHARED_UI_PKG);
+            getDevice().uninstallPackage(SHARED_UI_DIFF_CERT_PKG);
+        }
+    }
+
+    public static Test suite() {
+        return new DeviceTestSuite(InstallTests.class);
+    }
+}
diff --git a/tests/install-tests/test-apps/Android.mk b/tests/install-tests/test-apps/Android.mk
new file mode 100644
index 0000000..f6091e4
--- /dev/null
+++ b/tests/install-tests/test-apps/Android.mk
@@ -0,0 +1,21 @@
+# Copyright (C) 2009 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.
+
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+
+# Build the test APKs using their own makefiles
+include $(call all-makefiles-under,$(LOCAL_PATH))
+
diff --git a/tests/install-tests/test-apps/SharedUidInstall/Android.mk b/tests/install-tests/test-apps/SharedUidInstall/Android.mk
new file mode 100644
index 0000000..c3774ed
--- /dev/null
+++ b/tests/install-tests/test-apps/SharedUidInstall/Android.mk
@@ -0,0 +1,30 @@
+# Copyright (C) 2009 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.
+
+LOCAL_PATH:= $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE_TAGS := tests
+
+LOCAL_SRC_FILES := $(call all-java-files-under, src)
+
+LOCAL_SDK_VERSION := current
+
+LOCAL_PACKAGE_NAME := SharedUidInstall
+
+# sign this app with a different cert than SharedUidInstallDiffCert
+LOCAL_CERTIFICATE := cts/tests/install-tests/certs/cts-testkey1
+
+include $(BUILD_PACKAGE)
diff --git a/tests/install-tests/test-apps/SharedUidInstall/AndroidManifest.xml b/tests/install-tests/test-apps/SharedUidInstall/AndroidManifest.xml
new file mode 100644
index 0000000..b9e58e9
--- /dev/null
+++ b/tests/install-tests/test-apps/SharedUidInstall/AndroidManifest.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2009 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.cts.shareuidinstall"
+       android:sharedUserId="com.android.cts.shareduid">
+
+</manifest>
diff --git a/tests/install-tests/test-apps/SharedUidInstall/src/com/android/cts/shareduidinstall/SharedUidActivity.java b/tests/install-tests/test-apps/SharedUidInstall/src/com/android/cts/shareduidinstall/SharedUidActivity.java
new file mode 100644
index 0000000..2309348
--- /dev/null
+++ b/tests/install-tests/test-apps/SharedUidInstall/src/com/android/cts/shareduidinstall/SharedUidActivity.java
@@ -0,0 +1,25 @@
+/*
+ * Copyright (C) 2009 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.cts.shareduidinstallapp;
+
+import android.app.Activity;
+
+/**
+ * Empty activity, not needed for this test
+ */
+public class SharedUidActivity extends Activity {
+
+}
diff --git a/tests/install-tests/test-apps/SharedUidInstallDiffCert/Android.mk b/tests/install-tests/test-apps/SharedUidInstallDiffCert/Android.mk
new file mode 100644
index 0000000..a4b8234
--- /dev/null
+++ b/tests/install-tests/test-apps/SharedUidInstallDiffCert/Android.mk
@@ -0,0 +1,30 @@
+# Copyright (C) 2009 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.
+
+LOCAL_PATH:= $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE_TAGS := tests
+
+LOCAL_SRC_FILES := $(call all-java-files-under, src)
+
+LOCAL_SDK_VERSION := current
+
+LOCAL_PACKAGE_NAME := SharedUidInstallDiffCert
+
+# sign this app with a different cert than SharedUidInstall
+LOCAL_CERTIFICATE := cts/tests/install-tests/certs/cts-testkey2
+
+include $(BUILD_PACKAGE)
diff --git a/tests/install-tests/test-apps/SharedUidInstallDiffCert/AndroidManifest.xml b/tests/install-tests/test-apps/SharedUidInstallDiffCert/AndroidManifest.xml
new file mode 100644
index 0000000..f9a8859
--- /dev/null
+++ b/tests/install-tests/test-apps/SharedUidInstallDiffCert/AndroidManifest.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2009 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.cts.shareuidinstalldiffcert"
+       android:sharedUserId="com.android.cts.shareduid">
+
+    <!--
+    This app defines same sharedUserId as shareduidinstall app,
+    but will fail to install, since its signed with different cert
+    -->
+
+</manifest>
diff --git a/tests/install-tests/test-apps/SharedUidInstallDiffCert/src/com/android/cts/shareduidinstalldiffcert/SharedUidActivity.java b/tests/install-tests/test-apps/SharedUidInstallDiffCert/src/com/android/cts/shareduidinstalldiffcert/SharedUidActivity.java
new file mode 100644
index 0000000..2309348
--- /dev/null
+++ b/tests/install-tests/test-apps/SharedUidInstallDiffCert/src/com/android/cts/shareduidinstalldiffcert/SharedUidActivity.java
@@ -0,0 +1,25 @@
+/*
+ * Copyright (C) 2009 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.cts.shareduidinstallapp;
+
+import android.app.Activity;
+
+/**
+ * Empty activity, not needed for this test
+ */
+public class SharedUidActivity extends Activity {
+
+}