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 android.app;
18 
19 import android.os.Parcel;
20 import android.os.Parcelable;
21 
22 /**
23  * State (oom score) for processes known to activity manager.
24  * {@hide}
25  */
26 public final class ProcessMemoryState implements Parcelable {
27     public final int uid;
28     public final int pid;
29     public final String processName;
30     public final int oomScore;
31 
ProcessMemoryState(int uid, int pid, String processName, int oomScore)32     public ProcessMemoryState(int uid, int pid, String processName, int oomScore) {
33         this.uid = uid;
34         this.pid = pid;
35         this.processName = processName;
36         this.oomScore = oomScore;
37     }
38 
ProcessMemoryState(Parcel in)39     private ProcessMemoryState(Parcel in) {
40         uid = in.readInt();
41         pid = in.readInt();
42         processName = in.readString();
43         oomScore = in.readInt();
44     }
45 
46     public static final @android.annotation.NonNull Creator<ProcessMemoryState> CREATOR = new Creator<ProcessMemoryState>() {
47         @Override
48         public ProcessMemoryState createFromParcel(Parcel in) {
49             return new ProcessMemoryState(in);
50         }
51 
52         @Override
53         public ProcessMemoryState[] newArray(int size) {
54             return new ProcessMemoryState[size];
55         }
56     };
57 
58     @Override
describeContents()59     public int describeContents() {
60         return 0;
61     }
62 
63     @Override
writeToParcel(Parcel parcel, int i)64     public void writeToParcel(Parcel parcel, int i) {
65         parcel.writeInt(uid);
66         parcel.writeInt(pid);
67         parcel.writeString(processName);
68         parcel.writeInt(oomScore);
69     }
70 }
71