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