diff options
-rw-r--r-- | core/tests/coretests/res/raw/install_uses_feature | bin | 3198 -> 3178 bytes | |||
-rwxr-xr-x | core/tests/coretests/src/android/content/pm/PackageManagerTests.java | 15 | ||||
-rw-r--r-- | services/java/com/android/server/PackageManagerService.java | 20 |
3 files changed, 12 insertions, 23 deletions
diff --git a/core/tests/coretests/res/raw/install_uses_feature b/core/tests/coretests/res/raw/install_uses_feature Binary files differindex 769a246..eeeb309 100644 --- a/core/tests/coretests/res/raw/install_uses_feature +++ 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 0e65df5..7af64e4 100755 --- a/core/tests/coretests/src/android/content/pm/PackageManagerTests.java +++ b/core/tests/coretests/src/android/content/pm/PackageManagerTests.java @@ -3098,10 +3098,19 @@ public class PackageManagerTests extends AndroidTestCase { 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 testUsesFeatureMissingFeature() { - int retCode = PackageManager.INSTALL_FAILED_MISSING_FEATURE; - installFromRawResource("install.apk", R.raw.install_uses_feature, 0, true, true, retCode, + public void testUsesFeatureUnknownFeature() { + int retCode = PackageManager.INSTALL_SUCCEEDED; + installFromRawResource("install.apk", R.raw.install_uses_feature, 0, true, false, retCode, PackageInfo.INSTALL_LOCATION_UNSPECIFIED); } diff --git a/services/java/com/android/server/PackageManagerService.java b/services/java/com/android/server/PackageManagerService.java index 5806de2..9ee71e8 100644 --- a/services/java/com/android/server/PackageManagerService.java +++ b/services/java/com/android/server/PackageManagerService.java @@ -2924,26 +2924,6 @@ class PackageManagerService extends IPackageManager.Stub { } } - if (pkg.reqFeatures != null) { - int 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) { suid = mSettings.getSharedUserLP(pkg.mSharedUserId, pkg.applicationInfo.flags, true); |