diff options
author | Dianne Hackborn <hackbod@google.com> | 2011-01-31 17:55:11 -0800 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2011-01-31 17:55:11 -0800 |
commit | b04ec6a8a7e6a684eb4b8d434c87b76bbac9c80c (patch) | |
tree | f88ac23cf576bbfbc646eacac47d5c75467c687e | |
parent | 3efb3153137d310851346807fcc04e71144c5413 (diff) | |
parent | 7a7ed2b21233480d63a1f6b3830e3b0c1c6a3298 (diff) | |
download | frameworks_base-b04ec6a8a7e6a684eb4b8d434c87b76bbac9c80c.zip frameworks_base-b04ec6a8a7e6a684eb4b8d434c87b76bbac9c80c.tar.gz frameworks_base-b04ec6a8a7e6a684eb4b8d434c87b76bbac9c80c.tar.bz2 |
am 7a7ed2b2: Merge "Do not check features in PackageManagerService DO NOT MERGE" into gingerbread
* commit '7a7ed2b21233480d63a1f6b3830e3b0c1c6a3298':
Do not check features in PackageManagerService DO NOT MERGE
6 files changed, 57 insertions, 21 deletions
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 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2010 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.frameworks.coretests.install_uses_feature"> + + <uses-feature android:name="com.android.frameworks.coretests.nonexistent" /> + + <application android:hasCode="false"> + </application> +</manifest> 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 @@ +<?xml version="1.0" encoding="utf-8"?> + +<!-- Just need this dummy file to have something to build. --> +<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> + <string name="dummy">dummy</string> +</resources> diff --git a/core/tests/coretests/res/raw/install_uses_feature b/core/tests/coretests/res/raw/install_uses_feature Binary files differnew file mode 100644 index 0000000..9eef9aa --- /dev/null +++ b/core/tests/coretests/res/raw/install_uses_feature 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. + * <p> + * 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 diff --git a/services/java/com/android/server/PackageManagerService.java b/services/java/com/android/server/PackageManagerService.java index 9b8a605..8c74566 100644 --- a/services/java/com/android/server/PackageManagerService.java +++ b/services/java/com/android/server/PackageManagerService.java @@ -2926,27 +2926,6 @@ class PackageManagerService extends IPackageManager.Stub { System.arraycopy(mTmpSharedLibraries, 0, pkg.usesLibraryFiles, 0, num); } - - if (pkg.reqFeatures != null) { - N = pkg.reqFeatures.size(); - for (int i=0; i<N; i++) { - FeatureInfo fi = pkg.reqFeatures.get(i); - if ((fi.flags&FeatureInfo.FLAG_REQUIRED) == 0) { - // Don't care. - continue; - } - - if (fi.name != null) { - if (mAvailableFeatures.get(fi.name) == null) { - Slog.e(TAG, "Package " + pkg.packageName - + " requires unavailable feature " - + fi.name + "; failing!"); - mLastScanError = PackageManager.INSTALL_FAILED_MISSING_FEATURE; - return null; - } - } - } - } } if (pkg.mSharedUserId != null) { |