QaFormActivity.java

1.5 KB · raw

1package com.peachpasswords.qa;23import android.app.Activity;4import android.os.Bundle;5import android.text.InputType;6import android.view.View;7import android.widget.EditText;8import android.widget.LinearLayout;910/**11 * Minimal native login form for emulator autofill QA. Java on purpose: the12 * androidTest APK ships without the Kotlin runtime, so a standalone13 * `am start` launch of this activity must not need it. Lives in the test14 * package: a different package from the Peach autofill service, so the15 * framework will happily send fill requests for it.16 */17public class QaFormActivity extends Activity {18    @Override19    protected void onCreate(Bundle savedInstanceState) {20        super.onCreate(savedInstanceState);21        EditText username = new EditText(this);22        username.setId(android.R.id.edit);23        username.setHint("Username");24        username.setAutofillHints("username");25        username.setImportantForAutofill(View.IMPORTANT_FOR_AUTOFILL_YES);2627        EditText password = new EditText(this);28        password.setHint("Password");29        password.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD);30        password.setAutofillHints("password");31        password.setImportantForAutofill(View.IMPORTANT_FOR_AUTOFILL_YES);3233        LinearLayout layout = new LinearLayout(this);34        layout.setOrientation(LinearLayout.VERTICAL);35        layout.setPadding(48, 96, 48, 0);36        layout.addView(username);37        layout.addView(password);38        setContentView(layout);39    }40}