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

Commit ad691920 authored by Jack Yu's avatar Jack Yu Committed by Gerrit Code Review
Browse files

Merge changes from topic "remove_obsolete" into main

* changes:
  Fixed incorrect card name shown up
  Fixed inactive pSIM not shown in settings
  Fixed port index is not updated when iccid is active but slot is inactive
  Fixed eSIM subscription disappeared
  Support legacy cell broadcast fields
  Fixed inactive SIM removal not updated issue
  Broadcast subId upon service initialized
  Removed the obsolete code
  Fixed getAccessibleSubscriptionInfoList returns the non-embedded sub
  Adding Anamoly report to detect invalid portIndex
parents a7277582 b95810ab
Loading
Loading
Loading
Loading
+3 −7
Original line number Diff line number Diff line
@@ -2477,9 +2477,8 @@ public class SubscriptionController extends ISub.Stub {
    /**
     * Set uicc applications being enabled or disabled.
     * @param enabled whether uicc applications are enabled or disabled.
     * @return the number of records updated
     */
    public int setUiccApplicationsEnabled(boolean enabled, int subId) {
    public void setUiccApplicationsEnabled(boolean enabled, int subId) {
        if (DBG) logd("[setUiccApplicationsEnabled]+ enabled:" + enabled + " subId:" + subId);

        enforceModifyPhoneState("setUiccApplicationsEnabled");
@@ -2489,16 +2488,14 @@ public class SubscriptionController extends ISub.Stub {
            ContentValues value = new ContentValues(1);
            value.put(SubscriptionManager.UICC_APPLICATIONS_ENABLED, enabled);

            int result = mContext.getContentResolver().update(
                    SubscriptionManager.getUriForSubscriptionId(subId), value, null, null);
            mContext.getContentResolver().update(SubscriptionManager.getUriForSubscriptionId(subId),
                    value, null, null);

            // Refresh the Cache of Active Subscription Info List
            refreshCachedActiveSubscriptionInfoList();

            notifyUiccAppsEnableChanged();
            notifySubscriptionInfoChanged();

            return result;
        } finally {
            Binder.restoreCallingIdentity(identity);
        }
@@ -4031,7 +4028,6 @@ public class SubscriptionController extends ISub.Stub {
     * @return true if success, false if fails or the further action is
     * needed hence it's redirected to Euicc.
     */
    @Override
    public boolean setSubscriptionEnabled(boolean enable, int subId) {
        enforceModifyPhoneState("setSubscriptionEnabled");

+270 −12
Original line number Diff line number Diff line
@@ -147,6 +147,42 @@ public class SubscriptionDatabaseManager extends Handler {
            new AbstractMap.SimpleImmutableEntry<>(
                    SimInfo.COLUMN_IS_REMOVABLE,
                    SubscriptionInfoInternal::getRemovableEmbedded),
            new AbstractMap.SimpleImmutableEntry<>(
                    SimInfo.COLUMN_CB_EXTREME_THREAT_ALERT,
                    SubscriptionInfoInternal::getCellBroadcastExtremeThreatAlertEnabled),
            new AbstractMap.SimpleImmutableEntry<>(
                    SimInfo.COLUMN_CB_SEVERE_THREAT_ALERT,
                    SubscriptionInfoInternal::getCellBroadcastSevereThreatAlertEnabled),
            new AbstractMap.SimpleImmutableEntry<>(
                    SimInfo.COLUMN_CB_AMBER_ALERT,
                    SubscriptionInfoInternal::getCellBroadcastAmberAlertEnabled),
            new AbstractMap.SimpleImmutableEntry<>(
                    SimInfo.COLUMN_CB_EMERGENCY_ALERT,
                    SubscriptionInfoInternal::getCellBroadcastEmergencyAlertEnabled),
            new AbstractMap.SimpleImmutableEntry<>(
                    SimInfo.COLUMN_CB_ALERT_SOUND_DURATION,
                    SubscriptionInfoInternal::getCellBroadcastAlertSoundDuration),
            new AbstractMap.SimpleImmutableEntry<>(
                    SimInfo.COLUMN_CB_ALERT_REMINDER_INTERVAL,
                    SubscriptionInfoInternal::getCellBroadcastAlertReminderInterval),
            new AbstractMap.SimpleImmutableEntry<>(
                    SimInfo.COLUMN_CB_ALERT_VIBRATE,
                    SubscriptionInfoInternal::getCellBroadcastAlertVibrationEnabled),
            new AbstractMap.SimpleImmutableEntry<>(
                    SimInfo.COLUMN_CB_ALERT_SPEECH,
                    SubscriptionInfoInternal::getCellBroadcastAlertSpeechEnabled),
            new AbstractMap.SimpleImmutableEntry<>(
                    SimInfo.COLUMN_CB_ETWS_TEST_ALERT,
                    SubscriptionInfoInternal::getCellBroadcastEtwsTestAlertEnabled),
            new AbstractMap.SimpleImmutableEntry<>(
                    SimInfo.COLUMN_CB_CHANNEL_50_ALERT,
                    SubscriptionInfoInternal::getCellBroadcastAreaInfoMessageEnabled),
            new AbstractMap.SimpleImmutableEntry<>(
                    SimInfo.COLUMN_CB_CMAS_TEST_ALERT,
                    SubscriptionInfoInternal::getCellBroadcastTestAlertEnabled),
            new AbstractMap.SimpleImmutableEntry<>(
                    SimInfo.COLUMN_CB_OPT_OUT_DIALOG,
                    SubscriptionInfoInternal::getCellBroadcastOptOutDialogEnabled),
            new AbstractMap.SimpleImmutableEntry<>(
                    SimInfo.COLUMN_ENHANCED_4G_MODE_ENABLED,
                    SubscriptionInfoInternal::getEnhanced4GModeEnabled),
@@ -266,6 +302,42 @@ public class SubscriptionDatabaseManager extends Handler {
            new AbstractMap.SimpleImmutableEntry<>(
                    SimInfo.COLUMN_IS_REMOVABLE,
                    SubscriptionDatabaseManager::setRemovableEmbedded),
            new AbstractMap.SimpleImmutableEntry<>(
                    SimInfo.COLUMN_CB_EXTREME_THREAT_ALERT,
                    SubscriptionDatabaseManager::setCellBroadcastExtremeThreatAlertEnabled),
            new AbstractMap.SimpleImmutableEntry<>(
                    SimInfo.COLUMN_CB_SEVERE_THREAT_ALERT,
                    SubscriptionDatabaseManager::setCellBroadcastSevereThreatAlertEnabled),
            new AbstractMap.SimpleImmutableEntry<>(
                    SimInfo.COLUMN_CB_AMBER_ALERT,
                    SubscriptionDatabaseManager::setCellBroadcastAmberAlertEnabled),
            new AbstractMap.SimpleImmutableEntry<>(
                    SimInfo.COLUMN_CB_EMERGENCY_ALERT,
                    SubscriptionDatabaseManager::setCellBroadcastEmergencyAlertEnabled),
            new AbstractMap.SimpleImmutableEntry<>(
                    SimInfo.COLUMN_CB_ALERT_SOUND_DURATION,
                    SubscriptionDatabaseManager::setCellBroadcastAlertSoundDuration),
            new AbstractMap.SimpleImmutableEntry<>(
                    SimInfo.COLUMN_CB_ALERT_REMINDER_INTERVAL,
                    SubscriptionDatabaseManager::setCellBroadcastAlertReminderInterval),
            new AbstractMap.SimpleImmutableEntry<>(
                    SimInfo.COLUMN_CB_ALERT_VIBRATE,
                    SubscriptionDatabaseManager::setCellBroadcastAlertVibrationEnabled),
            new AbstractMap.SimpleImmutableEntry<>(
                    SimInfo.COLUMN_CB_ALERT_SPEECH,
                    SubscriptionDatabaseManager::setCellBroadcastAlertSpeechEnabled),
            new AbstractMap.SimpleImmutableEntry<>(
                    SimInfo.COLUMN_CB_ETWS_TEST_ALERT,
                    SubscriptionDatabaseManager::setCellBroadcastEtwsTestAlertEnabled),
            new AbstractMap.SimpleImmutableEntry<>(
                    SimInfo.COLUMN_CB_CHANNEL_50_ALERT,
                    SubscriptionDatabaseManager::setCellBroadcastAreaInfoMessageEnabled),
            new AbstractMap.SimpleImmutableEntry<>(
                    SimInfo.COLUMN_CB_CMAS_TEST_ALERT,
                    SubscriptionDatabaseManager::setCellBroadcastTestAlertEnabled),
            new AbstractMap.SimpleImmutableEntry<>(
                    SimInfo.COLUMN_CB_OPT_OUT_DIALOG,
                    SubscriptionDatabaseManager::setCellBroadcastOptOutDialogEnabled),
            new AbstractMap.SimpleImmutableEntry<>(
                    SimInfo.COLUMN_ENHANCED_4G_MODE_ENABLED,
                    SubscriptionDatabaseManager::setEnhanced4GModeEnabled),
@@ -449,18 +521,6 @@ public class SubscriptionDatabaseManager extends Handler {
            SimInfo.COLUMN_MCC,
            SimInfo.COLUMN_MNC,
            SimInfo.COLUMN_SIM_PROVISIONING_STATUS,
            SimInfo.COLUMN_CB_EXTREME_THREAT_ALERT,
            SimInfo.COLUMN_CB_SEVERE_THREAT_ALERT,
            SimInfo.COLUMN_CB_AMBER_ALERT,
            SimInfo.COLUMN_CB_EMERGENCY_ALERT,
            SimInfo.COLUMN_CB_ALERT_SOUND_DURATION,
            SimInfo.COLUMN_CB_ALERT_REMINDER_INTERVAL,
            SimInfo.COLUMN_CB_ALERT_VIBRATE,
            SimInfo.COLUMN_CB_ALERT_SPEECH,
            SimInfo.COLUMN_CB_ETWS_TEST_ALERT,
            SimInfo.COLUMN_CB_CHANNEL_50_ALERT,
            SimInfo.COLUMN_CB_CMAS_TEST_ALERT,
            SimInfo.COLUMN_CB_OPT_OUT_DIALOG,
            SimInfo.COLUMN_IS_METERED,
            SimInfo.COLUMN_DATA_ENABLED_OVERRIDE_RULES,
            SimInfo.COLUMN_ALLOWED_NETWORK_TYPES
@@ -1287,6 +1347,180 @@ public class SubscriptionDatabaseManager extends Handler {
                SubscriptionInfoInternal.Builder::setRemovableEmbedded);
    }

    /**
     * Set whether cell broadcast extreme threat alert is enabled by the user or not.
     *
     * @param subId Subscription id.
     * @param isExtremeThreatAlertEnabled whether cell broadcast extreme threat alert is enabled by
     * the user or not.
     *
     * @throws IllegalArgumentException if the subscription does not exist.
     */
    public void setCellBroadcastExtremeThreatAlertEnabled(int subId,
            int isExtremeThreatAlertEnabled) {
        writeDatabaseAndCacheHelper(subId, SimInfo.COLUMN_CB_EXTREME_THREAT_ALERT,
                isExtremeThreatAlertEnabled,
                SubscriptionInfoInternal.Builder::setCellBroadcastExtremeThreatAlertEnabled);
    }

    /**
     * Set whether cell broadcast severe threat alert is enabled by the user or not.
     *
     * @param subId Subscription id.
     * @param isSevereThreatAlertEnabled whether cell broadcast severe threat alert is enabled by
     * the user or not.
     *
     * @throws IllegalArgumentException if the subscription does not exist.
     */
    public void setCellBroadcastSevereThreatAlertEnabled(int subId,
            int isSevereThreatAlertEnabled) {
        writeDatabaseAndCacheHelper(subId, SimInfo.COLUMN_CB_SEVERE_THREAT_ALERT,
                isSevereThreatAlertEnabled,
                SubscriptionInfoInternal.Builder::setCellBroadcastSevereThreatAlertEnabled);
    }

    /**
     * Set whether cell broadcast amber alert is enabled by the user or not.
     *
     * @param subId Subscription id.
     * @param isAmberAlertEnabled whether cell broadcast amber alert is enabled by
     * the user or not.
     *
     * @throws IllegalArgumentException if the subscription does not exist.
     */
    public void setCellBroadcastAmberAlertEnabled(int subId, int isAmberAlertEnabled) {
        writeDatabaseAndCacheHelper(subId, SimInfo.COLUMN_CB_AMBER_ALERT, isAmberAlertEnabled,
                SubscriptionInfoInternal.Builder::setCellBroadcastAmberAlertEnabled);
    }

    /**
     * Set whether cell broadcast emergency alert is enabled by the user or not.
     *
     * @param subId Subscription id.
     * @param isEmergencyAlertEnabled whether cell broadcast emergency alert is enabled by
     * the user or not.
     *
     * @throws IllegalArgumentException if the subscription does not exist.
     */
    public void setCellBroadcastEmergencyAlertEnabled(int subId,
            int isEmergencyAlertEnabled) {
        writeDatabaseAndCacheHelper(subId, SimInfo.COLUMN_CB_EMERGENCY_ALERT,
                isEmergencyAlertEnabled,
                SubscriptionInfoInternal.Builder::setCellBroadcastEmergencyAlertEnabled);
    }

    /**
     * Set cell broadcast alert sound duration.
     *
     * @param subId Subscription id.
     * @param alertSoundDuration Alert sound duration in seconds.
     *
     * @throws IllegalArgumentException if the subscription does not exist.
     */
    public void setCellBroadcastAlertSoundDuration(int subId, int alertSoundDuration) {
        writeDatabaseAndCacheHelper(subId, SimInfo.COLUMN_CB_ALERT_SOUND_DURATION,
                alertSoundDuration,
                SubscriptionInfoInternal.Builder::setCellBroadcastAlertSoundDuration);
    }

    /**
     * Set cell broadcast alert reminder interval.
     *
     * @param subId Subscription id.
     * @param reminderInterval Alert reminder interval in milliseconds.
     *
     * @throws IllegalArgumentException if the subscription does not exist.
     */
    public void setCellBroadcastAlertReminderInterval(int subId, int reminderInterval) {
        writeDatabaseAndCacheHelper(subId, SimInfo.COLUMN_CB_ALERT_REMINDER_INTERVAL,
                reminderInterval,
                SubscriptionInfoInternal.Builder::setCellBroadcastAlertReminderInterval);
    }

    /**
     * Set whether cell broadcast alert vibration is enabled by the user or not.
     *
     * @param subId Subscription id.
     * @param isAlertVibrationEnabled whether cell broadcast alert vibration is enabled by the user
     * or not.
     *
     * @throws IllegalArgumentException if the subscription does not exist.
     */
    public void setCellBroadcastAlertVibrationEnabled(int subId, int isAlertVibrationEnabled) {
        writeDatabaseAndCacheHelper(subId, SimInfo.COLUMN_CB_ALERT_VIBRATE, isAlertVibrationEnabled,
                SubscriptionInfoInternal.Builder::setCellBroadcastAlertVibrationEnabled);
    }

    /**
     * Set whether cell broadcast alert speech is enabled by the user or not.
     *
     * @param subId Subscription id.
     * @param isAlertSpeechEnabled whether cell broadcast alert speech is enabled by the user or
     * not.
     *
     * @throws IllegalArgumentException if the subscription does not exist.
     */
    public void setCellBroadcastAlertSpeechEnabled(int subId, int isAlertSpeechEnabled) {
        writeDatabaseAndCacheHelper(subId, SimInfo.COLUMN_CB_ALERT_SPEECH, isAlertSpeechEnabled,
                SubscriptionInfoInternal.Builder::setCellBroadcastAlertSpeechEnabled);
    }

    /**
     * Set whether ETWS test alert is enabled by the user or not.
     *
     * @param subId Subscription id.
     * @param isEtwsTestAlertEnabled whether cell broadcast ETWS test alert is enabled by the user
     * or not.
     *
     * @throws IllegalArgumentException if the subscription does not exist.
     */
    public void setCellBroadcastEtwsTestAlertEnabled(int subId, int isEtwsTestAlertEnabled) {
        writeDatabaseAndCacheHelper(subId, SimInfo.COLUMN_CB_ETWS_TEST_ALERT,
                isEtwsTestAlertEnabled,
                SubscriptionInfoInternal.Builder::setCellBroadcastEtwsTestAlertEnabled);
    }

    /**
     * Set whether area info message is enabled by the user or not.
     *
     * @param subId Subscription id.
     * @param isAreaInfoMessageEnabled whether cell broadcast area info message is enabled by the
     * user or not.
     *
     * @throws IllegalArgumentException if the subscription does not exist.
     */
    public void setCellBroadcastAreaInfoMessageEnabled(int subId, int isAreaInfoMessageEnabled) {
        writeDatabaseAndCacheHelper(subId, SimInfo.COLUMN_CB_CHANNEL_50_ALERT,
                isAreaInfoMessageEnabled,
                SubscriptionInfoInternal.Builder::setCellBroadcastAreaInfoMessageEnabled);
    }

    /**
     * Set whether cell broadcast test alert is enabled by the user or not.
     *
     * @param subId Subscription id.
     * @param isTestAlertEnabled whether cell broadcast test alert is enabled by the user or not.
     *
     * @throws IllegalArgumentException if the subscription does not exist.
     */
    public void setCellBroadcastTestAlertEnabled(int subId, int isTestAlertEnabled) {
        writeDatabaseAndCacheHelper(subId, SimInfo.COLUMN_CB_CMAS_TEST_ALERT, isTestAlertEnabled,
                SubscriptionInfoInternal.Builder::setCellBroadcastTestAlertEnabled);
    }

    /**
     * Set whether cell broadcast opt-out dialog should be shown or not.
     *
     * @param subId Subscription id.
     * @param isOptOutDialogEnabled whether cell broadcast opt-out dialog should be shown or not.
     *
     * @throws IllegalArgumentException if the subscription does not exist.
     */
    public void setCellBroadcastOptOutDialogEnabled(int subId, int isOptOutDialogEnabled) {
        writeDatabaseAndCacheHelper(subId, SimInfo.COLUMN_CB_OPT_OUT_DIALOG, isOptOutDialogEnabled,
                SubscriptionInfoInternal.Builder::setCellBroadcastOptOutDialogEnabled);
    }

    /**
     * Set whether enhanced 4G mode is enabled by the user or not.
     *
@@ -1921,6 +2155,30 @@ public class SubscriptionDatabaseManager extends Handler {
        builder.setCardId(publicCardId)
                .setRemovableEmbedded(cursor.getInt(cursor.getColumnIndexOrThrow(
                        SimInfo.COLUMN_IS_REMOVABLE)))
                .setCellBroadcastExtremeThreatAlertEnabled(cursor.getInt(cursor
                        .getColumnIndexOrThrow(SimInfo.COLUMN_CB_EXTREME_THREAT_ALERT)))
                .setCellBroadcastSevereThreatAlertEnabled(cursor.getInt(cursor
                        .getColumnIndexOrThrow(SimInfo.COLUMN_CB_SEVERE_THREAT_ALERT)))
                .setCellBroadcastAmberAlertEnabled(cursor.getInt(cursor.getColumnIndexOrThrow(
                        SimInfo.COLUMN_CB_AMBER_ALERT)))
                .setCellBroadcastEmergencyAlertEnabled(cursor.getInt(cursor.getColumnIndexOrThrow(
                        SimInfo.COLUMN_CB_EMERGENCY_ALERT)))
                .setCellBroadcastAlertSoundDuration(cursor.getInt(cursor.getColumnIndexOrThrow(
                        SimInfo.COLUMN_CB_ALERT_SOUND_DURATION)))
                .setCellBroadcastAlertReminderInterval(cursor.getInt(cursor.getColumnIndexOrThrow(
                        SimInfo.COLUMN_CB_ALERT_REMINDER_INTERVAL)))
                .setCellBroadcastAlertVibrationEnabled(cursor.getInt(cursor.getColumnIndexOrThrow(
                        SimInfo.COLUMN_CB_ALERT_VIBRATE)))
                .setCellBroadcastAlertSpeechEnabled(cursor.getInt(cursor.getColumnIndexOrThrow(
                        SimInfo.COLUMN_CB_ALERT_SPEECH)))
                .setCellBroadcastEtwsTestAlertEnabled(cursor.getInt(cursor.getColumnIndexOrThrow(
                        SimInfo.COLUMN_CB_ETWS_TEST_ALERT)))
                .setCellBroadcastAreaInfoMessageEnabled(cursor.getInt(cursor.getColumnIndexOrThrow(
                        SimInfo.COLUMN_CB_CHANNEL_50_ALERT)))
                .setCellBroadcastTestAlertEnabled(cursor.getInt(cursor.getColumnIndexOrThrow(
                        SimInfo.COLUMN_CB_CMAS_TEST_ALERT)))
                .setCellBroadcastOptOutDialogEnabled(cursor.getInt(cursor.getColumnIndexOrThrow(
                        SimInfo.COLUMN_CB_OPT_OUT_DIALOG)))
                .setEnhanced4GModeEnabled(cursor.getInt(cursor.getColumnIndexOrThrow(
                        SimInfo.COLUMN_ENHANCED_4G_MODE_ENABLED)))
                .setVideoTelephonyEnabled(cursor.getInt(cursor.getColumnIndexOrThrow(
+425 −20

File changed.

Preview size limit exceeded, changes collapsed.

+140 −60

File changed.

Preview size limit exceeded, changes collapsed.

+2 −1
Original line number Diff line number Diff line
@@ -787,7 +787,8 @@ public class UiccController extends Handler {
                        IccCardConstants.State.ABSENT.toString());
            }

            SubscriptionManagerService.getInstance().updateSimStateForInactivePort(phoneId);
            SubscriptionManagerService.getInstance().updateSimStateForInactivePort(phoneId,
                    TextUtils.emptyIfNull(iccId));
        });
    }

Loading