• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2016 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 
17 package android.platform.helpers;
18 
19 import androidx.annotation.Nullable;
20 import android.support.test.uiautomator.Direction;
21 
22 /**
23  * An interface for interacting with any launcher.
24  * TODO(b/77278231): Add default methods for quickstep.
25  */
26 public interface ILauncherHelper extends IAppHelper {
27     /**
28      * Swipes the home page in the specified direction.
29      *
30      * @param dir the {@link Direction} to swipe the home page
31      * @return true if swiping was possible, false otherwise
32      * @throws IllegalArgumentException if the direction is UP or DOWN
33      */
swipeHome(Direction dir)34     public boolean swipeHome(Direction dir);
35 
36     /**
37      * Opens the all apps container from the launcher home.
38      */
openAllApps()39     public void openAllApps();
40 
41     /**
42      * Scrolls the all apps container in the specified direction.
43      *
44      * @param dir the {@link Direction} to swipe the container
45      * @return true if scrolling was possible, false otherwise
46      * @throws IllegalArgumentException if all apps cannot be scrolled that direction
47      * @throws IllegalStateException if all apps is not already open
48      */
scrollAllApps(Direction dir)49     public boolean scrollAllApps(Direction dir);
50 
51     /**
52      * Launches an application to the foreground.
53      *
54      * @param name the visible app name in the launcher
55      * @param pkg if specified, the expected app package after launch
56      */
launchApp(String name, @Nullable String pkg)57     public void launchApp(String name, @Nullable String pkg);
58 
59     /**
60      * Opens the quickstep view from any screen.
61      */
openQuickstep()62     public void openQuickstep();
63 
64     /**
65      * Scrolls the quickstep view in the specified direction.
66      *
67      * @param dir the {@link Direction} to swipe the view.
68      * @return true if scrolling was possible, false otherwise
69      * @throws IllegalArgumentException if the direction is UP or DOWN
70      * @throws IllegalStateException if quickstep is not already open
71      */
scrollQuickstep(Direction dir)72     public void scrollQuickstep(Direction dir);
73 
74     /**
75      * Selects a specific app from the quickstep view.
76      *
77      * @param app the app name to reopen, based on ...
78      * @return true if the app was found, false otherwise
79      * @throws IllegalStateException if quickstep is not already open
80      */
selectQuickstepApp(String app)81     public boolean selectQuickstepApp(String app);
82 }
83