code: @SuppressLint("InlinedApi")
      public static void restartWithTheme(Activity activity, int theme, boolean force) {
          if (theme < _START_RESOURCES_ID && theme > 0) {
              if (ThemeManager._THEME_MODIFIER > 0) {
                  theme |= ThemeManager._THEME_MODIFIER;
              }
              theme &= ThemeManager._THEME_MASK;
          }
          if (force || ThemeManager.getTheme(activity) != theme) {
              Intent intent = new Intent(activity.getIntent());
              intent.setClass(activity, activity.getClass());
              intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
              intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
              if (theme > 0) {
                  intent.putExtra(ThemeManager._THEME_TAG, theme);
              }
              intent.putExtra(KEY_INSTANCE_STATE, activity.saveInstanceState());
              intent.putExtra(KEY_CREATED_BY_THEME_MANAGER, true);
              if (activity.isRestricted()) {
                  Application app = Application.getLastInstance();
                  if (app != null && !app.isRestricted()) {
                      intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                      app.superStartActivity(intent, -1, null);
                  }
              } else {
                  if (!activity.isFinishing()) {
                      activity.finish();
                      activity.overridePendingTransition(0, 0);
                  }
                  if (activity != null) {
                      activity.superStartActivity(intent, -1, null);
                  }
              }
          }
      }
docs: Like {@link #restartWithTheme(Activity, int)}, but if third arg is true -
  restart activity regardless theme.
  
  @param activity Activity
  @param theme    Theme flags for check
  @param force    Force restart activity