summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEran Messeri <eranm@google.com>2019-10-18 14:15:10 +0100
committerVasyl Gello <vasek.gello@gmail.com>2020-02-05 10:48:11 +0000
commit2448bd1575391f2a355c0f836e47ae2a85462769 (patch)
treebb1a24df8093b26dc1b8fbbbee571963202a96a4
parent9d6c856c3e954c10aca6b04aca2b99aa65546920 (diff)
downloadandroid_packages_apps_CertInstaller-cm-14.1.tar.gz
android_packages_apps_CertInstaller-cm-14.1.tar.bz2
android_packages_apps_CertInstaller-cm-14.1.zip
KeyChain: Do not allow hiding Cert Install dialogcm-14.1
Do not allow apps to float a window on top of the certificate installation / naming dialog. This obscures the CA certificate installation dialog and could be used to trick a user into installing a CA certificate. This is fixed by adding the HIDE_NON_SYSTEM_OVERLAY_WINDOWS system flag when the activity is created (onCreate), so that another activity starting in the foreground would not be able to obscure the dialog. Bug: 139017101 Test: Manual, with an app that floats a window. Change-Id: I637974d2179d6cd266d3762a1464184d2be35bf4 Merged-In: Iff8e678743c3883cf1f7f64390097a768ca00856 (cherry picked from commit 6afaf1846cc28af1ea048ebd55770cb38f77fb19)
-rw-r--r--AndroidManifest.xml1
-rw-r--r--src/com/android/certinstaller/CertInstaller.java3
2 files changed, 4 insertions, 0 deletions
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 56ac884..df73092 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -9,6 +9,7 @@
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.MANAGE_USERS" />
<uses-permission android:name="android.permission.ACCESS_ALL_DOWNLOADS" />
+ <uses-permission android:name="android.permission.HIDE_NON_SYSTEM_OVERLAY_WINDOWS" />
<application android:label="@string/app_name"
android:allowBackup="false">
diff --git a/src/com/android/certinstaller/CertInstaller.java b/src/com/android/certinstaller/CertInstaller.java
index b4850d0..10d072a 100644
--- a/src/com/android/certinstaller/CertInstaller.java
+++ b/src/com/android/certinstaller/CertInstaller.java
@@ -16,6 +16,8 @@
package com.android.certinstaller;
+import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS;
+
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
@@ -94,6 +96,7 @@ public class CertInstaller extends Activity {
@Override
protected void onCreate(Bundle savedStates) {
super.onCreate(savedStates);
+ getWindow().addPrivateFlags(PRIVATE_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS);
mCredentials = createCredentialHelper(getIntent());