Home | History | Annotate | Download | only in launcherhelper
      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.support.test.launcherhelper;
     18 
     19 import android.app.Instrumentation;
     20 import android.support.test.uiautomator.BySelector;
     21 import android.support.test.uiautomator.UiDevice;
     22 import android.support.test.uiautomator.UiObject2;
     23 
     24 /**
     25  * Defines the common use cases that any types of TV launcher UI automation helper should fulfill.
     26  * <p>Class will be instantiated by {@link LauncherStrategyFactory} based on current launcher
     27  * package, and a {@link UiDevice} instance will be provided via {@link #setUiDevice(UiDevice)}
     28  * method.
     29  */
     30 public interface ILeanbackLauncherStrategy extends ILauncherStrategy {
     31 
     32     /**
     33      * Sets an instance of instrumentation
     34      */
     35     public void setInstrumentation(Instrumentation instrumentation);
     36 
     37     /**
     38      * Searches for a given query on TV launcher
     39      */
     40     public void search(String query);
     41 
     42     /**
     43      * Returns a {@link BySelector} describing the search row
     44      * @return
     45      */
     46     public BySelector getSearchRowSelector();
     47 
     48     /**
     49      * Returns a {@link BySelector} describing the notification row (or recommendation row)
     50      * @return
     51      */
     52     public BySelector getNotificationRowSelector();
     53 
     54     /**
     55      * Returns a {@link BySelector} describing the apps row
     56      * @return
     57      */
     58     public BySelector getAppsRowSelector();
     59 
     60     /**
     61      * Returns a {@link BySelector} describing the games row
     62      * @return
     63      */
     64     public BySelector getGamesRowSelector();
     65 
     66     /**
     67      * Returns a {@link BySelector} describing the settings row
     68      * @return
     69      */
     70     public BySelector getSettingsRowSelector();
     71 
     72     /**
     73      * Returns a {@link BySelector} describing the app widget (eg, clock widget)
     74      * @return
     75      */
     76     public BySelector getAppWidgetSelector();
     77 
     78     /**
     79      * Returns a {@link BySelector} describing the Now Playing card
     80      * @return
     81      */
     82     public BySelector getNowPlayingCardSelector();
     83 
     84     /**
     85      * Returns a {@link UiObject2} describing the focused search row,
     86      * or the top row on new TV Launcher
     87      * @return
     88      */
     89     public UiObject2 selectSearchRow();
     90 
     91     /**
     92      * Returns a {@link UiObject2} describing the focused notification row
     93      * @return
     94      */
     95     public UiObject2 selectNotificationRow();
     96 
     97     /**
     98      * Returns a {@link UiObject2} describing the focused apps row
     99      * @return
    100      */
    101     public UiObject2 selectAppsRow();
    102 
    103     /**
    104      * Returns a {@link UiObject2} describing the focused games row
    105      * @return
    106      */
    107     public UiObject2 selectGamesRow();
    108 
    109     /**
    110      * Returns a {@link UiObject2} describing the focused settings row
    111      * @return
    112      */
    113     public UiObject2 selectSettingsRow();
    114 
    115     /**
    116      * Returns whether there is a match for the given app widget selector.
    117      * @return
    118      */
    119     public boolean hasAppWidgetSelector();
    120 
    121     /**
    122      * Returns whether there is a Now Playing card on leanback launcher
    123      * @return
    124      */
    125     public boolean hasNowPlayingCard();
    126 }
    127