diff options
| author | Treehugger Robot <treehugger-gerrit@google.com> | 2021-07-21 14:08:12 +0000 |
|---|---|---|
| committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2021-07-21 14:08:12 +0000 |
| commit | 3359a2689ec97bb6dc623d14b33ac8c8b8af0e0c (patch) | |
| tree | 4a59f510ee58b1f9cc460ceb9dbe4e7f0307a74e | |
| parent | 2849ea2f8b2e11d2d56c308777bb64e92a207557 (diff) | |
| parent | 1764877a3bf5036c280016c3ee4a050df6a8ea8b (diff) | |
| download | platform_packages_apps_Nfc-3359a2689ec97bb6dc623d14b33ac8c8b8af0e0c.tar.gz platform_packages_apps_Nfc-3359a2689ec97bb6dc623d14b33ac8c8b8af0e0c.tar.bz2 platform_packages_apps_Nfc-3359a2689ec97bb6dc623d14b33ac8c8b8af0e0c.zip | |
Merge "Fix bluetooth peripheral handover issue" am: cb742da6cb am: 1764877a3b
Original change: https://android-review.googlesource.com/c/platform/packages/apps/Nfc/+/1754210
Change-Id: Ib434da93a2e827274459262540fad265ae4942d4
| -rw-r--r-- | src/com/android/nfc/handover/PeripheralHandoverService.java | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/com/android/nfc/handover/PeripheralHandoverService.java b/src/com/android/nfc/handover/PeripheralHandoverService.java index 70364a57..b4b0d5f4 100644 --- a/src/com/android/nfc/handover/PeripheralHandoverService.java +++ b/src/com/android/nfc/handover/PeripheralHandoverService.java @@ -121,14 +121,17 @@ public class PeripheralHandoverService extends Service implements BluetoothPerip if (intent == null) { if (DBG) Log.e(TAG, "Intent is null, can't do peripheral handover."); - stopSelf(startId); + synchronized (sLock) { + stopSelf(startId); + mStartId = 0; + } return START_NOT_STICKY; } if (doPeripheralHandover(intent.getExtras())) { return START_STICKY; } else { - stopSelf(startId); + onBluetoothPeripheralHandoverComplete(false); return START_NOT_STICKY; } } @@ -185,14 +188,12 @@ public class PeripheralHandoverService extends Service implements BluetoothPerip } if (mBluetoothAdapter.isEnabled()) { if (!mBluetoothPeripheralHandover.start()) { - mHandler.removeMessages(MSG_PAUSE_POLLING); - mNfcAdapter.resumePolling(); + return false; } } else { // Once BT is enabled, the headset pairing will be started if (!enableBluetooth()) { Log.e(TAG, "Error enabling Bluetooth."); - mBluetoothPeripheralHandover = null; return false; } } @@ -208,7 +209,7 @@ public class PeripheralHandoverService extends Service implements BluetoothPerip if (mBluetoothPeripheralHandover != null && !mBluetoothPeripheralHandover.hasStarted()) { if (!mBluetoothPeripheralHandover.start()) { - mNfcAdapter.resumePolling(); + onBluetoothPeripheralHandoverComplete(false); } } } |
