Catch VPN prepare exceptions widget

Refs #181
This commit is contained in:
M66B 2015-11-27 13:32:17 +01:00
parent f00dc6a373
commit b6056df9ed
1 changed files with 9 additions and 5 deletions

View File

@ -55,12 +55,16 @@ public class Widget extends AppWidgetProvider {
prefs.edit().putBoolean("enabled", false).apply();
SinkholeService.stop(context);
} else if (INTENT_ON.equals(intent.getAction())) {
if (VpnService.prepare(context) == null) {
prefs.edit().putBoolean("enabled", true).apply();
SinkholeService.start(context);
} else if (INTENT_ON.equals(intent.getAction()))
try {
if (VpnService.prepare(context) == null) {
prefs.edit().putBoolean("enabled", true).apply();
SinkholeService.start(context);
}
} catch (Throwable ex) {
Log.e(TAG, ex.toString() + "\n" + Log.getStackTraceString(ex));
Util.sendCrashReport(ex, context);
}
}
}
private static void update(int[] appWidgetIds, AppWidgetManager appWidgetManager, Context context) {