Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8f5109dd authored by Gavin Corkery's avatar Gavin Corkery
Browse files

Don't send session committed broadcast for dry runs

For staged installs, pre-reboot verification performs a dry run install.
Since this dry run install is non-staged, the session committed
broadcast will be sent, in some cases causing app icons to
erroneously appear. Add check for this case.

Test: Inspect SESSION_COMMITTED broadcasts sent for a staged install
      with and without this patch
Bug: 139663018

Change-Id: Ib0ba29a4506cda8da1865926ae62b137e1dce8ff
parent 2080a059
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -2186,8 +2186,10 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub {
        final boolean success = (returnCode == PackageManager.INSTALL_SUCCEEDED);

        // Send broadcast to default launcher only if it's a new install
        // TODO(b/144270665): Secure the usage of this broadcast.
        final boolean isNewInstall = extras == null || !extras.getBoolean(Intent.EXTRA_REPLACING);
        if (success && isNewInstall && mPm.mInstallerService.okToSendBroadcasts()) {
        if (success && isNewInstall && mPm.mInstallerService.okToSendBroadcasts()
                && (params.installFlags & PackageManager.INSTALL_DRY_RUN) == 0) {
            mPm.sendSessionCommitBroadcast(generateInfo(), userId);
        }