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

Commit fba2df1d authored by LuK1337's avatar LuK1337 Committed by Łukasz Patron
Browse files

UiccSlot: Validate hotswap restart prompt component properly

Resources.getString(int) cannot return null, therefore instead let's
check if ComponentName.unflattenFromString() is null.

Test: Remove SIM card on a device with config_hotswapCapable set to
      false and config_iccHotswapPromptForRestartDialogComponent set to
      @null, notice that dialog prompting user to restart is shown.
Bug: 227459873
Change-Id: Id7c8c1bfad6bb25fe5e8f8b4bb7be91e2484dd17
parent cbded5de
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -311,11 +311,11 @@ public class UiccSlot extends Handler {
    private void promptForRestart(boolean isAdded) {
        synchronized (mLock) {
            final Resources res = mContext.getResources();
            final String dialogComponent = res.getString(
                    R.string.config_iccHotswapPromptForRestartDialogComponent);
            final ComponentName dialogComponent = ComponentName.unflattenFromString(
                    res.getString(R.string.config_iccHotswapPromptForRestartDialogComponent));
            if (dialogComponent != null) {
                Intent intent = new Intent().setComponent(ComponentName.unflattenFromString(
                        dialogComponent)).addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
                Intent intent = new Intent().setComponent(dialogComponent)
                        .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
                        .putExtra(EXTRA_ICC_CARD_ADDED, isAdded);
                try {
                    mContext.startActivityAsUser(intent, UserHandle.CURRENT);