Do not show phonebook access permission dialog if pairing dialog has already been shown.
Bug: 16964116, 13886947, 16345619 Change-Id: I9cf2622b49c3812771d57432fed030affaa5ba48
This commit is contained in:
@@ -85,6 +85,17 @@
|
|||||||
android:textColor="@*android:color/secondary_text_material_light"
|
android:textColor="@*android:color/secondary_text_material_light"
|
||||||
android:visibility="gone" />
|
android:visibility="gone" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/phonebook_sharing_message"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="@dimen/bluetooth_dialog_padding"
|
||||||
|
android:layout_marginEnd="@dimen/bluetooth_dialog_padding"
|
||||||
|
android:layout_marginBottom="@dimen/bluetooth_dialog_padding"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:text="@string/bluetooth_pairing_will_share_phonebook"
|
||||||
|
android:textSize="12sp" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
|
@@ -86,6 +86,17 @@
|
|||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/phonebook_sharing_message"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="@dimen/bluetooth_dialog_padding"
|
||||||
|
android:layout_marginEnd="@dimen/bluetooth_dialog_padding"
|
||||||
|
android:layout_marginBottom="@dimen/bluetooth_dialog_padding"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:text="@string/bluetooth_pairing_will_share_phonebook"
|
||||||
|
android:textSize="12sp" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
|
@@ -1165,6 +1165,9 @@
|
|||||||
<!-- Button text for declining an incoming pairing request. [CHAR LIMIT=20] -->
|
<!-- Button text for declining an incoming pairing request. [CHAR LIMIT=20] -->
|
||||||
<string name="bluetooth_pairing_decline">Cancel</string>
|
<string name="bluetooth_pairing_decline">Cancel</string>
|
||||||
|
|
||||||
|
<!-- Message in pairing dialogs. [CHAR LIMIT=NONE] -->
|
||||||
|
<string name="bluetooth_pairing_will_share_phonebook">Pairing grants access to your contacts and call history when connected.</string>
|
||||||
|
|
||||||
<!-- Title for BT error dialogs. -->
|
<!-- Title for BT error dialogs. -->
|
||||||
<string name="bluetooth_error_title"></string>
|
<string name="bluetooth_error_title"></string>
|
||||||
<!-- Message for the error dialog when BT pairing fails generically. -->
|
<!-- Message for the error dialog when BT pairing fails generically. -->
|
||||||
|
@@ -55,6 +55,9 @@ public final class BluetoothPairingDialog extends AlertActivity implements
|
|||||||
|
|
||||||
private static final int BLUETOOTH_PIN_MAX_LENGTH = 16;
|
private static final int BLUETOOTH_PIN_MAX_LENGTH = 16;
|
||||||
private static final int BLUETOOTH_PASSKEY_MAX_LENGTH = 6;
|
private static final int BLUETOOTH_PASSKEY_MAX_LENGTH = 6;
|
||||||
|
|
||||||
|
private LocalBluetoothManager mBluetoothManager;
|
||||||
|
private CachedBluetoothDeviceManager mCachedDeviceManager;
|
||||||
private BluetoothDevice mDevice;
|
private BluetoothDevice mDevice;
|
||||||
private int mType;
|
private int mType;
|
||||||
private String mPairingKey;
|
private String mPairingKey;
|
||||||
@@ -98,13 +101,13 @@ public final class BluetoothPairingDialog extends AlertActivity implements
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
LocalBluetoothManager manager = LocalBluetoothManager.getInstance(this);
|
mBluetoothManager = LocalBluetoothManager.getInstance(this);
|
||||||
if (manager == null) {
|
if (mBluetoothManager == null) {
|
||||||
Log.e(TAG, "Error: BluetoothAdapter not supported by system");
|
Log.e(TAG, "Error: BluetoothAdapter not supported by system");
|
||||||
finish();
|
finish();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
CachedBluetoothDeviceManager deviceManager = manager.getCachedDeviceManager();
|
mCachedDeviceManager = mBluetoothManager.getCachedDeviceManager();
|
||||||
|
|
||||||
mDevice = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);
|
mDevice = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);
|
||||||
mType = intent.getIntExtra(BluetoothDevice.EXTRA_PAIRING_VARIANT, BluetoothDevice.ERROR);
|
mType = intent.getIntExtra(BluetoothDevice.EXTRA_PAIRING_VARIANT, BluetoothDevice.ERROR);
|
||||||
@@ -112,7 +115,7 @@ public final class BluetoothPairingDialog extends AlertActivity implements
|
|||||||
switch (mType) {
|
switch (mType) {
|
||||||
case BluetoothDevice.PAIRING_VARIANT_PIN:
|
case BluetoothDevice.PAIRING_VARIANT_PIN:
|
||||||
case BluetoothDevice.PAIRING_VARIANT_PASSKEY:
|
case BluetoothDevice.PAIRING_VARIANT_PASSKEY:
|
||||||
createUserEntryDialog(deviceManager);
|
createUserEntryDialog();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BluetoothDevice.PAIRING_VARIANT_PASSKEY_CONFIRMATION:
|
case BluetoothDevice.PAIRING_VARIANT_PASSKEY_CONFIRMATION:
|
||||||
@@ -123,12 +126,12 @@ public final class BluetoothPairingDialog extends AlertActivity implements
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
mPairingKey = String.format(Locale.US, "%06d", passkey);
|
mPairingKey = String.format(Locale.US, "%06d", passkey);
|
||||||
createConfirmationDialog(deviceManager);
|
createConfirmationDialog();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BluetoothDevice.PAIRING_VARIANT_CONSENT:
|
case BluetoothDevice.PAIRING_VARIANT_CONSENT:
|
||||||
case BluetoothDevice.PAIRING_VARIANT_OOB_CONSENT:
|
case BluetoothDevice.PAIRING_VARIANT_OOB_CONSENT:
|
||||||
createConsentDialog(deviceManager);
|
createConsentDialog();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BluetoothDevice.PAIRING_VARIANT_DISPLAY_PASSKEY:
|
case BluetoothDevice.PAIRING_VARIANT_DISPLAY_PASSKEY:
|
||||||
@@ -144,7 +147,7 @@ public final class BluetoothPairingDialog extends AlertActivity implements
|
|||||||
} else {
|
} else {
|
||||||
mPairingKey = String.format("%04d", pairingKey);
|
mPairingKey = String.format("%04d", pairingKey);
|
||||||
}
|
}
|
||||||
createDisplayPasskeyOrPinDialog(deviceManager);
|
createDisplayPasskeyOrPinDialog();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@@ -159,10 +162,10 @@ public final class BluetoothPairingDialog extends AlertActivity implements
|
|||||||
registerReceiver(mReceiver, new IntentFilter(BluetoothDevice.ACTION_BOND_STATE_CHANGED));
|
registerReceiver(mReceiver, new IntentFilter(BluetoothDevice.ACTION_BOND_STATE_CHANGED));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createUserEntryDialog(CachedBluetoothDeviceManager deviceManager) {
|
private void createUserEntryDialog() {
|
||||||
final AlertController.AlertParams p = mAlertParams;
|
final AlertController.AlertParams p = mAlertParams;
|
||||||
p.mTitle = getString(R.string.bluetooth_pairing_request);
|
p.mTitle = getString(R.string.bluetooth_pairing_request);
|
||||||
p.mView = createPinEntryView(deviceManager.getName(mDevice));
|
p.mView = createPinEntryView();
|
||||||
p.mPositiveButtonText = getString(android.R.string.ok);
|
p.mPositiveButtonText = getString(android.R.string.ok);
|
||||||
p.mPositiveButtonListener = this;
|
p.mPositiveButtonListener = this;
|
||||||
p.mNegativeButtonText = getString(android.R.string.cancel);
|
p.mNegativeButtonText = getString(android.R.string.cancel);
|
||||||
@@ -173,7 +176,7 @@ public final class BluetoothPairingDialog extends AlertActivity implements
|
|||||||
mOkButton.setEnabled(false);
|
mOkButton.setEnabled(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
private View createPinEntryView(String deviceName) {
|
private View createPinEntryView() {
|
||||||
View view = getLayoutInflater().inflate(R.layout.bluetooth_pin_entry, null);
|
View view = getLayoutInflater().inflate(R.layout.bluetooth_pin_entry, null);
|
||||||
TextView messageViewCaption = (TextView) view.findViewById(R.id.message_caption);
|
TextView messageViewCaption = (TextView) view.findViewById(R.id.message_caption);
|
||||||
TextView messageViewContent = (TextView) view.findViewById(R.id.message_subhead);
|
TextView messageViewContent = (TextView) view.findViewById(R.id.message_subhead);
|
||||||
@@ -208,7 +211,7 @@ public final class BluetoothPairingDialog extends AlertActivity implements
|
|||||||
}
|
}
|
||||||
|
|
||||||
messageViewCaption.setText(messageId1);
|
messageViewCaption.setText(messageId1);
|
||||||
messageViewContent.setText(deviceName);
|
messageViewContent.setText(mCachedDeviceManager.getName(mDevice));
|
||||||
messageView2.setText(messageId2);
|
messageView2.setText(messageId2);
|
||||||
mPairingView.setInputType(InputType.TYPE_CLASS_NUMBER);
|
mPairingView.setInputType(InputType.TYPE_CLASS_NUMBER);
|
||||||
mPairingView.setFilters(new InputFilter[] {
|
mPairingView.setFilters(new InputFilter[] {
|
||||||
@@ -217,10 +220,10 @@ public final class BluetoothPairingDialog extends AlertActivity implements
|
|||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
|
||||||
private View createView(CachedBluetoothDeviceManager deviceManager) {
|
private View createView() {
|
||||||
View view = getLayoutInflater().inflate(R.layout.bluetooth_pin_confirm, null);
|
View view = getLayoutInflater().inflate(R.layout.bluetooth_pin_confirm, null);
|
||||||
// Escape device name to avoid HTML injection.
|
// Escape device name to avoid HTML injection.
|
||||||
String name = Html.escapeHtml(deviceManager.getName(mDevice));
|
String name = Html.escapeHtml(mCachedDeviceManager.getName(mDevice));
|
||||||
TextView messageViewCaption = (TextView) view.findViewById(R.id.message_caption);
|
TextView messageViewCaption = (TextView) view.findViewById(R.id.message_caption);
|
||||||
TextView messageViewContent = (TextView) view.findViewById(R.id.message_subhead);
|
TextView messageViewContent = (TextView) view.findViewById(R.id.message_subhead);
|
||||||
TextView pairingViewCaption = (TextView) view.findViewById(R.id.pairing_caption);
|
TextView pairingViewCaption = (TextView) view.findViewById(R.id.pairing_caption);
|
||||||
@@ -262,10 +265,10 @@ public final class BluetoothPairingDialog extends AlertActivity implements
|
|||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createConfirmationDialog(CachedBluetoothDeviceManager deviceManager) {
|
private void createConfirmationDialog() {
|
||||||
final AlertController.AlertParams p = mAlertParams;
|
final AlertController.AlertParams p = mAlertParams;
|
||||||
p.mTitle = getString(R.string.bluetooth_pairing_request);
|
p.mTitle = getString(R.string.bluetooth_pairing_request);
|
||||||
p.mView = createView(deviceManager);
|
p.mView = createView();
|
||||||
p.mPositiveButtonText = getString(R.string.bluetooth_pairing_accept);
|
p.mPositiveButtonText = getString(R.string.bluetooth_pairing_accept);
|
||||||
p.mPositiveButtonListener = this;
|
p.mPositiveButtonListener = this;
|
||||||
p.mNegativeButtonText = getString(R.string.bluetooth_pairing_decline);
|
p.mNegativeButtonText = getString(R.string.bluetooth_pairing_decline);
|
||||||
@@ -273,10 +276,10 @@ public final class BluetoothPairingDialog extends AlertActivity implements
|
|||||||
setupAlert();
|
setupAlert();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createConsentDialog(CachedBluetoothDeviceManager deviceManager) {
|
private void createConsentDialog() {
|
||||||
final AlertController.AlertParams p = mAlertParams;
|
final AlertController.AlertParams p = mAlertParams;
|
||||||
p.mTitle = getString(R.string.bluetooth_pairing_request);
|
p.mTitle = getString(R.string.bluetooth_pairing_request);
|
||||||
p.mView = createView(deviceManager);
|
p.mView = createView();
|
||||||
p.mPositiveButtonText = getString(R.string.bluetooth_pairing_accept);
|
p.mPositiveButtonText = getString(R.string.bluetooth_pairing_accept);
|
||||||
p.mPositiveButtonListener = this;
|
p.mPositiveButtonListener = this;
|
||||||
p.mNegativeButtonText = getString(R.string.bluetooth_pairing_decline);
|
p.mNegativeButtonText = getString(R.string.bluetooth_pairing_decline);
|
||||||
@@ -284,11 +287,10 @@ public final class BluetoothPairingDialog extends AlertActivity implements
|
|||||||
setupAlert();
|
setupAlert();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createDisplayPasskeyOrPinDialog(
|
private void createDisplayPasskeyOrPinDialog() {
|
||||||
CachedBluetoothDeviceManager deviceManager) {
|
|
||||||
final AlertController.AlertParams p = mAlertParams;
|
final AlertController.AlertParams p = mAlertParams;
|
||||||
p.mTitle = getString(R.string.bluetooth_pairing_request);
|
p.mTitle = getString(R.string.bluetooth_pairing_request);
|
||||||
p.mView = createView(deviceManager);
|
p.mView = createView();
|
||||||
p.mNegativeButtonText = getString(android.R.string.cancel);
|
p.mNegativeButtonText = getString(android.R.string.cancel);
|
||||||
p.mNegativeButtonListener = this;
|
p.mNegativeButtonListener = this;
|
||||||
setupAlert();
|
setupAlert();
|
||||||
@@ -315,7 +317,20 @@ public final class BluetoothPairingDialog extends AlertActivity implements
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void allowPhonebookAccess() {
|
||||||
|
CachedBluetoothDevice cachedDevice = mCachedDeviceManager.findDevice(mDevice);
|
||||||
|
if (cachedDevice == null) {
|
||||||
|
cachedDevice = mCachedDeviceManager.addDevice(
|
||||||
|
mBluetoothManager.getBluetoothAdapter(),
|
||||||
|
mBluetoothManager.getProfileManager(),
|
||||||
|
mDevice);
|
||||||
|
}
|
||||||
|
cachedDevice.setPhonebookPermissionChoice(CachedBluetoothDevice.ACCESS_ALLOWED);
|
||||||
|
}
|
||||||
|
|
||||||
private void onPair(String value) {
|
private void onPair(String value) {
|
||||||
|
allowPhonebookAccess();
|
||||||
|
|
||||||
switch (mType) {
|
switch (mType) {
|
||||||
case BluetoothDevice.PAIRING_VARIANT_PIN:
|
case BluetoothDevice.PAIRING_VARIANT_PIN:
|
||||||
byte[] pinBytes = BluetoothDevice.convertPinToBytes(value);
|
byte[] pinBytes = BluetoothDevice.convertPinToBytes(value);
|
||||||
|
@@ -68,8 +68,6 @@ final class CachedBluetoothDevice implements Comparable<CachedBluetoothDevice> {
|
|||||||
|
|
||||||
private int mMessagePermissionChoice;
|
private int mMessagePermissionChoice;
|
||||||
|
|
||||||
private int mPhonebookRejectedTimes;
|
|
||||||
|
|
||||||
private int mMessageRejectedTimes;
|
private int mMessageRejectedTimes;
|
||||||
|
|
||||||
private final Collection<Callback> mCallbacks = new ArrayList<Callback>();
|
private final Collection<Callback> mCallbacks = new ArrayList<Callback>();
|
||||||
@@ -87,7 +85,6 @@ final class CachedBluetoothDevice implements Comparable<CachedBluetoothDevice> {
|
|||||||
|
|
||||||
private final static String PHONEBOOK_PREFS_NAME = "bluetooth_phonebook_permission";
|
private final static String PHONEBOOK_PREFS_NAME = "bluetooth_phonebook_permission";
|
||||||
private final static String MESSAGE_PREFS_NAME = "bluetooth_message_permission";
|
private final static String MESSAGE_PREFS_NAME = "bluetooth_message_permission";
|
||||||
private final static String PHONEBOOK_REJECT_TIMES = "bluetooth_phonebook_reject";
|
|
||||||
private final static String MESSAGE_REJECT_TIMES = "bluetooth_message_reject";
|
private final static String MESSAGE_REJECT_TIMES = "bluetooth_message_reject";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -372,7 +369,6 @@ final class CachedBluetoothDevice implements Comparable<CachedBluetoothDevice> {
|
|||||||
updateProfiles();
|
updateProfiles();
|
||||||
fetchPhonebookPermissionChoice();
|
fetchPhonebookPermissionChoice();
|
||||||
fetchMessagePermissionChoice();
|
fetchMessagePermissionChoice();
|
||||||
fetchPhonebookRejectTimes();
|
|
||||||
fetchMessageRejectTimes();
|
fetchMessageRejectTimes();
|
||||||
|
|
||||||
mVisible = false;
|
mVisible = false;
|
||||||
@@ -541,8 +537,6 @@ final class CachedBluetoothDevice implements Comparable<CachedBluetoothDevice> {
|
|||||||
mConnectAfterPairing = false; // cancel auto-connect
|
mConnectAfterPairing = false; // cancel auto-connect
|
||||||
setPhonebookPermissionChoice(ACCESS_UNKNOWN);
|
setPhonebookPermissionChoice(ACCESS_UNKNOWN);
|
||||||
setMessagePermissionChoice(ACCESS_UNKNOWN);
|
setMessagePermissionChoice(ACCESS_UNKNOWN);
|
||||||
mPhonebookRejectedTimes = 0;
|
|
||||||
savePhonebookRejectTimes();
|
|
||||||
mMessageRejectedTimes = 0;
|
mMessageRejectedTimes = 0;
|
||||||
saveMessageRejectTimes();
|
saveMessageRejectTimes();
|
||||||
}
|
}
|
||||||
@@ -661,15 +655,6 @@ final class CachedBluetoothDevice implements Comparable<CachedBluetoothDevice> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void setPhonebookPermissionChoice(int permissionChoice) {
|
void setPhonebookPermissionChoice(int permissionChoice) {
|
||||||
// if user reject it, only save it when reject exceed limit.
|
|
||||||
if (permissionChoice == ACCESS_REJECTED) {
|
|
||||||
mPhonebookRejectedTimes++;
|
|
||||||
savePhonebookRejectTimes();
|
|
||||||
if (mPhonebookRejectedTimes < PERSIST_REJECTED_TIMES_LIMIT) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
mPhonebookPermissionChoice = permissionChoice;
|
mPhonebookPermissionChoice = permissionChoice;
|
||||||
|
|
||||||
SharedPreferences.Editor editor =
|
SharedPreferences.Editor editor =
|
||||||
@@ -689,24 +674,6 @@ final class CachedBluetoothDevice implements Comparable<CachedBluetoothDevice> {
|
|||||||
ACCESS_UNKNOWN);
|
ACCESS_UNKNOWN);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void fetchPhonebookRejectTimes() {
|
|
||||||
SharedPreferences preference = mContext.getSharedPreferences(PHONEBOOK_REJECT_TIMES,
|
|
||||||
Context.MODE_PRIVATE);
|
|
||||||
mPhonebookRejectedTimes = preference.getInt(mDevice.getAddress(), 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void savePhonebookRejectTimes() {
|
|
||||||
SharedPreferences.Editor editor =
|
|
||||||
mContext.getSharedPreferences(PHONEBOOK_REJECT_TIMES,
|
|
||||||
Context.MODE_PRIVATE).edit();
|
|
||||||
if (mPhonebookRejectedTimes == 0) {
|
|
||||||
editor.remove(mDevice.getAddress());
|
|
||||||
} else {
|
|
||||||
editor.putInt(mDevice.getAddress(), mPhonebookRejectedTimes);
|
|
||||||
}
|
|
||||||
editor.commit();
|
|
||||||
}
|
|
||||||
|
|
||||||
int getMessagePermissionChoice() {
|
int getMessagePermissionChoice() {
|
||||||
return mMessagePermissionChoice;
|
return mMessagePermissionChoice;
|
||||||
}
|
}
|
||||||
|
@@ -151,7 +151,6 @@ public final class DeviceProfilesSettings extends SettingsPreferenceFragment
|
|||||||
if (pbapPermission != CachedBluetoothDevice.ACCESS_UNKNOWN) {
|
if (pbapPermission != CachedBluetoothDevice.ACCESS_UNKNOWN) {
|
||||||
final PbapServerProfile psp = mManager.getProfileManager().getPbapProfile();
|
final PbapServerProfile psp = mManager.getProfileManager().getPbapProfile();
|
||||||
CheckBoxPreference pbapPref = createProfilePreference(psp);
|
CheckBoxPreference pbapPref = createProfilePreference(psp);
|
||||||
pbapPref.setChecked(pbapPermission == CachedBluetoothDevice.ACCESS_ALLOWED);
|
|
||||||
mProfileContainer.addPreference(pbapPref);
|
mProfileContainer.addPreference(pbapPref);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -191,11 +190,6 @@ public final class DeviceProfilesSettings extends SettingsPreferenceFragment
|
|||||||
pref.setIcon(getResources().getDrawable(iconResource));
|
pref.setIcon(getResources().getDrawable(iconResource));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Gray out profile while connecting and disconnecting
|
|
||||||
*/
|
|
||||||
pref.setEnabled(!mCachedDevice.isBusy());
|
|
||||||
|
|
||||||
refreshProfilePreference(pref, profile);
|
refreshProfilePreference(pref, profile);
|
||||||
|
|
||||||
return pref;
|
return pref;
|
||||||
@@ -310,11 +304,16 @@ public final class DeviceProfilesSettings extends SettingsPreferenceFragment
|
|||||||
LocalBluetoothProfile profile) {
|
LocalBluetoothProfile profile) {
|
||||||
BluetoothDevice device = mCachedDevice.getDevice();
|
BluetoothDevice device = mCachedDevice.getDevice();
|
||||||
|
|
||||||
/*
|
// Gray out checkbox while connecting and disconnecting.
|
||||||
* Gray out checkbox while connecting and disconnecting
|
|
||||||
*/
|
|
||||||
profilePref.setEnabled(!mCachedDevice.isBusy());
|
profilePref.setEnabled(!mCachedDevice.isBusy());
|
||||||
profilePref.setChecked(profile.isPreferred(device));
|
|
||||||
|
if (profile instanceof PbapServerProfile) {
|
||||||
|
// Handle PBAP specially.
|
||||||
|
profilePref.setChecked(mCachedDevice.getPhonebookPermissionChoice()
|
||||||
|
== CachedBluetoothDevice.ACCESS_ALLOWED);
|
||||||
|
} else {
|
||||||
|
profilePref.setChecked(profile.isPreferred(device));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private LocalBluetoothProfile getProfileOf(Preference pref) {
|
private LocalBluetoothProfile getProfileOf(Preference pref) {
|
||||||
|
Reference in New Issue
Block a user