Bug 702858 - Do not stop listening to battery changes when in the background on Android. r=cjones

This commit is contained in:
Mounir Lamouri 2011-11-22 10:35:53 +01:00
parent 483054770c
commit 86c382cd4d

View File

@ -87,7 +87,6 @@ abstract public class GeckoApp
public Handler mMainHandler;
private IntentFilter mConnectivityFilter;
private BroadcastReceiver mConnectivityReceiver;
private IntentFilter mBatteryFilter;
private BroadcastReceiver mBatteryReceiver;
enum LaunchState {PreLaunch, Launching, WaitForDebugger,
@ -409,9 +408,10 @@ abstract public class GeckoApp
mConnectivityFilter.addAction(ConnectivityManager.CONNECTIVITY_ACTION);
mConnectivityReceiver = new GeckoConnectivityReceiver();
mBatteryFilter = new IntentFilter();
mBatteryFilter.addAction(Intent.ACTION_BATTERY_CHANGED);
IntentFilter batteryFilter = new IntentFilter();
batteryFilter.addAction(Intent.ACTION_BATTERY_CHANGED);
mBatteryReceiver = new GeckoBatteryManager();
registerReceiver(mBatteryReceiver, batteryFilter);
if (!checkAndSetLaunchState(LaunchState.PreLaunch,
LaunchState.Launching))
@ -505,7 +505,6 @@ abstract public class GeckoApp
super.onPause();
unregisterReceiver(mConnectivityReceiver);
unregisterReceiver(mBatteryReceiver);
}
@Override
@ -524,7 +523,6 @@ abstract public class GeckoApp
onNewIntent(getIntent());
registerReceiver(mConnectivityReceiver, mConnectivityFilter);
registerReceiver(mBatteryReceiver, mBatteryFilter);
}
@Override
@ -573,6 +571,8 @@ abstract public class GeckoApp
GeckoAppShell.sendEventToGecko(new GeckoEvent(GeckoEvent.ACTIVITY_SHUTDOWN));
super.onDestroy();
unregisterReceiver(mBatteryReceiver);
}
@Override