diff options
author | Ritwika Mitra <ritwikam@google.com> | 2019-11-20 09:58:06 -0800 |
---|---|---|
committer | Ritwika Mitra <ritwikam@google.com> | 2019-11-20 09:58:06 -0800 |
commit | 67a8cdeaeb2a0842979da395ebb3a7caabc8319c (patch) | |
tree | 598f3e95f40d12fadb684ca6b18aa03b1378d5bb /src/com/android/car | |
parent | 0dca31d523685db7b1af12c494579e0f72b1eb73 (diff) | |
download | Messenger-67a8cdeaeb2a0842979da395ebb3a7caabc8319c.tar.gz |
Disable reply for messages with null contact URIs
Contact URIs need to be non-null for BluetoothMapClient to understand
which sender on the phone to send a message to. Therefore, if a URI is null,
we should disable replying/sending a message.
Change-Id: I8d8bf9d8ad335711de32efbe6f1e3664901844d6
Fix: 144842584
Test: verified for iOS 12, iOS 13+, Android
Diffstat (limited to 'src/com/android/car')
-rw-r--r-- | src/com/android/car/messenger/MessengerDelegate.java | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/com/android/car/messenger/MessengerDelegate.java b/src/com/android/car/messenger/MessengerDelegate.java index 5a3d2e0..bd5e9fa 100644 --- a/src/com/android/car/messenger/MessengerDelegate.java +++ b/src/com/android/car/messenger/MessengerDelegate.java @@ -412,7 +412,7 @@ public class MessengerDelegate implements BluetoothMonitor.OnBluetoothEventListe final List<Action> actionList = new ArrayList<>(); // Reply action - if (shouldAddReplyAction(senderKey.getDeviceAddress())) { + if (shouldAddReplyAction(senderKey)) { final String replyString = mContext.getString(R.string.action_reply); PendingIntent replyIntent = createServiceIntent(senderKey, notificationId, MessengerService.ACTION_VOICE_REPLY); @@ -444,12 +444,16 @@ public class MessengerDelegate implements BluetoothMonitor.OnBluetoothEventListe return actionList; } - private boolean shouldAddReplyAction(String deviceAddress) { + private boolean shouldAddReplyAction(SenderKey senderKey) { + if (mNotificationInfos.get(senderKey).mSenderContactUri == null) { + return false; + } + BluetoothAdapter adapter = BluetoothAdapter.getDefaultAdapter(); if (adapter == null) { return false; } - BluetoothDevice device = adapter.getRemoteDevice(deviceAddress); + BluetoothDevice device = adapter.getRemoteDevice(senderKey.getDeviceAddress()); synchronized (mMapClientLock) { return (mBluetoothMapClient != null) && mBluetoothMapClient.isUploadingSupported( |