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

Commit 798dedb3 authored by Xiangyu/Malcolm Chen's avatar Xiangyu/Malcolm Chen Committed by Gerrit Code Review
Browse files

Merge "Move ACTION_CARRIER_* intent and extras from TelephonyIntents to TelephonyManager."

parents 554d3397 b4a42b2d
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -227,7 +227,7 @@ public class CarrierActionAgent extends Handler {
        carrierActionSetRadioEnabled(true);
        // notify configured carrier apps for reset
        mPhone.getCarrierSignalAgent().notifyCarrierSignalReceivers(
                new Intent(TelephonyIntents.ACTION_CARRIER_SIGNAL_RESET));
                new Intent(TelephonyManager.ACTION_CARRIER_SIGNAL_RESET));
    }

    private RegistrantList getRegistrantsFromAction(int action) {
+10 −9
Original line number Diff line number Diff line
@@ -34,6 +34,7 @@ import android.os.PersistableBundle;
import android.os.UserHandle;
import android.telephony.CarrierConfigManager;
import android.telephony.SubscriptionManager;
import android.telephony.TelephonyManager;
import android.text.TextUtils;
import android.util.LocalLog;
import android.util.Log;
@@ -98,11 +99,11 @@ public class CarrierSignalAgent extends Handler {
     * This is a list of supported signals from CarrierSignalAgent
     */
    private final Set<String> mCarrierSignalList = new HashSet<>(Arrays.asList(
            TelephonyIntents.ACTION_CARRIER_SIGNAL_PCO_VALUE,
            TelephonyIntents.ACTION_CARRIER_SIGNAL_REDIRECTED,
            TelephonyIntents.ACTION_CARRIER_SIGNAL_REQUEST_NETWORK_FAILED,
            TelephonyIntents.ACTION_CARRIER_SIGNAL_RESET,
            TelephonyIntents.ACTION_CARRIER_SIGNAL_DEFAULT_NETWORK_AVAILABLE));
            TelephonyManager.ACTION_CARRIER_SIGNAL_PCO_VALUE,
            TelephonyManager.ACTION_CARRIER_SIGNAL_REDIRECTED,
            TelephonyManager.ACTION_CARRIER_SIGNAL_REQUEST_NETWORK_FAILED,
            TelephonyManager.ACTION_CARRIER_SIGNAL_RESET,
            TelephonyManager.ACTION_CARRIER_SIGNAL_DEFAULT_NETWORK_AVAILABLE));

    private final LocalLog mErrorLocalLog = new LocalLog(20);

@@ -148,10 +149,10 @@ public class CarrierSignalAgent extends Handler {
                            // an optimization to avoid signaling on every default network switch.
                            if (!mDefaultNetworkAvail) {
                                if (DBG) log("Default network available: " + network);
                                Intent intent = new Intent(TelephonyIntents
                                Intent intent = new Intent(TelephonyManager
                                        .ACTION_CARRIER_SIGNAL_DEFAULT_NETWORK_AVAILABLE);
                                intent.putExtra(
                                        TelephonyIntents.EXTRA_DEFAULT_NETWORK_AVAILABLE_KEY, true);
                                        TelephonyManager.EXTRA_DEFAULT_NETWORK_AVAILABLE, true);
                                notifyCarrierSignalReceivers(intent);
                                mDefaultNetworkAvail = true;
                            }
@@ -159,10 +160,10 @@ public class CarrierSignalAgent extends Handler {
                        @Override
                        public void onLost(Network network) {
                            if (DBG) log("Default network lost: " + network);
                            Intent intent = new Intent(TelephonyIntents
                            Intent intent = new Intent(TelephonyManager
                                    .ACTION_CARRIER_SIGNAL_DEFAULT_NETWORK_AVAILABLE);
                            intent.putExtra(
                                    TelephonyIntents.EXTRA_DEFAULT_NETWORK_AVAILABLE_KEY, false);
                                    TelephonyManager.EXTRA_DEFAULT_NETWORK_AVAILABLE, false);
                            notifyCarrierSignalReceivers(intent);
                            mDefaultNetworkAvail = false;
                        }
+1 −2
Original line number Diff line number Diff line
@@ -76,7 +76,6 @@ import com.android.internal.telephony.PhoneFactory;
import com.android.internal.telephony.RILConstants;
import com.android.internal.telephony.RetryManager;
import com.android.internal.telephony.ServiceStateTracker;
import com.android.internal.telephony.TelephonyIntents;
import com.android.internal.telephony.dataconnection.DcTracker.ReleaseNetworkType;
import com.android.internal.telephony.dataconnection.DcTracker.RequestNetworkType;
import com.android.internal.telephony.metrics.TelephonyMetrics;
@@ -2060,7 +2059,7 @@ public class DataConnection extends StateMachine {

            final NetworkAgentConfig.Builder configBuilder = new NetworkAgentConfig.Builder();
            final CarrierSignalAgent carrierSignalAgent = mPhone.getCarrierSignalAgent();
            if (carrierSignalAgent.hasRegisteredReceivers(TelephonyIntents
            if (carrierSignalAgent.hasRegisteredReceivers(TelephonyManager
                    .ACTION_CARRIER_SIGNAL_REDIRECTED)) {
                // carrierSignal Receivers will place the carrier-specific provisioning notification
                configBuilder.disableProvisioningNotification();
+25 −16
Original line number Diff line number Diff line
@@ -19,6 +19,8 @@ package com.android.internal.telephony.dataconnection;
import static android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE;
import static android.telephony.TelephonyManager.NETWORK_TYPE_LTE;
import static android.telephony.TelephonyManager.NETWORK_TYPE_NR;
import static android.telephony.data.ApnSetting.PROTOCOL_IPV4V6;
import static android.telephony.data.ApnSetting.TYPE_DEFAULT;

import static com.android.internal.telephony.RILConstants.DATA_PROFILE_DEFAULT;
import static com.android.internal.telephony.RILConstants.DATA_PROFILE_INVALID;
@@ -104,7 +106,6 @@ import com.android.internal.telephony.PhoneFactory;
import com.android.internal.telephony.PhoneSwitcher;
import com.android.internal.telephony.RILConstants;
import com.android.internal.telephony.SettingsObserver;
import com.android.internal.telephony.TelephonyIntents;
import com.android.internal.telephony.dataconnection.DataConnectionReasons.DataAllowedReasonType;
import com.android.internal.telephony.dataconnection.DataConnectionReasons.DataDisallowedReasonType;
import com.android.internal.telephony.dataconnection.DataEnabledSettings.DataEnabledChangedReason;
@@ -2858,11 +2859,13 @@ public class DcTracker extends Handler {
                        final byte[] value = new byte[1];
                        value[0] = (byte) pcoVal;
                        final Intent intent =
                                new Intent(TelephonyIntents.ACTION_CARRIER_SIGNAL_PCO_VALUE);
                        intent.putExtra(TelephonyIntents.EXTRA_APN_TYPE_KEY, "default");
                        intent.putExtra(TelephonyIntents.EXTRA_APN_PROTO_KEY, "IPV4V6");
                        intent.putExtra(TelephonyIntents.EXTRA_PCO_ID_KEY, 0xFF00);
                        intent.putExtra(TelephonyIntents.EXTRA_PCO_VALUE_KEY, value);
                                new Intent(TelephonyManager.ACTION_CARRIER_SIGNAL_PCO_VALUE);
                        intent.putExtra(TelephonyManager.EXTRA_APN_TYPE, "default");
                        intent.putExtra(TelephonyManager.EXTRA_APN_TYPE_INT, TYPE_DEFAULT);
                        intent.putExtra(TelephonyManager.EXTRA_APN_PROTOCOL, "IPV4V6");
                        intent.putExtra(TelephonyManager.EXTRA_APN_PROTOCOL_INT, PROTOCOL_IPV4V6);
                        intent.putExtra(TelephonyManager.EXTRA_PCO_ID, 0xFF00);
                        intent.putExtra(TelephonyManager.EXTRA_PCO_VALUE, value);
                        mPhone.getCarrierSignalAgent().notifyCarrierSignalReceivers(intent);
                    }
                }
@@ -2884,10 +2887,12 @@ public class DcTracker extends Handler {
                    apn != null ? apn.getApnName() : null, cause);

            // Compose broadcast intent send to the specific carrier signaling receivers
            Intent intent = new Intent(TelephonyIntents
            Intent intent = new Intent(TelephonyManager
                    .ACTION_CARRIER_SIGNAL_REQUEST_NETWORK_FAILED);
            intent.putExtra(TelephonyIntents.EXTRA_ERROR_CODE_KEY, cause);
            intent.putExtra(TelephonyIntents.EXTRA_APN_TYPE_KEY, apnContext.getApnType());
            intent.putExtra(TelephonyManager.EXTRA_ERROR_CODE, cause);
            intent.putExtra(TelephonyManager.EXTRA_APN_TYPE, apnContext.getApnType());
            intent.putExtra(TelephonyManager.EXTRA_APN_TYPE_INT,
                    ApnSetting.getApnTypesBitmaskFromString(apnContext.getApnType()));
            mPhone.getCarrierSignalAgent().notifyCarrierSignalReceivers(intent);

            if (DataFailCause.isRadioRestartFailure(mPhone.getContext(), cause, mPhone.getSubId())
@@ -2947,8 +2952,8 @@ public class DcTracker extends Handler {
     */
    private void onNetworkStatusChanged(int status, int cid, String redirectUrl) {
        if (!TextUtils.isEmpty(redirectUrl)) {
            Intent intent = new Intent(TelephonyIntents.ACTION_CARRIER_SIGNAL_REDIRECTED);
            intent.putExtra(TelephonyIntents.EXTRA_REDIRECTION_URL_KEY, redirectUrl);
            Intent intent = new Intent(TelephonyManager.ACTION_CARRIER_SIGNAL_REDIRECTED);
            intent.putExtra(TelephonyManager.EXTRA_REDIRECTION_URL, redirectUrl);
            mPhone.getCarrierSignalAgent().notifyCarrierSignalReceivers(intent);
            log("Notify carrier signal receivers with redirectUrl: " + redirectUrl);
        } else {
@@ -4514,11 +4519,15 @@ public class DcTracker extends Handler {
            for (ApnContext apnContext : apnContextList) {
                String apnType = apnContext.getApnType();

                final Intent intent = new Intent(TelephonyIntents.ACTION_CARRIER_SIGNAL_PCO_VALUE);
                intent.putExtra(TelephonyIntents.EXTRA_APN_TYPE_KEY, apnType);
                intent.putExtra(TelephonyIntents.EXTRA_APN_PROTO_KEY, pcoData.bearerProto);
                intent.putExtra(TelephonyIntents.EXTRA_PCO_ID_KEY, pcoData.pcoId);
                intent.putExtra(TelephonyIntents.EXTRA_PCO_VALUE_KEY, pcoData.contents);
                final Intent intent = new Intent(TelephonyManager.ACTION_CARRIER_SIGNAL_PCO_VALUE);
                intent.putExtra(TelephonyManager.EXTRA_APN_TYPE, apnType);
                intent.putExtra(TelephonyManager.EXTRA_APN_TYPE_INT,
                        ApnSetting.getApnTypesBitmaskFromString(apnType));
                intent.putExtra(TelephonyManager.EXTRA_APN_PROTOCOL, pcoData.bearerProto);
                intent.putExtra(TelephonyManager.EXTRA_APN_PROTOCOL_INT,
                        ApnSetting.getProtocolIntFromString(pcoData.bearerProto));
                intent.putExtra(TelephonyManager.EXTRA_PCO_ID, pcoData.pcoId);
                intent.putExtra(TelephonyManager.EXTRA_PCO_VALUE, pcoData.contents);
                mPhone.getCarrierSignalAgent().notifyCarrierSignalReceivers(intent);
            }
        }
+2 −3
Original line number Diff line number Diff line
@@ -15,9 +15,8 @@
 */
package com.android.internal.telephony;

import static com.android.internal.telephony.TelephonyIntents.ACTION_CARRIER_SIGNAL_PCO_VALUE;
import static com.android.internal.telephony.TelephonyIntents
        .ACTION_CARRIER_SIGNAL_REQUEST_NETWORK_FAILED;
import static android.telephony.TelephonyManager.ACTION_CARRIER_SIGNAL_PCO_VALUE;
import static android.telephony.TelephonyManager.ACTION_CARRIER_SIGNAL_REQUEST_NETWORK_FAILED;

import static org.junit.Assert.assertEquals;
import static org.mockito.ArgumentMatchers.anyLong;