• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2014 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.server.am;
18 
19 import android.util.Log;
20 import android.util.LogWriter;
21 
22 import java.io.PrintWriter;
23 
24 /**
25  * Common class for the various debug {@link android.util.Log} output configuration in the activity
26  * manager package.
27  */
28 class ActivityManagerDebugConfig {
29 
30     // All output logs in the activity manager package use the {@link #TAG_AM} string for tagging
31     // their log output. This makes it easy to identify the origin of the log message when sifting
32     // through a large amount of log output from multiple sources. However, it also makes trying
33     // to figure-out the origin of a log message while debugging the activity manager a little
34     // painful. By setting this constant to true, log messages from the activity manager package
35     // will be tagged with their class names instead fot the generic tag.
36     static final boolean TAG_WITH_CLASS_NAME = false;
37 
38     // While debugging it is sometimes useful to have the category name of the log appended to the
39     // base log tag to make sifting through logs with the same base tag easier. By setting this
40     // constant to true, the category name of the log point will be appended to the log tag.
41     static final boolean APPEND_CATEGORY_NAME = false;
42 
43     // Default log tag for the activity manager package.
44     static final String TAG_AM = "ActivityManager";
45 
46     // Default writer that emits "info" log events for the activity manager package.
47     static final PrintWriter LOG_WRITER_INFO = new PrintWriter(
48             new LogWriter(Log.INFO, TAG_AM));
49 
50     // Enable all debug log categories.
51     static final boolean DEBUG_ALL = false;
52 
53     // Available log categories in the activity manager package.
54     static final boolean DEBUG_ANR = false;
55     static final boolean DEBUG_BACKGROUND_CHECK = DEBUG_ALL || false;
56     static final boolean DEBUG_BACKUP = DEBUG_ALL || false;
57     static final boolean DEBUG_BROADCAST = DEBUG_ALL || false;
58     static final boolean DEBUG_BROADCAST_LIGHT = DEBUG_BROADCAST || false;
59     static final boolean DEBUG_COMPACTION = DEBUG_ALL || false;
60     static final boolean DEBUG_FREEZER = DEBUG_ALL || false;
61     static final boolean DEBUG_LRU = DEBUG_ALL || false;
62     static final boolean DEBUG_MU = DEBUG_ALL || false;
63     static final boolean DEBUG_NETWORK = DEBUG_ALL || false;
64     static final boolean DEBUG_OOM_ADJ = DEBUG_ALL || false;
65     static final boolean DEBUG_OOM_ADJ_REASON = DEBUG_ALL || false;
66     static final boolean DEBUG_POWER = DEBUG_ALL || false;
67     static final boolean DEBUG_POWER_QUICK = DEBUG_POWER || false;
68     static final boolean DEBUG_PROCESS_OBSERVERS = DEBUG_ALL || false;
69     static final boolean DEBUG_PROCESSES = DEBUG_ALL || false;
70     static final boolean DEBUG_PROVIDER = DEBUG_ALL || false;
71     static final boolean DEBUG_PSS = DEBUG_ALL || false;
72     static final boolean DEBUG_RSS = DEBUG_ALL || false;
73     static final boolean DEBUG_SERVICE = DEBUG_ALL || false;
74     static final boolean DEBUG_FOREGROUND_SERVICE = DEBUG_ALL || false;
75     static final boolean DEBUG_SERVICE_EXECUTING = DEBUG_ALL || false;
76     static final boolean DEBUG_UID_OBSERVERS = DEBUG_ALL || false;
77     static final boolean DEBUG_USAGE_STATS = DEBUG_ALL || false;
78     static final boolean DEBUG_PERMISSIONS_REVIEW = DEBUG_ALL || false;
79     static final boolean DEBUG_ALLOWLISTS = DEBUG_ALL || false;
80 
81     static final String POSTFIX_BACKUP = (APPEND_CATEGORY_NAME) ? "_Backup" : "";
82     static final String POSTFIX_BROADCAST = (APPEND_CATEGORY_NAME) ? "_Broadcast" : "";
83     static final String POSTFIX_CLEANUP = (APPEND_CATEGORY_NAME) ? "_Cleanup" : "";
84     static final String POSTFIX_LRU = (APPEND_CATEGORY_NAME) ? "_LRU" : "";
85     static final String POSTFIX_MU = "_MU";
86     static final String POSTFIX_NETWORK = "_Network";
87     static final String POSTFIX_OOM_ADJ = (APPEND_CATEGORY_NAME) ? "_OomAdj" : "";
88     static final String POSTFIX_POWER = (APPEND_CATEGORY_NAME) ? "_Power" : "";
89     static final String POSTFIX_PROCESS_OBSERVERS = (APPEND_CATEGORY_NAME)
90             ? "_ProcessObservers" : "";
91     static final String POSTFIX_PROCESSES = (APPEND_CATEGORY_NAME) ? "_Processes" : "";
92     static final String POSTFIX_PSS = (APPEND_CATEGORY_NAME) ? "_Pss" : "";
93     static final String POSTFIX_RSS = (APPEND_CATEGORY_NAME) ? "_Rss" : "";
94     static final String POSTFIX_SERVICE = (APPEND_CATEGORY_NAME) ? "_Service" : "";
95     static final String POSTFIX_SERVICE_EXECUTING =
96             (APPEND_CATEGORY_NAME) ? "_ServiceExecuting" : "";
97     static final String POSTFIX_UID_OBSERVERS = (APPEND_CATEGORY_NAME)
98             ? "_UidObservers" : "";
99 }
100