1首先看看手机里的是什么
adb shell pm path com.android.launcher3
package:/system_ext/priv-app/Launcher3QuickStep/Launcher3QuickStep.apk
然后就编译Launcher3QuickStep
2push apk
没什么说的,push到对应的文件夹
/system_ext/priv-app/Launcher3QuickStep/Launcher3QuickStep.apk
3reboot
有可能起不来,因为权限的问题啥的,别着急,缺啥权限,补什么权限,不用改代码,直接修改push。
开机起不来,抓log,会出现下面的fatal exception,一看缺下面的权限
08-25 14:16:01.118 11140 11140 D AndroidRuntime: Shutting down VM
08-25 14:16:01.118 11140 11140 E AndroidRuntime: *** FATAL EXCEPTION IN SYSTEM PROCESS: main
08-25 14:16:01.118 11140 11140 E AndroidRuntime: java.lang.IllegalStateException: Signature|privileged permissions not in privapp-permissions allowlist: {com.android.launcher3 (/system_ext/priv-app/Launcher3QuickStep): android.permission.FORCE_STOP_PACKAGES}
我们知道launcher3的权限都定义在/frameworks/base/data/etc/com.android.launcher3.xml,
然后去frameworks/base/data/etc/Android.bp下面看看这个xml文件编译到哪里
prebuilt_etc {
name: "privapp_whitelist_com.android.launcher3",
system_ext_specific: true,
sub_dir: "permissions",
src: "com.android.launcher3.xml",
filename_from_src: true,
}
system_ext_specific: true,------说明编译到system/system_ext/etc/permissions/
然后我们就去手机的这个下面去找,
adb shell
cd system/system_ext/etc/permissions/
cat com.android.launcher3.xml
<permissions>
<privapp-permissions package="com.android.launcher3">
<permission name="android.permission.BIND_APPWIDGET"/>
<permission name="android.permission.CONTROL_REMOTE_APP_TRANSITION_ANIMATIONS"/>
<permission name="android.permission.GET_ACCOUNTS_PRIVILEGED"/>
<permission name="android.permission.WRITE_SECURE_SETTINGS"/>
<permission name="android.permission.BROADCAST_CLOSE_SYSTEM_DIALOGS"/>
<permission name="android.permission.START_TASKS_FROM_RECENTS"/>
<permission name="android.permission.STATUS_BAR"/>
<permission name="android.permission.STOP_APP_SWITCHES"/>
</privapp-permissions>
</permissions>
发现果然没有 <permission name="android.permission.FORCE_STOP_PACKAGES"/>
然后把这个文件pull出来,
adb pull system/system_ext/etc/permissions/com.android.launcher3.xml .
然后加上上面缺的那个权限,再push回去。
adb push com.android.launcher3.xml system/system_ext/etc/permissions/com.android.launcher3.xml
然后重新启动。
参考文章 android11,12 Launcher3编译什么