Merge "new API for IMS call fail cause"
am: ebad5a64d0
Change-Id: I70870709a27c48bc30c748e04e53c72780224bd8
This commit is contained in:
@@ -6049,6 +6049,7 @@ package android.telephony {
|
||||
public class PhoneStateListener {
|
||||
method public void onCallAttributesChanged(@NonNull android.telephony.CallAttributes);
|
||||
method public void onCallDisconnectCauseChanged(int, int);
|
||||
method public void onImsCallDisconnectCauseChanged(@NonNull android.telephony.ims.ImsReasonInfo);
|
||||
method public void onPreciseCallStateChanged(android.telephony.PreciseCallState);
|
||||
method public void onPreciseDataConnectionStateChanged(android.telephony.PreciseDataConnectionState);
|
||||
method public void onRadioPowerStateChanged(int);
|
||||
@@ -6056,6 +6057,7 @@ package android.telephony {
|
||||
method public void onVoiceActivationStateChanged(int);
|
||||
field public static final int LISTEN_CALL_ATTRIBUTES_CHANGED = 67108864; // 0x4000000
|
||||
field public static final int LISTEN_CALL_DISCONNECT_CAUSES = 33554432; // 0x2000000
|
||||
field public static final int LISTEN_IMS_CALL_DISCONNECT_CAUSES = 134217728; // 0x8000000
|
||||
field public static final int LISTEN_PRECISE_CALL_STATE = 2048; // 0x800
|
||||
field public static final int LISTEN_PRECISE_DATA_CONNECTION_STATE = 4096; // 0x1000
|
||||
field public static final int LISTEN_RADIO_POWER_STATE_CHANGED = 8388608; // 0x800000
|
||||
|
||||
@@ -52,6 +52,7 @@ import android.telephony.SubscriptionManager;
|
||||
import android.telephony.TelephonyManager;
|
||||
import android.telephony.data.ApnSetting;
|
||||
import android.telephony.emergency.EmergencyNumber;
|
||||
import android.telephony.ims.ImsReasonInfo;
|
||||
import android.util.LocalLog;
|
||||
import android.util.StatsLog;
|
||||
|
||||
@@ -227,6 +228,8 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
|
||||
|
||||
private int mCallDisconnectCause = DisconnectCause.NOT_VALID;
|
||||
|
||||
private List<ImsReasonInfo> mImsReasonInfo = null;
|
||||
|
||||
private int mCallPreciseDisconnectCause = PreciseDisconnectCause.NOT_VALID;
|
||||
|
||||
private boolean mCarrierNetworkChangeState = false;
|
||||
@@ -377,6 +380,7 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
|
||||
mCellLocation = new Bundle[numPhones];
|
||||
mCellInfo = new ArrayList<List<CellInfo>>();
|
||||
mSrvccState = new int[numPhones];
|
||||
mImsReasonInfo = new ArrayList<ImsReasonInfo>();
|
||||
mPhysicalChannelConfigs = new ArrayList<List<PhysicalChannelConfig>>();
|
||||
mEmergencyNumberList = new HashMap<>();
|
||||
for (int i = 0; i < numPhones; i++) {
|
||||
@@ -394,6 +398,7 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
|
||||
mCallForwarding[i] = false;
|
||||
mCellLocation[i] = new Bundle();
|
||||
mCellInfo.add(i, null);
|
||||
mImsReasonInfo.add(i, null);
|
||||
mSrvccState[i] = TelephonyManager.SRVCC_STATE_HANDOVER_NONE;
|
||||
mPhysicalChannelConfigs.add(i, new ArrayList<PhysicalChannelConfig>());
|
||||
}
|
||||
@@ -739,6 +744,13 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
|
||||
remove(r.binder);
|
||||
}
|
||||
}
|
||||
if ((events & PhoneStateListener.LISTEN_IMS_CALL_DISCONNECT_CAUSES) != 0) {
|
||||
try {
|
||||
r.callback.onImsCallDisconnectCauseChanged(mImsReasonInfo.get(phoneId));
|
||||
} catch (RemoteException ex) {
|
||||
remove(r.binder);
|
||||
}
|
||||
}
|
||||
if ((events & PhoneStateListener.LISTEN_PRECISE_DATA_CONNECTION_STATE) != 0) {
|
||||
try {
|
||||
r.callback.onPreciseDataConnectionStateChanged(
|
||||
@@ -1591,6 +1603,34 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
|
||||
}
|
||||
}
|
||||
|
||||
public void notifyImsDisconnectCause(int subId, ImsReasonInfo imsReasonInfo) {
|
||||
if (!checkNotifyPermission("notifyImsCallDisconnectCause()")) {
|
||||
return;
|
||||
}
|
||||
int phoneId = SubscriptionManager.getPhoneId(subId);
|
||||
synchronized (mRecords) {
|
||||
if (validatePhoneId(phoneId)) {
|
||||
mImsReasonInfo.set(phoneId, imsReasonInfo);
|
||||
for (Record r : mRecords) {
|
||||
if (r.matchPhoneStateListenerEvent(
|
||||
PhoneStateListener.LISTEN_IMS_CALL_DISCONNECT_CAUSES)
|
||||
&& idMatch(r.subId, subId, phoneId)) {
|
||||
try {
|
||||
if (DBG_LOC) {
|
||||
log("notifyImsCallDisconnectCause: mImsReasonInfo="
|
||||
+ imsReasonInfo + " r=" + r);
|
||||
}
|
||||
r.callback.onImsCallDisconnectCauseChanged(mImsReasonInfo.get(phoneId));
|
||||
} catch (RemoteException ex) {
|
||||
mRemoveList.add(r.binder);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
handleRemoveListLocked();
|
||||
}
|
||||
}
|
||||
|
||||
public void notifyPreciseDataConnectionFailed(String apnType,
|
||||
String apn, @DataFailCause.FailCause int failCause) {
|
||||
if (!checkNotifyPermission("notifyPreciseDataConnectionFailed()")) {
|
||||
@@ -1627,7 +1667,7 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
|
||||
int phoneId = SubscriptionManager.getPhoneId(subId);
|
||||
synchronized (mRecords) {
|
||||
if (validatePhoneId(phoneId)) {
|
||||
mSrvccState[phoneId] = state;
|
||||
mSrvccState[phoneId] = state;
|
||||
for (Record r : mRecords) {
|
||||
if (r.matchPhoneStateListenerEvent(
|
||||
PhoneStateListener.LISTEN_SRVCC_STATE_CHANGED) &&
|
||||
@@ -1838,6 +1878,7 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
|
||||
pw.println("mDataConnectionState=" + mDataConnectionState[i]);
|
||||
pw.println("mCellLocation=" + mCellLocation[i]);
|
||||
pw.println("mCellInfo=" + mCellInfo.get(i));
|
||||
pw.println("mImsCallDisconnectCause=" + mImsReasonInfo.get(i).toString());
|
||||
pw.decreaseIndent();
|
||||
}
|
||||
pw.println("mPreciseDataConnectionState=" + mPreciseDataConnectionState);
|
||||
@@ -2127,6 +2168,11 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
|
||||
android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE, null);
|
||||
}
|
||||
|
||||
if ((events & PhoneStateListener.LISTEN_IMS_CALL_DISCONNECT_CAUSES) != 0) {
|
||||
mContext.enforceCallingOrSelfPermission(
|
||||
android.Manifest.permission.READ_PRECISE_PHONE_STATE, null);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -28,6 +28,7 @@ import android.os.Handler;
|
||||
import android.os.HandlerExecutor;
|
||||
import android.os.Looper;
|
||||
import android.telephony.emergency.EmergencyNumber;
|
||||
import android.telephony.ims.ImsReasonInfo;
|
||||
|
||||
import com.android.internal.annotations.VisibleForTesting;
|
||||
import com.android.internal.telephony.IPhoneStateListener;
|
||||
@@ -347,6 +348,20 @@ public class PhoneStateListener {
|
||||
@SystemApi
|
||||
public static final int LISTEN_CALL_ATTRIBUTES_CHANGED = 0x04000000;
|
||||
|
||||
/**
|
||||
* Listen for IMS call disconnect causes which contains
|
||||
* {@link android.telephony.ims.ImsReasonInfo}
|
||||
*
|
||||
* {@more}
|
||||
* Requires Permission: {@link android.Manifest.permission#READ_PRECISE_PHONE_STATE
|
||||
* READ_PRECISE_PHONE_STATE}
|
||||
*
|
||||
* @see #onImsCallDisconnectCauseChanged(ImsReasonInfo)
|
||||
* @hide
|
||||
*/
|
||||
@SystemApi
|
||||
public static final int LISTEN_IMS_CALL_DISCONNECT_CAUSES = 0x08000000;
|
||||
|
||||
/*
|
||||
* Subscription used to listen to the phone state changes
|
||||
* @hide
|
||||
@@ -577,6 +592,17 @@ public class PhoneStateListener {
|
||||
// default implementation empty
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback invoked when Ims call disconnect cause changes.
|
||||
* @param imsReasonInfo {@link ImsReasonInfo} contains details on why IMS call failed.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
@SystemApi
|
||||
public void onImsCallDisconnectCauseChanged(@NonNull ImsReasonInfo imsReasonInfo) {
|
||||
// default implementation empty
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback invoked when data connection state changes with precise information.
|
||||
* @param dataConnectionState {@link PreciseDataConnectionState}
|
||||
@@ -981,6 +1007,16 @@ public class PhoneStateListener {
|
||||
Binder.withCleanCallingIdentity(
|
||||
() -> mExecutor.execute(() -> psl.onPreferredDataSubIdChanged(subId)));
|
||||
}
|
||||
|
||||
public void onImsCallDisconnectCauseChanged(ImsReasonInfo disconnectCause) {
|
||||
PhoneStateListener psl = mPhoneStateListenerWeakRef.get();
|
||||
if (psl == null) return;
|
||||
|
||||
Binder.withCleanCallingIdentity(
|
||||
() -> mExecutor.execute(
|
||||
() -> psl.onImsCallDisconnectCauseChanged(disconnectCause)));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -27,6 +27,7 @@ import android.telephony.PreciseDataConnectionState;
|
||||
import android.telephony.ServiceState;
|
||||
import android.telephony.SignalStrength;
|
||||
import android.telephony.emergency.EmergencyNumber;
|
||||
import android.telephony.ims.ImsReasonInfo;
|
||||
|
||||
oneway interface IPhoneStateListener {
|
||||
void onServiceStateChanged(in ServiceState serviceState);
|
||||
@@ -58,5 +59,6 @@ oneway interface IPhoneStateListener {
|
||||
void onCallAttributesChanged(in CallAttributes callAttributes);
|
||||
void onEmergencyNumberListChanged(in Map emergencyNumberList);
|
||||
void onCallDisconnectCauseChanged(in int disconnectCause, in int preciseDisconnectCause);
|
||||
void onImsCallDisconnectCauseChanged(in ImsReasonInfo imsReasonInfo);
|
||||
}
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@ import android.net.NetworkCapabilities;
|
||||
import android.os.Bundle;
|
||||
import android.telephony.CallQuality;
|
||||
import android.telephony.CellInfo;
|
||||
import android.telephony.ims.ImsReasonInfo;
|
||||
import android.telephony.PhoneCapability;
|
||||
import android.telephony.PhysicalChannelConfig;
|
||||
import android.telephony.ServiceState;
|
||||
@@ -84,4 +85,5 @@ interface ITelephonyRegistry {
|
||||
void notifyRadioPowerStateChanged(in int state);
|
||||
void notifyEmergencyNumberList();
|
||||
void notifyCallQualityChanged(in CallQuality callQuality, int phoneId);
|
||||
void notifyImsDisconnectCause(int subId, in ImsReasonInfo imsReasonInfo);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user