Fido: Add support for fido authentication during Google Account sign-in ff5c5a7e1b

This commit is contained in:
inotia00 2023-12-21 17:41:31 +09:00 • committed by Cuynu
commit 8e98efdf09
3 changed files with 60 additions and 6 deletions

View file

@ -261,7 +261,7 @@
<activity
android:name="org.microg.gms.auth.login.LoginActivity"
android:configChanges="keyboardHidden|orientation|screenSize"
android:configChanges="keyboardHidden|keyboard|orientation|screenSize"
android:exported="true"
android:process=":ui"
android:theme="@style/Theme.LoginBlue">

View file

@ -17,7 +17,6 @@
package org.microg.gms.auth.login;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.res.Configuration;
import android.os.Bundle;
import android.util.DisplayMetrics;
@ -26,10 +25,11 @@ import android.widget.Button;
import android.widget.TextView;
import androidx.annotation.StringRes;
import androidx.appcompat.app.AppCompatActivity;
import com.mgoogle.android.gms.R;
public abstract class AssistantActivity extends Activity {
public abstract class AssistantActivity extends AppCompatActivity {
private static final int TITLE_MIN_HEIGHT = 64;
private static final double TITLE_WIDTH_FACTOR = (8.0 / 18.0);

View file

@ -271,6 +271,10 @@ public class LoginActivity extends AssistantActivity {
webView.loadUrl(buildUrl(tmpl, Utils.getLocale(this)));
}
protected void runScript(String js) {
runOnUiThread(() -> webView.loadUrl("javascript:" + js));
}
private void closeWeb(boolean programmaticAuth) {
setMessage(R.string.auth_finalize);
runOnUiThread(() -> webView.setVisibility(INVISIBLE));
@ -406,12 +410,32 @@ public class LoginActivity extends AssistantActivity {
Log.d(TAG, "JSBridge: addAccount");
}
@JavascriptInterface
public final void attemptLogin(String accountName, String password) {
Log.d(TAG, "JSBridge: attemptLogin");
}
@JavascriptInterface
public void backupSyncOptIn(String accountName) {
Log.d(TAG, "JSBridge: backupSyncOptIn");
}
@JavascriptInterface
public void clearOldLoginAttempts() {
Log.d(TAG, "JSBridge: clearOldLoginAttempts");
}
@JavascriptInterface
public final void closeView() {
Log.d(TAG, "JSBridge: closeView");
closeWeb(false);
}
@JavascriptInterface
public void fetchIIDToken(String entity) {
Log.d(TAG, "JSBridge: fetchIIDToken");
}
@JavascriptInterface
public final String fetchVerifiedPhoneNumber() {
Log.d(TAG, "JSBridge: fetchVerifiedPhoneNumber");
@ -446,12 +470,17 @@ public class LoginActivity extends AssistantActivity {
@JavascriptInterface
public final int getAuthModuleVersionCode() {
return 1;
return GMS_VERSION_CODE;
}
@JavascriptInterface
public final int getBuildVersionSdk() {
return SDK_INT;
return Build.VERSION.SDK_INT;
}
@JavascriptInterface
public int getDeviceContactsCount() {
return -1;
}
@JavascriptInterface
@ -525,15 +554,40 @@ public class LoginActivity extends AssistantActivity {
}
@JavascriptInterface
public final void setAccountIdentifier(String accountIdentifier) {
public final void setAccountIdentifier(String accountName) {
Log.d(TAG, "JSBridge: setAccountIdentifier");
}
@JavascriptInterface
public void setAllActionsEnabled(boolean z) {
Log.d(TAG, "JSBridge: setAllActionsEnabled");
}
@JavascriptInterface
public final void setNewAccountCreated() {
Log.d(TAG, "JSBridge: setNewAccountCreated");
}
@JavascriptInterface
public void setPrimaryActionEnabled(boolean z) {
Log.d(TAG, "JSBridge: setPrimaryActionEnabled");
}
@JavascriptInterface
public void setPrimaryActionLabel(String str, int i) {
Log.d(TAG, "JSBridge: setPrimaryActionLabel: " + str);
}
@JavascriptInterface
public void setSecondaryActionEnabled(boolean z) {
Log.d(TAG, "JSBridge: setSecondaryActionEnabled");
}
@JavascriptInterface
public void setSecondaryActionLabel(String str, int i) {
Log.d(TAG, "JSBridge: setSecondaryActionLabel: " + str);
}
@JavascriptInterface
public final void showKeyboard() {
inputMethodManager.showSoftInput(webView, SHOW_IMPLICIT);