Prevent windows overlay on VPN dialog
This change addresses the issue of some applications using tapjack
attacks to trick users into disconnecting the VPN connection.
Bug: 182806691
Test: manually check that the VPN dialog is not being overlaid by
windows from the PoC application.
Change-Id: I03e600dec306af8b7d4c7ec024a5903f4591d9b4
diff --git a/packages/VpnDialogs/src/com/android/vpndialogs/ManageDialog.java b/packages/VpnDialogs/src/com/android/vpndialogs/ManageDialog.java
index 1fc74f7..67a7d12 100644
--- a/packages/VpnDialogs/src/com/android/vpndialogs/ManageDialog.java
+++ b/packages/VpnDialogs/src/com/android/vpndialogs/ManageDialog.java
@@ -16,6 +16,8 @@
package com.android.vpndialogs;
+import static android.view.WindowManager.LayoutParams.SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS;
+
import android.content.DialogInterface;
import android.net.VpnManager;
import android.os.Bundle;
@@ -87,6 +89,7 @@
mAlertParams.mNegativeButtonListener = this;
mAlertParams.mView = view;
setupAlert();
+ getWindow().addPrivateFlags(SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS);
if (mHandler == null) {
mHandler = new Handler(this);