aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMahesh Sharma <smahesh@codeaurora.org>2019-07-22 16:55:10 -0700
committerMahesh Kumar Sharma <smahesh@codeaurora.org>2019-07-24 11:10:36 -0700
commit9dbb556e16588af247ff975c6afa05feb45fe4cd (patch)
treea5d4a904b3bbf1592a30c450988b51c817a3cd9a
parente23ee25163bf7b3f7f2ecab3a89f5a48ff87e171 (diff)
downloadandroid_external_ant-wireless_ant_service-9dbb556e16588af247ff975c6afa05feb45fe4cd.tar.gz
android_external_ant-wireless_ant_service-9dbb556e16588af247ff975c6afa05feb45fe4cd.tar.bz2
android_external_ant-wireless_ant_service-9dbb556e16588af247ff975c6afa05feb45fe4cd.zip
Resolve CTS failure
1.) targetSdkVersion needs to be 28 or higher. Fix targetSdkVersion to fix CTS failure. 2.) Startservice needs to be explicit in newer android verisons. 3.) Remove call to startService from AntService class as we are handling it now explictly to fix issue in newer versions of Android. Change-Id: Ie8a780c978d8c27c00cb764182e4bcd1a3851a51
-rw-r--r--AndroidManifest.xml14
-rw-r--r--src/com/dsi/ant/server/AntService.java9
-rw-r--r--src/com/dsi/ant/server/startup/BootCompletedReceiver.java21
3 files changed, 18 insertions, 26 deletions
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index ebd1541..461e14f 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -22,27 +22,27 @@ limitations under the License.
<uses-sdk
android:minSdkVersion="7"
- android:targetSdkVersion="10"
+ android:targetSdkVersion="28"
/>
<application android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:process="system"
android:permission="com.dsi.ant.permission.ANTRADIO" >
-
+
<service android:exported="true" android:name=".AntService">
<intent-filter>
<action android:name="com.dsi.ant.server.IAntHal" />
<action android:name="com.dsi.ant.intent.request.SERVICE_INFO" />
</intent-filter>
-
+
<meta-data android:name="ANT_AdapterType"
android:value="built-in"
/>
</service>
-
- <receiver android:name="com.dsi.ant.server.startup.BootCompletedReceiver"
- android:enabled="true"
+
+ <receiver android:name="com.dsi.ant.server.startup.BootCompletedReceiver"
+ android:enabled="true"
android:exported="false"
android:label="BootCompletedReceiver">
<intent-filter>
@@ -62,4 +62,4 @@ limitations under the License.
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
-</manifest>
+</manifest>
diff --git a/src/com/dsi/ant/server/AntService.java b/src/com/dsi/ant/server/AntService.java
index 4e6f891..e41b2fa 100644
--- a/src/com/dsi/ant/server/AntService.java
+++ b/src/com/dsi/ant/server/AntService.java
@@ -124,11 +124,6 @@ public class AntService extends Service
return false; // Set to true if require bluetooth on for ANT functionality
}
- public static boolean startService(Context context)
- {
- return ( null != context.startService(new Intent(IAntHal.class.getName())) );
- }
-
/**
* Calls back the registered callback with the change to the new state
* @param state the {@link AntHalDefine} state
@@ -635,10 +630,6 @@ public class AntService extends Service
}
}
- // As someone has started using us, make sure we run "forever" like we
- // are a system service.
- startService(this);
-
return binder;
}
diff --git a/src/com/dsi/ant/server/startup/BootCompletedReceiver.java b/src/com/dsi/ant/server/startup/BootCompletedReceiver.java
index e53ebc4..ea55d00 100644
--- a/src/com/dsi/ant/server/startup/BootCompletedReceiver.java
+++ b/src/com/dsi/ant/server/startup/BootCompletedReceiver.java
@@ -2,17 +2,17 @@
* ANT Stack
*
* Copyright 2011 Dynastream Innovations
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.dsi.ant.server.startup;
@@ -27,18 +27,19 @@ import android.util.Log;
/**
* This class will receive BOOT_COMPLETED, and start the ANT HAL Service running forever.
*/
-public class BootCompletedReceiver extends BroadcastReceiver
+public class BootCompletedReceiver extends BroadcastReceiver
{
/** The debug log tag */
public static final String TAG = "BootCompletedReceiver";
-
+ private static final String ACTION_BOOT_COMPLETED = "android.intent.action.BOOT_COMPLETED";
@Override
- public void onReceive(final Context context, final Intent intent)
+ public void onReceive(final Context context, final Intent intent)
{
- // just make sure we are getting the right intent (better safe than sorry)
- if(Intent.ACTION_BOOT_COMPLETED.equals(intent.getAction()))
+ String action = intent.getAction();
+ Intent serviceIntent = new Intent(context,AntService.class);
+ if (null != action && action.equals(ACTION_BOOT_COMPLETED))
{
- AntService.startService(context);
+ context.startService(serviceIntent);
}
else
{