1 /*
2  * Copyright (C) 2006 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package com.android.internal.telephony;
18 
19 import android.annotation.NonNull;
20 import android.compat.annotation.UnsupportedAppUsage;
21 import android.telephony.Annotation;
22 import android.telephony.Annotation.RadioPowerState;
23 import android.telephony.Annotation.SrvccState;
24 import android.telephony.BarringInfo;
25 import android.telephony.CallQuality;
26 import android.telephony.CellIdentity;
27 import android.telephony.CellInfo;
28 import android.telephony.LinkCapacityEstimate;
29 import android.telephony.PhoneCapability;
30 import android.telephony.PhysicalChannelConfig;
31 import android.telephony.PreciseDataConnectionState;
32 import android.telephony.ServiceState;
33 import android.telephony.TelephonyDisplayInfo;
34 import android.telephony.TelephonyManager.DataEnabledReason;
35 import android.telephony.TelephonyManager.EmergencyCallbackModeStopReason;
36 import android.telephony.TelephonyManager.EmergencyCallbackModeType;
37 import android.telephony.emergency.EmergencyNumber;
38 import android.telephony.ims.ImsReasonInfo;
39 import android.telephony.ims.MediaQualityStatus;
40 
41 import java.util.List;
42 import java.util.Set;
43 
44 /**
45  * {@hide}
46  */
47 public interface PhoneNotifier {
48 
notifyPhoneState(Phone sender)49     void notifyPhoneState(Phone sender);
50 
51     /**
52      * Notify registrants of the given phone's current ServiceState.
53      */
notifyServiceState(Phone sender)54     void notifyServiceState(Phone sender);
55 
56     /**
57      * Notify registrants with a given ServiceState. Passing in the subId allows us to
58      * send a final ServiceState update when the subId for the sender phone becomes invalid
59      * @param sender
60      * @param subId
61      */
notifyServiceStateForSubId(Phone sender, ServiceState ss, int subId)62     void notifyServiceStateForSubId(Phone sender, ServiceState ss, int subId);
63 
64     /**
65      * Notify registrants of the current CellLocation.
66      *
67      * <p>Use CellIdentity that is Parcellable to pass AIDL; convert to CellLocation in client code.
68      */
notifyCellLocation(Phone sender, CellIdentity cellIdentity)69     void notifyCellLocation(Phone sender, CellIdentity cellIdentity);
70 
71     @UnsupportedAppUsage
notifySignalStrength(Phone sender)72     void notifySignalStrength(Phone sender);
73 
74     @UnsupportedAppUsage
notifyMessageWaitingChanged(Phone sender)75     void notifyMessageWaitingChanged(Phone sender);
76 
notifyCallForwardingChanged(Phone sender)77     void notifyCallForwardingChanged(Phone sender);
78 
79     /** Send a notification that the Data Connection for a particular apnType has changed */
notifyDataConnection(Phone sender, PreciseDataConnectionState preciseState)80     void notifyDataConnection(Phone sender, PreciseDataConnectionState preciseState);
81 
notifyDataActivity(Phone sender)82     void notifyDataActivity(Phone sender);
83 
notifyCellInfo(Phone sender, List<CellInfo> cellInfo)84     void notifyCellInfo(Phone sender, List<CellInfo> cellInfo);
85 
86     /** Send a notification that precise call state changed. */
notifyPreciseCallState(Phone sender, String[] imsCallIds, @Annotation.ImsCallServiceType int[] imsCallServiceTypes, @Annotation.ImsCallType int[] imsCallTypes)87     void notifyPreciseCallState(Phone sender, String[] imsCallIds,
88             @Annotation.ImsCallServiceType int[] imsCallServiceTypes,
89             @Annotation.ImsCallType int[] imsCallTypes);
90 
notifyDisconnectCause(Phone sender, int cause, int preciseCause)91     void notifyDisconnectCause(Phone sender, int cause, int preciseCause);
92 
notifyImsDisconnectCause(Phone sender, ImsReasonInfo imsReasonInfo)93     void notifyImsDisconnectCause(Phone sender, ImsReasonInfo imsReasonInfo);
94 
95     /** Send a notification that the SRVCC state has changed.*/
notifySrvccStateChanged(Phone sender, @SrvccState int state)96     void notifySrvccStateChanged(Phone sender, @SrvccState int state);
97 
98     /** Send a notification that the voice activation state has changed */
notifyVoiceActivationStateChanged(Phone sender, int activationState)99     void notifyVoiceActivationStateChanged(Phone sender, int activationState);
100 
101     /** Send a notification that the data activation state has changed */
notifyDataActivationStateChanged(Phone sender, int activationState)102     void notifyDataActivationStateChanged(Phone sender, int activationState);
103 
104     /** Send a notification that the users mobile data setting has changed */
notifyUserMobileDataStateChanged(Phone sender, boolean state)105     void notifyUserMobileDataStateChanged(Phone sender, boolean state);
106 
107     /** Send a notification that the display info has changed */
notifyDisplayInfoChanged(Phone sender, TelephonyDisplayInfo telephonyDisplayInfo)108     void notifyDisplayInfoChanged(Phone sender, TelephonyDisplayInfo telephonyDisplayInfo);
109 
110     /** Send a notification that the phone capability has changed */
notifyPhoneCapabilityChanged(PhoneCapability capability)111     void notifyPhoneCapabilityChanged(PhoneCapability capability);
112 
notifyRadioPowerStateChanged(Phone sender, @RadioPowerState int state)113     void notifyRadioPowerStateChanged(Phone sender, @RadioPowerState int state);
114 
115     /** Notify of change to EmergencyNumberList. */
notifyEmergencyNumberList(Phone sender)116     void notifyEmergencyNumberList(Phone sender);
117 
118     /** Notify of a change for Outgoing Emergency Sms. */
notifyOutgoingEmergencySms(Phone sender, EmergencyNumber emergencyNumber)119     void notifyOutgoingEmergencySms(Phone sender, EmergencyNumber emergencyNumber);
120 
121     /** Notify of a change to the call quality of an active foreground call. */
notifyCallQualityChanged(Phone sender, CallQuality callQuality, int callNetworkType)122     void notifyCallQualityChanged(Phone sender, CallQuality callQuality, int callNetworkType);
123 
124     /** Notify of a change to the media quality status of an active foreground call. */
notifyMediaQualityStatusChanged(Phone sender, MediaQualityStatus status)125     void notifyMediaQualityStatusChanged(Phone sender, MediaQualityStatus status);
126 
127     /** Notify registration failed */
notifyRegistrationFailed(Phone sender, @NonNull CellIdentity cellIdentity, @NonNull String chosenPlmn, int domain, int causeCode, int additionalCauseCode)128     void notifyRegistrationFailed(Phone sender, @NonNull CellIdentity cellIdentity,
129             @NonNull String chosenPlmn, int domain, int causeCode, int additionalCauseCode);
130 
131     /** Notify barring info has changed */
notifyBarringInfoChanged(Phone sender, @NonNull BarringInfo barringInfo)132     void notifyBarringInfoChanged(Phone sender, @NonNull BarringInfo barringInfo);
133 
134     /** Notify of change to PhysicalChannelConfig. */
notifyPhysicalChannelConfig(Phone sender, List<PhysicalChannelConfig> configs)135     void notifyPhysicalChannelConfig(Phone sender, List<PhysicalChannelConfig> configs);
136 
137     /** Notify DataEnabled has changed. */
notifyDataEnabled(Phone sender, boolean enabled, @DataEnabledReason int reason)138     void notifyDataEnabled(Phone sender, boolean enabled, @DataEnabledReason int reason);
139 
140     /** Notify Allowed Network Type has changed. */
notifyAllowedNetworkTypesChanged(Phone sender, int reason, long allowedNetworkType)141     void notifyAllowedNetworkTypesChanged(Phone sender, int reason, long allowedNetworkType);
142 
143     /** Notify link capacity estimate has changed. */
notifyLinkCapacityEstimateChanged(Phone sender, List<LinkCapacityEstimate> linkCapacityEstimateList)144     void notifyLinkCapacityEstimateChanged(Phone sender,
145             List<LinkCapacityEstimate> linkCapacityEstimateList);
146 
147     /** Notify callback mode started. */
notifyCallbackModeStarted(Phone sender, @EmergencyCallbackModeType int type)148     void notifyCallbackModeStarted(Phone sender, @EmergencyCallbackModeType int type);
149 
150     /** Notify callback mode stopped. */
notifyCallbackModeStopped(Phone sender, @EmergencyCallbackModeType int type, @EmergencyCallbackModeStopReason int reason)151     void notifyCallbackModeStopped(Phone sender, @EmergencyCallbackModeType int type,
152             @EmergencyCallbackModeStopReason int reason);
153 
154     /** Notify that simultaneous cellular calling subscriptions have changed */
notifySimultaneousCellularCallingSubscriptionsChanged(Set<Integer> subIds)155     void notifySimultaneousCellularCallingSubscriptionsChanged(Set<Integer> subIds);
156 
157     /** Notify carrier roaming non-terrestrial network mode changed. **/
notifyCarrierRoamingNtnModeChanged(Phone sender, boolean active)158     void notifyCarrierRoamingNtnModeChanged(Phone sender, boolean active);
159 }
160