diff options
| -rw-r--r-- | core/tests/overlaytests/device/AndroidManifest.xml | 29 | ||||
| -rw-r--r-- | core/tests/overlaytests/device/OverlayAppFiltered/Android.mk (renamed from core/tests/overlaytests/OverlayAppFiltered/Android.mk) | 0 | ||||
| -rw-r--r-- | core/tests/overlaytests/device/OverlayAppFiltered/AndroidManifest.xml (renamed from core/tests/overlaytests/OverlayAppFiltered/AndroidManifest.xml) | 0 | ||||
| -rw-r--r-- | core/tests/overlaytests/device/OverlayAppFiltered/res/raw/lorem_ipsum.txt (renamed from core/tests/overlaytests/OverlayAppFiltered/res/raw/lorem_ipsum.txt) | 0 | ||||
| -rw-r--r-- | core/tests/overlaytests/device/OverlayAppFiltered/res/values/config.xml (renamed from core/tests/overlaytests/OverlayAppFiltered/res/values/config.xml) | 0 | ||||
| -rw-r--r-- | core/tests/overlaytests/device/OverlayAppFiltered/res/xml/integer.xml (renamed from core/tests/overlaytests/OverlayAppFiltered/res/xml/integer.xml) | 0 | ||||
| -rw-r--r-- | core/tests/overlaytests/device/OverlayAppFirst/Android.mk (renamed from core/tests/overlaytests/OverlayAppFirst/Android.mk) | 0 | ||||
| -rw-r--r-- | core/tests/overlaytests/device/OverlayAppFirst/AndroidManifest.xml (renamed from core/tests/overlaytests/OverlayAppFirst/AndroidManifest.xml) | 0 | ||||
| -rw-r--r-- | core/tests/overlaytests/device/OverlayAppFirst/res/drawable-nodpi/drawable.jpg (renamed from core/tests/overlaytests/OverlayAppFirst/res/drawable-nodpi/drawable.jpg) | bin | 399 -> 399 bytes | |||
| -rw-r--r-- | core/tests/overlaytests/device/OverlayAppFirst/res/raw/lorem_ipsum.txt (renamed from core/tests/overlaytests/OverlayAppFirst/res/raw/lorem_ipsum.txt) | 0 | ||||
| -rw-r--r-- | core/tests/overlaytests/device/OverlayAppFirst/res/values-sv/config.xml (renamed from core/tests/overlaytests/OverlayAppFirst/res/values-sv/config.xml) | 0 | ||||
| -rw-r--r-- | core/tests/overlaytests/device/OverlayAppFirst/res/values/config.xml (renamed from core/tests/overlaytests/OverlayAppFirst/res/values/config.xml) | 0 | ||||
| -rw-r--r-- | core/tests/overlaytests/device/OverlayAppFirst/res/xml/integer.xml (renamed from core/tests/overlaytests/OverlayAppFirst/res/xml/integer.xml) | 0 | ||||
| -rw-r--r-- | core/tests/overlaytests/device/OverlayAppSecond/Android.mk (renamed from core/tests/overlaytests/OverlayAppSecond/Android.mk) | 0 | ||||
| -rw-r--r-- | core/tests/overlaytests/device/OverlayAppSecond/AndroidManifest.xml (renamed from core/tests/overlaytests/OverlayAppSecond/AndroidManifest.xml) | 0 | ||||
| -rw-r--r-- | core/tests/overlaytests/device/OverlayAppSecond/res/raw/lorem_ipsum.txt (renamed from core/tests/overlaytests/OverlayAppSecond/res/raw/lorem_ipsum.txt) | 0 | ||||
| -rw-r--r-- | core/tests/overlaytests/device/OverlayAppSecond/res/values-sv/config.xml (renamed from core/tests/overlaytests/OverlayAppSecond/res/values-sv/config.xml) | 0 | ||||
| -rw-r--r-- | core/tests/overlaytests/device/OverlayAppSecond/res/values/config.xml (renamed from core/tests/overlaytests/OverlayAppSecond/res/values/config.xml) | 0 | ||||
| -rw-r--r-- | core/tests/overlaytests/device/OverlayAppSecond/res/xml/integer.xml (renamed from core/tests/overlaytests/OverlayAppSecond/res/xml/integer.xml) | 0 | ||||
| -rw-r--r-- | core/tests/overlaytests/device/OverlayTest/Android.mk (renamed from core/tests/overlaytests/OverlayTest/Android.mk) | 0 | ||||
| -rw-r--r-- | core/tests/overlaytests/device/OverlayTest/AndroidManifest.xml (renamed from core/tests/overlaytests/OverlayTest/AndroidManifest.xml) | 0 | ||||
| -rw-r--r-- | core/tests/overlaytests/device/OverlayTest/res/drawable-nodpi/drawable.jpg (renamed from core/tests/overlaytests/OverlayTest/res/drawable-nodpi/drawable.jpg) | bin | 414 -> 414 bytes | |||
| -rw-r--r-- | core/tests/overlaytests/device/OverlayTest/res/raw/lorem_ipsum.txt (renamed from core/tests/overlaytests/OverlayTest/res/raw/lorem_ipsum.txt) | 0 | ||||
| -rw-r--r-- | core/tests/overlaytests/device/OverlayTest/res/values-sv/config.xml (renamed from core/tests/overlaytests/OverlayTest/res/values-sv/config.xml) | 0 | ||||
| -rw-r--r-- | core/tests/overlaytests/device/OverlayTest/res/values/config.xml (renamed from core/tests/overlaytests/OverlayTest/res/values/config.xml) | 0 | ||||
| -rw-r--r-- | core/tests/overlaytests/device/OverlayTest/res/xml/integer.xml (renamed from core/tests/overlaytests/OverlayTest/res/xml/integer.xml) | 0 | ||||
| -rw-r--r-- | core/tests/overlaytests/device/OverlayTest/src/com/android/overlaytest/OverlayBaseTest.java (renamed from core/tests/overlaytests/OverlayTest/src/com/android/overlaytest/OverlayBaseTest.java) | 0 | ||||
| -rw-r--r-- | core/tests/overlaytests/device/OverlayTest/src/com/android/overlaytest/WithMultipleOverlaysTest.java (renamed from core/tests/overlaytests/OverlayTest/src/com/android/overlaytest/WithMultipleOverlaysTest.java) | 0 | ||||
| -rw-r--r-- | core/tests/overlaytests/device/OverlayTest/src/com/android/overlaytest/WithOverlayTest.java (renamed from core/tests/overlaytests/OverlayTest/src/com/android/overlaytest/WithOverlayTest.java) | 0 | ||||
| -rw-r--r-- | core/tests/overlaytests/device/OverlayTest/src/com/android/overlaytest/WithoutOverlayTest.java (renamed from core/tests/overlaytests/OverlayTest/src/com/android/overlaytest/WithoutOverlayTest.java) | 0 | ||||
| -rw-r--r-- | core/tests/overlaytests/device/OverlayTestOverlay/Android.mk (renamed from core/tests/overlaytests/OverlayTestOverlay/Android.mk) | 0 | ||||
| -rw-r--r-- | core/tests/overlaytests/device/OverlayTestOverlay/AndroidManifest.xml (renamed from core/tests/overlaytests/OverlayTestOverlay/AndroidManifest.xml) | 0 | ||||
| -rw-r--r-- | core/tests/overlaytests/device/OverlayTestOverlay/res/values/config.xml (renamed from core/tests/overlaytests/OverlayTestOverlay/res/values/config.xml) | 0 | ||||
| -rw-r--r-- | core/tests/overlaytests/host/Android.mk | 32 | ||||
| -rw-r--r-- | core/tests/overlaytests/host/AndroidTest.xml | 24 | ||||
| -rw-r--r-- | core/tests/overlaytests/host/src/com/android/server/om/hosttest/InstallOverlayTests.java | 78 | ||||
| -rw-r--r-- | core/tests/overlaytests/host/test-apps/Android.mk | 16 | ||||
| -rw-r--r-- | core/tests/overlaytests/host/test-apps/SignatureOverlay/Android.mk | 52 | ||||
| -rw-r--r-- | core/tests/overlaytests/host/test-apps/SignatureOverlay/AndroidManifest.xml | 20 | ||||
| -rw-r--r-- | core/tests/overlaytests/host/test-apps/SignatureOverlay/src/dummy | 0 | ||||
| -rw-r--r-- | core/tests/overlaytests/host/test-apps/SignatureOverlay/static/AndroidManifest.xml | 20 | ||||
| -rw-r--r-- | services/core/java/com/android/server/om/OverlayManagerServiceImpl.java | 13 | ||||
| -rw-r--r-- | services/core/java/com/android/server/om/OverlayManagerSettings.java | 2 |
43 files changed, 284 insertions, 2 deletions
diff --git a/core/tests/overlaytests/device/AndroidManifest.xml b/core/tests/overlaytests/device/AndroidManifest.xml new file mode 100644 index 000000000000..e01caeedd862 --- /dev/null +++ b/core/tests/overlaytests/device/AndroidManifest.xml @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2018 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.server.om.test"> + + <uses-sdk android:minSdkVersion="21" /> + + <application> + <uses-library android:name="android.test.runner" /> + </application> + + <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner" + android:targetPackage="com.android.server.om.test" /> + +</manifest> diff --git a/core/tests/overlaytests/OverlayAppFiltered/Android.mk b/core/tests/overlaytests/device/OverlayAppFiltered/Android.mk index f76de7a93b2e..f76de7a93b2e 100644 --- a/core/tests/overlaytests/OverlayAppFiltered/Android.mk +++ b/core/tests/overlaytests/device/OverlayAppFiltered/Android.mk diff --git a/core/tests/overlaytests/OverlayAppFiltered/AndroidManifest.xml b/core/tests/overlaytests/device/OverlayAppFiltered/AndroidManifest.xml index 5b7950a25fbf..5b7950a25fbf 100644 --- a/core/tests/overlaytests/OverlayAppFiltered/AndroidManifest.xml +++ b/core/tests/overlaytests/device/OverlayAppFiltered/AndroidManifest.xml diff --git a/core/tests/overlaytests/OverlayAppFiltered/res/raw/lorem_ipsum.txt b/core/tests/overlaytests/device/OverlayAppFiltered/res/raw/lorem_ipsum.txt index 0954cedeb5d5..0954cedeb5d5 100644 --- a/core/tests/overlaytests/OverlayAppFiltered/res/raw/lorem_ipsum.txt +++ b/core/tests/overlaytests/device/OverlayAppFiltered/res/raw/lorem_ipsum.txt diff --git a/core/tests/overlaytests/OverlayAppFiltered/res/values/config.xml b/core/tests/overlaytests/device/OverlayAppFiltered/res/values/config.xml index 60b94eec5994..60b94eec5994 100644 --- a/core/tests/overlaytests/OverlayAppFiltered/res/values/config.xml +++ b/core/tests/overlaytests/device/OverlayAppFiltered/res/values/config.xml diff --git a/core/tests/overlaytests/OverlayAppFiltered/res/xml/integer.xml b/core/tests/overlaytests/device/OverlayAppFiltered/res/xml/integer.xml index e2652b7e2915..e2652b7e2915 100644 --- a/core/tests/overlaytests/OverlayAppFiltered/res/xml/integer.xml +++ b/core/tests/overlaytests/device/OverlayAppFiltered/res/xml/integer.xml diff --git a/core/tests/overlaytests/OverlayAppFirst/Android.mk b/core/tests/overlaytests/device/OverlayAppFirst/Android.mk index bf9416c279be..bf9416c279be 100644 --- a/core/tests/overlaytests/OverlayAppFirst/Android.mk +++ b/core/tests/overlaytests/device/OverlayAppFirst/Android.mk diff --git a/core/tests/overlaytests/OverlayAppFirst/AndroidManifest.xml b/core/tests/overlaytests/device/OverlayAppFirst/AndroidManifest.xml index ec10bbcf752e..ec10bbcf752e 100644 --- a/core/tests/overlaytests/OverlayAppFirst/AndroidManifest.xml +++ b/core/tests/overlaytests/device/OverlayAppFirst/AndroidManifest.xml diff --git a/core/tests/overlaytests/OverlayAppFirst/res/drawable-nodpi/drawable.jpg b/core/tests/overlaytests/device/OverlayAppFirst/res/drawable-nodpi/drawable.jpg Binary files differindex 0d944d02d633..0d944d02d633 100644 --- a/core/tests/overlaytests/OverlayAppFirst/res/drawable-nodpi/drawable.jpg +++ b/core/tests/overlaytests/device/OverlayAppFirst/res/drawable-nodpi/drawable.jpg diff --git a/core/tests/overlaytests/OverlayAppFirst/res/raw/lorem_ipsum.txt b/core/tests/overlaytests/device/OverlayAppFirst/res/raw/lorem_ipsum.txt index 756b0a3fc532..756b0a3fc532 100644 --- a/core/tests/overlaytests/OverlayAppFirst/res/raw/lorem_ipsum.txt +++ b/core/tests/overlaytests/device/OverlayAppFirst/res/raw/lorem_ipsum.txt diff --git a/core/tests/overlaytests/OverlayAppFirst/res/values-sv/config.xml b/core/tests/overlaytests/device/OverlayAppFirst/res/values-sv/config.xml index 9cdc73e27ade..9cdc73e27ade 100644 --- a/core/tests/overlaytests/OverlayAppFirst/res/values-sv/config.xml +++ b/core/tests/overlaytests/device/OverlayAppFirst/res/values-sv/config.xml diff --git a/core/tests/overlaytests/OverlayAppFirst/res/values/config.xml b/core/tests/overlaytests/device/OverlayAppFirst/res/values/config.xml index 972137a3d1bf..972137a3d1bf 100644 --- a/core/tests/overlaytests/OverlayAppFirst/res/values/config.xml +++ b/core/tests/overlaytests/device/OverlayAppFirst/res/values/config.xml diff --git a/core/tests/overlaytests/OverlayAppFirst/res/xml/integer.xml b/core/tests/overlaytests/device/OverlayAppFirst/res/xml/integer.xml index 7f628d9125f3..7f628d9125f3 100644 --- a/core/tests/overlaytests/OverlayAppFirst/res/xml/integer.xml +++ b/core/tests/overlaytests/device/OverlayAppFirst/res/xml/integer.xml diff --git a/core/tests/overlaytests/OverlayAppSecond/Android.mk b/core/tests/overlaytests/device/OverlayAppSecond/Android.mk index bb7d142d6809..bb7d142d6809 100644 --- a/core/tests/overlaytests/OverlayAppSecond/Android.mk +++ b/core/tests/overlaytests/device/OverlayAppSecond/Android.mk diff --git a/core/tests/overlaytests/OverlayAppSecond/AndroidManifest.xml b/core/tests/overlaytests/device/OverlayAppSecond/AndroidManifest.xml index ed498637b454..ed498637b454 100644 --- a/core/tests/overlaytests/OverlayAppSecond/AndroidManifest.xml +++ b/core/tests/overlaytests/device/OverlayAppSecond/AndroidManifest.xml diff --git a/core/tests/overlaytests/OverlayAppSecond/res/raw/lorem_ipsum.txt b/core/tests/overlaytests/device/OverlayAppSecond/res/raw/lorem_ipsum.txt index 613f5b63c66c..613f5b63c66c 100644 --- a/core/tests/overlaytests/OverlayAppSecond/res/raw/lorem_ipsum.txt +++ b/core/tests/overlaytests/device/OverlayAppSecond/res/raw/lorem_ipsum.txt diff --git a/core/tests/overlaytests/OverlayAppSecond/res/values-sv/config.xml b/core/tests/overlaytests/device/OverlayAppSecond/res/values-sv/config.xml index ec4b6c03e5ff..ec4b6c03e5ff 100644 --- a/core/tests/overlaytests/OverlayAppSecond/res/values-sv/config.xml +++ b/core/tests/overlaytests/device/OverlayAppSecond/res/values-sv/config.xml diff --git a/core/tests/overlaytests/OverlayAppSecond/res/values/config.xml b/core/tests/overlaytests/device/OverlayAppSecond/res/values/config.xml index 8b072160ffba..8b072160ffba 100644 --- a/core/tests/overlaytests/OverlayAppSecond/res/values/config.xml +++ b/core/tests/overlaytests/device/OverlayAppSecond/res/values/config.xml diff --git a/core/tests/overlaytests/OverlayAppSecond/res/xml/integer.xml b/core/tests/overlaytests/device/OverlayAppSecond/res/xml/integer.xml index f3370a6b8bcf..f3370a6b8bcf 100644 --- a/core/tests/overlaytests/OverlayAppSecond/res/xml/integer.xml +++ b/core/tests/overlaytests/device/OverlayAppSecond/res/xml/integer.xml diff --git a/core/tests/overlaytests/OverlayTest/Android.mk b/core/tests/overlaytests/device/OverlayTest/Android.mk index 5fe7b917102e..5fe7b917102e 100644 --- a/core/tests/overlaytests/OverlayTest/Android.mk +++ b/core/tests/overlaytests/device/OverlayTest/Android.mk diff --git a/core/tests/overlaytests/OverlayTest/AndroidManifest.xml b/core/tests/overlaytests/device/OverlayTest/AndroidManifest.xml index 9edba12ffa8f..9edba12ffa8f 100644 --- a/core/tests/overlaytests/OverlayTest/AndroidManifest.xml +++ b/core/tests/overlaytests/device/OverlayTest/AndroidManifest.xml diff --git a/core/tests/overlaytests/OverlayTest/res/drawable-nodpi/drawable.jpg b/core/tests/overlaytests/device/OverlayTest/res/drawable-nodpi/drawable.jpg Binary files differindex a3f14f325b85..a3f14f325b85 100644 --- a/core/tests/overlaytests/OverlayTest/res/drawable-nodpi/drawable.jpg +++ b/core/tests/overlaytests/device/OverlayTest/res/drawable-nodpi/drawable.jpg diff --git a/core/tests/overlaytests/OverlayTest/res/raw/lorem_ipsum.txt b/core/tests/overlaytests/device/OverlayTest/res/raw/lorem_ipsum.txt index cee7a927c5fa..cee7a927c5fa 100644 --- a/core/tests/overlaytests/OverlayTest/res/raw/lorem_ipsum.txt +++ b/core/tests/overlaytests/device/OverlayTest/res/raw/lorem_ipsum.txt diff --git a/core/tests/overlaytests/OverlayTest/res/values-sv/config.xml b/core/tests/overlaytests/device/OverlayTest/res/values-sv/config.xml index 891853edb4c5..891853edb4c5 100644 --- a/core/tests/overlaytests/OverlayTest/res/values-sv/config.xml +++ b/core/tests/overlaytests/device/OverlayTest/res/values-sv/config.xml diff --git a/core/tests/overlaytests/OverlayTest/res/values/config.xml b/core/tests/overlaytests/device/OverlayTest/res/values/config.xml index c692a2625199..c692a2625199 100644 --- a/core/tests/overlaytests/OverlayTest/res/values/config.xml +++ b/core/tests/overlaytests/device/OverlayTest/res/values/config.xml diff --git a/core/tests/overlaytests/OverlayTest/res/xml/integer.xml b/core/tests/overlaytests/device/OverlayTest/res/xml/integer.xml index 9383daa20b6c..9383daa20b6c 100644 --- a/core/tests/overlaytests/OverlayTest/res/xml/integer.xml +++ b/core/tests/overlaytests/device/OverlayTest/res/xml/integer.xml diff --git a/core/tests/overlaytests/OverlayTest/src/com/android/overlaytest/OverlayBaseTest.java b/core/tests/overlaytests/device/OverlayTest/src/com/android/overlaytest/OverlayBaseTest.java index e57c55ced046..e57c55ced046 100644 --- a/core/tests/overlaytests/OverlayTest/src/com/android/overlaytest/OverlayBaseTest.java +++ b/core/tests/overlaytests/device/OverlayTest/src/com/android/overlaytest/OverlayBaseTest.java diff --git a/core/tests/overlaytests/OverlayTest/src/com/android/overlaytest/WithMultipleOverlaysTest.java b/core/tests/overlaytests/device/OverlayTest/src/com/android/overlaytest/WithMultipleOverlaysTest.java index e104f5a670c1..e104f5a670c1 100644 --- a/core/tests/overlaytests/OverlayTest/src/com/android/overlaytest/WithMultipleOverlaysTest.java +++ b/core/tests/overlaytests/device/OverlayTest/src/com/android/overlaytest/WithMultipleOverlaysTest.java diff --git a/core/tests/overlaytests/OverlayTest/src/com/android/overlaytest/WithOverlayTest.java b/core/tests/overlaytests/device/OverlayTest/src/com/android/overlaytest/WithOverlayTest.java index 816a476e28cf..816a476e28cf 100644 --- a/core/tests/overlaytests/OverlayTest/src/com/android/overlaytest/WithOverlayTest.java +++ b/core/tests/overlaytests/device/OverlayTest/src/com/android/overlaytest/WithOverlayTest.java diff --git a/core/tests/overlaytests/OverlayTest/src/com/android/overlaytest/WithoutOverlayTest.java b/core/tests/overlaytests/device/OverlayTest/src/com/android/overlaytest/WithoutOverlayTest.java index 318cccc85461..318cccc85461 100644 --- a/core/tests/overlaytests/OverlayTest/src/com/android/overlaytest/WithoutOverlayTest.java +++ b/core/tests/overlaytests/device/OverlayTest/src/com/android/overlaytest/WithoutOverlayTest.java diff --git a/core/tests/overlaytests/OverlayTestOverlay/Android.mk b/core/tests/overlaytests/device/OverlayTestOverlay/Android.mk index ed330467f68a..ed330467f68a 100644 --- a/core/tests/overlaytests/OverlayTestOverlay/Android.mk +++ b/core/tests/overlaytests/device/OverlayTestOverlay/Android.mk diff --git a/core/tests/overlaytests/OverlayTestOverlay/AndroidManifest.xml b/core/tests/overlaytests/device/OverlayTestOverlay/AndroidManifest.xml index f8b6c7b888b5..f8b6c7b888b5 100644 --- a/core/tests/overlaytests/OverlayTestOverlay/AndroidManifest.xml +++ b/core/tests/overlaytests/device/OverlayTestOverlay/AndroidManifest.xml diff --git a/core/tests/overlaytests/OverlayTestOverlay/res/values/config.xml b/core/tests/overlaytests/device/OverlayTestOverlay/res/values/config.xml index c1e3de12059a..c1e3de12059a 100644 --- a/core/tests/overlaytests/OverlayTestOverlay/res/values/config.xml +++ b/core/tests/overlaytests/device/OverlayTestOverlay/res/values/config.xml diff --git a/core/tests/overlaytests/host/Android.mk b/core/tests/overlaytests/host/Android.mk new file mode 100644 index 000000000000..d8e1fc158fc1 --- /dev/null +++ b/core/tests/overlaytests/host/Android.mk @@ -0,0 +1,32 @@ +# Copyright (C) 2018 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_SRC_FILES := $(call all-java-files-under,src) +LOCAL_MODULE_TAGS := tests +LOCAL_MODULE := OverlayHostTests +LOCAL_JAVA_LIBRARIES := tradefed +LOCAL_COMPATIBILITY_SUITE := general-tests +LOCAL_TARGET_REQUIRED_MODULES := \ + OverlayHostTests_BadSignatureOverlay \ + OverlayHostTests_PlatformSignatureStaticOverlay \ + OverlayHostTests_PlatformSignatureOverlay \ + OverlayHostTests_PlatformSignatureOverlayV2 +include $(BUILD_HOST_JAVA_LIBRARY) + +# Include to build test-apps. +include $(call all-makefiles-under,$(LOCAL_PATH)) + diff --git a/core/tests/overlaytests/host/AndroidTest.xml b/core/tests/overlaytests/host/AndroidTest.xml new file mode 100644 index 000000000000..68846238c5f1 --- /dev/null +++ b/core/tests/overlaytests/host/AndroidTest.xml @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2018 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. +--> + +<configuration description="Host-driven test module config for OverlayHostTests"> + <option name="test-tag" value="OverlayHostTests" /> + <option name="test-suite-tag" value="apct" /> + + <test class="com.android.tradefed.testtype.HostTest"> + <option name="class" value="com.android.server.om.hosttest.InstallOverlayTests" /> + </test> +</configuration> diff --git a/core/tests/overlaytests/host/src/com/android/server/om/hosttest/InstallOverlayTests.java b/core/tests/overlaytests/host/src/com/android/server/om/hosttest/InstallOverlayTests.java new file mode 100644 index 000000000000..509371085055 --- /dev/null +++ b/core/tests/overlaytests/host/src/com/android/server/om/hosttest/InstallOverlayTests.java @@ -0,0 +1,78 @@ +/* + * Copyright (C) 2018 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.server.om.hosttest; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import com.android.tradefed.testtype.DeviceJUnit4ClassRunner; +import com.android.tradefed.testtype.junit4.BaseHostJUnit4Test; + +import org.junit.Test; +import org.junit.runner.RunWith; + +@RunWith(DeviceJUnit4ClassRunner.class) +public class InstallOverlayTests extends BaseHostJUnit4Test { + + private static final String OVERLAY_PACKAGE_NAME = + "com.android.server.om.hosttest.signature_overlay"; + + @Test + public void failToInstallNonPlatformSignedOverlay() throws Exception { + try { + installPackage("OverlayHostTests_BadSignatureOverlay.apk"); + fail("installed a non-platform signed overlay"); + } catch (Exception e) { + // Expected. + } + assertFalse(overlayManagerContainsPackage()); + } + + @Test + public void failToInstallPlatformSignedStaticOverlay() throws Exception { + try { + installPackage("OverlayHostTests_PlatformSignatureStaticOverlay.apk"); + fail("installed a static overlay"); + } catch (Exception e) { + // Expected. + } + assertFalse(overlayManagerContainsPackage()); + } + + @Test + public void succeedToInstallPlatformSignedOverlay() throws Exception { + installPackage("OverlayHostTests_PlatformSignatureOverlay.apk"); + assertTrue(overlayManagerContainsPackage()); + } + + @Test + public void succeedToInstallPlatformSignedOverlayAndUpdate() throws Exception { + installPackage("OverlayHostTests_PlatformSignatureOverlay.apk"); + assertTrue(overlayManagerContainsPackage()); + assertEquals("v1", getDevice().getAppPackageInfo(OVERLAY_PACKAGE_NAME).getVersionName()); + + installPackage("OverlayHostTests_PlatformSignatureOverlayV2.apk"); + assertTrue(overlayManagerContainsPackage()); + assertEquals("v2", getDevice().getAppPackageInfo(OVERLAY_PACKAGE_NAME).getVersionName()); + } + + private boolean overlayManagerContainsPackage() throws Exception { + return getDevice().executeShellCommand("cmd overlay list") + .contains(OVERLAY_PACKAGE_NAME); + } +} diff --git a/core/tests/overlaytests/host/test-apps/Android.mk b/core/tests/overlaytests/host/test-apps/Android.mk new file mode 100644 index 000000000000..5c7187ead31f --- /dev/null +++ b/core/tests/overlaytests/host/test-apps/Android.mk @@ -0,0 +1,16 @@ +# Copyright (C) 2018 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. + +include $(call all-subdir-makefiles) + diff --git a/core/tests/overlaytests/host/test-apps/SignatureOverlay/Android.mk b/core/tests/overlaytests/host/test-apps/SignatureOverlay/Android.mk new file mode 100644 index 000000000000..b051a82c29ac --- /dev/null +++ b/core/tests/overlaytests/host/test-apps/SignatureOverlay/Android.mk @@ -0,0 +1,52 @@ +# Copyright (C) 2018 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) + +my_package_prefix := com.android.server.om.hosttest.signature_overlay + +include $(CLEAR_VARS) +LOCAL_MODULE_TAGS := tests +LOCAL_PACKAGE_NAME := OverlayHostTests_BadSignatureOverlay +LOCAL_COMPATIBILITY_SUITE := general-tests +LOCAL_AAPT_FLAGS := --custom-package $(my_package_prefix)_bad +include $(BUILD_PACKAGE) + +include $(CLEAR_VARS) +LOCAL_MODULE_TAGS := tests +LOCAL_PACKAGE_NAME := OverlayHostTests_PlatformSignatureStaticOverlay +LOCAL_COMPATIBILITY_SUITE := general-tests +LOCAL_MANIFEST_FILE := static/AndroidManifest.xml +LOCAL_AAPT_FLAGS := --custom-package $(my_package_prefix)_static +include $(BUILD_PACKAGE) + +include $(CLEAR_VARS) +LOCAL_MODULE_TAGS := tests +LOCAL_PACKAGE_NAME := OverlayHostTests_PlatformSignatureOverlay +LOCAL_COMPATIBILITY_SUITE := general-tests +LOCAL_CERTIFICATE := platform +LOCAL_AAPT_FLAGS := --custom-package $(my_package_prefix)_v1 +LOCAL_AAPT_FLAGS += --version-code 1 --version-name v1 +include $(BUILD_PACKAGE) + +include $(CLEAR_VARS) +LOCAL_MODULE_TAGS := tests +LOCAL_PACKAGE_NAME := OverlayHostTests_PlatformSignatureOverlayV2 +LOCAL_COMPATIBILITY_SUITE := general-tests +LOCAL_CERTIFICATE := platform +LOCAL_AAPT_FLAGS := --custom-package $(my_package_prefix)_v2 +LOCAL_AAPT_FLAGS += --version-code 2 --version-name v2 +include $(BUILD_PACKAGE) + +my_package_prefix := diff --git a/core/tests/overlaytests/host/test-apps/SignatureOverlay/AndroidManifest.xml b/core/tests/overlaytests/host/test-apps/SignatureOverlay/AndroidManifest.xml new file mode 100644 index 000000000000..2d6843948f29 --- /dev/null +++ b/core/tests/overlaytests/host/test-apps/SignatureOverlay/AndroidManifest.xml @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2018 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.server.om.hosttest.signature_overlay"> + <overlay android:targetPackage="android" /> +</manifest> diff --git a/core/tests/overlaytests/host/test-apps/SignatureOverlay/src/dummy b/core/tests/overlaytests/host/test-apps/SignatureOverlay/src/dummy new file mode 100644 index 000000000000..e69de29bb2d1 --- /dev/null +++ b/core/tests/overlaytests/host/test-apps/SignatureOverlay/src/dummy diff --git a/core/tests/overlaytests/host/test-apps/SignatureOverlay/static/AndroidManifest.xml b/core/tests/overlaytests/host/test-apps/SignatureOverlay/static/AndroidManifest.xml new file mode 100644 index 000000000000..139dd9653b4a --- /dev/null +++ b/core/tests/overlaytests/host/test-apps/SignatureOverlay/static/AndroidManifest.xml @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2018 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.server.om.hosttest.signature_overlay"> + <overlay android:targetPackage="android" android:isStatic="true" /> +</manifest> diff --git a/services/core/java/com/android/server/om/OverlayManagerServiceImpl.java b/services/core/java/com/android/server/om/OverlayManagerServiceImpl.java index 321af43d9c3d..7600e81cd1c0 100644 --- a/services/core/java/com/android/server/om/OverlayManagerServiceImpl.java +++ b/services/core/java/com/android/server/om/OverlayManagerServiceImpl.java @@ -283,7 +283,18 @@ final class OverlayManagerServiceImpl { } void onOverlayPackageRemoved(@NonNull final String packageName, final int userId) { - Slog.wtf(TAG, "onOverlayPackageRemoved called, but only pre-installed overlays supported"); + try { + final OverlayInfo overlayInfo = mSettings.getOverlayInfo(packageName, userId); + if (mSettings.remove(packageName, userId)) { + removeIdmapIfPossible(overlayInfo); + if (overlayInfo.isEnabled()) { + // Only trigger updates if the overlay was enabled. + mListener.onOverlaysChanged(overlayInfo.targetPackageName, userId); + } + } + } catch (OverlayManagerSettings.BadKeyException e) { + Slog.e(TAG, "failed to remove overlay", e); + } } OverlayInfo getOverlayInfo(@NonNull final String packageName, final int userId) { diff --git a/services/core/java/com/android/server/om/OverlayManagerSettings.java b/services/core/java/com/android/server/om/OverlayManagerSettings.java index 7d00423a2c41..17b38deb27c1 100644 --- a/services/core/java/com/android/server/om/OverlayManagerSettings.java +++ b/services/core/java/com/android/server/om/OverlayManagerSettings.java @@ -104,7 +104,7 @@ final class OverlayManagerSettings { return true; } - OverlayInfo getOverlayInfo(@NonNull final String packageName, final int userId) + @NonNull OverlayInfo getOverlayInfo(@NonNull final String packageName, final int userId) throws BadKeyException { final int idx = select(packageName, userId); if (idx < 0) { |