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

Commit 5b60bfc0 authored by Ivan Podogov's avatar Ivan Podogov Committed by Gerrit Code Review
Browse files

Merge "Remove debug logging from report sending in HID Device mode."

parents 0ac20887 25ff1983
Loading
Loading
Loading
Loading
+0 −6
Original line number Original line Diff line number Diff line
@@ -347,8 +347,6 @@ static jboolean unregisterAppNative(JNIEnv* env, jobject thiz) {


static jboolean sendReportNative(JNIEnv* env, jobject thiz, jint id,
static jboolean sendReportNative(JNIEnv* env, jobject thiz, jint id,
                                 jbyteArray data) {
                                 jbyteArray data) {
  ALOGV("%s enter", __FUNCTION__);

  jboolean result = JNI_FALSE;
  jboolean result = JNI_FALSE;
  jsize size;
  jsize size;
  uint8_t* buf;
  uint8_t* buf;
@@ -362,8 +360,6 @@ static jboolean sendReportNative(JNIEnv* env, jobject thiz, jint id,
    bt_status_t ret =
    bt_status_t ret =
        sHiddIf->send_report(BTHD_REPORT_TYPE_INTRDATA, id, size, buf);
        sHiddIf->send_report(BTHD_REPORT_TYPE_INTRDATA, id, size, buf);


    ALOGV("%s: send_report() returned %d", __FUNCTION__, ret);

    if (ret == BT_STATUS_SUCCESS) {
    if (ret == BT_STATUS_SUCCESS) {
      result = JNI_TRUE;
      result = JNI_TRUE;
    }
    }
@@ -371,8 +367,6 @@ static jboolean sendReportNative(JNIEnv* env, jobject thiz, jint id,
    free(buf);
    free(buf);
  }
  }


  ALOGV("%s done (%d)", __FUNCTION__, result);

  return result;
  return result;
}
}


+169 −170
Original line number Original line Diff line number Diff line
@@ -42,8 +42,7 @@ import java.util.NoSuchElementException;


/** @hide */
/** @hide */
public class HidDevService extends ProfileService {
public class HidDevService extends ProfileService {

    private static final boolean DBG = false;
  private static final boolean DBG = true;


    private static final String TAG = HidDevService.class.getSimpleName();
    private static final String TAG = HidDevService.class.getSimpleName();


@@ -67,19 +66,19 @@ public class HidDevService extends ProfileService {


    private BluetoothHidDeviceDeathRecipient mDeathRcpt;
    private BluetoothHidDeviceDeathRecipient mDeathRcpt;


  static { classInitNative(); }
    static {
        classInitNative();
    }


    private final Handler mHandler = new Handler() {
    private final Handler mHandler = new Handler() {


        @Override
        @Override
        public void handleMessage(Message msg) {
        public void handleMessage(Message msg) {
      if (DBG)
            if (DBG) Log.v(TAG, "handleMessage(): msg.what=" + msg.what);
        Log.v(TAG, "handleMessage(): msg.what=" + msg.what);


            switch (msg.what) {
            switch (msg.what) {
                case MESSAGE_APPLICATION_STATE_CHANGED: {
                case MESSAGE_APPLICATION_STATE_CHANGED: {
        BluetoothDevice device =
                    BluetoothDevice device = msg.obj != null ? getDevice((byte[]) msg.obj) : null;
            msg.obj != null ? getDevice((byte[])msg.obj) : null;
                    boolean success = (msg.arg1 != 0);
                    boolean success = (msg.arg1 != 0);


                    if (success) {
                    if (success) {
@@ -99,8 +98,8 @@ public class HidDevService extends ProfileService {
                    }
                    }


                    if (success) {
                    if (success) {
          mDeathRcpt = new BluetoothHidDeviceDeathRecipient(HidDevService.this,
                        mDeathRcpt = new BluetoothHidDeviceDeathRecipient(
                                                            mAppConfig);
                                HidDevService.this, mAppConfig);
                        if (mCallback != null) {
                        if (mCallback != null) {
                            IBinder binder = mCallback.asBinder();
                            IBinder binder = mCallback.asBinder();
                            try {
                            try {
@@ -144,8 +143,7 @@ public class HidDevService extends ProfileService {
                    broadcastConnectionState(device, state);
                    broadcastConnectionState(device, state);


                    try {
                    try {
          if (mCallback != null)
                        if (mCallback != null) mCallback.onConnectionStateChanged(device, state);
            mCallback.onConnectionStateChanged(device, state);
                    } catch (RemoteException e) {
                    } catch (RemoteException e) {
                        e.printStackTrace();
                        e.printStackTrace();
                    }
                    }
@@ -158,7 +156,8 @@ public class HidDevService extends ProfileService {
                    int bufferSize = msg.obj == null ? 0 : ((Integer) msg.obj).intValue();
                    int bufferSize = msg.obj == null ? 0 : ((Integer) msg.obj).intValue();


                    try {
                    try {
            if (mCallback != null) mCallback.onGetReport(mHidDevice, type, id, bufferSize);
                        if (mCallback != null)
                            mCallback.onGetReport(mHidDevice, type, id, bufferSize);
                    } catch (RemoteException e) {
                    } catch (RemoteException e) {
                        e.printStackTrace();
                        e.printStackTrace();
                    }
                    }
@@ -170,7 +169,8 @@ public class HidDevService extends ProfileService {
                    byte[] data = ((ByteBuffer) msg.obj).array();
                    byte[] data = ((ByteBuffer) msg.obj).array();


                    try {
                    try {
            if (mCallback != null) mCallback.onSetReport(mHidDevice, reportType, reportId, data);
                        if (mCallback != null)
                            mCallback.onSetReport(mHidDevice, reportType, reportId, data);
                    } catch (RemoteException e) {
                    } catch (RemoteException e) {
                        e.printStackTrace();
                        e.printStackTrace();
                    }
                    }
@@ -210,8 +210,7 @@ public class HidDevService extends ProfileService {
        }
        }
    };
    };


  private static class BluetoothHidDeviceDeathRecipient
    private static class BluetoothHidDeviceDeathRecipient implements IBinder.DeathRecipient {
      implements IBinder.DeathRecipient {
        private HidDevService mService;
        private HidDevService mService;
        private BluetoothHidDeviceAppConfiguration mAppConfig;
        private BluetoothHidDeviceAppConfiguration mAppConfig;