telegram_bug_report
Completed Changes
Modified the askForPermissons method in DialogsActivity.java to resolve the issue of repeatedly requesting READ_MEDIA_* permissions on every app launch.
Core Modification
Added shouldShowRequestPermissionRationale checks before requesting READ_MEDIA_IMAGES and READ_MEDIA_VIDEO permissions.
// DialogsActivity.java line:10547
if (activity.checkSelfPermission(Manifest.permission.READ_MEDIA_IMAGES) != PackageManager.PERMISSION_GRANTED && activity.shouldShowRequestPermissionRationale(Manifest.permission.READ_MEDIA_IMAGES)) {
permissons.add(Manifest.permission.READ_MEDIA_IMAGES);
}
if (activity.checkSelfPermission(Manifest.permission.READ_MEDIA_VIDEO) != PackageManager.PERMISSION_GRANTED && activity.shouldShowRequestPermissionRationale(Manifest.permission.READ_MEDIA_VIDEO)) {
permissons.add(Manifest.permission.READ_MEDIA_VIDEO);
}
if (activity.checkSelfPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED && activity.shouldShowRequestPermissionRationale(Manifest.permission.WRITE_EXTERNAL_STORAGE)) {
permissons.add(Manifest.permission.WRITE_EXTERNAL_STORAGE);
}
Expected Verification Results
Before Fix
- On Android 13+, if the user permanently denies the contacts permission
READ_CONTACTSor notification permissionPOST_NOTIFICATION(triggering theonResumefallback path), the app would unconditionally attempt to request mediaREAD_MEDIA_*permissions on every launch. - In the demo video, media permissions weren't requested after the first notification denial because different permission groups were requested simultaneously. Android only processes the first group, and requesting multiple permission groups at once is non-compliant behavior.
After Fix
- First Install/Launch:
shouldShowRequestPermissionRationalereturnsfalse, so the app will not automatically request media permissions. This is the correct behavior—media permissions should be requested when the user attempts to send images. - Permanent Denial:
shouldShowRequestPermissionRationalereturnsfalse, so the app will no longer prompt the user repeatedly. - Single Denial:
shouldShowRequestPermissionRationalereturnstrue, allowing the app to request again (giving users a chance to reconsider, which aligns with Android guidelines). However, if denied again with "Don't ask again" checked, requests will stop.
Next Steps
I've identified several other permission-related issues. If needed, I'm happy to continue providing fixes and improvements.
Best regards
© 2025 Yuuou.
本站原创内容遵循 CC BY-NC-SA 4.0 知识共享许可协议。
欢迎非商业转载与引用,请注明出处
本站旨在记录技术探索与安全研究,所有内容仅代表作者个人观点
「让知识自由流动,而非被囚禁」