From 64e3ac294aa3ba8568256e14c5a6b480c01a329c Mon Sep 17 00:00:00 2001 From: matthesrieke Date: Mon, 24 Mar 2014 17:37:21 +0100 Subject: [PATCH 1/7] increase to next SNAPSHOT version --- org.envirocar.app/AndroidManifest.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/org.envirocar.app/AndroidManifest.xml b/org.envirocar.app/AndroidManifest.xml index 5cf72d4ed..e58fe966b 100644 --- a/org.envirocar.app/AndroidManifest.xml +++ b/org.envirocar.app/AndroidManifest.xml @@ -1,8 +1,8 @@ + android:versionCode="22" + android:versionName="0.10.0-SNAPSHOT"> - \ No newline at end of file + From ad616d63e5d75e45dde5d9b719d01df1c2ddd408 Mon Sep 17 00:00:00 2001 From: matthesrieke Date: Thu, 17 Apr 2014 15:35:01 +0200 Subject: [PATCH 2/7] fix two RuntimeExceptions that occur in very rare situations. --- .../envirocar/app/activity/DashboardFragment.java | 8 +++++++- .../drivedeck/DriveDeckSportConnector.java | 14 +++++++++++++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/org.envirocar.app/src/org/envirocar/app/activity/DashboardFragment.java b/org.envirocar.app/src/org/envirocar/app/activity/DashboardFragment.java index a8ad96be8..8ef196bab 100644 --- a/org.envirocar.app/src/org/envirocar/app/activity/DashboardFragment.java +++ b/org.envirocar.app/src/org/envirocar/app/activity/DashboardFragment.java @@ -262,7 +262,13 @@ public void onDestroy() { logger.info("onDestroy. hash="+System.identityHashCode(this)); super.onDestroy(); - getActivity().unregisterReceiver(receiver); + try { + getActivity().unregisterReceiver(receiver); + } + catch (IllegalArgumentException e) { + logger.warn(e.getMessage(), e); + logger.warn("Reconsider the Receiver registration lifecycle!"); + } if (preferences != null) { preferences.unregisterOnSharedPreferenceChangeListener(preferenceListener); } diff --git a/org.envirocar.app/src/org/envirocar/app/protocol/drivedeck/DriveDeckSportConnector.java b/org.envirocar.app/src/org/envirocar/app/protocol/drivedeck/DriveDeckSportConnector.java index c063faf37..dc7030693 100644 --- a/org.envirocar.app/src/org/envirocar/app/protocol/drivedeck/DriveDeckSportConnector.java +++ b/org.envirocar.app/src/org/envirocar/app/protocol/drivedeck/DriveDeckSportConnector.java @@ -144,7 +144,19 @@ private void updateConnectionState() { } private void determineProtocol(String protocolInt) { - int prot = Integer.parseInt(protocolInt); + if (protocolInt == null || protocolInt.trim().isEmpty()) { + return; + } + + int prot; + try { + prot = Integer.parseInt(protocolInt); + } + catch (NumberFormatException e) { + logger.warn("NFE: "+e.getMessage()); + return; + } + switch (prot) { case 1: protocol = Protocol.CAN11500; From 52602840a76708f2dcff631847e2a96ca9d7c5f0 Mon Sep 17 00:00:00 2001 From: matthesrieke Date: Thu, 17 Apr 2014 15:59:53 +0200 Subject: [PATCH 3/7] fix some other RuntimeExceptions --- .../app/activity/ListTracksFragment.java | 21 +++++++++++++++---- .../envirocar/app/activity/MainActivity.java | 4 +++- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/org.envirocar.app/src/org/envirocar/app/activity/ListTracksFragment.java b/org.envirocar.app/src/org/envirocar/app/activity/ListTracksFragment.java index 381bb75c6..d1d8ebd61 100644 --- a/org.envirocar.app/src/org/envirocar/app/activity/ListTracksFragment.java +++ b/org.envirocar.app/src/org/envirocar/app/activity/ListTracksFragment.java @@ -212,14 +212,27 @@ private void updateUsabilityOfMenuItems() { @Override public void run() { + Menu theMenu = menu; + + if (theMenu == null) { + return; + } + if (dbAdapter.getAllLocalTracks().size() > 0) { - menu.findItem(R.id.menu_delete_all).setEnabled(true); - menu.findItem(R.id.menu_upload).setEnabled(UserManager.instance().isLoggedIn()); + setItemEnabled(theMenu.findItem(R.id.menu_delete_all), true); + setItemEnabled(theMenu.findItem(R.id.menu_upload), UserManager.instance().isLoggedIn()); } else { - menu.findItem(R.id.menu_upload).setEnabled(false); - menu.findItem(R.id.menu_delete_all).setEnabled(false); + setItemEnabled(theMenu.findItem(R.id.menu_upload), false); + setItemEnabled(theMenu.findItem(R.id.menu_delete_all), false); } } + + private void setItemEnabled(com.actionbarsherlock.view.MenuItem item, + boolean b) { + if (item != null) { + item.setEnabled(b); + } + } }); } diff --git a/org.envirocar.app/src/org/envirocar/app/activity/MainActivity.java b/org.envirocar.app/src/org/envirocar/app/activity/MainActivity.java index 66de22913..80f93ea0c 100644 --- a/org.envirocar.app/src/org/envirocar/app/activity/MainActivity.java +++ b/org.envirocar.app/src/org/envirocar/app/activity/MainActivity.java @@ -394,6 +394,8 @@ protected void onSaveInstanceState(Bundle outState) { outState.putInt(TRACK_MODE, trackMode); outState.putSerializable(SEEN_ANNOUNCEMENTS, this.seenAnnouncements.toArray(new String[0])); + + this.unregisterReceiver(errorInformationReceiver); } protected void updateStartStopButton() { @@ -681,7 +683,7 @@ protected void onDestroy() { this.unregisterReceiver(bluetoothStateReceiver); this.unregisterReceiver(deviceDiscoveryStateReceiver); - this.unregisterReceiver(errorInformationReceiver); + this.unregisterReceiver(serviceStateReceiver); if (remainingTimeHandler != null) { From f50a7762f51e411c252c5eba4e803dfbe730af1f Mon Sep 17 00:00:00 2001 From: matthesrieke Date: Thu, 8 May 2014 14:26:37 +0200 Subject: [PATCH 4/7] move unregistration of listener to onDestroy. --- .../src/org/envirocar/app/activity/MainActivity.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/org.envirocar.app/src/org/envirocar/app/activity/MainActivity.java b/org.envirocar.app/src/org/envirocar/app/activity/MainActivity.java index 80f93ea0c..26a32d8b9 100644 --- a/org.envirocar.app/src/org/envirocar/app/activity/MainActivity.java +++ b/org.envirocar.app/src/org/envirocar/app/activity/MainActivity.java @@ -394,8 +394,6 @@ protected void onSaveInstanceState(Bundle outState) { outState.putInt(TRACK_MODE, trackMode); outState.putSerializable(SEEN_ANNOUNCEMENTS, this.seenAnnouncements.toArray(new String[0])); - - this.unregisterReceiver(errorInformationReceiver); } protected void updateStartStopButton() { @@ -686,6 +684,8 @@ protected void onDestroy() { this.unregisterReceiver(serviceStateReceiver); + this.unregisterReceiver(errorInformationReceiver); + if (remainingTimeHandler != null) { remainingTimeHandler.removeCallbacks(remainingTimeThread); discoveryTargetTime = 0; From 76378d0b7f5b0699c080b2e1a8eeb750b3f034a5 Mon Sep 17 00:00:00 2001 From: matthesrieke Date: Thu, 8 May 2014 14:34:43 +0200 Subject: [PATCH 5/7] change version --- org.envirocar.app/AndroidManifest.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/org.envirocar.app/AndroidManifest.xml b/org.envirocar.app/AndroidManifest.xml index e58fe966b..d81aa6eb0 100644 --- a/org.envirocar.app/AndroidManifest.xml +++ b/org.envirocar.app/AndroidManifest.xml @@ -2,7 +2,7 @@ + android:versionName="0.9.1-SNAPSHOT"> Date: Thu, 8 May 2014 14:40:44 +0200 Subject: [PATCH 6/7] adjust exception logging on bluetooth connection --- .../src/org/envirocar/app/bluetooth/BluetoothConnection.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/org.envirocar.app/src/org/envirocar/app/bluetooth/BluetoothConnection.java b/org.envirocar.app/src/org/envirocar/app/bluetooth/BluetoothConnection.java index 60748ae1a..fc10cdfc1 100644 --- a/org.envirocar.app/src/org/envirocar/app/bluetooth/BluetoothConnection.java +++ b/org.envirocar.app/src/org/envirocar/app/bluetooth/BluetoothConnection.java @@ -176,6 +176,7 @@ public void run() { break; } catch (IOException e) { + logger.warn("Exception on bluetooth connection. Trying the fallback... : "+e.getMessage(), e); //try the fallback try { if (running) { @@ -186,7 +187,7 @@ public void run() { break; } } catch (FallbackException e1) { - logger.warn("Could not initialize FallbackBluetoothSocket classes.", e); + logger.warn("Could not initialize FallbackBluetoothSocket classes: "+e1.getMessage(), e1); } catch (InterruptedException e1) { logger.warn(e1.getMessage(), e1); } catch (IOException e1) { @@ -224,7 +225,7 @@ private boolean selectSocket() { bluetoothSocket = new NativeBluetoothSocket(tmp); return true; } catch (IOException e) { - logger.warn(e.getMessage() ,e); + logger.warn(e.getMessage(), e); } return false; From ca70b4b0f354fb60ee98b7c4f0d7329e999d0536 Mon Sep 17 00:00:00 2001 From: matthesrieke Date: Thu, 8 May 2014 14:46:31 +0200 Subject: [PATCH 7/7] change version to release --- org.envirocar.app/AndroidManifest.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/org.envirocar.app/AndroidManifest.xml b/org.envirocar.app/AndroidManifest.xml index d81aa6eb0..80932e9ec 100644 --- a/org.envirocar.app/AndroidManifest.xml +++ b/org.envirocar.app/AndroidManifest.xml @@ -2,7 +2,7 @@ + android:versionName="0.9.1">