AOSP10 替换系统launcher

news/2024/5/17 15:54:01 标签: gitee

本文实现将原生的launcher 移除,替换成我们自己写的launcher。

分以下几个步骤:

一、新建一个自己的launcher项目。

1.直接使用android studio 新建一个项目。

2.修改AndroidManifest.xml 

  <application
        android:persistent="true"
        android:allowBackup="true"
        android:dataExtractionRules="@xml/data_extraction_rules"
        android:fullBackupContent="@xml/backup_rules"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/Theme.AngeLauncher"
        tools:targetApi="31">
        <activity
            android:name=".MainActivity"
            android:exported="true"
            android:label="@string/app_name"
            android:theme="@style/Theme.AngeLauncher">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
              <!--launcher相关-->
                <category android:name="android.intent.category.HOME" />
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.MONKEY"/>
                <category android:name="android.intent.category.LAUNCHER_APP" />

            </intent-filter>
        </activity>
    </application>

2.生成系统的签名并添加到新建的launcher 项目中

接着我们需要制作系统签名,这里使用 keytool-importkeypair 签名工具。

将 keytool-importkeypair clone 到本地,并将其中的 keytool-importkeypair 文件添加到 PATH 路径。

接着进入系统源码下的 build/target/product/security 路径,接着执行:

keytool-importkeypair -k ./platform.keystore -p android -pk8 platform.pk8 -cert platform.x509.pem -alias platform

k 表示要生成的 keystore 文件的名字,这里命名为 platform.keystore -p 表示要生成的 keystore 的密码,这里是 android -pk8 表示要导入的 platform.pk8 文件 -cert 表示要导入的platform.x509.pem -alias 表示给生成的 platform.keystore 取一个别名,这是命名为 platform

接着,把生成的签名文件 platform.keystore 拷贝到 Android Studio 项目的 app 目录下,然后在 app/build.gradle 中添加签名的配置信息:

 signingConfigs {
        sign {
            storeFile file('platform.keystore')
            storePassword 'android'
            keyAlias = 'platform'
            keyPassword 'android'
        }
    }

    buildTypes {
        release {
            signingConfig signingConfigs.sign
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }

3.编译生成apk。

二、添加product

1.在device 目录下添加ange/lqa 文件夹,并新建文件 AndroidProducts.mk 

PRODUCT_MAKEFILES := \
    $(LOCAL_DIR)/lqa.mk

COMMON_LUNCH_CHOICES := \
    lqa-eng \
    lqa-userdebug \
    lqa-user \

2.拷贝 build/target/board/generic_x86_64/BoardConfig.mk 到ange/lqa 文件夹下

3.拷贝 build/target/product/aosp_x86_64.mk并重命名为lqa.mk到ange/lqa 文件夹下,并作修改如下:

#
# Copyright 2013 The Android Open-Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

PRODUCT_USE_DYNAMIC_PARTITIONS := true

# The system image of aosp_x86_64-userdebug is a GSI for the devices with:
# - x86 64 bits user space
# - 64 bits binder interface
# - system-as-root
# - VNDK enforcement
# - compatible property override enabled

# This is a build configuration for a full-featured build of the
# Open-Source part of the tree. It's geared toward a US-centric
# build quite specifically for the emulator, and might not be
# entirely appropriate to inherit from for on-device configurations.

# GSI for system/product
$(call inherit-product, $(SRC_TARGET_DIR)/product/core_64_bit.mk)
$(call inherit-product, $(SRC_TARGET_DIR)/product/gsi_common.mk)

# Emulator for vendor
$(call inherit-product-if-exists, device/generic/goldfish/x86_64-vendor.mk)
$(call inherit-product, $(SRC_TARGET_DIR)/product/emulator_vendor.mk)
$(call inherit-product, $(SRC_TARGET_DIR)/board/generic_x86_64/device.mk)

# Enable mainline checking for excat this product name
#ifeq (aosp_x86_64,$(TARGET_PRODUCT))
PRODUCT_ENFORCE_ARTIFACT_PATH_REQUIREMENTS := relaxed
#endif

PRODUCT_ARTIFACT_PATH_REQUIREMENT_WHITELIST += \
    root/init.zygote32_64.rc \
    root/init.zygote64_32.rc \

# Copy different zygote settings for vendor.img to select by setting property
# ro.zygote=zygote64_32 or ro.zygote=zygote32_64:
#   1. 64-bit primary, 32-bit secondary OR
#   2. 32-bit primary, 64-bit secondary
# init.zygote64_32.rc is in the core_64_bit.mk below
PRODUCT_COPY_FILES += \
    system/core/rootdir/init.zygote32_64.rc:root/init.zygote32_64.rc

PRODUCT_NAME := lqa
PRODUCT_DEVICE := lqa
PRODUCT_BRAND := ange
PRODUCT_MODEL := Android sdk build for x86_64 lqa

PRODUCT_PACKAGES +=AngeLauncher	

三、在aosp10/packages/apps/ 下创建文件夹AngeLauncher  ,把编译好的apkf复制到该目录 ,命名为AngeLauncher.apk,并新增Android.mk 文件

LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := AngeLauncher
LOCAL_MODULE_TAGS := optional
LOCAL_SRC_FILES := $(LOCAL_MODULE).apk
LOCAL_MODULE_CLASS := APPS
LOCAL_MODULE_SUFFIX := $(COMMON_ANDROID_PACKAGE_SUFFIX)
LOCAL_DEX_PREOPT := false
USE_PLATFORM_LAUNCHER3 := false
LOCAL_PRODUCT_MODULE := true
LOCAL_OVERRIDES_PACKAGES := Home Launcher2 Launcher3 Launcher3Go Launcher3QuickStep
LOCAL_CERTIFICATE := PRESIGNED
include $(BUILD_PREBUILT)

四、编译&运行

source build/envsetup.sh
lunch lqa-eng
make -j4
emulator

启动后即可看到launcher已替换。


http://www.niftyadmin.cn/n/5386002.html

相关文章

Open CASCADE学习|全局属性

目录 1、概念解释 质心&#xff1a; 重心&#xff1a; 惯性矩&#xff1a; 惯性矩阵&#xff1a; 主惯性矩&#xff1a; 静态惯性矩&#xff1a; 2、API 1、概念解释 质心&#xff1a; 质心是质量中心的简称&#xff0c;指物质系统上被认为质量集中于此的一个假想点。…

消息队列-RabbitMQ:延迟队列、rabbitmq 插件方式实现延迟队列、整合SpringBoot

十六、延迟队列 1、延迟队列概念 延时队列内部是有序的&#xff0c;最重要的特性就体现在它的延时属性上&#xff0c;延时队列中的元素是希望在指定时间到了以后或之前取出和处理&#xff0c;简单来说&#xff0c;延时队列就是用来存放需要在指定时间被处理的元素的队列。 延…

常用的制造企业网络优化方案

在制造业企业不断加速转型的情况下&#xff0c;企业内部数据传输面临了更高的要求。在企业的多站点内部网络互联互通方面&#xff0c;常见的组网网络优化方案有多种选择&#xff0c;每种都有其独特的优势。以下是其中VPN、MPLS、SD-WAN三种主要的组网方案&#xff1a; 1. VPN&a…

人工智能讲师AI讲师大模型讲师叶梓介绍及大语言模型技术原理与实践提纲

叶梓&#xff0c;上海交通大学计算机专业博士毕业&#xff0c;高级工程师。主研方向&#xff1a;数据挖掘、机器学习、人工智能。历任国内知名上市IT企业的AI技术总监、资深技术专家&#xff0c;市级行业大数据平台技术负责人。 长期负责城市信息化智能平台的建设工作&#xff…

LaTex和Word中推荐使用的矢量图片格式

1、LaTex 推荐使用eps矢量格式。&#xff08;该格式直接放在word中不会显示&#xff0c;但是通过插入word后双击打开查看 2、Word 推荐使用svg矢量格式。该格式可以直接插入word中。 3、plt保存代码 import matplotlib.pyplot as plt# 绘制图形 x [1, 2, 3, 4, 5] y1 [1…

[word] 如何使用Excel制作简单的流程图 #媒体#微信#学习方法

如何使用Excel制作简单的流程图 对于在职场办公的朋友们来说&#xff0c;经常要使用到Excel演示公式&#xff0c;制作各种图表等等&#xff0c;其实Excel还可以制作简单的流程图呢&#xff0c;估计许多小伙伴们还不知道吧&#xff0c;今天就来给大家演示一下&#xff0c;看完就…

【Spring连载】使用Spring Data访问 MongoDB(四)----对象映射Object Mapping

【Spring连载】使用Spring Data访问 MongoDB&#xff08;四&#xff09;----对象映射Object Mapping 一、JSON Schema二、基于类型的转换器三、属性转换器四、非包装类型五、对象引用5.1 使用DBRefs 六、创建索引 一、JSON Schema 二、基于类型的转换器 三、属性转换器 四、…

设计模式学习笔记 - 面向对象 - 3.面向对象比面向过程有哪些优势?面向过程真的过时了吗?

简述 在过往的工作中&#xff0c;我发现很多人搞不清面向对象和面向过程的区别&#xff0c;总认为使用面向对象编程语言来开发&#xff0c;就是在面向面向对象编程了。而实际上&#xff0c;他们只是在用面向对象编程语言&#xff0c;编写面向过程风格的代码而已&#xff0c;并…