Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7f21580e authored by Hall Liu's avatar Hall Liu
Browse files

Read from correct extras when logging call composer

Read from a call's intent extras instead since that's where the
attachments will be indicated.

Bug: 180448171
Test: manual, atest CallLogManagerTest
Change-Id: If97f48a425457fecc6b50c5e893cc4cad5f78854
parent 67f64a66
Loading
Loading
Loading
Loading
+17 −8
Original line number Diff line number Diff line
@@ -342,20 +342,29 @@ public final class CallLogManager extends CallsManagerListenerBase {
                paramBuilder.setAddForAllUsers(accountHandle.getUserHandle() == null);
            }
        }
        if (call.getExtras() != null) {
            if (call.getExtras().containsKey(TelecomManager.EXTRA_PRIORITY)) {
                paramBuilder.setPriority(call.getExtras().getInt(TelecomManager.EXTRA_PRIORITY));
        if (call.getIntentExtras() != null) {
            if (call.getIntentExtras().containsKey(TelecomManager.EXTRA_PRIORITY)) {
                paramBuilder.setPriority(call.getIntentExtras()
                        .getInt(TelecomManager.EXTRA_PRIORITY));
            }
            if (call.getExtras().containsKey(TelecomManager.EXTRA_CALL_SUBJECT)) {
                paramBuilder.setSubject(call.getExtras()
            if (call.getIntentExtras().containsKey(TelecomManager.EXTRA_CALL_SUBJECT)) {
                paramBuilder.setSubject(call.getIntentExtras()
                        .getString(TelecomManager.EXTRA_CALL_SUBJECT));
            }
            if (call.getExtras().containsKey(TelecomManager.EXTRA_PICTURE_URI)) {
            if (call.getIntentExtras().containsKey(TelecomManager.EXTRA_PICTURE_URI)) {
                paramBuilder.setPictureUri(call.getIntentExtras()
                        .getParcelable(TelecomManager.EXTRA_PICTURE_URI));
            }
            // The picture uri can end up either in extras or in intent extras due to how these
            // two bundles are set. For incoming calls they're in extras, but for outgoing calls
            // they're in intentExtras.
            if (call.getExtras() != null
                    && call.getExtras().containsKey(TelecomManager.EXTRA_PICTURE_URI)) {
                paramBuilder.setPictureUri(call.getExtras()
                        .getParcelable(TelecomManager.EXTRA_PICTURE_URI));
            }
            if (call.getExtras().containsKey(TelecomManager.EXTRA_LOCATION)) {
                Location l = call.getExtras().getParcelable(TelecomManager.EXTRA_LOCATION);
            if (call.getIntentExtras().containsKey(TelecomManager.EXTRA_LOCATION)) {
                Location l = call.getIntentExtras().getParcelable(TelecomManager.EXTRA_LOCATION);
                if (l != null) {
                    paramBuilder.setLatitude(l.getLatitude());
                    paramBuilder.setLongitude(l.getLongitude());
+3 −3
Original line number Diff line number Diff line
@@ -775,17 +775,17 @@ public class CallsManager extends Call.ListenerBase
            int attachmentMask = result.mCallScreeningResponse.getCallComposerAttachmentsToShow();
            if ((attachmentMask
                    & CallScreeningService.CallResponse.CALL_COMPOSER_ATTACHMENT_LOCATION) == 0) {
                incomingCall.getExtras().remove(TelecomManager.EXTRA_LOCATION);
                incomingCall.getIntentExtras().remove(TelecomManager.EXTRA_LOCATION);
            }

            if ((attachmentMask
                    & CallScreeningService.CallResponse.CALL_COMPOSER_ATTACHMENT_SUBJECT) == 0) {
                incomingCall.getExtras().remove(TelecomManager.EXTRA_CALL_SUBJECT);
                incomingCall.getIntentExtras().remove(TelecomManager.EXTRA_CALL_SUBJECT);
            }

            if ((attachmentMask
                    & CallScreeningService.CallResponse.CALL_COMPOSER_ATTACHMENT_PRIORITY) == 0) {
                incomingCall.getExtras().remove(TelecomManager.EXTRA_PRIORITY);
                incomingCall.getIntentExtras().remove(TelecomManager.EXTRA_PRIORITY);
            }
        }

+1 −1
Original line number Diff line number Diff line
@@ -852,7 +852,7 @@ public class CallLogManagerTest extends TelecomTestCase {
        extras.putString(TelecomManager.EXTRA_CALL_SUBJECT, subject);
        extras.putParcelable(TelecomManager.EXTRA_LOCATION, location);
        extras.putParcelable(TelecomManager.EXTRA_PICTURE_URI, fakeProviderUri);
        when(fakeCall.getExtras()).thenReturn(extras);
        when(fakeCall.getIntentExtras()).thenReturn(extras);

        mCallLogManager.onCallStateChanged(fakeCall, CallState.ACTIVE,
                CallState.DISCONNECTED);