commit | 16d841048e962738bb40a192295d4fde8f5e355b | [log] [tgz] |
---|---|---|
author | Lorenzo Colitti <lorenzo@google.com> | Fri Apr 09 15:59:15 2021 +0000 |
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | Fri Apr 09 15:59:15 2021 +0000 |
tree | 4e6dd1b03553bade9523c2a17d0d0a40fd17e2fb | |
parent | 6cbdc19b2c9d56c9e1e11db76349e89ebc9cc923 [diff] | |
parent | fd3b95c1f7b2e80c46026a1d4174454df57e7f07 [diff] |
Ensure the HostsideVpnTests passes with keyguard locked. am: fd3b95c1f7 Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1669608 Change-Id: Idabf4f50d54116d80dc349564bd9ab04cc7fd21a
diff --git a/tests/cts/hostside/app/src/com/android/cts/net/hostside/MyActivity.java b/tests/cts/hostside/app/src/com/android/cts/net/hostside/MyActivity.java index 0d0bc58..55eec11 100644 --- a/tests/cts/hostside/app/src/com/android/cts/net/hostside/MyActivity.java +++ b/tests/cts/hostside/app/src/com/android/cts/net/hostside/MyActivity.java
@@ -17,6 +17,7 @@ package com.android.cts.net.hostside; import android.app.Activity; +import android.app.KeyguardManager; import android.content.Intent; import android.os.Bundle; import android.view.WindowManager; @@ -34,6 +35,11 @@ getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON | WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON | WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD); + + // Dismiss the keyguard so that the tests can click on the VPN confirmation dialog. + // FLAG_DISMISS_KEYGUARD is not sufficient to do this because as soon as the dialog appears, + // this activity goes into the background and the keyguard reappears. + getSystemService(KeyguardManager.class).requestDismissKeyguard(this, null /* callback */); } @Override