Android AOSP内置GMS服务

Android源代码中加入GMS,安装Google Play、Chrome等相关应用,使AOSP系统用起来更加顺滑

一、环境准备

(1) Android系统源码编译环境(Android 9.0 Pixel 3)
(2) 开发环境(SubLime Text3)

二、GMS OPENGAPPS相关应用下载

GMS OPENGAPPS

三、GMS OPENGAPPS配置编译

参考GMS OPENGAPPSREADME文档,进行相关配置,使得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

猜你喜欢

转载自blog.csdn.net/qq_35993502/article/details/129967123