Bug 1279301 - Move notification classes to notification folder. r=jonalmeida

Moved notification classes to notification folder.  Refactored uses which added
imports to some Gecko classes as well as the Notification classes.  Added getter
to GeckoAppShell for access to static NotificationClient. Changed paths in
AndroidManifest.xml.in to reflect changes.

MozReview-Commit-ID: 2CUJa0YsV1V

--HG--
rename : mobile/android/base/java/org/mozilla/gecko/AppNotificationClient.java => mobile/android/base/java/org/mozilla/gecko/notifications/AppNotificationClient.java
rename : mobile/android/base/java/org/mozilla/gecko/NotificationClient.java => mobile/android/base/java/org/mozilla/gecko/notifications/NotificationClient.java
rename : mobile/android/base/java/org/mozilla/gecko/NotificationHandler.java => mobile/android/base/java/org/mozilla/gecko/notifications/NotificationHandler.java
rename : mobile/android/base/java/org/mozilla/gecko/NotificationHelper.java => mobile/android/base/java/org/mozilla/gecko/notifications/NotificationHelper.java
rename : mobile/android/base/java/org/mozilla/gecko/NotificationReceiver.java => mobile/android/base/java/org/mozilla/gecko/notifications/NotificationReceiver.java
rename : mobile/android/base/java/org/mozilla/gecko/NotificationService.java => mobile/android/base/java/org/mozilla/gecko/notifications/NotificationService.java
rename : mobile/android/base/java/org/mozilla/gecko/ServiceNotificationClient.java => mobile/android/base/java/org/mozilla/gecko/notifications/ServiceNotificationClient.java
extra : transplant_source : G%E6%AD%80%D9%29%BB%D1%24%96d%92%8Fz%95%07%09%28A%AD
This commit is contained in:
Broderick Stadden 2016-07-27 13:57:22 -10:00
parent 646f325157
commit 50b6d3d34a
14 changed files with 37 additions and 18 deletions

View File

@ -241,7 +241,7 @@
</receiver>
<receiver
android:name="org.mozilla.gecko.NotificationReceiver"
android:name="org.mozilla.gecko.notifications.NotificationReceiver"
android:exported="false">
<!-- Notification API V2 -->
<intent-filter>
@ -357,7 +357,7 @@
<service
android:exported="false"
android:name="org.mozilla.gecko.NotificationService">
android:name="org.mozilla.gecko.notifications.NotificationService">
</service>
<service

View File

@ -57,6 +57,8 @@ import org.mozilla.gecko.media.AudioFocusAgent;
import org.mozilla.gecko.menu.GeckoMenu;
import org.mozilla.gecko.menu.GeckoMenuItem;
import org.mozilla.gecko.mozglue.SafeIntent;
import org.mozilla.gecko.notifications.NotificationClient;
import org.mozilla.gecko.notifications.ServiceNotificationClient;
import org.mozilla.gecko.overlays.ui.ShareDialog;
import org.mozilla.gecko.permissions.Permissions;
import org.mozilla.gecko.preferences.ClearOnShutdownPref;

View File

@ -23,6 +23,9 @@ import org.mozilla.gecko.home.HomeConfig.PanelType;
import org.mozilla.gecko.menu.GeckoMenu;
import org.mozilla.gecko.menu.GeckoMenuInflater;
import org.mozilla.gecko.menu.MenuPanel;
import org.mozilla.gecko.notifications.AppNotificationClient;
import org.mozilla.gecko.notifications.NotificationClient;
import org.mozilla.gecko.notifications.NotificationHelper;
import org.mozilla.gecko.util.IntentUtils;
import org.mozilla.gecko.mozglue.SafeIntent;
import org.mozilla.gecko.mozglue.GeckoLoader;

View File

@ -33,6 +33,7 @@ import org.mozilla.gecko.AppConstants.Versions;
import org.mozilla.gecko.gfx.BitmapUtils;
import org.mozilla.gecko.gfx.LayerView;
import org.mozilla.gecko.gfx.PanZoomController;
import org.mozilla.gecko.notifications.NotificationClient;
import org.mozilla.gecko.permissions.Permissions;
import org.mozilla.gecko.util.EventCallback;
import org.mozilla.gecko.util.GeckoRequest;
@ -185,6 +186,10 @@ public class GeckoAppShell
// Accessed by NotificationHelper. This should be encapsulated.
/* package */ static NotificationClient notificationClient;
public static NotificationClient getNotificationClient() {
return notificationClient;
}
// See also HardwareUtils.LOW_MEMORY_THRESHOLD_MB.
private static final int HIGH_MEMORY_DEVICE_THRESHOLD_MB = 768;

View File

@ -21,6 +21,7 @@ import org.mozilla.gecko.dlc.DownloadContentService;
import org.mozilla.gecko.home.HomePanelsManager;
import org.mozilla.gecko.lwt.LightweightTheme;
import org.mozilla.gecko.mdns.MulticastDNSManager;
import org.mozilla.gecko.notifications.NotificationHelper;
import org.mozilla.gecko.util.Clipboard;
import org.mozilla.gecko.util.HardwareUtils;
import org.mozilla.gecko.util.ThreadUtils;

View File

@ -15,6 +15,7 @@ import android.util.Log;
import java.io.File;
import org.mozilla.gecko.notifications.ServiceNotificationClient;
import org.mozilla.gecko.util.NativeEventListener;
import org.mozilla.gecko.util.NativeJSObject;
import org.mozilla.gecko.util.EventCallback;

View File

@ -3,7 +3,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
package org.mozilla.gecko;
package org.mozilla.gecko.notifications;
import android.content.Context;

View File

@ -3,7 +3,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
package org.mozilla.gecko;
package org.mozilla.gecko.notifications;
import android.app.Notification;
import android.app.PendingIntent;

View File

@ -3,7 +3,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
package org.mozilla.gecko;
package org.mozilla.gecko.notifications;
import android.graphics.Bitmap;
@ -12,6 +12,8 @@ import android.app.PendingIntent;
import android.content.Context;
import android.support.v4.app.NotificationCompat;
import android.support.v4.app.NotificationManagerCompat;
import org.mozilla.gecko.R;
import org.mozilla.gecko.gfx.BitmapUtils;
import java.util.concurrent.ConcurrentHashMap;

View File

@ -3,7 +3,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
package org.mozilla.gecko;
package org.mozilla.gecko.notifications;
import java.util.HashMap;
import java.util.Iterator;
@ -11,6 +11,10 @@ import java.util.Iterator;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import org.mozilla.gecko.AppConstants;
import org.mozilla.gecko.EventDispatcher;
import org.mozilla.gecko.GeckoAppShell;
import org.mozilla.gecko.R;
import org.mozilla.gecko.gfx.BitmapUtils;
import org.mozilla.gecko.mozglue.SafeIntent;
import org.mozilla.gecko.util.GeckoEventListener;
@ -299,7 +303,7 @@ public final class NotificationHelper implements GeckoEventListener {
PendingIntent deletePendingIntent = buildNotificationPendingIntent(message, CLEARED_EVENT);
builder.setDeleteIntent(deletePendingIntent);
GeckoAppShell.notificationClient.add(id.hashCode(), builder.build());
GeckoAppShell.getNotificationClient().add(id.hashCode(), builder.build());
boolean persistent = message.optBoolean(PERSISTENT_ATTR);
// We add only not persistent notifications to the list since we want to purge only
@ -340,7 +344,7 @@ public final class NotificationHelper implements GeckoEventListener {
}
private void closeNotification(String id, String handlerKey, String cookie) {
GeckoAppShell.notificationClient.remove(id.hashCode());
GeckoAppShell.getNotificationClient().remove(id.hashCode());
sendNotificationWasClosed(id, handlerKey, cookie);
}

View File

@ -3,8 +3,9 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
package org.mozilla.gecko;
package org.mozilla.gecko.notifications;
import org.mozilla.gecko.GeckoThread;
import org.mozilla.gecko.mozglue.SafeIntent;
import android.content.BroadcastReceiver;

View File

@ -3,7 +3,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
package org.mozilla.gecko;
package org.mozilla.gecko.notifications;
import android.app.Notification;
import android.app.Service;

View File

@ -3,7 +3,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
package org.mozilla.gecko;
package org.mozilla.gecko.notifications;
import android.content.ComponentName;
import android.content.Context;

View File

@ -213,7 +213,6 @@ gbjar.sources += ['java/org/mozilla/gecko/' + x for x in [
'animation/Rotate3DAnimation.java',
'animation/ViewHelper.java',
'ANRReporter.java',
'AppNotificationClient.java',
'BaseGeckoInterface.java',
'BootReceiver.java',
'BrowserApp.java',
@ -483,12 +482,14 @@ gbjar.sources += ['java/org/mozilla/gecko/' + x for x in [
'menu/MenuPanel.java',
'menu/MenuPopup.java',
'MotionEventInterceptor.java',
'NotificationClient.java',
'NotificationHandler.java',
'NotificationHelper.java',
'NotificationReceiver.java',
'notifications/AppNotificationClient.java',
'notifications/NotificationClient.java',
'notifications/NotificationHandler.java',
'notifications/NotificationHelper.java',
'notifications/NotificationReceiver.java',
'notifications/NotificationService.java',
'notifications/ServiceNotificationClient.java',
'notifications/WhatsNewReceiver.java',
'NotificationService.java',
'NSSBridge.java',
'overlays/OverlayConstants.java',
'overlays/service/OverlayActionService.java',
@ -562,7 +563,6 @@ gbjar.sources += ['java/org/mozilla/gecko/' + x for x in [
'ScreenshotObserver.java',
'search/SearchEngine.java',
'search/SearchEngineManager.java',
'ServiceNotificationClient.java',
'SessionParser.java',
'SharedPreferencesHelper.java',
'SiteIdentity.java',