Android AOSP定制去掉Google搜索栏

Android AOSP定制去掉Google搜索栏

1.前言:

​ 最近接触了Android系统定制的需求,感觉非常有意思,之前做过Launcher和串口,也自己安装过虚拟机,不过几年没用Linux系统了有点不习惯,Linux命令也不熟悉,刚开始连安装打开AndroidStudio都不会,这里如果不熟悉的小伙伴可以参数以下博客,毕竟Android源码编译都是在Linux环境下进行的,所以熟悉Linux命令还是非常有必要的,此篇作为AOSP定制开发的开篇遇到了很多问题,这里记录一下,废话不多说,直接上代码.

2.简介:

AOSP 概览

Android 是适用于各种不同规格设备的操作系统。任何人都可以通过 Android 开源项目 (AOSP) 查看 Android 的文档和源代码。您可以使用 AOSP 为自己的设备创建自定义 Android OS 变体。

AOSP 的设计可确保不存在一个集中瓶颈,即没有任何行业参与者可一手限制或控制其他参与者的创新。因此,AOSP 是一款功能完善且达到生产质量的开发者产品,其源代码可以开放自定义和移植。

AOSP(Android Open Source Project)是Android的开放源代码项目,为开发者提供了详细的源代码和工具,使得我们能够深入了解Android系统的运作原理。阅读AOSP源码并熟悉其目录结构是了解Android系统内部实现和架构的关键。

3.文章参考:

这里推荐豪哥的FrameWork教程,非常详细和实用,最开始也是跟着豪哥的博客学习了不少知识.

https://juejin.cn/post/7207374216127103033

https://juejin.cn/post/7125309442341961765

https://babyyn.github.io/Sources/AOSP/build.html

4.隐藏Google搜索栏

修改变量配置 QSB_ON_FIRST_SCREEN = false

  • 源码路径:packages\apps\Launcher3\src\com\android\launcher3\config\BaseFlags.java

  • 源码

    abstract class BaseFlags {BaseFlags() {}public static final boolean IS_DOGFOOD_BUILD = false;public static final String AUTHORITY = "com.android.launcher3.settings".intern();// When enabled allows to use any point on the fast scrollbar to start dragging.public static final boolean LAUNCHER3_DIRECT_SCROLL = true;// When enabled the promise icon is visible in all apps while installation an app.public static final boolean LAUNCHER3_PROMISE_APPS_IN_ALL_APPS = false;// When enabled allows use of spring motions on the icons.public static final boolean LAUNCHER3_SPRING_ICONS = true;// Feature flag to enable moving the QSB on the 0th screen of the workspace.public static final boolean QSB_ON_FIRST_SCREEN = true;// When enabled the all-apps icon is not added to the hotseat.public static final boolean NO_ALL_APPS_ICON = true;// When true, custom widgets are loaded using CustomWidgetParser.public static final boolean ENABLE_CUSTOM_WIDGETS = false;// Features to control Launcher3Go behaviorpublic static final boolean GO_DISABLE_WIDGETS = false;// When enabled shows a work profile tab in all appspublic static final boolean ALL_APPS_TABS_ENABLED = true;// When true, overview shows screenshots in the orientation they were taken rather than// trying to make them fit the orientation the device is in.public static final boolean OVERVIEW_USE_SCREENSHOT_ORIENTATION = true;
    }
    

在这里插入图片描述

  • 源码修改

    /** Copyright (C) 2017 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.*/package com.android.launcher3.config;/*** Defines a set of flags used to control various launcher behaviors.** All the flags should be defined here with appropriate default values. To override a value,* redefine it in {@link FeatureFlags}.** This class is kept package-private to prevent direct access.*/
    abstract class BaseFlags {BaseFlags() {}public static final boolean IS_DOGFOOD_BUILD = false;public static final String AUTHORITY = "com.android.launcher3.settings".intern();// When enabled allows to use any point on the fast scrollbar to start dragging.public static final boolean LAUNCHER3_DIRECT_SCROLL = true;// When enabled the promise icon is visible in all apps while installation an app.public static final boolean LAUNCHER3_PROMISE_APPS_IN_ALL_APPS = false;// When enabled allows use of spring motions on the icons.public static final boolean LAUNCHER3_SPRING_ICONS = true;// Feature flag to enable moving the QSB on the 0th screen of the workspace.public static final boolean QSB_ON_FIRST_SCREEN = false;// When enabled the all-apps icon is not added to the hotseat.public static final boolean NO_ALL_APPS_ICON = true;// When true, custom widgets are loaded using CustomWidgetParser.public static final boolean ENABLE_CUSTOM_WIDGETS = false;// Features to control Launcher3Go behaviorpublic static final boolean GO_DISABLE_WIDGETS = false;// When enabled shows a work profile tab in all appspublic static final boolean ALL_APPS_TABS_ENABLED = true;// When true, overview shows screenshots in the orientation they were taken rather than// trying to make them fit the orientation the device is in.public static final boolean OVERVIEW_USE_SCREENSHOT_ORIENTATION = true;
    }
    

5.注释xml代码

  • 源码路径:/packages/apps/Launcher3/res/layout/search_container_workspace.xml

  • 源码

    在这里插入图片描述

<?xml version="1.0" encoding="utf-8"?>
<!--Copyright (C) 2016 The Android Open Source ProjectLicensed 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 athttp://www.apache.org/licenses/LICENSE-2.0Unless required by applicable law or agreed to in writing, softwaredistributed 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 andlimitations under the License.
-->
<com.android.launcher3.qsb.QsbContainerViewxmlns:android="http://schemas.android.com/apk/res/android"android:orientation="vertical"android:layout_width="match_parent"android:layout_height="0dp"android:id="@id/search_container_workspace"android:padding="0dp" ><fragmentandroid:name="com.android.launcher3.qsb.QsbContainerView$QsbFragment"android:layout_width="match_parent"android:tag="qsb_view"android:layout_height="match_parent"/>
</com.android.launcher3.qsb.QsbContainerView>
  • 源码修改

在这里插入图片描述

<?xml version="1.0" encoding="utf-8"?>
<!--Copyright (C) 2016 The Android Open Source ProjectLicensed 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 athttp://www.apache.org/licenses/LICENSE-2.0Unless required by applicable law or agreed to in writing, softwaredistributed 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 andlimitations under the License.
-->
<com.android.launcher3.qsb.QsbContainerViewxmlns:android="http://schemas.android.com/apk/res/android"android:orientation="vertical"android:layout_width="match_parent"android:layout_height="0dp"android:id="@id/search_container_workspace"android:padding="0dp" ><!--<fragmentandroid:name="com.android.launcher3.qsb.QsbContainerView$QsbFragment"android:layout_width="match_parent"android:tag="qsb_view"android:layout_height="match_parent"/>-->
</com.android.launcher3.qsb.QsbContainerView>

6.注释资源加载代码:

  • 源码位置: /packages/apps/Launcher3/src/com/android/launcher3/Workspace.java

  • 源码

     /*** Initializes and binds the first page* @param qsb an existing qsb to recycle or null.*/public void bindAndInitFirstWorkspaceScreen(View qsb) {if (!FeatureFlags.QSB_ON_FIRST_SCREEN) {return;}// Add the first pageCellLayout firstPage = insertNewWorkspaceScreen(Workspace.FIRST_SCREEN_ID, 0);// Always add a QSB on the first screen.if (qsb == null) {// In transposed layout, we add the QSB in the Grid. As workspace does not touch the// edges, we do not need a full width QSB.qsb = LayoutInflater.from(getContext()).inflate(R.layout.search_container_workspace,firstPage, false);}CellLayout.LayoutParams lp = new CellLayout.LayoutParams(0, 0, firstPage.getCountX(), 1);lp.canReorder = false;if (!firstPage.addViewToCellLayout(qsb, 0, R.id.search_container_workspace, lp, true)) {Log.e(TAG, "Failed to add to item at (0, 0) to CellLayout");}}
    

在这里插入图片描述

源码修改:

 public void bindAndInitFirstWorkspaceScreen(View qsb) {if (!FeatureFlags.QSB_ON_FIRST_SCREEN) {return;}// Add the first pageCellLayout firstPage = insertNewWorkspaceScreen(Workspace.FIRST_SCREEN_ID, 0);// Always add a QSB on the first screen.if (qsb == null) {// In transposed layout, we add the QSB in the Grid. As workspace does not touch the// edges, we do not need a full width QSB.qsb = LayoutInflater.from(getContext()).inflate(R.layout.search_container_workspace,firstPage, false);}/*     CellLayout.LayoutParams lp = new CellLayout.LayoutParams(0, 0, firstPage.getCountX(), 1);lp.canReorder = false;if (!firstPage.addViewToCellLayout(qsb, 0, R.id.search_container_workspace, lp, true)) {Log.e(TAG, "Failed to add to item at (0, 0) to CellLayout");}*/}

在这里插入图片描述

7.实现的效果如下:

从下图可以看出我们需要的效果已经实现,已经满足我们的需求.

在这里插入图片描述

8.文章总结:

以上就是今天的内容,AndroidAOSP开发去掉Google搜索栏,如果熟悉AOSP源码的同学肯定会认为很简单,但是我是最近才刚接触的,过程中遇到了很多,比如Linux环境搭建,Linux命令的使用,AOSP源码的编译和下载,AOSP定制和App开发的有很大区别,必须去看源码,要不然你不知道从哪里下手,看了源码之后,熟悉了流程在去开发得心应手,后面会一步步讲解系统保活、系统深度定制、系统签名
等等。阅读源码是一个很好的习惯,分析源码更是一个好习惯,我们不仅要学会1+1=2,更要学会如何更好地阅读和分析源码,今天的代码先到这里,下一篇我们讲解AOSP如何定制gms。

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/bicheng/25554.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

SpringBoot实现图片文件上传和回显的两种方式

目录 一 功能需求 二 上传本地 2.1 实现文件上传的controller层 2.2 图片访问资源映射 二 上传OSS 一 功能需求 实现图片的上传和回显功能其实在业务中是非常常见的,比如需要上传头像,或者交易平台需要上传物品的图片等等,都需要上传和回显,所以我接下来给大家介绍两种…

Android Verified Boot (AVB) 与 dm-verity 之间的关系、相同点与差异点

标签: AVB; dm-verity ;Android Android Verified Boot (AVB) 与 dm-verity 之间的关系、相同点与差异点 概述 Android Verified Boot (AVB) 和 dm-verity 是 Android 操作系统中用于确保设备启动过程和运行时数据完整性的两个重要技术。尽管它们有着不同的实现和侧重点,…

大模型-智能儿科助手

论文摘要 论文标题为“PediatricsGPT: Large Language Models as Chinese Medical Assistants for Pediatric Applications”&#xff0c;提出了一种用于儿科应用的中文大模型助手。为了解决现有大模型在儿科应用中表现欠佳的问题&#xff0c;作者构建了一个高质量的数据集 Pe…

qt自适应图片

在 Qt 中&#xff0c;通过重写 paintEvent 方法来添加自适应背景图片的过程如下&#xff1a; 创建一个自定义的 QWidget 子类。重写 paintEvent 方法&#xff0c;在该方法中使用 QPainter 绘制背景图片。使用 QPixmap 加载图片&#xff0c;并调整图片的大小以适应窗口的大小。…

Spring知识点总结

1. 简介一下Spring框架。 答&#xff1a;Spring框架是一个开源的容器性质的轻量级框架。主要有三大特点&#xff1a;容器、IOC&#xff08;控制反转&#xff09;、AOP&#xff08;面向切面编程&#xff09;。 2. Spring框架有哪些优点&#xff1f;谈谈你的看法。 答&#xff…

window.open(“.html“,“_blank“) 执行是下载,并没有打开新窗口显示html

window.open() 方法在浏览器中打开一个新窗口或者新标签页。如果你的 .html 文件被下载而不是在新窗口中打开&#xff0c;那可能是因为服务器的响应头设置了 Content-Disposition: attachment&#xff0c;这会导致浏览器把响应的内容作为一个文件下载。 如果你有权限修改服务器…

Java集合汇总

Java中的集合框架是Java语言的核心部分&#xff0c;提供了强大的数据结构来存储和操作对象集合。集合框架位于java.util包中&#xff0c;主要可以分为两大类&#xff1a;Collection&#xff08;单列集合&#xff09;和Map&#xff08;双列集合&#xff09;。下面是对它们的总结…

快速开始一个go程序(极简-快速入门)

一、 实验介绍 1.1 实验简介 为了能更高效地使用语言进行编码&#xff0c;Go 语言有自己的哲学和编程习惯。Go 语言的设计者们从编程效率出发设计了这门语言&#xff0c;但又不会丢掉访问底层程序结构的能力。设计者们通过一组最少的关键字、内置的方法和语法&#xff0c;最终…

直接用sql语句来查询和分析excel表,不需要导数据,提供了sql语句自动生成,不会sql也能用

用sql语句来查询excel表&#xff0c;我们需要把excel表格导入到数据库中&#xff0c;然后用数据库的管理工具写sql语句来进行查询。方法有很多&#xff0c;我们不一一描述。 今天我们要说的是直接用sql语句来查询和分析excel表。为什么有这么一个想法呢&#xff1f;程…

网络安全法对个人保护的要求

概述 《网络安全法》作为我国网络安全领域的基本法&#xff0c;对个人信息的保护提出了明确要求&#xff0c;旨在构建一个安全、可靠的网络环境&#xff0c;保护公民、法人和其他组织的合法权益。下面就从三个角度进行解读。 个人信息收集与使用 《网络安全法》规定&#xf…

配置 JDK 和 Android SDK

目录 一、配置JDK 1. 安装 JDK 2. JDK 环境配置 3. JDK的配置验证 二、配置 adb 和Android SDK环境 1、下载 2、配置 Android SDK 环境 一、配置JDK 1. 安装 JDK 安装链接&#xff1a;Java Downloads | Oracle 我安装的是 .zip &#xff0c;直接在指定的文件夹下解压就…

[AIGC] 图论在LeetCode算法题中的应用

图论是计算机科学中一个广泛应用的理论基础&#xff0c;学好图论对解决LeetCode等平台上的算法问题至关重要。本文将介绍几种基于图论的LeetCode算法题目&#xff0c;并提供一个基本的解决策略。 文章目录 1. 基础定义2. 示例问题3. 解决策略结论 1. 基础定义 在深入研究示例之…

【Pyqt6 学习笔记】DIY一个二维码解析生成小工具

文章目录 Pycharm 配置QtDesignerPyUIC基本模板 代码示例依赖包main.pyscreen_shot_module.pyuntitled.pyuntitled.ui Pycharm 配置 摘自PyQT6的从零开始在Pycharm中配置与使用——蹦跑的蜗牛 pip install PyQt6 PyQt6-toolsQtDesigner File -> Settings -> External …

c++【入门】请假时间计算

限制 时间限制 : 1 秒 内存限制 : 128 MB 题目 假设小明的妈妈向公司请了n天的假&#xff0c;那么请问小明的妈妈总共请了多少小时的假&#xff0c;多少分钟的假&#xff1f;&#xff08;提示&#xff1a;1天有24小时&#xff0c;1小时有60分钟&#xff09; 输入 一个整数…

等级保护与网络安全:构建信息安全的坚实防线

# 等级保护与网络安全&#xff1a;构建信息安全的坚实防线 引言 在数字化时代&#xff0c;网络安全已成为国家安全的重要组成部分。等级保护作为我国网络安全保障体系的核心&#xff0c;对于维护网络空间的安全稳定起到了至关重要的作用。本文将探讨等级保护与网络安全的关系&…

自定义类型:枚举(enum)+联合体(union)

枚举联合体 一.枚举1.枚举类型的声明2.枚举类型的优点3.枚举类型的使用 二.联合体1.联合体类型的声明2.联合体的特点3.相同成员的结构体和联合体对比4.联合体大小的计算5.联合体的练习&#xff08;判断大小端&#xff09;6.联合体节省空间例题 一.枚举 1.枚举类型的声明 枚举…

Edge浏览器双击关闭标签页,双击关闭浏览器选项卡

设置》外观》自定义浏览器&#xff0c;开启“使用双击关闭浏览器选项卡” 设置里面搜索“双击”&#xff0c;这是最快的方式 鼠标滚轮单击 或者进入“设置”-“辅助功能” 呼吁已久的功能来了&#xff01;Edge浏览器双击关闭标签页功能上线新 国产浏览器大多都有双击关闭标签页…

大模型PEFT(二) 之 大模型LoRA指令微调学习记录

1.peft 1.1 微调方法批处理大小模式GPU显存速度 1.2 当前高效微调技术存在的一些问题 当前的高效微调技术很难在类似方法之间进行直接比较并评估它们的真实性能&#xff0c;主要的原因如下所示: 参数计算口径不一致:参数计算可以分为三类: 可训练参数的数量、微调模型与原…

python3创建虚拟环境

开发程序的时候&#xff0c;总是希望有一个相对干净的环境来开发和执行程序。一方面可以非常清晰的看到第三方工具的依赖性&#xff0c;另外一方面&#xff0c;为了将来部署的准确性。 这里为了开发cython程序&#xff0c;在debian12上使用了python的虚环境&#xff0c;删除和…

springcloud gateway扩展支持多版本灰度

改造要求 需要在原有的调度策略中通过客户端header中的version进行1个服务多实例下进行二次分组&#xff0c;让指定的version在指定的版本实例下进行轮训调度。 需要改造的点 1.业务服务在发布到naocs中的元数据需要指定版本号 2.网关的调度策略中需要增加版本的区分 3.无…