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

Commit 08c993b8 authored by Patrick Baumann's avatar Patrick Baumann
Browse files

Revert "Add new manifest attr allowUpdateOwnership (4/n)"

This reverts commit d378c630.

Reason for revert: Apps can no longer opt out of udpate ownership

Bug: 281898063
Test: atest UpdateOwnershipEnforcementTest
Change-Id: I3bc3ca266d9d5b1978a7f9419d278db06bfbbaa4
parent 31a3d5b0
Loading
Loading
Loading
Loading
+0 −7
Original line number Diff line number Diff line
@@ -1796,12 +1796,6 @@
    -->
    <attr name="attributionTags" format="string" />

    <!-- Default value <code>true</code> allows an installer to enable update
         ownership enforcement for this package via {@link
         android.content.pm.PackageInstaller.SessionParams#setRequestUpdateOwnership}
         during initial installation. This overrides the installer's use of {@link
         android.content.pm.PackageInstaller.SessionParams#setRequestUpdateOwnership}.
    -->
    <attr name="allowUpdateOwnership" format="boolean" />

    <!-- The <code>manifest</code> tag is the root of an
@@ -1841,7 +1835,6 @@
        <attr name="isSplitRequired" />
        <attr name="requiredSplitTypes" />
        <attr name="splitTypes" />
        <attr name="allowUpdateOwnership" />
    </declare-styleable>

    <!-- The <code>application</code> tag describes application-level components
+12 −21
Original line number Diff line number Diff line
@@ -324,7 +324,6 @@ final class InstallPackageHelper {
        InstallSource installSource = request.getInstallSource();
        final boolean isApex = (scanFlags & SCAN_AS_APEX) != 0;
        final boolean pkgAlreadyExists = oldPkgSetting != null;
        final boolean isAllowUpdateOwnership = parsedPackage.isAllowUpdateOwnership();
        final String oldUpdateOwner =
                pkgAlreadyExists ? oldPkgSetting.getInstallSource().mUpdateOwnerPackageName : null;
        final String updateOwnerFromSysconfig = isApex || !pkgSetting.isSystem() ? null
@@ -346,11 +345,7 @@ final class InstallPackageHelper {
            }

            // Handle the update ownership enforcement for APK
            if (!isAllowUpdateOwnership) {
                // If the app wants to opt-out of the update ownership enforcement via manifest,
                // it overrides the installer's use of #setRequestUpdateOwnership.
                installSource = installSource.setUpdateOwnerPackageName(null);
            } else if (!isApex) {
            if (!isApex) {
                // User installer UID as "current" userId if present; otherwise, use the userId
                // from InstallRequest.
                final int userId = installSource.mInstallerPackageUid != Process.INVALID_UID
@@ -391,9 +386,6 @@ final class InstallPackageHelper {
        // For non-standard install (addForInit), installSource is null.
        } else if (pkgSetting.isSystem()) {
            // We still honor the manifest attr if the system app wants to opt-out of it.
            if (!isAllowUpdateOwnership) {
                pkgSetting.setUpdateOwnerPackage(null);
            } else {
            final boolean isSameUpdateOwner = isUpdateOwnershipEnabled
                    && TextUtils.equals(oldUpdateOwner, updateOwnerFromSysconfig);

@@ -408,7 +400,6 @@ final class InstallPackageHelper {
                pkgSetting.setUpdateOwnerPackage(null);
            }
        }
        }

        if ((scanFlags & SCAN_AS_APK_IN_APEX) != 0) {
            boolean isFactory = (scanFlags & SCAN_AS_FACTORY) != 0;
+0 −11
Original line number Diff line number Diff line
@@ -1809,11 +1809,6 @@ public class PackageImpl implements ParsedPackage, AndroidPackageInternal,
        return getBoolean(Booleans.VISIBLE_TO_INSTANT_APPS);
    }

    @Override
    public boolean isAllowUpdateOwnership() {
        return getBoolean2(Booleans2.ALLOW_UPDATE_OWNERSHIP);
    }

    @Override
    public boolean isVmSafeMode() {
        return getBoolean(Booleans.VM_SAFE_MODE);
@@ -2517,11 +2512,6 @@ public class PackageImpl implements ParsedPackage, AndroidPackageInternal,
        return this;
    }

    @Override
    public PackageImpl setAllowUpdateOwnership(boolean value) {
        return setBoolean2(Booleans2.ALLOW_UPDATE_OWNERSHIP, value);
    }

    @Override
    public PackageImpl sortActivities() {
        Collections.sort(this.activities, ORDER_COMPARATOR);
@@ -3736,6 +3726,5 @@ public class PackageImpl implements ParsedPackage, AndroidPackageInternal,

        private static final long STUB = 1L;
        private static final long APEX = 1L << 1;
        private static final long ALLOW_UPDATE_OWNERSHIP = 1L << 2;
    }
}
+0 −6
Original line number Diff line number Diff line
@@ -1483,10 +1483,4 @@ public interface AndroidPackage {
     * @hide
     */
    boolean isVisibleToInstantApps();

    /**
     * @see R.styleable#AndroidManifest_allowUpdateOwnership
     * @hide
     */
    boolean isAllowUpdateOwnership();
}
+0 −2
Original line number Diff line number Diff line
@@ -388,8 +388,6 @@ public interface ParsingPackage {

    ParsingPackage setLocaleConfigResourceId(int localeConfigRes);

    ParsingPackage setAllowUpdateOwnership(boolean value);

    /**
     * Sets the trusted host certificates of apps that are allowed to embed activities of this
     * application.
Loading