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

Commit 7fdcb37d authored by Xin Li's avatar Xin Li Committed by Gerrit Code Review
Browse files

Merge "Merge Android 14 QPR1" into main

parents 6ea2d705 d4ebe427
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -275,6 +275,8 @@ message VoiceCallSession {
    optional int32 call_duration = 32;
    optional int32 last_known_rat = 33;
    optional int32 fold_state = 34;
    optional int64 rat_switch_count_after_connected = 35;
    optional bool handover_in_progress = 36;

    // Internal use only
    optional int64 setup_begin_millis = 10001;
@@ -378,6 +380,8 @@ message CellularServiceState {
    optional bool is_emergency_only = 10;
    optional bool is_internet_pdn_up = 11;
    optional int32 fold_state = 12;
    optional bool override_voice_service = 13;
    optional bool isDataEnabled = 14;

    // Internal use only
    optional int64 last_used_millis = 10001;
+58 −6
Original line number Diff line number Diff line
@@ -116,14 +116,15 @@ public class CarrierServiceStateTracker extends Handler {
                                    mPhone.getContext(),
                                    mPhone.getSubId(),
                                    CarrierConfigManager.KEY_EMERGENCY_NOTIFICATION_DELAY_INT,
                                    CarrierConfigManager
                                            .KEY_PREF_NETWORK_NOTIFICATION_DELAY_INT);
                                    CarrierConfigManager.KEY_PREF_NETWORK_NOTIFICATION_DELAY_INT,
                                    CarrierConfigManager.KEY_HIDE_PREFERRED_NETWORK_TYPE_BOOL);
                    if (b.isEmpty()) return;

                    for (Map.Entry<Integer, NotificationType> entry :
                            mNotificationTypeMap.entrySet()) {
                        NotificationType notificationType = entry.getValue();
                        notificationType.setDelay(b);
                        notificationType.setEnabled(b);
                    }
                    handleConfigChanges();
                });
@@ -429,6 +430,18 @@ public class CarrierServiceStateTracker extends Handler {
        **/
        void setDelay(PersistableBundle bundle);

        /**
         * Checks whether this Notification is enabled.
         * @return {@code true} if this Notification is enabled, false otherwise
         */
        boolean isEnabled();

        /**
         * Sets whether this Notification is enabled. If disabled, it will not build notification.
         * @param bundle PersistableBundle
         */
        void setEnabled(PersistableBundle bundle);

        /**
         * returns notification type id.
         **/
@@ -458,6 +471,7 @@ public class CarrierServiceStateTracker extends Handler {

        private final int mTypeId;
        private int mDelay = UNINITIALIZED_DELAY_VALUE;
        private boolean mEnabled = false;

        PrefNetworkNotification(int typeId) {
            this.mTypeId = typeId;
@@ -480,6 +494,28 @@ public class CarrierServiceStateTracker extends Handler {
            return mDelay;
        }

        /**
         * Checks whether this Notification is enabled.
         * @return {@code true} if this Notification is enabled, false otherwise
         */
        public boolean isEnabled() {
            return mEnabled;
        }

        /**
         * Sets whether this Notification is enabled. If disabled, it will not build notification.
         * @param bundle PersistableBundle
         */
        public void setEnabled(PersistableBundle bundle) {
            if (bundle == null) {
                Rlog.e(LOG_TAG, "bundle is null");
                return;
            }
            mEnabled = !bundle.getBoolean(
                    CarrierConfigManager.KEY_HIDE_PREFERRED_NETWORK_TYPE_BOOL);
            Rlog.i(LOG_TAG, "reading enabled notification pref network: " + mEnabled);
        }

        public int getTypeId() {
            return mTypeId;
        }
@@ -497,10 +533,10 @@ public class CarrierServiceStateTracker extends Handler {
         */
        public boolean sendMessage() {
            Rlog.i(LOG_TAG, "PrefNetworkNotification: sendMessage() w/values: "
                    + "," + isPhoneStillRegistered() + "," + mDelay + "," + isGlobalMode()
                    + "," + mSST.isRadioOn());
            if (mDelay == UNINITIALIZED_DELAY_VALUE || isPhoneStillRegistered() || isGlobalMode()
                    || isRadioOffOrAirplaneMode()) {
                    + "," + mEnabled + "," + isPhoneStillRegistered() + "," + mDelay
                    + "," + isGlobalMode() + "," + mSST.isRadioOn());
            if (!mEnabled || mDelay == UNINITIALIZED_DELAY_VALUE || isPhoneStillRegistered()
                    || isGlobalMode() || isRadioOffOrAirplaneMode()) {
                return false;
            }
            return true;
@@ -559,6 +595,22 @@ public class CarrierServiceStateTracker extends Handler {
            return mDelay;
        }

        /**
         * Checks whether this Notification is enabled.
         * @return {@code true} if this Notification is enabled, false otherwise
         */
        public boolean isEnabled() {
            return true;
        }

        /**
         * Sets whether this Notification is enabled. If disabled, it will not build notification.
         * @param bundle PersistableBundle
         */
        public void setEnabled(PersistableBundle bundle) {
            // always allowed. There is no config to hide notifications.
        }

        public int getTypeId() {
            return mTypeId;
        }
+37 −2
Original line number Diff line number Diff line
@@ -26,6 +26,8 @@ import android.telephony.CellBroadcastIdRange;
import android.telephony.SmsCbMessage;
import android.telephony.SubscriptionManager;
import android.telephony.TelephonyManager;
import android.util.IndentingPrintWriter;
import android.util.LocalLog;

import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.telephony.cdma.CdmaSmsBroadcastConfigInfo;
@@ -33,6 +35,8 @@ import com.android.internal.telephony.gsm.SmsBroadcastConfigInfo;
import com.android.internal.util.State;
import com.android.internal.util.StateMachine;

import java.io.FileDescriptor;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
@@ -59,6 +63,7 @@ public final class CellBroadcastConfigTracker extends StateMachine {
    // Cache of current cell broadcast id ranges of 3gpp2
    private List<CellBroadcastIdRange> mCbRanges3gpp2 = new CopyOnWriteArrayList<>();
    private Phone mPhone;
    private final LocalLog mLocalLog = new LocalLog(128);
    @VisibleForTesting
    public int mSubId;
    @VisibleForTesting
@@ -106,8 +111,7 @@ public final class CellBroadcastConfigTracker extends StateMachine {
        @Override
        public String toString() {
            return "Request[mCbRangesRequest3gpp = " + mCbRangesRequest3gpp + ", "
                    + "mCbRangesRequest3gpp2 = " + mCbRangesRequest3gpp2 + ", "
                    + "mCallback = " + mCallback + "]";
                    + "mCbRangesRequest3gpp2 = " + mCbRangesRequest3gpp2 + "]";
        }
    }

@@ -175,6 +179,9 @@ public final class CellBroadcastConfigTracker extends StateMachine {
                    Request request = (Request) msg.obj;
                    if (DBG) {
                        logd("IdleState handle EVENT_REQUEST with request:" + request);
                        mLocalLog.log("IdleState handle EVENT_REQUEST with request:" + request
                                + ", mCbRanges3gpp:" + mCbRanges3gpp
                                + ", mCbRanges3gpp2:" + mCbRanges3gpp2);
                    }
                    if (!mCbRanges3gpp.equals(request.get3gppRanges())) {
                        // set gsm config if the config is changed
@@ -229,6 +236,7 @@ public final class CellBroadcastConfigTracker extends StateMachine {
                        transitionTo(mGsmActivatingState);
                    } else {
                        logd("Failed to set gsm config");
                        mLocalLog.log("GsmConfiguringState Failed to set gsm config:" + request);
                        request.getCallback().accept(
                                TelephonyManager.CELL_BROADCAST_RESULT_FAIL_CONFIG);
                        // transit to idle state on the failure case
@@ -265,6 +273,8 @@ public final class CellBroadcastConfigTracker extends StateMachine {
                    if (DBG) {
                        logd("GsmActivatingState handle EVENT_ACTIVATION_DONE with request:"
                                + request);
                        mLocalLog.log("GsmActivatingState EVENT_ACTIVATION_DONE, exception:"
                                + ar.exception + ", request:" + request);
                    }
                    if (ar.exception == null) {
                        mCbRanges3gpp = request.get3gppRanges();
@@ -326,6 +336,7 @@ public final class CellBroadcastConfigTracker extends StateMachine {
                        transitionTo(mCdmaActivatingState);
                    } else {
                        logd("Failed to set cdma config");
                        mLocalLog.log("CdmaConfiguringState Failed to set cdma config:" + request);
                        request.getCallback().accept(
                                TelephonyManager.CELL_BROADCAST_RESULT_FAIL_CONFIG);
                        // transit to idle state on the failure case
@@ -362,6 +373,8 @@ public final class CellBroadcastConfigTracker extends StateMachine {
                    if (DBG) {
                        logd("CdmaActivatingState handle EVENT_ACTIVATION_DONE with request:"
                                + request);
                        mLocalLog.log("CdmaActivatingState EVENT_ACTIVATION_DONE, exception:"
                                + ar.exception + ", request:" + request);
                    }
                    if (ar.exception == null) {
                        mCbRanges3gpp2 = request.get3gpp2Ranges();
@@ -531,4 +544,26 @@ public final class CellBroadcastConfigTracker extends StateMachine {
            mPhone.mCi.setCdmaBroadcastActivation(activate, response);
        }
    }

    /**
     * Dump the state of CellBroadcastConfigTracker
     *
     * @param fd File descriptor
     * @param printWriter Print writer
     * @param args Arguments
     */
    public void dump(FileDescriptor fd, PrintWriter printWriter, String[] args) {
        IndentingPrintWriter pw = new IndentingPrintWriter(printWriter, "  ");
        pw.println(CellBroadcastConfigTracker.class.getSimpleName()
                + "-" + mPhone.getPhoneId() + ":");
        pw.increaseIndent();
        pw.println("Current mCbRanges3gpp:" + mCbRanges3gpp);
        pw.println("Current mCbRanges3gpp2:" + mCbRanges3gpp2);
        pw.decreaseIndent();

        pw.println("Local logs:");
        pw.increaseIndent();
        mLocalLog.dump(fd, pw, args);
        pw.decreaseIndent();
    }
}
+6 −1
Original line number Diff line number Diff line
@@ -40,6 +40,7 @@ import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.telephony.metrics.RcsStats;
import com.android.telephony.Rlog;

import java.util.NoSuchElementException;
import java.util.concurrent.ConcurrentLinkedQueue;

/**
@@ -155,7 +156,11 @@ public class GbaManager {

        public synchronized void unlinkToDeath() {
            if (mBinder != null) {
                try {
                    mBinder.unlinkToDeath(this, 0);
                } catch (NoSuchElementException e) {
                    // do nothing
                }
                mBinder = null;
            }
        }
+18 −5
Original line number Diff line number Diff line
@@ -249,6 +249,7 @@ public class GsmCdmaPhone extends Phone {
    private String mImeiSv;
    private String mVmNumber;
    private int mImeiType = IMEI_TYPE_UNKNOWN;
    private int mSimState = TelephonyManager.SIM_STATE_UNKNOWN;

    @VisibleForTesting
    public CellBroadcastConfigTracker mCellBroadcastConfigTracker =
@@ -426,9 +427,9 @@ public class GsmCdmaPhone extends Phone {
                if (mPhoneId == intent.getIntExtra(
                        SubscriptionManager.EXTRA_SLOT_INDEX,
                        SubscriptionManager.INVALID_SIM_SLOT_INDEX)) {
                    int simState = intent.getIntExtra(TelephonyManager.EXTRA_SIM_STATE,
                    mSimState = intent.getIntExtra(TelephonyManager.EXTRA_SIM_STATE,
                            TelephonyManager.SIM_STATE_UNKNOWN);
                    if (simState == TelephonyManager.SIM_STATE_LOADED
                    if (mSimState == TelephonyManager.SIM_STATE_LOADED
                            && currentSlotSubIdChanged()) {
                        setNetworkSelectionModeAutomatic(null);
                    }
@@ -680,6 +681,7 @@ public class GsmCdmaPhone extends Phone {
        mTelecomVoiceServiceStateOverride = newOverride;
        if (changed && mSST != null) {
            mSST.onTelecomVoiceServiceStateOverrideChanged();
            mSST.getServiceStateStats().onVoiceServiceStateOverrideChanged(hasService);
        }
    }

@@ -3521,13 +3523,14 @@ public class GsmCdmaPhone extends Phone {
            case EVENT_SET_NULL_CIPHER_AND_INTEGRITY_DONE:
                logd("EVENT_SET_NULL_CIPHER_AND_INTEGRITY_DONE");
                ar = (AsyncResult) msg.obj;
                // Only test for a success here in order to flip the support flag.
                // Testing for the negative case, e.g. REQUEST_NOT_SUPPORTED, is insufficient
                // because the modem or the RIL could still return exceptions for temporary
                // failures even when the feature is unsupported.
                if (ar == null || ar.exception == null) {
                    mIsNullCipherAndIntegritySupported = true;
                    return;
                }
                CommandException.Error error = ((CommandException) ar.exception).getCommandError();
                mIsNullCipherAndIntegritySupported = !error.equals(
                        CommandException.Error.REQUEST_NOT_SUPPORTED);
                break;

            case EVENT_IMS_DEREGISTRATION_TRIGGERED:
@@ -4499,6 +4502,12 @@ public class GsmCdmaPhone extends Phone {
            e.printStackTrace();
        }
        pw.flush();
        try {
            mCellBroadcastConfigTracker.dump(fd, pw, args);
        } catch (Exception e) {
            e.printStackTrace();
        }
        pw.flush();
    }

    @Override
@@ -5017,6 +5026,10 @@ public class GsmCdmaPhone extends Phone {
            return;
        }

        if (mSimState != TelephonyManager.SIM_STATE_LOADED) {
            return;
        }

        if (config == null) {
            loge("didn't get the vonr_enabled_bool from the carrier config.");
            return;
Loading