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

Commit 966242ef authored by Sandeep Gutta's avatar Sandeep Gutta
Browse files

Ignore SIM state events during shutdown

Make code changes in UiccController to ignore SIM/SLOT status
change events during device shutdown.

Bug: 160295031
Change-Id: I21533ac57e8ce2b9449dbf9f5cd9855fe825fc47
parent c32b0ccf
Loading
Loading
Loading
Loading
+24 −0
Original line number Diff line number Diff line
@@ -686,6 +686,13 @@ public class UiccController extends Handler {
            Rlog.e(LOG_TAG,"onGetIccCardStatusDone: invalid index : " + index);
            return;
        }
        if (isShuttingDown()) {
            // Do not process the SIM/SLOT events during device shutdown,
            // as it may unnecessarily modify the persistent information
            // like, SubscriptionManager.UICC_APPLICATIONS_ENABLED.
            log("onGetIccCardStatusDone: shudown in progress ignore event");
            return;
        }

        IccCardStatus status = (IccCardStatus)ar.result;

@@ -914,6 +921,13 @@ public class UiccController extends Handler {
            }
            return;
        }
        if (isShuttingDown()) {
            // Do not process the SIM/SLOT events during device shutdown,
            // as it may unnecessarily modify the persistent information
            // like, SubscriptionManager.UICC_APPLICATIONS_ENABLED.
            log("onGetSlotStatusDone: shudown in progress ignore event");
            return;
        }

        ArrayList<IccSlotStatus> status = (ArrayList<IccSlotStatus>) ar.result;

@@ -1230,6 +1244,16 @@ public class UiccController extends Handler {
        return (index >= 0 && index < mUiccSlots.length);
    }

    private boolean isShuttingDown() {
        for (int i = 0; i < TelephonyManager.getDefault().getActiveModemCount(); i++) {
            if (PhoneFactory.getPhone(i) != null &&
                    PhoneFactory.getPhone(i).isShuttingDown()) {
                return true;
            }
        }
        return false;
    }

    @UnsupportedAppUsage
    private void log(String string) {
        Rlog.d(LOG_TAG, string);