diff --git a/CHANGELOG b/CHANGELOG index 4ab60504a..ffea37a1f 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,9 @@ +0.9.46 2020-6-03 + * catch ActivityNotFound exception in MainActivity + +0.9.45 + * No significant changes + 0.9.44 / 2019-12-03 * Updated translations * Bumped target sdk version to 28, enforced by google diff --git a/app/src/main/java/net/i2p/android/router/MainFragment.java b/app/src/main/java/net/i2p/android/router/MainFragment.java index 52e7baa43..d48c43004 100644 --- a/app/src/main/java/net/i2p/android/router/MainFragment.java +++ b/app/src/main/java/net/i2p/android/router/MainFragment.java @@ -16,6 +16,7 @@ import android.preference.PreferenceManager; import android.provider.Settings; import android.support.v4.content.LocalBroadcastManager; import android.support.v7.app.AlertDialog; +import android.util.AndroidRuntimeException; import android.view.Gravity; import android.view.LayoutInflater; import android.view.View; @@ -27,6 +28,7 @@ import android.widget.ScrollView; import android.widget.TableLayout; import android.widget.TableRow; import android.widget.TextView; +import android.widget.Toast; import android.widget.ToggleButton; import net.i2p.android.I2PActivityBase; @@ -646,32 +648,34 @@ public class MainFragment extends I2PFragmentBase { PowerManager pm = (PowerManager) mContext.getSystemService(Context.POWER_SERVICE); if (!pm.isIgnoringBatteryOptimizations(packageName)) { AlertDialog.Builder b = new AlertDialog.Builder(getActivity()); - b.setTitle(R.string.configure_no_doze_title) - .setMessage(R.string.configure_no_doze) - .setCancelable(false) - .setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int i) { - String packageName = mContext.getPackageName(); - dialog.dismiss(); - ab.setPref(PREF_CONFIGURE_BATTERY, true); - intent.setAction(Settings.ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS); - intent.setData(Uri.parse("package:" + packageName)); - try { - mContext.startActivity(intent); - } catch (ActivityNotFoundException activityNotFound) { - ab.setPref(PREF_CONFIGURE_BATTERY, true); - } - } - }) - .setNegativeButton(R.string.no, new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int i) { - dialog.cancel(); - ab.setPref(PREF_CONFIGURE_BATTERY, false); - } - }) - .show(); + b.setTitle(R.string.configure_no_doze_title); + b.setMessage(R.string.configure_no_doze); + b.setCancelable(false); + b.setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int i) { + String packageName = mContext.getPackageName(); + dialog.dismiss(); + ab.setPref(PREF_CONFIGURE_BATTERY, true); + intent.setAction(Settings.ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS); + intent.setData(Uri.parse("package:" + packageName)); + try { + mContext.startActivity(intent); + } catch (ActivityNotFoundException activityNotFound) { + ab.setPref(PREF_CONFIGURE_BATTERY, true); + } catch (AndroidRuntimeException activityNotFound) { + ab.setPref(PREF_CONFIGURE_BATTERY, true); + } + } + }); + b.setNegativeButton(R.string.no, new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int i) { + dialog.cancel(); + ab.setPref(PREF_CONFIGURE_BATTERY, false); + } + }); + b.show(); } } else { ab.setPref(PREF_CONFIGURE_BATTERY, false); diff --git a/app/src/main/res/raw/i2ptunnel_config b/app/src/main/res/raw/i2ptunnel_config index 440b86f7d..75c7c514c 100644 --- a/app/src/main/res/raw/i2ptunnel_config +++ b/app/src/main/res/raw/i2ptunnel_config @@ -33,7 +33,7 @@ tunnel.1.type=ircclient tunnel.1.sharedClient=true tunnel.1.interface=127.0.0.1 tunnel.1.listenPort=6668 -tunnel.1.targetDestination=irc.dg.i2p:6667,irc.postman.i2p:6667,irc.echelon.i2p:6667 +tunnel.1.targetDestination=irc.postman.i2p:6667,irc.echelon.i2p:6667 tunnel.1.i2cpHost=127.0.0.1 tunnel.1.i2cpPort=7654 tunnel.1.option.inbound.nickname=shared clients diff --git a/gradle.properties b/gradle.properties index 7c33f6bbc..b463b86a9 100644 --- a/gradle.properties +++ b/gradle.properties @@ -14,7 +14,7 @@ POM_DEVELOPER_ID=meeh POM_DEVELOPER_NAME=meeh POM_DEVELOPER_EMAIL=meeh@i2pmail.org -I2P_VERSION=0.9.45 +I2P_VERSION=0.9.46 ANDROID_BUILD_TARGET_SDK_VERSION=28 ANDROID_BUILD_SDK_VERSION=28