Loading android/app/src/com/android/bluetooth/hid/HidDeviceService.java +5 −7 Original line number Diff line number Diff line Loading @@ -18,7 +18,6 @@ package com.android.bluetooth.hid; import android.bluetooth.BluetoothDevice; import android.bluetooth.BluetoothHidDevice; import android.bluetooth.BluetoothHidDeviceAppConfiguration; import android.bluetooth.BluetoothHidDeviceAppQosSettings; import android.bluetooth.BluetoothHidDeviceAppSdpSettings; import android.bluetooth.BluetoothProfile; Loading Loading @@ -94,8 +93,7 @@ public class HidDeviceService extends ProfileService { try { if (mCallback != null) { // TODO(hsz) remove AppConfig in frameworks/base in the follow-up CL mCallback.onAppStatusChanged(device, null, success); mCallback.onAppStatusChanged(device, success); } else { break; } Loading Loading @@ -283,9 +281,9 @@ public class HidDeviceService extends ProfileService { } @Override public boolean registerApp(BluetoothHidDeviceAppConfiguration config, BluetoothHidDeviceAppSdpSettings sdp, BluetoothHidDeviceAppQosSettings inQos, BluetoothHidDeviceAppQosSettings outQos, IBluetoothHidDeviceCallback callback) { public boolean registerApp(BluetoothHidDeviceAppSdpSettings sdp, BluetoothHidDeviceAppQosSettings inQos, BluetoothHidDeviceAppQosSettings outQos, IBluetoothHidDeviceCallback callback) { if (DBG) { Log.d(TAG, "registerApp()"); } Loading @@ -299,7 +297,7 @@ public class HidDeviceService extends ProfileService { } @Override public boolean unregisterApp(BluetoothHidDeviceAppConfiguration config) { public boolean unregisterApp() { if (DBG) { Log.d(TAG, "unregisterApp()"); } Loading android/app/src/com/android/bluetooth/map/BluetoothMapMasInstance.java +3 −2 Original line number Diff line number Diff line Loading @@ -410,8 +410,9 @@ public class BluetoothMapMasInstance implements IObexConnectionHandler { removeSdpRecord(); closeConnectionSocket(); closeServerSockets(true); // Do not block for Accept thread cleanup. // Fix Handler Thread block during BT Turn OFF. closeServerSockets(false); } /** Loading android/app/src/com/android/bluetooth/map/BluetoothMapObexServer.java +8 −8 Original line number Diff line number Diff line Loading @@ -1174,9 +1174,6 @@ public class BluetoothMapObexServer extends ServerRequestHandler { } try { // Open the OBEX body stream outStream = op.openOutputStream(); if (appParams.getMaxListCount() == BluetoothMapAppParams.INVALID_VALUE_PARAMETER) { appParams.setMaxListCount(1024); } Loading Loading @@ -1229,6 +1226,8 @@ public class BluetoothMapObexServer extends ServerRequestHandler { replyHeaders.setHeader(HeaderSet.APPLICATION_PARAMETER, outAppParams.encodeParams()); op.sendHeaders(replyHeaders); // Open the OBEX body stream outStream = op.openOutputStream(); } catch (IOException e) { Log.w(TAG, "sendMessageListingRsp: IOException - sending OBEX_HTTP_BAD_REQUEST", e); if (outStream != null) { Loading Loading @@ -1366,9 +1365,6 @@ public class BluetoothMapObexServer extends ServerRequestHandler { // Check to see if we only need to send the size - hence no need to encode. try { // Open the OBEX body stream outStream = op.openOutputStream(); if (appParams.getMaxListCount() == BluetoothMapAppParams.INVALID_VALUE_PARAMETER) { appParams.setMaxListCount(1024); } Loading Loading @@ -1416,6 +1412,8 @@ public class BluetoothMapObexServer extends ServerRequestHandler { replyHeaders.setHeader(HeaderSet.APPLICATION_PARAMETER, outAppParams.encodeParams()); op.sendHeaders(replyHeaders); // Open the OBEX body stream outStream = op.openOutputStream(); } catch (IOException e) { Log.w(TAG, "sendConvoListingRsp: IOException - sending OBEX_HTTP_BAD_REQUEST", e); if (outStream != null) { Loading Loading @@ -1524,7 +1522,6 @@ public class BluetoothMapObexServer extends ServerRequestHandler { if (maxListCount != 0) { outBytes = mCurrentFolder.encode(listStartOffset, maxListCount); outStream = op.openOutputStream(); } else { // ESR08 specified that this shall only be included for MaxListCount=0 outAppParams.setFolderListingSize(mCurrentFolder.getSubFolderCount()); Loading @@ -1535,6 +1532,9 @@ public class BluetoothMapObexServer extends ServerRequestHandler { replyHeaders.setHeader(HeaderSet.APPLICATION_PARAMETER, outAppParams.encodeParams()); op.sendHeaders(replyHeaders); if (maxListCount != 0) { outStream = op.openOutputStream(); } } catch (IOException e1) { Log.w(TAG, "sendFolderListingRsp: IOException" + " - sending OBEX_HTTP_BAD_REQUEST Exception:", e1); Loading Loading @@ -1723,7 +1723,6 @@ public class BluetoothMapObexServer extends ServerRequestHandler { try { outBytes = mOutContent.getMessage(handle, appParams, mCurrentFolder, version); outStream = op.openOutputStream(); // If it is a fraction request of Email message, set header before responding if ((BluetoothMapUtils.getMsgTypeFromHandle(handle).equals(TYPE.EMAIL) Loading @@ -1742,6 +1741,7 @@ public class BluetoothMapObexServer extends ServerRequestHandler { + "set FRACTION_DELIVER_LAST header"); } } outStream = op.openOutputStream(); } catch (IOException e) { Log.w(TAG, "sendGetMessageRsp: IOException - sending OBEX_HTTP_BAD_REQUEST", e); Loading android/app/src/com/android/bluetooth/map/BluetoothMapService.java +44 −12 Original line number Diff line number Diff line Loading @@ -148,7 +148,7 @@ public class BluetoothMapService extends ProfileService { private boolean mSdpSearchInitiated = false; SdpMnsRecord mMnsRecord = null; private MapServiceMessageHandler mSessionStatusHandler; private boolean mStartError = true; private boolean mServiceStarted = false; private boolean mSmsCapable = true; Loading @@ -165,7 +165,8 @@ public class BluetoothMapService extends ProfileService { if (DEBUG) { Log.d(TAG, "MAP Service closeService in"); } // Mark MapService Started as false while shutdown ongoing. mServiceStarted = false; if (mBluetoothMnsObexClient != null) { mBluetoothMnsObexClient.shutdown(); mBluetoothMnsObexClient = null; Loading Loading @@ -505,7 +506,7 @@ public class BluetoothMapService extends ProfileService { } protected boolean isMapStarted() { return !mStartError; return mServiceStarted; } public static BluetoothDevice getRemoteDevice() { Loading Loading @@ -672,8 +673,8 @@ public class BluetoothMapService extends ProfileService { // start RFCOMM listener sendStartListenerMessage(-1); mStartError = false; return !mStartError; mServiceStarted = true; return mServiceStarted; } /** Loading Loading @@ -844,7 +845,8 @@ public class BluetoothMapService extends ProfileService { //TODO: Check if the profile state can be retreived from ProfileService or AdapterService. if (!isMapStarted()) { if (DEBUG) { Log.d(TAG, "Service Not Available to STOP, ignoring"); Log.d(TAG, "Service Not Available to STOP or Shutdown already" + " in progress - Ignoring"); } return true; } else { Loading @@ -852,11 +854,13 @@ public class BluetoothMapService extends ProfileService { Log.d(TAG, "Service Stoping()"); } } // setState Disconnect already handled from closeService. // Handle it otherwise - Redundant for backup? setState(BluetoothMap.STATE_DISCONNECTED, BluetoothMap.RESULT_CANCELED); if (mSessionStatusHandler != null) { sendShutdownMessage(); } mStartError = true; setState(BluetoothMap.STATE_DISCONNECTED, BluetoothMap.RESULT_CANCELED); mServiceStarted = false; return true; } Loading @@ -865,10 +869,26 @@ public class BluetoothMapService extends ProfileService { if (DEBUG) { Log.d(TAG, "cleanup()"); } // Stop MapProfile if already started. // TODO: Check if the profile state can be retreived from ProfileService or AdapterService. if (!isMapStarted()) { if (DEBUG) { Log.d(TAG, "Service Not Available to STOP or Shutdown already" + " in progress - Ignoring"); } return true; } else { if (VERBOSE) Log.d(TAG, "Service Stoping()"); } // SetState Disconnect already handled from closeService. // Handle it otherwise. Redundant for backup ? setState(BluetoothMap.STATE_DISCONNECTED, BluetoothMap.RESULT_CANCELED); //Cleanup already handled in Stop(). //Move this extra check to Handler. if (mSessionStatusHandler != null) { sendShutdownMessage(); } mServiceStarted = false; return true; } Loading Loading @@ -1057,10 +1077,22 @@ public class BluetoothMapService extends ProfileService { int state = intent.getIntExtra(BluetoothAdapter.EXTRA_STATE, BluetoothAdapter.ERROR); if (state == BluetoothAdapter.STATE_TURNING_OFF) { if (DEBUG) Log.d(TAG, "STATE_TURNING_OFF"); // Stop MapProfile if already started. if (!isMapStarted()) { if (DEBUG) { Log.d(TAG, "STATE_TURNING_OFF"); Log.d(TAG, "Service Not Available to STOP or Shutdown already" + " in progress - Ignoring"); } } else if (mSessionStatusHandler != null) { if (VERBOSE) Log.d(TAG, "Service Stoping()"); sendShutdownMessage(); } else { if (DEBUG) { Log.d(TAG, "Unable to perform STOP or Shutdown already" + " in progress - Ignoring"); } } } else if (state == BluetoothAdapter.STATE_ON) { if (DEBUG) { Log.d(TAG, "STATE_ON"); Loading android/app/src/com/android/bluetooth/pbap/BluetoothPbapObexServer.java +2 −0 Original line number Diff line number Diff line Loading @@ -50,6 +50,7 @@ import java.text.CharacterIterator; import java.text.StringCharacterIterator; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import javax.obex.ApplicationParameter; import javax.obex.HeaderSet; Loading Loading @@ -838,6 +839,7 @@ public class BluetoothPbapObexServer extends ServerRequestHandler { // query the number, to get the names ArrayList<String> names = mVcardManager.getContactNamesByNumber(appParamValue.searchValue); if (mOrderBy == ORDER_BY_ALPHABETICAL) Collections.sort(names); for (int i = 0; i < names.size(); i++) { compareValue = names.get(i).trim(); if (D) { Loading Loading
android/app/src/com/android/bluetooth/hid/HidDeviceService.java +5 −7 Original line number Diff line number Diff line Loading @@ -18,7 +18,6 @@ package com.android.bluetooth.hid; import android.bluetooth.BluetoothDevice; import android.bluetooth.BluetoothHidDevice; import android.bluetooth.BluetoothHidDeviceAppConfiguration; import android.bluetooth.BluetoothHidDeviceAppQosSettings; import android.bluetooth.BluetoothHidDeviceAppSdpSettings; import android.bluetooth.BluetoothProfile; Loading Loading @@ -94,8 +93,7 @@ public class HidDeviceService extends ProfileService { try { if (mCallback != null) { // TODO(hsz) remove AppConfig in frameworks/base in the follow-up CL mCallback.onAppStatusChanged(device, null, success); mCallback.onAppStatusChanged(device, success); } else { break; } Loading Loading @@ -283,9 +281,9 @@ public class HidDeviceService extends ProfileService { } @Override public boolean registerApp(BluetoothHidDeviceAppConfiguration config, BluetoothHidDeviceAppSdpSettings sdp, BluetoothHidDeviceAppQosSettings inQos, BluetoothHidDeviceAppQosSettings outQos, IBluetoothHidDeviceCallback callback) { public boolean registerApp(BluetoothHidDeviceAppSdpSettings sdp, BluetoothHidDeviceAppQosSettings inQos, BluetoothHidDeviceAppQosSettings outQos, IBluetoothHidDeviceCallback callback) { if (DBG) { Log.d(TAG, "registerApp()"); } Loading @@ -299,7 +297,7 @@ public class HidDeviceService extends ProfileService { } @Override public boolean unregisterApp(BluetoothHidDeviceAppConfiguration config) { public boolean unregisterApp() { if (DBG) { Log.d(TAG, "unregisterApp()"); } Loading
android/app/src/com/android/bluetooth/map/BluetoothMapMasInstance.java +3 −2 Original line number Diff line number Diff line Loading @@ -410,8 +410,9 @@ public class BluetoothMapMasInstance implements IObexConnectionHandler { removeSdpRecord(); closeConnectionSocket(); closeServerSockets(true); // Do not block for Accept thread cleanup. // Fix Handler Thread block during BT Turn OFF. closeServerSockets(false); } /** Loading
android/app/src/com/android/bluetooth/map/BluetoothMapObexServer.java +8 −8 Original line number Diff line number Diff line Loading @@ -1174,9 +1174,6 @@ public class BluetoothMapObexServer extends ServerRequestHandler { } try { // Open the OBEX body stream outStream = op.openOutputStream(); if (appParams.getMaxListCount() == BluetoothMapAppParams.INVALID_VALUE_PARAMETER) { appParams.setMaxListCount(1024); } Loading Loading @@ -1229,6 +1226,8 @@ public class BluetoothMapObexServer extends ServerRequestHandler { replyHeaders.setHeader(HeaderSet.APPLICATION_PARAMETER, outAppParams.encodeParams()); op.sendHeaders(replyHeaders); // Open the OBEX body stream outStream = op.openOutputStream(); } catch (IOException e) { Log.w(TAG, "sendMessageListingRsp: IOException - sending OBEX_HTTP_BAD_REQUEST", e); if (outStream != null) { Loading Loading @@ -1366,9 +1365,6 @@ public class BluetoothMapObexServer extends ServerRequestHandler { // Check to see if we only need to send the size - hence no need to encode. try { // Open the OBEX body stream outStream = op.openOutputStream(); if (appParams.getMaxListCount() == BluetoothMapAppParams.INVALID_VALUE_PARAMETER) { appParams.setMaxListCount(1024); } Loading Loading @@ -1416,6 +1412,8 @@ public class BluetoothMapObexServer extends ServerRequestHandler { replyHeaders.setHeader(HeaderSet.APPLICATION_PARAMETER, outAppParams.encodeParams()); op.sendHeaders(replyHeaders); // Open the OBEX body stream outStream = op.openOutputStream(); } catch (IOException e) { Log.w(TAG, "sendConvoListingRsp: IOException - sending OBEX_HTTP_BAD_REQUEST", e); if (outStream != null) { Loading Loading @@ -1524,7 +1522,6 @@ public class BluetoothMapObexServer extends ServerRequestHandler { if (maxListCount != 0) { outBytes = mCurrentFolder.encode(listStartOffset, maxListCount); outStream = op.openOutputStream(); } else { // ESR08 specified that this shall only be included for MaxListCount=0 outAppParams.setFolderListingSize(mCurrentFolder.getSubFolderCount()); Loading @@ -1535,6 +1532,9 @@ public class BluetoothMapObexServer extends ServerRequestHandler { replyHeaders.setHeader(HeaderSet.APPLICATION_PARAMETER, outAppParams.encodeParams()); op.sendHeaders(replyHeaders); if (maxListCount != 0) { outStream = op.openOutputStream(); } } catch (IOException e1) { Log.w(TAG, "sendFolderListingRsp: IOException" + " - sending OBEX_HTTP_BAD_REQUEST Exception:", e1); Loading Loading @@ -1723,7 +1723,6 @@ public class BluetoothMapObexServer extends ServerRequestHandler { try { outBytes = mOutContent.getMessage(handle, appParams, mCurrentFolder, version); outStream = op.openOutputStream(); // If it is a fraction request of Email message, set header before responding if ((BluetoothMapUtils.getMsgTypeFromHandle(handle).equals(TYPE.EMAIL) Loading @@ -1742,6 +1741,7 @@ public class BluetoothMapObexServer extends ServerRequestHandler { + "set FRACTION_DELIVER_LAST header"); } } outStream = op.openOutputStream(); } catch (IOException e) { Log.w(TAG, "sendGetMessageRsp: IOException - sending OBEX_HTTP_BAD_REQUEST", e); Loading
android/app/src/com/android/bluetooth/map/BluetoothMapService.java +44 −12 Original line number Diff line number Diff line Loading @@ -148,7 +148,7 @@ public class BluetoothMapService extends ProfileService { private boolean mSdpSearchInitiated = false; SdpMnsRecord mMnsRecord = null; private MapServiceMessageHandler mSessionStatusHandler; private boolean mStartError = true; private boolean mServiceStarted = false; private boolean mSmsCapable = true; Loading @@ -165,7 +165,8 @@ public class BluetoothMapService extends ProfileService { if (DEBUG) { Log.d(TAG, "MAP Service closeService in"); } // Mark MapService Started as false while shutdown ongoing. mServiceStarted = false; if (mBluetoothMnsObexClient != null) { mBluetoothMnsObexClient.shutdown(); mBluetoothMnsObexClient = null; Loading Loading @@ -505,7 +506,7 @@ public class BluetoothMapService extends ProfileService { } protected boolean isMapStarted() { return !mStartError; return mServiceStarted; } public static BluetoothDevice getRemoteDevice() { Loading Loading @@ -672,8 +673,8 @@ public class BluetoothMapService extends ProfileService { // start RFCOMM listener sendStartListenerMessage(-1); mStartError = false; return !mStartError; mServiceStarted = true; return mServiceStarted; } /** Loading Loading @@ -844,7 +845,8 @@ public class BluetoothMapService extends ProfileService { //TODO: Check if the profile state can be retreived from ProfileService or AdapterService. if (!isMapStarted()) { if (DEBUG) { Log.d(TAG, "Service Not Available to STOP, ignoring"); Log.d(TAG, "Service Not Available to STOP or Shutdown already" + " in progress - Ignoring"); } return true; } else { Loading @@ -852,11 +854,13 @@ public class BluetoothMapService extends ProfileService { Log.d(TAG, "Service Stoping()"); } } // setState Disconnect already handled from closeService. // Handle it otherwise - Redundant for backup? setState(BluetoothMap.STATE_DISCONNECTED, BluetoothMap.RESULT_CANCELED); if (mSessionStatusHandler != null) { sendShutdownMessage(); } mStartError = true; setState(BluetoothMap.STATE_DISCONNECTED, BluetoothMap.RESULT_CANCELED); mServiceStarted = false; return true; } Loading @@ -865,10 +869,26 @@ public class BluetoothMapService extends ProfileService { if (DEBUG) { Log.d(TAG, "cleanup()"); } // Stop MapProfile if already started. // TODO: Check if the profile state can be retreived from ProfileService or AdapterService. if (!isMapStarted()) { if (DEBUG) { Log.d(TAG, "Service Not Available to STOP or Shutdown already" + " in progress - Ignoring"); } return true; } else { if (VERBOSE) Log.d(TAG, "Service Stoping()"); } // SetState Disconnect already handled from closeService. // Handle it otherwise. Redundant for backup ? setState(BluetoothMap.STATE_DISCONNECTED, BluetoothMap.RESULT_CANCELED); //Cleanup already handled in Stop(). //Move this extra check to Handler. if (mSessionStatusHandler != null) { sendShutdownMessage(); } mServiceStarted = false; return true; } Loading Loading @@ -1057,10 +1077,22 @@ public class BluetoothMapService extends ProfileService { int state = intent.getIntExtra(BluetoothAdapter.EXTRA_STATE, BluetoothAdapter.ERROR); if (state == BluetoothAdapter.STATE_TURNING_OFF) { if (DEBUG) Log.d(TAG, "STATE_TURNING_OFF"); // Stop MapProfile if already started. if (!isMapStarted()) { if (DEBUG) { Log.d(TAG, "STATE_TURNING_OFF"); Log.d(TAG, "Service Not Available to STOP or Shutdown already" + " in progress - Ignoring"); } } else if (mSessionStatusHandler != null) { if (VERBOSE) Log.d(TAG, "Service Stoping()"); sendShutdownMessage(); } else { if (DEBUG) { Log.d(TAG, "Unable to perform STOP or Shutdown already" + " in progress - Ignoring"); } } } else if (state == BluetoothAdapter.STATE_ON) { if (DEBUG) { Log.d(TAG, "STATE_ON"); Loading
android/app/src/com/android/bluetooth/pbap/BluetoothPbapObexServer.java +2 −0 Original line number Diff line number Diff line Loading @@ -50,6 +50,7 @@ import java.text.CharacterIterator; import java.text.StringCharacterIterator; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import javax.obex.ApplicationParameter; import javax.obex.HeaderSet; Loading Loading @@ -838,6 +839,7 @@ public class BluetoothPbapObexServer extends ServerRequestHandler { // query the number, to get the names ArrayList<String> names = mVcardManager.getContactNamesByNumber(appParamValue.searchValue); if (mOrderBy == ORDER_BY_ALPHABETICAL) Collections.sort(names); for (int i = 0; i < names.size(); i++) { compareValue = names.get(i).trim(); if (D) { Loading