Skip to content

Commit

Permalink
[RESTRICT AUTOMERGE] Add hide-non-system-overlay flag for HarmfulAppW…
Browse files Browse the repository at this point in the history
…arningActivity

A malicious application could overlay the activity. The overlay is
able to be tapped through, which can trick the user into starting a
harmful activity.

The CL added the flag SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS for
the activity to prevent the tapjacking/overlay attack.

Bug: 205595291
Test: atest CtsHarmfulAppWarningHostTestCases
Change-Id: Ia1a1ae0dc451e04bf5c31e3cb8cf30a0d8e32991
(cherry picked from commit a04b366)
(cherry picked from commit 2c87a8a)
Merged-In:Ia1a1ae0dc451e04bf5c31e3cb8cf30a0d8e32991
  • Loading branch information
Jeff Chang authored and BayerischeMotorenWerke committed May 3, 2022
1 parent e39d903 commit 53b9ff2
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@

package com.android.internal.app;

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

import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
Expand All @@ -27,6 +29,7 @@
import android.util.Log;
import android.view.View;
import android.widget.TextView;

import com.android.internal.R;

/**
Expand All @@ -48,6 +51,7 @@ public class HarmfulAppWarningActivity extends AlertActivity implements
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

getWindow().addSystemFlags(SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS);
final Intent intent = getIntent();
mPackageName = intent.getStringExtra(Intent.EXTRA_PACKAGE_NAME);
mTarget = intent.getParcelableExtra(Intent.EXTRA_INTENT);
Expand Down

0 comments on commit 53b9ff2

Please sign in to comment.