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

Commit a26d3ea0 authored by Aishwarya Mallampati's avatar Aishwarya Mallampati
Browse files

Revert "Moved SIM state broadcast back to UiccController"

This reverts commit dc1f5286.

Reason for revert: b/263772382

Change-Id: I8a1e3e1934f6b66ee6dd14c4373efb44daf64dc9
parent 9c185193
Loading
Loading
Loading
Loading
+1 −8
Original line number Diff line number Diff line
@@ -16,7 +16,6 @@

package com.android.internal.telephony;

import android.annotation.NonNull;
import android.compat.annotation.UnsupportedAppUsage;
import android.content.BroadcastReceiver;
import android.content.ComponentName;
@@ -201,13 +200,7 @@ public class CarrierServiceBindHelper {
        }
    }

    /**
     * Update SIM state.
     *
     * @param phoneId The phone id.
     * @param simState The legacy SIM state.
     */
    public void updateSimState(int phoneId, @NonNull String simState) {
    void updateForPhoneId(int phoneId, String simState) {
        logdWithLocalLog("update binding for phoneId: " + phoneId + " simState: " + simState);
        if (!SubscriptionManager.isValidPhoneId(phoneId)) {
            return;
+1 −1
Original line number Diff line number Diff line
@@ -700,7 +700,7 @@ public class SubscriptionInfoUpdater extends Handler {
        CarrierConfigManager configManager =
                (CarrierConfigManager) sContext.getSystemService(Context.CARRIER_CONFIG_SERVICE);
        configManager.updateConfigForPhoneId(phoneId, simState);
        mCarrierServiceBindHelper.updateSimState(phoneId, simState);
        mCarrierServiceBindHelper.updateForPhoneId(phoneId, simState);
    }

    private void updateSubscriptionCarrierId(int phoneId, String simState) {
+1 −143
Original line number Diff line number Diff line
@@ -59,7 +59,6 @@ import android.telephony.SubscriptionManager.SubscriptionType;
import android.telephony.SubscriptionManager.UsageSetting;
import android.telephony.TelephonyFrameworkInitializer;
import android.telephony.TelephonyManager;
import android.telephony.TelephonyManager.SimState;
import android.telephony.TelephonyRegistryManager;
import android.telephony.UiccAccessRule;
import android.telephony.euicc.EuiccManager;
@@ -428,10 +427,6 @@ public class SubscriptionManagerService extends ISub.Stub {
                    @Override
                    public void onDatabaseLoaded() {
                        log("Subscription database has been loaded.");
                        for (int phoneId = 0; phoneId < mTelephonyManager.getActiveModemCount()
                                ; phoneId++) {
                            markSubscriptionsInactive(phoneId);
                        }
                    }

                    /**
@@ -831,7 +826,7 @@ public class SubscriptionManagerService extends ISub.Stub {
    /**
     * Mark all subscriptions on this SIM slot index inactive.
     *
     * @param simSlotIndex The logical SIM slot index (i.e. phone id).
     * @param simSlotIndex The SIM slot index.
     */
    public void markSubscriptionsInactive(int simSlotIndex) {
        mSubscriptionDatabaseManager.getAllSubscriptions().stream()
@@ -990,15 +985,6 @@ public class SubscriptionManagerService extends ISub.Stub {
        }
    }

    /**
     * Update the subscriptions on the logical SIM slot index (i.e. phone id).
     *
     * @param slotIndex The logical SIM slot index.
     */
    private void updateSubscriptions(int slotIndex) {

    }

    /**
     * Get all subscription info records from SIMs that are inserted now or previously inserted.
     *
@@ -3093,134 +3079,6 @@ public class SubscriptionManagerService extends ISub.Stub {
                ? subscriptionInfoInternal.toSubscriptionInfo() : null;
    }

    /**
     * Called when SIM state changed to absent.
     *
     * @param slotIndex The logical SIM slot index.
     */
    private void onSimAbsent(int slotIndex) {
        if (mSlotIndexToSubId.containsKey(slotIndex)) {
            // Re-enable the SIM when it's removed, so it will be in enabled state when it gets
            // re-inserted again. (pre-U behavior)
            mSubscriptionDatabaseManager.setUiccApplicationsEnabled(
                    mSlotIndexToSubId.get(slotIndex), true);
            // When sim is absent, set the port index to invalid port index. (pre-U behavior)
            mSubscriptionDatabaseManager.setPortIndex(mSlotIndexToSubId.get(slotIndex),
                    TelephonyManager.INVALID_PORT_INDEX);
        }
        updateSubscriptions(slotIndex);
    }

    /**
     * Called when SIM state changed to locked.
     *
     * @param slotIndex The logical SIM slot index.
     */
    private void onSimLocked(int slotIndex) {

    }

    /**
     * Called when SIM state changed to ready.
     *
     * @param slotIndex The logical SIM slot index.
     */
    private void onSimReady(int slotIndex) {

    }

    /**
     * Called when SIM state changed to not ready.
     *
     * @param slotIndex The logical SIM slot index.
     */
    private void onSimNotReady(int slotIndex) {

    }

    /**
     * Called when SIM encounters error.
     *
     * @param slotIndex The logical SIM slot index.
     */
    private void onSimError(int slotIndex) {

    }

    /**
     * Called when SIM state changed to loaded.
     *
     * @param slotIndex The logical SIM slot index.
     */
    private void onSimLoaded(int slotIndex) {
    }

    /**
     * Called when eSIM becomes inactive.
     *
     * @param slotIndex The logical SIM slot index.
     */
    public void updateSimStateForInactivePort(int slotIndex) {
        mHandler.post(() -> {
            if (mSlotIndexToSubId.containsKey(slotIndex)) {
                // Re-enable the UICC application , so it will be in enabled state when it becomes
                // active again. (pre-U behavior)
                mSubscriptionDatabaseManager.setUiccApplicationsEnabled(
                        mSlotIndexToSubId.get(slotIndex), true);
                updateSubscriptions(slotIndex);
            }
        });
    }

    /**
     * Update SIM state. This method is supposed to be called by {@link UiccController} only.
     *
     * @param slotIndex The logical SIM slot index.
     * @param simState SIM state.
     * @param executor The executor to execute the callback.
     * @param updateCompleteCallback The callback to call when subscription manager service
     * completes subscription update. SIM state changed event will be broadcasted by
     * {@link UiccController} upon receiving callback.
     */
    public void updateSimState(int slotIndex, @SimState int simState,
            @Nullable @CallbackExecutor Executor executor,
            @Nullable Runnable updateCompleteCallback) {
        mHandler.post(() -> {
            switch (simState) {
                case TelephonyManager.SIM_STATE_ABSENT:
                    onSimAbsent(slotIndex);
                    break;
                case TelephonyManager.SIM_STATE_PIN_REQUIRED:
                case TelephonyManager.SIM_STATE_PUK_REQUIRED:
                case TelephonyManager.SIM_STATE_NETWORK_LOCKED:
                case TelephonyManager.SIM_STATE_PERM_DISABLED:
                    onSimLocked(slotIndex);
                    break;
                case TelephonyManager.SIM_STATE_READY:
                    onSimReady(slotIndex);
                    break;
                case TelephonyManager.SIM_STATE_NOT_READY:
                    onSimNotReady(slotIndex);
                    break;
                case TelephonyManager.SIM_STATE_CARD_IO_ERROR:
                    onSimError(slotIndex);
                    break;
                case TelephonyManager.SIM_STATE_CARD_RESTRICTED:
                    // No specific things needed to be done. Just return and broadcast the SIM
                    // states.
                    break;
                case TelephonyManager.SIM_STATE_LOADED:
                    onSimLoaded(slotIndex);
                    break;
                default:
                    break;
            }
            if (executor != null && updateCompleteCallback != null) {
                executor.execute(updateCompleteCallback);
            }
        });
    }

    /**
     * Log debug messages.
     *
+20 −322

File changed.

Preview size limit exceeded, changes collapsed.

+2 −2
Original line number Diff line number Diff line
@@ -802,8 +802,8 @@ public class UiccProfile extends IccCard {
            }
            log("setExternalState: set mPhoneId=" + mPhoneId + " mExternalState=" + mExternalState);

            UiccController.getInstance().updateSimState(mPhoneId, mExternalState,
                    getIccStateReason(mExternalState));
            UiccController.updateInternalIccState(mContext, mExternalState,
                    getIccStateReason(mExternalState), mPhoneId);
        }
    }

Loading