Skip to content

Delete videos always fails on Android 10 (Q): File.delete() blocked by scoped storage #360

Description

@Javad395

Device: Huawei nova 7i, EMUI / Android 10 (API 29)
App version: REX Player v5.1.0 (GitHub build)

Problem:
Trying to delete any video from inside the app always ends with the "Failed to delete" toast. Nothing helps (permissions granted, cache cleared, latest version).

Technical analysis (from source code):

  1. PermissionUtils.StorageOps.deleteVideos() takes the direct path because SCOPED_STORAGE_ONLY=false and hasManageStoragePermission() returns true for all devices below Android 11. The direct path calls File(video.path).delete().
  2. On Android 10, the app runs under scoped storage: requestLegacyExternalStorage="true" is ignored because targetSdk (36) > 29, WRITE_EXTERNAL_STORAGE is capped with android:maxSdkVersion="28", and MANAGE_EXTERNAL_STORAGE has no effect on API 29. Therefore raw File.delete() on shared media can never succeed, and every delete is counted as "failed".
  3. The scoped fallback (deleteVideosScoped) is never used on Q, and even if it were, contentResolver.delete() on Android 10 throws RecoverableSecurityException for media owned by other apps, and that exception is not handled — the API 29 user-confirmation flow (RecoverableSecurityException.getUserAction() -> IntentSenderRequest / startIntentSenderForResult) is not implemented anywhere in the app. createDeleteRequest() is only used for Android 11+ (Build.VERSION_CODES.R).

Expected behavior:
On Android 10 the app should either catch RecoverableSecurityException and show the system delete-confirmation dialog, or fall back to MediaStore createDeleteRequest-equivalent handling for Q, so that deletion works like it does on Android 11+.

Steps to reproduce:

  1. Open REX Player on an Android 10 device.
  2. Long-press a video and choose Delete.
  3. Toast "Failed to delete" is shown; the file remains.

Please add proper API 29 (Q) deletion handling. Thanks for the great player!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions