1/*
2 * Copyright (C) 2015 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
17package com.android.server.am;
18
19import android.app.ActivityManager;
20import android.os.UserHandle;
21
22/**
23 * Overall information about a uid that has actively running processes.
24 */
25public final class UidRecord {
26    final int uid;
27    int curProcState;
28    int setProcState = ActivityManager.PROCESS_STATE_NONEXISTENT;
29    int numProcs;
30
31    static final class ChangeItem {
32        UidRecord uidRecord;
33        int uid;
34        boolean gone;
35        int processState;
36    }
37
38    ChangeItem pendingChange;
39
40    public UidRecord(int _uid) {
41        uid = _uid;
42        reset();
43    }
44
45    public void reset() {
46        curProcState = ActivityManager.PROCESS_STATE_CACHED_EMPTY;
47    }
48
49    public String toString() {
50        StringBuilder sb = new StringBuilder(128);
51        sb.append("UidRecord{");
52        sb.append(Integer.toHexString(System.identityHashCode(this)));
53        sb.append(' ');
54        UserHandle.formatUid(sb, uid);
55        sb.append(' ');
56        sb.append(ProcessList.makeProcStateString(curProcState));
57        sb.append(" / ");
58        sb.append(numProcs);
59        sb.append(" procs}");
60        return sb.toString();
61    }
62}
63