DumpState.java revision 91a39d126d1f6efa47948ca1039ca347c1bd19e6
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 */
16package com.android.server.pm;
17
18public 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
44    public static final int OPTION_SHOW_FILTERS = 1 << 0;
45
46    private int mTypes;
47
48    private int mOptions;
49
50    private boolean mTitlePrinted;
51
52    private SharedUserSetting mSharedUser;
53
54    public boolean isDumping(int type) {
55        if (mTypes == 0 && type != DUMP_PREFERRED_XML) {
56            return true;
57        }
58
59        return (mTypes & type) != 0;
60    }
61
62    public void setDump(int type) {
63        mTypes |= type;
64    }
65
66    public boolean isOptionEnabled(int option) {
67        return (mOptions & option) != 0;
68    }
69
70    public void setOptionEnabled(int option) {
71        mOptions |= option;
72    }
73
74    public boolean onTitlePrinted() {
75        final boolean printed = mTitlePrinted;
76        mTitlePrinted = true;
77        return printed;
78    }
79
80    public boolean getTitlePrinted() {
81        return mTitlePrinted;
82    }
83
84    public void setTitlePrinted(boolean enabled) {
85        mTitlePrinted = enabled;
86    }
87
88    public SharedUserSetting getSharedUser() {
89        return mSharedUser;
90    }
91
92    public void setSharedUser(SharedUserSetting user) {
93        mSharedUser = user;
94    }
95}