mirror of
https://github.com/Divested-Mobile/DivestOS-Build.git
synced 2024-12-20 21:34:24 -05:00
101 lines
4.7 KiB
Diff
101 lines
4.7 KiB
Diff
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||
|
From: Thomas Stuart <tjstuart@google.com>
|
||
|
Date: Wed, 28 Sep 2022 09:40:14 -0700
|
||
|
Subject: [PATCH] prevent overlays on the phone settings
|
||
|
|
||
|
A report came in showing a 3rd party app could overlay a button
|
||
|
on the phone settings causing unwanted behavior. In order to prevent
|
||
|
this, a new system flag has been added that only allows system overlays.
|
||
|
|
||
|
bug: 246933785
|
||
|
Test: manual
|
||
|
Change-Id: I427b65bc6c1acf06676e1753a34a7a38e21bbae0
|
||
|
Merged-In: I427b65bc6c1acf06676e1753a34a7a38e21bbae0
|
||
|
(cherry picked from commit e827d8f13c1c92622474fa2bf9e41a1f4ce21e2c)
|
||
|
Merged-In: I427b65bc6c1acf06676e1753a34a7a38e21bbae0
|
||
|
---
|
||
|
AndroidManifest.xml | 3 +++
|
||
|
.../phone/settings/AccessibilitySettingsActivity.java | 6 ++++--
|
||
|
.../phone/settings/PhoneAccountSettingsActivity.java | 5 ++++-
|
||
|
.../android/phone/settings/VoicemailSettingsActivity.java | 4 ++++
|
||
|
4 files changed, 15 insertions(+), 3 deletions(-)
|
||
|
|
||
|
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
|
||
|
index 810e7bca0..766572164 100644
|
||
|
--- a/AndroidManifest.xml
|
||
|
+++ b/AndroidManifest.xml
|
||
|
@@ -176,6 +176,9 @@
|
||
|
<uses-permission android:name="android.permission.MANAGE_NETWORK_POLICY" />
|
||
|
<uses-permission android:name="android.permission.READ_NETWORK_USAGE_HISTORY" />
|
||
|
|
||
|
+ <!-- Needed to block unwanted malicious pop up overlays -->
|
||
|
+ <uses-permission android:name="android.permission.HIDE_NON_SYSTEM_OVERLAY_WINDOWS"/>
|
||
|
+
|
||
|
<application android:name="PhoneApp"
|
||
|
android:persistent="true"
|
||
|
android:label="@string/phoneAppLabel"
|
||
|
diff --git a/src/com/android/phone/settings/AccessibilitySettingsActivity.java b/src/com/android/phone/settings/AccessibilitySettingsActivity.java
|
||
|
index 769ef615f..c65aa3273 100644
|
||
|
--- a/src/com/android/phone/settings/AccessibilitySettingsActivity.java
|
||
|
+++ b/src/com/android/phone/settings/AccessibilitySettingsActivity.java
|
||
|
@@ -24,10 +24,12 @@ import com.android.phone.R;
|
||
|
|
||
|
public class AccessibilitySettingsActivity extends PreferenceActivity {
|
||
|
|
||
|
- @Override
|
||
|
+ @Override
|
||
|
protected void onCreate(Bundle icicle) {
|
||
|
super.onCreate(icicle);
|
||
|
-
|
||
|
+ getWindow().addPrivateFlags(
|
||
|
+ android.view.WindowManager.LayoutParams
|
||
|
+ .PRIVATE_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS);
|
||
|
getActionBar().setTitle(R.string.accessibility_settings_activity_title);
|
||
|
getFragmentManager().beginTransaction().replace(
|
||
|
android.R.id.content, new AccessibilitySettingsFragment()).commit();
|
||
|
diff --git a/src/com/android/phone/settings/PhoneAccountSettingsActivity.java b/src/com/android/phone/settings/PhoneAccountSettingsActivity.java
|
||
|
index 71ae8cfa4..14321d0c6 100644
|
||
|
--- a/src/com/android/phone/settings/PhoneAccountSettingsActivity.java
|
||
|
+++ b/src/com/android/phone/settings/PhoneAccountSettingsActivity.java
|
||
|
@@ -19,6 +19,7 @@ package com.android.phone.settings;
|
||
|
import android.os.Bundle;
|
||
|
import android.preference.PreferenceActivity;
|
||
|
import android.view.MenuItem;
|
||
|
+import android.view.WindowManager;
|
||
|
|
||
|
import com.android.phone.R;
|
||
|
|
||
|
@@ -27,7 +28,9 @@ public class PhoneAccountSettingsActivity extends PreferenceActivity {
|
||
|
@Override
|
||
|
protected void onCreate(Bundle icicle) {
|
||
|
super.onCreate(icicle);
|
||
|
-
|
||
|
+ getWindow().addPrivateFlags(
|
||
|
+ android.view.WindowManager.LayoutParams
|
||
|
+ .PRIVATE_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS);
|
||
|
getActionBar().setTitle(R.string.phone_accounts);
|
||
|
getFragmentManager().beginTransaction().replace(
|
||
|
android.R.id.content, new PhoneAccountSettingsFragment()).commit();
|
||
|
diff --git a/src/com/android/phone/settings/VoicemailSettingsActivity.java b/src/com/android/phone/settings/VoicemailSettingsActivity.java
|
||
|
index 04e8bf502..7c5dbf20c 100644
|
||
|
--- a/src/com/android/phone/settings/VoicemailSettingsActivity.java
|
||
|
+++ b/src/com/android/phone/settings/VoicemailSettingsActivity.java
|
||
|
@@ -37,6 +37,7 @@ import android.text.TextDirectionHeuristics;
|
||
|
import android.text.TextUtils;
|
||
|
import android.util.Log;
|
||
|
import android.view.MenuItem;
|
||
|
+import android.view.WindowManager;
|
||
|
import android.widget.ListAdapter;
|
||
|
import android.widget.Toast;
|
||
|
|
||
|
@@ -207,6 +208,9 @@ public class VoicemailSettingsActivity extends PreferenceActivity
|
||
|
@Override
|
||
|
protected void onCreate(Bundle icicle) {
|
||
|
super.onCreate(icicle);
|
||
|
+ getWindow().addPrivateFlags(
|
||
|
+ android.view.WindowManager.LayoutParams
|
||
|
+ .PRIVATE_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS);
|
||
|
// Make sure we are running as the primary user only
|
||
|
UserManager userManager = getApplicationContext().getSystemService(UserManager.class);
|
||
|
if (!userManager.isPrimaryUser()) {
|