dragon: Update DragonKeyboardFirmwareUpdater notification messages

This CL changes the strings showing up on the update progress notification. The
changes are in dfu library.

BUG=b/25369339
TEST=build and update the keyboard firmware

Change-Id: I44298a5532ae37b50135d4b5d6de5be73c0a01b4
diff --git a/DragonKeyboardFirmwareUpdater/dfu/README.google b/DragonKeyboardFirmwareUpdater/dfu/README.google
index c26b842..3c67d01 100644
--- a/DragonKeyboardFirmwareUpdater/dfu/README.google
+++ b/DragonKeyboardFirmwareUpdater/dfu/README.google
@@ -1,3 +1,11 @@
-HACKs in src/no/nordicsemi/android/dfu/DfuBaseService.java:
+HACKs:
+
+src/no/nordicsemi/android/dfu/DfuBaseService.java:
 mPackageBeforeNotification = 2
 BuildConfig.DEBUG
+
+res/values/strings.xml:
+Change all the strings used in the update progress notification.
+
+src/no/nordicsemi/android/dfu/DfuBaseService.java:
+Adopt the changes in res/values/strings.xml.
diff --git a/DragonKeyboardFirmwareUpdater/dfu/res/values/strings.xml b/DragonKeyboardFirmwareUpdater/dfu/res/values/strings.xml
index 89c9fa7..23dc6cf 100644
--- a/DragonKeyboardFirmwareUpdater/dfu/res/values/strings.xml
+++ b/DragonKeyboardFirmwareUpdater/dfu/res/values/strings.xml
@@ -1,31 +1,14 @@
-<resources>
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
 
-    <string name="dfu_unknown_name">unnamed device</string>
-    
-    <string name="dfu_action_abort">Abort</string>
+    <string name="dfu_unknown_name">Unnamed device</string>
+    <string name="dfu_action_cancel">Cancel</string>
 
-    <string name="dfu_status_initializing">Initializing&#8230;</string>
-    <string name="dfu_status_connecting">Connecting&#8230;</string>
-    <string name="dfu_status_starting">Starting DFU&#8230;</string>
-    <string name="dfu_status_switching_to_dfu">Starting bootloader&#8230;</string>
-    <string name="dfu_status_uploading">Uploading&#8230;</string>
-    <string name="dfu_status_uploading_part" formatted="false">Uploading part %d/%d&#8230;</string>
-    <string name="dfu_status_validating">Validating&#8230;</string>
-    <string name="dfu_status_disconnecting">Disconnecting&#8230;</string>
-    <string name="dfu_status_completed">Done</string>
-    <string name="dfu_status_aborted">Aborted</string>
-    <string name="dfu_status_aborting">Aborting&#8230;</string>
-    <string name="dfu_status_error">Upload failed</string>
-    
-    <string name="dfu_status_connecting_msg">Connecting to %s&#8230;</string>
-    <string name="dfu_status_starting_msg">Initializing DFU process&#8230;</string>
-    <string name="dfu_status_switching_to_dfu_msg">Waiting for bootloader&#8230;</string>
-    <string name="dfu_status_uploading_components_msg">Transmitting components to %s&#8230;</string>
-    <string name="dfu_status_uploading_msg">Transmitting application to %s&#8230;</string>
-    <string name="dfu_status_validating_msg">Validating&#8230;</string>
-    <string name="dfu_status_completed_msg">Application has been send successfully.</string>
-    <string name="dfu_status_aborted_msg">Application upload has been canceled.</string>
-    <string name="dfu_status_disconnecting_msg">Disconnecting from %s&#8230;</string>
-    <string name="dfu_status_error_msg">DFU process failed.</string>
-    
+    <!-- Pixel C Keyboard firmware update notification messages -->
+    <string name="dfu_status_notification_updating_title"><xliff:g id="product_name">Pixel C</xliff:g> Keyboard update</string>
+    <string name="dfu_status_notification_update_finished_title"><xliff:g id="product_name">Pixel C</xliff:g> Keyboard update installed</string>
+    <string name="dfu_status_notification_update_canceled_title"><xliff:g id="product_name">Pixel C</xliff:g> Keyboard update canceled</string>
+    <string name="dfu_status_notification_update_failed_title"><xliff:g id="product_name">Pixel C</xliff:g> Keyboard update did not succeed</string>
+
+    <string name="dfu_status_notification_updating_msg"><xliff:g id="update_progress_percent">%1$d %%</xliff:g></string>
+
 </resources>
diff --git a/DragonKeyboardFirmwareUpdater/dfu/src/no/nordicsemi/android/dfu/DfuBaseService.java b/DragonKeyboardFirmwareUpdater/dfu/src/no/nordicsemi/android/dfu/DfuBaseService.java
index 5d6a3e1..36c4cc5 100644
--- a/DragonKeyboardFirmwareUpdater/dfu/src/no/nordicsemi/android/dfu/DfuBaseService.java
+++ b/DragonKeyboardFirmwareUpdater/dfu/src/no/nordicsemi/android/dfu/DfuBaseService.java
@@ -2743,39 +2743,39 @@
 
 		switch (progress) {
 			case PROGRESS_CONNECTING:
-				builder.setOngoing(true).setContentTitle(getString(R.string.dfu_status_connecting)).setContentText(getString(R.string.dfu_status_connecting_msg, deviceName)).setProgress(100, 0, true);
+				builder.setOngoing(true).setContentTitle(getString(R.string.dfu_status_notification_updating_title)).setContentText(getString(R.string.dfu_status_notification_updating_msg, 0)).setProgress(100, 0, true);
 				break;
 			case PROGRESS_STARTING:
-				builder.setOngoing(true).setContentTitle(getString(R.string.dfu_status_starting)).setContentText(getString(R.string.dfu_status_starting_msg, deviceName)).setProgress(100, 0, true);
+				builder.setOngoing(true).setContentTitle(getString(R.string.dfu_status_notification_updating_title)).setContentText(getString(R.string.dfu_status_notification_updating_msg, 0)).setProgress(100, 0, true);
 				break;
 			case PROGRESS_ENABLING_DFU_MODE:
-				builder.setOngoing(true).setContentTitle(getString(R.string.dfu_status_switching_to_dfu)).setContentText(getString(R.string.dfu_status_switching_to_dfu_msg, deviceName))
+				builder.setOngoing(true).setContentTitle(getString(R.string.dfu_status_notification_updating_title)).setContentText(getString(R.string.dfu_status_notification_updating_msg, 0))
 						.setProgress(100, 0, true);
 				break;
 			case PROGRESS_VALIDATING:
-				builder.setOngoing(true).setContentTitle(getString(R.string.dfu_status_validating)).setContentText(getString(R.string.dfu_status_validating_msg, deviceName)).setProgress(100, 0, true);
+				builder.setOngoing(true).setContentTitle(getString(R.string.dfu_status_notification_updating_title)).setContentText(getString(R.string.dfu_status_notification_updating_msg, 0)).setProgress(100, 0, true);
 				break;
 			case PROGRESS_DISCONNECTING:
-				builder.setOngoing(true).setContentTitle(getString(R.string.dfu_status_disconnecting)).setContentText(getString(R.string.dfu_status_disconnecting_msg, deviceName))
+				builder.setOngoing(true).setContentTitle(getString(R.string.dfu_status_notification_updating_title)).setContentText(getString(R.string.dfu_status_notification_updating_msg, 100))
 						.setProgress(100, 0, true);
 				break;
 			case PROGRESS_COMPLETED:
-				builder.setOngoing(false).setContentTitle(getString(R.string.dfu_status_completed)).setSmallIcon(android.R.drawable.stat_sys_upload_done)
-						.setContentText(getString(R.string.dfu_status_completed_msg)).setAutoCancel(true).setColor(0xFF00B81A);
+				builder.setOngoing(false).setContentTitle(getString(R.string.dfu_status_notification_update_finished_title)).setSmallIcon(android.R.drawable.stat_sys_upload_done)
+						.setContentText(getString(R.string.dfu_status_notification_update_finished_title)).setAutoCancel(true).setColor(0xFF00B81A);
 				break;
 			case PROGRESS_ABORTED:
-				builder.setOngoing(false).setContentTitle(getString(R.string.dfu_status_aborted)).setSmallIcon(android.R.drawable.stat_sys_upload_done)
-						.setContentText(getString(R.string.dfu_status_aborted_msg)).setAutoCancel(true);
+				builder.setOngoing(false).setContentTitle(getString(R.string.dfu_status_notification_update_canceled_title)).setSmallIcon(android.R.drawable.stat_sys_upload_done)
+						.setContentText(getString(R.string.dfu_status_notification_update_canceled_title)).setAutoCancel(true);
 				break;
 			default:
 				if (progress >= ERROR_MASK) {
 					// progress is an error number
-					builder.setOngoing(false).setContentTitle(getString(R.string.dfu_status_error)).setSmallIcon(android.R.drawable.stat_sys_upload_done)
-							.setContentText(getString(R.string.dfu_status_error_msg)).setAutoCancel(true).setColor(Color.RED);
+					builder.setOngoing(false).setContentTitle(getString(R.string.dfu_status_notification_update_failed_title)).setSmallIcon(android.R.drawable.stat_sys_upload_done)
+							.setContentText(getString(R.string.dfu_status_notification_update_failed_title)).setAutoCancel(true).setColor(Color.RED);
 				} else {
 					// progress is in percents
-					final String title = mPartsTotal == 1 ? getString(R.string.dfu_status_uploading) : getString(R.string.dfu_status_uploading_part, mPartCurrent, mPartsTotal);
-					final String text = (mFileType & TYPE_APPLICATION) > 0 ? getString(R.string.dfu_status_uploading_msg, deviceName) : getString(R.string.dfu_status_uploading_components_msg, deviceName);
+					final String title = mPartsTotal == 1 ? getString(R.string.dfu_status_notification_updating_title) : getString(R.string.dfu_status_notification_updating_title);
+					final String text = (mFileType & TYPE_APPLICATION) > 0 ? getString(R.string.dfu_status_notification_updating_msg, progress) : getString(R.string.dfu_status_notification_updating_msg, progress);
 					builder.setOngoing(true).setContentTitle(title).setContentText(text).setProgress(100, progress, false);
 				}
 		}
@@ -2794,7 +2794,7 @@
 			final Intent abortIntent = new Intent(BROADCAST_ACTION);
 			abortIntent.putExtra(EXTRA_ACTION, ACTION_ABORT);
 			final PendingIntent pendingAbortIntent = PendingIntent.getBroadcast(this, 1, abortIntent, PendingIntent.FLAG_UPDATE_CURRENT);
-			builder.addAction(R.drawable.ic_action_notify_cancel, getString(R.string.dfu_action_abort), pendingAbortIntent);
+			builder.addAction(R.drawable.ic_action_notify_cancel, getString(R.string.dfu_action_cancel), pendingAbortIntent);
 		}
 
 		final NotificationManager manager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);