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

Commit 95f48fa1 authored by Joner Lin's avatar Joner Lin Committed by Automerger Merge Worker
Browse files

Merge changes from topic "Handle Shutdown Intent" am: bd01f52b am: c5741e17

Original change: https://android-review.googlesource.com/c/platform/packages/modules/Bluetooth/+/2032224

Change-Id: Ide192bd17ce20476f0838b80ce2e695e00f4ac93
parents c8f48254 c5741e17
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -213,6 +213,7 @@ class BluetoothManagerService extends IBluetoothManager.Stub {
    // used inside handler thread
    private boolean mQuietEnable = false;
    private boolean mEnable;
    private boolean mShutdownInProgress = false;

    private static CharSequence timeToLog(long timestamp) {
        return android.text.format.DateFormat.format("MM-dd HH:mm:ss", timestamp);
@@ -475,6 +476,7 @@ class BluetoothManagerService extends IBluetoothManager.Stub {
                }
            } else if (action.equals(Intent.ACTION_SHUTDOWN)) {
                Slog.i(TAG, "Device is shutting down.");
                mShutdownInProgress = true;
                mBluetoothLock.readLock().lock();
                try {
                    mEnable = false;
@@ -1957,6 +1959,11 @@ class BluetoothManagerService extends IBluetoothManager.Stub {
                case MESSAGE_ENABLE:
                    int quietEnable = msg.arg1;
                    int isBle  = msg.arg2;
                    if (mShutdownInProgress) {
                        Slog.i(TAG, "Skip Bluetooth Enable in device shutdown process");
                        break;
                    }

                    if (mHandler.hasMessages(MESSAGE_HANDLE_DISABLE_DELAYED)
                            || mHandler.hasMessages(MESSAGE_HANDLE_ENABLE_DELAYED)) {
                        // We are handling enable or disable right now, wait for it.