mirror of
https://github.com/oxen-io/session-android.git
synced 2025-08-13 18:41:30 +00:00
Finish KitKat compatibility details.
1) The system does actually enforce having a BROADCAST_SMS permission on the SMS receiver. Break out the "delivered" parts of this into a separate Receiver, so the permission won't trip up GB devices. 2) The system does actually enforce having "quick response" intents. Add a no-op for now. 3) Add a "make default" prompt. 4) Update settings to reflect what's going on in KitKat.
This commit is contained in:
@@ -172,6 +172,20 @@
|
|||||||
<service android:enabled="true" android:name=".service.RegistrationService"/>
|
<service android:enabled="true" android:name=".service.RegistrationService"/>
|
||||||
<service android:enabled="true" android:name=".gcm.GcmIntentService"/>
|
<service android:enabled="true" android:name=".gcm.GcmIntentService"/>
|
||||||
|
|
||||||
|
<service android:name=".service.QuickResponseService"
|
||||||
|
android:permission="android.permission.SEND_RESPOND_VIA_MESSAGE"
|
||||||
|
android:exported="true" >
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.RESPOND_VIA_MESSAGE" />
|
||||||
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
|
<data android:scheme="sms" />
|
||||||
|
<data android:scheme="smsto" />
|
||||||
|
<data android:scheme="mms" />
|
||||||
|
<data android:scheme="mmsto" />
|
||||||
|
</intent-filter>
|
||||||
|
</service>
|
||||||
|
|
||||||
|
|
||||||
<!-- <receiver android:name=".service.BootListener" -->
|
<!-- <receiver android:name=".service.BootListener" -->
|
||||||
<!-- android:enabled="true" -->
|
<!-- android:enabled="true" -->
|
||||||
<!-- android:exported="false">-->
|
<!-- android:exported="false">-->
|
||||||
@@ -189,6 +203,7 @@
|
|||||||
</receiver>
|
</receiver>
|
||||||
|
|
||||||
<receiver android:name=".service.SmsListener"
|
<receiver android:name=".service.SmsListener"
|
||||||
|
android:permission="android.permission.BROADCAST_SMS"
|
||||||
android:enabled="true"
|
android:enabled="true"
|
||||||
android:exported="true">
|
android:exported="true">
|
||||||
<intent-filter android:priority="1001">
|
<intent-filter android:priority="1001">
|
||||||
@@ -197,9 +212,13 @@
|
|||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.provider.Telephony.SMS_DELIVER"/>
|
<action android:name="android.provider.Telephony.SMS_DELIVER"/>
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
<intent-filter>
|
</receiver>
|
||||||
<action android:name="org.thoughtcrime.securesms.services.MESSAGE_SENT"/>
|
|
||||||
</intent-filter>
|
<receiver android:name=".service.SmsDeliveryListener"
|
||||||
|
android:exported="true">
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="org.thoughtcrime.securesms.services.MESSAGE_SENT"/>
|
||||||
|
</intent-filter>
|
||||||
</receiver>
|
</receiver>
|
||||||
|
|
||||||
<receiver android:name=".service.MmsListener"
|
<receiver android:name=".service.MmsListener"
|
||||||
|
@@ -278,7 +278,10 @@
|
|||||||
|
|
||||||
<!-- SmsReceiver -->
|
<!-- SmsReceiver -->
|
||||||
<string name="SmsReceiver_currently_unable_to_send_your_sms_message">Currently unable to send your SMS message. It will be sent once service becomes available.</string>
|
<string name="SmsReceiver_currently_unable_to_send_your_sms_message">Currently unable to send your SMS message. It will be sent once service becomes available.</string>
|
||||||
|
|
||||||
|
<!-- QuickResponseService -->
|
||||||
|
<string name="QuickResponseService_sorry_quick_response_is_not_yet_supported_by_textsecure">Sorry, Quick Response is not yet supported by TextSecure! =(</string>
|
||||||
|
|
||||||
<!-- auto_initiate_activity -->
|
<!-- auto_initiate_activity -->
|
||||||
<string name="auto_initiate_activity__you_have_received_a_message_from_someone_who_supports_textsecure_encrypted_sessions_would_you_like_to_initiate_a_secure_session">You have received a message from someone who supports TextSecure encrypted sessions. Would you like to initiate a secure session?</string>
|
<string name="auto_initiate_activity__you_have_received_a_message_from_someone_who_supports_textsecure_encrypted_sessions_would_you_like_to_initiate_a_secure_session">You have received a message from someone who supports TextSecure encrypted sessions. Would you like to initiate a secure session?</string>
|
||||||
<string name="auto_initiate_activity__initiate_exchange">Initiate Exchange</string>
|
<string name="auto_initiate_activity__initiate_exchange">Initiate Exchange</string>
|
||||||
@@ -482,6 +485,8 @@
|
|||||||
<string name="preferences__theme">Theme</string>
|
<string name="preferences__theme">Theme</string>
|
||||||
<string name="preferences__default">Default</string>
|
<string name="preferences__default">Default</string>
|
||||||
<string name="preferences__language">Language</string>
|
<string name="preferences__language">Language</string>
|
||||||
|
<string name="preferences__make_default_sms_app">Make Default SMS App</string>
|
||||||
|
<string name="preferences__make_textsecure_the_default_sms_mms_app">Make TextSecure the default SMS/MMS app for your system.</string>
|
||||||
|
|
||||||
<!-- **************************************** -->
|
<!-- **************************************** -->
|
||||||
<!-- menus -->
|
<!-- menus -->
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
|
||||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
|
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
<PreferenceCategory android:title="@string/preferences__general">
|
<PreferenceCategory android:key="general_category" android:title="@string/preferences__general">
|
||||||
<CheckBoxPreference android:defaultValue="true"
|
<CheckBoxPreference android:defaultValue="true"
|
||||||
android:key="pref_all_sms"
|
android:key="pref_all_sms"
|
||||||
android:summary="@string/preferences__use_textsecure_for_viewing_and_storing_all_incoming_text_messages"
|
android:summary="@string/preferences__use_textsecure_for_viewing_and_storing_all_incoming_text_messages"
|
||||||
@@ -12,6 +12,10 @@
|
|||||||
android:summary="@string/preferences__use_textsecure_for_viewing_and_storing_all_incoming_multimedia_messages"
|
android:summary="@string/preferences__use_textsecure_for_viewing_and_storing_all_incoming_multimedia_messages"
|
||||||
android:title="@string/preferences__pref_all_mms_title" />
|
android:title="@string/preferences__pref_all_mms_title" />
|
||||||
|
|
||||||
|
<Preference android:key="pref_set_default"
|
||||||
|
android:title="@string/preferences__make_default_sms_app"
|
||||||
|
android:summary="@string/preferences__make_textsecure_the_default_sms_mms_app" />
|
||||||
|
|
||||||
<CheckBoxPreference android:defaultValue="false"
|
<CheckBoxPreference android:defaultValue="false"
|
||||||
android:key="pref_delivery_report_sms"
|
android:key="pref_delivery_report_sms"
|
||||||
android:summary="@string/preferences__request_a_delivery_report_for_each_sms_message_you_send"
|
android:summary="@string/preferences__request_a_delivery_report_for_each_sms_message_you_send"
|
||||||
@@ -112,7 +116,7 @@
|
|||||||
android:title="@string/preferences__trim_all_threads_now"
|
android:title="@string/preferences__trim_all_threads_now"
|
||||||
android:summary="@string/preferences__scan_through_all_conversation_threads_and_enforce_conversation_length_limits"
|
android:summary="@string/preferences__scan_through_all_conversation_threads_and_enforce_conversation_length_limits"
|
||||||
android:dependency="pref_trim_threads" />
|
android:dependency="pref_trim_threads" />
|
||||||
|
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
|
|
||||||
<PreferenceCategory android:title="@string/preferences__display_settings" android:key="pref_display_category">
|
<PreferenceCategory android:title="@string/preferences__display_settings" android:key="pref_display_category">
|
||||||
|
@@ -22,13 +22,16 @@ import android.content.DialogInterface;
|
|||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.preference.CheckBoxPreference;
|
import android.preference.CheckBoxPreference;
|
||||||
import android.preference.EditTextPreference;
|
import android.preference.EditTextPreference;
|
||||||
import android.preference.Preference;
|
import android.preference.Preference;
|
||||||
|
import android.preference.PreferenceGroup;
|
||||||
import android.preference.PreferenceManager;
|
import android.preference.PreferenceManager;
|
||||||
import android.preference.PreferenceScreen;
|
import android.preference.PreferenceScreen;
|
||||||
import android.provider.ContactsContract;
|
import android.provider.ContactsContract;
|
||||||
|
import android.provider.Telephony;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
@@ -42,6 +45,7 @@ import org.thoughtcrime.securesms.util.DynamicLanguage;
|
|||||||
import org.thoughtcrime.securesms.util.DynamicTheme;
|
import org.thoughtcrime.securesms.util.DynamicTheme;
|
||||||
import org.thoughtcrime.securesms.util.MemoryCleaner;
|
import org.thoughtcrime.securesms.util.MemoryCleaner;
|
||||||
import org.thoughtcrime.securesms.util.Trimmer;
|
import org.thoughtcrime.securesms.util.Trimmer;
|
||||||
|
import org.thoughtcrime.securesms.util.Util;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Activity for application preference display and management.
|
* The Activity for application preference display and management.
|
||||||
@@ -65,7 +69,9 @@ public class ApplicationPreferencesActivity extends PassphraseRequiredSherlockPr
|
|||||||
public static final String LED_BLINK_PREF = "pref_led_blink";
|
public static final String LED_BLINK_PREF = "pref_led_blink";
|
||||||
public static final String LED_BLINK_PREF_CUSTOM = "pref_led_blink_custom";
|
public static final String LED_BLINK_PREF_CUSTOM = "pref_led_blink_custom";
|
||||||
public static final String IDENTITY_PREF = "pref_choose_identity";
|
public static final String IDENTITY_PREF = "pref_choose_identity";
|
||||||
|
public static final String ALL_SMS_PREF = "pref_all_sms";
|
||||||
public static final String ALL_MMS_PERF = "pref_all_mms";
|
public static final String ALL_MMS_PERF = "pref_all_mms";
|
||||||
|
public static final String KITKAT_DEFAULT_PREF = "pref_set_default";
|
||||||
public static final String PASSPHRASE_TIMEOUT_INTERVAL_PREF = "pref_timeout_interval";
|
public static final String PASSPHRASE_TIMEOUT_INTERVAL_PREF = "pref_timeout_interval";
|
||||||
public static final String PASSPHRASE_TIMEOUT_PREF = "pref_timeout_passphrase";
|
public static final String PASSPHRASE_TIMEOUT_PREF = "pref_timeout_passphrase";
|
||||||
public static final String AUTO_KEY_EXCHANGE_PREF = "pref_auto_complete_key_exchange";
|
public static final String AUTO_KEY_EXCHANGE_PREF = "pref_auto_complete_key_exchange";
|
||||||
@@ -110,6 +116,7 @@ public class ApplicationPreferencesActivity extends PassphraseRequiredSherlockPr
|
|||||||
addPreferencesFromResource(R.xml.preferences);
|
addPreferencesFromResource(R.xml.preferences);
|
||||||
|
|
||||||
initializeIdentitySelection();
|
initializeIdentitySelection();
|
||||||
|
initializePlatformSpecificOptions();
|
||||||
|
|
||||||
this.findPreference(CHANGE_PASSPHRASE_PREF)
|
this.findPreference(CHANGE_PASSPHRASE_PREF)
|
||||||
.setOnPreferenceClickListener(new ChangePassphraseClickListener());
|
.setOnPreferenceClickListener(new ChangePassphraseClickListener());
|
||||||
@@ -176,6 +183,27 @@ public class ApplicationPreferencesActivity extends PassphraseRequiredSherlockPr
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void initializePlatformSpecificOptions() {
|
||||||
|
PreferenceGroup generalCategory = (PreferenceGroup)findPreference("general_category");
|
||||||
|
Preference defaultPreference = findPreference(KITKAT_DEFAULT_PREF);
|
||||||
|
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
|
||||||
|
generalCategory.removePreference(findPreference(ALL_SMS_PREF));
|
||||||
|
generalCategory.removePreference(findPreference(ALL_MMS_PERF));
|
||||||
|
|
||||||
|
if (Util.isDefaultSmsProvider(this)) {
|
||||||
|
generalCategory.removePreference(defaultPreference);
|
||||||
|
} else {
|
||||||
|
Intent intent = new Intent(Telephony.Sms.Intents.ACTION_CHANGE_DEFAULT);
|
||||||
|
intent.putExtra(Telephony.Sms.Intents.EXTRA_PACKAGE_NAME, getPackageName());
|
||||||
|
|
||||||
|
defaultPreference.setIntent(intent);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
generalCategory.removePreference(defaultPreference);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void initializeIdentitySelection() {
|
private void initializeIdentitySelection() {
|
||||||
ContactIdentityManager identity = ContactIdentityManager.getInstance(this);
|
ContactIdentityManager identity = ContactIdentityManager.getInstance(this);
|
||||||
|
|
||||||
|
@@ -6,7 +6,9 @@ import android.database.ContentObserver;
|
|||||||
import android.os.AsyncTask;
|
import android.os.AsyncTask;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.preference.PreferenceManager;
|
||||||
import android.provider.ContactsContract;
|
import android.provider.ContactsContract;
|
||||||
|
import android.provider.Telephony;
|
||||||
import android.support.v4.view.GravityCompat;
|
import android.support.v4.view.GravityCompat;
|
||||||
import android.support.v4.widget.DrawerLayout;
|
import android.support.v4.widget.DrawerLayout;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
@@ -19,7 +21,7 @@ import android.widget.SimpleAdapter;
|
|||||||
import com.actionbarsherlock.view.Menu;
|
import com.actionbarsherlock.view.Menu;
|
||||||
import com.actionbarsherlock.view.MenuInflater;
|
import com.actionbarsherlock.view.MenuInflater;
|
||||||
import com.actionbarsherlock.view.MenuItem;
|
import com.actionbarsherlock.view.MenuItem;
|
||||||
import org.thoughtcrime.securesms.crypto.IdentityKeyUtil;
|
|
||||||
import org.thoughtcrime.securesms.crypto.MasterSecret;
|
import org.thoughtcrime.securesms.crypto.MasterSecret;
|
||||||
import org.thoughtcrime.securesms.database.DatabaseFactory;
|
import org.thoughtcrime.securesms.database.DatabaseFactory;
|
||||||
import org.thoughtcrime.securesms.database.ThreadDatabase;
|
import org.thoughtcrime.securesms.database.ThreadDatabase;
|
||||||
@@ -31,6 +33,7 @@ import org.thoughtcrime.securesms.service.SendReceiveService;
|
|||||||
import org.thoughtcrime.securesms.util.DynamicLanguage;
|
import org.thoughtcrime.securesms.util.DynamicLanguage;
|
||||||
import org.thoughtcrime.securesms.util.DynamicTheme;
|
import org.thoughtcrime.securesms.util.DynamicTheme;
|
||||||
import org.thoughtcrime.securesms.util.MemoryCleaner;
|
import org.thoughtcrime.securesms.util.MemoryCleaner;
|
||||||
|
import org.thoughtcrime.securesms.util.Util;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@@ -68,6 +71,8 @@ public class ConversationListActivity extends PassphraseRequiredSherlockFragment
|
|||||||
super.onResume();
|
super.onResume();
|
||||||
dynamicTheme.onResume(this);
|
dynamicTheme.onResume(this);
|
||||||
dynamicLanguage.onResume(this);
|
dynamicLanguage.onResume(this);
|
||||||
|
|
||||||
|
initializeDefaultMessengerCheck();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -254,4 +259,17 @@ public class ConversationListActivity extends PassphraseRequiredSherlockFragment
|
|||||||
this.fragment.setMasterSecret(masterSecret);
|
this.fragment.setMasterSecret(masterSecret);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void initializeDefaultMessengerCheck() {
|
||||||
|
if (!Util.isDefaultSmsProvider(this) &&
|
||||||
|
!(PreferenceManager.getDefaultSharedPreferences(this)
|
||||||
|
.getBoolean("pref_prompted_default_sms", false)))
|
||||||
|
{
|
||||||
|
PreferenceManager.getDefaultSharedPreferences(this).edit()
|
||||||
|
.putBoolean("pref_prompted_default_sms", true).commit();
|
||||||
|
Intent intent = new Intent(Telephony.Sms.Intents.ACTION_CHANGE_DEFAULT);
|
||||||
|
intent.putExtra(Telephony.Sms.Intents.EXTRA_PACKAGE_NAME, getPackageName());
|
||||||
|
startActivity(intent);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
@@ -0,0 +1,31 @@
|
|||||||
|
package org.thoughtcrime.securesms.service;
|
||||||
|
|
||||||
|
import android.app.Service;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.os.IBinder;
|
||||||
|
import android.telephony.TelephonyManager;
|
||||||
|
import android.util.Log;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import org.thoughtcrime.securesms.R;
|
||||||
|
|
||||||
|
public class QuickResponseService extends Service {
|
||||||
|
|
||||||
|
public int onStartCommand(Intent intent, int flags, int startId) {
|
||||||
|
if (!TelephonyManager.ACTION_RESPOND_VIA_MESSAGE.equals(intent.getAction())) {
|
||||||
|
Log.w("QuickResponseService", "Received unknown intent: " + intent.getAction());
|
||||||
|
return START_NOT_STICKY;
|
||||||
|
}
|
||||||
|
|
||||||
|
Toast.makeText(this,
|
||||||
|
getString(R.string.QuickResponseService_sorry_quick_response_is_not_yet_supported_by_textsecure),
|
||||||
|
Toast.LENGTH_LONG).show();
|
||||||
|
|
||||||
|
return START_NOT_STICKY;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IBinder onBind(Intent intent) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,21 @@
|
|||||||
|
package org.thoughtcrime.securesms.service;
|
||||||
|
|
||||||
|
import android.content.BroadcastReceiver;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
|
|
||||||
|
public class SmsDeliveryListener extends BroadcastReceiver {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onReceive(Context context, Intent intent) {
|
||||||
|
if (SendReceiveService.SENT_SMS_ACTION.equals(intent.getAction())) {
|
||||||
|
intent.putExtra("ResultCode", this.getResultCode());
|
||||||
|
intent.setClass(context, SendReceiveService.class);
|
||||||
|
context.startService(intent);
|
||||||
|
} else if (SendReceiveService.DELIVERED_SMS_ACTION.equals(intent.getAction())) {
|
||||||
|
intent.putExtra("ResultCode", this.getResultCode());
|
||||||
|
intent.setClass(context, SendReceiveService.class);
|
||||||
|
context.startService(intent);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -106,8 +106,11 @@ public class SmsListener extends BroadcastReceiver {
|
|||||||
intent.getAction().equals(SMS_RECEIVED_ACTION) && Util.isDefaultSmsProvider(context))
|
intent.getAction().equals(SMS_RECEIVED_ACTION) && Util.isDefaultSmsProvider(context))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (PreferenceManager.getDefaultSharedPreferences(context).getBoolean("pref_all_sms", true))
|
if (PreferenceManager.getDefaultSharedPreferences(context)
|
||||||
|
.getBoolean(ApplicationPreferencesActivity.ALL_SMS_PREF, true))
|
||||||
|
{
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
return WirePrefix.isEncryptedMessage(messageBody) || WirePrefix.isKeyExchange(messageBody);
|
return WirePrefix.isEncryptedMessage(messageBody) || WirePrefix.isKeyExchange(messageBody);
|
||||||
}
|
}
|
||||||
@@ -140,7 +143,7 @@ public class SmsListener extends BroadcastReceiver {
|
|||||||
public void onReceive(Context context, Intent intent) {
|
public void onReceive(Context context, Intent intent) {
|
||||||
Log.w("SMSListener", "Got SMS broadcast...");
|
Log.w("SMSListener", "Got SMS broadcast...");
|
||||||
|
|
||||||
if (intent.getAction().equals(SMS_RECEIVED_ACTION) && isChallenge(context, intent)) {
|
if (SMS_RECEIVED_ACTION.equals(intent.getAction()) && isChallenge(context, intent)) {
|
||||||
Log.w("SmsListener", "Got challenge!");
|
Log.w("SmsListener", "Got challenge!");
|
||||||
Intent challengeIntent = new Intent(RegistrationService.CHALLENGE_EVENT);
|
Intent challengeIntent = new Intent(RegistrationService.CHALLENGE_EVENT);
|
||||||
challengeIntent.putExtra(RegistrationService.CHALLENGE_EXTRA, parseChallenge(context, intent));
|
challengeIntent.putExtra(RegistrationService.CHALLENGE_EXTRA, parseChallenge(context, intent));
|
||||||
@@ -148,8 +151,9 @@ public class SmsListener extends BroadcastReceiver {
|
|||||||
|
|
||||||
abortBroadcast();
|
abortBroadcast();
|
||||||
} else if ((intent.getAction().equals(SMS_RECEIVED_ACTION) ||
|
} else if ((intent.getAction().equals(SMS_RECEIVED_ACTION) ||
|
||||||
intent.getAction().equals(SMS_DELIVERED_ACTION)) &&
|
intent.getAction().equals(SMS_DELIVERED_ACTION)) &&
|
||||||
isRelevant(context, intent)) {
|
isRelevant(context, intent))
|
||||||
|
{
|
||||||
Intent receivedIntent = new Intent(context, SendReceiveService.class);
|
Intent receivedIntent = new Intent(context, SendReceiveService.class);
|
||||||
receivedIntent.setAction(SendReceiveService.RECEIVE_SMS_ACTION);
|
receivedIntent.setAction(SendReceiveService.RECEIVE_SMS_ACTION);
|
||||||
receivedIntent.putExtra("ResultCode", this.getResultCode());
|
receivedIntent.putExtra("ResultCode", this.getResultCode());
|
||||||
@@ -157,14 +161,6 @@ public class SmsListener extends BroadcastReceiver {
|
|||||||
context.startService(receivedIntent);
|
context.startService(receivedIntent);
|
||||||
|
|
||||||
abortBroadcast();
|
abortBroadcast();
|
||||||
} else if (intent.getAction().equals(SendReceiveService.SENT_SMS_ACTION)) {
|
|
||||||
intent.putExtra("ResultCode", this.getResultCode());
|
|
||||||
intent.setClass(context, SendReceiveService.class);
|
|
||||||
context.startService(intent);
|
|
||||||
} else if (intent.getAction().equals(SendReceiveService.DELIVERED_SMS_ACTION)) {
|
|
||||||
intent.putExtra("ResultCode", this.getResultCode());
|
|
||||||
intent.setClass(context, SendReceiveService.class);
|
|
||||||
context.startService(intent);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -14,7 +14,7 @@ import org.thoughtcrime.securesms.crypto.SessionCipher;
|
|||||||
import org.thoughtcrime.securesms.database.model.SmsMessageRecord;
|
import org.thoughtcrime.securesms.database.model.SmsMessageRecord;
|
||||||
import org.thoughtcrime.securesms.recipients.Recipient;
|
import org.thoughtcrime.securesms.recipients.Recipient;
|
||||||
import org.thoughtcrime.securesms.service.SendReceiveService;
|
import org.thoughtcrime.securesms.service.SendReceiveService;
|
||||||
import org.thoughtcrime.securesms.service.SmsListener;
|
import org.thoughtcrime.securesms.service.SmsDeliveryListener;
|
||||||
import org.thoughtcrime.securesms.sms.MultipartSmsMessageHandler;
|
import org.thoughtcrime.securesms.sms.MultipartSmsMessageHandler;
|
||||||
import org.thoughtcrime.securesms.sms.OutgoingTextMessage;
|
import org.thoughtcrime.securesms.sms.OutgoingTextMessage;
|
||||||
import org.thoughtcrime.securesms.sms.SmsTransportDetails;
|
import org.thoughtcrime.securesms.sms.SmsTransportDetails;
|
||||||
@@ -109,7 +109,7 @@ public class SmsTransport {
|
|||||||
ArrayList<PendingIntent> sentIntents = new ArrayList<PendingIntent>(messages.size());
|
ArrayList<PendingIntent> sentIntents = new ArrayList<PendingIntent>(messages.size());
|
||||||
|
|
||||||
for (int i=0;i<messages.size();i++) {
|
for (int i=0;i<messages.size();i++) {
|
||||||
Intent pending = new Intent(SendReceiveService.SENT_SMS_ACTION, Uri.parse("custom://" + messageId + System.currentTimeMillis()), context, SmsListener.class);
|
Intent pending = new Intent(SendReceiveService.SENT_SMS_ACTION, Uri.parse("custom://" + messageId + System.currentTimeMillis()), context, SmsDeliveryListener.class);
|
||||||
pending.putExtra("type", type);
|
pending.putExtra("type", type);
|
||||||
pending.putExtra("message_id", messageId);
|
pending.putExtra("message_id", messageId);
|
||||||
sentIntents.add(PendingIntent.getBroadcast(context, 0, pending, 0));
|
sentIntents.add(PendingIntent.getBroadcast(context, 0, pending, 0));
|
||||||
@@ -128,7 +128,7 @@ public class SmsTransport {
|
|||||||
ArrayList<PendingIntent> deliveredIntents = new ArrayList<PendingIntent>(messages.size());
|
ArrayList<PendingIntent> deliveredIntents = new ArrayList<PendingIntent>(messages.size());
|
||||||
|
|
||||||
for (int i=0;i<messages.size();i++) {
|
for (int i=0;i<messages.size();i++) {
|
||||||
Intent pending = new Intent(SendReceiveService.DELIVERED_SMS_ACTION, Uri.parse("custom://" + messageId + System.currentTimeMillis()), context, SmsListener.class);
|
Intent pending = new Intent(SendReceiveService.DELIVERED_SMS_ACTION, Uri.parse("custom://" + messageId + System.currentTimeMillis()), context, SmsDeliveryListener.class);
|
||||||
pending.putExtra("type", type);
|
pending.putExtra("type", type);
|
||||||
pending.putExtra("message_id", messageId);
|
pending.putExtra("message_id", messageId);
|
||||||
deliveredIntents.add(PendingIntent.getBroadcast(context, 0, pending, 0));
|
deliveredIntents.add(PendingIntent.getBroadcast(context, 0, pending, 0));
|
||||||
|
@@ -188,7 +188,7 @@ public class Util {
|
|||||||
|
|
||||||
public static boolean isDefaultSmsProvider(Context context){
|
public static boolean isDefaultSmsProvider(Context context){
|
||||||
return (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) ||
|
return (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) ||
|
||||||
(Telephony.Sms.getDefaultSmsPackage(context) == context.getPackageName());
|
(Telephony.Sms.getDefaultSmsPackage(context).equals(context.getPackageName()));
|
||||||
}
|
}
|
||||||
|
|
||||||
// public static Bitmap loadScaledBitmap(InputStream src, int targetWidth, int targetHeight) {
|
// public static Bitmap loadScaledBitmap(InputStream src, int targetWidth, int targetHeight) {
|
||||||
|
Reference in New Issue
Block a user