diff --git a/mobile/android/base/webapp/EventListener.java b/mobile/android/base/webapp/EventListener.java index 2312d1bd3a74..07537f21c0dc 100644 --- a/mobile/android/base/webapp/EventListener.java +++ b/mobile/android/base/webapp/EventListener.java @@ -5,6 +5,33 @@ package org.mozilla.gecko.webapp; +import org.mozilla.gecko.ActivityHandlerHelper; +import org.mozilla.gecko.AppConstants; +import org.mozilla.gecko.GeckoAppShell; +import org.mozilla.gecko.GeckoEvent; +import org.mozilla.gecko.GeckoProfile; +import org.mozilla.gecko.favicons.decoders.FaviconDecoder; +import org.mozilla.gecko.gfx.BitmapUtils; +import org.mozilla.gecko.util.ActivityResultHandler; +import org.mozilla.gecko.EventDispatcher; +import org.mozilla.gecko.util.EventCallback; +import org.mozilla.gecko.util.NativeEventListener; +import org.mozilla.gecko.util.NativeJSObject; +import org.mozilla.gecko.util.ThreadUtils; +import org.mozilla.gecko.WebappAllocator; + +import android.app.Activity; +import android.app.ActivityManager; +import android.content.Context; +import android.content.Intent; +import android.content.IntentFilter; +import android.content.pm.ApplicationInfo; +import android.content.pm.PackageManager; +import android.content.pm.PackageManager.NameNotFoundException; +import android.graphics.Bitmap; +import android.net.Uri; +import android.util.Log; + import java.io.File; import java.util.Arrays; import java.util.HashSet; @@ -13,25 +40,6 @@ import java.util.Set; import org.json.JSONException; import org.json.JSONObject; -import org.mozilla.gecko.ActivityHandlerHelper; -import org.mozilla.gecko.EventDispatcher; -import org.mozilla.gecko.GeckoAppShell; -import org.mozilla.gecko.GeckoProfile; -import org.mozilla.gecko.util.ActivityResultHandler; -import org.mozilla.gecko.util.EventCallback; -import org.mozilla.gecko.util.NativeEventListener; -import org.mozilla.gecko.util.NativeJSObject; -import org.mozilla.gecko.util.ThreadUtils; - -import android.app.Activity; -import android.app.ActivityManager; -import android.content.Context; -import android.content.Intent; -import android.content.IntentFilter; -import android.content.pm.ApplicationInfo; -import android.content.pm.PackageManager; -import android.net.Uri; -import android.util.Log; public class EventListener implements NativeEventListener { diff --git a/mobile/android/base/webapp/InstallHelper.java b/mobile/android/base/webapp/InstallHelper.java index 8f60f5ea2d57..eda6d8b0dddd 100644 --- a/mobile/android/base/webapp/InstallHelper.java +++ b/mobile/android/base/webapp/InstallHelper.java @@ -19,9 +19,7 @@ import org.mozilla.gecko.GeckoAppShell; import org.mozilla.gecko.GeckoEvent; import org.mozilla.gecko.GeckoProfile; import org.mozilla.gecko.gfx.BitmapUtils; -import org.mozilla.gecko.util.EventCallback; -import org.mozilla.gecko.util.NativeEventListener; -import org.mozilla.gecko.util.NativeJSObject; +import org.mozilla.gecko.util.GeckoEventListener; import org.mozilla.gecko.util.ThreadUtils; import android.content.Context; @@ -29,7 +27,7 @@ import android.graphics.Bitmap; import android.net.Uri; import android.util.Log; -public class InstallHelper implements NativeEventListener { +public class InstallHelper implements GeckoEventListener { private static final String LOGTAG = "GeckoWebappInstallHelper"; private static final String[] INSTALL_EVENT_NAMES = new String[] {"Webapps:Postinstall"}; private final Context mContext; @@ -38,7 +36,7 @@ public class InstallHelper implements NativeEventListener { public static interface InstallCallback { // on the GeckoThread - void installCompleted(InstallHelper installHelper, String event, NativeJSObject message); + void installCompleted(InstallHelper installHelper, String event, JSONObject message); // on the GeckoBackgroundThread void installErrored(InstallHelper installHelper, Exception exception); @@ -164,7 +162,7 @@ public class InstallHelper implements NativeEventListener { } @Override - public void handleMessage(String event, NativeJSObject message, EventCallback callback) { + public void handleMessage(String event, JSONObject message) { EventDispatcher.getInstance().unregisterGeckoThreadListener(this, INSTALL_EVENT_NAMES); if (mCallback != null) { diff --git a/mobile/android/base/webapp/WebappImpl.java b/mobile/android/base/webapp/WebappImpl.java index 7dceb19d9408..5adc670b59f1 100644 --- a/mobile/android/base/webapp/WebappImpl.java +++ b/mobile/android/base/webapp/WebappImpl.java @@ -18,7 +18,6 @@ import org.mozilla.gecko.GeckoThread; import org.mozilla.gecko.R; import org.mozilla.gecko.Tab; import org.mozilla.gecko.Tabs; -import org.mozilla.gecko.util.NativeJSObject; import org.mozilla.gecko.webapp.InstallHelper.InstallCallback; import android.content.Intent; @@ -326,13 +325,13 @@ public class WebappImpl extends GeckoApp implements InstallCallback { } @Override - public void installCompleted(InstallHelper installHelper, String event, NativeJSObject message) { + public void installCompleted(InstallHelper installHelper, String event, JSONObject message) { if (event == null) { return; } if (event.equals("Webapps:Postinstall")) { - String origin = message.optString("origin", null); + String origin = message.optString("origin"); launchWebapp(origin); } }