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_INTENT_FILTER_VERIFIERS = 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 
47     public static final int OPTION_SHOW_FILTERS = 1 << 0;
48     public static final int OPTION_DUMP_ALL_COMPONENTS = 1 << 1;
49     public static final int OPTION_SKIP_PERMISSIONS = 1 << 2;
50 
51     private int mTypes;
52 
53     private int mOptions;
54 
55     private boolean mTitlePrinted;
56 
57     private SharedUserSetting mSharedUser;
58 
isDumping(int type)59     public boolean isDumping(int type) {
60         if (mTypes == 0 && type != DUMP_PREFERRED_XML) {
61             return true;
62         }
63 
64         return (mTypes & type) != 0;
65     }
66 
setDump(int type)67     public void setDump(int type) {
68         mTypes |= type;
69     }
70 
isOptionEnabled(int option)71     public boolean isOptionEnabled(int option) {
72         return (mOptions & option) != 0;
73     }
74 
setOptionEnabled(int option)75     public void setOptionEnabled(int option) {
76         mOptions |= option;
77     }
78 
onTitlePrinted()79     public boolean onTitlePrinted() {
80         final boolean printed = mTitlePrinted;
81         mTitlePrinted = true;
82         return printed;
83     }
84 
getTitlePrinted()85     public boolean getTitlePrinted() {
86         return mTitlePrinted;
87     }
88 
setTitlePrinted(boolean enabled)89     public void setTitlePrinted(boolean enabled) {
90         mTitlePrinted = enabled;
91     }
92 
getSharedUser()93     public SharedUserSetting getSharedUser() {
94         return mSharedUser;
95     }
96 
setSharedUser(SharedUserSetting user)97     public void setSharedUser(SharedUserSetting user) {
98         mSharedUser = user;
99     }
100 }
101