From c0f387de9a6069ba9076ca9cbf5b74ada3cfa586 Mon Sep 17 00:00:00 2001 From: Oizaro Date: Wed, 30 Sep 2020 14:33:21 +0200 Subject: [PATCH] Show spoof button from start --- .../gms/auth/login/AssistantActivity.java | 4 ++-- .../microg/gms/auth/login/LoginActivity.java | 20 ++++++++---------- .../org/microg/gms/checkin/CheckinClient.java | 21 +++++++++---------- .../src/main/res/values-in/strings.xml | 4 ++-- .../src/main/res/values-it/strings.xml | 4 ++-- .../src/main/res/values/strings.xml | 4 ++-- 6 files changed, 27 insertions(+), 30 deletions(-) diff --git a/play-services-core/src/main/java/org/microg/gms/auth/login/AssistantActivity.java b/play-services-core/src/main/java/org/microg/gms/auth/login/AssistantActivity.java index 7465d274..0c0d674c 100644 --- a/play-services-core/src/main/java/org/microg/gms/auth/login/AssistantActivity.java +++ b/play-services-core/src/main/java/org/microg/gms/auth/login/AssistantActivity.java @@ -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() { } diff --git a/play-services-core/src/main/java/org/microg/gms/auth/login/LoginActivity.java b/play-services-core/src/main/java/org/microg/gms/auth/login/LoginActivity.java index 00bf3a63..b366380c 100644 --- a/play-services-core/src/main/java/org/microg/gms/auth/login/LoginActivity.java +++ b/play-services-core/src/main/java/org/microg/gms/auth/login/LoginActivity.java @@ -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; diff --git a/play-services-core/src/main/java/org/microg/gms/checkin/CheckinClient.java b/play-services-core/src/main/java/org/microg/gms/checkin/CheckinClient.java index ddc6d099..49bf4d73 100755 --- a/play-services-core/src/main/java/org/microg/gms/checkin/CheckinClient.java +++ b/play-services-core/src/main/java/org/microg/gms/checkin/CheckinClient.java @@ -80,24 +80,23 @@ public class CheckinClient { DeviceIdentifier deviceIdent, PhoneInfo phoneInfo, LastCheckinInfo checkinInfo, Locale locale, List accounts) { - Log.e("sono io sono io", ""+brandSpoof); CheckinRequest.Builder builder = new CheckinRequest.Builder() .accountCookie(new ArrayList()) .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) diff --git a/play-services-core/src/main/res/values-in/strings.xml b/play-services-core/src/main/res/values-in/strings.xml index 5492bbc1..5f8f5a67 100644 --- a/play-services-core/src/main/res/values-in/strings.xml +++ b/play-services-core/src/main/res/values-in/strings.xml @@ -16,7 +16,7 @@ Maaf… "Sebuah aplikasi di perangkat anda mencoba untuk masuk ke akun Google. -Jika ini disengaja, gunakan tombol Masuk untuk menghubungkan ke halaman masuk Google, jika tidak, tekan Batalkan untuk kembali ke aplikasi yang menyebabkan dialog ini muncul." +Jika ini disengaja, gunakan tombol Masuk (atau Huawei, jika Anda memiliki perangkat dengan merek ini) untuk menghubungkan ke halaman masuk Google, jika tidak, tekan Batalkan untuk kembali ke aplikasi yang menyebabkan dialog ini muncul." Sign in "Menyambungkan koneksi ke server Google untuk memasukkan anda. @@ -26,7 +26,7 @@ Ini bisa berlangsung beberapa detik." Ini mungkin hanya masalah sementara atau perangkat Android anda mungkin tidak disediakan untuk layanan data." "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)." +Coba lagi nanti." "Perangkat anda sedang menghubungkan ke Google untuk menyimpan informasi ke akun anda. Ini bisa berlangsung beberapa menit." diff --git a/play-services-core/src/main/res/values-it/strings.xml b/play-services-core/src/main/res/values-it/strings.xml index 08ac5cf4..eae7c87f 100755 --- a/play-services-core/src/main/res/values-it/strings.xml +++ b/play-services-core/src/main/res/values-it/strings.xml @@ -16,7 +16,7 @@ Ci scusiamo… "Un'app sul tuo dispositivo sta tentando di accedere a un account Google. -Se ciò è intenzionale, utilizza il pulsante Accedi per connetterti alla relativa pagina di accesso Google, in caso contrario, premi Annulla per tornare all\'applicazione che ha richiamato questa finestra di dialogo." +Se ciò è intenzionale, utilizza il pulsante Accedi (o Huawei, se possiedi un dispositivo con questo marchio) per connetterti alla relativa pagina di accesso Google, in caso contrario, premi Annulla per tornare all\'applicazione che ha richiamato questa finestra di dialogo." Accedi "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." 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." "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)." +Riprova più tardi." "Il tuo dispositivo sta tentando di contattare Google per salvare le informazioni sul tuo account. Questo potrà richiedere un paio di minuti" diff --git a/play-services-core/src/main/res/values/strings.xml b/play-services-core/src/main/res/values/strings.xml index 1165db51..1f3585dd 100755 --- a/play-services-core/src/main/res/values/strings.xml +++ b/play-services-core/src/main/res/values/strings.xml @@ -30,7 +30,7 @@ Sorry… "An app on your device is trying to sign in to a Google account. -If this was intentional, use the Sign in button to connect to Google’s sign-in page, if not, press Cancel to go back to the application that caused this dialog to show up." +If this was intentional, use the Sign in (or Huawei, if you have a device with this brand) button to connect to Google’s sign-in page, if not, press Cancel to go back to the application that caused this dialog to show up." Sign in "Establishing a connection to Google’s servers to sign you in. @@ -40,7 +40,7 @@ This can take a few seconds." 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." "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)." +Try again later." "Your device is contacting Google to save information to your account. This can take a couple of minutes."