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.service;
18 
19 import android.content.pm.ApplicationInfo;
20 import android.os.Process;
21 import android.util.Log;
22 
23 public class ZygotePreload implements android.app.ZygotePreload {
24     private static final String TAG = "ZygotePreload";
25 
26     private static int sZygotePid = -1;
27 
28     private static String sZygotePackage = null;
29 
getZygotePid()30     public static int getZygotePid() {
31         return sZygotePid;
32     }
33 
getZygotePackage()34     public static String getZygotePackage() {
35         return sZygotePackage;
36     }
37 
doPreload(ApplicationInfo info)38     public void doPreload(ApplicationInfo info) {
39         sZygotePid = Process.myPid();
40         sZygotePackage = info.packageName;
41         Log.d(TAG, "Doing ZygotePreload, sZygotePid=" + sZygotePid);
42     }
43 }
44