diff options
author | Docile-Alligator <25734209+Docile-Alligator@users.noreply.github.com> | 2024-08-25 14:53:05 +0000 |
---|---|---|
committer | Docile-Alligator <25734209+Docile-Alligator@users.noreply.github.com> | 2024-08-25 15:04:32 +0000 |
commit | bd7f0f506ebb7adae24711abc8b6fe6bef0634ea (patch) | |
tree | d46c2e2d5818c03925335ca426c6a1d032019cef /app/src/main/java/ml/docilealligator | |
parent | 0fe8be5d3287ec500e934f25023b77896d83cd80 (diff) | |
download | infinity-for-reddit-bd7f0f506ebb7adae24711abc8b6fe6bef0634ea.tar infinity-for-reddit-bd7f0f506ebb7adae24711abc8b6fe6bef0634ea.tar.gz infinity-for-reddit-bd7f0f506ebb7adae24711abc8b6fe6bef0634ea.tar.bz2 infinity-for-reddit-bd7f0f506ebb7adae24711abc8b6fe6bef0634ea.tar.lz infinity-for-reddit-bd7f0f506ebb7adae24711abc8b6fe6bef0634ea.tar.xz infinity-for-reddit-bd7f0f506ebb7adae24711abc8b6fe6bef0634ea.tar.zst infinity-for-reddit-bd7f0f506ebb7adae24711abc8b6fe6bef0634ea.zip |
Fix submitting posts and downloading media not working on Android >= 14 with VPN on.
Diffstat (limited to 'app/src/main/java/ml/docilealligator')
4 files changed, 4 insertions, 10 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/services/DownloadMediaService.java b/app/src/main/java/ml/docilealligator/infinityforreddit/services/DownloadMediaService.java index 75dc884d..fc781bc7 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/services/DownloadMediaService.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/services/DownloadMediaService.java @@ -14,14 +14,12 @@ import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.media.MediaScannerConnection; -import android.net.NetworkCapabilities; import android.net.NetworkRequest; import android.net.Uri; import android.os.Build; import android.os.Environment; import android.os.PersistableBundle; import android.provider.MediaStore; -import android.util.Log; import androidx.core.app.NotificationChannelCompat; import androidx.core.app.NotificationCompat; @@ -89,7 +87,7 @@ public class DownloadMediaService extends JobService { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) { return new JobInfo.Builder(JOB_ID++, new ComponentName(context, DownloadMediaService.class)) .setUserInitiated(true) - .setRequiredNetwork(new NetworkRequest.Builder().addCapability(NetworkCapabilities.NET_CAPABILITY_INTERNET).build()) + .setRequiredNetwork(new NetworkRequest.Builder().clearCapabilities().build()) .setEstimatedNetworkBytes(0, contentEstimatedBytes + 500) .setExtras(extras) .build(); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/services/DownloadRedditVideoService.java b/app/src/main/java/ml/docilealligator/infinityforreddit/services/DownloadRedditVideoService.java index 13da3088..c889a166 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/services/DownloadRedditVideoService.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/services/DownloadRedditVideoService.java @@ -18,7 +18,6 @@ import android.media.MediaExtractor; import android.media.MediaFormat; import android.media.MediaMuxer; import android.media.MediaScannerConnection; -import android.net.NetworkCapabilities; import android.net.NetworkRequest; import android.net.Uri; import android.os.Build; @@ -97,7 +96,7 @@ public class DownloadRedditVideoService extends JobService { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) { return new JobInfo.Builder(JOB_ID++, new ComponentName(context, DownloadRedditVideoService.class)) .setUserInitiated(true) - .setRequiredNetwork(new NetworkRequest.Builder().addCapability(NetworkCapabilities.NET_CAPABILITY_INTERNET).build()) + .setRequiredNetwork(new NetworkRequest.Builder().clearCapabilities().build()) .setEstimatedNetworkBytes(0, contentEstimatedBytes + 500) .setExtras(extras) .build(); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/services/EditProfileService.java b/app/src/main/java/ml/docilealligator/infinityforreddit/services/EditProfileService.java index aaf9da4e..e458b63e 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/services/EditProfileService.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/services/EditProfileService.java @@ -8,7 +8,6 @@ import android.content.ComponentName; import android.content.Context; import android.graphics.Bitmap; import android.graphics.BitmapFactory; -import android.net.NetworkCapabilities; import android.net.NetworkRequest; import android.net.Uri; import android.os.Build; @@ -77,7 +76,7 @@ public class EditProfileService extends JobService { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) { return new JobInfo.Builder(JOB_ID++, new ComponentName(context, EditProfileService.class)) .setUserInitiated(true) - .setRequiredNetwork(new NetworkRequest.Builder().addCapability(NetworkCapabilities.NET_CAPABILITY_INTERNET).build()) + .setRequiredNetwork(new NetworkRequest.Builder().clearCapabilities().build()) .setEstimatedNetworkBytes(0, contentEstimatedBytes + 500) .setExtras(extras) .build(); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/services/SubmitPostService.java b/app/src/main/java/ml/docilealligator/infinityforreddit/services/SubmitPostService.java index fe41c350..d70881d0 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/services/SubmitPostService.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/services/SubmitPostService.java @@ -8,7 +8,6 @@ import android.content.ComponentName; import android.content.Context; import android.content.SharedPreferences; import android.graphics.Bitmap; -import android.net.NetworkCapabilities; import android.net.NetworkRequest; import android.net.Uri; import android.os.Build; @@ -123,9 +122,8 @@ public class SubmitPostService extends JobService { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) { return new JobInfo.Builder(JOB_ID++, new ComponentName(context, SubmitPostService.class)) .setUserInitiated(true) - .setRequiredNetwork(new NetworkRequest.Builder().addCapability(NetworkCapabilities.NET_CAPABILITY_INTERNET).build()) + .setRequiredNetwork(new NetworkRequest.Builder().clearCapabilities().build()) .setEstimatedNetworkBytes(0, contentEstimatedBytes + 500) - .setOverrideDeadline(0) .setExtras(extras) .build(); } else { |