Skip to content

Commit

Permalink
add keepScreenOn
Browse files Browse the repository at this point in the history
  • Loading branch information
Xiaoyu Lu committed Jan 28, 2014
1 parent 594a814 commit a1a3bc6
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion testrunner/src/com/baidu/cafe/local/LocalLib.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
import android.view.MotionEvent.PointerCoords;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.view.inputmethod.InputMethodManager;
import android.webkit.WebView;
import android.widget.AbsListView;
Expand Down Expand Up @@ -2127,7 +2128,7 @@ public View waitForView(String arg1, String arg2, boolean isAssert) {
* @param longClick
* true means long click
*/
public void clickOn(String arg1, String arg2, boolean longClick){
public void clickOn(String arg1, String arg2, boolean longClick) {
clickOn(arg1, arg2, longClick, true);
}

Expand Down Expand Up @@ -2365,4 +2366,14 @@ public void travel() {
public String getStringFromArguments(String key) {
return CafeTestRunner.mArguments.getString(key);
}

/**
* DO NOT USE A WAKE LOCK
*
* This will make sure that the screen stays on while your window is in the
* foreground, and only while it is in the foreground.
*/
public void keepScreenOn() {
mActivity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
}
}

0 comments on commit a1a3bc6

Please sign in to comment.