mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1221270 - Turn GeckoService into an IntentService; r=snorp
We want GeckoService to handle intents from the system, e.g. an intent from the alarm manager.
This commit is contained in:
parent
74919cf92f
commit
80593ca4e1
@ -5,34 +5,55 @@
|
||||
|
||||
package org.mozilla.gecko;
|
||||
|
||||
import android.app.Service;
|
||||
import android.app.IntentService;
|
||||
import android.content.Intent;
|
||||
import android.os.IBinder;
|
||||
import android.util.Log;
|
||||
|
||||
public class GeckoService extends IntentService {
|
||||
|
||||
public class GeckoService extends Service {
|
||||
private static final String LOGTAG = "GeckoService";
|
||||
private static final boolean DEBUG = false;
|
||||
|
||||
@Override
|
||||
|
||||
public GeckoService() {
|
||||
super("GeckoService");
|
||||
}
|
||||
|
||||
@Override // Service
|
||||
public void onCreate() {
|
||||
GeckoAppShell.ensureCrashHandling();
|
||||
GeckoAppShell.setApplicationContext(getApplicationContext());
|
||||
|
||||
super.onCreate();
|
||||
|
||||
if (DEBUG) {
|
||||
Log.d(LOGTAG, "Created");
|
||||
}
|
||||
GeckoThread.ensureInit(/* args */ null, /* action */ null);
|
||||
GeckoThread.launch();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Override // Service
|
||||
public void onDestroy() {
|
||||
// TODO: Make sure Gecko is in a somewhat idle state
|
||||
// because our process could be killed at anytime.
|
||||
|
||||
if (DEBUG) {
|
||||
Log.d(LOGTAG, "Destroyed");
|
||||
}
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBinder onBind(Intent intent) {
|
||||
return null;
|
||||
@Override // IntentService
|
||||
protected void onHandleIntent(final Intent intent) {
|
||||
|
||||
if (intent == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
// We are on the intent service worker thread.
|
||||
if (DEBUG) {
|
||||
Log.d(LOGTAG, "Handling " + intent.getAction());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user