Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a578b689 authored by Chalard Jean's avatar Chalard Jean
Browse files

Protect VPN dialogs against overlay.

Bug: 130568701
Test: manual. After this, can't display on top of it
Change-Id: Ib032f800edb0416cc15f01a34954340d0d0ffa78
(cherry picked from commit 4e80dc2861614d25a1f957f50040a8cf04812d11)
parent 050d6df7
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@
    <uses-permission android:name="android.permission.CONTROL_VPN" />
    <uses-permission android:name="android.permission.CONTROL_ALWAYS_ON_VPN" />
    <uses-permission android:name="android.permission.CONNECTIVITY_INTERNAL" />
    <uses-permission android:name="android.permission.HIDE_NON_SYSTEM_OVERLAY_WINDOWS"/>

    <application android:label="VpnDialogs"
                 android:allowBackup="false">
+7 −3
Original line number Diff line number Diff line
@@ -16,6 +16,10 @@

package com.android.vpndialogs;

import static android.view.WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM;
import static android.view.WindowManager.LayoutParams.SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS;
import static android.view.WindowManager.LayoutParams.TYPE_SYSTEM_ALERT;

import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
@@ -31,7 +35,6 @@ import android.text.method.LinkMovementMethod;
import android.text.style.ClickableSpan;
import android.util.Log;
import android.view.View;
import android.view.WindowManager;
import android.widget.TextView;

import com.android.internal.app.AlertActivity;
@@ -74,8 +77,9 @@ public class AlwaysOnDisconnectedDialog extends AlertActivity
        setupAlert();

        getWindow().setCloseOnTouchOutside(false);
        getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT);
        getWindow().addFlags(WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM);
        getWindow().setType(TYPE_SYSTEM_ALERT);
        getWindow().addFlags(FLAG_ALT_FOCUSABLE_IM);
        getWindow().addPrivateFlags(SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS);
    }

    @Override
+3 −0
Original line number Diff line number Diff line
@@ -16,6 +16,8 @@

package com.android.vpndialogs;

import static android.view.WindowManager.LayoutParams.SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS;

import android.content.Context;
import android.content.DialogInterface;
import android.content.pm.PackageManager;
@@ -79,6 +81,7 @@ public class ConfirmDialog extends AlertActivity
        setupAlert();

        getWindow().setCloseOnTouchOutside(false);
        getWindow().addPrivateFlags(SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS);
        Button button = mAlert.getButton(DialogInterface.BUTTON_POSITIVE);
        button.setFilterTouchesWhenObscured(true);
    }