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

Commit a975202b authored by Jiashen Wang's avatar Jiashen Wang Committed by Android (Google) Code Review
Browse files

Merge "Add a config flag to control slot change receiver in Settings"

parents 7d0e81bc e9be9eb0
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -479,4 +479,7 @@

    <!-- Orders for overriding tile positions on the homepage -->
    <integer-array name="config_homepage_tile_orders"/>

    <!-- Whether to handle slot change events -->
    <bool name="config_handle_sim_slot_change">false</bool>
</resources>
+6 −0
Original line number Diff line number Diff line
@@ -27,6 +27,7 @@ import android.util.Log;

import androidx.annotation.Nullable;

import com.android.settings.R;
import com.android.settingslib.utils.ThreadUtils;

import java.util.List;
@@ -60,6 +61,11 @@ public class SimSlotChangeReceiver extends BroadcastReceiver {

    // Checks whether the slot event should be handled.
    private boolean shouldHandleSlotChange(Context context) {
        if (!context.getResources().getBoolean(R.bool.config_handle_sim_slot_change)) {
            Log.i(TAG, "The flag is off. Ignore slot changes.");
            return false;
        }

        final EuiccManager euiccManager = context.getSystemService(EuiccManager.class);
        if (euiccManager == null || !euiccManager.isEnabled()) {
            Log.i(TAG, "Ignore slot changes because EuiccManager is disabled.");