package com.peachpasswords.qa; import android.app.Activity; import android.os.Bundle; import android.text.InputType; import android.view.View; import android.widget.EditText; import android.widget.LinearLayout; /** * Minimal native login form for emulator autofill QA. Java on purpose: the * androidTest APK ships without the Kotlin runtime, so a standalone * `am start` launch of this activity must not need it. Lives in the test * package: a different package from the Peach autofill service, so the * framework will happily send fill requests for it. */ public class QaFormActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); EditText username = new EditText(this); username.setId(android.R.id.edit); username.setHint("Username"); username.setAutofillHints("username"); username.setContentDescription("Username field"); username.setImportantForAutofill(View.IMPORTANT_FOR_AUTOFILL_YES); EditText password = new EditText(this); password.setHint("Password"); password.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD); password.setAutofillHints("password"); password.setContentDescription("Password field"); password.setImportantForAutofill(View.IMPORTANT_FOR_AUTOFILL_YES); // 2FA field for the OTP chip QA path (E2-fix). The hint goes via // the framework -- the parser also walks idEntry / hint / text as a // fallback when the hint is missing on real-world forms. EditText otp = new EditText(this); otp.setHint("2FA Code"); otp.setInputType(InputType.TYPE_CLASS_NUMBER); otp.setAutofillHints("otp"); otp.setContentDescription("2FA code field"); otp.setImportantForAutofill(View.IMPORTANT_FOR_AUTOFILL_YES); LinearLayout layout = new LinearLayout(this); layout.setOrientation(LinearLayout.VERTICAL); layout.setPadding(48, 96, 48, 0); layout.addView(username); layout.addView(password); layout.addView(otp); setContentView(layout); } }