mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 744850. Only set isRegistered if registering succeeded. r=mfinkle
--HG-- extra : rebase_source : 3e921849ea2effe2efa500dac365e4818afda206
This commit is contained in:
parent
81d71fde1a
commit
9692b68d8f
@ -43,8 +43,11 @@ public class GeckoBatteryManager
|
||||
if (!isRegistered) {
|
||||
IntentFilter filter = new IntentFilter();
|
||||
filter.addAction(Intent.ACTION_BATTERY_CHANGED);
|
||||
activity.registerReceiver(this, filter);
|
||||
isRegistered = true;
|
||||
|
||||
// registerReciever can return null if registering fails
|
||||
isRegistered = activity.registerReceiver(this, filter) != null;
|
||||
if (!isRegistered)
|
||||
Log.e(LOGTAG, "Registering receiver failed");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -22,6 +22,8 @@ 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 IntentFilter mFilter;
|
||||
|
||||
private static boolean isRegistered = false;
|
||||
@ -50,8 +52,10 @@ public class GeckoConnectivityReceiver extends BroadcastReceiver {
|
||||
|
||||
public void registerFor(Activity activity) {
|
||||
if (!isRegistered) {
|
||||
activity.registerReceiver(this, mFilter);
|
||||
isRegistered = true;
|
||||
// registerReciever will return null if registering throws a RemoteException
|
||||
isRegistered = activity.registerReceiver(this, mFilter) != null;
|
||||
if (!isRegistered)
|
||||
Log.e(LOGTAG, "Registering receiver failed");
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user