Merge "Expose SRVCC state changes as @SystemAPI" am: c10b96899e

am: 657343b811

Change-Id: I43bdae25b265586db2417e7f512eac04800de047
This commit is contained in:
Brad Ebinger
2018-11-09 15:27:27 -08:00
committed by android-build-merger
7 changed files with 118 additions and 33 deletions

View File

@@ -5160,7 +5160,9 @@ package android.telephony {
public class PhoneStateListener { public class PhoneStateListener {
method public void onRadioPowerStateChanged(int); method public void onRadioPowerStateChanged(int);
method public void onSrvccStateChanged(int);
field public static final int LISTEN_RADIO_POWER_STATE_CHANGED = 8388608; // 0x800000 field public static final int LISTEN_RADIO_POWER_STATE_CHANGED = 8388608; // 0x800000
field public static final int LISTEN_SRVCC_STATE_CHANGED = 16384; // 0x4000
} }
public class ServiceState implements android.os.Parcelable { public class ServiceState implements android.os.Parcelable {
@@ -5369,6 +5371,11 @@ package android.telephony {
field public static final int SIM_ACTIVATION_STATE_UNKNOWN = 0; // 0x0 field public static final int SIM_ACTIVATION_STATE_UNKNOWN = 0; // 0x0
field public static final int SIM_STATE_LOADED = 10; // 0xa field public static final int SIM_STATE_LOADED = 10; // 0xa
field public static final int SIM_STATE_PRESENT = 11; // 0xb field public static final int SIM_STATE_PRESENT = 11; // 0xb
field public static final int SRVCC_STATE_HANDOVER_CANCELED = 3; // 0x3
field public static final int SRVCC_STATE_HANDOVER_COMPLETED = 1; // 0x1
field public static final int SRVCC_STATE_HANDOVER_FAILED = 2; // 0x2
field public static final int SRVCC_STATE_HANDOVER_NONE = -1; // 0xffffffff
field public static final int SRVCC_STATE_HANDOVER_STARTED = 0; // 0x0
} }
public final class UiccAccessRule implements android.os.Parcelable { public final class UiccAccessRule implements android.os.Parcelable {

View File

@@ -47,7 +47,6 @@ import android.telephony.ServiceState;
import android.telephony.SignalStrength; import android.telephony.SignalStrength;
import android.telephony.SubscriptionManager; import android.telephony.SubscriptionManager;
import android.telephony.TelephonyManager; import android.telephony.TelephonyManager;
import android.telephony.VoLteServiceState;
import android.util.LocalLog; import android.util.LocalLog;
import android.util.StatsLog; import android.util.StatsLog;
@@ -196,7 +195,7 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
private ArrayList<List<PhysicalChannelConfig>> mPhysicalChannelConfigs; private ArrayList<List<PhysicalChannelConfig>> mPhysicalChannelConfigs;
private VoLteServiceState mVoLteServiceState = new VoLteServiceState(); private int[] mSrvccState;
private int mDefaultSubId = SubscriptionManager.INVALID_SUBSCRIPTION_ID; private int mDefaultSubId = SubscriptionManager.INVALID_SUBSCRIPTION_ID;
@@ -230,8 +229,7 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
static final int ENFORCE_PHONE_STATE_PERMISSION_MASK = static final int ENFORCE_PHONE_STATE_PERMISSION_MASK =
PhoneStateListener.LISTEN_CALL_FORWARDING_INDICATOR | PhoneStateListener.LISTEN_CALL_FORWARDING_INDICATOR |
PhoneStateListener.LISTEN_MESSAGE_WAITING_INDICATOR | PhoneStateListener.LISTEN_MESSAGE_WAITING_INDICATOR;
PhoneStateListener.LISTEN_VOLTE_STATE;
static final int PRECISE_PHONE_STATE_PERMISSION_MASK = static final int PRECISE_PHONE_STATE_PERMISSION_MASK =
PhoneStateListener.LISTEN_PRECISE_CALL_STATE | PhoneStateListener.LISTEN_PRECISE_CALL_STATE |
@@ -356,6 +354,7 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
mCallForwarding = new boolean[numPhones]; mCallForwarding = new boolean[numPhones];
mCellLocation = new Bundle[numPhones]; mCellLocation = new Bundle[numPhones];
mCellInfo = new ArrayList<List<CellInfo>>(); mCellInfo = new ArrayList<List<CellInfo>>();
mSrvccState = new int[numPhones];
mPhysicalChannelConfigs = new ArrayList<List<PhysicalChannelConfig>>(); mPhysicalChannelConfigs = new ArrayList<List<PhysicalChannelConfig>>();
for (int i = 0; i < numPhones; i++) { for (int i = 0; i < numPhones; i++) {
mCallState[i] = TelephonyManager.CALL_STATE_IDLE; mCallState[i] = TelephonyManager.CALL_STATE_IDLE;
@@ -371,6 +370,7 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
mCallForwarding[i] = false; mCallForwarding[i] = false;
mCellLocation[i] = new Bundle(); mCellLocation[i] = new Bundle();
mCellInfo.add(i, null); mCellInfo.add(i, null);
mSrvccState[i] = TelephonyManager.SRVCC_STATE_HANDOVER_NONE;
mPhysicalChannelConfigs.add(i, new ArrayList<PhysicalChannelConfig>()); mPhysicalChannelConfigs.add(i, new ArrayList<PhysicalChannelConfig>());
} }
@@ -772,6 +772,13 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
remove(r.binder); remove(r.binder);
} }
} }
if ((events & PhoneStateListener.LISTEN_SRVCC_STATE_CHANGED) != 0) {
try {
r.callback.onSrvccStateChanged(mSrvccState[phoneId]);
} catch (RemoteException ex) {
remove(r.binder);
}
}
} }
} }
} else { } else {
@@ -1522,19 +1529,30 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
TelephonyManager.NETWORK_TYPE_UNKNOWN, apnType, apn, reason, null, failCause); TelephonyManager.NETWORK_TYPE_UNKNOWN, apnType, apn, reason, null, failCause);
} }
public void notifyVoLteServiceStateChanged(VoLteServiceState lteState) { @Override
if (!checkNotifyPermission("notifyVoLteServiceStateChanged()")) { public void notifySrvccStateChanged(int subId, @TelephonyManager.SrvccState int state) {
if (!checkNotifyPermission("notifySrvccStateChanged()")) {
return; return;
} }
if (VDBG) {
log("notifySrvccStateChanged: subId=" + subId + " srvccState=" + state);
}
int phoneId = SubscriptionManager.getPhoneId(subId);
synchronized (mRecords) { synchronized (mRecords) {
mVoLteServiceState = lteState; if (validatePhoneId(phoneId)) {
for (Record r : mRecords) { mSrvccState[phoneId] = state;
if (r.matchPhoneStateListenerEvent(PhoneStateListener.LISTEN_VOLTE_STATE)) { for (Record r : mRecords) {
try { if (r.matchPhoneStateListenerEvent(
r.callback.onVoLteServiceStateChanged( PhoneStateListener.LISTEN_SRVCC_STATE_CHANGED) &&
new VoLteServiceState(mVoLteServiceState)); idMatch(r.subId, subId, phoneId)) {
} catch (RemoteException ex) { try {
mRemoveList.add(r.binder); if (DBG_LOC) {
log("notifySrvccStateChanged: mSrvccState=" + state + " r=" + r);
}
r.callback.onSrvccStateChanged(state);
} catch (RemoteException ex) {
mRemoveList.add(r.binder);
}
} }
} }
} }
@@ -1680,7 +1698,7 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
pw.println("mRingingCallState=" + mRingingCallState); pw.println("mRingingCallState=" + mRingingCallState);
pw.println("mForegroundCallState=" + mForegroundCallState); pw.println("mForegroundCallState=" + mForegroundCallState);
pw.println("mBackgroundCallState=" + mBackgroundCallState); pw.println("mBackgroundCallState=" + mBackgroundCallState);
pw.println("mVoLteServiceState=" + mVoLteServiceState); pw.println("mSrvccState=" + mSrvccState);
pw.println("mPhoneCapability=" + mPhoneCapability); pw.println("mPhoneCapability=" + mPhoneCapability);
pw.println("mPreferredDataSubId=" + mPreferredDataSubId); pw.println("mPreferredDataSubId=" + mPreferredDataSubId);
pw.println("mRadioPowerState=" + mRadioPowerState); pw.println("mRadioPowerState=" + mRadioPowerState);
@@ -1931,6 +1949,12 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE, null); android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE, null);
} }
if ((events & PhoneStateListener.LISTEN_SRVCC_STATE_CHANGED) != 0) {
mContext.enforceCallingOrSelfPermission(
android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE, null);
}
return true; return true;
} }

View File

@@ -16,7 +16,9 @@
package android.telephony; package android.telephony;
import android.Manifest;
import android.annotation.NonNull; import android.annotation.NonNull;
import android.annotation.RequiresPermission;
import android.annotation.SystemApi; import android.annotation.SystemApi;
import android.annotation.UnsupportedAppUsage; import android.annotation.UnsupportedAppUsage;
import android.os.Bundle; import android.os.Bundle;
@@ -201,12 +203,13 @@ public class PhoneStateListener {
public static final int LISTEN_DATA_CONNECTION_REAL_TIME_INFO = 0x00002000; public static final int LISTEN_DATA_CONNECTION_REAL_TIME_INFO = 0x00002000;
/** /**
* Listen for changes to LTE network state * Listen for changes to the SRVCC state of the active call.
* * @see #onServiceStateChanged(ServiceState)
* @see #onLteNetworkStateChanged
* @hide * @hide
*/ */
public static final int LISTEN_VOLTE_STATE = 0x00004000; @SystemApi
@RequiresPermission(Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
public static final int LISTEN_SRVCC_STATE_CHANGED = 0x00004000;
/** /**
* Listen for OEM hook raw event * Listen for OEM hook raw event
@@ -409,8 +412,8 @@ public class PhoneStateListener {
PhoneStateListener.this.onDataConnectionRealTimeInfoChanged( PhoneStateListener.this.onDataConnectionRealTimeInfoChanged(
(DataConnectionRealTimeInfo)msg.obj); (DataConnectionRealTimeInfo)msg.obj);
break; break;
case LISTEN_VOLTE_STATE: case LISTEN_SRVCC_STATE_CHANGED:
PhoneStateListener.this.onVoLteServiceStateChanged((VoLteServiceState)msg.obj); PhoneStateListener.this.onSrvccStateChanged((int) msg.obj);
break; break;
case LISTEN_VOICE_ACTIVATION_STATE: case LISTEN_VOICE_ACTIVATION_STATE:
PhoneStateListener.this.onVoiceActivationStateChanged((int)msg.obj); PhoneStateListener.this.onVoiceActivationStateChanged((int)msg.obj);
@@ -613,13 +616,13 @@ public class PhoneStateListener {
} }
/** /**
* Callback invoked when the service state of LTE network * Callback invoked when there has been a change in the Single Radio Voice Call Continuity
* related to the VoLTE service has changed. * (SRVCC) state for the currently active call.
* @param stateInfo is the current LTE network information
* @hide * @hide
*/ */
@UnsupportedAppUsage @SystemApi
public void onVoLteServiceStateChanged(VoLteServiceState stateInfo) { public void onSrvccStateChanged(@TelephonyManager.SrvccState int srvccState) {
} }
/** /**
@@ -803,8 +806,8 @@ public class PhoneStateListener {
send(LISTEN_DATA_CONNECTION_REAL_TIME_INFO, 0, 0, dcRtInfo); send(LISTEN_DATA_CONNECTION_REAL_TIME_INFO, 0, 0, dcRtInfo);
} }
public void onVoLteServiceStateChanged(VoLteServiceState lteState) { public void onSrvccStateChanged(int state) {
send(LISTEN_VOLTE_STATE, 0, 0, lteState); send(LISTEN_SRVCC_STATE_CHANGED, 0, 0, state);
} }
public void onVoiceActivationStateChanged(int activationState) { public void onVoiceActivationStateChanged(int activationState) {

View File

@@ -181,6 +181,57 @@ public class TelephonyManager {
/** @hide */ /** @hide */
static public final int KEY_TYPE_WLAN = 2; static public final int KEY_TYPE_WLAN = 2;
/**
* No Single Radio Voice Call Continuity (SRVCC) handover is active.
* See TS 23.216 for more information.
* @hide
*/
@SystemApi
public static final int SRVCC_STATE_HANDOVER_NONE = -1;
/**
* Single Radio Voice Call Continuity (SRVCC) handover has been started on the network.
* See TS 23.216 for more information.
* @hide
*/
@SystemApi
public static final int SRVCC_STATE_HANDOVER_STARTED = 0;
/**
* Ongoing Single Radio Voice Call Continuity (SRVCC) handover has successfully completed.
* See TS 23.216 for more information.
* @hide
*/
@SystemApi
public static final int SRVCC_STATE_HANDOVER_COMPLETED = 1;
/**
* Ongoing Single Radio Voice Call Continuity (SRVCC) handover has failed.
* See TS 23.216 for more information.
* @hide
*/
@SystemApi
public static final int SRVCC_STATE_HANDOVER_FAILED = 2;
/**
* Ongoing Single Radio Voice Call Continuity (SRVCC) handover has been canceled.
* See TS 23.216 for more information.
* @hide
*/
@SystemApi
public static final int SRVCC_STATE_HANDOVER_CANCELED = 3;
/** @hide */
@Retention(RetentionPolicy.SOURCE)
@IntDef(prefix = {"SRVCC_STATE_"},
value = {
SRVCC_STATE_HANDOVER_NONE,
SRVCC_STATE_HANDOVER_STARTED,
SRVCC_STATE_HANDOVER_COMPLETED,
SRVCC_STATE_HANDOVER_FAILED,
SRVCC_STATE_HANDOVER_CANCELED})
public @interface SrvccState {}
private final Context mContext; private final Context mContext;
private final int mSubId; private final int mSubId;
@UnsupportedAppUsage @UnsupportedAppUsage

View File

@@ -24,9 +24,11 @@ import android.telephony.Rlog;
/** /**
* Contains LTE network state related information. * Contains LTE network state related information.
* * @deprecated Only contains SRVCC state, which isn't specific to LTE handovers. For SRVCC
* indications, use {@link PhoneStateListener#onSrvccStateChanged(int)}.
* @hide * @hide
*/ */
@Deprecated
public final class VoLteServiceState implements Parcelable { public final class VoLteServiceState implements Parcelable {
private static final String LOG_TAG = "VoLteServiceState"; private static final String LOG_TAG = "VoLteServiceState";

View File

@@ -25,7 +25,6 @@ import android.telephony.PhoneCapability;
import android.telephony.PhysicalChannelConfig; import android.telephony.PhysicalChannelConfig;
import android.telephony.PreciseCallState; import android.telephony.PreciseCallState;
import android.telephony.PreciseDataConnectionState; import android.telephony.PreciseDataConnectionState;
import android.telephony.VoLteServiceState;
oneway interface IPhoneStateListener { oneway interface IPhoneStateListener {
void onServiceStateChanged(in ServiceState serviceState); void onServiceStateChanged(in ServiceState serviceState);
@@ -45,7 +44,7 @@ oneway interface IPhoneStateListener {
void onPreciseCallStateChanged(in PreciseCallState callState); void onPreciseCallStateChanged(in PreciseCallState callState);
void onPreciseDataConnectionStateChanged(in PreciseDataConnectionState dataConnectionState); void onPreciseDataConnectionStateChanged(in PreciseDataConnectionState dataConnectionState);
void onDataConnectionRealTimeInfoChanged(in DataConnectionRealTimeInfo dcRtInfo); void onDataConnectionRealTimeInfoChanged(in DataConnectionRealTimeInfo dcRtInfo);
void onVoLteServiceStateChanged(in VoLteServiceState lteState); void onSrvccStateChanged(in int state);
void onVoiceActivationStateChanged(int activationState); void onVoiceActivationStateChanged(int activationState);
void onDataActivationStateChanged(int activationState); void onDataActivationStateChanged(int activationState);
void onOemHookRawEvent(in byte[] rawData); void onOemHookRawEvent(in byte[] rawData);

View File

@@ -25,7 +25,6 @@ import android.telephony.PhoneCapability;
import android.telephony.PhysicalChannelConfig; import android.telephony.PhysicalChannelConfig;
import android.telephony.ServiceState; import android.telephony.ServiceState;
import android.telephony.SignalStrength; import android.telephony.SignalStrength;
import android.telephony.VoLteServiceState;
import com.android.internal.telephony.IPhoneStateListener; import com.android.internal.telephony.IPhoneStateListener;
import com.android.internal.telephony.IOnSubscriptionsChangedListener; import com.android.internal.telephony.IOnSubscriptionsChangedListener;
@@ -70,7 +69,7 @@ interface ITelephonyRegistry {
void notifyPreciseDataConnectionFailed(String reason, String apnType, String apn, void notifyPreciseDataConnectionFailed(String reason, String apnType, String apn,
String failCause); String failCause);
void notifyCellInfoForSubscriber(in int subId, in List<CellInfo> cellInfo); void notifyCellInfoForSubscriber(in int subId, in List<CellInfo> cellInfo);
void notifyVoLteServiceStateChanged(in VoLteServiceState lteState); void notifySrvccStateChanged(in int subId, in int lteState);
void notifySimActivationStateChangedForPhoneId(in int phoneId, in int subId, void notifySimActivationStateChangedForPhoneId(in int phoneId, in int subId,
int activationState, int activationType); int activationState, int activationType);
void notifyOemHookRawEventForSubscriber(in int subId, in byte[] rawData); void notifyOemHookRawEventForSubscriber(in int subId, in byte[] rawData);