Reset AndroidID after switching login method

This commit is contained in:
Oizaro 2020-10-10 02:19:45 +02:00
parent 258b9936f3
commit 646eab8f2a
3 changed files with 25 additions and 2 deletions

View File

@ -158,7 +158,12 @@ public class LoginActivity extends AssistantActivity {
super.onHuaweiButtonClicked();
state++;
if (state == 1) {
CheckinClient.brandSpoof = true;
CheckinClient.isHuaweiButtonClicked = true;
if (CheckinClient.isLoginButtonClicked) {
LastCheckinInfo.ClearCheckinInfo(this);
CheckinClient.brandSpoof = true;
CheckinClient.isLoginButtonClicked = false;
}
init();
}
}
@ -168,7 +173,12 @@ public class LoginActivity extends AssistantActivity {
super.onNextButtonClicked();
state++;
if (state == 1) {
CheckinClient.brandSpoof = false;
CheckinClient.isLoginButtonClicked = true;
if (CheckinClient.isHuaweiButtonClicked) {
LastCheckinInfo.ClearCheckinInfo(this);
CheckinClient.brandSpoof = false;
CheckinClient.isHuaweiButtonClicked = false;
}
init();
} else if (state == -1) {
setResult(RESULT_CANCELED);

View File

@ -45,6 +45,8 @@ public class CheckinClient {
private static final List<String> TODO_LIST_STRING = new ArrayList<>(); // TODO
private static final List<CheckinRequest.Checkin.Statistic> TODO_LIST_CHECKIN = new ArrayList<CheckinRequest.Checkin.Statistic>(); // TODO
private static final String SERVICE_URL = "https://android.clients.google.com/checkin";
public static boolean isHuaweiButtonClicked = false;
public static boolean isLoginButtonClicked = false;
public static boolean brandSpoof = false;
public static CheckinResponse request(CheckinRequest request) throws IOException {

View File

@ -57,4 +57,15 @@ public class LastCheckinInfo {
.putString(PREF_DEVICE_DATA_VERSION_INFO, deviceDataVersionInfo)
.commit();
}
public static void ClearCheckinInfo(Context context) {
context.getSharedPreferences(PREFERENCES_NAME, Context.MODE_PRIVATE).edit()
.putLong(PREF_ANDROID_ID, 0)
.putString(PREF_DIGEST, INITIAL_DIGEST)
.putLong(PREF_LAST_CHECKIN, 0)
.putLong(PREF_SECURITY_TOKEN, 0)
.putString(PREF_VERSION_INFO, "")
.putString(PREF_DEVICE_DATA_VERSION_INFO, "")
.commit();
}
}