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

Commit 4ae341e6 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Rename the Utils class in settingslib.bluetooth"

parents bb046455 e7b7cb8c
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -310,7 +310,7 @@ public class A2dpProfile implements LocalBluetoothProfile {
                return R.string.bluetooth_a2dp_profile_summary_connected;

            default:
                return Utils.getConnectionStateSummary(state);
                return BluetoothUtils.getConnectionStateSummary(state);
        }
    }

+1 −1
Original line number Diff line number Diff line
@@ -202,7 +202,7 @@ final class A2dpSinkProfile implements LocalBluetoothProfile {
                return R.string.bluetooth_a2dp_profile_summary_connected;

            default:
                return Utils.getConnectionStateSummary(state);
                return BluetoothUtils.getConnectionStateSummary(state);
        }
    }

+1 −1
Original line number Diff line number Diff line
@@ -379,7 +379,7 @@ public class BluetoothEventManager {
                Log.w(TAG, "showUnbondMessage: Not displaying any message for reason: " + reason);
                return;
            }
            Utils.showError(context, name, errorMsg);
            BluetoothUtils.showError(context, name, errorMsg);
        }
    }

+11 −11
Original line number Diff line number Diff line
@@ -13,7 +13,7 @@ import com.android.settingslib.graph.BluetoothDeviceLayerDrawable;

import java.util.List;

public class Utils {
public class BluetoothUtils {
    public static final boolean V = false; // verbose logging
    public static final boolean D = true;  // regular logging

+20 −15
Original line number Diff line number Diff line
@@ -47,7 +47,6 @@ import java.util.List;
 */
public class CachedBluetoothDevice implements Comparable<CachedBluetoothDevice> {
    private static final String TAG = "CachedBluetoothDevice";
    private static final boolean DEBUG = Utils.V;

    private final Context mContext;
    private final LocalBluetoothAdapter mLocalAdapter;
@@ -103,7 +102,7 @@ public class CachedBluetoothDevice implements Comparable<CachedBluetoothDevice>
    }

    public void setHiSyncId(long id) {
        if (Utils.D) {
        if (BluetoothUtils.D) {
            Log.d(TAG, "setHiSyncId: mDevice " + mDevice + ", id " + id);
        }
        mHiSyncId = id;
@@ -142,13 +141,15 @@ public class CachedBluetoothDevice implements Comparable<CachedBluetoothDevice>
    }

    void onProfileStateChanged(LocalBluetoothProfile profile, int newProfileState) {
        if (Utils.D) {
        if (BluetoothUtils.D) {
            Log.d(TAG, "onProfileStateChanged: profile " + profile +
                    " newProfileState " + newProfileState);
        }
        if (mLocalAdapter.getBluetoothState() == BluetoothAdapter.STATE_TURNING_OFF)
        {
            if (Utils.D) Log.d(TAG, " BT Turninig Off...Profile conn state change ignored...");
            if (BluetoothUtils.D) {
                Log.d(TAG, " BT Turninig Off...Profile conn state change ignored...");
            }
            return;
        }
        mProfileConnectionState.put(profile, newProfileState);
@@ -209,7 +210,7 @@ public class CachedBluetoothDevice implements Comparable<CachedBluetoothDevice>

    public void disconnect(LocalBluetoothProfile profile) {
        if (profile.disconnect(mDevice)) {
            if (Utils.D) {
            if (BluetoothUtils.D) {
                Log.d(TAG, "Command sent successfully:DISCONNECT " + describe(profile));
            }
        }
@@ -256,7 +257,7 @@ public class CachedBluetoothDevice implements Comparable<CachedBluetoothDevice>
                }
            }
        }
        if (DEBUG) Log.d(TAG, "Preferred profiles = " + preferredProfiles);
        if (BluetoothUtils.D) Log.d(TAG, "Preferred profiles = " + preferredProfiles);

        if (preferredProfiles == 0) {
            connectAutoConnectableProfiles();
@@ -297,7 +298,7 @@ public class CachedBluetoothDevice implements Comparable<CachedBluetoothDevice>
            return;
        }
        if (profile.connect(mDevice)) {
            if (Utils.D) {
            if (BluetoothUtils.D) {
                Log.d(TAG, "Command sent successfully:CONNECT " + describe(profile));
            }
            return;
@@ -347,10 +348,10 @@ public class CachedBluetoothDevice implements Comparable<CachedBluetoothDevice>
            if (dev != null) {
                final boolean successful = dev.removeBond();
                if (successful) {
                    if (Utils.D) {
                    if (BluetoothUtils.D) {
                        Log.d(TAG, "Command sent successfully:REMOVE_BOND " + describe(null));
                    }
                } else if (Utils.V) {
                } else if (BluetoothUtils.V) {
                    Log.v(TAG, "Framework rejected command immediately:REMOVE_BOND " +
                        describe(null));
                }
@@ -369,7 +370,7 @@ public class CachedBluetoothDevice implements Comparable<CachedBluetoothDevice>

    public void clearProfileConnectionState ()
    {
        if (Utils.D) {
        if (BluetoothUtils.D) {
            Log.d(TAG," Clearing all connection state for dev:" + mDevice.getName());
        }
        for (LocalBluetoothProfile profile :getProfiles()) {
@@ -473,7 +474,9 @@ public class CachedBluetoothDevice implements Comparable<CachedBluetoothDevice>

        if (TextUtils.isEmpty(mName)) {
            mName = mDevice.getAddress();
            if (DEBUG) Log.d(TAG, "Device has no name (yet), use address: " + mName);
            if (BluetoothUtils.D) {
                Log.d(TAG, "Device has no name (yet), use address: " + mName);
            }
        }
    }

@@ -629,7 +632,7 @@ public class CachedBluetoothDevice implements Comparable<CachedBluetoothDevice>
        mProfileManager.updateProfiles(uuids, localUuids, mProfiles, mRemovedProfiles,
                                       mLocalNapRoleConnected, mDevice);

        if (DEBUG) {
        if (BluetoothUtils.D) {
            Log.e(TAG, "updating profiles for " + mDevice.getAliasName());
            BluetoothClass bluetoothClass = mDevice.getBluetoothClass();

@@ -678,7 +681,7 @@ public class CachedBluetoothDevice implements Comparable<CachedBluetoothDevice>
            timeout = MAX_HOGP_DELAY_FOR_AUTO_CONNECT;
        }

        if (DEBUG) {
        if (BluetoothUtils.D) {
            Log.d(TAG, "onUuidChanged: Time since last connect"
                    + (SystemClock.elapsedRealtime() - mConnectAttempted));
        }
@@ -995,7 +998,8 @@ public class CachedBluetoothDevice implements Comparable<CachedBluetoothDevice>
            switch (connectionStatus) {
                case BluetoothProfile.STATE_CONNECTING:
                case BluetoothProfile.STATE_DISCONNECTING:
                    return mContext.getString(Utils.getConnectionStateSummary(connectionStatus));
                    return mContext.getString(
                            BluetoothUtils.getConnectionStateSummary(connectionStatus));

                case BluetoothProfile.STATE_CONNECTED:
                    profileConnected = true;
@@ -1090,7 +1094,8 @@ public class CachedBluetoothDevice implements Comparable<CachedBluetoothDevice>
            switch (connectionStatus) {
                case BluetoothProfile.STATE_CONNECTING:
                case BluetoothProfile.STATE_DISCONNECTING:
                    return mContext.getString(Utils.getConnectionStateSummary(connectionStatus));
                    return mContext.getString(
                            BluetoothUtils.getConnectionStateSummary(connectionStatus));

                case BluetoothProfile.STATE_CONNECTED:
                    profileConnected = true;
Loading