Fixes for poorly merged behavior

1) Fixed call in progress notification

2) Don't cache auth info in service

// FREEBIE
This commit is contained in:
Moxie Marlinspike 2015-09-16 15:17:37 -07:00
parent fdfa15aa4d
commit 36b7f767b6
6 changed files with 23 additions and 11 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 444 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 346 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 536 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 739 B

View file

@ -92,9 +92,9 @@ public class RedPhoneService extends Service implements CallStateListener, CallS
private int state;
private byte[] zid;
private String localNumber;
// private String localNumber;
private String remoteNumber;
private String password;
// private String password;
private CallManager currentCallManager;
private LockManager lockManager;
private UncaughtExceptionHandlerManager uncaughtExceptionHandlerManager;
@ -172,8 +172,8 @@ public class RedPhoneService extends Service implements CallStateListener, CallS
private void initializeResources() {
this.state = RedPhone.STATE_IDLE;
this.zid = getZID();
this.localNumber = TextSecurePreferences.getLocalNumber(this);
this.password = TextSecurePreferences.getPushServerPassword(this);
// this.localNumber = TextSecurePreferences.getLocalNumber(this);
// this.password = TextSecurePreferences.getPushServerPassword(this);
this.lockManager = new LockManager(this);
}
@ -185,9 +185,12 @@ public class RedPhoneService extends Service implements CallStateListener, CallS
/// Intent Handlers
private void handleIncomingCall(Intent intent) {
SessionDescriptor session = intent.getParcelableExtra(EXTRA_SESSION_DESCRIPTOR);
remoteNumber = intent.getStringExtra(EXTRA_REMOTE_NUMBER);
state = RedPhone.STATE_RINGING;
String localNumber = TextSecurePreferences.getLocalNumber(this);
String password = TextSecurePreferences.getPushServerPassword(this);
SessionDescriptor session = intent.getParcelableExtra(EXTRA_SESSION_DESCRIPTOR);
remoteNumber = intent.getStringExtra(EXTRA_REMOTE_NUMBER);
state = RedPhone.STATE_RINGING;
lockManager.updatePhoneState(LockManager.PhoneState.PROCESSING);
this.currentCallManager = new ResponderCallManager(this, this, remoteNumber, localNumber,
@ -196,6 +199,9 @@ public class RedPhoneService extends Service implements CallStateListener, CallS
}
private void handleOutgoingCall(Intent intent) {
String localNumber = TextSecurePreferences.getLocalNumber(this);
String password = TextSecurePreferences.getPushServerPassword(this);
remoteNumber = intent.getStringExtra(EXTRA_REMOTE_NUMBER);
if (remoteNumber == null || remoteNumber.length() == 0)
@ -215,7 +221,9 @@ public class RedPhoneService extends Service implements CallStateListener, CallS
}
private void handleBusyCall(Intent intent) {
SessionDescriptor session = intent.getParcelableExtra(EXTRA_SESSION_DESCRIPTOR);
String localNumber = TextSecurePreferences.getLocalNumber(this);
String password = TextSecurePreferences.getPushServerPassword(this);
SessionDescriptor session = intent.getParcelableExtra(EXTRA_SESSION_DESCRIPTOR);
if (currentCallManager != null && session.equals(currentCallManager.getSessionDescriptor())) {
Log.w("RedPhoneService", "Duplicate incoming call signal, ignoring...");
@ -305,8 +313,12 @@ public class RedPhoneService extends Service implements CallStateListener, CallS
}
public Recipient getRecipient() {
return RecipientFactory.getRecipientsFromString(this, remoteNumber, true)
.getPrimaryRecipient();
if (remoteNumber != null) {
return RecipientFactory.getRecipientsFromString(this, remoteNumber, true)
.getPrimaryRecipient();
} else {
return Recipient.getUnknownRecipient();
}
}
// public PersonInfo getRemotePersonInfo() {

View file

@ -51,7 +51,7 @@ public class NotificationBarManager {
Intent contentIntent = new Intent(context, RedPhone.class);
contentIntent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, contentIntent, 0);
String notificationText = "RedPhone call in progress";
String notificationText = "Signal call in progress";
Notification notification = new Notification(R.drawable.redphone_stat_sys_phone_call, null,
System.currentTimeMillis());