• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 mTimeStarted;
28     private StringBuilder mState;
29     // This is only used for items with mCode == AppOpsManager.OP_RECORD_AUDIO
30     private boolean mSilenced;
31 
AppOpItem(int code, int uid, String packageName, long timeStarted)32     public AppOpItem(int code, int uid, String packageName, long timeStarted) {
33         this.mCode = code;
34         this.mUid = uid;
35         this.mPackageName = packageName;
36         this.mTimeStarted = timeStarted;
37         mState = new StringBuilder()
38                 .append("AppOpItem(")
39                 .append("Op code=").append(code).append(", ")
40                 .append("UID=").append(uid).append(", ")
41                 .append("Package name=").append(packageName).append(", ")
42                 .append("Paused=");
43     }
44 
getCode()45     public int getCode() {
46         return mCode;
47     }
48 
getUid()49     public int getUid() {
50         return mUid;
51     }
52 
getPackageName()53     public String getPackageName() {
54         return mPackageName;
55     }
56 
getTimeStarted()57     public long getTimeStarted() {
58         return mTimeStarted;
59     }
60 
setSilenced(boolean silenced)61     public void setSilenced(boolean silenced) {
62         mSilenced = silenced;
63     }
64 
isSilenced()65     public boolean isSilenced() {
66         return mSilenced;
67     }
68 
69     @Override
toString()70     public String toString() {
71         return mState.append(mSilenced).append(")").toString();
72     }
73 }
74