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

Commit 48f005f9 authored by Hyunho's avatar Hyunho
Browse files

Added new API to notify ECBM and SCBM status

Bug: b/260533540
Test: atest CtsTelephonyTestCases:TelephonyCallbackTest, TelephonyRegistryTest
Change-Id: I4d8198a257f8524123016621b56006276b593ae9
parent 88f6ed6b
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -33,6 +33,8 @@ import android.telephony.PreciseDataConnectionState;
import android.telephony.ServiceState;
import android.telephony.TelephonyDisplayInfo;
import android.telephony.TelephonyManager.DataEnabledReason;
import android.telephony.TelephonyManager.EmergencyCallbackModeStopReason;
import android.telephony.TelephonyManager.EmergencyCallbackModeType;
import android.telephony.TelephonyRegistryManager;
import android.telephony.emergency.EmergencyNumber;
import android.telephony.ims.ImsCallSession;
@@ -284,6 +286,18 @@ public class DefaultPhoneNotifier implements PhoneNotifier {
                sender.getSubId(), linkCapacityEstimateList);
    }

    @Override
    public void notifyCallbackModeStarted(Phone sender, @EmergencyCallbackModeType int type) {
        mTelephonyRegistryMgr.notifyCallBackModeStarted(sender.getPhoneId(),
                sender.getSubId(), type);
    }

    @Override
    public void notifyCallbackModeStopped(Phone sender, @EmergencyCallbackModeType int type,
            @EmergencyCallbackModeStopReason int reason) {
        mTelephonyRegistryMgr.notifyCallbackModeStopped(sender.getPhoneId(),
                sender.getSubId(), type, reason);
    }
    /**
     * Convert the {@link Call.State} enum into the PreciseCallState.PRECISE_CALL_STATE_* constants
     * for the public API.
+20 −0
Original line number Diff line number Diff line
@@ -5506,6 +5506,26 @@ public abstract class Phone extends Handler implements PhoneInternalInterface {
        mCi.getTimeForNextSatelliteVisibility(result);
    }

    /**
     * Start callback mode
     * @param type for callback mode entry.
     */
    public void startCallbackMode(@TelephonyManager.EmergencyCallbackModeType int type) {
        Rlog.d(LOG_TAG, "startCallbackMode:type=" + type);
        mNotifier.notifyCallbackModeStarted(this, type);
    }

    /**
     * Stop callback mode
     * @param type for callback mode exit.
     * @param reason for stopping callback mode.
     */
    public void stopCallbackMode(@TelephonyManager.EmergencyCallbackModeType int type,
            @TelephonyManager.EmergencyCallbackModeStopReason int reason) {
        Rlog.d(LOG_TAG, "stopCallbackMode:type=" + type + ", reason=" + reason);
        mNotifier.notifyCallbackModeStopped(this, type, reason);
    }

    public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
        pw.println("Phone: subId=" + getSubId());
        pw.println(" mPhoneId=" + mPhoneId);
+9 −0
Original line number Diff line number Diff line
@@ -32,6 +32,8 @@ import android.telephony.PreciseDataConnectionState;
import android.telephony.ServiceState;
import android.telephony.TelephonyDisplayInfo;
import android.telephony.TelephonyManager.DataEnabledReason;
import android.telephony.TelephonyManager.EmergencyCallbackModeStopReason;
import android.telephony.TelephonyManager.EmergencyCallbackModeType;
import android.telephony.emergency.EmergencyNumber;
import android.telephony.ims.ImsReasonInfo;
import android.telephony.ims.MediaQualityStatus;
@@ -140,4 +142,11 @@ public interface PhoneNotifier {
    /** Notify link capacity estimate has changed. */
    void notifyLinkCapacityEstimateChanged(Phone sender,
            List<LinkCapacityEstimate> linkCapacityEstimateList);

    /** Notify callback mode started. */
    void notifyCallbackModeStarted(Phone sender, @EmergencyCallbackModeType int type);

    /** Notify callback mode stopped. */
    void notifyCallbackModeStopped(Phone sender, @EmergencyCallbackModeType int type,
            @EmergencyCallbackModeStopReason int reason);
}
+2 −0
Original line number Diff line number Diff line
@@ -157,6 +157,8 @@ public class TelephonyRegistryTest extends TelephonyTest {
                TelephonyCallback.EVENT_VOICE_ACTIVATION_STATE_CHANGED);
        READ_PRIVILEGED_PHONE_STATE_EVENTS.add(
                TelephonyCallback.EVENT_ALLOWED_NETWORK_TYPE_LIST_CHANGED);
        READ_PRIVILEGED_PHONE_STATE_EVENTS.add(
                TelephonyCallback.EVENT_EMERGENCY_CALLBACK_MODE_CHANGED);
    }

    // All events contribute to TelephonyRegistry#isActiveEmergencySessionPermissionRequired