You've already forked android_translation_layer
mirror of
https://gitlab.com/android_translation_layer/android_translation_layer.git
synced 2025-10-27 11:48:10 -07:00
ContentProvider: wrap in try/catch
Errors thrown here shouldn't be fatal, the app will often work just fine without any ContentProviders (especially a mostly-native app probably only uses them for ads)
This commit is contained in:
@@ -14,8 +14,9 @@ public abstract class ContentProvider {
|
||||
|
||||
static Map<String, ContentProvider> providers = new HashMap<String, ContentProvider>();
|
||||
|
||||
static void createContentProviders() throws Exception {
|
||||
static void createContentProviders() {
|
||||
for (PackageParser.Provider provider_parsed : Context.pkg.providers) {
|
||||
try {
|
||||
String providerName = provider_parsed.className;
|
||||
System.out.println("creating " + providerName);
|
||||
Class<? extends ContentProvider> providerCls = Class.forName(providerName).asSubclass(ContentProvider.class);
|
||||
@@ -23,6 +24,7 @@ public abstract class ContentProvider {
|
||||
provider.attachInfo(Context.this_application, provider_parsed.info);
|
||||
provider.onCreate();
|
||||
providers.put(provider_parsed.info.authority, provider);
|
||||
} catch(Exception e) { e.printStackTrace(); }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user