Merge changes from topic "cherrypick-revert_allowUpdateOwnership" into udc-dev
* changes: Revert "Add new manifest attr allowUpdateOwnership (4/n)" Revert "App may trigger bypass of update owner enforcement"
This commit is contained in:
committed by
Android (Google) Code Review
commit
d83a9ca378
@@ -138,11 +138,6 @@ public class ApkLite {
|
||||
*/
|
||||
private final boolean mIsSdkLibrary;
|
||||
|
||||
/**
|
||||
* Indicates if this package allows an installer to declare update ownership of it.
|
||||
*/
|
||||
private final boolean mAllowUpdateOwnership;
|
||||
|
||||
public ApkLite(String path, String packageName, String splitName, boolean isFeatureSplit,
|
||||
String configForSplit, String usesSplitName, boolean isSplitRequired, int versionCode,
|
||||
int versionCodeMajor, int revisionCode, int installLocation,
|
||||
@@ -153,7 +148,7 @@ public class ApkLite {
|
||||
String requiredSystemPropertyName, String requiredSystemPropertyValue,
|
||||
int minSdkVersion, int targetSdkVersion, int rollbackDataPolicy,
|
||||
Set<String> requiredSplitTypes, Set<String> splitTypes,
|
||||
boolean hasDeviceAdminReceiver, boolean isSdkLibrary, boolean allowUpdateOwnership) {
|
||||
boolean hasDeviceAdminReceiver, boolean isSdkLibrary) {
|
||||
mPath = path;
|
||||
mPackageName = packageName;
|
||||
mSplitName = splitName;
|
||||
@@ -187,7 +182,6 @@ public class ApkLite {
|
||||
mRollbackDataPolicy = rollbackDataPolicy;
|
||||
mHasDeviceAdminReceiver = hasDeviceAdminReceiver;
|
||||
mIsSdkLibrary = isSdkLibrary;
|
||||
mAllowUpdateOwnership = allowUpdateOwnership;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -480,9 +474,6 @@ public class ApkLite {
|
||||
return mRollbackDataPolicy;
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates if this app contains a {@link android.app.admin.DeviceAdminReceiver}.
|
||||
*/
|
||||
@DataClass.Generated.Member
|
||||
public boolean isHasDeviceAdminReceiver() {
|
||||
return mHasDeviceAdminReceiver;
|
||||
@@ -496,19 +487,11 @@ public class ApkLite {
|
||||
return mIsSdkLibrary;
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates if this package allows an installer to declare update ownership of it.
|
||||
*/
|
||||
@DataClass.Generated.Member
|
||||
public boolean isAllowUpdateOwnership() {
|
||||
return mAllowUpdateOwnership;
|
||||
}
|
||||
|
||||
@DataClass.Generated(
|
||||
time = 1680122754650L,
|
||||
time = 1643063342990L,
|
||||
codegenVersion = "1.0.23",
|
||||
sourceFile = "frameworks/base/core/java/android/content/pm/parsing/ApkLite.java",
|
||||
inputSignatures = "private final @android.annotation.NonNull java.lang.String mPackageName\nprivate final @android.annotation.NonNull java.lang.String mPath\nprivate final @android.annotation.Nullable java.lang.String mSplitName\nprivate final @android.annotation.Nullable java.lang.String mUsesSplitName\nprivate final @android.annotation.Nullable java.lang.String mConfigForSplit\nprivate final @android.annotation.Nullable java.util.Set<java.lang.String> mRequiredSplitTypes\nprivate final @android.annotation.Nullable java.util.Set<java.lang.String> mSplitTypes\nprivate final int mVersionCodeMajor\nprivate final int mVersionCode\nprivate final int mRevisionCode\nprivate final int mInstallLocation\nprivate final int mMinSdkVersion\nprivate final int mTargetSdkVersion\nprivate final @android.annotation.NonNull android.content.pm.VerifierInfo[] mVerifiers\nprivate final @android.annotation.NonNull android.content.pm.SigningDetails mSigningDetails\nprivate final boolean mFeatureSplit\nprivate final boolean mIsolatedSplits\nprivate final boolean mSplitRequired\nprivate final boolean mCoreApp\nprivate final boolean mDebuggable\nprivate final boolean mProfileableByShell\nprivate final boolean mMultiArch\nprivate final boolean mUse32bitAbi\nprivate final boolean mExtractNativeLibs\nprivate final boolean mUseEmbeddedDex\nprivate final @android.annotation.Nullable java.lang.String mTargetPackageName\nprivate final boolean mOverlayIsStatic\nprivate final int mOverlayPriority\nprivate final @android.annotation.Nullable java.lang.String mRequiredSystemPropertyName\nprivate final @android.annotation.Nullable java.lang.String mRequiredSystemPropertyValue\nprivate final int mRollbackDataPolicy\nprivate final boolean mHasDeviceAdminReceiver\nprivate final boolean mIsSdkLibrary\nprivate final boolean mAllowUpdateOwnership\npublic long getLongVersionCode()\nprivate boolean hasAnyRequiredSplitTypes()\nclass ApkLite extends java.lang.Object implements []\n@com.android.internal.util.DataClass(genConstructor=false, genConstDefs=false)")
|
||||
inputSignatures = "private final @android.annotation.NonNull java.lang.String mPackageName\nprivate final @android.annotation.NonNull java.lang.String mPath\nprivate final @android.annotation.Nullable java.lang.String mSplitName\nprivate final @android.annotation.Nullable java.lang.String mUsesSplitName\nprivate final @android.annotation.Nullable java.lang.String mConfigForSplit\nprivate final @android.annotation.Nullable java.util.Set<java.lang.String> mRequiredSplitTypes\nprivate final @android.annotation.Nullable java.util.Set<java.lang.String> mSplitTypes\nprivate final int mVersionCodeMajor\nprivate final int mVersionCode\nprivate final int mRevisionCode\nprivate final int mInstallLocation\nprivate final int mMinSdkVersion\nprivate final int mTargetSdkVersion\nprivate final @android.annotation.NonNull android.content.pm.VerifierInfo[] mVerifiers\nprivate final @android.annotation.NonNull android.content.pm.SigningDetails mSigningDetails\nprivate final boolean mFeatureSplit\nprivate final boolean mIsolatedSplits\nprivate final boolean mSplitRequired\nprivate final boolean mCoreApp\nprivate final boolean mDebuggable\nprivate final boolean mProfileableByShell\nprivate final boolean mMultiArch\nprivate final boolean mUse32bitAbi\nprivate final boolean mExtractNativeLibs\nprivate final boolean mUseEmbeddedDex\nprivate final @android.annotation.Nullable java.lang.String mTargetPackageName\nprivate final boolean mOverlayIsStatic\nprivate final int mOverlayPriority\nprivate final @android.annotation.Nullable java.lang.String mRequiredSystemPropertyName\nprivate final @android.annotation.Nullable java.lang.String mRequiredSystemPropertyValue\nprivate final int mRollbackDataPolicy\nprivate final boolean mHasDeviceAdminReceiver\nprivate final boolean mIsSdkLibrary\npublic long getLongVersionCode()\nprivate boolean hasAnyRequiredSplitTypes()\nclass ApkLite extends java.lang.Object implements []\n@com.android.internal.util.DataClass(genConstructor=false, genConstDefs=false)")
|
||||
@Deprecated
|
||||
private void __metadata() {}
|
||||
|
||||
|
||||
@@ -127,8 +127,7 @@ public class ApkLiteParseUtils {
|
||||
null /* isFeatureSplits */, null /* usesSplitNames */,
|
||||
null /* configForSplit */, null /* splitApkPaths */,
|
||||
null /* splitRevisionCodes */, baseApk.getTargetSdkVersion(),
|
||||
null /* requiredSplitTypes */, null, /* splitTypes */
|
||||
baseApk.isAllowUpdateOwnership()));
|
||||
null /* requiredSplitTypes */, null /* splitTypes */));
|
||||
} finally {
|
||||
Trace.traceEnd(TRACE_TAG_PACKAGE_MANAGER);
|
||||
}
|
||||
@@ -154,8 +153,7 @@ public class ApkLiteParseUtils {
|
||||
null /* isFeatureSplits */, null /* usesSplitNames */,
|
||||
null /* configForSplit */, null /* splitApkPaths */,
|
||||
null /* splitRevisionCodes */, baseApk.getTargetSdkVersion(),
|
||||
null /* requiredSplitTypes */, null, /* splitTypes */
|
||||
baseApk.isAllowUpdateOwnership()));
|
||||
null /* requiredSplitTypes */, null /* splitTypes */));
|
||||
} finally {
|
||||
Trace.traceEnd(TRACE_TAG_PACKAGE_MANAGER);
|
||||
}
|
||||
@@ -301,8 +299,7 @@ public class ApkLiteParseUtils {
|
||||
return input.success(
|
||||
new PackageLite(codePath, baseCodePath, baseApk, splitNames, isFeatureSplits,
|
||||
usesSplitNames, configForSplits, splitCodePaths, splitRevisionCodes,
|
||||
baseApk.getTargetSdkVersion(), requiredSplitTypes, splitTypes,
|
||||
baseApk.isAllowUpdateOwnership()));
|
||||
baseApk.getTargetSdkVersion(), requiredSplitTypes, splitTypes));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -429,8 +426,6 @@ public class ApkLiteParseUtils {
|
||||
"isFeatureSplit", false);
|
||||
boolean isSplitRequired = parser.getAttributeBooleanValue(ANDROID_RES_NAMESPACE,
|
||||
"isSplitRequired", false);
|
||||
boolean allowUpdateOwnership = parser.getAttributeBooleanValue(ANDROID_RES_NAMESPACE,
|
||||
"allowUpdateOwnership", true);
|
||||
String configForSplit = parser.getAttributeValue(null, "configForSplit");
|
||||
|
||||
int targetSdkVersion = DEFAULT_TARGET_SDK_VERSION;
|
||||
@@ -614,7 +609,7 @@ public class ApkLiteParseUtils {
|
||||
overlayIsStatic, overlayPriority, requiredSystemPropertyName,
|
||||
requiredSystemPropertyValue, minSdkVersion, targetSdkVersion,
|
||||
rollbackDataPolicy, requiredSplitTypes.first, requiredSplitTypes.second,
|
||||
hasDeviceAdminReceiver, isSdkLibrary, allowUpdateOwnership));
|
||||
hasDeviceAdminReceiver, isSdkLibrary));
|
||||
}
|
||||
|
||||
private static boolean isDeviceAdminReceiver(
|
||||
|
||||
@@ -110,16 +110,10 @@ public class PackageLite {
|
||||
*/
|
||||
private final boolean mIsSdkLibrary;
|
||||
|
||||
/**
|
||||
* Indicates if this package allows an installer to declare update ownership of it.
|
||||
*/
|
||||
private final boolean mAllowUpdateOwnership;
|
||||
|
||||
public PackageLite(String path, String baseApkPath, ApkLite baseApk,
|
||||
String[] splitNames, boolean[] isFeatureSplits, String[] usesSplitNames,
|
||||
String[] configForSplit, String[] splitApkPaths, int[] splitRevisionCodes,
|
||||
int targetSdk, Set<String>[] requiredSplitTypes, Set<String>[] splitTypes,
|
||||
boolean allowUpdateOwnership) {
|
||||
int targetSdk, Set<String>[] requiredSplitTypes, Set<String>[] splitTypes) {
|
||||
// The following paths may be different from the path in ApkLite because we
|
||||
// move or rename the APK files. Use parameters to indicate the correct paths.
|
||||
mPath = path;
|
||||
@@ -150,7 +144,6 @@ public class PackageLite {
|
||||
mSplitApkPaths = splitApkPaths;
|
||||
mSplitRevisionCodes = splitRevisionCodes;
|
||||
mTargetSdk = targetSdk;
|
||||
mAllowUpdateOwnership = allowUpdateOwnership;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -421,19 +414,12 @@ public class PackageLite {
|
||||
return mIsSdkLibrary;
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates if this package allows an installer to declare update ownership of it.
|
||||
*/
|
||||
@DataClass.Generated.Member
|
||||
public boolean isAllowUpdateOwnership() {
|
||||
return mAllowUpdateOwnership;
|
||||
}
|
||||
|
||||
@DataClass.Generated(
|
||||
time = 1680125514341L,
|
||||
time = 1643132127068L,
|
||||
codegenVersion = "1.0.23",
|
||||
sourceFile = "frameworks/base/core/java/android/content/pm/parsing/PackageLite.java",
|
||||
inputSignatures = "private final @android.annotation.NonNull java.lang.String mPackageName\nprivate final @android.annotation.NonNull java.lang.String mPath\nprivate final @android.annotation.NonNull java.lang.String mBaseApkPath\nprivate final @android.annotation.Nullable java.lang.String[] mSplitApkPaths\nprivate final @android.annotation.Nullable java.lang.String[] mSplitNames\nprivate final @android.annotation.Nullable java.lang.String[] mUsesSplitNames\nprivate final @android.annotation.Nullable java.lang.String[] mConfigForSplit\nprivate final @android.annotation.Nullable java.util.Set<java.lang.String> mBaseRequiredSplitTypes\nprivate final @android.annotation.Nullable java.util.Set<java.lang.String>[] mRequiredSplitTypes\nprivate final @android.annotation.Nullable java.util.Set<java.lang.String>[] mSplitTypes\nprivate final int mVersionCodeMajor\nprivate final int mVersionCode\nprivate final int mTargetSdk\nprivate final int mBaseRevisionCode\nprivate final @android.annotation.Nullable int[] mSplitRevisionCodes\nprivate final int mInstallLocation\nprivate final @android.annotation.NonNull android.content.pm.VerifierInfo[] mVerifiers\nprivate final @android.annotation.Nullable boolean[] mIsFeatureSplits\nprivate final boolean mIsolatedSplits\nprivate final boolean mSplitRequired\nprivate final boolean mCoreApp\nprivate final boolean mDebuggable\nprivate final boolean mMultiArch\nprivate final boolean mUse32bitAbi\nprivate final boolean mExtractNativeLibs\nprivate final boolean mProfileableByShell\nprivate final boolean mUseEmbeddedDex\nprivate final boolean mIsSdkLibrary\nprivate final boolean mAllowUpdateOwnership\npublic java.util.List<java.lang.String> getAllApkPaths()\npublic long getLongVersionCode()\nprivate boolean hasAnyRequiredSplitTypes()\nclass PackageLite extends java.lang.Object implements []\n@com.android.internal.util.DataClass(genConstructor=false, genConstDefs=false)")
|
||||
inputSignatures =
|
||||
"private final @android.annotation.NonNull java.lang.String mPackageName\nprivate final @android.annotation.NonNull java.lang.String mPath\nprivate final @android.annotation.NonNull java.lang.String mBaseApkPath\nprivate final @android.annotation.Nullable java.lang.String[] mSplitApkPaths\nprivate final @android.annotation.Nullable java.lang.String[] mSplitNames\nprivate final @android.annotation.Nullable java.lang.String[] mUsesSplitNames\nprivate final @android.annotation.Nullable java.lang.String[] mConfigForSplit\nprivate final @android.annotation.Nullable java.util.Set<java.lang.String> mBaseRequiredSplitTypes\nprivate final @android.annotation.Nullable java.util.Set<java.lang.String>[] mRequiredSplitTypes\nprivate final @android.annotation.Nullable java.util.Set<java.lang.String>[] mSplitTypes\nprivate final int mVersionCodeMajor\nprivate final int mVersionCode\nprivate final int mTargetSdk\nprivate final int mBaseRevisionCode\nprivate final @android.annotation.Nullable int[] mSplitRevisionCodes\nprivate final int mInstallLocation\nprivate final @android.annotation.NonNull android.content.pm.VerifierInfo[] mVerifiers\nprivate final @android.annotation.Nullable boolean[] mIsFeatureSplits\nprivate final boolean mIsolatedSplits\nprivate final boolean mSplitRequired\nprivate final boolean mCoreApp\nprivate final boolean mDebuggable\nprivate final boolean mMultiArch\nprivate final boolean mUse32bitAbi\nprivate final boolean mExtractNativeLibs\nprivate final boolean mProfileableByShell\nprivate final boolean mUseEmbeddedDex\nprivate final boolean mIsSdkLibrary\npublic java.util.List<java.lang.String> getAllApkPaths()\npublic long getLongVersionCode()\nprivate boolean hasAnyRequiredSplitTypes()\nclass PackageLite extends java.lang.Object implements []\n@com.android.internal.util.DataClass(genConstructor=false, genConstDefs=false)")
|
||||
@Deprecated
|
||||
private void __metadata() {}
|
||||
|
||||
|
||||
@@ -1797,12 +1797,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
|
||||
@@ -1842,7 +1836,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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -745,9 +745,6 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub {
|
||||
@GuardedBy("mLock")
|
||||
private int mValidatedTargetSdk = INVALID_TARGET_SDK_VERSION;
|
||||
|
||||
@GuardedBy("mLock")
|
||||
private boolean mAllowsUpdateOwnership = true;
|
||||
|
||||
private static final FileFilter sAddedApkFilter = new FileFilter() {
|
||||
@Override
|
||||
public boolean accept(File file) {
|
||||
@@ -869,11 +866,13 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub {
|
||||
|
||||
private static final int USER_ACTION_NOT_NEEDED = 0;
|
||||
private static final int USER_ACTION_REQUIRED = 1;
|
||||
private static final int USER_ACTION_PENDING_APK_PARSING = 2;
|
||||
private static final int USER_ACTION_REQUIRED_UPDATE_OWNER_REMINDER = 3;
|
||||
|
||||
@IntDef({
|
||||
USER_ACTION_NOT_NEEDED,
|
||||
USER_ACTION_REQUIRED,
|
||||
USER_ACTION_PENDING_APK_PARSING,
|
||||
USER_ACTION_REQUIRED_UPDATE_OWNER_REMINDER,
|
||||
})
|
||||
@interface UserActionRequirement {}
|
||||
@@ -964,11 +963,11 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub {
|
||||
&& !isApexSession()
|
||||
&& !isUpdateOwner
|
||||
&& !isInstallerShell
|
||||
&& mAllowsUpdateOwnership
|
||||
// We don't enforce the update ownership for the managed user and profile.
|
||||
&& !isFromManagedUserOrProfile) {
|
||||
return USER_ACTION_REQUIRED_UPDATE_OWNER_REMINDER;
|
||||
}
|
||||
|
||||
if (isPermissionGranted) {
|
||||
return USER_ACTION_NOT_NEEDED;
|
||||
}
|
||||
@@ -983,20 +982,7 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub {
|
||||
&& isUpdateWithoutUserActionPermissionGranted
|
||||
&& ((isUpdateOwnershipEnforcementEnabled ? isUpdateOwner
|
||||
: isInstallerOfRecord) || isSelfUpdate)) {
|
||||
if (!isApexSession()) {
|
||||
if (!isTargetSdkConditionSatisfied(this)) {
|
||||
return USER_ACTION_REQUIRED;
|
||||
}
|
||||
|
||||
if (!mSilentUpdatePolicy.isSilentUpdateAllowed(
|
||||
getInstallerPackageName(), getPackageName())) {
|
||||
// Fall back to the non-silent update if a repeated installation is invoked
|
||||
// within the throttle time.
|
||||
return USER_ACTION_REQUIRED;
|
||||
}
|
||||
mSilentUpdatePolicy.track(getInstallerPackageName(), getPackageName());
|
||||
return USER_ACTION_NOT_NEEDED;
|
||||
}
|
||||
return USER_ACTION_PENDING_APK_PARSING;
|
||||
}
|
||||
|
||||
return USER_ACTION_REQUIRED;
|
||||
@@ -2404,6 +2390,26 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub {
|
||||
session.sendPendingUserActionIntent(target);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!session.isApexSession() && userActionRequirement == USER_ACTION_PENDING_APK_PARSING) {
|
||||
if (!isTargetSdkConditionSatisfied(session)) {
|
||||
session.sendPendingUserActionIntent(target);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (session.params.requireUserAction == SessionParams.USER_ACTION_NOT_REQUIRED) {
|
||||
if (!session.mSilentUpdatePolicy.isSilentUpdateAllowed(
|
||||
session.getInstallerPackageName(), session.getPackageName())) {
|
||||
// Fall back to the non-silent update if a repeated installation is invoked
|
||||
// within the throttle time.
|
||||
session.sendPendingUserActionIntent(target);
|
||||
return true;
|
||||
}
|
||||
session.mSilentUpdatePolicy.track(session.getInstallerPackageName(),
|
||||
session.getPackageName());
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -3409,8 +3415,6 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub {
|
||||
// {@link PackageLite#getTargetSdk()}
|
||||
mValidatedTargetSdk = packageLite.getTargetSdk();
|
||||
|
||||
mAllowsUpdateOwnership = packageLite.isAllowUpdateOwnership();
|
||||
|
||||
return packageLite;
|
||||
}
|
||||
|
||||
|
||||
@@ -698,7 +698,7 @@ class PackageManagerShellCommand extends ShellCommand {
|
||||
null /* usesSplitNames */, null /* configForSplit */,
|
||||
null /* splitApkPaths */, null /* splitRevisionCodes */,
|
||||
apkLite.getTargetSdkVersion(), null /* requiredSplitTypes */,
|
||||
null /* splitTypes */, apkLite.isAllowUpdateOwnership());
|
||||
null /* splitTypes */);
|
||||
sessionSize += InstallLocationUtils.calculateInstalledSize(pkgLite,
|
||||
params.sessionParams.abiOverride, fd.getFileDescriptor());
|
||||
} catch (IOException e) {
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -422,8 +422,7 @@ public class DexMetadataHelperTest {
|
||||
null /* splitNames */, null /* isFeatureSplits */, null /* usesSplitNames */,
|
||||
null /* configForSplit */, null /* splitApkPaths */,
|
||||
null /* splitRevisionCodes */, baseApk.getTargetSdkVersion(),
|
||||
null /* requiredSplitTypes */, null /* splitTypes */,
|
||||
false /* allowUpdateOwnership */);
|
||||
null /* requiredSplitTypes */, null /* splitTypes */);
|
||||
Assert.assertEquals(dm.length(), DexMetadataHelper.getPackageDexMetadataSize(pkgLite));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user