Overview.java 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. /*
  2. * Copyright (C) 2018 The Android Open Source Project
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. package com.android.launcher3.tapl;
  17. import static com.android.launcher3.testing.TestProtocol.ALL_APPS_STATE_ORDINAL;
  18. import androidx.annotation.NonNull;
  19. import com.android.launcher3.tapl.LauncherInstrumentation.ContainerType;
  20. import com.android.launcher3.testing.TestProtocol;
  21. /**
  22. * Overview pane.
  23. */
  24. public final class Overview extends BaseOverview {
  25. Overview(LauncherInstrumentation launcher) {
  26. super(launcher);
  27. verifyActiveContainer();
  28. }
  29. @Override
  30. protected ContainerType getContainerType() {
  31. return LauncherInstrumentation.ContainerType.OVERVIEW;
  32. }
  33. /**
  34. * Swipes up to All Apps.
  35. *
  36. * @return the App Apps object.
  37. */
  38. @NonNull
  39. public AllAppsFromOverview switchToAllApps() {
  40. try (LauncherInstrumentation.Closable e = mLauncher.eventsCheck();
  41. LauncherInstrumentation.Closable c = mLauncher.addContextLayer(
  42. "want to switch from overview to all apps")) {
  43. verifyActiveContainer();
  44. // Swipe from an app icon to the top.
  45. LauncherInstrumentation.log("Overview.switchToAllApps before swipe");
  46. mLauncher.swipeToState(
  47. mLauncher.getDevice().getDisplayWidth() / 2,
  48. mLauncher.getTestInfo(
  49. TestProtocol.REQUEST_HOTSEAT_TOP).
  50. getInt(TestProtocol.TEST_INFO_RESPONSE_FIELD),
  51. mLauncher.getDevice().getDisplayWidth() / 2,
  52. 0,
  53. 12,
  54. ALL_APPS_STATE_ORDINAL,
  55. LauncherInstrumentation.GestureScope.INSIDE);
  56. try (LauncherInstrumentation.Closable c1 = mLauncher.addContextLayer(
  57. "swiped all way up from overview")) {
  58. return new AllAppsFromOverview(mLauncher);
  59. }
  60. }
  61. }
  62. @Override
  63. public void dismissAllTasks() {
  64. super.dismissAllTasks();
  65. try (LauncherInstrumentation.Closable c1 = mLauncher.addContextLayer(
  66. "dismissed all tasks")) {
  67. new Workspace(mLauncher);
  68. }
  69. }
  70. }