diff options
author | Roman Birg <roman@cyngn.com> | 2016-06-10 06:16:30 -0700 |
---|---|---|
committer | Gerrit Code Review <gerrit@cyanogenmod.org> | 2016-06-23 15:53:38 -0700 |
commit | f4565979a3ce9763458b62801046adf6915529ff (patch) | |
tree | 23f874f6179590c1ade431691e95e16700de616e | |
parent | 22b8c47a0d43b6064345c52ef89eb718d7713058 (diff) | |
download | android_packages_apps_Bluetooth-f4565979a3ce9763458b62801046adf6915529ff.tar.gz android_packages_apps_Bluetooth-f4565979a3ce9763458b62801046adf6915529ff.tar.bz2 android_packages_apps_Bluetooth-f4565979a3ce9763458b62801046adf6915529ff.zip |
Bluetooth OPP: Fix mismerge
These changes are present in "BT: Fix following issues in data profiles"
with commit id 49c3eb7394d46b51556fad6e31b21f90c0d54675
CYNGNOS-2866
Change-Id: I2932939a71fc38d1e4f070c158af7cde664db07d
(cherry picked from commit 5080b9b7293800b9f2be6887096f1eb54e1c55fc)
-rw-r--r-- | src/com/android/bluetooth/opp/BluetoothOppService.java | 59 |
1 files changed, 20 insertions, 39 deletions
diff --git a/src/com/android/bluetooth/opp/BluetoothOppService.java b/src/com/android/bluetooth/opp/BluetoothOppService.java index 4edf4dd7a..bf1d60e29 100644 --- a/src/com/android/bluetooth/opp/BluetoothOppService.java +++ b/src/com/android/bluetooth/opp/BluetoothOppService.java @@ -158,6 +158,8 @@ public class BluetoothOppService extends Service { super.onCreate(); if (D) Log.d(TAG, "onCreate"); mAdapter = BluetoothAdapter.getDefaultAdapter(); + mSocketListener = new BluetoothOppRfcommListener(mAdapter); + mL2cSocketListener = new BluetoothOppL2capListener(mAdapter); mShares = Lists.newArrayList(); mBatchs = Lists.newArrayList(); mObserver = new BluetoothShareContentObserver(); @@ -241,11 +243,9 @@ public class BluetoothOppService extends Service { } if(mSocketListener != null){ mSocketListener.stop(); - mSocketListener = null; } if(mL2cSocketListener != null){ mL2cSocketListener.stop(); - mL2cSocketListener = null; } mListenStarted = false; //Stop Active INBOUND Transfer @@ -360,50 +360,31 @@ public class BluetoothOppService extends Service { private void startSocketListener() { - Log.d(TAG, "start Socket Listeners"); - - if(mSocketListener != null){ - Log.d(TAG, "rfcomm listener active, stopping it"); - mSocketListener.stop(); - mSocketListener = null; - } - if(mL2cSocketListener != null){ - Log.d(TAG, "l2cap listener active, stopping it"); - mL2cSocketListener.stop(); - mL2cSocketListener = null; - } - mSocketListener = new BluetoothOppRfcommListener(mAdapter); - mL2cSocketListener = new BluetoothOppL2capListener(mAdapter); - if (mSocketListener != null && mL2cSocketListener != null) { - - if ( ( mSocketListener.openRfcommSocket() != null) && - ( mL2cSocketListener.openL2capSocket() != null) && - SdpManager.getDefaultManager() != null) { - mOppSdpHandle = SdpManager.getDefaultManager() - .createOppOpsRecord("OBEX Object Push", mSocketListener.getRfcommChannel(), - mL2cSocketListener.getL2capPsm(), 0x0102, SdpManager.OPP_FORMAT_ALL); - mSocketListener.start(mHandler); - mL2cSocketListener.start(mHandler); - } else { - Log.e(TAG, "ERROR:serversocket object is NULL"); - } - } + if (V) Log.v(TAG, "start Socket Listeners"); + if (mSocketListener != null && mL2cSocketListener != null) { + if ((mSocketListener.openRfcommSocket() != null) && + (mL2cSocketListener.openL2capSocket() != null) && + SdpManager.getDefaultManager() != null) { + mOppSdpHandle = SdpManager.getDefaultManager() + .createOppOpsRecord("OBEX Object Push", mSocketListener.getRfcommChannel(), + mL2cSocketListener.getL2capPsm(), 0x0102, SdpManager.OPP_FORMAT_ALL); + mSocketListener.start(mHandler); + mL2cSocketListener.start(mHandler); + } else { + Log.e(TAG, "ERROR:serversocket object is NULL"); + } + } } + @Override public void onDestroy() { if (V) Log.v(TAG, "onDestroy"); super.onDestroy(); getContentResolver().unregisterContentObserver(mObserver); unregisterReceiver(mBluetoothReceiver); - if(mSocketListener != null) { - mSocketListener.stop(); - mSocketListener = null; - } - if(mL2cSocketListener != null) { - mL2cSocketListener.stop(); - mL2cSocketListener = null; - } + mSocketListener.stop(); + mL2cSocketListener.stop(); if(mBatchs != null) { mBatchs.clear(); @@ -430,7 +411,7 @@ public class BluetoothOppService extends Service { String action = intent.getAction(); if (action.equals(BluetoothAdapter.ACTION_STATE_CHANGED)) { - switch (intent.getIntExtra(BluetoothAdapter.EXTRA_STATE, BluetoothAdapter.ERROR)) { + switch (mAdapter.getState()) { case BluetoothAdapter.STATE_ON: if (V) Log.v(TAG, "Receiver BLUETOOTH_STATE_CHANGED_ACTION, BLUETOOTH_STATE_ON"); |