Marking SessionParams#setDontKillApp as public API

This change marks the long-time system API SessionParams#setDontKillApp as public, giving any installer the ability to install new splits without killing the subject app's processes.

CTS already covers this API via PackageManagerShellCommandTest#testDontKill*

Test: atest PackageManagerShellCommandTest
Bug: 267458096
API-Coverage-Bug: 219044664
Change-Id: Ie263ac431570fce7c4bb6879a48b8183189f0b5b
This commit is contained in:
Patrick Baumann
2023-02-01 15:38:37 +00:00
parent 39b953106b
commit 655b431563
3 changed files with 13 additions and 7 deletions

View File

@@ -12185,6 +12185,7 @@ package android.content.pm {
method @Nullable public String getAppPackageName();
method @NonNull public int[] getChildSessionIds();
method public long getCreatedMillis();
method public boolean getDontKillApp();
method public int getInstallLocation();
method public int getInstallReason();
method @Nullable public String getInstallerAttributionTag();
@@ -12240,6 +12241,7 @@ package android.content.pm {
method public void setAppPackageName(@Nullable String);
method public void setApplicationEnabledSettingPersistent();
method @Deprecated public void setAutoRevokePermissionsMode(boolean);
method public void setDontKillApp(boolean);
method public void setInstallLocation(int);
method public void setInstallReason(int);
method public void setInstallScenario(int);

View File

@@ -3632,7 +3632,6 @@ package android.content.pm {
method public boolean getAllocateAggressive();
method @Deprecated public boolean getAllowDowngrade();
method public int getAutoRevokePermissionsMode();
method public boolean getDontKillApp();
method public boolean getEnableRollback();
method @Nullable public String[] getGrantedRuntimePermissions();
method public boolean getInstallAsFullApp(boolean);
@@ -3648,7 +3647,6 @@ package android.content.pm {
method @RequiresPermission(android.Manifest.permission.ALLOCATE_AGGRESSIVE) public void setAllocateAggressive(boolean);
method @Deprecated public void setAllowDowngrade(boolean);
method @RequiresPermission(allOf={android.Manifest.permission.INSTALL_PACKAGES, "com.android.permission.USE_INSTALLER_V2"}) public void setDataLoaderParams(@NonNull android.content.pm.DataLoaderParams);
method public void setDontKillApp(boolean);
method public void setEnableRollback(boolean);
method public void setEnableRollback(boolean, int);
method @RequiresPermission(android.Manifest.permission.INSTALL_GRANT_RUNTIME_PERMISSIONS) public void setGrantedRuntimePermissions(String[]);

View File

@@ -2616,8 +2616,17 @@ public class PackageInstaller {
installFlags |= PackageManager.INSTALL_FORCE_PERMISSION_PROMPT;
}
/** {@hide} */
@SystemApi
/**
* Requests that the system not kill any of the package's running
* processes as part of a {@link SessionParams#MODE_INHERIT_EXISTING}
* session in which splits being added. By default, all installs will
* result in the package's running processes being killed before the
* install completes.
*
* @param dontKillApp set to {@code true} to request that the processes
* belonging to the package not be killed as part of
* this install.
*/
public void setDontKillApp(boolean dontKillApp) {
if (dontKillApp) {
installFlags |= PackageManager.INSTALL_DONT_KILL_APP;
@@ -3456,10 +3465,7 @@ public class PackageInstaller {
/**
* Get the value set in {@link SessionParams#setDontKillApp(boolean)}.
*
* @hide
*/
@SystemApi
public boolean getDontKillApp() {
return (installFlags & PackageManager.INSTALL_DONT_KILL_APP) != 0;
}