Revert "Add new manifest attr allowUpdateOwnership (4/n)"
This reverts commit d378c630bb.
Reason for revert: Apps can no longer opt out of udpate ownership
Bug: 281898063
Test: atest UpdateOwnershipEnforcementTest
Change-Id: I3bc3ca266d9d5b1978a7f9419d278db06bfbbaa4
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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,22 +386,18 @@ 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);
|
||||
final boolean isSameUpdateOwner = isUpdateOwnershipEnabled
|
||||
&& TextUtils.equals(oldUpdateOwner, updateOwnerFromSysconfig);
|
||||
|
||||
// Here we handle the update owner for the system package, and the rules are:
|
||||
// -. We use the update owner from sysconfig as the initial value.
|
||||
// -. Once an app becomes to system app later via OTA, only retains the update
|
||||
// owner if it's consistence with sysconfig.
|
||||
// -. Clear the update owner when update owner changes from sysconfig.
|
||||
if (!pkgAlreadyExists || isSameUpdateOwner) {
|
||||
pkgSetting.setUpdateOwnerPackage(updateOwnerFromSysconfig);
|
||||
} else {
|
||||
pkgSetting.setUpdateOwnerPackage(null);
|
||||
}
|
||||
// Here we handle the update owner for the system package, and the rules are:
|
||||
// -. We use the update owner from sysconfig as the initial value.
|
||||
// -. Once an app becomes to system app later via OTA, only retains the update
|
||||
// owner if it's consistence with sysconfig.
|
||||
// -. Clear the update owner when update owner changes from sysconfig.
|
||||
if (!pkgAlreadyExists || isSameUpdateOwner) {
|
||||
pkgSetting.setUpdateOwnerPackage(updateOwnerFromSysconfig);
|
||||
} else {
|
||||
pkgSetting.setUpdateOwnerPackage(null);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1483,10 +1483,4 @@ public interface AndroidPackage {
|
||||
* @hide
|
||||
*/
|
||||
boolean isVisibleToInstantApps();
|
||||
|
||||
/**
|
||||
* @see R.styleable#AndroidManifest_allowUpdateOwnership
|
||||
* @hide
|
||||
*/
|
||||
boolean isAllowUpdateOwnership();
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -219,7 +219,6 @@ public class ParsingPackageUtils {
|
||||
public static final int PARSE_DEFAULT_INSTALL_LOCATION =
|
||||
PackageInfo.INSTALL_LOCATION_UNSPECIFIED;
|
||||
public static final int PARSE_DEFAULT_TARGET_SANDBOX = 1;
|
||||
public static final boolean PARSE_DEFAULT_ALLOW_UPDATE_OWNERSHIP = true;
|
||||
|
||||
/**
|
||||
* If set to true, we will only allow package files that exactly match the DTD. Otherwise, we
|
||||
@@ -887,9 +886,7 @@ public class ParsingPackageUtils {
|
||||
.setTargetSandboxVersion(anInteger(PARSE_DEFAULT_TARGET_SANDBOX,
|
||||
R.styleable.AndroidManifest_targetSandboxVersion, sa))
|
||||
/* Set the global "on SD card" flag */
|
||||
.setExternalStorage((flags & PARSE_EXTERNAL_STORAGE) != 0)
|
||||
.setAllowUpdateOwnership(bool(PARSE_DEFAULT_ALLOW_UPDATE_OWNERSHIP,
|
||||
R.styleable.AndroidManifest_allowUpdateOwnership, sa));
|
||||
.setExternalStorage((flags & PARSE_EXTERNAL_STORAGE) != 0);
|
||||
|
||||
boolean foundApp = false;
|
||||
final int depth = parser.getDepth();
|
||||
|
||||
@@ -218,7 +218,6 @@ class AndroidPackageTest : ParcelableComponentTest(AndroidPackage::class, Packag
|
||||
AndroidPackage::isClearUserDataOnFailedRestoreAllowed,
|
||||
AndroidPackage::isAllowNativeHeapPointerTagging,
|
||||
AndroidPackage::isTaskReparentingAllowed,
|
||||
AndroidPackage::isAllowUpdateOwnership,
|
||||
AndroidPackage::isBackupInForeground,
|
||||
AndroidPackage::isHardwareAccelerated,
|
||||
AndroidPackage::isSaveStateDisallowed,
|
||||
|
||||
Reference in New Issue
Block a user