mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-30 00:01:50 +00:00
Bug 719795 - Crash when GeckoSmsManager.init is called more than once [r=blassey,mounir]
This commit is contained in:
parent
d4c1ba6a7a
commit
1ea391744d
@ -414,7 +414,7 @@ abstract public class GeckoApp
|
||||
registerReceiver(mBatteryReceiver, batteryFilter);
|
||||
|
||||
if (SmsManager.getInstance() != null) {
|
||||
SmsManager.getInstance().init();
|
||||
SmsManager.getInstance().start();
|
||||
}
|
||||
|
||||
GeckoNetworkManager.getInstance().init();
|
||||
@ -580,7 +580,9 @@ abstract public class GeckoApp
|
||||
GeckoAppShell.sendEventToGecko(new GeckoEvent(GeckoEvent.ACTIVITY_SHUTDOWN));
|
||||
|
||||
if (SmsManager.getInstance() != null) {
|
||||
SmsManager.getInstance().shutdown();
|
||||
SmsManager.getInstance().stop();
|
||||
if (isFinishing())
|
||||
SmsManager.getInstance().shutdown();
|
||||
}
|
||||
|
||||
GeckoNetworkManager.getInstance().stop();
|
||||
|
@ -356,15 +356,17 @@ public class GeckoSmsManager
|
||||
|
||||
private final static String[] kRequiredMessageRows = new String[] { "_id", "address", "body", "date", "type" };
|
||||
|
||||
public void init() {
|
||||
public GeckoSmsManager() {
|
||||
SmsIOThread.getInstance().start();
|
||||
}
|
||||
|
||||
public void start() {
|
||||
IntentFilter smsFilter = new IntentFilter();
|
||||
smsFilter.addAction(GeckoSmsManager.ACTION_SMS_RECEIVED);
|
||||
smsFilter.addAction(GeckoSmsManager.ACTION_SMS_SENT);
|
||||
smsFilter.addAction(GeckoSmsManager.ACTION_SMS_DELIVERED);
|
||||
|
||||
GeckoApp.mAppContext.registerReceiver(this, smsFilter);
|
||||
|
||||
SmsIOThread.getInstance().start();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -925,9 +927,11 @@ public class GeckoSmsManager
|
||||
MessagesListManager.getInstance().remove(aListId);
|
||||
}
|
||||
|
||||
public void shutdown() {
|
||||
public void stop() {
|
||||
GeckoApp.mAppContext.unregisterReceiver(this);
|
||||
}
|
||||
|
||||
public void shutdown() {
|
||||
SmsIOThread.getInstance().interrupt();
|
||||
MessagesListManager.getInstance().clear();
|
||||
}
|
||||
|
@ -57,7 +57,8 @@ class SmsManager
|
||||
|
||||
interface ISmsManager
|
||||
{
|
||||
public void init();
|
||||
public void start();
|
||||
public void stop();
|
||||
public void shutdown();
|
||||
|
||||
public int getNumberOfMessagesForText(String aText);
|
||||
|
@ -1693,13 +1693,13 @@ abstract public class GeckoApp
|
||||
registerReceiver(mBatteryReceiver, batteryFilter);
|
||||
|
||||
if (SmsManager.getInstance() != null) {
|
||||
SmsManager.getInstance().init();
|
||||
SmsManager.getInstance().start();
|
||||
}
|
||||
|
||||
GeckoNetworkManager.getInstance().init();
|
||||
|
||||
final GeckoApp self = this;
|
||||
|
||||
|
||||
GeckoAppShell.getHandler().postDelayed(new Runnable() {
|
||||
public void run() {
|
||||
Log.w(LOGTAG, "zerdatime " + SystemClock.uptimeMillis() + " - pre checkLaunchState");
|
||||
@ -2016,7 +2016,9 @@ abstract public class GeckoApp
|
||||
mFavicons.close();
|
||||
|
||||
if (SmsManager.getInstance() != null) {
|
||||
SmsManager.getInstance().shutdown();
|
||||
SmsManager.getInstance().stop();
|
||||
if (isFinishing())
|
||||
SmsManager.getInstance().shutdown();
|
||||
}
|
||||
|
||||
GeckoNetworkManager.getInstance().stop();
|
||||
|
@ -356,15 +356,17 @@ public class GeckoSmsManager
|
||||
|
||||
private final static String[] kRequiredMessageRows = new String[] { "_id", "address", "body", "date", "type" };
|
||||
|
||||
public void init() {
|
||||
public GeckoSmsManager() {
|
||||
SmsIOThread.getInstance().start();
|
||||
}
|
||||
|
||||
public void start() {
|
||||
IntentFilter smsFilter = new IntentFilter();
|
||||
smsFilter.addAction(GeckoSmsManager.ACTION_SMS_RECEIVED);
|
||||
smsFilter.addAction(GeckoSmsManager.ACTION_SMS_SENT);
|
||||
smsFilter.addAction(GeckoSmsManager.ACTION_SMS_DELIVERED);
|
||||
|
||||
GeckoApp.mAppContext.registerReceiver(this, smsFilter);
|
||||
|
||||
SmsIOThread.getInstance().start();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -925,9 +927,11 @@ public class GeckoSmsManager
|
||||
MessagesListManager.getInstance().remove(aListId);
|
||||
}
|
||||
|
||||
public void shutdown() {
|
||||
public void stop() {
|
||||
GeckoApp.mAppContext.unregisterReceiver(this);
|
||||
}
|
||||
|
||||
public void shutdown() {
|
||||
SmsIOThread.getInstance().interrupt();
|
||||
MessagesListManager.getInstance().clear();
|
||||
}
|
||||
|
@ -57,7 +57,8 @@ class SmsManager
|
||||
|
||||
interface ISmsManager
|
||||
{
|
||||
public void init();
|
||||
public void start();
|
||||
public void stop();
|
||||
public void shutdown();
|
||||
|
||||
public int getNumberOfMessagesForText(String aText);
|
||||
|
Loading…
Reference in New Issue
Block a user