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

Commit 0eeee8b2 authored by Brandon Maxwell's avatar Brandon Maxwell Committed by Android (Google) Code Review
Browse files

Merge "Respect setting for incoming call to vibrate" into nyc-dev

parents ef57777a ffa70124
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -315,8 +315,10 @@ public class StatusBarNotifier implements InCallPresenter.InCallStateListener,
            audioAttributes.setContentType(AudioAttributes.CONTENT_TYPE_MUSIC);
            audioAttributes.setUsage(AudioAttributes.USAGE_NOTIFICATION_RINGTONE);
            notification.audioAttributes = audioAttributes.build();
            if (mDialerRingtoneManager.shouldVibrate(mContext.getContentResolver())) {
                notification.vibrate = VIBRATE_PATTERN;
            }
        }
        if (mDialerRingtoneManager.shouldPlayCallWaitingTone(callState)) {
            Log.v(this, "Playing call waiting tone");
            mDialerRingtoneManager.playCallWaitingTone();
+13 −0
Original line number Diff line number Diff line
@@ -18,7 +18,9 @@ package com.android.incallui.ringtone;

import com.google.common.base.Preconditions;

import android.content.ContentResolver;
import android.net.Uri;
import android.provider.Settings;
import android.support.annotation.Nullable;

import com.android.contacts.common.compat.CompatUtils;
@@ -69,6 +71,17 @@ public class DialerRingtoneManager {
                && ringtoneUri != null;
    }

    /**
     * Determines if an incoming call should vibrate as well as ring.
     *
     * @param resolver {@link ContentResolver} used to look up the
     * {@link Settings.System#VIBRATE_WHEN_RINGING} setting.
     * @return {@code true} if the call should vibrate, {@code false} otherwise.
     */
    public boolean shouldVibrate(ContentResolver resolver) {
        return Settings.System.getInt(resolver, Settings.System.VIBRATE_WHEN_RINGING, 0) != 0;
    }

    /**
     * The incoming callState is never set as {@link State#CALL_WAITING} because
     * {@link Call#translateState(int)} doesn't account for that case, check for it here