1 /*
2  * Copyright (C) 2020 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package com.android.systemui.statusbar;
18 
19 import com.android.internal.logging.UiEvent;
20 import com.android.internal.logging.UiEventLogger;
21 
22 /**
23  * Events for changes in the {@link StatusBarState}.
24  */
25 public enum StatusBarStateEvent implements UiEventLogger.UiEventEnum {
26 
27     @UiEvent(doc = "StatusBarState changed to unknown state")
28     STATUS_BAR_STATE_UNKNOWN(428),
29 
30     @UiEvent(doc = "StatusBarState changed to SHADE state")
31     STATUS_BAR_STATE_SHADE(429),
32 
33     @UiEvent(doc = "StatusBarState changed to KEYGUARD state")
34     STATUS_BAR_STATE_KEYGUARD(430),
35 
36     @UiEvent(doc = "StatusBarState changed to SHADE_LOCKED state")
37     STATUS_BAR_STATE_SHADE_LOCKED(431),
38 
39     @UiEvent(doc = "StatusBarState changed to FULLSCREEN_USER_SWITCHER state")
40     STATUS_BAR_STATE_FULLSCREEN_USER_SWITCHER(432);
41 
42     private int mId;
StatusBarStateEvent(int id)43     StatusBarStateEvent(int id) {
44         mId = id;
45     }
46 
47     @Override
getId()48     public int getId() {
49         return mId;
50     }
51 
52     /**
53      * Return the event associated with the state.
54      */
fromState(int state)55     public static StatusBarStateEvent fromState(int state) {
56         switch(state) {
57             case StatusBarState.SHADE:
58                 return STATUS_BAR_STATE_SHADE;
59             case StatusBarState.KEYGUARD:
60                 return STATUS_BAR_STATE_KEYGUARD;
61             case StatusBarState.SHADE_LOCKED:
62                 return STATUS_BAR_STATE_SHADE_LOCKED;
63             case StatusBarState.FULLSCREEN_USER_SWITCHER:
64                 return STATUS_BAR_STATE_FULLSCREEN_USER_SWITCHER;
65             default:
66                 return STATUS_BAR_STATE_UNKNOWN;
67         }
68     }
69 }
70