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

Commit bf586051 authored by [1;5Cbkchoi's avatar [1;5Cbkchoi
Browse files

Add UserCompletedEventType#newUserCompletedEventType static method for testing.

Bug: 222358822

Test: atest com.android.internal.car.CarServiceHelperServiceTest

Change-Id: I95d226e5e2c0a1547a385e6bfaa9e19e6721dfd3
parent fad9dab6
Loading
Loading
Loading
Loading
+12 −1
Original line number Diff line number Diff line
@@ -32,6 +32,7 @@ import android.os.ServiceManager;
import android.os.UserHandle;
import android.os.UserManager;

import com.android.internal.annotations.VisibleForTesting;
import com.android.server.pm.UserManagerService;

import java.io.PrintWriter;
@@ -261,13 +262,23 @@ public abstract class SystemService {
        public @interface EventTypesFlag {
        }

        private @EventTypesFlag int mEventType;
        private final @EventTypesFlag int mEventType;

        /** @hide */
        UserCompletedEventType(@EventTypesFlag int eventType) {
            mEventType = eventType;
        }

        /**
         * Creates a new instance of {@link UserCompletedEventType}.
         * @hide
         */
        @VisibleForTesting
        public static UserCompletedEventType newUserCompletedEventTypeForTest(
                @EventTypesFlag int eventType) {
            return new UserCompletedEventType(eventType);
        }

        /** Returns whether one of the events is {@link #onUserStarting}. */
        public boolean includesOnUserStarting() {
            return (mEventType & EVENT_TYPE_USER_STARTING) != 0;