0
0
Fork 0
mirror of https://github.com/YTVanced/VancedMicroG synced 2024-11-30 15:13:02 +00:00

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

View file

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

View file

@ -16,7 +16,7 @@
<string name="sorry">Maaf…</string> <string name="sorry">Maaf…</string>
<string name="auth_before_connect">"Sebuah aplikasi di perangkat anda mencoba untuk masuk ke akun Google. <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_sign_in">Sign in</string>
<string name="auth_connecting">"Menyambungkan koneksi ke server Google untuk memasukkan anda. <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> 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. <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. <string name="auth_finalize">"Perangkat anda sedang menghubungkan ke Google untuk menyimpan informasi ke akun anda.
Ini bisa berlangsung beberapa menit."</string> Ini bisa berlangsung beberapa menit."</string>

View file

@ -16,7 +16,7 @@
<string name="sorry">Ci scusiamo…</string> <string name="sorry">Ci scusiamo…</string>
<string name="auth_before_connect">"Un'app sul tuo dispositivo sta tentando di accedere a un account Google. <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_sign_in">Accedi</string>
<string name="auth_connecting">"Il tuo dispositivo sta stabilendo una connessione ai server di Google per eseguire l\'accesso. <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> 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. <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. <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> Questo potrà richiedere un paio di minuti"</string>

View file

@ -30,7 +30,7 @@
<string name="sorry">Sorry…</string> <string name="sorry">Sorry…</string>
<string name="auth_before_connect">"An app on your device is trying to sign in to a Google account. <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_sign_in">Sign in</string>
<string name="auth_connecting">"Establishing a connection to Googles servers to sign you in. <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> 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. <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. <string name="auth_finalize">"Your device is contacting Google to save information to your account.
This can take a couple of minutes."</string> This can take a couple of minutes."</string>