Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a0a58576 authored by Sal Savage's avatar Sal Savage Committed by Gerrit Code Review
Browse files

Merge "Use profile names instead of integer constants when logging"

parents 3a0e9109 8f2c782c
Loading
Loading
Loading
Loading
+6 −6
Original line number Original line Diff line number Diff line
@@ -729,16 +729,16 @@ class AdapterProperties {
                    metricId, device.getName());
                    metricId, device.getName());
            MetricsLogger.getInstance().logSanitizedBluetoothDeviceName(metricId, device.getName());
            MetricsLogger.getInstance().logSanitizedBluetoothDeviceName(metricId, device.getName());
        }
        }
        Log.d(TAG,
        Log.d(TAG, "PROFILE_CONNECTION_STATE_CHANGE: profile="
                "PROFILE_CONNECTION_STATE_CHANGE: profile=" + profile + ", device=" + device + ", "
                + BluetoothProfile.getProfileName(profile) + ", device=" + device + ", "
                + prevState + " -> " + state);
                + prevState + " -> " + state);
        BluetoothStatsLog.write(BluetoothStatsLog.BLUETOOTH_CONNECTION_STATE_CHANGED, state,
        BluetoothStatsLog.write(BluetoothStatsLog.BLUETOOTH_CONNECTION_STATE_CHANGED, state,
                0 /* deprecated */, profile, mService.obfuscateAddress(device),
                0 /* deprecated */, profile, mService.obfuscateAddress(device),
                metricId, 0, -1);
                metricId, 0, -1);


        if (!isNormalStateTransition(prevState, state)) {
        if (!isNormalStateTransition(prevState, state)) {
            Log.w(TAG,
            Log.w(TAG, "PROFILE_CONNECTION_STATE_CHANGE: unexpected transition for profile="
                    "PROFILE_CONNECTION_STATE_CHANGE: unexpected transition for profile=" + profile
                    + BluetoothProfile.getProfileName(profile)
                    + ", device=" + device + ", " + prevState + " -> " + state);
                    + ", device=" + device + ", " + prevState + " -> " + state);
        }
        }
        sendConnectionStateChange(device, profile, state, prevState);
        sendConnectionStateChange(device, profile, state, prevState);
+6 −4
Original line number Original line Diff line number Diff line
@@ -506,8 +506,9 @@ class PhonePolicy {
    @RequiresPermission(android.Manifest.permission.BLUETOOTH_PRIVILEGED)
    @RequiresPermission(android.Manifest.permission.BLUETOOTH_PRIVILEGED)
    private void processProfileStateChanged(BluetoothDevice device, int profileId, int nextState,
    private void processProfileStateChanged(BluetoothDevice device, int profileId, int nextState,
            int prevState) {
            int prevState) {
        debugLog("processProfileStateChanged, device=" + device + ", profile=" + profileId + ", "
        debugLog("processProfileStateChanged, device=" + device + ", profile="
                + prevState + " -> " + nextState);
                + BluetoothProfile.getProfileName(profileId) + ", " + prevState + " -> "
                + nextState);
        if (((profileId == BluetoothProfile.A2DP) || (profileId == BluetoothProfile.HEADSET)
        if (((profileId == BluetoothProfile.A2DP) || (profileId == BluetoothProfile.HEADSET)
                || (profileId == BluetoothProfile.LE_AUDIO)
                || (profileId == BluetoothProfile.LE_AUDIO)
                || (profileId == BluetoothProfile.CSIP_SET_COORDINATOR)
                || (profileId == BluetoothProfile.CSIP_SET_COORDINATOR)
@@ -544,8 +545,9 @@ class PhonePolicy {
     * @param device is the device we just made the active device
     * @param device is the device we just made the active device
     */
     */
    private void processActiveDeviceChanged(BluetoothDevice device, int profileId) {
    private void processActiveDeviceChanged(BluetoothDevice device, int profileId) {
        debugLog("processActiveDeviceChanged, device=" + device + ", profile=" + profileId
        debugLog("processActiveDeviceChanged, device=" + device + ", profile="
                + " isDualModeAudioEnabled=" + isDualModeAudioEnabled());
                + BluetoothProfile.getProfileName(profileId) + " isDualModeAudioEnabled="
                + isDualModeAudioEnabled());


        if (device != null) {
        if (device != null) {
            mDatabaseManager.setConnection(device, profileId == BluetoothProfile.A2DP);
            mDatabaseManager.setConnection(device, profileId == BluetoothProfile.A2DP);
+4 −2
Original line number Original line Diff line number Diff line
@@ -300,7 +300,8 @@ public class SilenceDeviceManager {


    void addConnectedDevice(BluetoothDevice device, int profile) {
    void addConnectedDevice(BluetoothDevice device, int profile) {
        if (VERBOSE) {
        if (VERBOSE) {
            Log.d(TAG, "addConnectedDevice: " + device + ", profile:" + profile);
            Log.d(TAG, "addConnectedDevice: " + device + ", profile:"
                    + BluetoothProfile.getProfileName(profile));
        }
        }
        switch (profile) {
        switch (profile) {
            case BluetoothProfile.A2DP:
            case BluetoothProfile.A2DP:
@@ -318,7 +319,8 @@ public class SilenceDeviceManager {


    void removeConnectedDevice(BluetoothDevice device, int profile) {
    void removeConnectedDevice(BluetoothDevice device, int profile) {
        if (VERBOSE) {
        if (VERBOSE) {
            Log.d(TAG, "removeConnectedDevice: " + device + ", profile:" + profile);
            Log.d(TAG, "removeConnectedDevice: " + device + ", profile:"
                    + BluetoothProfile.getProfileName(profile));
        }
        }
        switch (profile) {
        switch (profile) {
            case BluetoothProfile.A2DP:
            case BluetoothProfile.A2DP: