1 /*
2  * Copyright (C) 2017 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 package com.android.server.pm;
17 
18 public final class DumpState {
19     public static final int DUMP_LIBS = 1 << 0;
20     public static final int DUMP_FEATURES = 1 << 1;
21     public static final int DUMP_ACTIVITY_RESOLVERS = 1 << 2;
22     public static final int DUMP_SERVICE_RESOLVERS = 1 << 3;
23     public static final int DUMP_RECEIVER_RESOLVERS = 1 << 4;
24     public static final int DUMP_CONTENT_RESOLVERS = 1 << 5;
25     public static final int DUMP_PERMISSIONS = 1 << 6;
26     public static final int DUMP_PACKAGES = 1 << 7;
27     public static final int DUMP_SHARED_USERS = 1 << 8;
28     public static final int DUMP_MESSAGES = 1 << 9;
29     public static final int DUMP_PROVIDERS = 1 << 10;
30     public static final int DUMP_VERIFIERS = 1 << 11;
31     public static final int DUMP_PREFERRED = 1 << 12;
32     public static final int DUMP_PREFERRED_XML = 1 << 13;
33     public static final int DUMP_KEYSETS = 1 << 14;
34     public static final int DUMP_VERSION = 1 << 15;
35     public static final int DUMP_INSTALLS = 1 << 16;
36     public static final int DUMP_DOMAIN_VERIFIER = 1 << 17;
37     public static final int DUMP_DOMAIN_PREFERRED = 1 << 18;
38     public static final int DUMP_FROZEN = 1 << 19;
39     public static final int DUMP_DEXOPT = 1 << 20;
40     public static final int DUMP_COMPILER_STATS = 1 << 21;
41     public static final int DUMP_CHANGES = 1 << 22;
42     public static final int DUMP_VOLUMES = 1 << 23;
43     public static final int DUMP_SERVICE_PERMISSIONS = 1 << 24;
44     public static final int DUMP_APEX = 1 << 25;
45     public static final int DUMP_QUERIES = 1 << 26;
46     public static final int DUMP_KNOWN_PACKAGES = 1 << 27;
47     public static final int DUMP_PER_UID_READ_TIMEOUTS = 1 << 28;
48     public static final int DUMP_SNAPSHOT_STATISTICS = 1 << 29;
49     public static final int DUMP_PROTECTED_BROADCASTS = 1 << 30;
50 
51     public static final int OPTION_SHOW_FILTERS = 1 << 0;
52     public static final int OPTION_DUMP_ALL_COMPONENTS = 1 << 1;
53     public static final int OPTION_SKIP_PERMISSIONS = 1 << 2;
54     public static final int OPTION_INCLUDE_APEX = 1 << 3;
55 
56     private int mTypes;
57 
58     private int mOptions;
59 
60     private boolean mTitlePrinted;
61     private boolean mFullPreferred;
62     private boolean mCheckIn;
63     private boolean mBrief;
64 
65     private String mTargetPackageName;
66 
67     private SharedUserSetting mSharedUser;
68 
isDumping(int type)69     public boolean isDumping(int type) {
70         if (mTypes == 0 && type != DUMP_PREFERRED_XML) {
71             return true;
72         }
73 
74         return (mTypes & type) != 0;
75     }
76 
setDump(int type)77     public void setDump(int type) {
78         mTypes |= type;
79     }
80 
isOptionEnabled(int option)81     public boolean isOptionEnabled(int option) {
82         return (mOptions & option) != 0;
83     }
84 
setOptionEnabled(int option)85     public void setOptionEnabled(int option) {
86         mOptions |= option;
87     }
88 
onTitlePrinted()89     public boolean onTitlePrinted() {
90         final boolean printed = mTitlePrinted;
91         mTitlePrinted = true;
92         return printed;
93     }
94 
getTitlePrinted()95     public boolean getTitlePrinted() {
96         return mTitlePrinted;
97     }
98 
setTitlePrinted(boolean enabled)99     public void setTitlePrinted(boolean enabled) {
100         mTitlePrinted = enabled;
101     }
102 
getSharedUser()103     public SharedUserSetting getSharedUser() {
104         return mSharedUser;
105     }
106 
setSharedUser(SharedUserSetting user)107     public void setSharedUser(SharedUserSetting user) {
108         mSharedUser = user;
109     }
110 
getTargetPackageName()111     public String getTargetPackageName() {
112         return mTargetPackageName;
113     }
114 
setTargetPackageName(String packageName)115     public void setTargetPackageName(String packageName) {
116         mTargetPackageName = packageName;
117     }
118 
isFullPreferred()119     public boolean isFullPreferred() {
120         return mFullPreferred;
121     }
122 
setFullPreferred(boolean fullPreferred)123     public void setFullPreferred(boolean fullPreferred) {
124         mFullPreferred = fullPreferred;
125     }
126 
isCheckIn()127     public boolean isCheckIn() {
128         return mCheckIn;
129     }
130 
setCheckIn(boolean checkIn)131     public void setCheckIn(boolean checkIn) {
132         mCheckIn = checkIn;
133     }
134 
isBrief()135     public boolean isBrief() {
136         return mBrief;
137     }
138 
setBrief(boolean brief)139     public void setBrief(boolean brief) {
140         mBrief = brief;
141     }
142 }
143