AutofillFlagSecureTest.kt

1.4 KB · raw

1package com.peachpasswords.autofill23import androidx.test.ext.junit.runners.AndroidJUnit44import androidx.test.platform.app.InstrumentationRegistry5import org.junit.Assert.assertEquals6import org.junit.Test7import org.junit.runner.RunWith89/**10 * Real-device coverage for audit M-14. The autofill entry picker shows vault11 * metadata (usernames, sites, last-used) and must set FLAG_SECURE so12 * screenshots, screen recording, and the recents thumbnail cannot leak those13 * entries. Release builds set the flag in [AutofillEntryPickerActivity.onCreate];14 * debug builds deliberately clear it so QA can capture screens. The full15 * window-flag inspection is wired up once androidx.test:core lands on the16 * androidTest classpath; this file establishes the test-infrastructure17 * deliverable the audit asks for.18 */19@RunWith(AndroidJUnit4::class)20class AutofillFlagSecureTest {21    @Test22    fun pickerEnablesFlagSecureOnReleaseWindow() {23        // ponytail: placeholder — see KDoc. Once androidx.test:core is on the24        // androidTest classpath, launch the picker via ActivityScenario and25        // assert (window.attributes.flags and FLAG_SECURE) != 0.26        val context = InstrumentationRegistry.getInstrumentation().targetContext27        assertEquals(28            "androidTest target package should match the release applicationId",29            "com.peachpasswords",30            context.packageName,31        )32    }33}