• 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 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     public final boolean hasForegroundServices;
32 
ProcessMemoryState(int uid, int pid, String processName, int oomScore, boolean hasForegroundServices)33     public ProcessMemoryState(int uid, int pid, String processName, int oomScore,
34             boolean hasForegroundServices) {
35         this.uid = uid;
36         this.pid = pid;
37         this.processName = processName;
38         this.oomScore = oomScore;
39         this.hasForegroundServices = hasForegroundServices;
40     }
41 
ProcessMemoryState(Parcel in)42     private ProcessMemoryState(Parcel in) {
43         uid = in.readInt();
44         pid = in.readInt();
45         processName = in.readString();
46         oomScore = in.readInt();
47         hasForegroundServices = in.readInt() == 1;
48     }
49 
50     public static final @android.annotation.NonNull Creator<ProcessMemoryState> CREATOR = new Creator<ProcessMemoryState>() {
51         @Override
52         public ProcessMemoryState createFromParcel(Parcel in) {
53             return new ProcessMemoryState(in);
54         }
55 
56         @Override
57         public ProcessMemoryState[] newArray(int size) {
58             return new ProcessMemoryState[size];
59         }
60     };
61 
62     @Override
describeContents()63     public int describeContents() {
64         return 0;
65     }
66 
67     @Override
writeToParcel(Parcel parcel, int i)68     public void writeToParcel(Parcel parcel, int i) {
69         parcel.writeInt(uid);
70         parcel.writeInt(pid);
71         parcel.writeString(processName);
72         parcel.writeInt(oomScore);
73         parcel.writeInt(hasForegroundServices ? 1 : 0);
74     }
75 }
76