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

This commit is contained in:
Jiashen Wang
2021-01-26 00:17:27 +00:00
committed by Android (Google) Code Review
2 changed files with 9 additions and 0 deletions

View File

@@ -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>

View File

@@ -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.");