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

Commit 0aad899c authored by Android Build Coastguard Worker's avatar Android Build Coastguard Worker
Browse files

Snap for 9390188 from cb3895d5 to tm-qpr2-release

Change-Id: Idfc42dffe2fd5eb9ef35d6638d04df895e756e6f
parents 0e3f9313 cb3895d5
Loading
Loading
Loading
Loading
+34 −1
Original line number Diff line number Diff line
@@ -48,6 +48,16 @@ import java.util.Map;
import java.util.concurrent.LinkedBlockingDeque;
import java.util.stream.Collectors;

import static android.provider.CallLog.Calls.AUTO_MISSED_EMERGENCY_CALL;
import static android.provider.CallLog.Calls.AUTO_MISSED_MAXIMUM_DIALING;
import static android.provider.CallLog.Calls.AUTO_MISSED_MAXIMUM_RINGING;
import static android.provider.CallLog.Calls.USER_MISSED_CALL_FILTERS_TIMEOUT;
import static android.provider.CallLog.Calls.USER_MISSED_CALL_SCREENING_SERVICE_SILENCED;
import static android.provider.CallLog.Calls.USER_MISSED_DND_MODE;
import static android.provider.CallLog.Calls.USER_MISSED_LOW_RING_VOLUME;
import static android.provider.CallLog.Calls.USER_MISSED_NEVER_RANG;
import static android.provider.CallLog.Calls.USER_MISSED_NO_VIBRATE;
import static android.provider.CallLog.Calls.USER_MISSED_SHORT_RING;
import static android.telecom.ParcelableCallAnalytics.AnalyticsEvent;
import static android.telecom.TelecomAnalytics.SessionTiming;

@@ -542,7 +552,30 @@ public class Analytics {

        private String getMissedReasonString() {
            //TODO: Implement this
            return null;
            StringBuilder s =  new StringBuilder();
            s.append('[');
            if ((missedReason & AUTO_MISSED_EMERGENCY_CALL) != 0) {
                s.append("emergency]");
                return s.toString();
            } else if ((missedReason & AUTO_MISSED_MAXIMUM_DIALING) != 0) {
                s.append("max_dialing]");
                return s.toString();
            } else if ((missedReason & AUTO_MISSED_MAXIMUM_RINGING) != 0) {
                s.append("max_ringing]");
                return s.toString();
            }

            // user missed
            if ((missedReason & USER_MISSED_SHORT_RING) != 0) s.append("short_ring ");
            if ((missedReason & USER_MISSED_DND_MODE) != 0) s.append("dnd ");
            if ((missedReason & USER_MISSED_LOW_RING_VOLUME) != 0) s.append("low_volume ");
            if ((missedReason & USER_MISSED_NO_VIBRATE) != 0) s.append("no_vibrate ");
            if ((missedReason & USER_MISSED_CALL_SCREENING_SERVICE_SILENCED) != 0)
                s.append("css_silenced ");
            if ((missedReason & USER_MISSED_CALL_FILTERS_TIMEOUT) != 0) s.append("filter_timeout ");
            if ((missedReason & USER_MISSED_NEVER_RANG) != 0) s.append("no_ring ");
            s.append("]");
            return s.toString();
        }

        private String getInCallServicesString() {
+6 −1
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ package com.android.server.telecom;
import static android.provider.CallLog.Calls.USER_MISSED_DND_MODE;
import static android.provider.CallLog.Calls.USER_MISSED_LOW_RING_VOLUME;
import static android.provider.CallLog.Calls.USER_MISSED_NO_VIBRATE;
import static android.provider.Settings.Global.ZEN_MODE_OFF;

import android.app.Notification;
import android.app.NotificationManager;
@@ -507,10 +508,14 @@ public class Ringer {
        AudioManager audioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);
        // Use AudioManager#getRingerMode for more accurate result, instead of
        // AudioManager#getRingerModeInternal which only useful for volume controllers
        NotificationManager notificationManager = context.getSystemService(
                NotificationManager.class);
        boolean zenModeOn = notificationManager != null
                && notificationManager.getZenMode() != ZEN_MODE_OFF;
        return mVibrator.hasVibrator()
                && mSystemSettingsUtil.isRingVibrationEnabled(context)
                && (audioManager.getRingerMode() != AudioManager.RINGER_MODE_SILENT
                || shouldRingForContact);
                || (zenModeOn && shouldRingForContact));
    }

    private RingerAttributes getRingerAttributes(Call call, boolean isHfpDeviceAttached) {
+9 −0
Original line number Diff line number Diff line
@@ -188,6 +188,7 @@ public class BluetoothDeviceManager {
    private BluetoothLeAudio mBluetoothLeAudioService;
    private boolean mLeAudioSetAsCommunicationDevice = false;
    private String mLeAudioDevice;
    private String mHearingAidDevice;
    private boolean mHearingAidSetAsCommunicationDevice = false;
    private BluetoothDevice mBluetoothHearingAidActiveDeviceCache;
    private BluetoothAdapter mBluetoothAdapter;
@@ -443,10 +444,17 @@ public class BluetoothDeviceManager {
    }

    public void clearHearingAidCommunicationDevice() {
        Log.i(this, "clearHearingAidCommunicationDevice: mHearingAidSetAsCommunicationDevice = "
                + mHearingAidSetAsCommunicationDevice);
        if (!mHearingAidSetAsCommunicationDevice) {
            return;
        }
        mHearingAidSetAsCommunicationDevice = false;
        if (mHearingAidDevice != null) {
            mBluetoothRouteManager.onAudioLost(mHearingAidDevice);
            mHearingAidDevice = null;
        }

        if (mAudioManager == null) {
            Log.i(this, "clearHearingAidCommunicationDevice: mAudioManager is null");
            return;
@@ -552,6 +560,7 @@ public class BluetoothDeviceManager {
            Log.w(this, " Could not set hearingAid device");
        } else {
            Log.i(this, " hearingAid device set");
            mHearingAidDevice = hearingAid.getAddress();
            mHearingAidSetAsCommunicationDevice = true;
        }
        return result;
+2 −1
Original line number Diff line number Diff line
@@ -491,7 +491,8 @@ public class BluetoothRouteManager extends StateMachine {
            SomeArgs args = (SomeArgs) msg.obj;

            Log.continueSession(((Session) args.arg1), "BRM.pM_" + msg.what);
            Log.i(LOG_TAG, "Message received: %s.", MESSAGE_CODE_TO_NAME.get(msg.what));
            Log.i(LOG_TAG, "%s received message: %s.", this,
                    MESSAGE_CODE_TO_NAME.get(msg.what));
        } else if (msg.what == RUN_RUNNABLE && msg.obj instanceof Runnable) {
            Log.i(LOG_TAG, "Running runnable for testing");
        } else {
+7 −0
Original line number Diff line number Diff line
@@ -58,6 +58,8 @@ import java.util.List;

@RunWith(JUnit4.class)
public class BluetoothDeviceManagerTest extends TelecomTestCase {
    private static final String DEVICE_ADDRESS_1 = "00:00:00:00:00:01";

    @Mock BluetoothRouteManager mRouteManager;
    @Mock BluetoothHeadset mBluetoothHeadset;
    @Mock BluetoothAdapter mAdapter;
@@ -484,7 +486,11 @@ public class BluetoothDeviceManagerTest extends TelecomTestCase {
    @SmallTest
    @Test
    public void testClearHearingAidCommunicationDevice() {
        AudioDeviceInfo mockAudioDeviceInfo = mock(AudioDeviceInfo.class);
        when(mockAudioDeviceInfo.getAddress()).thenReturn(DEVICE_ADDRESS_1);
        when(mockAudioDeviceInfo.getType()).thenReturn(AudioDeviceInfo.TYPE_HEARING_AID);
        List<AudioDeviceInfo> devices = new ArrayList<>();
        devices.add(mockAudioDeviceInfo);

        when(mockAudioManager.getAvailableCommunicationDevices())
                .thenReturn(devices);
@@ -492,6 +498,7 @@ public class BluetoothDeviceManagerTest extends TelecomTestCase {
        mBluetoothDeviceManager.setHearingAidCommunicationDevice();
        when(mockAudioManager.getCommunicationDevice()).thenReturn(null);
        mBluetoothDeviceManager.clearHearingAidCommunicationDevice();
        verify(mRouteManager).onAudioLost(eq(DEVICE_ADDRESS_1));
        assertFalse(mBluetoothDeviceManager.isHearingAidSetAsCommunicationDevice());
    }

Loading