diff options
author | 2025-02-11 01:16:58 -0800 | |
---|---|---|
committer | 2025-02-11 01:16:58 -0800 | |
commit | a2dff5f2edfda3fa67dde2aa7f28e4845a3ed15a (patch) | |
tree | 14366ebe7557ecbd6d191cbc6e4ada46ee2015e2 | |
parent | 1b7405604b2278514e6eb56bac03ffd485b5f952 (diff) | |
parent | 13bebff110f432172f046d5bec9ee0dab8db8d17 (diff) |
Merge "Remove the userId before doing authority check in case of cross-profiles uri checks" into main
-rw-r--r-- | core/java/android/provider/DocumentsProvider.java | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/core/java/android/provider/DocumentsProvider.java b/core/java/android/provider/DocumentsProvider.java index 5b527c70b4f7..1b65a8859924 100644 --- a/core/java/android/provider/DocumentsProvider.java +++ b/core/java/android/provider/DocumentsProvider.java @@ -1124,12 +1124,13 @@ public abstract class DocumentsProvider extends ContentProvider { } final Uri documentUri = extraUri; - final String authority = documentUri.getAuthority(); + final String authorityWithoutUserId = getAuthorityWithoutUserId(documentUri.getAuthority()); final String documentId = DocumentsContract.getDocumentId(documentUri); - if (!mAuthority.equals(authority)) { + if (!mAuthority.equals(authorityWithoutUserId)) { throw new SecurityException( - "Requested authority " + authority + " doesn't match provider " + mAuthority); + "Requested authority " + authorityWithoutUserId + " doesn't match provider " + + mAuthority); } if (METHOD_IS_CHILD_DOCUMENT.equals(method)) { |