开发者

Controlling default friendly name for Bluetooth adapter

I'm looking at the Wireless & Network Settings, spec开发者_如何转开发ifically the Bluetooth settings, using Android 2.3.3. When the phone first starts, the device name (the friendly name) is blank. When I enable Bluetooth, it populates the Device Name with a default string and saves it somewhere. I want that default name to not be blank initially. My problem is that I can't find where this string is really stored.

It looks like the the Bluetooth settings screen is using the bluetooth service at frameworks/base/core/java/android/server/BluetoothService.java, but from there, there are functions to get/set the adapter properties natively {for example getDevicePropertiesNative()}. This function is in frameworks/base/core/jni/android_server_BluetoothService.cpp and uses dbus to get the requested property. How do you find out where the dbus call is handled? I still see nothing in any of these files that sets the initial value of the Name property, so I'm hoping it's on the other side of the dbus calls.

Note that I did find the bluez code in both system/bluetooth and external/bluetooth/bluez, which both seem to be getting compiled, and there is a function that appears to be for setting the default bluetooth adapter values using /etc/bluetooth/main.conf, but if I change that code or the main.conf file, nothing different happens. I couldn't find any analogue to getName().

I'm a bit new to Android internals, so any help is appreciated.


The implementation of IBluetooth can be found at BluetoothService.java.

Not sure if that is the function you're looking for, but here is getName():

public synchronized String getName() {
    mContext.enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission");
    return getProperty("Name");
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜