Merge branch 'master' of github.com:WhisperSystems/TextSecure

This commit is contained in:
Moxie Marlinspike 2013-10-13 04:07:45 -07:00
commit 8d115562f0
6 changed files with 34 additions and 5 deletions

View File

@ -437,6 +437,8 @@
<string name="preferences__pref_led_blink_dialogtitle">Select LED Blink Pattern</string> <string name="preferences__pref_led_blink_dialogtitle">Select LED Blink Pattern</string>
<string name="preferences__select_led_color">Select LED Color</string> <string name="preferences__select_led_color">Select LED Color</string>
<string name="preferences__sound">Sound</string> <string name="preferences__sound">Sound</string>
<string name="preferences__inthread_notifications">In thread notifications</string>
<string name="preferences__play_inthread_notifications">Play notification sound while in thread.</string>
<string name="preferences__vibrate">Vibrate</string> <string name="preferences__vibrate">Vibrate</string>
<string name="preferences__also_vibrate_when_notified">Also vibrate when notified</string> <string name="preferences__also_vibrate_when_notified">Also vibrate when notified</string>
<string name="preferences__minutes">minutes</string> <string name="preferences__minutes">minutes</string>

View File

@ -50,12 +50,22 @@
android:title="@string/preferences__sound" android:title="@string/preferences__sound"
android:ringtoneType="notification" android:ringtoneType="notification"
android:defaultValue="content://settings/system/notification_sound" /> android:defaultValue="content://settings/system/notification_sound" />
<CheckBoxPreference android:key="pref_key_inthread_notifications"
android:title="@string/preferences__inthread_notifications"
android:summary="@string/preferences__play_inthread_notifications"
android:layout="?android:attr/preferenceLayoutChild"
android:dependency="pref_key_enable_notifications"
android:defaultValue="true" />
<CheckBoxPreference android:layout="?android:attr/preferenceLayoutChild" <CheckBoxPreference android:layout="?android:attr/preferenceLayoutChild"
android:dependency="pref_key_enable_notifications" android:dependency="pref_key_enable_notifications"
android:key="pref_key_vibrate" android:key="pref_key_vibrate"
android:defaultValue="true" android:defaultValue="true"
android:title="@string/preferences__vibrate" android:title="@string/preferences__vibrate"
android:summary="@string/preferences__also_vibrate_when_notified" /> android:summary="@string/preferences__also_vibrate_when_notified" />
</PreferenceCategory> </PreferenceCategory>
<PreferenceCategory android:title="Input Settings"> <PreferenceCategory android:title="Input Settings">

View File

@ -58,6 +58,7 @@ public class ApplicationPreferencesActivity extends PassphraseRequiredSherlockPr
private static final int ENABLE_PASSPHRASE_ACTIVITY = 2; private static final int ENABLE_PASSPHRASE_ACTIVITY = 2;
public static final String RINGTONE_PREF = "pref_key_ringtone"; public static final String RINGTONE_PREF = "pref_key_ringtone";
public static final String IN_THREAD_NOTIFICATION_PREF = "pref_key_inthread_notifications";
public static final String VIBRATE_PREF = "pref_key_vibrate"; public static final String VIBRATE_PREF = "pref_key_vibrate";
public static final String NOTIFICATION_PREF = "pref_key_enable_notifications"; public static final String NOTIFICATION_PREF = "pref_key_enable_notifications";
public static final String LED_COLOR_PREF = "pref_led_color"; public static final String LED_COLOR_PREF = "pref_led_color";

View File

@ -228,6 +228,11 @@ public class MessageNotifier {
private static void sendInThreadNotification(Context context) { private static void sendInThreadNotification(Context context) {
try { try {
SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context); SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context);
if (!sp.getBoolean(ApplicationPreferencesActivity.IN_THREAD_NOTIFICATION_PREF, true)) {
return;
}
String ringtone = sp.getString(ApplicationPreferencesActivity.RINGTONE_PREF, null); String ringtone = sp.getString(ApplicationPreferencesActivity.RINGTONE_PREF, null);
if (ringtone == null) if (ringtone == null)

View File

@ -189,7 +189,7 @@ public class KeyCachingService extends Service {
} }
private void foregroundServiceModern() { private void foregroundServiceModern() {
Notification notification = new Notification(R.drawable.icon_cached, null, System.currentTimeMillis()); NotificationCompat.Builder builder = new NotificationCompat.Builder(this);
RemoteViews remoteViews = new RemoteViews(getPackageName(), R.layout.key_caching_notification); RemoteViews remoteViews = new RemoteViews(getPackageName(), R.layout.key_caching_notification);
Intent intent = new Intent(this, KeyCachingService.class); Intent intent = new Intent(this, KeyCachingService.class);
@ -197,10 +197,11 @@ public class KeyCachingService extends Service {
PendingIntent pendingIntent = PendingIntent.getService(getApplicationContext(), 0, intent, 0); PendingIntent pendingIntent = PendingIntent.getService(getApplicationContext(), 0, intent, 0);
remoteViews.setOnClickPendingIntent(R.id.lock_cache_icon, pendingIntent); remoteViews.setOnClickPendingIntent(R.id.lock_cache_icon, pendingIntent);
notification.contentView = remoteViews; builder.setSmallIcon(R.drawable.icon_cached);
builder.setContent(remoteViews);
stopForeground(true); stopForeground(true);
startForeground(SERVICE_RUNNING_ID, notification); startForeground(SERVICE_RUNNING_ID, builder.build());
} }
private void foregroundServiceLegacy() { private void foregroundServiceLegacy() {

View File

@ -60,15 +60,19 @@ public class SmsTransport {
// and messages, this will throw an NPE. I have no idea why, so I'm just catching it and marking // and messages, this will throw an NPE. I have no idea why, so I'm just catching it and marking
// the message as a failure. That way at least it doesn't repeatedly crash every time you start // the message as a failure. That way at least it doesn't repeatedly crash every time you start
// the app. // the app.
// d3sre 12/10/13 -- extended the log file to further analyse the problem
try { try {
SmsManager.getDefault().sendTextMessage(message.getIndividualRecipient().getNumber(), null, messages.get(i), SmsManager.getDefault().sendTextMessage(message.getIndividualRecipient().getNumber(), null, messages.get(i),
sentIntents.get(i), sentIntents.get(i),
deliveredIntents == null ? null : deliveredIntents.get(i)); deliveredIntents == null ? null : deliveredIntents.get(i));
} catch (NullPointerException npe) { } catch (NullPointerException npe) {
Log.w("SmsSender", npe); Log.w("SmsTransport", npe);
Log.w("SmsTransport", "Recipient: " + message.getIndividualRecipient().getNumber());
Log.w("SmsTransport", "Message Total Parts/Current: " + messages.size() + "/" + i);
Log.w("SmsTransport", "Message Part Length: " + messages.get(i).getBytes().length);
throw new UndeliverableMessageException(npe); throw new UndeliverableMessageException(npe);
} catch (IllegalArgumentException iae) { } catch (IllegalArgumentException iae) {
Log.w("SmsSender", iae); Log.w("SmsTransport", iae);
throw new UndeliverableMessageException(iae); throw new UndeliverableMessageException(iae);
} }
} }
@ -87,10 +91,16 @@ public class SmsTransport {
// and messages, this will throw an NPE. I have no idea why, so I'm just catching it and marking // and messages, this will throw an NPE. I have no idea why, so I'm just catching it and marking
// the message as a failure. That way at least it doesn't repeatedly crash every time you start // the message as a failure. That way at least it doesn't repeatedly crash every time you start
// the app. // the app.
// d3sre 12/10/13 -- extended the log file to further analyse the problem
try { try {
SmsManager.getDefault().sendMultipartTextMessage(recipient, null, messages, sentIntents, deliveredIntents); SmsManager.getDefault().sendMultipartTextMessage(recipient, null, messages, sentIntents, deliveredIntents);
} catch (NullPointerException npe) { } catch (NullPointerException npe) {
Log.w("SmsTransport", npe); Log.w("SmsTransport", npe);
Log.w("SmsTransport", "Recipient: " + recipient);
Log.w("SmsTransport", "Message Parts: " + messages.size());
for (String messagePart: messages) {
Log.w("SmsTransport", "Message Part Length: " + messagePart.getBytes().length);
}
throw new UndeliverableMessageException(npe); throw new UndeliverableMessageException(npe);
} }
} }