1 /* 2 * Copyright (C) 2022 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 18 import androidx.annotation.NonNull; 19 import androidx.test.uiautomator.UiObject2; 20 21 import com.android.launcher3.testing.shared.TestProtocol; 22 23 /** 24 * Operations on AllApps opened from the Taskbar. 25 */ 26 public class AllAppsFromTaskbar extends AllApps { 27 AllAppsFromTaskbar(LauncherInstrumentation launcher)28 AllAppsFromTaskbar(LauncherInstrumentation launcher) { 29 super(launcher); 30 } 31 32 @Override getContainerType()33 protected LauncherInstrumentation.ContainerType getContainerType() { 34 return LauncherInstrumentation.ContainerType.TASKBAR_ALL_APPS; 35 } 36 37 @NonNull 38 @Override getAppIcon(String appName)39 public TaskbarAppIcon getAppIcon(String appName) { 40 return (TaskbarAppIcon) super.getAppIcon(appName); 41 } 42 43 @NonNull 44 @Override createAppIcon(UiObject2 icon)45 protected TaskbarAppIcon createAppIcon(UiObject2 icon) { 46 return new TaskbarAppIcon(mLauncher, icon); 47 } 48 49 @Override hasSearchBox()50 protected boolean hasSearchBox() { 51 return false; 52 } 53 54 @Override getAppsListRecyclerTopPadding()55 protected int getAppsListRecyclerTopPadding() { 56 return mLauncher.getTestInfo(TestProtocol.REQUEST_TASKBAR_ALL_APPS_TOP_PADDING) 57 .getInt(TestProtocol.TEST_INFO_RESPONSE_FIELD); 58 } 59 60 @Override getAllAppsScroll()61 protected int getAllAppsScroll() { 62 return mLauncher.getTestInfo(TestProtocol.REQUEST_TASKBAR_APPS_LIST_SCROLL_Y) 63 .getInt(TestProtocol.TEST_INFO_RESPONSE_FIELD); 64 } 65 66 @NonNull 67 @Override getQsb()68 public TaskbarAllAppsQsb getQsb() { 69 return new TaskbarAllAppsQsb(mLauncher, verifyActiveContainer()); 70 } 71 } 72