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

Commit 31127fcd authored by Myles Watson's avatar Myles Watson
Browse files

ProfileService: Remove log() wrapper

log() was used infrequently and saved very little code.

Bug: 72435402
Test: runtest bluetooth
Change-Id: I45ef997e5b1b9d616750dff041fe03ff3e123a17
parent bbb03027
Loading
Loading
Loading
Loading
+4 −8
Original line number Diff line number Diff line
@@ -116,7 +116,7 @@ public abstract class ProfileService extends Service {
    @Override
    public void onCreate() {
        if (DBG) {
            log("onCreate");
            Log.d(mName, "onCreate");
        }
        super.onCreate();
        mAdapter = BluetoothAdapter.getDefaultAdapter();
@@ -127,7 +127,7 @@ public abstract class ProfileService extends Service {
    @Override
    public int onStartCommand(Intent intent, int flags, int startId) {
        if (DBG) {
            log("onStartCommand()");
            Log.d(mName, "onStartCommand()");
        }

        if (checkCallingOrSelfPermission(BLUETOOTH_ADMIN_PERM)
@@ -156,7 +156,7 @@ public abstract class ProfileService extends Service {
    @Override
    public IBinder onBind(Intent intent) {
        if (DBG) {
            log("onBind");
            Log.d(mName, "onBind");
        }
        if (mAdapter != null && mBinder == null) {
            // initBinder returned null, you can't bind
@@ -168,7 +168,7 @@ public abstract class ProfileService extends Service {
    @Override
    public boolean onUnbind(Intent intent) {
        if (DBG) {
            log("onUnbind");
            Log.d(mName, "onUnbind");
        }
        return super.onUnbind(intent);
    }
@@ -297,8 +297,4 @@ public abstract class ProfileService extends Service {
        }
        return null;
    }

    protected void log(String msg) {
        Log.d(mName, msg);
    }
}
+6 −5
Original line number Diff line number Diff line
@@ -147,7 +147,7 @@ public class HealthService extends ProfileService {
        @Override
        public void handleMessage(Message msg) {
            if (DBG) {
                log("HealthService Handler msg: " + msg.what);
                Log.d(TAG, "HealthService Handler msg: " + msg.what);
            }
            switch (msg.what) {
                case MESSAGE_REGISTER_APPLICATION: {
@@ -160,8 +160,8 @@ public class HealthService extends ProfileService {
                    int halRole = convertRoleToHal(appConfig.getRole());
                    int halChannelType = convertChannelTypeToHal(appConfig.getChannelType());
                    if (VDBG) {
                        log("register datatype: " + appConfig.getDataType() + " role: " + halRole
                                + " name: " + appConfig.getName() + " channeltype: "
                        Log.d(TAG, "register datatype: " + appConfig.getDataType() + " role: "
                                + halRole + " name: " + appConfig.getName() + " channeltype: "
                                + halChannelType);
                    }
                    int appId = registerHealthAppNative(appConfig.getDataType(), halRole,
@@ -554,7 +554,7 @@ public class HealthService extends ProfileService {

    private void callStatusCallback(BluetoothHealthAppConfiguration config, int status) {
        if (VDBG) {
            log("Health Device Application: " + config + " State Change: status:" + status);
            Log.d(TAG, "Health Device Application: " + config + " State Change: status:" + status);
        }
        IBluetoothHealthCallback callback = (mApps.get(config)).mCallback;
        if (callback == null) {
@@ -636,7 +636,8 @@ public class HealthService extends ProfileService {
            BluetoothDevice device, int state, int prevState, ParcelFileDescriptor fd, int id) {
        broadcastHealthDeviceStateChange(device, state);

        log("Health Device Callback: " + device + " State Change: " + prevState + "->" + state);
        Log.d(TAG,
                "Health Device Callback: " + device + " State Change: " + prevState + "->" + state);

        ParcelFileDescriptor dupedFd = null;
        if (fd != null) {
+4 −4
Original line number Diff line number Diff line
@@ -235,7 +235,7 @@ public class HidHostService extends ProfileService {
                case MESSAGE_SET_PROTOCOL_MODE: {
                    BluetoothDevice device = (BluetoothDevice) msg.obj;
                    byte protocolMode = (byte) msg.arg1;
                    log("sending set protocol mode(" + protocolMode + ")");
                    Log.d(TAG, "sending set protocol mode(" + protocolMode + ")");
                    if (!setProtocolModeNative(Utils.getByteAddress(device), protocolMode)) {
                        Log.e(TAG, "Error: set protocol mode native returns false");
                    }
@@ -751,7 +751,7 @@ public class HidHostService extends ProfileService {
        /* Notifying the connection state change of the profile before sending the intent for
           connection state change, as it was causing a race condition, with the UI not being
           updated with the correct connection state. */
        log("Connection state " + device + ": " + prevState + "->" + newState);
        Log.d(TAG, "Connection state " + device + ": " + prevState + "->" + newState);
        Intent intent = new Intent(BluetoothHidHost.ACTION_CONNECTION_STATE_CHANGED);
        intent.putExtra(BluetoothProfile.EXTRA_PREVIOUS_STATE, prevState);
        intent.putExtra(BluetoothProfile.EXTRA_STATE, newState);
@@ -775,7 +775,7 @@ public class HidHostService extends ProfileService {
        intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT);
        sendBroadcast(intent, BLUETOOTH_PERM);
        if (DBG) {
            log("Protocol Mode (" + device + "): " + protocolMode);
            Log.d(TAG, "Protocol Mode (" + device + "): " + protocolMode);
        }
    }

@@ -803,7 +803,7 @@ public class HidHostService extends ProfileService {
        intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT);
        sendBroadcast(intent, BLUETOOTH_PERM);
        if (DBG) {
            log("Idle time (" + device + "): " + idleTime);
            Log.d(TAG, "Idle time (" + device + "): " + idleTime);
        }
    }

+6 −4
Original line number Diff line number Diff line
@@ -194,7 +194,8 @@ public class PanService extends ProfileService {
                    BluetoothDevice device = getDevice(cs.addr);
                    // TBD get iface from the msg
                    if (DBG) {
                        log("MESSAGE_CONNECT_STATE_CHANGED: " + device + " state: " + cs.state);
                        Log.d(TAG,
                                "MESSAGE_CONNECT_STATE_CHANGED: " + device + " state: " + cs.state);
                    }
                    handlePanDeviceStateChange(device, mPanIfName /* iface */,
                            convertHalState(cs.state), cs.local_role, cs.remote_role);
@@ -462,8 +463,8 @@ public class PanService extends ProfileService {
    private void onConnectStateChanged(byte[] address, int state, int error, int localRole,
            int remoteRole) {
        if (DBG) {
            log("onConnectStateChanged: " + state + ", local role:" + localRole + ", remoteRole: "
                    + remoteRole);
            Log.d(TAG, "onConnectStateChanged: " + state + ", local role:" + localRole
                    + ", remoteRole: " + remoteRole);
        }
        Message msg = mHandler.obtainMessage(MESSAGE_CONNECT_STATE_CHANGED);
        msg.obj = new ConnectState(address, state, error, localRole, remoteRole);
@@ -472,7 +473,8 @@ public class PanService extends ProfileService {

    private void onControlStateChanged(int localRole, int state, int error, String ifname) {
        if (DBG) {
            log("onControlStateChanged: " + state + ", error: " + error + ", ifname: " + ifname);
            Log.d(TAG, "onControlStateChanged: " + state + ", error: " + error + ", ifname: "
                    + ifname);
        }
        if (error == 0) {
            mPanIfName = ifname;