From f36d020ed4e7b363dae0b3d8c7bbb5ee7c483005 Mon Sep 17 00:00:00 2001 From: Wes Johnston Date: Fri, 2 Aug 2013 11:04:49 -0700 Subject: [PATCH] Bug 896350 - Don't close notifications unless explicitly requested to. r=blassey --- mobile/android/base/GeckoAppShell.java | 5 ----- mobile/android/base/NotificationHandler.java | 5 ----- mobile/android/chrome/content/downloads.js | 2 +- toolkit/components/alerts/nsAlertsService.cpp | 1 - widget/android/AndroidBridge.cpp | 4 +++- 5 files changed, 4 insertions(+), 13 deletions(-) diff --git a/mobile/android/base/GeckoAppShell.java b/mobile/android/base/GeckoAppShell.java index f61a7c192be2..5daa81a5623f 100644 --- a/mobile/android/base/GeckoAppShell.java +++ b/mobile/android/base/GeckoAppShell.java @@ -1283,11 +1283,6 @@ public class GeckoAppShell public static void alertsProgressListener_OnProgress(String aAlertName, long aProgress, long aProgressMax, String aAlertText) { int notificationID = aAlertName.hashCode(); sNotificationClient.update(notificationID, aProgress, aProgressMax, aAlertText); - - if (aProgress == aProgressMax) { - // Hide the notification at 100% - removeObserver(aAlertName); - } } public static void closeNotification(String aAlertName) { diff --git a/mobile/android/base/NotificationHandler.java b/mobile/android/base/NotificationHandler.java index 5ce7842a46e8..e3247a749f9c 100644 --- a/mobile/android/base/NotificationHandler.java +++ b/mobile/android/base/NotificationHandler.java @@ -102,11 +102,6 @@ public class NotificationHandler { if (mForegroundNotification == null && isOngoing(notification)) { setForegroundNotification(notificationID, notification); } - - // Hide the notification at 100% - if (aProgress == aProgressMax) { - remove(notificationID); - } } /** diff --git a/mobile/android/chrome/content/downloads.js b/mobile/android/chrome/content/downloads.js index bebd72f69ce4..069ab293941e 100644 --- a/mobile/android/chrome/content/downloads.js +++ b/mobile/android/chrome/content/downloads.js @@ -42,7 +42,7 @@ var Downloads = { let f = this._getLocalFile(fileUri); try { f.launch(); - } catch (ex) { + } catch (ex) { // in case we are not able to open the file (i.e. there is no app able to handle it) // we just open the browser tab showing it BrowserApp.addTab("about:downloads?id=" + guid); diff --git a/toolkit/components/alerts/nsAlertsService.cpp b/toolkit/components/alerts/nsAlertsService.cpp index f1e0781541f3..91e27bfa1410 100644 --- a/toolkit/components/alerts/nsAlertsService.cpp +++ b/toolkit/components/alerts/nsAlertsService.cpp @@ -86,7 +86,6 @@ NS_IMETHODIMP nsAlertsService::ShowAlertNotification(const nsAString & aImageUrl } #ifdef MOZ_WIDGET_ANDROID - mozilla::AndroidBridge::Bridge()->CloseNotification(aAlertName); mozilla::AndroidBridge::Bridge()->ShowAlertNotification(aImageUrl, aAlertTitle, aAlertText, aAlertCookie, aAlertListener, aAlertName); return NS_OK; diff --git a/widget/android/AndroidBridge.cpp b/widget/android/AndroidBridge.cpp index 35bda9e9f29e..af8d8a438499 100644 --- a/widget/android/AndroidBridge.cpp +++ b/widget/android/AndroidBridge.cpp @@ -707,8 +707,10 @@ AndroidBridge::ShowAlertNotification(const nsAString& aImageUrl, AutoLocalJNIFrame jniFrame(env); - if (nsAppShell::gAppShell && aAlertListener) + if (nsAppShell::gAppShell && aAlertListener) { + // This will remove any observers already registered for this id nsAppShell::gAppShell->AddObserver(aAlertName, aAlertListener); + } jvalue args[5]; args[0].l = NewJavaString(&jniFrame, aImageUrl);