在Android
源代码中加入GMS
,安装Google Play、Chrome
等相关应用,使AOSP
系统用起来更加顺滑
一、环境准备
(1) Android系统源码编译环境(Android 9.0 Pixel 3)
(2) 开发环境(SubLime Text3)
二、GMS OPENGAPPS相关应用下载
三、GMS OPENGAPPS配置编译
参考GMS OPENGAPPS的README
文档,进行相关配置,使得OPENGAPPS
参与系统的编译,并生成含有GMS
服务的系统
1)在aosp/.repo/manifests/default.xml
文件中追加如下内容
<remote name="opengapps" fetch="https://github.com/opengapps/" />
<remote name="opengapps-gitlab" fetch="https://gitlab.opengapps.org/opengapps/" />
<project path="vendor/opengapps/build" name="aosp_build" revision="master" remote="opengapps" />
<project path="vendor/opengapps/sources/all" name="all" clone-depth="1" revision="master" remote="opengapps-gitlab" />
<!-- arm64 depends on arm -->
<project path="vendor/opengapps/sources/arm" name="arm" clone-depth="1" revision="master" remote="opengapps-gitlab" />
<project path="vendor/opengapps/sources/arm64" name="arm64" clone-depth="1" revision="master" remote="opengapps-gitlab" />
<project path="vendor/opengapps/sources/x86" name="x86" clone-depth="1" revision="master" remote="opengapps-gitlab" />
<project path="vendor/opengapps/sources/x86_64" name="x86_64" clone-depth="1" revision="master" remote="opengapps-gitlab" />
git commit -a -m "add open gapps"
2)在aosp/device/google/muskie/aosp_walleye.mk
文件中修改配置
- PRODUCT_RESTRICT_VENDOR_FILES := owner
+ PRODUCT_RESTRICT_VENDOR_FILES := false
3)在device/google/crosshatch/device.mk
文件中追加如下内容
GAPPS_VARIANT := mini
WITH_DEXPREOPT := true
DONT_DEXPREOPT_PREBUILTS := true
$(call inherit-product, vendor/opengapps/build/opengapps-packages.mk)
4)在frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
文件中修改内容
public class WindowManagerService extends IWindowManager.Stub
@Override
public void setShelfHeight(boolean visible, int shelfHeight) {
- mAmInternal.enforceCallerIsRecentsOrHasPermission(android.Manifest.permission.STATUS_BAR,
- "setShelfHeight()");
+ //mAmInternal.enforceCallerIsRecentsOrHasPermission(android.Manifest.permission.STATUS_BAR,
+ // "setShelfHeight()");
synchronized (mWindowMap) {
getDefaultDisplayContentLocked().getPinnedStackController().setAdjustedForShelf(visible,
shelfHeight)
5)拉取OPENGAPPS
文件
sudo apt install git-lfs
git lfs install
repo forall -c git lfs pull
四、编译系统
srouce build/envsetup.sh
lunch xxx
make -j16
五、刷入设备
fastboot flashall -w

