Release v3.2.0
-FIXED Unsynchronized access to mCallback in AntHalService causing NullPointerException in some situations -UPDATE Application Launcher icon to grey version for visibility on dark and light backgrounds -UPDATE gitignore file
This commit is contained in:
29
.gitignore
vendored
29
.gitignore
vendored
@@ -1,21 +1,12 @@
|
||||
# built application files
|
||||
*.apk
|
||||
*.ap_
|
||||
# Ignores for Eclipse
|
||||
/.settings/
|
||||
|
||||
# files for the dex VM
|
||||
*.dex
|
||||
# Ignores for Android Projects
|
||||
/bin/
|
||||
/gen/
|
||||
/publish/
|
||||
/local.properties
|
||||
/secure.properties
|
||||
|
||||
# Java class files
|
||||
*.class
|
||||
|
||||
# generated files
|
||||
bin/
|
||||
gen/
|
||||
|
||||
# Local configuration file (sdk path, etc)
|
||||
local.properties
|
||||
# and the not safe to be released part
|
||||
secure.properties
|
||||
|
||||
# CVS files
|
||||
CVS/
|
||||
# Ignores for Mac machines
|
||||
.DS_Store
|
||||
@@ -16,8 +16,8 @@ limitations under the License.
|
||||
-->
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.dsi.ant.server"
|
||||
android:versionName="3.1.1"
|
||||
android:versionCode="030101"
|
||||
android:versionName="3.2.0"
|
||||
android:versionCode="030200"
|
||||
android:sharedUserId="android.uid.system">
|
||||
|
||||
<uses-sdk
|
||||
@@ -25,7 +25,7 @@ limitations under the License.
|
||||
android:targetSdkVersion="10"
|
||||
/>
|
||||
|
||||
<application android:icon="@drawable/icon"
|
||||
<application android:icon="@drawable/ic_launcher"
|
||||
android:label="@string/app_name"
|
||||
android:process="system"
|
||||
android:permission="com.dsi.ant.permission.ANTRADIO" >
|
||||
|
||||
BIN
res/drawable-xxhdpi/ic_launcher.png
Normal file
BIN
res/drawable-xxhdpi/ic_launcher.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 84 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 6.0 KiB |
@@ -80,7 +80,11 @@ public class AntService extends Service
|
||||
private Object mChangeAntPowerState_LOCK = new Object();
|
||||
private static Object sAntHalServiceDestroy_LOCK = new Object();
|
||||
|
||||
IAntHalCallback mCallback;
|
||||
/** Callback object for sending events to the upper layers */
|
||||
private volatile IAntHalCallback mCallback;
|
||||
/** Used for synchronizing changes to {@link #mCallback}
|
||||
* The synchronization is needed because of how {@link #doUnregisterAntHalCallback(IAntHalCallback)} works */
|
||||
private final Object mCallback_LOCK = new Object();
|
||||
|
||||
/**
|
||||
* Receives Bluetooth State Changed intent and sends {@link ACTION_REQUEST_ENABLE}
|
||||
@@ -134,13 +138,16 @@ public class AntService extends Service
|
||||
synchronized(mChangeAntPowerState_LOCK) {
|
||||
if(DEBUG) Log.i(TAG, "Setting ANT State = "+ state +" / "+ AntHalDefine.getAntHalStateString(state));
|
||||
|
||||
if (mCallback != null)
|
||||
// Use caching instead of synchronization so that we do not have to hold a lock during a callback.
|
||||
// It is safe to not hold the lock because we are not doing any write accesses.
|
||||
IAntHalCallback callback = mCallback;
|
||||
if (callback != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
if(DEBUG) Log.d(TAG, "Calling status changed callback "+ mCallback.toString());
|
||||
if(DEBUG) Log.d(TAG, "Calling status changed callback "+ callback.toString());
|
||||
|
||||
mCallback.antHalStateChanged(state);
|
||||
callback.antHalStateChanged(state);
|
||||
}
|
||||
catch (RemoteException e)
|
||||
{
|
||||
@@ -244,11 +251,9 @@ public class AntService extends Service
|
||||
|
||||
/**
|
||||
* Perform a power change if required.
|
||||
* Tries to use changeAntWirelessState() in {@link BluetoothService}. If it does not exist then
|
||||
* it defaults to a native enable() or disable() call
|
||||
* @param state true for enable, false for disable
|
||||
* @return {@link AntHalDefine#ANT_HAL_RESULT_SUCCESS} when the request is successfully sent,
|
||||
* false otherwise
|
||||
* @return {@link AntHalDefine#ANT_HAL_RESULT_SUCCESS} when the request has
|
||||
* been posted, false otherwise
|
||||
*/
|
||||
private int asyncSetAntPowerState(final boolean state)
|
||||
{
|
||||
@@ -435,7 +440,10 @@ public class AntService extends Service
|
||||
{
|
||||
if(DEBUG) Log.i(TAG, "Registering callback: "+ callback.toString());
|
||||
|
||||
synchronized(mCallback_LOCK)
|
||||
{
|
||||
mCallback = callback;
|
||||
}
|
||||
|
||||
return AntHalDefine.ANT_HAL_RESULT_SUCCESS;
|
||||
}
|
||||
@@ -446,11 +454,14 @@ public class AntService extends Service
|
||||
|
||||
int result = AntHalDefine.ANT_HAL_RESULT_FAIL_UNKNOWN;
|
||||
|
||||
synchronized (mCallback_LOCK)
|
||||
{
|
||||
if(mCallback.asBinder() == callback.asBinder())
|
||||
{
|
||||
mCallback = null;
|
||||
result = AntHalDefine.ANT_HAL_RESULT_SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
@@ -590,8 +601,11 @@ public class AntService extends Service
|
||||
}
|
||||
}
|
||||
|
||||
synchronized (mCallback_LOCK)
|
||||
{
|
||||
mCallback = null;
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
super.onDestroy();
|
||||
@@ -633,7 +647,10 @@ public class AntService extends Service
|
||||
{
|
||||
if (DEBUG) Log.d(TAG, "onUnbind() entered");
|
||||
|
||||
synchronized (mCallback_LOCK)
|
||||
{
|
||||
mCallback = null;
|
||||
}
|
||||
|
||||
return super.onUnbind(intent);
|
||||
}
|
||||
@@ -657,11 +674,14 @@ public class AntService extends Service
|
||||
{
|
||||
public synchronized void ANTRxMessage( byte[] message)
|
||||
{
|
||||
if(null != mCallback)
|
||||
// Use caching instead of synchronization so that we do not have to hold a lock during a callback.
|
||||
// It is safe to not hold the lock because we are not doing any write accesses.
|
||||
IAntHalCallback callback = mCallback;
|
||||
if(null != callback)
|
||||
{
|
||||
try
|
||||
{
|
||||
mCallback.antHalRxMessage(message);
|
||||
callback.antHalRxMessage(message);
|
||||
}
|
||||
catch (RemoteException e)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user