Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d1a3b37b authored by Malcolm Chen's avatar Malcolm Chen Committed by Xiangyu/Malcolm Chen
Browse files

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
parent ff510dd0
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -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";
+2 −2
Original line number Diff line number Diff line
@@ -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);
+10 −10
Original line number Diff line number Diff line
@@ -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: "
+2 −3
Original line number Diff line number Diff line
@@ -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:
+6 −6
Original line number Diff line number Diff line
@@ -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);

Loading