Keep the screen on while the test activity is on top.

Bug: 231440256
Test: atest com.android.cts.net.HostsideConnOnActivityStartTest
Ignore-AOSP-First: Will cherrypick afterwards
Change-Id: Ibb0cc4c8a7cc2338ca938c775706f6b779fa96d3
This commit is contained in:
Sudheer Shanka 2022-05-20 15:15:35 -07:00
commit 4bfbef73bc

View file

@ -27,6 +27,7 @@ import android.content.IntentFilter;
import android.os.Bundle;
import android.os.RemoteCallback;
import android.util.Log;
import android.view.WindowManager;
import androidx.annotation.GuardedBy;
@ -42,6 +43,8 @@ public class MyActivity extends Activity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Log.d(TAG, "MyActivity.onCreate()");
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
}
@Override