From 877a41b054c19b3265d022febe6b8fd3c8527ad2 Mon Sep 17 00:00:00 2001 From: Arc Wang Date: Thu, 7 Apr 2022 10:39:13 +0800 Subject: [PATCH] Hide non-system overlay window on ActivityPicker To improve security. Bug: 181962311 Test: manual Show an AlertDialog and observe if it will hide after below command. adb shell am start -a android.intent.action.PICK_ACTIVITY -n com.android.settings/.ActivityPicker Change-Id: I800f0f39a469a95eb36eeaaeb2aa60a39fd916d3 --- src/com/android/settings/ActivityPicker.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/com/android/settings/ActivityPicker.java b/src/com/android/settings/ActivityPicker.java index 1c4be142927..4d65101d9dc 100644 --- a/src/com/android/settings/ActivityPicker.java +++ b/src/com/android/settings/ActivityPicker.java @@ -16,6 +16,8 @@ package com.android.settings; +import static android.view.WindowManager.LayoutParams.SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS; + import android.app.Activity; import android.content.Context; import android.content.DialogInterface; @@ -72,6 +74,8 @@ public class ActivityPicker extends AlertActivity implements protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); + getWindow().addPrivateFlags(SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS); + final Intent intent = getIntent(); // Read base intent from extras, otherwise assume default