Source:
public static void setEmail(@NonNull final String email, @Nullable final String emailAuthHash, @Nullable final EmailUpdateHandler callback) { if (taskController.shouldQueueTaskForInit("setEmail()")) { logger.error("Waiting for remote params. " + "Moving setEmail() operation to a pending task queue."); taskController.addTaskWaitingForInit(new Runnable() { @Override public void run() { logger.debug("Running setEmail() operation from a pending task queue."); setEmail(email, emailAuthHash, callback); } }); } if (shouldLogUserPrivacyConsentErrorMessageForMethodName("setEmail()")) return; if (!OSUtils.isValidEmail(email)) { String errorMessage = "Email is invalid"; if (callback != null) callback.onFailure(new EmailUpdateError(EmailErrorType.VALIDATION, errorMessage)); logger.error(errorMessage); return; } if (getRemoteParams() != null && getRemoteParams().useEmailAuth && emailAuthHash == null) { String errorMessage = "Email authentication (auth token) is set to REQUIRED for this application. Please provide an auth token from your backend server or change the setting in the OneSignal dashboard."; if (callback != null) callback.onFailure(new EmailUpdateError(EmailErrorType.REQUIRES_EMAIL_AUTH, errorMessage)); logger.error(errorMessage); return; } emailUpdateHandler = callback; Runnable runSetEmail = new Runnable() { @Override public void run() { String trimmedEmail = email.trim(); String internalEmailAuthHash = emailAuthHash; if (internalEmailAuthHash != null) internalEmailAuthHash.toLowerCase(); getCurrentEmailSubscriptionState(appContext).setEmailAddress(trimmedEmail); OneSignalStateSynchronizer.setEmail(trimmedEmail.toLowerCase(), internalEmailAuthHash); } }; if (!initDone || taskController.shouldRunTaskThroughQueue()) { logger.error("You should initialize OneSignal before calling setEmail! " + "Moving this operation to a pending task queue."); taskController.addTaskToQueue(runSetEmail); return; } runSetEmail.run(); }

Target:
public static void setEmail(@NonNull final String email, @Nullable final String emailAuthHash, @Nullable final EmailUpdateHandler callback) { if (taskController.shouldQueueTaskForInit(OSTaskController.SET_EMAIL)) { logger.error("Waiting for remote params. " + "Moving " + OSTaskController.SET_EMAIL + " operation to a pending task queue."); taskController.addTaskToQueue(new Runnable() { @Override public void run() { logger.debug("Running " + OSTaskController.SET_EMAIL + " operation from a pending task queue."); setEmail(email, emailAuthHash, callback); } }); } if (shouldLogUserPrivacyConsentErrorMessageForMethodName(OSTaskController.SET_EMAIL)) return; if (!OSUtils.isValidEmail(email)) { String errorMessage = "Email is invalid"; if (callback != null) callback.onFailure(new EmailUpdateError(EmailErrorType.VALIDATION, errorMessage)); logger.error(errorMessage); return; } if (getRemoteParams().useEmailAuth && emailAuthHash == null) { String errorMessage = "Email authentication (auth token) is set to REQUIRED for this application. Please provide an auth token from your backend server or change the setting in the OneSignal dashboard."; if (callback != null) callback.onFailure(new EmailUpdateError(EmailErrorType.REQUIRES_EMAIL_AUTH, errorMessage)); logger.error(errorMessage); return; } emailUpdateHandler = callback; String trimmedEmail = email.trim(); String internalEmailAuthHash = emailAuthHash; if (internalEmailAuthHash != null) internalEmailAuthHash = internalEmailAuthHash.toLowerCase(); getCurrentEmailSubscriptionState(appContext).setEmailAddress(trimmedEmail); OneSignalStateSynchronizer.setEmail(trimmedEmail.toLowerCase(), internalEmailAuthHash); }