如何确定哪个应用导致了“检测到屏幕重叠"错误? [英] How Do I determine which app is causing the “Screen Overlay Detected” error?

查看:211
本文介绍了如何确定哪个应用导致了“检测到屏幕重叠"错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

让我以此为序开始我已经阅读了,并且我确切了解重叠问题是什么,则会显示一条消息.

Let me preface this with I have already read through Android "Screen Overlay Detected" message if user is trying to grant a permission when a notification is showing and I understand exactly what the overlay problem is.

我也了解如何请求它以及如何检查我当前正在运行的应用程序是否具有在覆盖图上绘制的权限(!Settings.canDrawOverlays(this)).

I also understand how to request it as well as how to check if my current running app has permission to draw on overlays (!Settings.canDrawOverlays(this)).

我被我的应用程序责骂的是,每当弹出一个权限请求时,都会显示叠加层弹出窗口,并且即使用户授予我的应用程序绘制叠加层的权限,他们也永远不会越过权限屏幕.

I was getting scolded for my app because every time a permission request would popup, the overlays popup would be shown and even though users gave permission for my application to draw overlays, they could never get past the permissions screen.

进行一些挖掘后,问题在于某些用户正在其屏幕上运行录制应用程序:

After some digging, the problem was that some users were running a recording app on their screen:

问题是,这不是我的应用程序!这是AZ屏幕录像机(链接)作为覆盖层运行,但是由于在该弹出窗口出现时它们在我的应用程序中,因此我为此承担了责任.

The problem is, this is not my app! This is AZ Screen Recorder (link) which runs as an overlay, but due to the fact that they are in my app at the time this popup appears, I am blamed for the issue.

我想向用户显示一些东西,他们需要检查是否有任何其他应用作为叠加层运行,但是我不知道该如何检查.

I would like to display something to the user that they need to check for any other apps that are running something as an overlay, but I do not know how to check for this.

我可以检查他们是否能够在我的应用程序中绘制叠加层,但是我不知道如何检查其他对象.

I can check if they are able to draw overlays in my application, but I do not know how to check for others.

因此,我的问题是,是否可以通过编程方式检查当前是否有 在运行时正在运行叠加层的应用程序,如果可以,我是否可以找出软件包的名称说应用程序?

My question therefore is, is there a way to programmatically check if there are currently any apps that are running an overlay at runtime and if so, can I find out the package name of said apps?

(PS,我对屏幕录制器应用没有任何疑问,我只想链接到它,以便任何人都可以下载并测试是否选择)

(PS, I have no qualms with the screen recorder app in question, I just wanted to link to it so that anyone can download and test if they choose)

推荐答案

如果您可以进行测试视图并在其上生成点击事件,那么对于牛轧糖和奥利奥版本,您可以使用:

If you can make a test view and generate a tap event on that, then for nougat and oreo versions you can use:

view.setOnTouchListener((v, event) -> {
        if ((event.getFlags() & 0x2) != 0) {
            mPresenter.onVideoViewTapped();
            return false;
        }
        return false;
    });

此处0x2是FLAG_WINDOW_IS_PARTIALLY_OBSCURED的值,根据文档隐藏.

Here 0x2 is the value for FLAG_WINDOW_IS_PARTIALLY_OBSCURED, which is hidden as per documentation.

这篇关于如何确定哪个应用导致了“检测到屏幕重叠"错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆