1 /* 2 * Copyright (C) 2019 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 17 package com.android.server.om; 18 19 import android.annotation.Nullable; 20 import android.annotation.UserIdInt; 21 import android.content.om.OverlayIdentifier; 22 import android.os.UserHandle; 23 24 /** 25 * State for dumps performed by the OverlayManagerService. 26 */ 27 public final class DumpState { 28 @UserIdInt private int mUserId = UserHandle.USER_ALL; 29 @Nullable private String mPackageName; 30 @Nullable private String mOverlayName; 31 @Nullable private String mField; 32 private boolean mVerbose; 33 34 /** Sets the user to dump the state for */ setUserId(@serIdInt int userId)35 public void setUserId(@UserIdInt int userId) { 36 mUserId = userId; 37 } getUserId()38 @UserIdInt public int getUserId() { 39 return mUserId; 40 } 41 42 /** Sets the name of the package to dump the state for */ setOverlyIdentifier(String overlayIdentifier)43 public void setOverlyIdentifier(String overlayIdentifier) { 44 final OverlayIdentifier overlay = OverlayIdentifier.fromString(overlayIdentifier); 45 mPackageName = overlay.getPackageName(); 46 mOverlayName = overlay.getOverlayName(); 47 } getPackageName()48 @Nullable public String getPackageName() { 49 return mPackageName; 50 } getOverlayName()51 @Nullable public String getOverlayName() { 52 return mOverlayName; 53 } 54 55 /** Sets the name of the field to dump the state for */ setField(String field)56 public void setField(String field) { 57 mField = field; 58 } getField()59 @Nullable public String getField() { 60 return mField; 61 } 62 63 /** Enables verbose dump state */ setVerbose(boolean verbose)64 public void setVerbose(boolean verbose) { 65 mVerbose = verbose; 66 } isVerbose()67 public boolean isVerbose() { 68 return mVerbose; 69 } 70 } 71