From 80b158e7d6e1cf0b7849b541551651d6827375a7 Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Fri, 17 Jun 2016 09:10:35 +0200 Subject: [PATCH 1/3] enable build fail on lint error to catch them in CI builds The spongycastle issue is taking a long time to get resolved, has not yet affected us, and would be a lot of work to fix in a different way. So the 'InvalidPackage' error is just disabled for now. --- app/build.gradle | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/build.gradle b/app/build.gradle index 1db1d6ffe..63535c85d 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -185,7 +185,7 @@ android { lintOptions { checkReleaseBuilds false - abortOnError false + abortOnError true htmlReport true xmlReport false @@ -200,6 +200,9 @@ android { // Like supportsRtl or parentActivityName. They are on purpose. disable 'UnusedAttribute' + + // to make CI fail on errors until this is fixed https://github.com/rtyley/spongycastle/issues/7 + disable 'InvalidPackage' } packagingOptions { From ba88bd706077faec6b46ab0f16b50c05a046031d Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Tue, 21 Jun 2016 12:51:48 +0200 Subject: [PATCH 2/3] only show update notification if updates are going to happen UpdateService.onHandleIntent() starts with a time check for whether an update is actually scheduled. Before, UpdateService put up a notification when it started. This changes it so that the notification is put up after the check, so it should only show the notification if UpdateService is actually going to run, and no longer when it is just waking up to check the time. !307 #662 --- .../java/org/fdroid/fdroid/UpdateService.java | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/app/src/main/java/org/fdroid/fdroid/UpdateService.java b/app/src/main/java/org/fdroid/fdroid/UpdateService.java index 404c151ac..3c4c5da5a 100644 --- a/app/src/main/java/org/fdroid/fdroid/UpdateService.java +++ b/app/src/main/java/org/fdroid/fdroid/UpdateService.java @@ -75,8 +75,6 @@ public class UpdateService extends IntentService { private static final String STATE_LAST_UPDATED = "lastUpdateCheck"; - private LocalBroadcastManager localBroadcastManager; - private static final int NOTIFY_ID_UPDATING = 0; private static final int NOTIFY_ID_UPDATES_AVAILABLE = 1; @@ -133,10 +131,6 @@ public class UpdateService extends IntentService { public void onCreate() { super.onCreate(); - localBroadcastManager = LocalBroadcastManager.getInstance(this); - localBroadcastManager.registerReceiver(updateStatusReceiver, - new IntentFilter(LOCAL_ACTION_STATUS)); - notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); notificationBuilder = new NotificationCompat.Builder(this) @@ -155,15 +149,13 @@ public class UpdateService extends IntentService { pendingIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); notificationBuilder.setContentIntent(PendingIntent.getActivity(this, 0, pendingIntent, PendingIntent.FLAG_UPDATE_CURRENT)); } - - notificationManager.notify(NOTIFY_ID_UPDATING, notificationBuilder.build()); } @Override public void onDestroy() { super.onDestroy(); notificationManager.cancel(NOTIFY_ID_UPDATING); - localBroadcastManager.unregisterReceiver(updateStatusReceiver); + LocalBroadcastManager.getInstance(this).unregisterReceiver(updateStatusReceiver); } protected static void sendStatus(Context context, int statusCode) { @@ -328,11 +320,14 @@ public class UpdateService extends IntentService { return; } + notificationManager.notify(NOTIFY_ID_UPDATING, notificationBuilder.build()); + LocalBroadcastManager.getInstance(this).registerReceiver(updateStatusReceiver, + new IntentFilter(LOCAL_ACTION_STATUS)); + // Grab some preliminary information, then we can release the // database while we do all the downloading, etc... List repos = RepoProvider.Helper.all(this); - //List swapRepos = new ArrayList<>(); int unchangedRepos = 0; int updatedRepos = 0; int errorRepos = 0; @@ -349,7 +344,6 @@ public class UpdateService extends IntentService { continue; } if (!singleRepoUpdate && repo.isSwap) { - //swapRepos.add(repo); continue; } From 09eea0d40bcf6b7a5612ef719177fd4ab2d2193b Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Tue, 21 Jun 2016 13:03:37 +0200 Subject: [PATCH 3/3] ignore "java.lang.IllegalArgumentException: Could not parse [null/24]" This is currently baffling me as to how it can happen. This isn't a pretty fix but it is better that letting F-Droid crash. db9bdc31 was supposed to make it so that only one thread at a time ever updated the static vars on FDroidApp. closes #690 --- .../java/org/fdroid/fdroid/net/WifiStateChangeService.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/org/fdroid/fdroid/net/WifiStateChangeService.java b/app/src/main/java/org/fdroid/fdroid/net/WifiStateChangeService.java index 69a41761d..d56d39cc9 100644 --- a/app/src/main/java/org/fdroid/fdroid/net/WifiStateChangeService.java +++ b/app/src/main/java/org/fdroid/fdroid/net/WifiStateChangeService.java @@ -103,7 +103,12 @@ public class WifiStateChangeService extends IntentService { if (dhcpInfo != null) { String netmask = formatIpAddress(dhcpInfo.netmask); if (!TextUtils.isEmpty(FDroidApp.ipAddressString) && netmask != null) { - FDroidApp.subnetInfo = new SubnetUtils(FDroidApp.ipAddressString, netmask).getInfo(); + try { + FDroidApp.subnetInfo = new SubnetUtils(FDroidApp.ipAddressString, netmask).getInfo(); + } catch (IllegalArgumentException e) { + // catch this mystery error: "java.lang.IllegalArgumentException: Could not parse [null/24]" + e.printStackTrace(); + } } } } else if (wifiState == WifiManager.WIFI_STATE_DISABLED