Loading android/app/jni/com_android_bluetooth_gatt.cpp +15 −5 Original line number Diff line number Diff line Loading @@ -174,7 +174,7 @@ static jmethodID method_onBatchScanThresholdCrossed; static jmethodID method_CreateonTrackAdvFoundLostObject; static jmethodID method_onTrackAdvFoundLost; static jmethodID method_onScanParamSetupCompleted; /** * Server callback methods Loading Loading @@ -591,6 +591,13 @@ void btgattc_track_adv_event_cb(btgatt_track_adv_info_t *p_adv_track_info) checkAndClearExceptionFromCallback(sCallbackEnv, __FUNCTION__); } void btgattc_scan_parameter_setup_completed_cb(int client_if, btgattc_error_t status) { CHECK_CALLBACK_ENV sCallbackEnv->CallVoidMethod(mCallbacksObj, method_onScanParamSetupCompleted, status, client_if); checkAndClearExceptionFromCallback(sCallbackEnv, __func__); } static const btgatt_client_callbacks_t sGattClientCallbacks = { btgattc_register_app_cb, btgattc_scan_result_cb, Loading Loading @@ -623,7 +630,8 @@ static const btgatt_client_callbacks_t sGattClientCallbacks = { btgattc_batchscan_startstop_cb, btgattc_batchscan_reports_cb, btgattc_batchscan_threshold_cb, btgattc_track_adv_event_cb btgattc_track_adv_event_cb, btgattc_scan_parameter_setup_completed_cb }; Loading Loading @@ -879,6 +887,7 @@ static void classInitNative(JNIEnv* env, jclass clazz) { method_CreateonTrackAdvFoundLostObject = env->GetMethodID(clazz, "CreateonTrackAdvFoundLostObject", "(II[BI[BIIILjava/lang/String;IIII)Lcom/android/bluetooth/gatt/AdvtFilterOnFoundOnLostInfo;"); method_onTrackAdvFoundLost = env->GetMethodID(clazz, "onTrackAdvFoundLost", "(Lcom/android/bluetooth/gatt/AdvtFilterOnFoundOnLostInfo;)V"); method_onScanParamSetupCompleted = env->GetMethodID(clazz, "onScanParamSetupCompleted", "(II)V"); // Server callbacks Loading Loading @@ -1313,10 +1322,11 @@ static void gattSetAdvDataNative(JNIEnv *env, jobject object, jint client_if, } static void gattSetScanParametersNative(JNIEnv* env, jobject object, jint scan_interval_unit, jint scan_window_unit) jint client_if, jint scan_interval_unit, jint scan_window_unit) { if (!sGattIf) return; sGattIf->client->set_scan_parameters(scan_interval_unit, scan_window_unit); sGattIf->client->set_scan_parameters(client_if, scan_interval_unit, scan_window_unit); } static void gattClientScanFilterParamAddNative(JNIEnv* env, jobject object, jobject params) Loading Loading @@ -1823,7 +1833,7 @@ static JNINativeMethod sScanMethods[] = { {"gattClientScanFilterDeleteNative", "(IIIIIJJJJLjava/lang/String;Ljava/lang/String;B[B[B)V", (void *) gattClientScanFilterDeleteNative}, {"gattClientScanFilterClearNative", "(II)V", (void *) gattClientScanFilterClearNative}, {"gattClientScanFilterEnableNative", "(IZ)V", (void *) gattClientScanFilterEnableNative}, {"gattSetScanParametersNative", "(II)V", (void *) gattSetScanParametersNative}, {"gattSetScanParametersNative", "(III)V", (void *) gattSetScanParametersNative}, }; // JNI functions defined in GattService class. Loading android/app/src/com/android/bluetooth/btservice/AdapterProperties.java +10 −1 Original line number Diff line number Diff line Loading @@ -66,6 +66,8 @@ class AdapterProperties { private int mOffloadedScanResultStorageBytes; private int mVersSupported; private int mTotNumOfTrackableAdv; private boolean mIsExtendedScanSupported; private boolean mIsDebugLogSupported; private boolean mIsActivityAndEnergyReporting; // Lock for all getters and setters. Loading Loading @@ -571,6 +573,8 @@ class AdapterProperties { + (0xFF & ((int)val[8])); mTotNumOfTrackableAdv = ((0xFF & ((int)val[11])) << 8) + (0xFF & ((int)val[10])); mIsExtendedScanSupported = ((0xFF & ((int)val[12])) != 0); mIsDebugLogSupported = ((0xFF & ((int)val[13])) != 0); Log.d(TAG, "BT_PROPERTY_LOCAL_LE_FEATURES: update from BT controller" + " mNumOfAdvertisementInstancesSupported = " Loading @@ -587,7 +591,12 @@ class AdapterProperties { +" mVersSupported = " + mVersSupported + " mTotNumOfTrackableAdv = " + mTotNumOfTrackableAdv); + mTotNumOfTrackableAdv + " mIsExtendedScanSupported = " + mIsExtendedScanSupported + " mIsDebugLogSupported = " + mIsDebugLogSupported ); } void onBluetoothReady() { Loading android/app/src/com/android/bluetooth/gatt/GattService.java +9 −0 Original line number Diff line number Diff line Loading @@ -1190,6 +1190,15 @@ public class GattService extends ProfileService { } } void onScanParamSetupCompleted(int status, int clientIf) throws RemoteException { ClientMap.App app = mClientMap.getById(clientIf); if (app == null || app.callback == null) { Log.e(TAG, "Advertise app or callback is null"); return; } Log.d(TAG, "onScanParamSetupCompleted : " + status); } // callback from AdvertiseManager for advertise status dispatch. void onMultipleAdvertiseCallback(int clientIf, int status, boolean isStart, AdvertiseSettings settings) throws RemoteException { Loading android/app/src/com/android/bluetooth/gatt/ScanManager.java +4 −2 Original line number Diff line number Diff line Loading @@ -419,7 +419,9 @@ public class ScanManager { scanWindow = Utils.millsToUnit(scanWindow); scanInterval = Utils.millsToUnit(scanInterval); gattClientScanNative(false); gattSetScanParametersNative(scanInterval, scanWindow); logd("configureRegularScanParams - scanInterval = " + scanInterval + "configureRegularScanParams - scanWindow = " + scanWindow); gattSetScanParametersNative(client.clientIf, scanInterval, scanWindow); gattClientScanNative(true); mLastConfiguredScanSetting = curScanSetting; } Loading Loading @@ -1017,7 +1019,7 @@ public class ScanManager { /************************** Regular scan related native methods **************************/ private native void gattClientScanNative(boolean start); private native void gattSetScanParametersNative(int scan_interval, private native void gattSetScanParametersNative(int client_if, int scan_interval, int scan_window); /************************** Filter related native methods ********************************/ Loading android/app/src/com/android/bluetooth/map/BluetoothMapContent.java +14 −8 Original line number Diff line number Diff line Loading @@ -712,11 +712,13 @@ public class BluetoothMapContent { private TYPE getType(Cursor c, FilterInfo fi) { TYPE type = null; if (V) Log.d(TAG, "getType: for filterMsgType" + fi.mMsgType); if (fi.mMsgType == FilterInfo.TYPE_SMS) { if (fi.mPhoneType == TelephonyManager.PHONE_TYPE_GSM) { type = TYPE.SMS_GSM; } else if (fi.mPhoneType == TelephonyManager.PHONE_TYPE_CDMA) { if (V) Log.d(TAG, "getType: phoneType for SMS " + fi.mPhoneType); if (fi.mPhoneType == TelephonyManager.PHONE_TYPE_CDMA) { type = TYPE.SMS_CDMA; } else { type = TYPE.SMS_GSM; } } else if (fi.mMsgType == FilterInfo.TYPE_MMS) { type = TYPE.MMS; Loading Loading @@ -2126,17 +2128,21 @@ public class BluetoothMapContent { Cursor tmpCursor = null; for(int x=0;x<listSize;x++){ BluetoothMapMessageListingElement ele = list.get(x); if((ele.getType().equals(TYPE.SMS_GSM)||ele.getType().equals(TYPE.SMS_CDMA)) && smsCursor != null){ /* If OBEX "GET" request header includes "ParameterMask" with 'Type' NOT set, * then ele.getType() returns "null" even for a valid cursor. * Avoid NullPointerException in equals() check when 'mType' value is "null" */ TYPE tmpType = ele.getType(); if (smsCursor!= null && ((TYPE.SMS_GSM).equals(tmpType) || (TYPE.SMS_CDMA).equals(tmpType))) { tmpCursor = smsCursor; fi.mMsgType = FilterInfo.TYPE_SMS; }else if(ele.getType().equals(TYPE.MMS) && mmsCursor != null){ } else if(mmsCursor != null && (TYPE.MMS).equals(tmpType)) { tmpCursor = mmsCursor; fi.mMsgType = FilterInfo.TYPE_MMS; }else if(ele.getType().equals(TYPE.EMAIL) && emailCursor != null){ } else if(emailCursor != null && ((TYPE.EMAIL).equals(tmpType))) { tmpCursor = emailCursor; fi.mMsgType = FilterInfo.TYPE_EMAIL; }else if(ele.getType().equals(TYPE.IM) && imCursor != null){ } else if(imCursor != null && ((TYPE.IM).equals(tmpType))) { tmpCursor = imCursor; fi.mMsgType = FilterInfo.TYPE_IM; } Loading Loading
android/app/jni/com_android_bluetooth_gatt.cpp +15 −5 Original line number Diff line number Diff line Loading @@ -174,7 +174,7 @@ static jmethodID method_onBatchScanThresholdCrossed; static jmethodID method_CreateonTrackAdvFoundLostObject; static jmethodID method_onTrackAdvFoundLost; static jmethodID method_onScanParamSetupCompleted; /** * Server callback methods Loading Loading @@ -591,6 +591,13 @@ void btgattc_track_adv_event_cb(btgatt_track_adv_info_t *p_adv_track_info) checkAndClearExceptionFromCallback(sCallbackEnv, __FUNCTION__); } void btgattc_scan_parameter_setup_completed_cb(int client_if, btgattc_error_t status) { CHECK_CALLBACK_ENV sCallbackEnv->CallVoidMethod(mCallbacksObj, method_onScanParamSetupCompleted, status, client_if); checkAndClearExceptionFromCallback(sCallbackEnv, __func__); } static const btgatt_client_callbacks_t sGattClientCallbacks = { btgattc_register_app_cb, btgattc_scan_result_cb, Loading Loading @@ -623,7 +630,8 @@ static const btgatt_client_callbacks_t sGattClientCallbacks = { btgattc_batchscan_startstop_cb, btgattc_batchscan_reports_cb, btgattc_batchscan_threshold_cb, btgattc_track_adv_event_cb btgattc_track_adv_event_cb, btgattc_scan_parameter_setup_completed_cb }; Loading Loading @@ -879,6 +887,7 @@ static void classInitNative(JNIEnv* env, jclass clazz) { method_CreateonTrackAdvFoundLostObject = env->GetMethodID(clazz, "CreateonTrackAdvFoundLostObject", "(II[BI[BIIILjava/lang/String;IIII)Lcom/android/bluetooth/gatt/AdvtFilterOnFoundOnLostInfo;"); method_onTrackAdvFoundLost = env->GetMethodID(clazz, "onTrackAdvFoundLost", "(Lcom/android/bluetooth/gatt/AdvtFilterOnFoundOnLostInfo;)V"); method_onScanParamSetupCompleted = env->GetMethodID(clazz, "onScanParamSetupCompleted", "(II)V"); // Server callbacks Loading Loading @@ -1313,10 +1322,11 @@ static void gattSetAdvDataNative(JNIEnv *env, jobject object, jint client_if, } static void gattSetScanParametersNative(JNIEnv* env, jobject object, jint scan_interval_unit, jint scan_window_unit) jint client_if, jint scan_interval_unit, jint scan_window_unit) { if (!sGattIf) return; sGattIf->client->set_scan_parameters(scan_interval_unit, scan_window_unit); sGattIf->client->set_scan_parameters(client_if, scan_interval_unit, scan_window_unit); } static void gattClientScanFilterParamAddNative(JNIEnv* env, jobject object, jobject params) Loading Loading @@ -1823,7 +1833,7 @@ static JNINativeMethod sScanMethods[] = { {"gattClientScanFilterDeleteNative", "(IIIIIJJJJLjava/lang/String;Ljava/lang/String;B[B[B)V", (void *) gattClientScanFilterDeleteNative}, {"gattClientScanFilterClearNative", "(II)V", (void *) gattClientScanFilterClearNative}, {"gattClientScanFilterEnableNative", "(IZ)V", (void *) gattClientScanFilterEnableNative}, {"gattSetScanParametersNative", "(II)V", (void *) gattSetScanParametersNative}, {"gattSetScanParametersNative", "(III)V", (void *) gattSetScanParametersNative}, }; // JNI functions defined in GattService class. Loading
android/app/src/com/android/bluetooth/btservice/AdapterProperties.java +10 −1 Original line number Diff line number Diff line Loading @@ -66,6 +66,8 @@ class AdapterProperties { private int mOffloadedScanResultStorageBytes; private int mVersSupported; private int mTotNumOfTrackableAdv; private boolean mIsExtendedScanSupported; private boolean mIsDebugLogSupported; private boolean mIsActivityAndEnergyReporting; // Lock for all getters and setters. Loading Loading @@ -571,6 +573,8 @@ class AdapterProperties { + (0xFF & ((int)val[8])); mTotNumOfTrackableAdv = ((0xFF & ((int)val[11])) << 8) + (0xFF & ((int)val[10])); mIsExtendedScanSupported = ((0xFF & ((int)val[12])) != 0); mIsDebugLogSupported = ((0xFF & ((int)val[13])) != 0); Log.d(TAG, "BT_PROPERTY_LOCAL_LE_FEATURES: update from BT controller" + " mNumOfAdvertisementInstancesSupported = " Loading @@ -587,7 +591,12 @@ class AdapterProperties { +" mVersSupported = " + mVersSupported + " mTotNumOfTrackableAdv = " + mTotNumOfTrackableAdv); + mTotNumOfTrackableAdv + " mIsExtendedScanSupported = " + mIsExtendedScanSupported + " mIsDebugLogSupported = " + mIsDebugLogSupported ); } void onBluetoothReady() { Loading
android/app/src/com/android/bluetooth/gatt/GattService.java +9 −0 Original line number Diff line number Diff line Loading @@ -1190,6 +1190,15 @@ public class GattService extends ProfileService { } } void onScanParamSetupCompleted(int status, int clientIf) throws RemoteException { ClientMap.App app = mClientMap.getById(clientIf); if (app == null || app.callback == null) { Log.e(TAG, "Advertise app or callback is null"); return; } Log.d(TAG, "onScanParamSetupCompleted : " + status); } // callback from AdvertiseManager for advertise status dispatch. void onMultipleAdvertiseCallback(int clientIf, int status, boolean isStart, AdvertiseSettings settings) throws RemoteException { Loading
android/app/src/com/android/bluetooth/gatt/ScanManager.java +4 −2 Original line number Diff line number Diff line Loading @@ -419,7 +419,9 @@ public class ScanManager { scanWindow = Utils.millsToUnit(scanWindow); scanInterval = Utils.millsToUnit(scanInterval); gattClientScanNative(false); gattSetScanParametersNative(scanInterval, scanWindow); logd("configureRegularScanParams - scanInterval = " + scanInterval + "configureRegularScanParams - scanWindow = " + scanWindow); gattSetScanParametersNative(client.clientIf, scanInterval, scanWindow); gattClientScanNative(true); mLastConfiguredScanSetting = curScanSetting; } Loading Loading @@ -1017,7 +1019,7 @@ public class ScanManager { /************************** Regular scan related native methods **************************/ private native void gattClientScanNative(boolean start); private native void gattSetScanParametersNative(int scan_interval, private native void gattSetScanParametersNative(int client_if, int scan_interval, int scan_window); /************************** Filter related native methods ********************************/ Loading
android/app/src/com/android/bluetooth/map/BluetoothMapContent.java +14 −8 Original line number Diff line number Diff line Loading @@ -712,11 +712,13 @@ public class BluetoothMapContent { private TYPE getType(Cursor c, FilterInfo fi) { TYPE type = null; if (V) Log.d(TAG, "getType: for filterMsgType" + fi.mMsgType); if (fi.mMsgType == FilterInfo.TYPE_SMS) { if (fi.mPhoneType == TelephonyManager.PHONE_TYPE_GSM) { type = TYPE.SMS_GSM; } else if (fi.mPhoneType == TelephonyManager.PHONE_TYPE_CDMA) { if (V) Log.d(TAG, "getType: phoneType for SMS " + fi.mPhoneType); if (fi.mPhoneType == TelephonyManager.PHONE_TYPE_CDMA) { type = TYPE.SMS_CDMA; } else { type = TYPE.SMS_GSM; } } else if (fi.mMsgType == FilterInfo.TYPE_MMS) { type = TYPE.MMS; Loading Loading @@ -2126,17 +2128,21 @@ public class BluetoothMapContent { Cursor tmpCursor = null; for(int x=0;x<listSize;x++){ BluetoothMapMessageListingElement ele = list.get(x); if((ele.getType().equals(TYPE.SMS_GSM)||ele.getType().equals(TYPE.SMS_CDMA)) && smsCursor != null){ /* If OBEX "GET" request header includes "ParameterMask" with 'Type' NOT set, * then ele.getType() returns "null" even for a valid cursor. * Avoid NullPointerException in equals() check when 'mType' value is "null" */ TYPE tmpType = ele.getType(); if (smsCursor!= null && ((TYPE.SMS_GSM).equals(tmpType) || (TYPE.SMS_CDMA).equals(tmpType))) { tmpCursor = smsCursor; fi.mMsgType = FilterInfo.TYPE_SMS; }else if(ele.getType().equals(TYPE.MMS) && mmsCursor != null){ } else if(mmsCursor != null && (TYPE.MMS).equals(tmpType)) { tmpCursor = mmsCursor; fi.mMsgType = FilterInfo.TYPE_MMS; }else if(ele.getType().equals(TYPE.EMAIL) && emailCursor != null){ } else if(emailCursor != null && ((TYPE.EMAIL).equals(tmpType))) { tmpCursor = emailCursor; fi.mMsgType = FilterInfo.TYPE_EMAIL; }else if(ele.getType().equals(TYPE.IM) && imCursor != null){ } else if(imCursor != null && ((TYPE.IM).equals(tmpType))) { tmpCursor = imCursor; fi.mMsgType = FilterInfo.TYPE_IM; } Loading