Show spoof button from start

This commit is contained in:
Oizaro 2020-09-30 14:33:21 +02:00
parent f12501076d
commit c0f387de9a
6 changed files with 27 additions and 30 deletions

View File

@ -38,7 +38,7 @@ public abstract class AssistantActivity extends Activity {
super.onCreate(savedInstanceState);
setContentView(R.layout.login_assistant);
formatTitle();
findViewById(R.id.spoof_button).setOnClickListener(v -> onSpoofButtonClicked());
findViewById(R.id.spoof_button).setOnClickListener(v -> onHuaweiButtonClicked());
findViewById(R.id.next_button).setOnClickListener(v -> onNextButtonClicked());
findViewById(R.id.back_button).setOnClickListener(v -> onBackButtonClicked());
}
@ -93,7 +93,7 @@ public abstract class AssistantActivity extends Activity {
}
}
protected void onSpoofButtonClicked() {
protected void onHuaweiButtonClicked() {
}

View File

@ -21,6 +21,7 @@ import android.accounts.AccountManager;
import android.annotation.SuppressLint;
import android.annotation.TargetApi;
import android.content.Context;
import android.content.Intent;
import android.graphics.Color;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
@ -94,13 +95,11 @@ public class LoginActivity extends AssistantActivity {
private InputMethodManager inputMethodManager;
private ViewGroup authContent;
private int state = 0;
private Bundle initialSavedInstanceState;
@SuppressLint("AddJavascriptInterface")
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
initialSavedInstanceState = savedInstanceState;
accountType = AuthConstants.DEFAULT_ACCOUNT_TYPE;
accountManager = AccountManager.get(LoginActivity.this);
inputMethodManager = (InputMethodManager) getSystemService(INPUT_METHOD_SERVICE);
@ -148,17 +147,20 @@ public class LoginActivity extends AssistantActivity {
init();
} else {
setMessage(R.string.auth_before_connect);
setSpoofButtonText(R.string.brand_spoof_button);
setBackButtonText(android.R.string.cancel);
setNextButtonText(R.string.auth_sign_in);
}
}
@Override
protected void onSpoofButtonClicked() {
super.onSpoofButtonClicked();
protected void onHuaweiButtonClicked() {
super.onHuaweiButtonClicked();
CheckinClient.brandSpoof = true;
state = 0;
onCreate(initialSavedInstanceState);
state++;
if (state == 1) {
init();
}
}
@Override
@ -279,7 +281,6 @@ public class LoginActivity extends AssistantActivity {
}
}
showError(R.string.auth_general_error_desc);
setSpoofButtonText(R.string.brand_spoof_button);
}
private void retrieveRtToken(String oAuthToken) {
@ -312,7 +313,6 @@ public class LoginActivity extends AssistantActivity {
Log.w(TAG, "Account NOT created!");
runOnUiThread(() -> {
showError(R.string.auth_general_error_desc);
setSpoofButtonText(R.string.brand_spoof_button);
setNextButtonText(android.R.string.ok);
});
state = -2;
@ -324,7 +324,6 @@ public class LoginActivity extends AssistantActivity {
Log.w(TAG, "onException", exception);
runOnUiThread(() -> {
showError(R.string.auth_general_error_desc);
setSpoofButtonText(R.string.brand_spoof_button);
setNextButtonText(android.R.string.ok);
});
state = -2;
@ -353,15 +352,14 @@ public class LoginActivity extends AssistantActivity {
if (!TextUtils.isEmpty(accountId))
accountManager.setUserData(account, "GoogleUserId", accountId);
checkin(true);
finish();
CheckinClient.brandSpoof = false;
finish();
}
@Override
public void onException(Exception exception) {
Log.w(TAG, "onException", exception);
runOnUiThread(() -> {
showError(R.string.auth_general_error_desc);
setSpoofButtonText(R.string.brand_spoof_button);
setNextButtonText(android.R.string.ok);
});
state = -2;

View File

@ -80,24 +80,23 @@ public class CheckinClient {
DeviceIdentifier deviceIdent, PhoneInfo phoneInfo,
LastCheckinInfo checkinInfo, Locale locale,
List<Account> accounts) {
Log.e("sono io sono io", ""+brandSpoof);
CheckinRequest.Builder builder = new CheckinRequest.Builder()
.accountCookie(new ArrayList<String>())
.androidId(checkinInfo.androidId)
.checkin(new CheckinRequest.Checkin.Builder()
.build(new CheckinRequest.Checkin.Build.Builder()
.bootloader(!brandSpoof ? build.bootloader : "c2f2-0.2-5799621")
.brand(!brandSpoof ? build.brand : "google")
.bootloader(brandSpoof ? "c2f2-0.2-5799621" : build.bootloader)
.brand(brandSpoof ? "google" : build.brand)
.clientId("android-google")
.device(!brandSpoof ? build.device : "generic")
.fingerprint(!brandSpoof ? build.fingerprint : "google/coral/coral:10/QD1A.190821.007/5831595:user/release-keys")
.hardware(!brandSpoof ? build.hardware : "coral")
.manufacturer(!brandSpoof ? build.manufacturer : "Google")
.model(!brandSpoof ? build.model : "mainline")
.device(brandSpoof ? "generic" : build.device)
.fingerprint(brandSpoof ? "google/coral/coral:10/QD1A.190821.007/5831595:user/release-keys" : build.fingerprint)
.hardware(brandSpoof ? "coral" : build.hardware)
.manufacturer(brandSpoof ? "Google" : build.manufacturer)
.model(brandSpoof ? "mainline" : build.model)
.otaInstalled(false) // TODO?
.product(!brandSpoof ? build.product : "coral")
.radio(!brandSpoof ? build.radio : "")
.sdkVersion(!brandSpoof ? build.sdk : 29)
.product(brandSpoof ? "coral" : build.product)
.radio(brandSpoof ? "" : build.radio)
.sdkVersion(brandSpoof ? 29 : build.sdk)
.time(build.time / 1000)
.build())
.cellOperator(phoneInfo.cellOperator)

View File

@ -16,7 +16,7 @@
<string name="sorry">Maaf…</string>
<string name="auth_before_connect">"Sebuah aplikasi di perangkat anda mencoba untuk masuk ke akun Google.
Jika ini disengaja, gunakan tombol <b>Masuk</b> untuk menghubungkan ke halaman masuk Google, jika tidak, tekan <b>Batalkan</b> untuk kembali ke aplikasi yang menyebabkan dialog ini muncul."</string>
Jika ini disengaja, gunakan tombol <b>Masuk</b> (atau <b>Huawei</b>, jika Anda memiliki perangkat dengan merek ini) untuk menghubungkan ke halaman masuk Google, jika tidak, tekan <b>Batalkan</b> untuk kembali ke aplikasi yang menyebabkan dialog ini muncul."</string>
<string name="auth_sign_in">Sign in</string>
<string name="auth_connecting">"Menyambungkan koneksi ke server Google untuk memasukkan anda.
@ -26,7 +26,7 @@ Ini bisa berlangsung beberapa detik."</string>
Ini mungkin hanya masalah sementara atau perangkat Android anda mungkin tidak disediakan untuk layanan data."</string>
<string name="auth_general_error_desc">"Ada masalah dengan menghubungkan ke server Google.
Coba lagi nanti atau coba login dengan mengklik tombol \'SPOOF\' di bawah ini (jika Anda memiliki perangkat Huawei)."</string>
Coba lagi nanti."</string>
<string name="auth_finalize">"Perangkat anda sedang menghubungkan ke Google untuk menyimpan informasi ke akun anda.
Ini bisa berlangsung beberapa menit."</string>

View File

@ -16,7 +16,7 @@
<string name="sorry">Ci scusiamo…</string>
<string name="auth_before_connect">"Un'app sul tuo dispositivo sta tentando di accedere a un account Google.
Se ciò è intenzionale, utilizza il pulsante <b>Accedi</b> per connetterti alla relativa pagina di accesso Google, in caso contrario, premi <b>Annulla</b> per tornare all\'applicazione che ha richiamato questa finestra di dialogo."</string>
Se ciò è intenzionale, utilizza il pulsante <b>Accedi</b> (o <b>Huawei</b>, se possiedi un dispositivo con questo marchio) per connetterti alla relativa pagina di accesso Google, in caso contrario, premi <b>Annulla</b> per tornare all\'applicazione che ha richiamato questa finestra di dialogo."</string>
<string name="auth_sign_in">Accedi</string>
<string name="auth_connecting">"Il tuo dispositivo sta stabilendo una connessione ai server di Google per eseguire l\'accesso.
@ -26,7 +26,7 @@ Questa operazione potrebbe richiedere alcuni secondi."</string>
Questo potrebbe essere un problema temporaneo o legato al mancato collegamento del tuo dispositivo Android ad un servizio dati. Riprova quando sarai connesso ad una rete mobile o connettiti ad una rete Wi-Fi."</string>
<string name="auth_general_error_desc">"Si è verificato un problema di comunicazione con i server di Google.
Riprova più tardi o prova ad accedere cliccando sul pulsante \'SPOOF\' in basso (se possiedi un dispositivo Huawei)."</string>
Riprova più tardi."</string>
<string name="auth_finalize">"Il tuo dispositivo sta tentando di contattare Google per salvare le informazioni sul tuo account.
Questo potrà richiedere un paio di minuti"</string>

View File

@ -30,7 +30,7 @@
<string name="sorry">Sorry…</string>
<string name="auth_before_connect">"An app on your device is trying to sign in to a Google account.
If this was intentional, use the <b>Sign in</b> button to connect to Googles sign-in page, if not, press <b>Cancel</b> to go back to the application that caused this dialog to show up."</string>
If this was intentional, use the <b>Sign in</b> (or <b>Huawei</b>, if you have a device with this brand) button to connect to Googles sign-in page, if not, press <b>Cancel</b> to go back to the application that caused this dialog to show up."</string>
<string name="auth_sign_in">Sign in</string>
<string name="auth_connecting">"Establishing a connection to Googles servers to sign you in.
@ -40,7 +40,7 @@ This can take a few seconds."</string>
This could be a temporary problem or your Android device may not be provisioned for data services. Try again when connected to a mobile network, or connect to a Wi-Fi network."</string>
<string name="auth_general_error_desc">"There was a problem communicating with Google servers.
Try again later or try to log in clicking on below \'SPOOF\' button (if you have a Huawei device)."</string>
Try again later."</string>
<string name="auth_finalize">"Your device is contacting Google to save information to your account.
This can take a couple of minutes."</string>