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 private int mId; StatusBarStateEvent(int id)40 StatusBarStateEvent(int id) { 41 mId = id; 42 } 43 44 @Override getId()45 public int getId() { 46 return mId; 47 } 48 49 /** 50 * Return the event associated with the state. 51 */ fromState(int state)52 public static StatusBarStateEvent fromState(int state) { 53 switch(state) { 54 case StatusBarState.SHADE: 55 return STATUS_BAR_STATE_SHADE; 56 case StatusBarState.KEYGUARD: 57 return STATUS_BAR_STATE_KEYGUARD; 58 case StatusBarState.SHADE_LOCKED: 59 return STATUS_BAR_STATE_SHADE_LOCKED; 60 default: 61 return STATUS_BAR_STATE_UNKNOWN; 62 } 63 } 64 } 65