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