diff options
author | Kiran Kelageri <kirankelageri@codeaurora.org> | 2015-09-16 11:53:04 -0700 |
---|---|---|
committer | Kiran Kelageri <kirankelageri@codeaurora.org> | 2015-09-16 11:53:04 -0700 |
commit | 1a8f27a91c83562015648b592340e543d2d6937f (patch) | |
tree | 2155c04e4d8588ab21640390d8b0128e1cc8f843 /wipower-host | |
parent | 794065ed644fa9a53882448de604f3051a549356 (diff) | |
download | android_packages_apps_BluetoothExt-1a8f27a91c83562015648b592340e543d2d6937f.tar.gz android_packages_apps_BluetoothExt-1a8f27a91c83562015648b592340e543d2d6937f.tar.bz2 android_packages_apps_BluetoothExt-1a8f27a91c83562015648b592340e543d2d6937f.zip |
Bluetooth-Wipower: Seperating A4WP reference app.
Seperated A4WP as a reference app, wipowerservice and JNI
now serves as a SDK for wipower.
Change-Id: Ibc67c977252ada2f02612f40d6733004fe95d4d8
Diffstat (limited to 'wipower-host')
-rw-r--r-- | wipower-host/a4wp/Android.mk | 3 | ||||
-rw-r--r-- | wipower-host/a4wp/AndroidManifest.xml | 22 | ||||
-rw-r--r-- | wipower-host/jni/android_hardware_wipower.cpp | 10 | ||||
-rw-r--r-- | wipower-host/wipower_service/Android.mk | 23 | ||||
-rw-r--r-- | wipower-host/wipower_service/AndroidManifest.xml | 68 | ||||
-rw-r--r-- | wipower-host/wipower_service/src/org/codeaurora/bluetooth/wipower/BTEventHandler.java (renamed from wipower-host/a4wp/src/org/codeaurora/bluetooth/wipower/BTEventHandler.java) | 2 | ||||
-rw-r--r-- | wipower-host/wipower_service/src/org/codeaurora/bluetooth/wipower/WipowerApp.java (renamed from wipower-host/a4wp/src/org/codeaurora/bluetooth/wipower/WipowerApp.java) | 2 | ||||
-rw-r--r-- | wipower-host/wipower_service/src/org/codeaurora/bluetooth/wipower/WipowerService.java (renamed from wipower-host/a4wp/src/org/codeaurora/bluetooth/wipower/WipowerService.java) | 2 |
8 files changed, 102 insertions, 30 deletions
diff --git a/wipower-host/a4wp/Android.mk b/wipower-host/a4wp/Android.mk index 996d243..edf6dd4 100644 --- a/wipower-host/a4wp/Android.mk +++ b/wipower-host/a4wp/Android.mk @@ -2,8 +2,7 @@ LOCAL_PATH:= $(call my-dir) include $(CLEAR_VARS) LOCAL_MODULE_TAGS := optional -src_dirs:= src/org/codeaurora/bluetooth/a4wp_app \ - src/org/codeaurora/bluetooth/wipower +src_dirs:= src/org/codeaurora/bluetooth/a4wp_app LOCAL_SRC_FILES := \ $(call all-java-files-under, $(src_dirs)) diff --git a/wipower-host/a4wp/AndroidManifest.xml b/wipower-host/a4wp/AndroidManifest.xml index ef75a6f..690bc66 100644 --- a/wipower-host/a4wp/AndroidManifest.xml +++ b/wipower-host/a4wp/AndroidManifest.xml @@ -39,34 +39,14 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. <uses-permission android:name="android.permission.BLUETOOTH_ADMIN" /> <uses-permission android:name="android.permission.WAKE_LOCK" /> <uses-permission android:name="android.permission.BLUETOOTH_STACK" /> + <uses-feature android:name="android.hardware.bluetooth_le" android:required="true" /> <application android:process="com.android.bluetooth" - android:name=".wipower.WipowerApp" android:persistent="false" android:supportsRtl="true"> <uses-library android:name="com.quicinc.wbc" android:required="false" /> <uses-library android:name="android.wipower" android:required="false" /> - <uses-feature android:name="android.hardware.bluetooth_le" android:required="true" /> - <receiver - android:name=".wipower.BTEventHandler" - android:exported="true" - android:enabled="true" - android:process="com.android.bluetooth"> - <intent-filter> - <action android:name="android.bluetooth.adapter.action.STATE_CHANGED" /> - </intent-filter> - </receiver> - <service - android:name = ".wipower.WipowerService" - android:exported="true" - android:enabled="true" - android:process="com.android.bluetooth"> - <intent-filter> - <action android:name="android.wipower.IWipower" /> - </intent-filter> - </service> - <service android:process="com.android.bluetooth" android:exported="true" diff --git a/wipower-host/jni/android_hardware_wipower.cpp b/wipower-host/jni/android_hardware_wipower.cpp index 01d5f08..02d70f6 100644 --- a/wipower-host/jni/android_hardware_wipower.cpp +++ b/wipower-host/jni/android_hardware_wipower.cpp @@ -127,7 +127,8 @@ static void wipower_power_cb(unsigned char alert_data) { static void callback_thread_event(bt_cb_thread_evt event) { JavaVM* vm = AndroidRuntime::getJavaVM(); - ALOGE("Kiran: Callback thread attached: %d", event); + if (DBG) + ALOGV("Callback thread attached: %d", event); if (event == ASSOCIATE_JVM) { JavaVMAttachArgs args; char name[] = "wipower Service Callback Thread"; @@ -135,10 +136,11 @@ static void callback_thread_event(bt_cb_thread_evt event) { args.name = name; args.group = NULL; vm->AttachCurrentThread(&sCallbackEnv, &args); - ALOGE("Kiran: Callback thread attached: %p", sCallbackEnv); + if (DBG) + ALOGV("Callback thread attached: %p", sCallbackEnv); } else if (event == DISASSOCIATE_JVM) { if (!checkCallbackThread()) { - ALOGE("Kiran: Callback: '%s' is not called on the correct thread", __FUNCTION__); + ALOGE("Callback: '%s' is not called on the correct thread", __FUNCTION__); return; } vm->DetachCurrentThread(); @@ -402,7 +404,7 @@ int register_android_hardware_wipower(JNIEnv* env) { ALOGV("%s: >\n", __func__); - return jniRegisterNativeMethods(env, "org/codeaurora/bt_wipower/wipower/WipowerService", gMethods, NELEM(gMethods)); + return jniRegisterNativeMethods(env, "org/codeaurora/bt_wipowersdk/wipower/WipowerService", gMethods, NELEM(gMethods)); } } diff --git a/wipower-host/wipower_service/Android.mk b/wipower-host/wipower_service/Android.mk new file mode 100644 index 0000000..1189c8e --- /dev/null +++ b/wipower-host/wipower_service/Android.mk @@ -0,0 +1,23 @@ +LOCAL_PATH:= $(call my-dir) +include $(CLEAR_VARS) + +LOCAL_MODULE_TAGS := optional +src_dirs:= src/org/codeaurora/bluetooth/wipower + +LOCAL_SRC_FILES := \ + $(call all-java-files-under, $(src_dirs)) + +LOCAL_PACKAGE_NAME := wipowerservice +LOCAL_CERTIFICATE := platform +LOCAL_JAVA_LIBRARIES += android.wipower + +LOCAL_REQUIRED_MODULES := bluetooth.default + +LOCAL_PROGUARD_ENABLED := disabled + +LOCAL_MULTILIB := 32 +LOCAL_JNI_SHARED_LIBRARIES := libwipower_jni + +include $(BUILD_PACKAGE) + +include $(call all-makefiles-under,$(LOCAL_PATH)) diff --git a/wipower-host/wipower_service/AndroidManifest.xml b/wipower-host/wipower_service/AndroidManifest.xml new file mode 100644 index 0000000..bc7643e --- /dev/null +++ b/wipower-host/wipower_service/AndroidManifest.xml @@ -0,0 +1,68 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* Copyright (c) 2015, The Linux Foundation. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + * Neither the name of The Linux Foundation nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED +WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS +BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR +BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE +OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ +--> +<manifest xmlns:android="http://schemas.android.com/apk/res/android" + package="org.codeaurora.bt_wipowersdk" + android:sharedUserId="android.uid.bluetooth"> + + <original-package android:name="org.codeaurora.bt_wipowersdk" /> + + <uses-permission android:name="android.permission.ACCESS_BLUETOOTH_SHARE" /> + <uses-permission android:name="android.permission.BLUETOOTH" /> + <uses-permission android:name="android.permission.BLUETOOTH_ADMIN" /> + <uses-permission android:name="android.permission.WAKE_LOCK" /> + <uses-permission android:name="android.permission.BLUETOOTH_STACK" /> + <uses-feature android:name="android.hardware.bluetooth_le" android:required="true" /> + <application android:process="com.android.bluetooth" + android:name=".wipower.WipowerApp" + android:persistent="false" + android:supportsRtl="true"> + <uses-library android:name="android.wipower" + android:required="false" /> + <receiver + android:name=".wipower.BTEventHandler" + android:exported="true" + android:enabled="true" + android:process="com.android.bluetooth"> + <intent-filter> + <action android:name="android.bluetooth.adapter.action.STATE_CHANGED" /> + </intent-filter> + </receiver> + <service + android:name = ".wipower.WipowerService" + android:exported="true" + android:enabled="true" + android:process="com.android.bluetooth"> + <intent-filter> + <action android:name="android.wipower.IWipower" /> + </intent-filter> + </service> + </application> +</manifest> diff --git a/wipower-host/a4wp/src/org/codeaurora/bluetooth/wipower/BTEventHandler.java b/wipower-host/wipower_service/src/org/codeaurora/bluetooth/wipower/BTEventHandler.java index b191448..ad1e33d 100644 --- a/wipower-host/a4wp/src/org/codeaurora/bluetooth/wipower/BTEventHandler.java +++ b/wipower-host/wipower_service/src/org/codeaurora/bluetooth/wipower/BTEventHandler.java @@ -27,7 +27,7 @@ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.codeaurora.bt_wipower.wipower; +package org.codeaurora.bt_wipowersdk.wipower; import android.bluetooth.BluetoothAdapter; import android.bluetooth.BluetoothDevice; diff --git a/wipower-host/a4wp/src/org/codeaurora/bluetooth/wipower/WipowerApp.java b/wipower-host/wipower_service/src/org/codeaurora/bluetooth/wipower/WipowerApp.java index d9127f3..9aaaf0b 100644 --- a/wipower-host/a4wp/src/org/codeaurora/bluetooth/wipower/WipowerApp.java +++ b/wipower-host/wipower_service/src/org/codeaurora/bluetooth/wipower/WipowerApp.java @@ -31,7 +31,7 @@ * @hide */ -package org.codeaurora.bt_wipower.wipower; +package org.codeaurora.bt_wipowersdk.wipower; import android.app.Application; import android.util.Log; diff --git a/wipower-host/a4wp/src/org/codeaurora/bluetooth/wipower/WipowerService.java b/wipower-host/wipower_service/src/org/codeaurora/bluetooth/wipower/WipowerService.java index bda73be..524810d 100644 --- a/wipower-host/a4wp/src/org/codeaurora/bluetooth/wipower/WipowerService.java +++ b/wipower-host/wipower_service/src/org/codeaurora/bluetooth/wipower/WipowerService.java @@ -27,7 +27,7 @@ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.codeaurora.bt_wipower.wipower; +package org.codeaurora.bt_wipowersdk.wipower; import java.util.UUID; import android.bluetooth.BluetoothManager; |