Loading core/java/android/bluetooth/BluetoothDevice.java +8 −0 Original line number Diff line number Diff line Loading @@ -895,6 +895,14 @@ public final class BluetoothDevice implements Parcelable { return false; } /** @hide */ public boolean isBondingInitiatedLocally() { try { return sService.isBondingInitiatedLocally(this); } catch (RemoteException e) {Log.e(TAG, "", e);} return false; } /** * Set the Out Of Band data for a remote device to be used later * in the pairing mechanism. Users can obtain this data through other Loading core/java/android/bluetooth/IBluetooth.aidl +1 −0 Original line number Diff line number Diff line Loading @@ -62,6 +62,7 @@ interface IBluetooth boolean cancelBondProcess(in BluetoothDevice device); boolean removeBond(in BluetoothDevice device); int getBondState(in BluetoothDevice device); boolean isBondingInitiatedLocally(in BluetoothDevice device); int getConnectionState(in BluetoothDevice device); String getRemoteName(in BluetoothDevice device); Loading packages/SettingsLib/src/com/android/settingslib/bluetooth/CachedBluetoothDevice.java +2 −8 Original line number Diff line number Diff line Loading @@ -102,9 +102,6 @@ public final class CachedBluetoothDevice implements Comparable<CachedBluetoothDe private static final long MAX_UUID_DELAY_FOR_AUTO_CONNECT = 5000; private static final long MAX_HOGP_DELAY_FOR_AUTO_CONNECT = 30000; /** Auto-connect after pairing only if locally initiated. */ private boolean mConnectAfterPairing; /** * Describes the current device and profile for logging. * Loading Loading @@ -300,7 +297,6 @@ public final class CachedBluetoothDevice implements Comparable<CachedBluetoothDe return false; } mConnectAfterPairing = true; // auto-connect after pairing return true; } Loading @@ -309,7 +305,7 @@ public final class CachedBluetoothDevice implements Comparable<CachedBluetoothDe * slightly different for local vs. remote initiated pairing dialogs. */ boolean isUserInitiatedPairing() { return mConnectAfterPairing; return mDevice.isBondingInitiatedLocally(); } public void unpair() { Loading Loading @@ -549,7 +545,6 @@ public final class CachedBluetoothDevice implements Comparable<CachedBluetoothDe void onBondingStateChanged(int bondState) { if (bondState == BluetoothDevice.BOND_NONE) { mProfiles.clear(); mConnectAfterPairing = false; // cancel auto-connect setPhonebookPermissionChoice(ACCESS_UNKNOWN); setMessagePermissionChoice(ACCESS_UNKNOWN); setSimPermissionChoice(ACCESS_UNKNOWN); Loading @@ -562,10 +557,9 @@ public final class CachedBluetoothDevice implements Comparable<CachedBluetoothDe if (bondState == BluetoothDevice.BOND_BONDED) { if (mDevice.isBluetoothDock()) { onBondingDockConnect(); } else if (mConnectAfterPairing) { } else if (mDevice.isBondingInitiatedLocally()) { connect(false); } mConnectAfterPairing = false; } } Loading Loading
core/java/android/bluetooth/BluetoothDevice.java +8 −0 Original line number Diff line number Diff line Loading @@ -895,6 +895,14 @@ public final class BluetoothDevice implements Parcelable { return false; } /** @hide */ public boolean isBondingInitiatedLocally() { try { return sService.isBondingInitiatedLocally(this); } catch (RemoteException e) {Log.e(TAG, "", e);} return false; } /** * Set the Out Of Band data for a remote device to be used later * in the pairing mechanism. Users can obtain this data through other Loading
core/java/android/bluetooth/IBluetooth.aidl +1 −0 Original line number Diff line number Diff line Loading @@ -62,6 +62,7 @@ interface IBluetooth boolean cancelBondProcess(in BluetoothDevice device); boolean removeBond(in BluetoothDevice device); int getBondState(in BluetoothDevice device); boolean isBondingInitiatedLocally(in BluetoothDevice device); int getConnectionState(in BluetoothDevice device); String getRemoteName(in BluetoothDevice device); Loading
packages/SettingsLib/src/com/android/settingslib/bluetooth/CachedBluetoothDevice.java +2 −8 Original line number Diff line number Diff line Loading @@ -102,9 +102,6 @@ public final class CachedBluetoothDevice implements Comparable<CachedBluetoothDe private static final long MAX_UUID_DELAY_FOR_AUTO_CONNECT = 5000; private static final long MAX_HOGP_DELAY_FOR_AUTO_CONNECT = 30000; /** Auto-connect after pairing only if locally initiated. */ private boolean mConnectAfterPairing; /** * Describes the current device and profile for logging. * Loading Loading @@ -300,7 +297,6 @@ public final class CachedBluetoothDevice implements Comparable<CachedBluetoothDe return false; } mConnectAfterPairing = true; // auto-connect after pairing return true; } Loading @@ -309,7 +305,7 @@ public final class CachedBluetoothDevice implements Comparable<CachedBluetoothDe * slightly different for local vs. remote initiated pairing dialogs. */ boolean isUserInitiatedPairing() { return mConnectAfterPairing; return mDevice.isBondingInitiatedLocally(); } public void unpair() { Loading Loading @@ -549,7 +545,6 @@ public final class CachedBluetoothDevice implements Comparable<CachedBluetoothDe void onBondingStateChanged(int bondState) { if (bondState == BluetoothDevice.BOND_NONE) { mProfiles.clear(); mConnectAfterPairing = false; // cancel auto-connect setPhonebookPermissionChoice(ACCESS_UNKNOWN); setMessagePermissionChoice(ACCESS_UNKNOWN); setSimPermissionChoice(ACCESS_UNKNOWN); Loading @@ -562,10 +557,9 @@ public final class CachedBluetoothDevice implements Comparable<CachedBluetoothDe if (bondState == BluetoothDevice.BOND_BONDED) { if (mDevice.isBluetoothDock()) { onBondingDockConnect(); } else if (mConnectAfterPairing) { } else if (mDevice.isBondingInitiatedLocally()) { connect(false); } mConnectAfterPairing = false; } } Loading