From fa2ae1ad1ad2f6c905a9de713038338a24d9ae7c Mon Sep 17 00:00:00 2001 From: Kenny Root Date: Mon, 31 Jan 2011 16:25:25 -0800 Subject: Do not check features in PackageManagerService DO NOT MERGE PackageManagerService shouldn't check features that a package declares that it uses because this will cause problems in the future when we add more features that older phones didn't explicitly declare. We must rely on markets to know about phones and filter them for us to avoid this situation. Bug: 3409434 Change-Id: I0d51b2de33d8110edc6824af4b5b8c901f96077f --- .../coretests/apks/install_uses_feature/Android.mk | 11 ++++++++++ .../apks/install_uses_feature/AndroidManifest.xml | 23 +++++++++++++++++++++ .../install_uses_feature/res/values/strings.xml | 6 ++++++ core/tests/coretests/res/raw/install_uses_feature | Bin 0 -> 3150 bytes .../android/content/pm/PackageManagerTests.java | 17 +++++++++++++++ 5 files changed, 57 insertions(+) create mode 100644 core/tests/coretests/apks/install_uses_feature/Android.mk create mode 100644 core/tests/coretests/apks/install_uses_feature/AndroidManifest.xml create mode 100644 core/tests/coretests/apks/install_uses_feature/res/values/strings.xml create mode 100644 core/tests/coretests/res/raw/install_uses_feature (limited to 'core/tests') diff --git a/core/tests/coretests/apks/install_uses_feature/Android.mk b/core/tests/coretests/apks/install_uses_feature/Android.mk new file mode 100644 index 0000000..c0a5067 --- /dev/null +++ b/core/tests/coretests/apks/install_uses_feature/Android.mk @@ -0,0 +1,11 @@ +LOCAL_PATH:= $(call my-dir) +include $(CLEAR_VARS) + +LOCAL_MODULE_TAGS := tests + +LOCAL_SRC_FILES := $(call all-subdir-java-files) + +LOCAL_PACKAGE_NAME := FrameworkCoreTests_install_uses_feature + +include $(BUILD_PACKAGE) + diff --git a/core/tests/coretests/apks/install_uses_feature/AndroidManifest.xml b/core/tests/coretests/apks/install_uses_feature/AndroidManifest.xml new file mode 100644 index 0000000..ecbd7c4 --- /dev/null +++ b/core/tests/coretests/apks/install_uses_feature/AndroidManifest.xml @@ -0,0 +1,23 @@ + + + + + + + + + diff --git a/core/tests/coretests/apks/install_uses_feature/res/values/strings.xml b/core/tests/coretests/apks/install_uses_feature/res/values/strings.xml new file mode 100644 index 0000000..3b8b3b1 --- /dev/null +++ b/core/tests/coretests/apks/install_uses_feature/res/values/strings.xml @@ -0,0 +1,6 @@ + + + + + dummy + diff --git a/core/tests/coretests/res/raw/install_uses_feature b/core/tests/coretests/res/raw/install_uses_feature new file mode 100644 index 0000000..9eef9aa Binary files /dev/null and b/core/tests/coretests/res/raw/install_uses_feature differ diff --git a/core/tests/coretests/src/android/content/pm/PackageManagerTests.java b/core/tests/coretests/src/android/content/pm/PackageManagerTests.java index d5f385b..410e5e9 100755 --- a/core/tests/coretests/src/android/content/pm/PackageManagerTests.java +++ b/core/tests/coretests/src/android/content/pm/PackageManagerTests.java @@ -2838,6 +2838,23 @@ public class PackageManagerTests extends AndroidTestCase { installFromRawResource("install.apk", rapk2, PackageManager.INSTALL_REPLACE_EXISTING, true, fail, retCode, PackageInfo.INSTALL_LOCATION_UNSPECIFIED); } + + /** + * Unknown features should be allowed to install. This prevents older phones + * from rejecting new packages that specify features that didn't exist when + * an older phone existed. All older phones are assumed to have those + * features. + *

+ * Right now we allow all packages to be installed regardless of their + * features. + */ + @LargeTest + public void testUsesFeatureUnknownFeature() { + int retCode = PackageManager.INSTALL_SUCCEEDED; + installFromRawResource("install.apk", R.raw.install_uses_feature, 0, true, false, retCode, + PackageInfo.INSTALL_LOCATION_UNSPECIFIED); + } + /*---------- Recommended install location tests ----*/ /* * TODO's -- cgit v1.1