Merge "Always restart apps if base.apk gets updated." into tm-dev

This commit is contained in:
Alex Buynytskyy
2022-03-05 05:40:17 +00:00
committed by Android (Google) Code Review
3 changed files with 21 additions and 0 deletions

View File

@@ -57,4 +57,5 @@ interface IPackageInstallerSession {
int getParentSessionId(); int getParentSessionId();
boolean isStaged(); boolean isStaged();
int getInstallFlags();
} }

View File

@@ -1585,6 +1585,18 @@ public class PackageInstaller {
} }
} }
/**
* @return Session's {@link SessionParams#installFlags}.
* @hide
*/
public int getInstallFlags() {
try {
return mSession.getInstallFlags();
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
}
/** /**
* @return the session ID of the multi-package session that this belongs to or * @return the session ID of the multi-package session that this belongs to or
* {@link SessionInfo#INVALID_ID} if it does not belong to a multi-package session. * {@link SessionInfo#INVALID_ID} if it does not belong to a multi-package session.

View File

@@ -2860,6 +2860,9 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub {
inheritFileLocked(mResolvedBaseFile); inheritFileLocked(mResolvedBaseFile);
// Collect the requiredSplitTypes from base // Collect the requiredSplitTypes from base
CollectionUtils.addAll(requiredSplitTypes, existing.getBaseRequiredSplitTypes()); CollectionUtils.addAll(requiredSplitTypes, existing.getBaseRequiredSplitTypes());
} else {
// Installing base.apk. Make sure the app is restarted.
params.setDontKillApp(false);
} }
// Inherit splits if not overridden. // Inherit splits if not overridden.
@@ -3555,6 +3558,11 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub {
return params.isStaged; return params.isStaged;
} }
@Override
public int getInstallFlags() {
return params.installFlags;
}
@Override @Override
public DataLoaderParamsParcel getDataLoaderParams() { public DataLoaderParamsParcel getDataLoaderParams() {
mContext.enforceCallingOrSelfPermission(Manifest.permission.USE_INSTALLER_V2, null); mContext.enforceCallingOrSelfPermission(Manifest.permission.USE_INSTALLER_V2, null);