在 AOSP 11 中更改启动器

Change launcher in AOSP 11

我正在为模拟器构建 AOSP 11 x86_64 并尝试使用第三方启动器更改默认启动器。

我正在使用 raspberry pi 的启动器 downloaded from here

当我手动编译这个启动器并使用 adb 安装时它工作正常,就像它提示选择启动器一样。

但我需要在源代码中添加

我发现我需要覆盖默认启动器。

所以我修改了raspberry pi的启动器Android.bp文件

build/target/product/handheld_system_ext.mk 中添加了包名称“RpLauncher”,其中添加了默认启动器 (Launcher3QuickStep) 包。

PRODUCT_PACKAGES += \
Launcher3QuickStep \
Provision \
Settings \
StorageManager \
SystemUI \
WallpaperCropper \
RpLauncher \

在此之后,当启动模拟器时,只会出现启动动画,并且永远不会结束。 有人对此有任何想法吗?

这里,问题可能是设备无法启动,因为您正在将此应用程序添加为特权应用程序

特权:真实,

因此,您应该将应用请求的特权权限列入白名单

像这样https://cs.android.com/android/platform/superproject/+/master:packages/apps/Launcher3/Android.bp;l=170?q=Launcher3QuickStep&ss=android%2Fplatform%2Fsuperproject

@Ashok Mutyala,感谢您的 help.Now 我可以将启动器添加为特权应用 以下是最终更改

启动器的Android.bp

android_app {
name: "RpLauncher",
overrides: ["Home Launcher2 Launcher3 Launcher3QuickStep"],
platform_apis: true,
certificate: "platform",
privileged: true,
system_ext_specific: true,

static_libs: [
  "androidx.legacy_legacy-support-v4",
  "androidx.recyclerview_recyclerview",
  "androidx.leanback_leanback",
  "kotlinx-coroutines-core",
],

srcs: ["src/**/*.kt"],
resource_dirs: ["res"],
required: ["privapp_whitelist_com.arpi.rplauncher"],

}

创建新文件 frameworks/base/data/etc/com.arpi.rplauncher.xml --> 这是 frameworks/base/data/etc/com.android.launcher3.xml 的副本,仅更改包名称。

    <?xml version="1.0" encoding="utf-8"?>
<!--
  ~ Copyright (C) 2019 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
  -->
<permissions>
    <privapp-permissions package="com.arpi.rplauncher">
        <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"/>
    </privapp-permissions>
</permissions>

在frameworks/base/data/etc/Android.bp 添加如下。

prebuilt_etc {
    name: "privapp_whitelist_com.arpi.rplauncher",
    system_ext_specific: true,
    sub_dir: "permissions",
    src: "com.arpi.rplauncher.xml",
    filename_from_src: true,
}