mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 863103 - Add BackgroundService.runIntentInService() utility method. r=rnewman
This commit is contained in:
parent
43321abf7e
commit
fb8072844c
@ -27,6 +27,13 @@ public abstract class BackgroundService extends IntentService {
|
||||
super(threadName);
|
||||
}
|
||||
|
||||
public static void runIntentInService(Context context, Intent intent, Class<? extends BackgroundService> serviceClass) {
|
||||
Intent service = new Intent(context, serviceClass);
|
||||
service.setAction(intent.getAction());
|
||||
service.putExtras(intent);
|
||||
context.startService(service);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the OS will allow us to perform background
|
||||
* data operations. This logic varies by OS version.
|
||||
|
@ -4,6 +4,8 @@
|
||||
|
||||
package org.mozilla.gecko.background.announcements;
|
||||
|
||||
import org.mozilla.gecko.background.BackgroundService;
|
||||
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
@ -28,9 +30,6 @@ public class AnnouncementsBroadcastReceiver extends BroadcastReceiver {
|
||||
return;
|
||||
}
|
||||
|
||||
Intent service = new Intent(context, AnnouncementsBroadcastService.class);
|
||||
service.putExtras(intent);
|
||||
service.setAction(intent.getAction());
|
||||
context.startService(service);
|
||||
BackgroundService.runIntentInService(context, intent, AnnouncementsBroadcastService.class);
|
||||
}
|
||||
}
|
||||
|
@ -4,6 +4,7 @@
|
||||
|
||||
package org.mozilla.gecko.background.announcements;
|
||||
|
||||
import org.mozilla.gecko.background.BackgroundService;
|
||||
import org.mozilla.gecko.background.common.log.Logger;
|
||||
|
||||
import android.content.BroadcastReceiver;
|
||||
@ -24,7 +25,6 @@ public class AnnouncementsStartReceiver extends BroadcastReceiver {
|
||||
}
|
||||
|
||||
Logger.debug(LOG_TAG, "AnnouncementsStartReceiver.onReceive().");
|
||||
Intent service = new Intent(context, AnnouncementsService.class);
|
||||
context.startService(service);
|
||||
BackgroundService.runIntentInService(context, intent, AnnouncementsService.class);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user