android - Android N, O App Overlay stays after Permission request declined
问题描述
I have an app that needs access to the users accounts.
As the user declines the Contact Permission Dialog, the odd behaviour begins.
As usual the dialog appears and the app in background gets an overlay to darken content. If the user declines the permission now, the dialog disappears, but the darkening overlay stays (it also prohibits user-interaction).
The content visible behind overlay is changed accordingly to the declined permission.
The Error occurs only on devices with Android N and Android O, M looks perfectly after declining and lower api levels do not have runtime permissions, so they are doing their job as well.
A few stats:
- minSdk 16
- compileSdk 27
- targetSdk 27
- Buildtools Version 27.0.3
- supportLib 27.1.1
- com.google.android.gms.auth 15.0.1
Also there are other permission requests, which are working just as they should (e.g. Location).
Only the dialog shown for GET_ACCOUNTS (Contact permission Group) does not handle the overlay right.
It would be awesome, if somebody could give me some hints, which dependencies may exist that I did not see.
Thanks a lot in advance to everybody reading this, giving my problem a few thoughts, sharing a similar story even without a solution. Every hint or input will be appreciated :D
Update:
I removed the permission dialog and present the accountChooser to the user, but the misbehaviour stays. The only difference is, that even after choosing an account (and so granting the permission for this account) the overlay stays. As in background the app is visible, I can verify the features functionality and online data is available.
解决方案
经过长时间的搜索,权限对话框或帐户选择器似乎不是问题,而是通过按下按钮激活的底层progressDialog问题。现已弃用的 progressDialog 已启动,背景为灰色且不活动。现在两个正式可疑的对话开始了。在他们确认后,他们被正确隐藏了。不活动的灰色覆盖是旧进度对话框的一部分。我确信该错误是由于时间问题造成的,同时隐藏了被两个系统对话框打断的 progressDialog。
我的解决方案是废弃旧的 progressDialog 并构建一个替换(自定义警报对话框),它在单独的线程中显示和取消。自定义对话框现在按原样隐藏,甚至灰色覆盖也正确消失。
谢谢大家,我希望这可以帮助其他人更快地找到他们的解决方案;)
推荐阅读
- c++ - 使用 WebGL 使用 qml 访问客户端上的文件
- nginx - 为 sourcegraph 重写 Nginx 反向代理子目录
- python - 使用 ListView 和 django-filter 的 Django 分页无法正常工作
- javascript - Django Vue.js - 渲染多选下拉列表
- git - 从 .gitignore 规则中排除文件夹
- c++ - 了解 std::function 的晦涩模板参数
- twilio - 我们可以从谷歌云功能发起 twilio 可编程语音呼叫吗?
- node.js - 用 body-parse 快速解析 json
- python - tensorflow-gpu 的 ImportError
- css - 如何以缅甸/缅甸字体显示网站内容