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

Commit 5159f54b authored by YK Jeffrey Chao's avatar YK Jeffrey Chao Committed by Android Git Automerger
Browse files

am 0eab112f: Preload timeout and retry mechanism (2/3)

* commit '0eab112f':
  Preload timeout and retry mechanism (2/3)
parents 7707ae91 0eab112f
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -570,7 +570,11 @@ static jboolean disableNative(JNIEnv* env, jobject obj) {
    if (!sBluetoothInterface) return result;

    int ret = sBluetoothInterface->disable();
    result = (ret == BT_STATUS_SUCCESS) ? JNI_TRUE : JNI_FALSE;
    /* Retrun JNI_FALSE only when BTIF explicitly reports
       BT_STATUS_FAIL. It is fine for the BT_STATUS_NOT_READY
       case which indicates that stack had not been enabled.
    */
    result = (ret == BT_STATUS_FAIL) ? JNI_FALSE : JNI_TRUE;
    return result;
}

+10 −1
Original line number Diff line number Diff line
@@ -258,7 +258,7 @@ final class AdapterState extends StateMachine {
                     Log.w(TAG,"Timeout will setting scan mode..Continuing with disable...");
                     //Fall through
                case BEGIN_DISABLE: {
                    if (DBG) Log.d(TAG,"CURRENT_STATE=PENDING, MESSAGE = BEGIN_DISABLE" + isTurningOn + ", isTurningOff=" + isTurningOff);
                    if (DBG) Log.d(TAG,"CURRENT_STATE=PENDING, MESSAGE = BEGIN_DISABLE, isTurningOn=" + isTurningOn + ", isTurningOff=" + isTurningOff);
                    removeMessages(SET_SCAN_MODE_TIMEOUT);
                    sendMessageDelayed(DISABLE_TIMEOUT, DISABLE_TIMEOUT_DELAY);
                    boolean ret = mAdapterService.disableNative();
@@ -273,6 +273,15 @@ final class AdapterState extends StateMachine {
                    break;
                case DISABLED:
                    if (DBG) Log.d(TAG,"CURRENT_STATE=PENDING, MESSAGE = DISABLED, isTurningOn=" + isTurningOn + ", isTurningOff=" + isTurningOff);
                    if (isTurningOn) {
                        removeMessages(ENABLE_TIMEOUT);
                        errorLog("Error enabling Bluetooth - hardware init failed");
                        mPendingCommandState.setTurningOn(false);
                        transitionTo(mOffState);
                        mAdapterService.stopProfileServices();
                        notifyAdapterStateChange(BluetoothAdapter.STATE_OFF);
                        break;
                    }
                    removeMessages(DISABLE_TIMEOUT);
                    sendMessageDelayed(STOP_TIMEOUT, STOP_TIMEOUT_DELAY);
                    if (mAdapterService.stopProfileServices()) {