Home | History | Annotate | Download | only in app
      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 package android.app;
     17 
     18 import android.annotation.NonNull;
     19 import android.content.pm.ApplicationInfo;
     20 
     21 /**
     22  * This is the interface to be implemented for the class that is specified by the
     23  * {@link android.R.styleable#AndroidManifestApplication_zygotePreloadName
     24  * android:zygotePreloadName} of the <application> tag.
     25  *
     26  * It is responsible for preloading application code and data, that will be shared by all
     27  * isolated services that have the
     28  * {@link android.R.styleable#AndroidManifestService_useAppZygote android:useAppZygote} attribute
     29  * of the &lt;service&gt; tag set to <code>true</code>.
     30  *
     31  * Note that implementations of this class must provide a default constructor with no arguments.
     32  */
     33 public interface ZygotePreload {
     34     /**
     35      * This method is called once every time the Application Zygote is started. It is normally
     36      * started the first time an isolated service that uses it is started. The Application Zygote
     37      * will be stopped when all isolated services that use it are stopped.
     38      *
     39      * @param appInfo The ApplicationInfo object belonging to the application
     40      */
     41     void doPreload(@NonNull ApplicationInfo appInfo);
     42 }
     43