1 /*
2  * Copyright (C) 2019 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.externalservice.common;
18 
19 import android.os.Parcel;
20 import android.os.Parcelable;
21 
22 /**
23  * A class that encapsulates information about a running service process
24  * and information about how it was created.
25  */
26 public class RunningServiceInfo implements Parcelable {
27     /** The UNIX user ID of the running service process. */
28     public int uid;
29 
30     /** The UNIX process ID of the running service process. */
31     public int pid;
32 
33     /** The package name that the process is running under. */
34     public String packageName;
35 
36     /** The value reported from the test's ZygotePreload.getZygotePid(). */
37     public int zygotePid;
38 
39     /** The value reported from the test's ZygotePreload.getZygotePackage(). */
40     public String zygotePackage;
41 
writeToParcel(Parcel dest, int parcelableFlags)42     public void writeToParcel(Parcel dest, int parcelableFlags) {
43         dest.writeInt(uid);
44         dest.writeInt(pid);
45         dest.writeString(packageName);
46         dest.writeInt(zygotePid);
47         dest.writeString(zygotePackage);
48     }
49 
50     public static final Parcelable.Creator<RunningServiceInfo> CREATOR
51             = new Parcelable.Creator<RunningServiceInfo>() {
52         public RunningServiceInfo createFromParcel(Parcel source) {
53             RunningServiceInfo info = new RunningServiceInfo();
54             info.uid = source.readInt();
55             info.pid = source.readInt();
56             info.packageName = source.readString();
57             info.zygotePid = source.readInt();
58             info.zygotePackage = source.readString();
59             return info;
60         }
61         public RunningServiceInfo[] newArray(int size) {
62             return new RunningServiceInfo[size];
63         }
64     };
65 
describeContents()66     public int describeContents() {
67         return 0;
68     }
69 }
70