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

Commit 9937ad41 authored by Android Build Coastguard Worker's avatar Android Build Coastguard Worker
Browse files

Snap for 13466374 from 29dfc0b5 to 25Q3-release

Change-Id: I0fb0b772923fa054a5a2edaf38fea4363135b58d
parents cf6f1952 29dfc0b5
Loading
Loading
Loading
Loading
+61 −59
Original line number Diff line number Diff line
@@ -388,6 +388,11 @@ public class SatelliteController extends Handler {
    private AtomicBoolean mIsDemoModeEnabled = new AtomicBoolean(false);
    private AtomicBoolean mIsEmergency = new AtomicBoolean(false);
    private AtomicBoolean mIsSatelliteEnabled = null;
    @VisibleForTesting(visibility = VisibleForTesting.Visibility.PRIVATE)
    protected AtomicBoolean mIsRadioOn = new AtomicBoolean(false);
    @VisibleForTesting(visibility = VisibleForTesting.Visibility.PRIVATE)
    protected AtomicBoolean mRadioOffRequested = new AtomicBoolean(false);
    private AtomicBoolean mIgnorePlmnListFromStorage = new AtomicBoolean(false);

    private final Object mSatelliteEnabledRequestLock = new Object();
    /* This variable is used to store the first enable request that framework has received in the
@@ -480,13 +485,6 @@ public class SatelliteController extends Handler {
    private final ConcurrentHashMap<IBinder, ISelectedNbIotSatelliteSubscriptionCallback>
            mSelectedNbIotSatelliteSubscriptionChangedListeners = new ConcurrentHashMap<>();

    @VisibleForTesting(visibility = VisibleForTesting.Visibility.PRIVATE)
    protected final Object mIsRadioOnLock = new Object();
    @VisibleForTesting(visibility = VisibleForTesting.Visibility.PRIVATE)
    protected boolean mIsRadioOn;
    @GuardedBy("mIsRadioOnLock")
    @VisibleForTesting(visibility = VisibleForTesting.Visibility.PRIVATE)
    protected boolean mRadioOffRequested = false;
    @VisibleForTesting(visibility = VisibleForTesting.Visibility.PRIVATE)
    protected final Object mDeviceProvisionLock = new Object();
    @VisibleForTesting(visibility = VisibleForTesting.Visibility.PRIVATE)
@@ -943,9 +941,7 @@ public class SatelliteController extends Handler {
                mContext, looper, mFeatureFlags, mPointingAppController);

        mCi.registerForRadioStateChanged(this, EVENT_RADIO_STATE_CHANGED, null);
        synchronized (mIsRadioOnLock) {
            mIsRadioOn = phone.isRadioOn();
        }
        mIsRadioOn.set(phone.isRadioOn());

        registerForPendingDatagramCount();
        registerForSatelliteModemStateChanged();
@@ -1832,20 +1828,16 @@ public class SatelliteController extends Handler {
            }

            case EVENT_RADIO_STATE_CHANGED: {
                synchronized (mIsRadioOnLock) {
                logd("EVENT_RADIO_STATE_CHANGED: radioState=" + mCi.getRadioState());
                if (mCi.getRadioState() == TelephonyManager.RADIO_POWER_ON) {
                        mIsRadioOn = true;
                    mIsRadioOn.set(true);
                } else if (mCi.getRadioState() == TelephonyManager.RADIO_POWER_OFF) {
                    resetCarrierRoamingSatelliteModeParams();
                        synchronized (mIsRadioOnLock) {
                            if (mRadioOffRequested) {
                    if (mRadioOffRequested.get()) {
                        logd("EVENT_RADIO_STATE_CHANGED: set mIsRadioOn to false");
                        stopWaitForCellularModemOffTimer();
                                mIsRadioOn = false;
                                mRadioOffRequested = false;
                            }
                        }
                        mIsRadioOn.set(false);
                        mRadioOffRequested.set(false);
                    }
                }

@@ -2162,9 +2154,7 @@ public class SatelliteController extends Handler {

            case EVENT_WAIT_FOR_CELLULAR_MODEM_OFF_TIMED_OUT: {
                plogw("Timed out to wait for cellular modem OFF state");
                synchronized (mIsRadioOnLock) {
                    mRadioOffRequested = false;
                }
                mRadioOffRequested.set(false);
                break;
            }

@@ -2697,20 +2687,18 @@ public class SatelliteController extends Handler {
        }

        if (enableSatellite) {
            synchronized (mIsRadioOnLock) {
                if (!mIsRadioOn) {
            if (!mIsRadioOn.get()) {
                ploge("Radio is not on, can not enable satellite");
                sendErrorAndReportSessionMetrics(
                        SatelliteManager.SATELLITE_RESULT_INVALID_MODEM_STATE, result);
                return;
            }
                if (mRadioOffRequested) {
            if (mRadioOffRequested.get()) {
                ploge("Radio is being powering off, can not enable satellite");
                sendErrorAndReportSessionMetrics(
                        SatelliteManager.SATELLITE_RESULT_INVALID_MODEM_STATE, result);
                return;
            }
            }

            if (mTelecomManager.isInEmergencyCall()) {
                plogd("requestSatelliteEnabled: reject as emergency call is ongoing.");
@@ -4361,9 +4349,7 @@ public class SatelliteController extends Handler {
    public void onSetCellularRadioPowerStateRequested(boolean powerOn) {
        logd("onSetCellularRadioPowerStateRequested: powerOn=" + powerOn);

        synchronized (mIsRadioOnLock) {
            mRadioOffRequested = !powerOn;
        }
        mRadioOffRequested.set(!powerOn);
        if (powerOn) {
            stopWaitForCellularModemOffTimer();
        } else {
@@ -4388,11 +4374,9 @@ public class SatelliteController extends Handler {
     */
    public void onPowerOffCellularRadioFailed() {
        logd("onPowerOffCellularRadioFailed");
        synchronized (mIsRadioOnLock) {
            mRadioOffRequested = false;
        mRadioOffRequested.set(false);
        stopWaitForCellularModemOffTimer();
    }
    }

    /**
     * Notify SMS received.
@@ -5914,7 +5898,8 @@ public class SatelliteController extends Handler {
                obtainMessage(EVENT_SET_SATELLITE_PLMN_INFO_DONE));
    }

    private Set<String> getAllPlmnSet() {
    @VisibleForTesting(visibility = VisibleForTesting.Visibility.PACKAGE)
    protected Set<String> getAllPlmnSet() {
        Set<String> allPlmnSetFromSubInfo = new HashSet<>();
        int[] activeSubIdArray = mSubscriptionManagerService.getActiveSubIdList(true);
        for (int activeSubId : activeSubIdArray) {
@@ -5923,6 +5908,12 @@ public class SatelliteController extends Handler {
        }
        allPlmnSetFromSubInfo.addAll(mSatellitePlmnListFromOverlayConfig);

        if (mIgnorePlmnListFromStorage.get()) {
            // Do not use PLMN list from storage
            plogd("getAllPlmnList: allPlmnSetFromSubInfo=" + allPlmnSetFromSubInfo);
            return allPlmnSetFromSubInfo;
        }

        Set<String> allPlmnListFromStorage = getCarrierRoamingNtnAllSatellitePlmnSetFromStorage();
        if (!allPlmnListFromStorage.containsAll(allPlmnSetFromSubInfo)) {
            allPlmnListFromStorage.addAll(allPlmnSetFromSubInfo);
@@ -7167,7 +7158,6 @@ public class SatelliteController extends Handler {
    }

    private void startWaitForCellularModemOffTimer() {
        synchronized (mIsRadioOnLock) {
        if (hasMessages(EVENT_WAIT_FOR_CELLULAR_MODEM_OFF_TIMED_OUT)) {
            plogd("startWaitForCellularModemOffTimer: the timer was already started");
            return;
@@ -7178,7 +7168,6 @@ public class SatelliteController extends Handler {
        sendMessageDelayed(obtainMessage(EVENT_WAIT_FOR_CELLULAR_MODEM_OFF_TIMED_OUT),
                timeoutMillis);
    }
    }

    private void stopWaitForCellularModemOffTimer() {
        synchronized (mSatelliteEnabledRequestLock) {
@@ -8770,7 +8759,7 @@ public class SatelliteController extends Handler {
            return false;
        }

        if (!mIsRadioOn) {
        if (!mIsRadioOn.get()) {
            plogd("isCarrierRoamingNtnEligible: radio is off");
            return false;
        }
@@ -9888,4 +9877,17 @@ public class SatelliteController extends Handler {

        return getSatelliteDataServicePolicyForPlmn(subId, "");
    }

    /**
     * This API can be used by only CTS to make the function {@link #getAllPlmnSet()} to exclude the
     * PLMN list from storage from the returned result.
     *
     * @param enabled Whether to enable boolean config.
     * @return {@code true} if the value is set successfully, {@code false} otherwise.
     */
    public boolean setSatelliteIgnorePlmnListFromStorage(boolean enabled) {
        plogd("setSatelliteIgnorePlmnListFromStorage - " + enabled);
        mIgnorePlmnListFromStorage.set(enabled);
        return true;
    }
}
+6 −5
Original line number Diff line number Diff line
@@ -60,6 +60,7 @@ import com.android.internal.telephony.PhoneFactory;
import com.android.internal.telephony.subscription.SubscriptionManagerService;
import com.android.internal.telephony.util.TelephonyUtils;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
@@ -556,8 +557,8 @@ public class SatelliteServiceUtils {

    /** Check whether device is connected to satellite PLMN */
    public static boolean isSatellitePlmn(int subId, @NonNull ServiceState serviceState) {
        List<String> satellitePlmnList =
                SatelliteController.getInstance().getSatellitePlmnsForCarrier(subId);
        List<String> satellitePlmnList = new ArrayList<>(
                SatelliteController.getInstance().getAllPlmnSet());
        if (satellitePlmnList.isEmpty()) {
            logd("isSatellitePlmn: satellitePlmnList is empty");
            return false;
@@ -567,12 +568,12 @@ public class SatelliteServiceUtils {
                serviceState.getNetworkRegistrationInfoListForTransportType(
                        AccessNetworkConstants.TRANSPORT_TYPE_WWAN)) {
            String registeredPlmn = nri.getRegisteredPlmn();
            if (TextUtils.isEmpty(registeredPlmn)) {
                logd("isSatellitePlmn: registeredPlmn is empty");
            String mccmnc = getMccMnc(nri);
            if (TextUtils.isEmpty(registeredPlmn) && TextUtils.isEmpty(mccmnc)) {
                logd("isSatellitePlmn: registeredPlmn and cell plmn are empty");
                continue;
            }

            String mccmnc = getMccMnc(nri);
            for (String satellitePlmn : satellitePlmnList) {
                if (TextUtils.equals(satellitePlmn, registeredPlmn)
                        || TextUtils.equals(satellitePlmn, mccmnc)) {
+17 −6
Original line number Diff line number Diff line
@@ -38,6 +38,7 @@ import static com.android.internal.telephony.uicc.IccCardStatus.PinState.PINSTAT
import static com.android.internal.telephony.uicc.IccCardStatus.PinState.PINSTATE_ENABLED_VERIFIED;
import static com.android.internal.telephony.util.TelephonyUtils.FORCE_VERBOSE_STATE_LOGGING;

import android.annotation.NonNull;
import android.annotation.Nullable;
import android.app.KeyguardManager;
import android.content.BroadcastReceiver;
@@ -47,6 +48,7 @@ import android.content.IntentFilter;
import android.content.SharedPreferences;
import android.os.AsyncResult;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.os.PersistableBundle;
import android.os.WorkSource;
@@ -66,10 +68,12 @@ import com.android.internal.telephony.Phone;
import com.android.internal.telephony.PhoneConstants;
import com.android.internal.telephony.PhoneFactory;
import com.android.internal.telephony.TelephonyStatsLog;
import com.android.internal.telephony.flags.FeatureFlags;
import com.android.internal.telephony.nano.StoredPinProto.EncryptedPin;
import com.android.internal.telephony.nano.StoredPinProto.StoredPin;
import com.android.internal.telephony.nano.StoredPinProto.StoredPin.PinStatus;
import com.android.internal.telephony.uicc.IccCardStatus.PinState;
import com.android.internal.telephony.util.WorkerThread;
import com.android.internal.util.ArrayUtils;
import com.android.telephony.Rlog;

@@ -180,7 +184,8 @@ public class PinStorage extends Handler {
        }
    };

    public PinStorage(Context context) {
    public PinStorage(Context context, @NonNull Looper looper, @NonNull FeatureFlags featureFlags) {
        super(looper);
        mContext = context;
        mBootCount = getBootCount();
        mKeyStore = initializeKeyStore();
@@ -211,10 +216,16 @@ public class PinStorage extends Handler {
        String alias = (!mIsDeviceSecure || mIsDeviceLocked)
                ? KEYSTORE_ALIAS_LONG_TERM_ALWAYS : KEYSTORE_ALIAS_LONG_TERM_USER_AUTH;
        // This is the main thread, so accessing keystore in a separate thread to prevent ANR.
        Executors.newSingleThreadExecutor().execute(() -> mLongTermSecretKey = initializeSecretKey(
        if (featureFlags.threadShred()) {
            WorkerThread.getExecutor().execute(() -> mLongTermSecretKey = initializeSecretKey(
                    alias, /*createIfAbsent=*/ true));
        } else {
            Executors.newSingleThreadExecutor()
                    .execute(() -> mLongTermSecretKey = initializeSecretKey(
                            alias, /*createIfAbsent=*/ true));
        }

        // If the device is not securee or is unlocked, we can start logic. Otherwise we need to
        // If the device is not secured or is unlocked, we can start logic. Otherwise we need to
        // wait for the device to be unlocked and store any temporary PIN in RAM.
        if (!mIsDeviceSecure || !mIsDeviceLocked) {
            mRamStorage = null;
@@ -673,7 +684,7 @@ public class PinStorage extends Handler {
        } else {
            // Load both the stored PIN in available state (with long-term key) and in other states
            // (with short-term key). At most one of them should be present at any given time and
            // we treat the case wheere both are present as an error.
            // we treat the case where both are present as an error.
            StoredPin availableStoredPin = loadPinInformationFromDisk(
                    slotId, SHARED_PREFS_AVAILABLE_PIN_BASE_KEY, mLongTermSecretKey);
            StoredPin rebootStoredPin = loadPinInformationFromDisk(
+8 −1
Original line number Diff line number Diff line
@@ -33,6 +33,7 @@ import android.content.SharedPreferences;
import android.content.pm.PackageManager;
import android.os.AsyncResult;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.os.RegistrantList;
import android.os.UserHandle;
@@ -72,6 +73,7 @@ import com.android.internal.telephony.subscription.SubscriptionManagerService;
import com.android.internal.telephony.uicc.euicc.EuiccCard;
import com.android.internal.telephony.util.ArrayUtils;
import com.android.internal.telephony.util.TelephonyUtils;
import com.android.internal.telephony.util.WorkerThread;
import com.android.telephony.Rlog;

import java.io.FileDescriptor;
@@ -305,7 +307,12 @@ public class UiccController extends Handler {
        PhoneConfigurationManager.registerForMultiSimConfigChange(
                this, EVENT_MULTI_SIM_CONFIG_CHANGED, null);

        mPinStorage = new PinStorage(mContext);
        if (mFeatureFlags.threadShred()) {
            mPinStorage = new PinStorage(mContext, WorkerThread.getHandler().getLooper(),
                    mFeatureFlags);
        } else {
            mPinStorage = new PinStorage(mContext, Looper.myLooper(), mFeatureFlags);
        }
        if (!TelephonyUtils.IS_USER) {
            mUseRemovableEsimAsDefault = PreferenceManager.getDefaultSharedPreferences(mContext)
                    .getBoolean(REMOVABLE_ESIM_AS_DEFAULT, false);
+1 −0
Original line number Diff line number Diff line
@@ -565,6 +565,7 @@ public abstract class TelephonyTest {
        lenient().doReturn(true).when(mFeatureFlags).dataServiceCheck();
        lenient().doReturn(true).when(mFeatureFlags).phoneTypeCleanup();
        lenient().doReturn(true).when(mFeatureFlags).cleanupCdma();
        lenient().doReturn(true).when(mFeatureFlags).threadShred();

        WorkerThread.reset();
        TelephonyManager.disableServiceHandleCaching();
Loading