mirror of
https://github.com/Divested-Mobile/DivestOS-Build.git
synced 2024-09-08 18:44:54 +00:00
![Tad](/assets/img/avatar_default.png)
- Adds hosts cache and wildcard support back - Fixes broken hardened malloc enablement patch - Drops FDroidPrivExt, non-functional - Disables captive portal toggle patch, crashes Settings, needs rework - Rebranding work - Attempts to fix no boot animation Signed-off-by: Tad <tad@spotco.us>
36 lines
1.6 KiB
Diff
36 lines
1.6 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Dmitry Muhomor <muhomor.dmitry@gmail.com>
|
|
Date: Sat, 5 Feb 2022 11:08:55 +0200
|
|
Subject: [PATCH] make DownloadManager.query() a no-op when INTERNET permission
|
|
is revoked
|
|
|
|
---
|
|
core/java/android/app/DownloadManager.java | 7 +++++++
|
|
1 file changed, 7 insertions(+)
|
|
|
|
diff --git a/core/java/android/app/DownloadManager.java b/core/java/android/app/DownloadManager.java
|
|
index ed0ba8b4b642..97757b51aaeb 100644
|
|
--- a/core/java/android/app/DownloadManager.java
|
|
+++ b/core/java/android/app/DownloadManager.java
|
|
@@ -36,6 +36,7 @@ import android.content.pm.PackageManager;
|
|
import android.database.Cursor;
|
|
import android.database.CursorWrapper;
|
|
import android.database.DatabaseUtils;
|
|
+import android.database.MatrixCursor;
|
|
import android.net.ConnectivityManager;
|
|
import android.net.NetworkPolicyManager;
|
|
import android.net.Uri;
|
|
@@ -1178,6 +1179,12 @@ public class DownloadManager {
|
|
|
|
/** @hide */
|
|
public Cursor query(Query query, String[] projection) {
|
|
+ // don't crash apps that expect INTERNET permission to be always granted
|
|
+ Context ctx = ActivityThread.currentApplication();
|
|
+ if (ctx != null && ctx.checkSelfPermission(Manifest.permission.INTERNET) != PackageManager.PERMISSION_GRANTED) {
|
|
+ // underlying provider is protected by the INTERNET permission
|
|
+ return new MatrixCursor(projection);
|
|
+ }
|
|
Cursor underlyingCursor = query.runQuery(mResolver, projection, mBaseUri);
|
|
if (underlyingCursor == null) {
|
|
return null;
|