Merge "Add a config flag to control slot change receiver in Settings"
This commit is contained in:
@@ -479,4 +479,7 @@
|
|||||||
|
|
||||||
<!-- Orders for overriding tile positions on the homepage -->
|
<!-- Orders for overriding tile positions on the homepage -->
|
||||||
<integer-array name="config_homepage_tile_orders"/>
|
<integer-array name="config_homepage_tile_orders"/>
|
||||||
|
|
||||||
|
<!-- Whether to handle slot change events -->
|
||||||
|
<bool name="config_handle_sim_slot_change">false</bool>
|
||||||
</resources>
|
</resources>
|
||||||
|
@@ -27,6 +27,7 @@ import android.util.Log;
|
|||||||
|
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
|
|
||||||
|
import com.android.settings.R;
|
||||||
import com.android.settingslib.utils.ThreadUtils;
|
import com.android.settingslib.utils.ThreadUtils;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -60,6 +61,11 @@ public class SimSlotChangeReceiver extends BroadcastReceiver {
|
|||||||
|
|
||||||
// Checks whether the slot event should be handled.
|
// Checks whether the slot event should be handled.
|
||||||
private boolean shouldHandleSlotChange(Context context) {
|
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);
|
final EuiccManager euiccManager = context.getSystemService(EuiccManager.class);
|
||||||
if (euiccManager == null || !euiccManager.isEnabled()) {
|
if (euiccManager == null || !euiccManager.isEnabled()) {
|
||||||
Log.i(TAG, "Ignore slot changes because EuiccManager is disabled.");
|
Log.i(TAG, "Ignore slot changes because EuiccManager is disabled.");
|
||||||
|
Reference in New Issue
Block a user