Bug 1066747: Fix strictmode violation in sharing service. r=rnewman
authorChris Kitching <chriskitching@linux.com>
Fri, 12 Sep 2014 11:08:26 -0700
changeset 205155 2bcd3d508fe4c2e197db49f32950000d93847b40
parent 205154 adba5a9030d360087468dbe8b1da55eaad09827a
child 205156 5da4f81fca8d0e6ba6df995021941b0052dcef00
push id49106
push userphilringnalda@gmail.com
push dateSat, 13 Sep 2014 17:12:34 +0000
treeherdermozilla-inbound@ab04d0f2665f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersrnewman
bugs1066747
milestone35.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1066747: Fix strictmode violation in sharing service. r=rnewman
mobile/android/base/overlays/service/OverlayActionService.java
--- a/mobile/android/base/overlays/service/OverlayActionService.java
+++ b/mobile/android/base/overlays/service/OverlayActionService.java
@@ -43,17 +43,17 @@ import static org.mozilla.gecko.overlays
  * * Neither of these incur a page fetch on the service... yet. That will require headless Gecko,
  *   something we're yet to have. Refactoring Gecko as a service itself and restructing the rest of
  *   the app to talk to it seems like the way to go there.
  */
 public class OverlayActionService extends Service {
     private static final String LOGTAG = "GeckoOverlayService";
 
     // Map used for selecting the appropriate helper object when handling a share.
-    private final Map<ShareMethod.Type, ShareMethod> shareTypes = new EnumMap<>(ShareMethod.Type.class);
+    final Map<ShareMethod.Type, ShareMethod> shareTypes = new EnumMap<>(ShareMethod.Type.class);
 
     // Map relating Strings representing share types to the corresponding ShareMethods.
     // Share methods are initialised (and shown in the UI) in the order they are given here.
     // This map is used to look up the appropriate ShareMethod when handling a request, as well as
     // for identifying which ShareMethod needs re-initialising in response to such an intent (which
     // will be necessary in situations such as the deletion of Sync accounts).
 
     // Not a bindable service.
@@ -83,22 +83,27 @@ public class OverlayActionService extend
         }
 
         return START_NOT_STICKY;
     }
 
     /**
      * Reinitialise all ShareMethods, causing them to broadcast any UI update events necessary.
      */
-    private void initShareMethods(Context context) {
-        shareTypes.clear();
+    private void initShareMethods(final Context context) {
+        ThreadUtils.postToBackgroundThread(new Runnable() {
+            @Override
+            public void run() {
+                shareTypes.clear();
 
-        shareTypes.put(ShareMethod.Type.ADD_BOOKMARK, new AddBookmark(context));
-        shareTypes.put(ShareMethod.Type.ADD_TO_READING_LIST, new AddToReadingList(context));
-        shareTypes.put(ShareMethod.Type.SEND_TAB, new SendTab(context));
+                shareTypes.put(ShareMethod.Type.ADD_BOOKMARK, new AddBookmark(context));
+                shareTypes.put(ShareMethod.Type.ADD_TO_READING_LIST, new AddToReadingList(context));
+                shareTypes.put(ShareMethod.Type.SEND_TAB, new SendTab(context));
+            }
+        });
     }
 
     public void handleShare(final Intent intent) {
         ThreadUtils.postToBackgroundThread(new Runnable() {
             @Override
             public void run() {
                 ShareData shareData;
                 try {