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

Commit a97ba775 authored by android-build-team Robot's avatar android-build-team Robot
Browse files

Snap for 6469672 from 19999ba0 to rvc-release

Change-Id: Ib9507436866fd01100b05d67c01f14f269f368da
parents 599e09ee 19999ba0
Loading
Loading
Loading
Loading
+2 −6
Original line number Diff line number Diff line
@@ -449,18 +449,14 @@ public class CarrierKeyDownloadManager extends Handler {
            for (int i = 0; i < keys.length(); i++) {
                JSONObject key = keys.getJSONObject(i);
                // Support both "public-key" and "certificate" String property.
                // "certificate" is a more accurate description, however, the 3GPP draft spec
                // S3-170116, "Privacy Protection for EAP-AKA" section 4.3 mandates the use of
                // "public-key".
                String cert = null;
                if (key.has(JSON_CERTIFICATE)) {
                    cert = key.getString(JSON_CERTIFICATE);
                } else {
                    cert = key.getString(JSON_CERTIFICATE_ALTERNATE);
                }
                // The 3GPP draft spec 3GPP draft spec S3-170116, "Privacy Protection for EAP-AKA"
                // section 4.3, does not specify any key-type property. To be compatible with these
                // networks, the logic defaults to WLAN type if not specified.
                // The key-type property is optional, therefore, the default value is WLAN type if
                // not specified.
                int type = TelephonyManager.KEY_TYPE_WLAN;
                if (key.has(JSON_TYPE)) {
                    String typeString = key.getString(JSON_TYPE);
+5 −0
Original line number Diff line number Diff line
@@ -351,6 +351,11 @@ public class NetworkTypeController extends StateMachine {
    }

    private @Annotation.OverrideNetworkType int getNrDisplayType() {
        // Don't show 5G icon if preferred network type does not include 5G
        if ((mTelephonyManager.getPreferredNetworkTypeBitmask()
                & TelephonyManager.NETWORK_TYPE_BITMASK_NR) == 0) {
            return TelephonyDisplayInfo.OVERRIDE_NETWORK_TYPE_NONE;
        }
        // Icon display keys in order of priority
        List<String> keys = new ArrayList<>();
        // TODO: Update for NR SA
+34 −34
Original line number Diff line number Diff line
@@ -85,7 +85,7 @@ import java.util.concurrent.CompletableFuture;
 */
public class PhoneSwitcher extends Handler {
    private static final String LOG_TAG = "PhoneSwitcher";
    private static final boolean VDBG = false;
    protected static final boolean VDBG = false;

    private static final int DEFAULT_NETWORK_CHANGE_TIMEOUT_MS = 5000;
    private static final int MODEM_COMMAND_RETRY_PERIOD_MS     = 5000;
@@ -155,17 +155,17 @@ public class PhoneSwitcher extends Handler {
        }
    }

    private final List<DcRequest> mPrioritizedDcRequests = new ArrayList<>();
    private final RegistrantList mActivePhoneRegistrants;
    private final SubscriptionController mSubscriptionController;
    private final Context mContext;
    protected final List<DcRequest> mPrioritizedDcRequests = new ArrayList<>();
    protected final RegistrantList mActivePhoneRegistrants;
    protected final SubscriptionController mSubscriptionController;
    protected final Context mContext;
    private final LocalLog mLocalLog;
    private PhoneState[] mPhoneStates;
    private int[] mPhoneSubscriptions;
    private final CellularNetworkValidator mValidator;
    protected PhoneState[] mPhoneStates;
    protected int[] mPhoneSubscriptions;
    @VisibleForTesting
    protected final CellularNetworkValidator mValidator;
    private int mPendingSwitchSubId = INVALID_SUBSCRIPTION_ID;
    private boolean mPendingSwitchNeedValidation;

    @VisibleForTesting
    public final CellularNetworkValidator.ValidationCallback mValidationCallback =
            new CellularNetworkValidator.ValidationCallback() {
@@ -186,16 +186,16 @@ public class PhoneSwitcher extends Handler {
    @UnsupportedAppUsage
    // How many phones (correspondingly logical modems) are allowed for PS attach. This is used
    // when we specifically use setDataAllowed to initiate on-demand PS(data) attach for each phone.
    private int mMaxDataAttachModemCount;
    protected int mMaxDataAttachModemCount;
    // Local cache of TelephonyManager#getActiveModemCount(). 1 if in single SIM mode, 2 if in dual
    // SIM mode.
    private int mActiveModemCount;
    private static PhoneSwitcher sPhoneSwitcher = null;
    protected int mActiveModemCount;
    protected static PhoneSwitcher sPhoneSwitcher = null;

    // Which primary (non-opportunistic) subscription is set as data subscription among all primary
    // subscriptions. This value usually comes from user setting, and it's the subscription used for
    // Internet data if mOpptDataSubId is not set.
    private int mPrimaryDataSubId = SubscriptionManager.INVALID_SUBSCRIPTION_ID;
    protected int mPrimaryDataSubId = SubscriptionManager.INVALID_SUBSCRIPTION_ID;

    // mOpptDataSubId must be an active subscription. If it's set, it overrides mPrimaryDataSubId
    // to be used for Internet data.
@@ -203,7 +203,7 @@ public class PhoneSwitcher extends Handler {

    // The phone ID that has an active voice call. If set, and its mobile data setting is on,
    // it will become the mPreferredDataPhoneId.
    private int mPhoneIdInVoiceCall = SubscriptionManager.INVALID_PHONE_INDEX;
    protected int mPhoneIdInVoiceCall = SubscriptionManager.INVALID_PHONE_INDEX;

    @VisibleForTesting
    // It decides:
@@ -215,7 +215,7 @@ public class PhoneSwitcher extends Handler {
    protected int mPreferredDataPhoneId = SubscriptionManager.INVALID_PHONE_INDEX;

    // Subscription ID corresponds to mPreferredDataPhoneId.
    private WatchedInt mPreferredDataSubId =
    protected WatchedInt mPreferredDataSubId =
            new WatchedInt(SubscriptionManager.INVALID_SUBSCRIPTION_ID) {
        @Override
        public void set(int newValue) {
@@ -232,7 +232,7 @@ public class PhoneSwitcher extends Handler {
    private ISetOpportunisticDataCallback mSetOpptSubCallback;

    private static final int EVENT_PRIMARY_DATA_SUB_CHANGED       = 101;
    private static final int EVENT_SUBSCRIPTION_CHANGED           = 102;
    protected static final int EVENT_SUBSCRIPTION_CHANGED           = 102;
    private static final int EVENT_REQUEST_NETWORK                = 103;
    private static final int EVENT_RELEASE_NETWORK                = 104;
    // ECBM has started/ended. If we just ended an emergency call and mEmergencyOverride is not
@@ -270,12 +270,12 @@ public class PhoneSwitcher extends Handler {
    // Depending on version of IRadioConfig, we need to send either RIL_REQUEST_ALLOW_DATA if it's
    // 1.0, or RIL_REQUEST_SET_PREFERRED_DATA if it's 1.1 or later. So internally mHalCommandToUse
    // will be either HAL_COMMAND_ALLOW_DATA or HAL_COMMAND_ALLOW_DATA or HAL_COMMAND_UNKNOWN.
    private static final int HAL_COMMAND_UNKNOWN        = 0;
    private static final int HAL_COMMAND_ALLOW_DATA     = 1;
    private static final int HAL_COMMAND_PREFERRED_DATA = 2;
    private int mHalCommandToUse = HAL_COMMAND_UNKNOWN;
    protected static final int HAL_COMMAND_UNKNOWN        = 0;
    protected static final int HAL_COMMAND_ALLOW_DATA     = 1;
    protected static final int HAL_COMMAND_PREFERRED_DATA = 2;
    protected int mHalCommandToUse = HAL_COMMAND_UNKNOWN;

    private RadioConfig mRadioConfig;
    protected RadioConfig mRadioConfig;

    private final static int MAX_LOCAL_LOG_LINES = 30;

@@ -777,8 +777,8 @@ public class PhoneSwitcher extends Handler {
        return (TelephonyManager) mContext.getSystemService(Context.TELEPHONY_SERVICE);
    }

    private static final boolean REQUESTS_CHANGED   = true;
    private static final boolean REQUESTS_UNCHANGED = false;
    protected static final boolean REQUESTS_CHANGED   = true;
    protected static final boolean REQUESTS_UNCHANGED = false;
    /**
     * Re-evaluate things. Do nothing if nothing's changed.
     *
@@ -788,7 +788,7 @@ public class PhoneSwitcher extends Handler {
     *
     * @return {@code True} if the default data subscription need to be changed.
     */
    private boolean onEvaluate(boolean requestsChanged, String reason) {
    protected boolean onEvaluate(boolean requestsChanged, String reason) {
        StringBuilder sb = new StringBuilder(reason);

        // If we use HAL_COMMAND_PREFERRED_DATA,
@@ -916,18 +916,18 @@ public class PhoneSwitcher extends Handler {
        return diffDetected;
    }

    private static class PhoneState {
    protected static class PhoneState {
        public volatile boolean active = false;
        public long lastRequested = 0;
    }

    @UnsupportedAppUsage
    private void activate(int phoneId) {
    protected void activate(int phoneId) {
        switchPhone(phoneId, true);
    }

    @UnsupportedAppUsage
    private void deactivate(int phoneId) {
    protected void deactivate(int phoneId) {
        switchPhone(phoneId, false);
    }

@@ -980,7 +980,7 @@ public class PhoneSwitcher extends Handler {
        msg.sendToTarget();
    }

    private void sendRilCommands(int phoneId) {
    protected void sendRilCommands(int phoneId) {
        if (!SubscriptionManager.isValidPhoneId(phoneId)) return;

        Message message = Message.obtain(this, EVENT_MODEM_COMMAND_DONE, phoneId);
@@ -1039,7 +1039,7 @@ public class PhoneSwitcher extends Handler {
        return phoneId;
    }

    private int getSubIdFromNetworkSpecifier(NetworkSpecifier specifier) {
    protected int getSubIdFromNetworkSpecifier(NetworkSpecifier specifier) {
        if (specifier == null) {
            return DEFAULT_SUBSCRIPTION_ID;
        }
@@ -1059,7 +1059,7 @@ public class PhoneSwitcher extends Handler {

    // This updates mPreferredDataPhoneId which decides which phone should handle default network
    // requests.
    private void updatePreferredDataPhoneId() {
    protected void updatePreferredDataPhoneId() {
        Phone voicePhone = findPhoneById(mPhoneIdInVoiceCall);
        if (mEmergencyOverride != null && findPhoneById(mEmergencyOverride.mPhoneId) != null) {
            // Override DDS for emergency even if user data is not enabled, since it is an
@@ -1096,7 +1096,7 @@ public class PhoneSwitcher extends Handler {
                mSubscriptionController.getSubIdUsingPhoneId(mPreferredDataPhoneId));
    }

    private void transitionToEmergencyPhone() {
    protected void transitionToEmergencyPhone() {
        if (mActiveModemCount <= 0) {
            log("No phones: unable to reset preferred phone for emergency");
            return;
@@ -1334,7 +1334,7 @@ public class PhoneSwitcher extends Handler {
                subId, needValidation ? 1 : 0, callback).sendToTarget();
    }

    private boolean isPhoneInVoiceCall(Phone phone) {
    protected boolean isPhoneInVoiceCall(Phone phone) {
        if (phone == null) {
            return false;
        }
@@ -1364,7 +1364,7 @@ public class PhoneSwitcher extends Handler {
    }

    @UnsupportedAppUsage
    private void log(String l) {
    protected void log(String l) {
        Rlog.d(LOG_TAG, l);
        mLocalLog.log(l);
    }
@@ -1380,7 +1380,7 @@ public class PhoneSwitcher extends Handler {
    /**
     * See {@link PhoneStateListener#LISTEN_ACTIVE_DATA_SUBSCRIPTION_ID_CHANGE}.
     */
    private void notifyPreferredDataSubIdChanged() {
    protected void notifyPreferredDataSubIdChanged() {
        TelephonyRegistryManager telephonyRegistryManager = (TelephonyRegistryManager) mContext
                .getSystemService(Context.TELEPHONY_REGISTRY_SERVICE);
        log("notifyPreferredDataSubIdChanged to " + mPreferredDataSubId.get());
+20 −14
Original line number Diff line number Diff line
@@ -5040,19 +5040,23 @@ public class ServiceStateTracker extends Handler {
        List<SubscriptionInfo> subInfoList = SubscriptionController.getInstance()
                .getActiveSubscriptionInfoList(mPhone.getContext().getOpPackageName(),
                        mPhone.getContext().getAttributionTag());

        if (!ArrayUtils.isEmpty(subInfoList)) {
            for (SubscriptionInfo info : subInfoList) {
            // If we have an active opportunistic subscription whose data is IN_SERVICE, we needs
            // to get signal strength to decide data switching threshold. In this case, we poll
            // latest signal strength from modem.
                // If we have an active opportunistic subscription whose data is IN_SERVICE,
                // we need to get signal strength to decide data switching threshold. In this case,
                // we poll latest signal strength from modem.
                if (info.isOpportunistic()) {
                    TelephonyManager tm = TelephonyManager.from(mPhone.getContext())
                            .createForSubscriptionId(info.getSubscriptionId());
                    ServiceState ss = tm.getServiceState();
                if (ss != null && ss.getDataRegistrationState() == ServiceState.STATE_IN_SERVICE) {
                    if (ss != null
                            && ss.getDataRegistrationState() == ServiceState.STATE_IN_SERVICE) {
                        return true;
                    }
                }
            }
        }

        return false;
    }
@@ -5749,6 +5753,7 @@ public class ServiceStateTracker extends Handler {
    public Set<Integer> getNrContextIds() {
        Set<Integer> idSet = new HashSet<>();

        if (!ArrayUtils.isEmpty(mLastPhysicalChannelConfigList)) {
            for (PhysicalChannelConfig config : mLastPhysicalChannelConfigList) {
                if (isNrPhysicalChannelConfig(config)) {
                    for (int id : config.getContextIds()) {
@@ -5756,6 +5761,7 @@ public class ServiceStateTracker extends Handler {
                    }
                }
            }
        }

        return idSet;
    }
+14 −1
Original line number Diff line number Diff line
@@ -244,7 +244,7 @@ public class SubscriptionController extends ISub.Stub {
        }
    }

    protected static class WatchedInt {
    public static class WatchedInt {
        private int mValue;

        public WatchedInt(int initialValue) {
@@ -738,6 +738,19 @@ public class SubscriptionController extends ISub.Stub {
     * @hide
     */
    public SubscriptionInfo getSubscriptionInfo(int subId) {
        // check cache for active subscriptions first, before querying db
        for (SubscriptionInfo subInfo : mCacheActiveSubInfoList) {
            if (subInfo.getSubscriptionId() == subId) {
                return subInfo;
            }
        }
        // check cache for opportunistic subscriptions too, before querying db
        for (SubscriptionInfo subInfo : mCacheOpportunisticSubInfoList) {
            if (subInfo.getSubscriptionId() == subId) {
                return subInfo;
            }
        }

        List<SubscriptionInfo> subInfoList = getSubInfo(
                SubscriptionManager.UNIQUE_KEY_SUBSCRIPTION_ID + "=" + subId, null);
        if (subInfoList == null || subInfoList.isEmpty()) return null;
Loading