Merge "Always restart apps if base.apk gets updated." into qt-dev am: 1adea76f46

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/17111536

Change-Id: Ia35c96940c76b46ff5754f493e4f0c64df211483
This commit is contained in:
TreeHugger Robot
2022-03-09 06:21:41 +00:00
committed by Automerger Merge Worker
3 changed files with 24 additions and 0 deletions

View File

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

View File

@@ -1175,6 +1175,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
* {@link SessionInfo#INVALID_ID} if it does not belong to a multi-package session.

View File

@@ -91,6 +91,7 @@ import android.system.OsConstants;
import android.system.StructStat;
import android.text.TextUtils;
import android.util.ArraySet;
import android.util.EventLog;
import android.util.ExceptionUtils;
import android.util.MathUtils;
import android.util.Slog;
@@ -1717,6 +1718,11 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub {
resolveInheritedFile(baseDexMetadataFile);
}
baseApk = existingBase;
} else if ((params.installFlags & PackageManager.INSTALL_DONT_KILL_APP) != 0) {
EventLog.writeEvent(0x534e4554, "219044664");
// Installing base.apk. Make sure the app is restarted.
params.setDontKillApp(false);
}
// Inherit splits if not overridden
@@ -2135,6 +2141,11 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub {
return params.isStaged;
}
@Override
public int getInstallFlags() {
return params.installFlags;
}
@Override
public int[] getChildSessionIds() {
final int[] childSessionIds = mChildSessionIds.copyKeys();