1 /* 2 * Copyright (C) 2018 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.systemui.appops; 18 19 /** 20 * Item to store information of active applications using different APP OPS 21 */ 22 public class AppOpItem { 23 24 private int mCode; 25 private int mUid; 26 private String mPackageName; 27 private long mTimeStartedElapsed; 28 private StringBuilder mState; 29 private boolean mIsDisabled; 30 AppOpItem(int code, int uid, String packageName, long timeStartedElapsed)31 public AppOpItem(int code, int uid, String packageName, long timeStartedElapsed) { 32 this.mCode = code; 33 this.mUid = uid; 34 this.mPackageName = packageName; 35 this.mTimeStartedElapsed = timeStartedElapsed; 36 mState = new StringBuilder() 37 .append("AppOpItem(") 38 .append("Op code=").append(code).append(", ") 39 .append("UID=").append(uid).append(", ") 40 .append("Package name=").append(packageName).append(", ") 41 .append("Paused="); 42 } 43 getCode()44 public int getCode() { 45 return mCode; 46 } 47 getUid()48 public int getUid() { 49 return mUid; 50 } 51 getPackageName()52 public String getPackageName() { 53 return mPackageName; 54 } 55 getTimeStartedElapsed()56 public long getTimeStartedElapsed() { 57 return mTimeStartedElapsed; 58 } 59 setDisabled(boolean misDisabled)60 public void setDisabled(boolean misDisabled) { 61 this.mIsDisabled = misDisabled; 62 } 63 isDisabled()64 public boolean isDisabled() { 65 return mIsDisabled; 66 } 67 68 @Override toString()69 public String toString() { 70 return mState.append(mIsDisabled).append(")").toString(); 71 } 72 } 73