forked from upstream-mirrors/OpenTracks
- Fix proguard issue with ANT+ services.
- Fix AntSensorManager.onDestroy, check antReceiver is not null. - In AntSensorManager.onDestroy, log info rather than log error for AntServiceNotConnectedException.
This commit is contained in:
@@ -67,3 +67,9 @@
|
|||||||
# Needed by Guava
|
# Needed by Guava
|
||||||
|
|
||||||
-dontwarn sun.misc.Unsafe
|
-dontwarn sun.misc.Unsafe
|
||||||
|
|
||||||
|
# Keep services needed by ANT+ protocol
|
||||||
|
-keep public class com.dsi.ant.IAnt_6
|
||||||
|
-keep public class com.dsi.ant.IAnt
|
||||||
|
-keep public class com.dsi.ant.IServiceSettings
|
||||||
|
|
||||||
|
|||||||
+11
-7
@@ -22,6 +22,7 @@ import com.dsi.ant.AntInterface;
|
|||||||
import com.dsi.ant.AntInterfaceIntent;
|
import com.dsi.ant.AntInterfaceIntent;
|
||||||
import com.dsi.ant.AntMesg;
|
import com.dsi.ant.AntMesg;
|
||||||
import com.dsi.ant.exception.AntInterfaceException;
|
import com.dsi.ant.exception.AntInterfaceException;
|
||||||
|
import com.dsi.ant.exception.AntServiceNotConnectedException;
|
||||||
import com.google.android.apps.mytracks.content.Sensor;
|
import com.google.android.apps.mytracks.content.Sensor;
|
||||||
import com.google.android.apps.mytracks.content.Sensor.SensorDataSet;
|
import com.google.android.apps.mytracks.content.Sensor.SensorDataSet;
|
||||||
import com.google.android.apps.mytracks.services.sensors.SensorManager;
|
import com.google.android.apps.mytracks.services.sensors.SensorManager;
|
||||||
@@ -142,13 +143,16 @@ public abstract class AntSensorManager extends SensorManager {
|
|||||||
Log.w(TAG, "Failed to unregister ANT data receiver", e);
|
Log.w(TAG, "Failed to unregister ANT data receiver", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
if (antReceiver != null) {
|
||||||
antReceiver.releaseInterface();
|
try {
|
||||||
} catch (AntInterfaceException e) {
|
antReceiver.releaseInterface();
|
||||||
Log.e(TAG, "failed to release ANT interface", e);
|
} catch (AntServiceNotConnectedException e) {
|
||||||
|
Log.i(TAG, "ANT service not connected", e);
|
||||||
|
} catch (AntInterfaceException e) {
|
||||||
|
Log.e(TAG, "failed to release ANT interface", e);
|
||||||
|
}
|
||||||
|
antReceiver.destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
antReceiver.destroy();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -236,7 +240,7 @@ public abstract class AntSensorManager extends SensorManager {
|
|||||||
/**
|
/**
|
||||||
* Process a raw ANT message.
|
* Process a raw ANT message.
|
||||||
* @param antMessage the ANT message, including the size and message ID bytes
|
* @param antMessage the ANT message, including the size and message ID bytes
|
||||||
* @deprecated Use {@link #handleMessage(int, byte[])} instead.
|
* @deprecated Use {@link #handleMessage(byte, byte[])} instead.
|
||||||
*/
|
*/
|
||||||
protected void handleMessage(byte[] antMessage) {
|
protected void handleMessage(byte[] antMessage) {
|
||||||
int len = antMessage[0];
|
int len = antMessage[0];
|
||||||
|
|||||||
Reference in New Issue
Block a user