Loading res/values/strings.xml +3 −0 Original line number Diff line number Diff line Loading @@ -1444,6 +1444,9 @@ <!-- Title for the dialog to enter PIN. [CHAR LIMIT=40] --> <string name="bluetooth_pairing_request">Pair with <xliff:g id="device_name">%1$s</xliff:g>?</string> <!-- Message when a bluetooth device from a coordinated set is bonding late. [CHAR LIMIT=NONE] --> <string name="bluetooth_pairing_group_late_bonding">Add new member to the existing coordinated set</string> <!-- Message when bluetooth is informing the user of the pairing key. [CHAR LIMIT=NONE] --> <string name="bluetooth_pairing_key_msg">Bluetooth pairing code</string> Loading src/com/android/settings/bluetooth/BluetoothPairingController.java +15 −1 Original line number Diff line number Diff line Loading @@ -72,6 +72,7 @@ public class BluetoothPairingController implements OnCheckedChangeListener, private boolean mIsCoordinatedSetMember; private boolean mIsLeAudio; private boolean mIsLeContactSharingEnabled; private boolean mIsLateBonding; /** * Creates an instance of a BluetoothPairingController. Loading @@ -98,6 +99,7 @@ public class BluetoothPairingController implements OnCheckedChangeListener, mDeviceName = mBluetoothManager.getCachedDeviceManager().getName(mDevice); mPbapClientProfile = mBluetoothManager.getProfileManager().getPbapClientProfile(); mPasskeyFormatted = formatKey(mPasskey); mIsLateBonding = mBluetoothManager.getCachedDeviceManager().isLateBonding(mDevice); final CachedBluetoothDevice cachedDevice = mBluetoothManager.getCachedDeviceManager().findDevice(mDevice); Loading @@ -116,7 +118,10 @@ public class BluetoothPairingController implements OnCheckedChangeListener, mIsLeContactSharingEnabled = DeviceConfig.getBoolean(DeviceConfig.NAMESPACE_SETTINGS_UI, SettingsUIDeviceConfig.BT_LE_AUDIO_CONTACT_SHARING_ENABLED, true); Log.d(TAG, "BT_LE_AUDIO_CONTACT_SHARING_ENABLED is " + mIsLeContactSharingEnabled); Log.d(TAG, "BT_LE_AUDIO_CONTACT_SHARING_ENABLED is " + mIsLeContactSharingEnabled + " isCooridnatedSetMember " + mIsCoordinatedSetMember); } } Loading Loading @@ -192,6 +197,15 @@ public class BluetoothPairingController implements OnCheckedChangeListener, return mIsCoordinatedSetMember; } /** * A method for querying if the bluetooth device from a coordinated set is bonding late. * * @return - A boolean indicating if the device is bonding late. */ public boolean isLateBonding() { return mIsLateBonding; } /** * A method for querying if the bluetooth device has a profile already set up on this device. * Loading src/com/android/settings/bluetooth/BluetoothPairingDialogFragment.java +8 −2 Original line number Diff line number Diff line Loading @@ -357,8 +357,14 @@ public class BluetoothPairingDialogFragment extends InstrumentedDialogFragment i pairingViewContent.setText(mPairingController.getPairingContent()); } final TextView messagePairingSet = (TextView) view.findViewById(R.id.pairing_group_message); messagePairingSet.setVisibility(mPairingController.isCoordinatedSetMemberDevice() ? View.VISIBLE : View.GONE); if (mPairingController.isLateBonding()) { messagePairingSet.setText(getString(R.string.bluetooth_pairing_group_late_bonding)); } boolean setPairingMessage = mPairingController.isCoordinatedSetMemberDevice() || mPairingController.isLateBonding(); messagePairingSet.setVisibility(setPairingMessage ? View.VISIBLE : View.GONE); return view; } } src/com/android/settings/bluetooth/BluetoothPairingRequest.java +17 −5 Original line number Diff line number Diff line Loading @@ -26,6 +26,7 @@ import android.os.UserHandle; import android.text.TextUtils; import android.util.Log; import com.android.settingslib.bluetooth.CachedBluetoothDevice; import com.android.settingslib.bluetooth.LocalBluetoothManager; /** Loading Loading @@ -53,17 +54,28 @@ public final class BluetoothPairingRequest extends BroadcastReceiver { boolean shouldShowDialog = LocalBluetoothPreferences.shouldShowDialogInForeground( context, device); // Skips consent pairing dialog if the device was recently associated with CDM Log.d(TAG, "Receive ACTION_PAIRING_REQUEST pairingVariant=" + pairingVariant + " canBondWithoutDialog=" + device.canBondWithoutDialog() + " isOngoingPairByCsip=" + mBluetoothManager.getCachedDeviceManager().isOngoingPairByCsip(device) + " isLateBonding=" + mBluetoothManager.getCachedDeviceManager().isLateBonding(device)); /* Skips consent pairing dialog if the device was recently associated with CDM * or if the device is a member of the coordinated set and is not bonding late. */ if (pairingVariant == BluetoothDevice.PAIRING_VARIANT_CONSENT && (device.canBondWithoutDialog() || mBluetoothManager.getCachedDeviceManager().isOngoingPairByCsip(device))) { || (mBluetoothManager.getCachedDeviceManager().isOngoingPairByCsip(device) && !mBluetoothManager.getCachedDeviceManager().isLateBonding(device)))) { device.setPairingConfirmation(true); } else if (powerManager.isInteractive() && shouldShowDialog) { // Since the screen is on and the BT-related activity is in the foreground, // just open the dialog // convert broadcast intent into activity intent (same action string) Intent pairingIntent = BluetoothPairingService.getPairingDialogIntent(context, intent, BluetoothDevice.EXTRA_PAIRING_INITIATOR_FOREGROUND); Intent pairingIntent = BluetoothPairingService.getPairingDialogIntent( context, intent, BluetoothDevice.EXTRA_PAIRING_INITIATOR_FOREGROUND); context.startActivityAsUser(pairingIntent, UserHandle.CURRENT); } else { Loading Loading
res/values/strings.xml +3 −0 Original line number Diff line number Diff line Loading @@ -1444,6 +1444,9 @@ <!-- Title for the dialog to enter PIN. [CHAR LIMIT=40] --> <string name="bluetooth_pairing_request">Pair with <xliff:g id="device_name">%1$s</xliff:g>?</string> <!-- Message when a bluetooth device from a coordinated set is bonding late. [CHAR LIMIT=NONE] --> <string name="bluetooth_pairing_group_late_bonding">Add new member to the existing coordinated set</string> <!-- Message when bluetooth is informing the user of the pairing key. [CHAR LIMIT=NONE] --> <string name="bluetooth_pairing_key_msg">Bluetooth pairing code</string> Loading
src/com/android/settings/bluetooth/BluetoothPairingController.java +15 −1 Original line number Diff line number Diff line Loading @@ -72,6 +72,7 @@ public class BluetoothPairingController implements OnCheckedChangeListener, private boolean mIsCoordinatedSetMember; private boolean mIsLeAudio; private boolean mIsLeContactSharingEnabled; private boolean mIsLateBonding; /** * Creates an instance of a BluetoothPairingController. Loading @@ -98,6 +99,7 @@ public class BluetoothPairingController implements OnCheckedChangeListener, mDeviceName = mBluetoothManager.getCachedDeviceManager().getName(mDevice); mPbapClientProfile = mBluetoothManager.getProfileManager().getPbapClientProfile(); mPasskeyFormatted = formatKey(mPasskey); mIsLateBonding = mBluetoothManager.getCachedDeviceManager().isLateBonding(mDevice); final CachedBluetoothDevice cachedDevice = mBluetoothManager.getCachedDeviceManager().findDevice(mDevice); Loading @@ -116,7 +118,10 @@ public class BluetoothPairingController implements OnCheckedChangeListener, mIsLeContactSharingEnabled = DeviceConfig.getBoolean(DeviceConfig.NAMESPACE_SETTINGS_UI, SettingsUIDeviceConfig.BT_LE_AUDIO_CONTACT_SHARING_ENABLED, true); Log.d(TAG, "BT_LE_AUDIO_CONTACT_SHARING_ENABLED is " + mIsLeContactSharingEnabled); Log.d(TAG, "BT_LE_AUDIO_CONTACT_SHARING_ENABLED is " + mIsLeContactSharingEnabled + " isCooridnatedSetMember " + mIsCoordinatedSetMember); } } Loading Loading @@ -192,6 +197,15 @@ public class BluetoothPairingController implements OnCheckedChangeListener, return mIsCoordinatedSetMember; } /** * A method for querying if the bluetooth device from a coordinated set is bonding late. * * @return - A boolean indicating if the device is bonding late. */ public boolean isLateBonding() { return mIsLateBonding; } /** * A method for querying if the bluetooth device has a profile already set up on this device. * Loading
src/com/android/settings/bluetooth/BluetoothPairingDialogFragment.java +8 −2 Original line number Diff line number Diff line Loading @@ -357,8 +357,14 @@ public class BluetoothPairingDialogFragment extends InstrumentedDialogFragment i pairingViewContent.setText(mPairingController.getPairingContent()); } final TextView messagePairingSet = (TextView) view.findViewById(R.id.pairing_group_message); messagePairingSet.setVisibility(mPairingController.isCoordinatedSetMemberDevice() ? View.VISIBLE : View.GONE); if (mPairingController.isLateBonding()) { messagePairingSet.setText(getString(R.string.bluetooth_pairing_group_late_bonding)); } boolean setPairingMessage = mPairingController.isCoordinatedSetMemberDevice() || mPairingController.isLateBonding(); messagePairingSet.setVisibility(setPairingMessage ? View.VISIBLE : View.GONE); return view; } }
src/com/android/settings/bluetooth/BluetoothPairingRequest.java +17 −5 Original line number Diff line number Diff line Loading @@ -26,6 +26,7 @@ import android.os.UserHandle; import android.text.TextUtils; import android.util.Log; import com.android.settingslib.bluetooth.CachedBluetoothDevice; import com.android.settingslib.bluetooth.LocalBluetoothManager; /** Loading Loading @@ -53,17 +54,28 @@ public final class BluetoothPairingRequest extends BroadcastReceiver { boolean shouldShowDialog = LocalBluetoothPreferences.shouldShowDialogInForeground( context, device); // Skips consent pairing dialog if the device was recently associated with CDM Log.d(TAG, "Receive ACTION_PAIRING_REQUEST pairingVariant=" + pairingVariant + " canBondWithoutDialog=" + device.canBondWithoutDialog() + " isOngoingPairByCsip=" + mBluetoothManager.getCachedDeviceManager().isOngoingPairByCsip(device) + " isLateBonding=" + mBluetoothManager.getCachedDeviceManager().isLateBonding(device)); /* Skips consent pairing dialog if the device was recently associated with CDM * or if the device is a member of the coordinated set and is not bonding late. */ if (pairingVariant == BluetoothDevice.PAIRING_VARIANT_CONSENT && (device.canBondWithoutDialog() || mBluetoothManager.getCachedDeviceManager().isOngoingPairByCsip(device))) { || (mBluetoothManager.getCachedDeviceManager().isOngoingPairByCsip(device) && !mBluetoothManager.getCachedDeviceManager().isLateBonding(device)))) { device.setPairingConfirmation(true); } else if (powerManager.isInteractive() && shouldShowDialog) { // Since the screen is on and the BT-related activity is in the foreground, // just open the dialog // convert broadcast intent into activity intent (same action string) Intent pairingIntent = BluetoothPairingService.getPairingDialogIntent(context, intent, BluetoothDevice.EXTRA_PAIRING_INITIATOR_FOREGROUND); Intent pairingIntent = BluetoothPairingService.getPairingDialogIntent( context, intent, BluetoothDevice.EXTRA_PAIRING_INITIATOR_FOREGROUND); context.startActivityAsUser(pairingIntent, UserHandle.CURRENT); } else { Loading