From 9c074f0f781cabdbc2609f1798d982be14960b4b Mon Sep 17 00:00:00 2001 From: Yi-Yo Chiang Date: Fri, 25 Mar 2022 19:21:58 +0800 Subject: [PATCH] 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 --- .../DynamicSystemInstallationService.java | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/packages/DynamicSystemInstallationService/src/com/android/dynsystem/DynamicSystemInstallationService.java b/packages/DynamicSystemInstallationService/src/com/android/dynsystem/DynamicSystemInstallationService.java index 98d4cf0d1182e..3a3565941489c 100644 --- a/packages/DynamicSystemInstallationService/src/com/android/dynsystem/DynamicSystemInstallationService.java +++ b/packages/DynamicSystemInstallationService/src/com/android/dynsystem/DynamicSystemInstallationService.java @@ -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;