Loading core/tests/coretests/res/raw/install_uses_feature −20 B (3.1 KiB) File changed.No diff preview for this file type. View original file View changed file core/tests/coretests/src/android/content/pm/PackageManagerTests.java +12 −3 Original line number Original line Diff line number Diff line Loading @@ -3098,10 +3098,19 @@ public class PackageManagerTests extends AndroidTestCase { fail, retCode, PackageInfo.INSTALL_LOCATION_UNSPECIFIED); 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 @LargeTest public void testUsesFeatureMissingFeature() { public void testUsesFeatureUnknownFeature() { int retCode = PackageManager.INSTALL_FAILED_MISSING_FEATURE; int retCode = PackageManager.INSTALL_SUCCEEDED; installFromRawResource("install.apk", R.raw.install_uses_feature, 0, true, true, retCode, installFromRawResource("install.apk", R.raw.install_uses_feature, 0, true, false, retCode, PackageInfo.INSTALL_LOCATION_UNSPECIFIED); PackageInfo.INSTALL_LOCATION_UNSPECIFIED); } } Loading services/java/com/android/server/PackageManagerService.java +0 −20 Original line number Original line Diff line number Diff line Loading @@ -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) { if (pkg.mSharedUserId != null) { suid = mSettings.getSharedUserLP(pkg.mSharedUserId, suid = mSettings.getSharedUserLP(pkg.mSharedUserId, pkg.applicationInfo.flags, true); pkg.applicationInfo.flags, true); Loading Loading
core/tests/coretests/res/raw/install_uses_feature −20 B (3.1 KiB) File changed.No diff preview for this file type. View original file View changed file
core/tests/coretests/src/android/content/pm/PackageManagerTests.java +12 −3 Original line number Original line Diff line number Diff line Loading @@ -3098,10 +3098,19 @@ public class PackageManagerTests extends AndroidTestCase { fail, retCode, PackageInfo.INSTALL_LOCATION_UNSPECIFIED); 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 @LargeTest public void testUsesFeatureMissingFeature() { public void testUsesFeatureUnknownFeature() { int retCode = PackageManager.INSTALL_FAILED_MISSING_FEATURE; int retCode = PackageManager.INSTALL_SUCCEEDED; installFromRawResource("install.apk", R.raw.install_uses_feature, 0, true, true, retCode, installFromRawResource("install.apk", R.raw.install_uses_feature, 0, true, false, retCode, PackageInfo.INSTALL_LOCATION_UNSPECIFIED); PackageInfo.INSTALL_LOCATION_UNSPECIFIED); } } Loading
services/java/com/android/server/PackageManagerService.java +0 −20 Original line number Original line Diff line number Diff line Loading @@ -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) { if (pkg.mSharedUserId != null) { suid = mSettings.getSharedUserLP(pkg.mSharedUserId, suid = mSettings.getSharedUserLP(pkg.mSharedUserId, pkg.applicationInfo.flags, true); pkg.applicationInfo.flags, true); Loading