Merge "[DO NOT MERGE] Revert submission 9950791-pick-precise-dataconn" into qt-qpr1-dev-plus-aosp
This commit is contained in:
@@ -35,8 +35,8 @@ import android.telephony.Annotation.SrvccState;
|
||||
import android.telephony.emergency.EmergencyNumber;
|
||||
import android.telephony.ims.ImsReasonInfo;
|
||||
|
||||
import com.android.internal.annotations.VisibleForTesting;
|
||||
import com.android.internal.telephony.IPhoneStateListener;
|
||||
import com.android.internal.annotations.VisibleForTesting;
|
||||
|
||||
import dalvik.system.VMRuntime;
|
||||
|
||||
@@ -188,13 +188,12 @@ public class PhoneStateListener {
|
||||
/**
|
||||
* Listen for {@link PreciseDataConnectionState} on the data connection (cellular).
|
||||
*
|
||||
* <p>Requires permission {@link android.Manifest.permission#MODIFY_PHONE_STATE}
|
||||
* or the calling app has carrier privileges
|
||||
* (see {@link TelephonyManager#hasCarrierPrivileges}).
|
||||
*
|
||||
* @see #onPreciseDataConnectionStateChanged
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
@RequiresPermission((android.Manifest.permission.MODIFY_PHONE_STATE))
|
||||
@RequiresPermission((android.Manifest.permission.READ_PRECISE_PHONE_STATE))
|
||||
@SystemApi
|
||||
public static final int LISTEN_PRECISE_DATA_CONNECTION_STATE = 0x00001000;
|
||||
|
||||
/**
|
||||
@@ -689,9 +688,8 @@ public class PhoneStateListener {
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback providing update about the default/internet data connection on the registered
|
||||
* subscription.
|
||||
*
|
||||
* Callback invoked when data connection state changes with precise information
|
||||
* on the registered subscription.
|
||||
* Note, the registration subId comes from {@link TelephonyManager} object which registers
|
||||
* PhoneStateListener by {@link TelephonyManager#listen(PhoneStateListener, int)}.
|
||||
* If this TelephonyManager object was created with
|
||||
@@ -699,13 +697,12 @@ public class PhoneStateListener {
|
||||
* subId. Otherwise, this callback applies to
|
||||
* {@link SubscriptionManager#getDefaultSubscriptionId()}.
|
||||
*
|
||||
* <p>Requires permission {@link android.Manifest.permission#MODIFY_PHONE_STATE}
|
||||
* or the calling app has carrier privileges
|
||||
* (see {@link TelephonyManager#hasCarrierPrivileges}).
|
||||
*
|
||||
* @param dataConnectionState {@link PreciseDataConnectionState}
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
@RequiresPermission((android.Manifest.permission.MODIFY_PHONE_STATE))
|
||||
@RequiresPermission((android.Manifest.permission.READ_PRECISE_PHONE_STATE))
|
||||
@SystemApi
|
||||
public void onPreciseDataConnectionStateChanged(
|
||||
@NonNull PreciseDataConnectionState dataConnectionState) {
|
||||
// default implementation empty
|
||||
@@ -1014,21 +1011,11 @@ public class PhoneStateListener {
|
||||
PhoneStateListener psl = mPhoneStateListenerWeakRef.get();
|
||||
if (psl == null) return;
|
||||
|
||||
if (state == TelephonyManager.DATA_DISCONNECTING
|
||||
&& VMRuntime.getRuntime().getTargetSdkVersion() < Build.VERSION_CODES.R) {
|
||||
Binder.withCleanCallingIdentity(() -> mExecutor.execute(
|
||||
() -> {
|
||||
psl.onDataConnectionStateChanged(
|
||||
TelephonyManager.DATA_CONNECTED, networkType);
|
||||
psl.onDataConnectionStateChanged(TelephonyManager.DATA_CONNECTED);
|
||||
}));
|
||||
} else {
|
||||
Binder.withCleanCallingIdentity(() -> mExecutor.execute(
|
||||
() -> {
|
||||
psl.onDataConnectionStateChanged(state, networkType);
|
||||
psl.onDataConnectionStateChanged(state);
|
||||
}));
|
||||
}
|
||||
Binder.withCleanCallingIdentity(() -> mExecutor.execute(
|
||||
() -> {
|
||||
psl.onDataConnectionStateChanged(state, networkType);
|
||||
psl.onDataConnectionStateChanged(state);
|
||||
}));
|
||||
}
|
||||
|
||||
public void onDataActivity(int direction) {
|
||||
|
||||
@@ -21,15 +21,19 @@ import android.annotation.RequiresPermission;
|
||||
import android.annotation.SystemApi;
|
||||
import android.annotation.TestApi;
|
||||
import android.content.Context;
|
||||
import android.net.LinkProperties;
|
||||
import android.net.NetworkCapabilities;
|
||||
import android.os.Binder;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.HandlerExecutor;
|
||||
import android.os.RemoteException;
|
||||
import android.os.ServiceManager;
|
||||
import android.telephony.Annotation.ApnType;
|
||||
import android.telephony.Annotation.CallState;
|
||||
import android.telephony.Annotation.DataActivityType;
|
||||
import android.telephony.Annotation.DataFailureCause;
|
||||
import android.telephony.Annotation.DataState;
|
||||
import android.telephony.Annotation.NetworkType;
|
||||
import android.telephony.Annotation.PreciseCallStates;
|
||||
import android.telephony.Annotation.RadioPowerState;
|
||||
@@ -361,18 +365,27 @@ public class TelephonyRegistryManager {
|
||||
* @param subId for which data connection state changed.
|
||||
* @param slotIndex for which data connections state changed. Can be derived from subId except
|
||||
* when subId is invalid.
|
||||
* @param apnType the APN type that triggered this update
|
||||
* @param preciseState the PreciseDataConnectionState
|
||||
*
|
||||
* @see android.telephony.PreciseDataConnection
|
||||
* @param state latest data connection state, e.g,
|
||||
* @param isDataConnectivityPossible indicates if data is allowed
|
||||
* @param apn the APN {@link ApnSetting#getApnName()} of this data connection.
|
||||
* @param apnType the apnType, "ims" for IMS APN, "emergency" for EMERGENCY APN.
|
||||
* @param linkProperties {@link LinkProperties} associated with this data connection.
|
||||
* @param networkCapabilities {@link NetworkCapabilities} associated with this data connection.
|
||||
* @param networkType associated with this data connection.
|
||||
* @param roaming {@code true} indicates in roaming, {@false} otherwise.
|
||||
* @see TelephonyManager#DATA_DISCONNECTED
|
||||
* @see TelephonyManager#isDataConnectivityPossible()
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
public void notifyDataConnectionForSubscriber(int slotIndex, int subId,
|
||||
String apnType, PreciseDataConnectionState preciseState) {
|
||||
public void notifyDataConnectionForSubscriber(int slotIndex, int subId, @DataState int state,
|
||||
boolean isDataConnectivityPossible,
|
||||
@ApnType String apn, String apnType, LinkProperties linkProperties,
|
||||
NetworkCapabilities networkCapabilities, int networkType, boolean roaming) {
|
||||
try {
|
||||
sRegistry.notifyDataConnectionForSubscriber(
|
||||
slotIndex, subId, apnType, preciseState);
|
||||
sRegistry.notifyDataConnectionForSubscriber(slotIndex, subId, state,
|
||||
isDataConnectivityPossible,
|
||||
apn, apnType, linkProperties, networkCapabilities, networkType, roaming);
|
||||
} catch (RemoteException ex) {
|
||||
// system process is dead
|
||||
}
|
||||
@@ -640,6 +653,25 @@ public class TelephonyRegistryManager {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Notify data connection failed on certain subscription.
|
||||
*
|
||||
* @param subId for which data connection failed.
|
||||
* @param slotIndex for which data conenction faled. Can be derived from subId except when subId
|
||||
* is invalid.
|
||||
* @param apnType the apnType, "ims" for IMS APN, "emergency" for EMERGENCY APN. Note each data
|
||||
* connection can support multiple anyTypes.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
public void notifyDataConnectionFailed(int subId, int slotIndex, String apnType) {
|
||||
try {
|
||||
sRegistry.notifyDataConnectionFailedForSubscriber(slotIndex, subId, apnType);
|
||||
} catch (RemoteException ex) {
|
||||
// system process is dead
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO change from bundle to CellLocation?
|
||||
* @hide
|
||||
|
||||
@@ -24,8 +24,6 @@ import android.telephony.CallQuality;
|
||||
import android.telephony.CellInfo;
|
||||
import android.telephony.ims.ImsReasonInfo;
|
||||
import android.telephony.PhoneCapability;
|
||||
import android.telephony.PhysicalChannelConfig;
|
||||
import android.telephony.PreciseDataConnectionState;
|
||||
import android.telephony.ServiceState;
|
||||
import android.telephony.SignalStrength;
|
||||
import android.telephony.emergency.EmergencyNumber;
|
||||
@@ -56,8 +54,13 @@ interface ITelephonyRegistry {
|
||||
@UnsupportedAppUsage(maxTargetSdk = 28)
|
||||
void notifyDataActivity(int state);
|
||||
void notifyDataActivityForSubscriber(in int subId, int state);
|
||||
void notifyDataConnectionForSubscriber(
|
||||
int phoneId, int subId, String apnType, in PreciseDataConnectionState preciseState);
|
||||
void notifyDataConnection(int state, boolean isDataConnectivityPossible,
|
||||
String apn, String apnType, in LinkProperties linkProperties,
|
||||
in NetworkCapabilities networkCapabilities, int networkType, boolean roaming);
|
||||
void notifyDataConnectionForSubscriber(int phoneId, int subId, int state,
|
||||
boolean isDataConnectivityPossible,
|
||||
String apn, String apnType, in LinkProperties linkProperties,
|
||||
in NetworkCapabilities networkCapabilities, int networkType, boolean roaming);
|
||||
@UnsupportedAppUsage
|
||||
void notifyDataConnectionFailed(String apnType);
|
||||
void notifyDataConnectionFailedForSubscriber(int phoneId, int subId, String apnType);
|
||||
|
||||
Reference in New Issue
Block a user