• 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 package android.support.test.launcherhelper;
17 
18 import android.support.test.uiautomator.By;
19 import android.support.test.uiautomator.BySelector;
20 import android.support.test.uiautomator.UiObject2;
21 
22 public class Launcher3Strategy extends BaseLauncher3Strategy {
23 
24     private static final String LAUNCHER_PKG = "com.android.launcher3";
25 
26     /**
27      * {@inheritDoc}
28      */
29     @Override
getSupportedLauncherPackage()30     public String getSupportedLauncherPackage() {
31         return LAUNCHER_PKG;
32     }
33 
34     /**
35      * {@inheritDoc}
36      */
37     @Override
dismissHomeScreenCling()38     protected void dismissHomeScreenCling() {
39         super.dismissHomeScreenCling();
40         // dismiss first run cling
41         UiObject2 gotItButton = mDevice.findObject(
42                 By.res(getSupportedLauncherPackage(), "cling_dismiss_longpress_info"));
43         if (gotItButton != null) {
44             gotItButton.click();
45         }
46     }
47 
48     /**
49      * {@inheritDoc}
50      */
51     @Override
getAllAppsButtonSelector()52     public BySelector getAllAppsButtonSelector() {
53         return By.res(getSupportedLauncherPackage(), "all_apps_handle");
54     }
55 }
56