diff --git a/app/src/androidTest/java/de/test/antennapod/ui/PreferencesTest.java b/app/src/androidTest/java/de/test/antennapod/ui/PreferencesTest.java
index 7d3972378..6741cbc86 100644
--- a/app/src/androidTest/java/de/test/antennapod/ui/PreferencesTest.java
+++ b/app/src/androidTest/java/de/test/antennapod/ui/PreferencesTest.java
@@ -374,13 +374,6 @@ public class PreferencesTest {
clickPreference(R.string.pref_automatic_download_on_battery_title);
Awaitility.await().atMost(1000, MILLISECONDS)
.until(() -> enableAutodownloadOnBattery == UserPreferences.isEnableAutodownloadOnBattery());
- final boolean enableWifiFilter = UserPreferences.isEnableAutodownloadWifiFilter();
- clickPreference(R.string.pref_autodl_wifi_filter_title);
- Awaitility.await().atMost(1000, MILLISECONDS)
- .until(() -> enableWifiFilter != UserPreferences.isEnableAutodownloadWifiFilter());
- clickPreference(R.string.pref_autodl_wifi_filter_title);
- Awaitility.await().atMost(1000, MILLISECONDS)
- .until(() -> enableWifiFilter == UserPreferences.isEnableAutodownloadWifiFilter());
}
@Test
diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/preferences/AutoDownloadPreferencesFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/preferences/AutoDownloadPreferencesFragment.java
index 469697e23..6b15e4301 100644
--- a/app/src/main/java/de/danoeh/antennapod/fragment/preferences/AutoDownloadPreferencesFragment.java
+++ b/app/src/main/java/de/danoeh/antennapod/fragment/preferences/AutoDownloadPreferencesFragment.java
@@ -1,42 +1,32 @@
package de.danoeh.antennapod.fragment.preferences;
-import android.Manifest;
import android.app.Activity;
import android.content.Context;
-import android.content.pm.PackageManager;
import android.content.res.Resources;
import android.net.wifi.WifiConfiguration;
import android.net.wifi.WifiManager;
import android.os.Build;
import android.os.Bundle;
-import androidx.annotation.NonNull;
-import androidx.core.content.ContextCompat;
+import android.util.Log;
import androidx.preference.CheckBoxPreference;
import androidx.preference.ListPreference;
import androidx.preference.Preference;
import androidx.preference.PreferenceFragmentCompat;
import androidx.preference.PreferenceScreen;
-import android.util.Log;
+import de.danoeh.antennapod.R;
+import de.danoeh.antennapod.activity.PreferenceActivity;
+import de.danoeh.antennapod.core.preferences.UserPreferences;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
-import de.danoeh.antennapod.R;
-import de.danoeh.antennapod.activity.PreferenceActivity;
-import de.danoeh.antennapod.core.preferences.UserPreferences;
-
public class AutoDownloadPreferencesFragment extends PreferenceFragmentCompat {
private static final String TAG = "AutoDnldPrefFragment";
- private static final int LOCATION_PERMISSION_REQUEST_CODE = 1;
- private static final String PREF_KEY_LOCATION_PERMISSION_REQUEST_PROMPT = "prefAutoDownloadWifiFilterAndroid10PermissionPrompt";
-
private CheckBoxPreference[] selectedNetworks;
- private Preference prefPermissionRequestPromptOnAndroid10 = null;
-
@Override
public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
addPreferencesFromResource(R.xml.preferences_autodownload);
@@ -67,6 +57,9 @@ public class AutoDownloadPreferencesFragment extends PreferenceFragmentCompat {
}
return true;
});
+ if (Build.VERSION.SDK_INT >= 29) {
+ findPreference(UserPreferences.PREF_ENABLE_AUTODL_WIFI_FILTER).setVisible(false);
+ }
findPreference(UserPreferences.PREF_ENABLE_AUTODL_WIFI_FILTER)
.setOnPreferenceChangeListener(
(preference, newValue) -> {
@@ -93,6 +86,10 @@ public class AutoDownloadPreferencesFragment extends PreferenceFragmentCompat {
}
private void buildAutodownloadSelectedNetworksPreference() {
+ if (Build.VERSION.SDK_INT >= 29) {
+ return;
+ }
+
final Activity activity = getActivity();
if (selectedNetworks != null) {
@@ -192,65 +189,10 @@ public class AutoDownloadPreferencesFragment extends PreferenceFragmentCompat {
}
private void setSelectedNetworksEnabled(boolean b) {
- if (showPermissionRequestPromptOnAndroid10IfNeeded(b)) {
- return;
- }
-
if (selectedNetworks != null) {
for (Preference p : selectedNetworks) {
p.setEnabled(b);
}
}
}
-
- @Override
- public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
- if (requestCode != LOCATION_PERMISSION_REQUEST_CODE) {
- return;
- }
- if (permissions.length > 0 && permissions[0].equals(Manifest.permission.ACCESS_FINE_LOCATION) &&
- grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
- buildAutodownloadSelectedNetworksPreference();
- }
- }
-
- private boolean showPermissionRequestPromptOnAndroid10IfNeeded(boolean wifiFilterEnabled) {
- if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.P) {
- return false;
- }
-
- // Cases Android 10(Q) or later
- if (prefPermissionRequestPromptOnAndroid10 != null) {
- getPreferenceScreen().removePreference(prefPermissionRequestPromptOnAndroid10);
- prefPermissionRequestPromptOnAndroid10 = null;
- }
-
- if (ContextCompat.checkSelfPermission(requireContext(), Manifest.permission.ACCESS_FINE_LOCATION)
- == PackageManager.PERMISSION_GRANTED) {
- return false;
- }
-
- // Case location permission not yet granted, permission-specific UI is needed
- if (!wifiFilterEnabled) {
- // Don't show the UI when WiFi filter disabled.
- // it still return true, so that the caller knows
- // it does not have required permission, and will not invoke codes that require so.
- return true;
- }
-
- Preference pref = new Preference(requireActivity());
- pref.setKey(PREF_KEY_LOCATION_PERMISSION_REQUEST_PROMPT);
- pref.setTitle(R.string.autodl_wifi_filter_permission_title);
- pref.setSummary(R.string.autodl_wifi_filter_permission_message);
- pref.setIcon(R.drawable.ic_warning_red);
- pref.setOnPreferenceClickListener(preference -> {
- requestPermissions(new String[]{Manifest.permission.ACCESS_FINE_LOCATION}, LOCATION_PERMISSION_REQUEST_CODE);
- return true;
- });
- pref.setPersistent(false);
- getPreferenceScreen().addPreference(pref);
- prefPermissionRequestPromptOnAndroid10 = pref;
- return true;
- }
-
}
diff --git a/core/src/main/AndroidManifest.xml b/core/src/main/AndroidManifest.xml
index 7d84bdddb..3b6edae42 100644
--- a/core/src/main/AndroidManifest.xml
+++ b/core/src/main/AndroidManifest.xml
@@ -9,11 +9,6 @@
-
-
-
-
diff --git a/core/src/main/res/values/strings.xml b/core/src/main/res/values/strings.xml
index 2f80ac416..694ea0df2 100644
--- a/core/src/main/res/values/strings.xml
+++ b/core/src/main/res/values/strings.xml
@@ -416,8 +416,6 @@
Configure the automatic download of episodes.
Enable Wi-Fi filter
Allow automatic download only for selected Wi-Fi networks.
- Permission required
- Location permission is required for Wi-Fi filter. Tap to grant the permission.
Download when not charging
Allow automatic download when the battery is not charging
Parallel Downloads