Skip to content

Commit a91da5d

Browse files
travisgMike Lockwood
authored andcommitted
add config_bluetooth_default_profiles config var and use it to disable bt profiles
For devices that don't care about the previously default bluetooth profiles, add a config var to disable them. Change-Id: I04bb7ad4b1235bc37227645f472fdf5b918f6a31
1 parent b85c933 commit a91da5d

File tree

3 files changed

+22
-11
lines changed

3 files changed

+22
-11
lines changed

core/java/android/server/BluetoothService.java

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
import android.content.Intent;
4747
import android.content.IntentFilter;
4848
import android.content.SharedPreferences;
49+
import android.content.res.Resources;
4950
import android.os.Binder;
5051
import android.os.Handler;
5152
import android.os.IBinder;
@@ -554,27 +555,32 @@ private synchronized void addReservedSdpRecords(final ArrayList<ParcelUuid> uuid
554555
private synchronized void updateSdpRecords() {
555556
ArrayList<ParcelUuid> uuids = new ArrayList<ParcelUuid>();
556557

558+
Resources R = mContext.getResources();
559+
557560
// Add the default records
558-
uuids.add(BluetoothUuid.HSP_AG);
559-
uuids.add(BluetoothUuid.ObexObjectPush);
561+
if (R.getBoolean(com.android.internal.R.bool.config_bluetooth_default_profiles)) {
562+
uuids.add(BluetoothUuid.HSP_AG);
563+
uuids.add(BluetoothUuid.ObexObjectPush);
564+
}
560565

561-
if (mContext.getResources().
562-
getBoolean(com.android.internal.R.bool.config_voice_capable)) {
566+
if (R.getBoolean(com.android.internal.R.bool.config_voice_capable)) {
563567
uuids.add(BluetoothUuid.Handsfree_AG);
564568
uuids.add(BluetoothUuid.PBAP_PSE);
565569
}
566570

567571
// Add SDP records for profiles maintained by Android userspace
568572
addReservedSdpRecords(uuids);
569573

570-
// Enable profiles maintained by Bluez userspace.
571-
setBluetoothTetheringNative(true, BluetoothPanProfileHandler.NAP_ROLE,
572-
BluetoothPanProfileHandler.NAP_BRIDGE);
574+
if (R.getBoolean(com.android.internal.R.bool.config_bluetooth_default_profiles)) {
575+
// Enable profiles maintained by Bluez userspace.
576+
setBluetoothTetheringNative(true, BluetoothPanProfileHandler.NAP_ROLE,
577+
BluetoothPanProfileHandler.NAP_BRIDGE);
573578

574-
// Add SDP records for profiles maintained by Bluez userspace
575-
uuids.add(BluetoothUuid.AudioSource);
576-
uuids.add(BluetoothUuid.AvrcpTarget);
577-
uuids.add(BluetoothUuid.NAP);
579+
// Add SDP records for profiles maintained by Bluez userspace
580+
uuids.add(BluetoothUuid.AudioSource);
581+
uuids.add(BluetoothUuid.AvrcpTarget);
582+
uuids.add(BluetoothUuid.NAP);
583+
}
578584

579585
// Cannot cast uuids.toArray directly since ParcelUuid is parcelable
580586
mAdapterUuids = new ParcelUuid[uuids.size()];

core/res/res/values/config.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -635,6 +635,10 @@
635635
cell broadcasting sms, and MMS. -->
636636
<bool name="config_sms_capable">true</bool>
637637

638+
<!-- Enable/disable default bluetooth profiles:
639+
HSP_AG, ObexObjectPush, Audio, NAP -->
640+
<bool name="config_bluetooth_default_profiles">true</bool>
641+
638642
<!-- IP address of the dns server to use if nobody else suggests one -->
639643
<string name="config_default_dns_server" translatable="false">8.8.8.8</string>
640644

core/res/res/values/public.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,7 @@
245245
<java-symbol type="bool" name="config_enableWallpaperService" />
246246
<java-symbol type="bool" name="config_sendAudioBecomingNoisy" />
247247
<java-symbol type="bool" name="config_enableScreenshotChord" />
248+
<java-symbol type="bool" name="config_bluetooth_default_profiles" />
248249

249250
<java-symbol type="integer" name="config_cursorWindowSize" />
250251
<java-symbol type="integer" name="config_longPressOnPowerBehavior" />

0 commit comments

Comments
 (0)