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

Commit 2e0f4191 authored by yanglv's avatar yanglv Committed by Gerrit - the friendly Code Review server
Browse files

Mms: Fix no ringtone for MT SMS during the call.

If phone status is active, it will block ringtone sound.
If phone status is idle it will play ringtone sound by
Ringtone Player. Add config based functionality to play
the SMS ringtone during a call.

CRs-Fixed: 771756

Change-Id: If02b398d5eb3520f173d7b71a11df2536a218bc1
parent 4404f4a2
Loading
Loading
Loading
Loading
+15 −1
Original line number Diff line number Diff line
@@ -94,6 +94,7 @@ import android.os.IInterface;
import android.os.Looper;
import android.os.Message;
import android.os.Parcelable;
import android.os.PersistableBundle;
import android.os.Process;
import android.os.RemoteException;
import android.os.SystemClock;
@@ -112,6 +113,7 @@ import android.service.notification.NotificationListenerService;
import android.service.notification.NotificationRankingUpdate;
import android.service.notification.StatusBarNotification;
import android.service.notification.ZenModeConfig;
import android.telephony.CarrierConfigManager;
import android.telephony.PhoneStateListener;
import android.telephony.TelephonyManager;
import android.text.TextUtils;
@@ -305,6 +307,8 @@ public class NotificationManagerService extends SystemService {
    private RankingHandler mRankingHandler;
    private long mLastOverRateLogTime;
    private float mMaxPackageEnqueueRate = DEFAULT_MAX_NOTIFICATION_ENQUEUE_RATE;
    private PersistableBundle mCarrierConfig;
    private CarrierConfigManager mConfigManager;

    private static class Archive {
        final int mBufferSize;
@@ -1054,6 +1058,8 @@ public class NotificationManagerService extends SystemService {

        publishBinderService(Context.NOTIFICATION_SERVICE, mService);
        publishLocalService(NotificationManagerInternal.class, mInternalService);
        mConfigManager = (CarrierConfigManager)
                getContext().getSystemService(Context.CARRIER_CONFIG_SERVICE);
    }

    private void sendRegisteredOnlyBroadcast(String action) {
@@ -2801,7 +2807,15 @@ public class NotificationManagerService extends SystemService {
        // These are set inside the conditional if the notification is allowed to make noise.
        boolean hasValidVibrate = false;
        boolean hasValidSound = false;
        if (disableEffects == null

        boolean smsRingtone =  false;
        if (mCarrierConfig == null) {
            mCarrierConfig = mConfigManager.getConfig();
        } else {
            smsRingtone = mCarrierConfig.getBoolean(
                CarrierConfigManager.KEY_CONFIG_SMS_RINGTONE_INCALL);
        }
        if ((disableEffects == null || (smsRingtone && mInCall))
                && (record.getUserId() == UserHandle.USER_ALL ||
                    record.getUserId() == currentUser ||
                    mUserProfiles.isCurrentProfile(record.getUserId()))
+7 −0
Original line number Diff line number Diff line
@@ -743,6 +743,12 @@ public class CarrierConfigManager {
    public static final String KEY_MAP_ANONYMOUS_TO_RESTRICTED_BOOL =
            "carrier_map_anonymous_to_restricted";

    /**
     * Configuration to play sms ringtone during MO/MT call.
     * @hide
     */
    public static final String KEY_CONFIG_SMS_RINGTONE_INCALL = "config_sms_ringtone_incall";

    /** The default value for every variable. */
    private final static PersistableBundle sDefaults;

@@ -888,6 +894,7 @@ public class CarrierConfigManager {
        sDefaults.putStringArray(KEY_SIM_PROVISIONING_STATUS_DETECTION_CARRIER_APP_STRING_ARRAY,
                null);
        sDefaults.putBoolean(KEY_MAP_ANONYMOUS_TO_RESTRICTED_BOOL, true);
        sDefaults.putBoolean(KEY_CONFIG_SMS_RINGTONE_INCALL, true);
    }

    /**