Move ACTION_CARRIER_* intent and extras from TelephonyIntents to

TelephonyManager.

The purpose is to expose them as @SystemApi as they are used externally.

Bug: 140908357
Test: unittest
Change-Id: I3dabcb853ebbd648b20d97b446db11476780be25
Merged-In: I3dabcb853ebbd648b20d97b446db11476780be25
This commit is contained in:
Malcolm Chen
2020-01-08 15:53:02 -08:00
committed by Xiangyu/Malcolm Chen
parent ff510dd0c0
commit d1a3b37bb9
7 changed files with 221 additions and 100 deletions

View File

@@ -9649,6 +9649,11 @@ package android.telephony {
method public void updateServiceLocation();
method @RequiresPermission(android.Manifest.permission.READ_ACTIVE_EMERGENCY_SESSION) public void updateTestOtaEmergencyNumberDbFilePath(@NonNull String);
field @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public static final String ACTION_ANOMALY_REPORTED = "android.telephony.action.ANOMALY_REPORTED";
field public static final String ACTION_CARRIER_SIGNAL_DEFAULT_NETWORK_AVAILABLE = "com.android.internal.telephony.CARRIER_SIGNAL_DEFAULT_NETWORK_AVAILABLE";
field public static final String ACTION_CARRIER_SIGNAL_PCO_VALUE = "com.android.internal.telephony.CARRIER_SIGNAL_PCO_VALUE";
field public static final String ACTION_CARRIER_SIGNAL_REDIRECTED = "com.android.internal.telephony.CARRIER_SIGNAL_REDIRECTED";
field public static final String ACTION_CARRIER_SIGNAL_REQUEST_NETWORK_FAILED = "com.android.internal.telephony.CARRIER_SIGNAL_REQUEST_NETWORK_FAILED";
field public static final String ACTION_CARRIER_SIGNAL_RESET = "com.android.internal.telephony.CARRIER_SIGNAL_RESET";
field public static final String ACTION_EMERGENCY_ASSISTANCE = "android.telephony.action.EMERGENCY_ASSISTANCE";
field public static final String ACTION_SERVICE_PROVIDERS_UPDATED = "android.telephony.action.SERVICE_PROVIDERS_UPDATED";
field public static final String ACTION_SIM_APPLICATION_STATE_CHANGED = "android.telephony.action.SIM_APPLICATION_STATE_CHANGED";
@@ -9667,8 +9672,17 @@ package android.telephony {
field public static final int CARRIER_PRIVILEGE_STATUS_RULES_NOT_LOADED = -1; // 0xffffffff
field public static final String EXTRA_ANOMALY_DESCRIPTION = "android.telephony.extra.ANOMALY_DESCRIPTION";
field public static final String EXTRA_ANOMALY_ID = "android.telephony.extra.ANOMALY_ID";
field @Deprecated public static final String EXTRA_APN_PROTOCOL = "apnProto";
field public static final String EXTRA_APN_PROTOCOL_INT = "apnProtoInt";
field @Deprecated public static final String EXTRA_APN_TYPE = "apnType";
field public static final String EXTRA_APN_TYPE_INT = "apnTypeInt";
field public static final String EXTRA_DATA_SPN = "android.telephony.extra.DATA_SPN";
field public static final String EXTRA_DEFAULT_NETWORK_AVAILABLE = "defaultNetworkAvailable";
field public static final String EXTRA_ERROR_CODE = "errorCode";
field public static final String EXTRA_PCO_ID = "pcoId";
field public static final String EXTRA_PCO_VALUE = "pcoValue";
field public static final String EXTRA_PLMN = "android.telephony.extra.PLMN";
field public static final String EXTRA_REDIRECTION_URL = "redirectionUrl";
field public static final String EXTRA_SHOW_PLMN = "android.telephony.extra.SHOW_PLMN";
field public static final String EXTRA_SHOW_SPN = "android.telephony.extra.SHOW_SPN";
field public static final String EXTRA_SIM_STATE = "android.telephony.extra.SIM_STATE";

View File

@@ -36,6 +36,7 @@ import android.net.http.SslError;
import android.os.Bundle;
import android.telephony.CarrierConfigManager;
import android.telephony.SubscriptionManager;
import android.telephony.TelephonyManager;
import android.text.TextUtils;
import android.util.ArrayMap;
import android.util.Log;
@@ -49,7 +50,6 @@ import android.widget.ProgressBar;
import android.widget.TextView;
import com.android.internal.telephony.PhoneConstants;
import com.android.internal.telephony.TelephonyIntents;
import com.android.internal.util.ArrayUtils;
import com.android.internal.util.TrafficStatsConstants;
@@ -203,7 +203,7 @@ public class CaptivePortalLoginActivity extends Activity {
}
private URL getUrlForCaptivePortal() {
String url = getIntent().getStringExtra(TelephonyIntents.EXTRA_REDIRECTION_URL_KEY);
String url = getIntent().getStringExtra(TelephonyManager.EXTRA_REDIRECTION_URL);
if (TextUtils.isEmpty(url)) url = mCm.getCaptivePortalServerUrl();
final CarrierConfigManager configManager = getApplicationContext()
.getSystemService(CarrierConfigManager.class);

View File

@@ -19,10 +19,10 @@ import android.content.Context;
import android.content.Intent;
import android.os.PersistableBundle;
import android.telephony.CarrierConfigManager;
import android.telephony.TelephonyManager;
import android.text.TextUtils;
import android.util.Log;
import com.android.internal.telephony.TelephonyIntents;
import com.android.internal.util.ArrayUtils;
import java.util.ArrayList;
@@ -50,7 +50,7 @@ public class CustomConfigLoader {
* @param intent passing signal for config match
* @return a list of carrier action for the given signal based on the carrier config.
*
* Example: input intent TelephonyIntent.ACTION_CARRIER_SIGNAL_REQUEST_NETWORK_FAILED
* Example: input intent TelephonyManager.ACTION_CARRIER_SIGNAL_REQUEST_NETWORK_FAILED
* This intent allows fined-grained matching based on both intent type & extra values:
* apnType and errorCode.
* apnType read from passing intent is "default" and errorCode is 0x26 for example and
@@ -78,25 +78,25 @@ public class CustomConfigLoader {
String arg1 = null;
String arg2 = null;
switch (intent.getAction()) {
case TelephonyIntents.ACTION_CARRIER_SIGNAL_REDIRECTED:
case TelephonyManager.ACTION_CARRIER_SIGNAL_REDIRECTED:
configs = b.getStringArray(CarrierConfigManager
.KEY_CARRIER_DEFAULT_ACTIONS_ON_REDIRECTION_STRING_ARRAY);
break;
case TelephonyIntents.ACTION_CARRIER_SIGNAL_REQUEST_NETWORK_FAILED:
case TelephonyManager.ACTION_CARRIER_SIGNAL_REQUEST_NETWORK_FAILED:
configs = b.getStringArray(CarrierConfigManager
.KEY_CARRIER_DEFAULT_ACTIONS_ON_DCFAILURE_STRING_ARRAY);
arg1 = intent.getStringExtra(TelephonyIntents.EXTRA_APN_TYPE_KEY);
arg2 = intent.getStringExtra(TelephonyIntents.EXTRA_ERROR_CODE_KEY);
arg1 = intent.getStringExtra(TelephonyManager.EXTRA_APN_TYPE);
arg2 = intent.getStringExtra(TelephonyManager.EXTRA_ERROR_CODE);
break;
case TelephonyIntents.ACTION_CARRIER_SIGNAL_RESET:
case TelephonyManager.ACTION_CARRIER_SIGNAL_RESET:
configs = b.getStringArray(CarrierConfigManager
.KEY_CARRIER_DEFAULT_ACTIONS_ON_RESET);
break;
case TelephonyIntents.ACTION_CARRIER_SIGNAL_DEFAULT_NETWORK_AVAILABLE:
case TelephonyManager.ACTION_CARRIER_SIGNAL_DEFAULT_NETWORK_AVAILABLE:
configs = b.getStringArray(CarrierConfigManager
.KEY_CARRIER_DEFAULT_ACTIONS_ON_DEFAULT_NETWORK_AVAILABLE);
arg1 = String.valueOf(intent.getBooleanExtra(TelephonyIntents
.EXTRA_DEFAULT_NETWORK_AVAILABLE_KEY, false));
arg1 = String.valueOf(intent.getBooleanExtra(TelephonyManager
.EXTRA_DEFAULT_NETWORK_AVAILABLE, false));
break;
default:
Log.e(TAG, "load carrier config failure with un-configured key: "

View File

@@ -27,10 +27,9 @@ import android.net.ConnectivityManager;
import android.net.Network;
import android.net.NetworkCapabilities;
import android.provider.Settings;
import android.telephony.TelephonyManager;
import android.util.Log;
import com.android.internal.telephony.TelephonyIntents;
/**
* Service to run {@link android.app.job.JobScheduler} job.
* Service to monitor when there is a change to conent URI
@@ -93,7 +92,7 @@ public class ProvisionObserver extends JobService {
}
int jobId;
switch(intent.getAction()) {
case TelephonyIntents.ACTION_CARRIER_SIGNAL_REDIRECTED:
case TelephonyManager.ACTION_CARRIER_SIGNAL_REDIRECTED:
jobId = PROVISION_OBSERVER_REEVALUATION_JOB_ID;
break;
default:

View File

@@ -15,6 +15,11 @@
*/
package com.android.carrierdefaultapp;
import static org.mockito.Matchers.eq;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
@@ -25,7 +30,6 @@ import android.telephony.TelephonyManager;
import android.test.InstrumentationTestCase;
import com.android.internal.telephony.PhoneConstants;
import com.android.internal.telephony.TelephonyIntents;
import org.junit.After;
import org.junit.Before;
@@ -34,10 +38,6 @@ import org.mockito.ArgumentCaptor;
import org.mockito.Captor;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import static org.mockito.Matchers.eq;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
public class CarrierDefaultReceiverTest extends InstrumentationTestCase {
@Mock
@@ -87,7 +87,7 @@ public class CarrierDefaultReceiverTest extends InstrumentationTestCase {
.KEY_CARRIER_DEFAULT_ACTIONS_ON_REDIRECTION_STRING_ARRAY, new String[]{"4,1"});
doReturn(b).when(mCarrierConfigMgr).getConfig();
Intent intent = new Intent(TelephonyIntents.ACTION_CARRIER_SIGNAL_REDIRECTED);
Intent intent = new Intent(TelephonyManager.ACTION_CARRIER_SIGNAL_REDIRECTED);
intent.putExtra(PhoneConstants.SUBSCRIPTION_KEY, subId);
mReceiver.onReceive(mContext, intent);

View File

@@ -1515,6 +1515,193 @@ public class TelephonyManager {
public static final String EXTRA_SIM_COMBINATION_NAMES =
"android.telephony.extra.SIM_COMBINATION_NAMES";
/**
* <p>Broadcast Action: when data connections get redirected with validation failure.
* intended for sim/account status checks and only sent to the specified carrier app
* The intent will have the following extra values:</p>
* <ul>
* <li>{@link #EXTRA_APN_TYPE}</li><dd>A string with the apn type.</dd>
* <li>{@link #EXTRA_APN_TYPE_INT}</li><dd>A integer with the apn type.</dd>
* <li>{@link #EXTRA_REDIRECTION_URL}</li><dd>redirection url string</dd>
* <li>subId</li><dd>Sub Id which associated the data connection failure.</dd>
* </ul>
* <p class="note">This is a protected intent that can only be sent by the system.</p>
* @hide
*/
@SystemApi
@SuppressLint("ActionValue")
public static final String ACTION_CARRIER_SIGNAL_REDIRECTED =
"com.android.internal.telephony.CARRIER_SIGNAL_REDIRECTED";
/**
* <p>Broadcast Action: when data connections setup fails.
* intended for sim/account status checks and only sent to the specified carrier app
* The intent will have the following extra values:</p>
* <ul>
* <li>{@link #EXTRA_APN_TYPE}</li><dd>A string with the apn type.</dd>
* <li>{@link #EXTRA_APN_TYPE_INT}</li><dd>A integer with the apn type.</dd>
* <li>{@link #EXTRA_ERROR_CODE}</li><dd>A integer with dataFailCause.</dd>
* <li>subId</li><dd>Sub Id which associated the data connection failure.</dd>
* </ul>
* <p class="note">This is a protected intent that can only be sent by the system. </p>
* @hide
*/
@SystemApi
@SuppressLint("ActionValue")
public static final String ACTION_CARRIER_SIGNAL_REQUEST_NETWORK_FAILED =
"com.android.internal.telephony.CARRIER_SIGNAL_REQUEST_NETWORK_FAILED";
/**
* <p>Broadcast Action: when pco value is available.
* intended for sim/account status checks and only sent to the specified carrier app
* The intent will have the following extra values:</p>
* <ul>
* <li>{@link #EXTRA_APN_TYPE}</li><dd>A string with the apn type.</dd>
* <li>{@link #EXTRA_APN_TYPE_INT}</li><dd>A integer with the apn type.</dd>
* <li>{@link #EXTRA_APN_PROTOCOL}</li><dd>A string with the protocol of the apn connection
* (IP,IPV6, IPV4V6)</dd>
* <li>{@link #EXTRA_APN_PROTOCOL_INT}</li><dd>A integer with the protocol of the apn
* connection (IP,IPV6, IPV4V6)</dd>
* <li>{@link #EXTRA_PCO_ID}</li><dd>An integer indicating the pco id for the data.</dd>
* <li>{@link #EXTRA_PCO_VALUE}</li><dd>A byte array of pco data read from modem.</dd>
* <li>subId</li><dd>Sub Id which associated the data connection.</dd>
* </ul>
* <p class="note">This is a protected intent that can only be sent by the system. </p>
* @hide
*/
@SystemApi
@SuppressLint("ActionValue")
public static final String ACTION_CARRIER_SIGNAL_PCO_VALUE =
"com.android.internal.telephony.CARRIER_SIGNAL_PCO_VALUE";
/**
* <p>Broadcast Action: when system default network available/unavailable with
* carrier-disabled mobile data. Intended for carrier apps to set/reset carrier actions when
* other network becomes system default network, Wi-Fi for example.
* The intent will have the following extra values:</p>
* <ul>
* <li>{@link #EXTRA_DEFAULT_NETWORK_AVAILABLE}</li>
* <dd>A boolean indicates default network available.</dd>
* <li>subId</li><dd>Sub Id which associated the default data.</dd>
* </ul>
* <p class="note">This is a protected intent that can only be sent by the system. </p>
* @hide
*/
@SystemApi
@SuppressLint("ActionValue")
public static final String ACTION_CARRIER_SIGNAL_DEFAULT_NETWORK_AVAILABLE =
"com.android.internal.telephony.CARRIER_SIGNAL_DEFAULT_NETWORK_AVAILABLE";
/**
* <p>Broadcast Action: when framework reset all carrier actions on sim load or absent.
* intended for carrier apps clean up (clear UI e.g.) and only sent to the specified carrier app
* The intent will have the following extra values:</p>
* <ul>
* <li>subId</li><dd>Sub Id which associated the data connection failure.</dd>
* </ul>
* <p class="note">This is a protected intent that can only be sent by the system.</p>
* @hide
*/
@SystemApi
@SuppressLint("ActionValue")
public static final String ACTION_CARRIER_SIGNAL_RESET =
"com.android.internal.telephony.CARRIER_SIGNAL_RESET";
// CARRIER_SIGNAL_ACTION extra keys
/**
* An string extra of redirected url upon {@link #ACTION_CARRIER_SIGNAL_REDIRECTED}.
* @hide
*/
@SystemApi
@SuppressLint("ActionValue")
public static final String EXTRA_REDIRECTION_URL = "redirectionUrl";
/**
* An integer extra of error code upon {@link #ACTION_CARRIER_SIGNAL_REQUEST_NETWORK_FAILED}.
* Check {@link DataFailCause} for all possible values.
* @hide
*/
@SystemApi
@SuppressLint("ActionValue")
public static final String EXTRA_ERROR_CODE = "errorCode";
/**
* An string extra of corresponding apn type upon
* {@link #ACTION_CARRIER_SIGNAL_REQUEST_NETWORK_FAILED},
* {@link #ACTION_CARRIER_SIGNAL_REDIRECTED} and
* {@link #ACTION_CARRIER_SIGNAL_PCO_VALUE} broadcasts.
* @deprecated This is kept for backward compatibility reason. Use {@link #EXTRA_APN_TYPE_INT}
* instead.
*
* @hide
*/
@SystemApi
@Deprecated
@SuppressLint("ActionValue")
public static final String EXTRA_APN_TYPE = "apnType";
/**
* An string integer of corresponding apn type upon
* {@link #ACTION_CARRIER_SIGNAL_REQUEST_NETWORK_FAILED},
* {@link #ACTION_CARRIER_SIGNAL_REDIRECTED} and
* {@link #ACTION_CARRIER_SIGNAL_PCO_VALUE} broadcasts.
* Check {@link ApnSetting} TYPE_* for its values.
* @hide
*/
@SystemApi
@SuppressLint("ActionValue")
public static final String EXTRA_APN_TYPE_INT = "apnTypeInt";
/**
* An string extra with the protocol of the apn connection (IP,IPV6, IPV4V6) upon
* {@link #ACTION_CARRIER_SIGNAL_PCO_VALUE} broadcasts.
* @deprecated This is kept for backward compatibility reason.
* Use {@link #EXTRA_APN_PROTOCOL_INT} instead.
*
* @hide
*/
@SystemApi
@Deprecated
@SuppressLint("ActionValue")
public static final String EXTRA_APN_PROTOCOL = "apnProto";
/**
* An integer extra with the protocol of the apn connection (IP,IPV6, IPV4V6) upon
* {@link #ACTION_CARRIER_SIGNAL_PCO_VALUE} broadcasts.
* Check {@link ApnSetting} PROTOCOL_* for its values.
* @hide
*/
@SystemApi
@SuppressLint("ActionValue")
public static final String EXTRA_APN_PROTOCOL_INT = "apnProtoInt";
/**
* An integer extra indicating the pco id for the data upon
* {@link #ACTION_CARRIER_SIGNAL_PCO_VALUE} broadcasts.
* @hide
*/
@SystemApi
@SuppressLint("ActionValue")
public static final String EXTRA_PCO_ID = "pcoId";
/**
* An extra of byte array of pco data read from modem upon
* {@link #ACTION_CARRIER_SIGNAL_PCO_VALUE} broadcasts.
* @hide
*/
@SystemApi
@SuppressLint("ActionValue")
public static final String EXTRA_PCO_VALUE = "pcoValue";
/**
* An boolean extra indicating default network available upon
* {@link #ACTION_CARRIER_SIGNAL_DEFAULT_NETWORK_AVAILABLE} broadcasts.
* @hide
*/
@SystemApi
@SuppressLint("ActionValue")
public static final String EXTRA_DEFAULT_NETWORK_AVAILABLE = "defaultNetworkAvailable";
//
//
// Device Info

View File

@@ -350,85 +350,6 @@ public class TelephonyIntents {
public static final String ACTION_SET_RADIO_CAPABILITY_FAILED =
"android.intent.action.ACTION_SET_RADIO_CAPABILITY_FAILED";
/**
* <p>Broadcast Action: when data connections get redirected with validation failure.
* intended for sim/account status checks and only sent to the specified carrier app
* The intent will have the following extra values:</p>
* <ul>
* <li>apnType</li><dd>A string with the apn type.</dd>
* <li>redirectionUrl</li><dd>redirection url string</dd>
* <li>subId</li><dd>Sub Id which associated the data connection failure.</dd>
* </ul>
* <p class="note">This is a protected intent that can only be sent by the system.</p>
*/
public static final String ACTION_CARRIER_SIGNAL_REDIRECTED =
"com.android.internal.telephony.CARRIER_SIGNAL_REDIRECTED";
/**
* <p>Broadcast Action: when data connections setup fails.
* intended for sim/account status checks and only sent to the specified carrier app
* The intent will have the following extra values:</p>
* <ul>
* <li>apnType</li><dd>A string with the apn type.</dd>
* <li>errorCode</li><dd>A integer with dataFailCause.</dd>
* <li>subId</li><dd>Sub Id which associated the data connection failure.</dd>
* </ul>
* <p class="note">This is a protected intent that can only be sent by the system. </p>
*/
public static final String ACTION_CARRIER_SIGNAL_REQUEST_NETWORK_FAILED =
"com.android.internal.telephony.CARRIER_SIGNAL_REQUEST_NETWORK_FAILED";
/**
* <p>Broadcast Action: when pco value is available.
* intended for sim/account status checks and only sent to the specified carrier app
* The intent will have the following extra values:</p>
* <ul>
* <li>apnType</li><dd>A string with the apn type.</dd>
* <li>apnProto</li><dd>A string with the protocol of the apn connection (IP,IPV6,
* IPV4V6)</dd>
* <li>pcoId</li><dd>An integer indicating the pco id for the data.</dd>
* <li>pcoValue</li><dd>A byte array of pco data read from modem.</dd>
* <li>subId</li><dd>Sub Id which associated the data connection.</dd>
* </ul>
* <p class="note">This is a protected intent that can only be sent by the system. </p>
*/
public static final String ACTION_CARRIER_SIGNAL_PCO_VALUE =
"com.android.internal.telephony.CARRIER_SIGNAL_PCO_VALUE";
/**
* <p>Broadcast Action: when system default network available/unavailable with
* carrier-disabled mobile data. Intended for carrier apps to set/reset carrier actions when
* other network becomes system default network, Wi-Fi for example.
* The intent will have the following extra values:</p>
* <ul>
* <li>defaultNetworkAvailable</li><dd>A boolean indicates default network available.</dd>
* <li>subId</li><dd>Sub Id which associated the default data.</dd>
* </ul>
* <p class="note">This is a protected intent that can only be sent by the system. </p>
*/
public static final String ACTION_CARRIER_SIGNAL_DEFAULT_NETWORK_AVAILABLE =
"com.android.internal.telephony.CARRIER_SIGNAL_DEFAULT_NETWORK_AVAILABLE";
/**
* <p>Broadcast Action: when framework reset all carrier actions on sim load or absent.
* intended for carrier apps clean up (clear UI e.g.) and only sent to the specified carrier app
* The intent will have the following extra values:</p>
* <ul>
* <li>subId</li><dd>Sub Id which associated the data connection failure.</dd>
* </ul>
* <p class="note">This is a protected intent that can only be sent by the system.</p>
*/
public static final String ACTION_CARRIER_SIGNAL_RESET =
"com.android.internal.telephony.CARRIER_SIGNAL_RESET";
// CARRIER_SIGNAL_ACTION extra keys
public static final String EXTRA_REDIRECTION_URL_KEY = "redirectionUrl";
public static final String EXTRA_ERROR_CODE_KEY = "errorCode";
public static final String EXTRA_APN_TYPE_KEY = "apnType";
public static final String EXTRA_APN_PROTO_KEY = "apnProto";
public static final String EXTRA_PCO_ID_KEY = "pcoId";
public static final String EXTRA_PCO_VALUE_KEY = "pcoValue";
public static final String EXTRA_DEFAULT_NETWORK_AVAILABLE_KEY = "defaultNetworkAvailable";
/**
* Broadcast action to trigger CI OMA-DM Session.
*/