mirror of
https://github.com/Divested-Mobile/DivestOS-Build.git
synced 2024-12-15 02:44:23 -05:00
39 lines
1.4 KiB
Diff
39 lines
1.4 KiB
Diff
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||
|
From: Dmitry Muhomor <muhomor.dmitry@gmail.com>
|
||
|
Date: Tue, 30 Aug 2022 12:37:03 +0300
|
||
|
Subject: [PATCH] improve compatibility with revoked INTERNET in
|
||
|
DownloadManager
|
||
|
|
||
|
---
|
||
|
core/java/android/app/DownloadManager.java | 10 ++++++++++
|
||
|
1 file changed, 10 insertions(+)
|
||
|
|
||
|
diff --git a/core/java/android/app/DownloadManager.java b/core/java/android/app/DownloadManager.java
|
||
|
index 6285f4745c37..ffc722279da1 100644
|
||
|
--- a/core/java/android/app/DownloadManager.java
|
||
|
+++ b/core/java/android/app/DownloadManager.java
|
||
|
@@ -1169,6 +1169,11 @@ public class DownloadManager {
|
||
|
* @return the number of downloads actually removed
|
||
|
*/
|
||
|
public int remove(long... ids) {
|
||
|
+ if (SpecialRuntimePermAppUtils.isInternetCompatEnabled()) {
|
||
|
+ // underlying provider is protected by the INTERNET permission
|
||
|
+ return 0;
|
||
|
+ }
|
||
|
+
|
||
|
return markRowDeleted(ids);
|
||
|
}
|
||
|
|
||
|
@@ -1595,6 +1600,11 @@ public class DownloadManager {
|
||
|
throw new IllegalArgumentException(" invalid value for param: totalBytes");
|
||
|
}
|
||
|
|
||
|
+ if (SpecialRuntimePermAppUtils.isInternetCompatEnabled()) {
|
||
|
+ // underlying provider is protected by the INTERNET permission
|
||
|
+ return -1;
|
||
|
+ }
|
||
|
+
|
||
|
// if there is already an entry with the given path name in downloads.db, return its id
|
||
|
Request request;
|
||
|
if (uri != null) {
|