Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6cf32312 authored by Dianne Hackborn's avatar Dianne Hackborn Committed by Android (Google) Code Review
Browse files

Merge "Do not check features in PackageManagerService" into honeycomb

parents 122106cb 4c3915a0
Loading
Loading
Loading
Loading
+12 −3
Original line number Original line Diff line number Diff line
@@ -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);
    }
    }


+0 −20
Original line number Original line Diff line number Diff line
@@ -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);