Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4a792c9b authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Attempt to fix LaunchAppShowImeOnStartTest" into tm-dev am: 0a6445f4

parents 665b66ed 0a6445f4
Loading
Loading
Loading
Loading
+34 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2022 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.android.server.wm.flicker.helpers

import android.app.Instrumentation
import android.support.test.launcherhelper.ILauncherStrategy
import android.support.test.launcherhelper.LauncherStrategyFactory
import com.android.server.wm.flicker.testapp.ActivityOptions
import com.android.server.wm.traces.common.FlickerComponentName
import com.android.server.wm.traces.parser.toFlickerComponent

class ImeStateInitializeHelper @JvmOverloads constructor(
    instr: Instrumentation,
    launcherName: String = ActivityOptions.IME_ACTIVITY_INITIALIZE_LAUNCHER_NAME,
    component: FlickerComponentName =
        ActivityOptions.IME_ACTIVITY_INITIALIZE_COMPONENT_NAME.toFlickerComponent(),
    launcherStrategy: ILauncherStrategy = LauncherStrategyFactory
            .getInstance(instr)
            .launcherStrategy
) : StandardAppHelper(instr, launcherName, component, launcherStrategy)
 No newline at end of file
+4 −0
Original line number Diff line number Diff line
@@ -28,6 +28,7 @@ import com.android.server.wm.flicker.FlickerTestParameter
import com.android.server.wm.flicker.FlickerTestParameterFactory
import com.android.server.wm.flicker.dsl.FlickerBuilder
import com.android.server.wm.flicker.helpers.ImeAppAutoFocusHelper
import com.android.server.wm.flicker.helpers.ImeStateInitializeHelper
import com.android.server.wm.flicker.helpers.setRotation
import com.android.server.wm.traces.common.FlickerComponentName
import org.junit.FixMethodOrder
@@ -71,17 +72,20 @@ import org.junit.runners.Parameterized
class LaunchAppShowImeOnStartTest(private val testSpec: FlickerTestParameter) {
    private val instrumentation: Instrumentation = InstrumentationRegistry.getInstrumentation()
    private val testApp = ImeAppAutoFocusHelper(instrumentation, testSpec.startRotation)
    private val initializeApp = ImeStateInitializeHelper(instrumentation)

    @FlickerBuilderProvider
    fun buildFlicker(): FlickerBuilder {
        return FlickerBuilder(instrumentation).apply {
            setup {
                eachRun {
                    initializeApp.launchViaIntent()
                    this.setRotation(testSpec.startRotation)
                }
            }
            teardown {
                eachRun {
                    initializeApp.exit()
                    testApp.exit()
                }
            }
+10 −0
Original line number Diff line number Diff line
@@ -52,6 +52,16 @@
                <category android:name="android.intent.category.LAUNCHER"/>
            </intent-filter>
        </activity>
        <activity android:name=".ImeStateInitializeActivity"
                  android:theme="@style/no_starting_window"
                  android:windowSoftInputMode="stateAlwaysHidden"
                  android:label="ImeStateInitializeActivity"
                  android:exported="true">
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>
                <category android:name="android.intent.category.LAUNCHER"/>
            </intent-filter>
        </activity>
        <activity android:name=".SeamlessRotationActivity"
             android:taskAffinity="com.android.server.wm.flicker.testapp.SeamlessRotationActivity"
             android:theme="@style/CutoutShortEdges"
+4 −0
Original line number Diff line number Diff line
@@ -42,4 +42,8 @@
        <item name="android:backgroundDimEnabled">false</item>
        <item name="android:windowSoftInputMode">stateUnchanged</item>
    </style>

    <style name="no_starting_window" parent="@android:style/Theme.DeviceDefault">
        <item name="android:windowDisablePreview">true</item>
    </style>
</resources>
+5 −0
Original line number Diff line number Diff line
@@ -37,6 +37,11 @@ public class ActivityOptions {
            new ComponentName(FLICKER_APP_PACKAGE,
                    FLICKER_APP_PACKAGE + ".ImeActivity");

    public static final String IME_ACTIVITY_INITIALIZE_LAUNCHER_NAME = "ImeStateInitializeActivity";
    public static final ComponentName IME_ACTIVITY_INITIALIZE_COMPONENT_NAME =
            new ComponentName(FLICKER_APP_PACKAGE,
                    FLICKER_APP_PACKAGE + ".ImeStateInitializeActivity");

    public static final String SIMPLE_ACTIVITY_LAUNCHER_NAME = "SimpleApp";
    public static final ComponentName SIMPLE_ACTIVITY_AUTO_FOCUS_COMPONENT_NAME =
            new ComponentName(FLICKER_APP_PACKAGE,
Loading