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

Commit e0811cc3 authored by Wei Wang's avatar Wei Wang
Browse files

Callback on correct method when status is unsuccessful.

Change-Id: I63c07bbae559765af1aecb492379ab18268336d8
parent d02986b2
Loading
Loading
Loading
Loading
+14 −2
Original line number Diff line number Diff line
@@ -1989,7 +1989,13 @@ public final class BluetoothAdapter {
        public void onAdvertiseStateChange(int advertiseState, int status) {
            Log.d(TAG, "on advertise call back, state: " + advertiseState + " status: " + status);
            if (advertiseState == STATE_ADVERTISE_STARTED) {
                if (status == ADVERTISE_CALLBACK_SUCCESS) {
                    mAdvertiseCallback.onAdvertiseStart(status);
                } else {
                    // If status is unsuccessful and advertise state is started, it means stop
                    // advertising fails.
                    mAdvertiseCallback.onAdvertiseStop(status);
                }
            } else {
                synchronized (this) {
                    if (status == ADVERTISE_CALLBACK_SUCCESS) {
@@ -2011,7 +2017,13 @@ public final class BluetoothAdapter {
                        }
                    }
                }
                if (status == ADVERTISE_CALLBACK_SUCCESS) {
                    mAdvertiseCallback.onAdvertiseStop(status);
                } else{
                    // If status is unsuccesful and advertise state is stopped, it means start
                    // advertising fails.
                    mAdvertiseCallback.onAdvertiseStart(status);
                }
            }
        }
    }