Loading android/app/src/com/android/bluetooth/btservice/AdapterProperties.java +75 −9 Original line number Original line Diff line number Diff line Loading @@ -46,6 +46,8 @@ import android.util.Pair; import com.android.bluetooth.Utils; import com.android.bluetooth.Utils; import com.android.bluetooth.btservice.RemoteDevices.DeviceProperties; import com.android.bluetooth.btservice.RemoteDevices.DeviceProperties; import java.io.FileDescriptor; import java.io.PrintWriter; import java.util.HashMap; import java.util.HashMap; import java.util.concurrent.CopyOnWriteArrayList; import java.util.concurrent.CopyOnWriteArrayList; Loading Loading @@ -189,8 +191,7 @@ class AdapterProperties { + propertyOverlayedMaxConnectedAudioDevices + ", finalValue=" + propertyOverlayedMaxConnectedAudioDevices + ", finalValue=" + mMaxConnectedAudioDevices); + mMaxConnectedAudioDevices); mA2dpOffloadEnabled = SystemProperties.getBoolean( mA2dpOffloadEnabled = SystemProperties.getBoolean(A2DP_OFFLOAD_ENABLE_PROPERTY, false); A2DP_OFFLOAD_ENABLE_PROPERTY, false); IntentFilter filter = new IntentFilter(); IntentFilter filter = new IntentFilter(); filter.addAction(BluetoothHeadset.ACTION_CONNECTION_STATE_CHANGED); filter.addAction(BluetoothHeadset.ACTION_CONNECTION_STATE_CHANGED); Loading Loading @@ -313,10 +314,10 @@ class AdapterProperties { } } /** /** * @param mConnectionState the mConnectionState to set * @param connectionState the mConnectionState to set */ */ void setConnectionState(int mConnectionState) { void setConnectionState(int connectionState) { this.mConnectionState = mConnectionState; mConnectionState = connectionState; } } /** /** Loading @@ -329,9 +330,9 @@ class AdapterProperties { /** /** * @param mState the mState to set * @param mState the mState to set */ */ void setState(int mState) { void setState(int state) { debugLog("Setting state to " + BluetoothAdapter.nameForState(mState)); debugLog("Setting state to " + BluetoothAdapter.nameForState(state)); this.mState = mState; mState = state; } } /** /** Loading Loading @@ -823,7 +824,8 @@ class AdapterProperties { } } void onBluetoothReady() { void onBluetoothReady() { debugLog("onBluetoothReady, state=" + getState() + ", ScanMode=" + mScanMode); debugLog("onBluetoothReady, state=" + BluetoothAdapter.nameForState(getState()) + ", ScanMode=" + mScanMode); synchronized (mObject) { synchronized (mObject) { // Reset adapter and profile connection states // Reset adapter and profile connection states Loading Loading @@ -894,6 +896,70 @@ class AdapterProperties { } } } } protected void dump(FileDescriptor fd, PrintWriter writer, String[] args) { writer.println(TAG); writer.println(" " + "Name: " + getName()); writer.println(" " + "Address: " + Utils.getAddressStringFromByte(mAddress)); writer.println(" " + "BluetoothClass: " + getBluetoothClass()); writer.println(" " + "ScanMode: " + dumpScanMode(getScanMode())); writer.println(" " + "ConnectionState: " + dumpConnectionState(getConnectionState())); writer.println(" " + "State: " + BluetoothAdapter.nameForState(getState())); writer.println(" " + "MaxConnectedAudioDevices: " + getMaxConnectedAudioDevices()); writer.println(" " + "A2dpOffloadEnabled: " + mA2dpOffloadEnabled); writer.println(" " + "Discovering: " + mDiscovering); writer.println(" " + "DiscoveryEndMs: " + mDiscoveryEndMs); writer.println(" " + "Bonded devices:"); for (BluetoothDevice device : mBondedDevices) { writer.println( " " + device.getAddress() + " [" + dumpDeviceType(device.getType()) + "] " + device.getName()); } } private String dumpDeviceType(int deviceType) { switch (deviceType) { case BluetoothDevice.DEVICE_TYPE_UNKNOWN: return " ???? "; case BluetoothDevice.DEVICE_TYPE_CLASSIC: return "BR/EDR"; case BluetoothDevice.DEVICE_TYPE_LE: return " LE "; case BluetoothDevice.DEVICE_TYPE_DUAL: return " DUAL "; default: return "Invalid device type: " + deviceType; } } private String dumpConnectionState(int state) { switch (state) { case BluetoothAdapter.STATE_DISCONNECTED: return "STATE_DISCONNECTED"; case BluetoothAdapter.STATE_DISCONNECTING: return "STATE_DISCONNECTING"; case BluetoothAdapter.STATE_CONNECTING: return "STATE_CONNECTING"; case BluetoothAdapter.STATE_CONNECTED: return "STATE_CONNECTED"; default: return "Unknown Connection State " + state; } } private String dumpScanMode(int scanMode) { switch (scanMode) { case BluetoothAdapter.SCAN_MODE_NONE: return "SCAN_MODE_NONE"; case BluetoothAdapter.SCAN_MODE_CONNECTABLE: return "SCAN_MODE_CONNECTABLE"; case BluetoothAdapter.SCAN_MODE_CONNECTABLE_DISCOVERABLE: return "SCAN_MODE_CONNECTABLE_DISCOVERABLE"; default: return "Unknown Scan Mode " + scanMode; } } private static void infoLog(String msg) { private static void infoLog(String msg) { if (VDBG) { if (VDBG) { Log.i(TAG, msg); Log.i(TAG, msg); Loading android/app/src/com/android/bluetooth/btservice/AdapterService.java +1 −14 Original line number Original line Diff line number Diff line Loading @@ -122,10 +122,6 @@ public class AdapterService extends Service { "message_access_permission"; "message_access_permission"; private static final String SIM_ACCESS_PERMISSION_PREFERENCE_FILE = "sim_access_permission"; private static final String SIM_ACCESS_PERMISSION_PREFERENCE_FILE = "sim_access_permission"; private static final String[] DEVICE_TYPE_NAMES = new String[]{ "???", "BR/EDR", "LE", "DUAL" }; private static final int CONTROLLER_ENERGY_UPDATE_TIMEOUT_MILLIS = 30; private static final int CONTROLLER_ENERGY_UPDATE_TIMEOUT_MILLIS = 30; static { static { Loading Loading @@ -2422,17 +2418,8 @@ public class AdapterService extends Service { return; return; } } writer.println("AdapterProperties"); writer.println(" " + "MaxConnectedAudioDevices: " + getMaxConnectedAudioDevices()); writer.println(); writer.println(); mAdapterProperties.dump(fd, writer, args); writer.println("Bonded devices:"); for (BluetoothDevice device : getBondedDevices()) { writer.println( " " + device.getAddress() + " [" + DEVICE_TYPE_NAMES[device.getType()] + "] " + device.getName()); } writer.println(); writer.println(); mAdapterStateMachine.dump(fd, writer, args); mAdapterStateMachine.dump(fd, writer, args); Loading Loading
android/app/src/com/android/bluetooth/btservice/AdapterProperties.java +75 −9 Original line number Original line Diff line number Diff line Loading @@ -46,6 +46,8 @@ import android.util.Pair; import com.android.bluetooth.Utils; import com.android.bluetooth.Utils; import com.android.bluetooth.btservice.RemoteDevices.DeviceProperties; import com.android.bluetooth.btservice.RemoteDevices.DeviceProperties; import java.io.FileDescriptor; import java.io.PrintWriter; import java.util.HashMap; import java.util.HashMap; import java.util.concurrent.CopyOnWriteArrayList; import java.util.concurrent.CopyOnWriteArrayList; Loading Loading @@ -189,8 +191,7 @@ class AdapterProperties { + propertyOverlayedMaxConnectedAudioDevices + ", finalValue=" + propertyOverlayedMaxConnectedAudioDevices + ", finalValue=" + mMaxConnectedAudioDevices); + mMaxConnectedAudioDevices); mA2dpOffloadEnabled = SystemProperties.getBoolean( mA2dpOffloadEnabled = SystemProperties.getBoolean(A2DP_OFFLOAD_ENABLE_PROPERTY, false); A2DP_OFFLOAD_ENABLE_PROPERTY, false); IntentFilter filter = new IntentFilter(); IntentFilter filter = new IntentFilter(); filter.addAction(BluetoothHeadset.ACTION_CONNECTION_STATE_CHANGED); filter.addAction(BluetoothHeadset.ACTION_CONNECTION_STATE_CHANGED); Loading Loading @@ -313,10 +314,10 @@ class AdapterProperties { } } /** /** * @param mConnectionState the mConnectionState to set * @param connectionState the mConnectionState to set */ */ void setConnectionState(int mConnectionState) { void setConnectionState(int connectionState) { this.mConnectionState = mConnectionState; mConnectionState = connectionState; } } /** /** Loading @@ -329,9 +330,9 @@ class AdapterProperties { /** /** * @param mState the mState to set * @param mState the mState to set */ */ void setState(int mState) { void setState(int state) { debugLog("Setting state to " + BluetoothAdapter.nameForState(mState)); debugLog("Setting state to " + BluetoothAdapter.nameForState(state)); this.mState = mState; mState = state; } } /** /** Loading Loading @@ -823,7 +824,8 @@ class AdapterProperties { } } void onBluetoothReady() { void onBluetoothReady() { debugLog("onBluetoothReady, state=" + getState() + ", ScanMode=" + mScanMode); debugLog("onBluetoothReady, state=" + BluetoothAdapter.nameForState(getState()) + ", ScanMode=" + mScanMode); synchronized (mObject) { synchronized (mObject) { // Reset adapter and profile connection states // Reset adapter and profile connection states Loading Loading @@ -894,6 +896,70 @@ class AdapterProperties { } } } } protected void dump(FileDescriptor fd, PrintWriter writer, String[] args) { writer.println(TAG); writer.println(" " + "Name: " + getName()); writer.println(" " + "Address: " + Utils.getAddressStringFromByte(mAddress)); writer.println(" " + "BluetoothClass: " + getBluetoothClass()); writer.println(" " + "ScanMode: " + dumpScanMode(getScanMode())); writer.println(" " + "ConnectionState: " + dumpConnectionState(getConnectionState())); writer.println(" " + "State: " + BluetoothAdapter.nameForState(getState())); writer.println(" " + "MaxConnectedAudioDevices: " + getMaxConnectedAudioDevices()); writer.println(" " + "A2dpOffloadEnabled: " + mA2dpOffloadEnabled); writer.println(" " + "Discovering: " + mDiscovering); writer.println(" " + "DiscoveryEndMs: " + mDiscoveryEndMs); writer.println(" " + "Bonded devices:"); for (BluetoothDevice device : mBondedDevices) { writer.println( " " + device.getAddress() + " [" + dumpDeviceType(device.getType()) + "] " + device.getName()); } } private String dumpDeviceType(int deviceType) { switch (deviceType) { case BluetoothDevice.DEVICE_TYPE_UNKNOWN: return " ???? "; case BluetoothDevice.DEVICE_TYPE_CLASSIC: return "BR/EDR"; case BluetoothDevice.DEVICE_TYPE_LE: return " LE "; case BluetoothDevice.DEVICE_TYPE_DUAL: return " DUAL "; default: return "Invalid device type: " + deviceType; } } private String dumpConnectionState(int state) { switch (state) { case BluetoothAdapter.STATE_DISCONNECTED: return "STATE_DISCONNECTED"; case BluetoothAdapter.STATE_DISCONNECTING: return "STATE_DISCONNECTING"; case BluetoothAdapter.STATE_CONNECTING: return "STATE_CONNECTING"; case BluetoothAdapter.STATE_CONNECTED: return "STATE_CONNECTED"; default: return "Unknown Connection State " + state; } } private String dumpScanMode(int scanMode) { switch (scanMode) { case BluetoothAdapter.SCAN_MODE_NONE: return "SCAN_MODE_NONE"; case BluetoothAdapter.SCAN_MODE_CONNECTABLE: return "SCAN_MODE_CONNECTABLE"; case BluetoothAdapter.SCAN_MODE_CONNECTABLE_DISCOVERABLE: return "SCAN_MODE_CONNECTABLE_DISCOVERABLE"; default: return "Unknown Scan Mode " + scanMode; } } private static void infoLog(String msg) { private static void infoLog(String msg) { if (VDBG) { if (VDBG) { Log.i(TAG, msg); Log.i(TAG, msg); Loading
android/app/src/com/android/bluetooth/btservice/AdapterService.java +1 −14 Original line number Original line Diff line number Diff line Loading @@ -122,10 +122,6 @@ public class AdapterService extends Service { "message_access_permission"; "message_access_permission"; private static final String SIM_ACCESS_PERMISSION_PREFERENCE_FILE = "sim_access_permission"; private static final String SIM_ACCESS_PERMISSION_PREFERENCE_FILE = "sim_access_permission"; private static final String[] DEVICE_TYPE_NAMES = new String[]{ "???", "BR/EDR", "LE", "DUAL" }; private static final int CONTROLLER_ENERGY_UPDATE_TIMEOUT_MILLIS = 30; private static final int CONTROLLER_ENERGY_UPDATE_TIMEOUT_MILLIS = 30; static { static { Loading Loading @@ -2422,17 +2418,8 @@ public class AdapterService extends Service { return; return; } } writer.println("AdapterProperties"); writer.println(" " + "MaxConnectedAudioDevices: " + getMaxConnectedAudioDevices()); writer.println(); writer.println(); mAdapterProperties.dump(fd, writer, args); writer.println("Bonded devices:"); for (BluetoothDevice device : getBondedDevices()) { writer.println( " " + device.getAddress() + " [" + DEVICE_TYPE_NAMES[device.getType()] + "] " + device.getName()); } writer.println(); writer.println(); mAdapterStateMachine.dump(fd, writer, args); mAdapterStateMachine.dump(fd, writer, args); Loading