Prevent overlays on vCard import flows

Bug: 172252122
Test: manual with POC
Change-Id: I69c46f073f324005c3dd214447792fc20fe75a2b
Merged-In: I69c46f073f324005c3dd214447792fc20fe75a2b
(cherry picked from commit aa189a0daadf4d4cd8e00895c9bdbb8ac0ec9bb6)
(cherry picked from commit b423fdf941a10fc1498dcee0665e56fb1856bf4e)
diff --git a/Android.bp b/Android.bp
index 1fd8e8b..08288f8 100644
--- a/Android.bp
+++ b/Android.bp
@@ -32,6 +32,6 @@
         proguard_flags_files: ["proguard.flags"],
     },
 
-    sdk_version: "current",
+    sdk_version: "system_current",
     min_sdk_version: "21",
 }
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index e0814c1..c9dc980 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -53,6 +53,7 @@
     <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
     <!-- Required in P to run Service.startForeground() -->
     <uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>
+    <uses-permission android:name="android.permission.HIDE_NON_SYSTEM_OVERLAY_WINDOWS" />
 
     <uses-feature
         android:name="android.hardware.telephony"
diff --git a/src/com/android/contacts/vcard/ImportVCardActivity.java b/src/com/android/contacts/vcard/ImportVCardActivity.java
index 2c69cdf..38367c4 100644
--- a/src/com/android/contacts/vcard/ImportVCardActivity.java
+++ b/src/com/android/contacts/vcard/ImportVCardActivity.java
@@ -546,6 +546,9 @@
     protected void onCreate(Bundle bundle) {
         super.onCreate(bundle);
 
+        getWindow().addSystemFlags(android.view.WindowManager.LayoutParams
+            .SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS);
+
         Uri sourceUri = getIntent().getData();
 
         // Reading uris from non-storage needs the permission granted from the source intent,
diff --git a/src/com/android/contacts/vcard/SelectAccountActivity.java b/src/com/android/contacts/vcard/SelectAccountActivity.java
index ac5b3eb..eb13e50 100644
--- a/src/com/android/contacts/vcard/SelectAccountActivity.java
+++ b/src/com/android/contacts/vcard/SelectAccountActivity.java
@@ -52,6 +52,9 @@
     protected void onCreate(Bundle bundle) {
         super.onCreate(bundle);
 
+        getWindow().addSystemFlags(android.view.WindowManager.LayoutParams
+            .SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS);
+
         // There's three possibilities:
         // - more than one accounts -> ask the user
         // - just one account -> use the account without asking the user