Pass on incoming messages until DB is imported.

This commit is contained in:
Moxie Marlinspike 2013-02-17 15:07:37 -08:00
parent 5eb04328d3
commit 1ff4fd842c
2 changed files with 27 additions and 20 deletions

View File

@ -16,13 +16,6 @@
*/ */
package org.thoughtcrime.securesms.service; package org.thoughtcrime.securesms.service;
import org.thoughtcrime.securesms.ApplicationPreferencesActivity;
import org.thoughtcrime.securesms.protocol.WirePrefix;
import ws.com.google.android.mms.pdu.GenericPdu;
import ws.com.google.android.mms.pdu.NotificationInd;
import ws.com.google.android.mms.pdu.PduHeaders;
import ws.com.google.android.mms.pdu.PduParser;
import android.content.BroadcastReceiver; import android.content.BroadcastReceiver;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
@ -30,12 +23,23 @@ import android.os.Build;
import android.preference.PreferenceManager; import android.preference.PreferenceManager;
import android.util.Log; import android.util.Log;
import org.thoughtcrime.securesms.ApplicationPreferencesActivity;
import org.thoughtcrime.securesms.protocol.WirePrefix;
import ws.com.google.android.mms.pdu.GenericPdu;
import ws.com.google.android.mms.pdu.NotificationInd;
import ws.com.google.android.mms.pdu.PduHeaders;
import ws.com.google.android.mms.pdu.PduParser;
public class MmsListener extends BroadcastReceiver { public class MmsListener extends BroadcastReceiver {
private boolean isRelevent(Context context, Intent intent) { private boolean isRelevent(Context context, Intent intent) {
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.DONUT) if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.DONUT)
return false; return false;
if (!ApplicationMigrationService.isDatabaseImported(context))
return false;
if (PreferenceManager.getDefaultSharedPreferences(context).getBoolean(ApplicationPreferencesActivity.ALL_MMS_PERF, true)) if (PreferenceManager.getDefaultSharedPreferences(context).getBoolean(ApplicationPreferencesActivity.ALL_MMS_PERF, true))
return true; return true;

View File

@ -82,6 +82,9 @@ public class SmsListener extends BroadcastReceiver {
if (isExemption(message, messageBody)) if (isExemption(message, messageBody))
return false; return false;
if (!ApplicationMigrationService.isDatabaseImported(context))
return false;
if (PreferenceManager.getDefaultSharedPreferences(context).getBoolean("pref_all_sms", true)) if (PreferenceManager.getDefaultSharedPreferences(context).getBoolean("pref_all_sms", true))
return true; return true;