Merge "Attempt to fix LaunchAppShowImeOnStartTest" into tm-dev am: 0a6445f43b
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/18157813 Change-Id: I102163dd120f674bf7196532c0eeb282fd043774 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -0,0 +1,34 @@
|
|||||||
|
/*
|
||||||
|
* 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)
|
||||||
@@ -28,6 +28,7 @@ import com.android.server.wm.flicker.FlickerTestParameter
|
|||||||
import com.android.server.wm.flicker.FlickerTestParameterFactory
|
import com.android.server.wm.flicker.FlickerTestParameterFactory
|
||||||
import com.android.server.wm.flicker.dsl.FlickerBuilder
|
import com.android.server.wm.flicker.dsl.FlickerBuilder
|
||||||
import com.android.server.wm.flicker.helpers.ImeAppAutoFocusHelper
|
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.flicker.helpers.setRotation
|
||||||
import com.android.server.wm.traces.common.FlickerComponentName
|
import com.android.server.wm.traces.common.FlickerComponentName
|
||||||
import org.junit.FixMethodOrder
|
import org.junit.FixMethodOrder
|
||||||
@@ -71,17 +72,20 @@ import org.junit.runners.Parameterized
|
|||||||
class LaunchAppShowImeOnStartTest(private val testSpec: FlickerTestParameter) {
|
class LaunchAppShowImeOnStartTest(private val testSpec: FlickerTestParameter) {
|
||||||
private val instrumentation: Instrumentation = InstrumentationRegistry.getInstrumentation()
|
private val instrumentation: Instrumentation = InstrumentationRegistry.getInstrumentation()
|
||||||
private val testApp = ImeAppAutoFocusHelper(instrumentation, testSpec.startRotation)
|
private val testApp = ImeAppAutoFocusHelper(instrumentation, testSpec.startRotation)
|
||||||
|
private val initializeApp = ImeStateInitializeHelper(instrumentation)
|
||||||
|
|
||||||
@FlickerBuilderProvider
|
@FlickerBuilderProvider
|
||||||
fun buildFlicker(): FlickerBuilder {
|
fun buildFlicker(): FlickerBuilder {
|
||||||
return FlickerBuilder(instrumentation).apply {
|
return FlickerBuilder(instrumentation).apply {
|
||||||
setup {
|
setup {
|
||||||
eachRun {
|
eachRun {
|
||||||
|
initializeApp.launchViaIntent()
|
||||||
this.setRotation(testSpec.startRotation)
|
this.setRotation(testSpec.startRotation)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
teardown {
|
teardown {
|
||||||
eachRun {
|
eachRun {
|
||||||
|
initializeApp.exit()
|
||||||
testApp.exit()
|
testApp.exit()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -52,6 +52,16 @@
|
|||||||
<category android:name="android.intent.category.LAUNCHER"/>
|
<category android:name="android.intent.category.LAUNCHER"/>
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</activity>
|
</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"
|
<activity android:name=".SeamlessRotationActivity"
|
||||||
android:taskAffinity="com.android.server.wm.flicker.testapp.SeamlessRotationActivity"
|
android:taskAffinity="com.android.server.wm.flicker.testapp.SeamlessRotationActivity"
|
||||||
android:theme="@style/CutoutShortEdges"
|
android:theme="@style/CutoutShortEdges"
|
||||||
|
|||||||
@@ -42,4 +42,8 @@
|
|||||||
<item name="android:backgroundDimEnabled">false</item>
|
<item name="android:backgroundDimEnabled">false</item>
|
||||||
<item name="android:windowSoftInputMode">stateUnchanged</item>
|
<item name="android:windowSoftInputMode">stateUnchanged</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
<style name="no_starting_window" parent="@android:style/Theme.DeviceDefault">
|
||||||
|
<item name="android:windowDisablePreview">true</item>
|
||||||
|
</style>
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
@@ -37,6 +37,11 @@ public class ActivityOptions {
|
|||||||
new ComponentName(FLICKER_APP_PACKAGE,
|
new ComponentName(FLICKER_APP_PACKAGE,
|
||||||
FLICKER_APP_PACKAGE + ".ImeActivity");
|
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 String SIMPLE_ACTIVITY_LAUNCHER_NAME = "SimpleApp";
|
||||||
public static final ComponentName SIMPLE_ACTIVITY_AUTO_FOCUS_COMPONENT_NAME =
|
public static final ComponentName SIMPLE_ACTIVITY_AUTO_FOCUS_COMPONENT_NAME =
|
||||||
new ComponentName(FLICKER_APP_PACKAGE,
|
new ComponentName(FLICKER_APP_PACKAGE,
|
||||||
|
|||||||
@@ -0,0 +1,50 @@
|
|||||||
|
/*
|
||||||
|
* 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.testapp;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.graphics.Color;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A nop {@link Activity} to make sure that the test starts from a deterministic state.
|
||||||
|
*
|
||||||
|
* <p>Currently this {@link Activity} makes sure the following things</p>
|
||||||
|
* <li>
|
||||||
|
* <ul>Hide the software keyboard with
|
||||||
|
* {@link android.view.WindowManager.LayoutParams#SOFT_INPUT_STATE_ALWAYS_HIDDEN}</ul>
|
||||||
|
* <ul>Make sure that the navigation bar (if supported) is rendered with {@link Color#BLACK}.
|
||||||
|
* </ul>
|
||||||
|
* </li>
|
||||||
|
*/
|
||||||
|
public class ImeStateInitializeActivity extends Activity {
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle bundle) {
|
||||||
|
super.onCreate(bundle);
|
||||||
|
final View view = new View(this);
|
||||||
|
view.setBackgroundColor(Color.WHITE);
|
||||||
|
view.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
|
||||||
|
ViewGroup.LayoutParams.MATCH_PARENT));
|
||||||
|
|
||||||
|
// Make sure that navigation bar is rendered with black (if supported).
|
||||||
|
getWindow().setNavigationBarColor(Color.BLACK);
|
||||||
|
|
||||||
|
setContentView(view);
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user