共用方式為


ServiceInfo.FlagUseAppZygote Field

Definition

Caution

This constant will be removed in the future version. Use Android.Content.PM.ServiceInfoFlags enum directly instead of this field.

Bit in #flags: If set, the service (which must be isolated) will be spawned from an Application Zygote, instead of the regular Zygote.

[Android.Runtime.Register("FLAG_USE_APP_ZYGOTE", ApiSince=29)]
[System.Obsolete("This constant will be removed in the future version. Use Android.Content.PM.ServiceInfoFlags enum directly instead of this field.", true)]
public const Android.Content.PM.ServiceInfoFlags FlagUseAppZygote = 8;
[<Android.Runtime.Register("FLAG_USE_APP_ZYGOTE", ApiSince=29)>]
[<System.Obsolete("This constant will be removed in the future version. Use Android.Content.PM.ServiceInfoFlags enum directly instead of this field.", true)>]
val mutable FlagUseAppZygote : Android.Content.PM.ServiceInfoFlags

Field Value

Value = 8

Implements

Attributes

Remarks

Bit in #flags: If set, the service (which must be isolated) will be spawned from an Application Zygote, instead of the regular Zygote. The Application Zygote will pre-initialize the application's class loader, and call a static callback into the application to allow it to perform application-specific preloads (such as loading a shared library). Therefore, spawning from the Application Zygote will typically reduce the service launch time and reduce its memory usage. The downside of using this flag is that you will have an additional process (the app zygote itself) that is taking up memory. Whether actual memory usage is improved therefore strongly depends on the number of isolated services that an application starts, and how much memory those services save by preloading. Therefore, it is recommended to measure memory usage under typical workloads to determine whether it makes sense to use this flag.

Java documentation for android.content.pm.ServiceInfo.FLAG_USE_APP_ZYGOTE.

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to