mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 744850 - java.lang.IllegalArgumentException: Receiver not registered (ignore the crash) r=kats
This commit is contained in:
parent
a2126a563d
commit
0182d96930
@ -8,8 +8,6 @@ package org.mozilla.gecko;
|
||||
import java.lang.Math;
|
||||
import java.util.Date;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
@ -18,11 +16,12 @@ import android.content.IntentFilter;
|
||||
import android.os.BatteryManager;
|
||||
import android.os.Build;
|
||||
import android.os.SystemClock;
|
||||
import android.util.Log;
|
||||
|
||||
public class GeckoBatteryManager
|
||||
extends BroadcastReceiver
|
||||
{
|
||||
private static final String LOGTAG = "GeckoBatteryManager";
|
||||
private static final String LOGTAG = "GeckoBatteryManager";
|
||||
|
||||
// Those constants should be keep in sync with the ones in:
|
||||
// dom/battery/Constants.h
|
||||
@ -44,7 +43,7 @@ public class GeckoBatteryManager
|
||||
IntentFilter filter = new IntentFilter();
|
||||
filter.addAction(Intent.ACTION_BATTERY_CHANGED);
|
||||
|
||||
// registerReciever can return null if registering fails
|
||||
// registerReceiver can return null if registering fails
|
||||
isRegistered = activity.registerReceiver(this, filter) != null;
|
||||
if (!isRegistered)
|
||||
Log.e(LOGTAG, "Registering receiver failed");
|
||||
@ -53,7 +52,11 @@ public class GeckoBatteryManager
|
||||
|
||||
public void unregisterFor(Activity activity) {
|
||||
if (isRegistered) {
|
||||
activity.unregisterReceiver(this);
|
||||
try {
|
||||
activity.unregisterReceiver(this);
|
||||
} catch (IllegalArgumentException iae) {
|
||||
Log.e(LOGTAG, "Unregistering receiver failed", iae);
|
||||
}
|
||||
isRegistered = false;
|
||||
}
|
||||
}
|
||||
|
@ -5,8 +5,6 @@
|
||||
|
||||
package org.mozilla.gecko;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
@ -14,6 +12,7 @@ import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.net.ConnectivityManager;
|
||||
import android.net.NetworkInfo;
|
||||
import android.util.Log;
|
||||
|
||||
public class GeckoConnectivityReceiver extends BroadcastReceiver {
|
||||
/*
|
||||
@ -24,7 +23,7 @@ public class GeckoConnectivityReceiver extends BroadcastReceiver {
|
||||
private static final String LINK_DATA_DOWN = "down";
|
||||
private static final String LINK_DATA_UNKNOWN = "unknown";
|
||||
|
||||
private static final String LOGTAG = "GeckoConnectivityReciever";
|
||||
private static final String LOGTAG = "GeckoConnectivityReceiver";
|
||||
|
||||
private IntentFilter mFilter;
|
||||
|
||||
@ -54,7 +53,7 @@ public class GeckoConnectivityReceiver extends BroadcastReceiver {
|
||||
|
||||
public void registerFor(Activity activity) {
|
||||
if (!isRegistered) {
|
||||
// registerReciever will return null if registering throws a RemoteException
|
||||
// registerReciever will return null if registering fails
|
||||
isRegistered = activity.registerReceiver(this, mFilter) != null;
|
||||
if (!isRegistered)
|
||||
Log.e(LOGTAG, "Registering receiver failed");
|
||||
@ -63,7 +62,11 @@ public class GeckoConnectivityReceiver extends BroadcastReceiver {
|
||||
|
||||
public void unregisterFor(Activity activity) {
|
||||
if (isRegistered) {
|
||||
activity.unregisterReceiver(this);
|
||||
try {
|
||||
activity.unregisterReceiver(this);
|
||||
} catch (IllegalArgumentException iae) {
|
||||
Log.e(LOGTAG, "Unregistering receiver failed", iae);
|
||||
}
|
||||
isRegistered = false;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user