Merge pull request #4437 from ByteHamster/providerinstaller-synchronous

Make ProviderInstaller synchronous again
This commit is contained in:
H. Lehmann 2020-09-20 08:27:37 +02:00 committed by GitHub
commit 694ba65dd0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 4 additions and 35 deletions

View File

@ -45,6 +45,7 @@ public class ClientConfig {
UserPreferences.init(context);
UsageStatistics.init(context);
PlaybackPreferences.init(context);
installSslProvider(context);
NetworkUtils.init(context);
AntennapodHttpClient.setCacheDirectory(new File(context.getCacheDir(), "okhttp"));
SleepTimerPreferences.init(context);
@ -53,7 +54,7 @@ public class ClientConfig {
initialized = true;
}
public static void installSslProvider(Context context) {
private static void installSslProvider(Context context) {
// ProviderInstaller is a closed-source Google library
}
}

View File

@ -1,18 +0,0 @@
package de.danoeh.antennapod.core.service;
import androidx.annotation.NonNull;
import okhttp3.Interceptor;
import okhttp3.Response;
import java.io.IOException;
public class ProviderInstallerInterceptor implements Interceptor {
public static Runnable installer = () -> { };
@Override
@NonNull
public Response intercept(Chain chain) throws IOException {
installer.run();
return chain.proceed(chain.request());
}
}

View File

@ -32,7 +32,6 @@ import javax.net.ssl.TrustManagerFactory;
import javax.net.ssl.X509TrustManager;
import de.danoeh.antennapod.core.preferences.UserPreferences;
import de.danoeh.antennapod.core.service.ProviderInstallerInterceptor;
import de.danoeh.antennapod.core.service.UserAgentInterceptor;
import de.danoeh.antennapod.core.storage.DBWriter;
import okhttp3.Cache;
@ -117,7 +116,6 @@ public class AntennapodHttpClient {
}
return response;
});
builder.interceptors().add(new ProviderInstallerInterceptor());
builder.interceptors().add(new BasicAuthorizationInterceptor());
builder.networkInterceptors().add(new UserAgentInterceptor());

View File

@ -12,7 +12,6 @@ import de.danoeh.antennapod.core.preferences.PlaybackPreferences;
import de.danoeh.antennapod.core.preferences.SleepTimerPreferences;
import de.danoeh.antennapod.core.preferences.UsageStatistics;
import de.danoeh.antennapod.core.preferences.UserPreferences;
import de.danoeh.antennapod.core.service.ProviderInstallerInterceptor;
import de.danoeh.antennapod.core.service.download.AntennapodHttpClient;
import de.danoeh.antennapod.core.storage.PodDBAdapter;
import de.danoeh.antennapod.core.util.NetworkUtils;
@ -55,6 +54,7 @@ public class ClientConfig {
UserPreferences.init(context);
UsageStatistics.init(context);
PlaybackPreferences.init(context);
installSslProvider(context);
NetworkUtils.init(context);
// Don't initialize Cast-related logic unless it is enabled, to avoid the unnecessary
// Google Play Service usage.
@ -65,18 +65,6 @@ public class ClientConfig {
} else {
Log.v(TAG, "Cast is disabled. All Cast-related initialization will be skipped.");
}
ProviderInstaller.installIfNeededAsync(context, new ProviderInstaller.ProviderInstallListener() {
@Override
public void onProviderInstalled() {
Log.e(TAG, "onProviderInstalled");
}
@Override
public void onProviderInstallFailed(int i, Intent intent) {
Log.e(TAG, "onProviderInstallFailed");
}
});
ProviderInstallerInterceptor.installer = () -> installSslProvider(context);
AntennapodHttpClient.setCacheDirectory(new File(context.getCacheDir(), "okhttp"));
SleepTimerPreferences.init(context);
RxJavaErrorHandlerSetup.setupRxJavaErrorHandler();
@ -84,7 +72,7 @@ public class ClientConfig {
initialized = true;
}
public static void installSslProvider(Context context) {
private static void installSslProvider(Context context) {
try {
ProviderInstaller.installIfNeeded(context);
} catch (GooglePlayServicesRepairableException e) {