Debian Codegraph @

libs/WindowManager/Shell/src/com/android/wm/shell/protolog/ShellProtoLogGroup.java

raw symbols SCIP
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.wm.shell.protolog;
18
19 import com.android.internal.protolog.common.IProtoLogGroup;
20
21 /**
22 * Defines logging groups for ProtoLog.
23 *
24 * This file is used by the ProtoLogTool to generate optimized logging code.
25 */
26 public enum ShellProtoLogGroup implements IProtoLogGroup {
27 // NOTE: Since we enable these from the same WM ShellCommand, these names should not conflict
28 // with those in the framework ProtoLogGroup
29 WM_SHELL_INIT(Consts.ENABLE_DEBUG, Consts.ENABLE_LOG_TO_PROTO_DEBUG, true,
30 Consts.TAG_WM_SHELL),
31 WM_SHELL_TASK_ORG(Consts.ENABLE_DEBUG, Consts.ENABLE_LOG_TO_PROTO_DEBUG, false,
32 Consts.TAG_WM_SHELL),
33 WM_SHELL_TRANSITIONS(Consts.ENABLE_DEBUG, Consts.ENABLE_LOG_TO_PROTO_DEBUG, true,
34 Consts.TAG_WM_SHELL),
35 WM_SHELL_DRAG_AND_DROP(Consts.ENABLE_DEBUG, Consts.ENABLE_LOG_TO_PROTO_DEBUG, true,
36 Consts.TAG_WM_SHELL),
37 WM_SHELL_STARTING_WINDOW(Consts.ENABLE_DEBUG, Consts.ENABLE_LOG_TO_PROTO_DEBUG, false,
38 Consts.TAG_WM_STARTING_WINDOW),
39 WM_SHELL_BACK_PREVIEW(Consts.ENABLE_DEBUG, Consts.ENABLE_LOG_TO_PROTO_DEBUG, true,
40 "ShellBackPreview"),
41 WM_SHELL_RECENT_TASKS(Consts.ENABLE_DEBUG, Consts.ENABLE_LOG_TO_PROTO_DEBUG, false,
42 Consts.TAG_WM_SHELL),
43 WM_SHELL_PICTURE_IN_PICTURE(Consts.ENABLE_DEBUG, Consts.ENABLE_LOG_TO_PROTO_DEBUG, false,
44 Consts.TAG_WM_SHELL),
45 WM_SHELL_SPLIT_SCREEN(Consts.ENABLE_DEBUG, Consts.ENABLE_LOG_TO_PROTO_DEBUG, true,
46 Consts.TAG_WM_SPLIT_SCREEN),
47 WM_SHELL_SYSUI_EVENTS(Consts.ENABLE_DEBUG, Consts.ENABLE_LOG_TO_PROTO_DEBUG, false,
48 Consts.TAG_WM_SHELL),
49 WM_SHELL_DESKTOP_MODE(Consts.ENABLE_DEBUG, Consts.ENABLE_LOG_TO_PROTO_DEBUG, false,
50 Consts.TAG_WM_SHELL),
51 WM_SHELL_FLOATING_APPS(Consts.ENABLE_DEBUG, Consts.ENABLE_LOG_TO_PROTO_DEBUG, false,
52 Consts.TAG_WM_SHELL),
53 TEST_GROUP(true, true, false, "WindowManagerShellProtoLogTest");
54
55 private final boolean mEnabled;
56 private volatile boolean mLogToProto;
57 private volatile boolean mLogToLogcat;
58 private final String mTag;
59
60 /**
61 * @param enabled set to false to exclude all log statements for this group from
62 * compilation,
63 * they will not be available in runtime.
64 * @param logToProto enable binary logging for the group
65 * @param logToLogcat enable text logging for the group
66 * @param tag name of the source of the logged message
67 */
68 ShellProtoLogGroup(boolean enabled, boolean logToProto, boolean logToLogcat, String tag) {
69 this.mEnabled = enabled;
70 this.mLogToProto = logToProto;
71 this.mLogToLogcat = logToLogcat;
72 this.mTag = tag;
73 }
74
75 @Override
76 public boolean isEnabled() {
77 return mEnabled;
78 }
79
80 @Override
81 public boolean isLogToProto() {
82 return mLogToProto;
83 }
84
85 @Override
86 public boolean isLogToLogcat() {
87 return mLogToLogcat;
88 }
89
90 @Override
91 public boolean isLogToAny() {
92 return mLogToLogcat || mLogToProto;
93 }
94
95 @Override
96 public String getTag() {
97 return mTag;
98 }
99
100 @Override
101 public void setLogToProto(boolean logToProto) {
102 this.mLogToProto = logToProto;
103 }
104
105 @Override
106 public void setLogToLogcat(boolean logToLogcat) {
107 this.mLogToLogcat = logToLogcat;
108 }
109
110 private static class Consts {
111 private static final String TAG_WM_SHELL = "WindowManagerShell";
112 private static final String TAG_WM_STARTING_WINDOW = "ShellStartingWindow";
113 private static final String TAG_WM_SPLIT_SCREEN = "ShellSplitScreen";
114
115 private static final boolean ENABLE_DEBUG = true;
116 private static final boolean ENABLE_LOG_TO_PROTO_DEBUG = true;
117 }
118 }