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

Commit 2a695de5 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "UserSwitchingDialog timeout shouldn't remove all callbacks and messages." into main

parents 7869b006 82fc9045
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -203,6 +203,7 @@ class UserController implements Handler.Callback {
    static final int COMPLETE_USER_SWITCH_MSG = 130;
    static final int USER_COMPLETED_EVENT_MSG = 140;
    static final int SCHEDULED_STOP_BACKGROUND_USER_MSG = 150;
    static final int USER_SWITCHING_DIALOG_ANIMATION_TIMEOUT_MSG = 160;

    private static final int NO_ARG2 = 0;

+4 −2
Original line number Diff line number Diff line
@@ -16,6 +16,8 @@

package com.android.server.am;

import static com.android.server.am.UserController.USER_SWITCHING_DIALOG_ANIMATION_TIMEOUT_MSG;

import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.UserIdInt;
@@ -302,14 +304,14 @@ class UserSwitchingDialog extends Dialog {
        final AtomicBoolean isFirst = new AtomicBoolean(true);
        final Runnable onAnimationEndOrTimeout = () -> {
            if (isFirst.getAndSet(false)) {
                mHandler.removeCallbacksAndMessages(null);
                mHandler.removeMessages(USER_SWITCHING_DIALOG_ANIMATION_TIMEOUT_MSG);
                onAnimationEnd.run();
            }
        };
        mHandler.postDelayed(() -> {
            Slog.w(TAG, name + " animation not completed in " + ANIMATION_TIMEOUT_MS + " ms");
            onAnimationEndOrTimeout.run();
        }, ANIMATION_TIMEOUT_MS);
        }, USER_SWITCHING_DIALOG_ANIMATION_TIMEOUT_MSG, ANIMATION_TIMEOUT_MS);

        return onAnimationEndOrTimeout;
    }