Merge "Remove hidden APIs for callState and dataState."
This commit is contained in:
@@ -72,7 +72,6 @@ import com.android.internal.app.IBatteryStats;
|
|||||||
import com.android.internal.telephony.IOnSubscriptionsChangedListener;
|
import com.android.internal.telephony.IOnSubscriptionsChangedListener;
|
||||||
import com.android.internal.telephony.IPhoneStateListener;
|
import com.android.internal.telephony.IPhoneStateListener;
|
||||||
import com.android.internal.telephony.ITelephonyRegistry;
|
import com.android.internal.telephony.ITelephonyRegistry;
|
||||||
import com.android.internal.telephony.PhoneConstantConversions;
|
|
||||||
import com.android.internal.telephony.PhoneConstants;
|
import com.android.internal.telephony.PhoneConstants;
|
||||||
import com.android.internal.telephony.TelephonyIntents;
|
import com.android.internal.telephony.TelephonyIntents;
|
||||||
import com.android.internal.telephony.TelephonyPermissions;
|
import com.android.internal.telephony.TelephonyPermissions;
|
||||||
@@ -2254,8 +2253,7 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Intent intent = new Intent(TelephonyManager.ACTION_PHONE_STATE_CHANGED);
|
Intent intent = new Intent(TelephonyManager.ACTION_PHONE_STATE_CHANGED);
|
||||||
intent.putExtra(PhoneConstants.STATE_KEY,
|
intent.putExtra(TelephonyManager.EXTRA_STATE, callStateToString(state));
|
||||||
PhoneConstantConversions.convertCallState(state).toString());
|
|
||||||
|
|
||||||
// If a valid subId was specified, we should fire off a subId-specific state
|
// If a valid subId was specified, we should fire off a subId-specific state
|
||||||
// change intent and include the subId.
|
// change intent and include the subId.
|
||||||
@@ -2288,6 +2286,18 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
|
|||||||
android.Manifest.permission.READ_CALL_LOG});
|
android.Manifest.permission.READ_CALL_LOG});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Converts TelephonyManager#CALL_STATE_* to TelephonyManager#EXTRA_STATE_*. */
|
||||||
|
private static String callStateToString(int callState) {
|
||||||
|
switch (callState) {
|
||||||
|
case TelephonyManager.CALL_STATE_RINGING:
|
||||||
|
return TelephonyManager.EXTRA_STATE_RINGING;
|
||||||
|
case TelephonyManager.CALL_STATE_OFFHOOK:
|
||||||
|
return TelephonyManager.EXTRA_STATE_OFFHOOK;
|
||||||
|
default:
|
||||||
|
return TelephonyManager.EXTRA_STATE_IDLE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void broadcastDataConnectionStateChanged(int state, boolean isDataAllowed, String apn,
|
private void broadcastDataConnectionStateChanged(int state, boolean isDataAllowed, String apn,
|
||||||
String apnType, LinkProperties linkProperties,
|
String apnType, LinkProperties linkProperties,
|
||||||
NetworkCapabilities networkCapabilities,
|
NetworkCapabilities networkCapabilities,
|
||||||
@@ -2296,8 +2306,7 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
|
|||||||
// status bar takes care of that after taking into account all of the
|
// status bar takes care of that after taking into account all of the
|
||||||
// required info.
|
// required info.
|
||||||
Intent intent = new Intent(TelephonyIntents.ACTION_ANY_DATA_CONNECTION_STATE_CHANGED);
|
Intent intent = new Intent(TelephonyIntents.ACTION_ANY_DATA_CONNECTION_STATE_CHANGED);
|
||||||
intent.putExtra(PhoneConstants.STATE_KEY,
|
intent.putExtra(TelephonyManager.EXTRA_STATE, dataStateToString(state));
|
||||||
PhoneConstantConversions.convertDataState(state).toString());
|
|
||||||
if (!isDataAllowed) {
|
if (!isDataAllowed) {
|
||||||
intent.putExtra(PhoneConstants.NETWORK_UNAVAILABLE_KEY, true);
|
intent.putExtra(PhoneConstants.NETWORK_UNAVAILABLE_KEY, true);
|
||||||
}
|
}
|
||||||
@@ -2340,7 +2349,7 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
|
|||||||
String apnType, String apn, LinkProperties linkProperties,
|
String apnType, String apn, LinkProperties linkProperties,
|
||||||
@DataFailureCause int failCause) {
|
@DataFailureCause int failCause) {
|
||||||
Intent intent = new Intent(TelephonyManager.ACTION_PRECISE_DATA_CONNECTION_STATE_CHANGED);
|
Intent intent = new Intent(TelephonyManager.ACTION_PRECISE_DATA_CONNECTION_STATE_CHANGED);
|
||||||
intent.putExtra(PhoneConstants.STATE_KEY, state);
|
intent.putExtra(TelephonyManager.EXTRA_STATE, state);
|
||||||
intent.putExtra(PhoneConstants.DATA_NETWORK_TYPE_KEY, networkType);
|
intent.putExtra(PhoneConstants.DATA_NETWORK_TYPE_KEY, networkType);
|
||||||
if (apnType != null) intent.putExtra(PhoneConstants.DATA_APN_TYPE_KEY, apnType);
|
if (apnType != null) intent.putExtra(PhoneConstants.DATA_APN_TYPE_KEY, apnType);
|
||||||
if (apn != null) intent.putExtra(PhoneConstants.DATA_APN_KEY, apn);
|
if (apn != null) intent.putExtra(PhoneConstants.DATA_APN_KEY, apn);
|
||||||
@@ -2681,11 +2690,11 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert data state to string
|
* Convert TelephonyManager.DATA_* to string.
|
||||||
*
|
*
|
||||||
* @return The data state in string format.
|
* @return The data state in string format.
|
||||||
*/
|
*/
|
||||||
private String dataStateToString(@TelephonyManager.DataState int state) {
|
private static String dataStateToString(int state) {
|
||||||
switch (state) {
|
switch (state) {
|
||||||
case TelephonyManager.DATA_DISCONNECTED: return "DISCONNECTED";
|
case TelephonyManager.DATA_DISCONNECTED: return "DISCONNECTED";
|
||||||
case TelephonyManager.DATA_CONNECTING: return "CONNECTING";
|
case TelephonyManager.DATA_CONNECTING: return "CONNECTING";
|
||||||
|
|||||||
Reference in New Issue
Block a user