Verify backup can be decrypted as part of creation flow.

This commit is contained in:
Cody Henthorne
2022-08-08 12:28:10 -04:00
parent 5212b33b47
commit cfebd0eeb9
16 changed files with 430 additions and 253 deletions

View File

@@ -163,6 +163,28 @@ public final class GenericForegroundService extends Service {
ContextCompat.startForegroundService(context, intent);
}
synchronized void replaceTitle(int id, @NonNull String title) {
Entry oldEntry = allActiveMessages.get(id);
if (oldEntry == null) {
Log.w(TAG, "Failed to replace notification, it was not found");
return;
}
Entry newEntry = new Entry(title, oldEntry.channelId, oldEntry.iconRes, oldEntry.id, oldEntry.progressMax, oldEntry.progress, oldEntry.indeterminate);
if (oldEntry.equals(newEntry)) {
Log.d(TAG, String.format("handleReplace() skip, no change %s", newEntry));
return;
}
Log.i(TAG, String.format("handleReplace() %s", newEntry));
allActiveMessages.put(newEntry.id, newEntry);
updateNotification();
}
synchronized void replaceProgress(int id, int progressMax, int progress, boolean indeterminate) {
Entry oldEntry = allActiveMessages.get(id);

View File

@@ -67,6 +67,14 @@ public final class NotificationController implements AutoCloseable,
setProgress((int) newProgressMax, (int) newProgress, false);
}
public void replaceTitle(@NonNull String title) {
GenericForegroundService genericForegroundService = service.get();
if (genericForegroundService == null) return;
genericForegroundService.replaceTitle(id, title);
}
private synchronized void setProgress(int newProgressMax, int newProgress, boolean indeterminant) {
int newPercent = newProgressMax != 0 ? 100 * newProgress / newProgressMax : -1;