android 5.0后对于apk 跑32 64 的逻辑

本文详细介绍了在Android 5.0(代号L)之后,系统如何支持并运行32位和64位APK。主要讨论了在设备配置继承、zygote启动脚本、系统支持32位和64位应用的设置,以及启动过程中如何根据APK的指令集选择相应的zygote进程。在Android L上,启动脚本被抽象到单独的rc文件中,根据`ro.zygote`属性区分64位和32位zygote,从而实现不同位数的应用启动。此外,文章还介绍了如何判断APK的指令集,以及启动过程中的关键步骤,如通过ActivityManagerService调用Zygote来启动进程。
摘要由CSDN通过智能技术生成

1, 是否是 64 bit apk,在对应的 full_sky828_8s70.mk 里面,这里主要包含64 bit apk的支持, 还有zygote的启动方式,64 bit apk fork的简要过程

Inherit from hardware-specific part of the product configuration.

$(call inherit-product, device/skyworth/sky828_8s70/device.mk)

Inherit from the common Open Source product configuration.

(callinheritproduct, (SRC_TARGET_DIR)/product/core_64_bit.mk)
(callinheritproduct, (SRC_TARGET_DIR)/product/aosp_base.mk)
$(call inherit-product-if-exists, vendor/google/products/gms.mk)

这个里面主要的内容是:

Copy the 64-bit primary, 32-bit secondary zygote startup script

PRODUCT_COPY_FILES += system/core/rootdir/init.zygote64_32.rc:root/init.zygote64_32.rc

Set the zygote property to select the 64-bit primary, 32-bit secondary script

This line must be parsed before the one in core_minimal.mk

PRODUCT_DEFAULT_PROPERTY_OVERRIDES += ro.zygote=zygote64_32

TARGET_SUPPORTS_32_BIT_APPS := true
TARGET_SUPPORTS_64_BIT_APPS := true

这里主要是表明编译系统support 32 , 64 apk, 还有把zygote 名字ro.zygote设置为 zygote64_32,
在L之前启动zygote 是直接在 init.rc 里面通过
service zygote /system/bin/app_process -Xzygote /system/bin –zygote –start-system-server
class main
socket zygote stream 660 root system
onrestart write /sys/android_power/request_state wake
onrestart write /sys/power/state on
onrestart restart media
onrestart restart netd
这个来启动的, 但L上由于可能有2个zygote, 所以把zygote的启动脚本抽象到一个单独的rc文件里面, 根据ro.zygote来区分。
这个单独的脚本是在init rc里面include的。 具体如下
import /init.environ.rc
import /init.usb.rc
import /init. ro.hardware.rcimport

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值