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

Commit 9c074f0f authored by Yi-Yo Chiang's avatar Yi-Yo Chiang
Browse files

DSU service: Show which partition is being installed in notification

Instead of showing "Install in progress", show which partition is being
installed and the total number of partitions, for example:
"Install in progress: system partition [2/3]"

Bug: 169036106
Test: Start a DSU installation and observe the system notification
Change-Id: I81b414606b1e18109ade5a3480931b162bd2a01f
parent 3a9690c3
Loading
Loading
Loading
Loading
+17 −2
Original line number Diff line number Diff line
@@ -486,16 +486,31 @@ public class DynamicSystemInstallationService extends Service

        switch (status) {
            case STATUS_IN_PROGRESS:
                builder.setContentText(getString(R.string.notification_install_inprogress));
                String msgInProgress = getString(R.string.notification_install_inprogress);

                if (mInstallTaskProgress != null) {
                if (mInstallTaskProgress == null) {
                    builder.setContentText(msgInProgress);
                } else {
                    if (mInstallTaskProgress.totalPartitionNumber > 0) {
                        builder.setContentText(
                                String.format(
                                        "%s: %s partition [%d/%d]",
                                        msgInProgress,
                                        mInstallTaskProgress.partitionName,
                                        mInstallTaskProgress.partitionNumber,
                                        mInstallTaskProgress.totalPartitionNumber));

                        // totalProgressPercentage is defined iff totalPartitionNumber is defined
                        builder.setProgress(
                                100,
                                mInstallTaskProgress.totalProgressPercentage,
                                /* indeterminate = */ false);
                    } else {
                        builder.setContentText(
                                String.format(
                                        "%s: %s partition",
                                        msgInProgress, mInstallTaskProgress.partitionName));

                        int max = 1024;
                        int progress = 0;