Run MailboxAlarmReceiver's code in a background thread

* Fixes 2313077
* Broadcast receivers are run in the UI thread, so we must ensure that
  any long-running code is executed in a background thread

Change-Id: I9a3d501a308445a84a1baa99fc6abb9feb56ff2d
This commit is contained in:
Marc Blank 2009-12-10 09:20:58 -08:00
parent e312c12b74
commit 079589641a

View File

@ -50,8 +50,16 @@ public class EmailSyncAlarmReceiver extends BroadcastReceiver {
private static String TAG = "EmailSyncAlarm";
@Override
public void onReceive(Context context, Intent intent) {
public void onReceive(final Context context, Intent intent) {
Log.v(TAG, "onReceive");
new Thread(new Runnable() {
public void run() {
handleReceive(context);
}
}).start();
}
private void handleReceive(Context context) {
ArrayList<Long> mailboxesToNotify = new ArrayList<Long>();
ContentResolver cr = context.getContentResolver();
int messageCount = 0;