Loading quickstep/tests/src/com/android/quickstep/TaplTestsQuickstep.java +22 −0 Original line number Diff line number Diff line Loading @@ -309,6 +309,28 @@ public class TaplTestsQuickstep extends AbstractQuickStepTest { launchedAppState.switchToOverview(); } @Test @ScreenRecord // b/242163205 public void testQuickSwitchToPreviousAppForTablet() throws Exception { assumeTrue(mLauncher.isTablet()); startTestActivity(2); startImeTestActivity(); // Set ignoreTaskbarVisibility to true to verify the task bar visibility explicitly. mLauncher.setIgnoreTaskbarVisibility(true); // Expect task bar invisible when the launched app was the IME activity. LaunchedAppState launchedAppState = getAndAssertLaunchedApp(); launchedAppState.assertTaskbarHidden(); // Quick-switch to the test app with swiping to right. launchedAppState.quickSwitchToPreviousApp(); // Expect task bar visible when the launched app was the test activity. launchedAppState = getAndAssertLaunchedApp(); launchedAppState.assertTaskbarVisible(); } private boolean isTestActivityRunning(int activityNumber) { return mDevice.wait(Until.hasObject(By.pkg(getAppPackageName()) .text("TestActivity" + activityNumber)), Loading tests/Android.bp +1 −0 Original line number Diff line number Diff line Loading @@ -60,6 +60,7 @@ filegroup { "src/com/android/launcher3/testcomponent/CustomShortcutConfigActivity.java", "src/com/android/launcher3/testcomponent/TestCommandReceiver.java", "src/com/android/launcher3/testcomponent/TestLauncherActivity.java", "src/com/android/launcher3/testcomponent/ImeTestActivity.java", ], } Loading tests/AndroidManifest-common.xml +10 −0 Original line number Diff line number Diff line Loading @@ -277,6 +277,16 @@ </intent-filter> </activity-alias> <activity android:name="com.android.launcher3.testcomponent.ImeTestActivity" android:label="ImeTestActivity" android:icon="@drawable/test_theme_icon" android:exported="true"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <!-- [b/197780098] Disable eager initialization of Jetpack libraries. --> <provider android:name="androidx.startup.InitializationProvider" Loading tests/src/com/android/launcher3/testcomponent/BaseTestingActivity.java +16 −0 Original line number Diff line number Diff line Loading @@ -24,7 +24,9 @@ import android.graphics.Color; import android.os.Bundle; import android.util.TypedValue; import android.view.View; import android.view.WindowInsets; import android.widget.Button; import android.widget.EditText; import android.widget.LinearLayout; import android.widget.LinearLayout.LayoutParams; Loading Loading @@ -81,6 +83,20 @@ public class BaseTestingActivity extends Activity implements View.OnClickListene mView.addView(button, lp); } protected void addEditor(String initText, String hint, boolean requestIme) { EditText editText = new EditText(this); editText.setHint(hint); editText.setText(initText); LayoutParams lp = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); lp.bottomMargin = mMargin; mView.addView(editText, lp); if (requestIme) { editText.requestFocus(); mView.getWindowInsetsController().show(WindowInsets.Type.ime()); } } @Override protected void onResume() { super.onResume(); Loading tests/src/com/android/launcher3/testcomponent/ImeTestActivity.java 0 → 100644 +27 −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.launcher3.testcomponent; import android.os.Bundle; public class ImeTestActivity extends OtherBaseTestingActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Requests to focus an editor and show IME for test. addEditor("Focused editor for test", "Focused editor for test", true); } } Loading
quickstep/tests/src/com/android/quickstep/TaplTestsQuickstep.java +22 −0 Original line number Diff line number Diff line Loading @@ -309,6 +309,28 @@ public class TaplTestsQuickstep extends AbstractQuickStepTest { launchedAppState.switchToOverview(); } @Test @ScreenRecord // b/242163205 public void testQuickSwitchToPreviousAppForTablet() throws Exception { assumeTrue(mLauncher.isTablet()); startTestActivity(2); startImeTestActivity(); // Set ignoreTaskbarVisibility to true to verify the task bar visibility explicitly. mLauncher.setIgnoreTaskbarVisibility(true); // Expect task bar invisible when the launched app was the IME activity. LaunchedAppState launchedAppState = getAndAssertLaunchedApp(); launchedAppState.assertTaskbarHidden(); // Quick-switch to the test app with swiping to right. launchedAppState.quickSwitchToPreviousApp(); // Expect task bar visible when the launched app was the test activity. launchedAppState = getAndAssertLaunchedApp(); launchedAppState.assertTaskbarVisible(); } private boolean isTestActivityRunning(int activityNumber) { return mDevice.wait(Until.hasObject(By.pkg(getAppPackageName()) .text("TestActivity" + activityNumber)), Loading
tests/Android.bp +1 −0 Original line number Diff line number Diff line Loading @@ -60,6 +60,7 @@ filegroup { "src/com/android/launcher3/testcomponent/CustomShortcutConfigActivity.java", "src/com/android/launcher3/testcomponent/TestCommandReceiver.java", "src/com/android/launcher3/testcomponent/TestLauncherActivity.java", "src/com/android/launcher3/testcomponent/ImeTestActivity.java", ], } Loading
tests/AndroidManifest-common.xml +10 −0 Original line number Diff line number Diff line Loading @@ -277,6 +277,16 @@ </intent-filter> </activity-alias> <activity android:name="com.android.launcher3.testcomponent.ImeTestActivity" android:label="ImeTestActivity" android:icon="@drawable/test_theme_icon" android:exported="true"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <!-- [b/197780098] Disable eager initialization of Jetpack libraries. --> <provider android:name="androidx.startup.InitializationProvider" Loading
tests/src/com/android/launcher3/testcomponent/BaseTestingActivity.java +16 −0 Original line number Diff line number Diff line Loading @@ -24,7 +24,9 @@ import android.graphics.Color; import android.os.Bundle; import android.util.TypedValue; import android.view.View; import android.view.WindowInsets; import android.widget.Button; import android.widget.EditText; import android.widget.LinearLayout; import android.widget.LinearLayout.LayoutParams; Loading Loading @@ -81,6 +83,20 @@ public class BaseTestingActivity extends Activity implements View.OnClickListene mView.addView(button, lp); } protected void addEditor(String initText, String hint, boolean requestIme) { EditText editText = new EditText(this); editText.setHint(hint); editText.setText(initText); LayoutParams lp = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); lp.bottomMargin = mMargin; mView.addView(editText, lp); if (requestIme) { editText.requestFocus(); mView.getWindowInsetsController().show(WindowInsets.Type.ime()); } } @Override protected void onResume() { super.onResume(); Loading
tests/src/com/android/launcher3/testcomponent/ImeTestActivity.java 0 → 100644 +27 −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.launcher3.testcomponent; import android.os.Bundle; public class ImeTestActivity extends OtherBaseTestingActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Requests to focus an editor and show IME for test. addEditor("Focused editor for test", "Focused editor for test", true); } }