From d0290b7e03a50c69bab7065dce94b8d2476e014a Mon Sep 17 00:00:00 2001 From: Ludvig Hansson Date: Tue, 13 Dec 2022 11:24:37 +0100 Subject: Restrict Wear device to single user Align behavior to regular devices and allow a single user for cuttlefish Wear emulator. Test: adb shell pm get-max-users = 1 Bug: 257114786 Change-Id: I8814ce3bca3045046bb8960cdb7cab938cbcbb21 --- shared/wear/overlays/core/res/values/config.xml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/shared/wear/overlays/core/res/values/config.xml b/shared/wear/overlays/core/res/values/config.xml index a07169f37..18d6d014f 100644 --- a/shared/wear/overlays/core/res/values/config.xml +++ b/shared/wear/overlays/core/res/values/config.xml @@ -113,4 +113,7 @@ true false true + + + 1 -- cgit v1.2.3 From 95617f364f71982f185b1937a92f38d5f7403c9a Mon Sep 17 00:00:00 2001 From: Jack Yu Date: Fri, 17 Feb 2023 12:06:31 -0800 Subject: Enabled subscription manager service Enabled subscription manager service on CF. Test: Boot up Test: atest FrameworksTelephonyTests Bug: 268719188 Change-Id: Ifb1164104dc234fc92f02cd7291ac917390c0336 --- shared/auto/overlay/frameworks/base/core/res/res/values/config.xml | 3 +++ shared/phone/overlays/core/res/values/config.xml | 3 +++ shared/tv/overlay/frameworks/base/core/res/res/values/config.xml | 3 +++ shared/wear/overlays/core/res/values/config.xml | 3 +++ 4 files changed, 12 insertions(+) diff --git a/shared/auto/overlay/frameworks/base/core/res/res/values/config.xml b/shared/auto/overlay/frameworks/base/core/res/res/values/config.xml index 93e173442..bf94cbaa2 100644 --- a/shared/auto/overlay/frameworks/base/core/res/res/values/config.xml +++ b/shared/auto/overlay/frameworks/base/core/res/res/values/config.xml @@ -44,4 +44,7 @@ 1 + + + true diff --git a/shared/phone/overlays/core/res/values/config.xml b/shared/phone/overlays/core/res/values/config.xml index 3a9225ef7..8abf5a803 100644 --- a/shared/phone/overlays/core/res/values/config.xml +++ b/shared/phone/overlays/core/res/values/config.xml @@ -65,4 +65,7 @@ true + + + true diff --git a/shared/tv/overlay/frameworks/base/core/res/res/values/config.xml b/shared/tv/overlay/frameworks/base/core/res/res/values/config.xml index 195a8a796..0264a59c1 100644 --- a/shared/tv/overlay/frameworks/base/core/res/res/values/config.xml +++ b/shared/tv/overlay/frameworks/base/core/res/res/values/config.xml @@ -17,4 +17,7 @@ 4 + + + true diff --git a/shared/wear/overlays/core/res/values/config.xml b/shared/wear/overlays/core/res/values/config.xml index 18d6d014f..b21471bd6 100644 --- a/shared/wear/overlays/core/res/values/config.xml +++ b/shared/wear/overlays/core/res/values/config.xml @@ -116,4 +116,7 @@ 1 + + + true -- cgit v1.2.3 From bfba68affd2ea517485795e7e72af36fbab4c481 Mon Sep 17 00:00:00 2001 From: Istvan Nador Date: Mon, 27 Feb 2023 19:45:13 +0000 Subject: Minidroid: Allow overriding androidboot.(hardware|init_rc) in BoardConfig.mk This way other devices that inherit from shared/minidroid/BoardConfig.mk file can customize their hardware name and primary init .rc script. Bug: 268612029 Test: manually by running minidroid in cuttlefish. Change-Id: I5c503806cb1f0aa8ebdb557c7df261284c67a861 --- shared/minidroid/BoardConfig.mk | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/shared/minidroid/BoardConfig.mk b/shared/minidroid/BoardConfig.mk index c0313fb56..2ca159574 100644 --- a/shared/minidroid/BoardConfig.mk +++ b/shared/minidroid/BoardConfig.mk @@ -104,6 +104,11 @@ PRODUCT_COPY_FILES += \ BOARD_BOOTLOADER_IN_UPDATE_PACKAGE := true BOARD_RAMDISK_USE_LZ4 := true +# Default to minidroid, if not set. +LOCAL_ANDROIDBOOT_HARDWARE ?= minidroid +# Default to minidroid's primary init .rc, if not set. +LOCAL_ANDROIDBOOT_INIT_RC ?= /system/etc/init/hw/init.minidroid.rc + BOARD_KERNEL_CMDLINE += printk.devkmsg=on BOARD_KERNEL_CMDLINE += audit=1 BOARD_KERNEL_CMDLINE += panic=-1 @@ -112,12 +117,12 @@ BOARD_KERNEL_CMDLINE += cma=0 BOARD_KERNEL_CMDLINE += firmware_class.path=/vendor/etc/ BOARD_KERNEL_CMDLINE += loop.max_part=7 BOARD_KERNEL_CMDLINE += init=/init -BOARD_BOOTCONFIG += androidboot.hardware=minidroid +BOARD_BOOTCONFIG += androidboot.hardware=$(LOCAL_ANDROIDBOOT_HARDWARE) +BOARD_BOOTCONFIG += \ + androidboot.init_rc=$(LOCAL_ANDROIDBOOT_INIT_RC) BOARD_BOOTCONFIG += kernel.mac80211_hwsim.radios=0 BOARD_BOOTCONFIG += \ kernel.vmw_vsock_virtio_transport_common.virtio_transport_max_vsock_pkt_buf_size=16384 -BOARD_BOOTCONFIG += \ - androidboot.init_rc=/system/etc/init/hw/init.minidroid.rc BOARD_BOOTCONFIG += \ androidboot.microdroid.debuggable=1 \ androidboot.adb.enabled=1 -- cgit v1.2.3 From 5d7ef59d85dd2704fc9de961c38e4631ea4811be Mon Sep 17 00:00:00 2001 From: Howard Date: Mon, 27 Feb 2023 14:15:53 -0800 Subject: Remove deprecated DataCenter from preinstalled packages config. Bug: 269520654 Test: None required, app disabled Change-Id: Iaded75a77166b08e00167552824790153d5581a3 --- shared/auto/preinstalled-packages-product-car-cuttlefish.xml | 3 --- 1 file changed, 3 deletions(-) diff --git a/shared/auto/preinstalled-packages-product-car-cuttlefish.xml b/shared/auto/preinstalled-packages-product-car-cuttlefish.xml index 90ba3b69c..0d0cc0636 100644 --- a/shared/auto/preinstalled-packages-product-car-cuttlefish.xml +++ b/shared/auto/preinstalled-packages-product-car-cuttlefish.xml @@ -108,9 +108,6 @@ Apps that do need to run on SYSTEM and evaluated by package owner. Here the apps will have FULL only. --> - - - -- cgit v1.2.3 From be231206a752dbf8abca3d71d457a165ec2cb3a4 Mon Sep 17 00:00:00 2001 From: Jack Yu Date: Wed, 1 Mar 2023 10:42:24 -0800 Subject: Turned on subscription manager service by default Removed the device specific overlay as the feature has been turned on by default in ag/21675230. Test: See bug 268199525#comment4 for comprehensive test result Bug: 268719188 Change-Id: Ia7381ff529516bdc2f2ca860423054248e89203b --- shared/auto/overlay/frameworks/base/core/res/res/values/config.xml | 3 --- shared/phone/overlays/core/res/values/config.xml | 3 --- shared/tv/overlay/frameworks/base/core/res/res/values/config.xml | 3 --- shared/wear/overlays/core/res/values/config.xml | 3 --- 4 files changed, 12 deletions(-) diff --git a/shared/auto/overlay/frameworks/base/core/res/res/values/config.xml b/shared/auto/overlay/frameworks/base/core/res/res/values/config.xml index bf94cbaa2..93e173442 100644 --- a/shared/auto/overlay/frameworks/base/core/res/res/values/config.xml +++ b/shared/auto/overlay/frameworks/base/core/res/res/values/config.xml @@ -44,7 +44,4 @@ 1 - - - true diff --git a/shared/phone/overlays/core/res/values/config.xml b/shared/phone/overlays/core/res/values/config.xml index 8abf5a803..3a9225ef7 100644 --- a/shared/phone/overlays/core/res/values/config.xml +++ b/shared/phone/overlays/core/res/values/config.xml @@ -65,7 +65,4 @@ true - - - true diff --git a/shared/tv/overlay/frameworks/base/core/res/res/values/config.xml b/shared/tv/overlay/frameworks/base/core/res/res/values/config.xml index 0264a59c1..195a8a796 100644 --- a/shared/tv/overlay/frameworks/base/core/res/res/values/config.xml +++ b/shared/tv/overlay/frameworks/base/core/res/res/values/config.xml @@ -17,7 +17,4 @@ 4 - - - true diff --git a/shared/wear/overlays/core/res/values/config.xml b/shared/wear/overlays/core/res/values/config.xml index b21471bd6..18d6d014f 100644 --- a/shared/wear/overlays/core/res/values/config.xml +++ b/shared/wear/overlays/core/res/values/config.xml @@ -116,7 +116,4 @@ 1 - - - true -- cgit v1.2.3 From d63fded55fc643c7437a4f5f87f96d1a17df7762 Mon Sep 17 00:00:00 2001 From: Raghwendra Date: Fri, 29 Jul 2022 13:43:04 +0000 Subject: Increases the list element of wake up reason Bug: 233681453 Change-Id: Ifb9775d3bfac7c48f14cd82f4ac0cb7aaa80fcfc --- shared/wear/overlays/core/res/values/config.xml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/shared/wear/overlays/core/res/values/config.xml b/shared/wear/overlays/core/res/values/config.xml index 18d6d014f..2f7ca522d 100644 --- a/shared/wear/overlays/core/res/values/config.xml +++ b/shared/wear/overlays/core/res/values/config.xml @@ -107,6 +107,10 @@ 0 0 0 + 0 + 0 + 0 + 0 6350 true -- cgit v1.2.3 From ea4fbd4b27ebdb94f34d1f21323b9fc411efcb5b Mon Sep 17 00:00:00 2001 From: Ivan Podogov Date: Tue, 24 Jan 2023 18:44:56 +0000 Subject: Make Cuttlefish watch round Bug: 229775429 Test: make, run Change-Id: I41a265793bf73ca36ef08aab0be0a10a69ca2172 --- shared/wear/overlays/core/res/values/config.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/shared/wear/overlays/core/res/values/config.xml b/shared/wear/overlays/core/res/values/config.xml index 2f7ca522d..f513118af 100644 --- a/shared/wear/overlays/core/res/values/config.xml +++ b/shared/wear/overlays/core/res/values/config.xml @@ -120,4 +120,5 @@ 1 + true -- cgit v1.2.3 From 0c5a48134fa1e7afbc06c51a5b9ed1223f5cd34d Mon Sep 17 00:00:00 2001 From: ckishan Date: Mon, 20 Mar 2023 02:54:10 +0000 Subject: Enabled ImsStack in Cuttlefish Bug: 267586933 Test: Verified with acloud test (acloud create --local-image) Change-Id: I12c64698e835c55a79ae4f6b62b0a562887f0c8d --- shared/device.mk | 7 +++++++ shared/phone/overlays/core/res/values/config.xml | 2 ++ 2 files changed, 9 insertions(+) diff --git a/shared/device.mk b/shared/device.mk index 07c20317f..31dca7513 100644 --- a/shared/device.mk +++ b/shared/device.mk @@ -181,6 +181,13 @@ PRODUCT_PACKAGES += \ PRODUCT_PACKAGES += \ GbaService +# +# Package for AOSP ImsStack +# +PRODUCT_PACKAGES += \ + ImsStack \ + libimsstack + # # Packages for testing # diff --git a/shared/phone/overlays/core/res/values/config.xml b/shared/phone/overlays/core/res/values/config.xml index 3a9225ef7..254f5c268 100644 --- a/shared/phone/overlays/core/res/values/config.xml +++ b/shared/phone/overlays/core/res/values/config.xml @@ -57,6 +57,8 @@ com.android.ims com.android.qns com.android.gbaservice + com.android.imsstack + com.android.imsstack true -- cgit v1.2.3 From 99d328bb5dfd2fa01078807d09c34b0f3212ea53 Mon Sep 17 00:00:00 2001 From: Liana Kazanova Date: Mon, 27 Mar 2023 22:20:35 +0000 Subject: Revert "Enabled ImsStack in Cuttlefish" This reverts commit 0c5a48134fa1e7afbc06c51a5b9ed1223f5cd34d. Reason for revert: b/275420249 Change-Id: I1f2b239f8c86c131d6a1d70ca15fa127a2c9c2e4 --- shared/device.mk | 7 ------- shared/phone/overlays/core/res/values/config.xml | 2 -- 2 files changed, 9 deletions(-) diff --git a/shared/device.mk b/shared/device.mk index 31dca7513..07c20317f 100644 --- a/shared/device.mk +++ b/shared/device.mk @@ -181,13 +181,6 @@ PRODUCT_PACKAGES += \ PRODUCT_PACKAGES += \ GbaService -# -# Package for AOSP ImsStack -# -PRODUCT_PACKAGES += \ - ImsStack \ - libimsstack - # # Packages for testing # diff --git a/shared/phone/overlays/core/res/values/config.xml b/shared/phone/overlays/core/res/values/config.xml index 254f5c268..3a9225ef7 100644 --- a/shared/phone/overlays/core/res/values/config.xml +++ b/shared/phone/overlays/core/res/values/config.xml @@ -57,8 +57,6 @@ com.android.ims com.android.qns com.android.gbaservice - com.android.imsstack - com.android.imsstack true -- cgit v1.2.3 From 462b33d704fda3108a50912af4a219a5da318c46 Mon Sep 17 00:00:00 2001 From: Thomas Nguyen Date: Wed, 15 Mar 2023 11:56:27 -0700 Subject: Support satellite vendor service in CF Bug: 273555341 Test: atest android.telephony.cts.SatelliteManagerTest Change-Id: I96b03946366b72aaae7ea9c04e102dcdbca96df2 --- guest/services/cf_satellite_service/Android.bp | 43 +++ .../cf_satellite_service/AndroidManifest.xml | 16 + .../telephony/satellite/CFSatelliteService.java | 324 +++++++++++++++++++++ shared/device.mk | 5 + shared/phone/overlays/core/res/values/config.xml | 3 + 5 files changed, 391 insertions(+) create mode 100644 guest/services/cf_satellite_service/Android.bp create mode 100644 guest/services/cf_satellite_service/AndroidManifest.xml create mode 100644 guest/services/cf_satellite_service/src/com/google/android/telephony/satellite/CFSatelliteService.java diff --git a/guest/services/cf_satellite_service/Android.bp b/guest/services/cf_satellite_service/Android.bp new file mode 100644 index 000000000..770c68bc8 --- /dev/null +++ b/guest/services/cf_satellite_service/Android.bp @@ -0,0 +1,43 @@ +// Copyright 2023 Google Inc. All Rights Reserved. +// +// 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 { + default_applicable_licenses: ["Android-Apache-2.0"], +} + +android_library { + name: "CFSatelliteService-core", + srcs: [ + "src/**/*.java", + ], + static_libs: [ + "android-support-annotations", + ], + libs: [ + "telephony-common", + ], +} + +android_app { + name: "CFSatelliteService", + system_ext_specific: true, + platform_apis: true, + manifest: "AndroidManifest.xml", + static_libs: [ + "CFSatelliteService-core", + ], + owner: "google", + privileged: true, + certificate: "platform", +} diff --git a/guest/services/cf_satellite_service/AndroidManifest.xml b/guest/services/cf_satellite_service/AndroidManifest.xml new file mode 100644 index 000000000..17ff714a5 --- /dev/null +++ b/guest/services/cf_satellite_service/AndroidManifest.xml @@ -0,0 +1,16 @@ + + + + + + + + + + diff --git a/guest/services/cf_satellite_service/src/com/google/android/telephony/satellite/CFSatelliteService.java b/guest/services/cf_satellite_service/src/com/google/android/telephony/satellite/CFSatelliteService.java new file mode 100644 index 000000000..a514e33e5 --- /dev/null +++ b/guest/services/cf_satellite_service/src/com/google/android/telephony/satellite/CFSatelliteService.java @@ -0,0 +1,324 @@ +/* + * Copyright (C) 2023 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.google.android.telephony.satellite; + +import android.annotation.NonNull; +import android.annotation.Nullable; +import android.content.Intent; +import android.os.Binder; +import android.os.IBinder; +import android.telephony.satellite.stub.ISatelliteCapabilitiesConsumer; +import android.telephony.satellite.stub.ISatelliteListener; +import android.telephony.satellite.stub.NTRadioTechnology; +import android.telephony.satellite.stub.PointingInfo; +import android.telephony.satellite.stub.SatelliteCapabilities; +import android.telephony.satellite.stub.SatelliteDatagram; +import android.telephony.satellite.stub.SatelliteError; +import android.telephony.satellite.stub.SatelliteImplBase; +import android.telephony.satellite.stub.SatelliteModemState; +import android.telephony.satellite.stub.SatelliteService; + +import com.android.internal.telephony.IBooleanConsumer; +import com.android.internal.telephony.IIntegerConsumer; +import com.android.internal.util.FunctionalUtils; +import com.android.telephony.Rlog; + +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Set; +import java.util.concurrent.Executor; + +public class CFSatelliteService extends SatelliteImplBase { + private static final String TAG = "CFSatelliteService"; + + // Hardcoded values below + private static final int SATELLITE_ALWAYS_VISIBLE = 0; + /** SatelliteCapabilities constant indicating that the radio technology is proprietary. */ + private static final int[] SUPPORTED_RADIO_TECHNOLOGIES = + new int[] {NTRadioTechnology.PROPRIETARY}; + /** SatelliteCapabilities constant indicating that pointing to satellite is required. */ + private static final boolean POINTING_TO_SATELLITE_REQUIRED = true; + /** SatelliteCapabilities constant indicating the maximum number of characters per datagram. */ + private static final int MAX_BYTES_PER_DATAGRAM = 339; + + @NonNull private final Set mListeners = new HashSet<>(); + + private boolean mIsCommunicationAllowedInLocation; + private boolean mIsEnabled; + private boolean mIsProvisioned; + private boolean mIsSupported; + private int mModemState; + + /** + * Create CFSatelliteService using the Executor specified for methods being called from + * the framework. + * + * @param executor The executor for the framework to use when executing satellite methods. + */ + public CFSatelliteService(@NonNull Executor executor) { + super(executor); + mIsCommunicationAllowedInLocation = true; + mIsEnabled = false; + mIsProvisioned = false; + mIsSupported = true; + mModemState = SatelliteModemState.SATELLITE_MODEM_STATE_OFF; + } + + /** + * Zero-argument constructor to prevent service binding exception. + */ + public CFSatelliteService() { + this(Runnable::run); + } + + @Override + public IBinder onBind(Intent intent) { + if (SatelliteService.SERVICE_INTERFACE.equals(intent.getAction())) { + logd("CFSatelliteService bound"); + return new CFSatelliteService().getBinder(); + } + return null; + } + + @Override + public void onCreate() { + super.onCreate(); + logd("onCreate"); + } + + @Override + public void onDestroy() { + super.onDestroy(); + logd("onDestroy"); + } + + @Override + public void setSatelliteListener(@NonNull ISatelliteListener listener) { + logd("setSatelliteListener"); + mListeners.add(listener); + } + + @Override + public void requestSatelliteListeningEnabled(boolean enable, int timeout, + @NonNull IIntegerConsumer errorCallback) { + logd("requestSatelliteListeningEnabled"); + if (!verifySatelliteModemState(errorCallback)) { + return; + } + if (enable) { + updateSatelliteModemState(SatelliteModemState.SATELLITE_MODEM_STATE_LISTENING); + } else { + updateSatelliteModemState(SatelliteModemState.SATELLITE_MODEM_STATE_IDLE); + } + runWithExecutor(() -> errorCallback.accept(SatelliteError.ERROR_NONE)); + } + + @Override + public void requestSatelliteEnabled(boolean enableSatellite, boolean enableDemoMode, + @NonNull IIntegerConsumer errorCallback) { + logd("requestSatelliteEnabled"); + if (enableSatellite) { + enableSatellite(errorCallback); + } else { + disableSatellite(errorCallback); + } + } + + private void enableSatellite(@NonNull IIntegerConsumer errorCallback) { + mIsEnabled = true; + updateSatelliteModemState(SatelliteModemState.SATELLITE_MODEM_STATE_IDLE); + runWithExecutor(() -> errorCallback.accept(SatelliteError.ERROR_NONE)); + } + + private void disableSatellite(@NonNull IIntegerConsumer errorCallback) { + mIsEnabled = false; + updateSatelliteModemState(SatelliteModemState.SATELLITE_MODEM_STATE_OFF); + runWithExecutor(() -> errorCallback.accept(SatelliteError.ERROR_NONE)); + } + + @Override + public void requestIsSatelliteEnabled(@NonNull IIntegerConsumer errorCallback, + @NonNull IBooleanConsumer callback) { + logd("requestIsSatelliteEnabled"); + runWithExecutor(() -> callback.accept(mIsEnabled)); + } + + @Override + public void requestIsSatelliteSupported(@NonNull IIntegerConsumer errorCallback, + @NonNull IBooleanConsumer callback) { + logd("requestIsSatelliteSupported"); + runWithExecutor(() -> callback.accept(mIsSupported)); + } + + @Override + public void requestSatelliteCapabilities(@NonNull IIntegerConsumer errorCallback, + @NonNull ISatelliteCapabilitiesConsumer callback) { + logd("requestSatelliteCapabilities"); + SatelliteCapabilities capabilities = new SatelliteCapabilities(); + capabilities.supportedRadioTechnologies = SUPPORTED_RADIO_TECHNOLOGIES; + capabilities.isPointingRequired = POINTING_TO_SATELLITE_REQUIRED; + capabilities.maxBytesPerOutgoingDatagram = MAX_BYTES_PER_DATAGRAM; + runWithExecutor(() -> callback.accept(capabilities)); + } + + @Override + public void startSendingSatellitePointingInfo(@NonNull IIntegerConsumer errorCallback) { + logd("startSendingSatellitePointingInfo"); + if (!verifySatelliteModemState(errorCallback)) { + return; + } + runWithExecutor(() -> errorCallback.accept(SatelliteError.ERROR_NONE)); + } + + @Override + public void stopSendingSatellitePointingInfo(@NonNull IIntegerConsumer errorCallback) { + logd("stopSendingSatellitePointingInfo"); + runWithExecutor(() -> errorCallback.accept(SatelliteError.ERROR_NONE)); + } + + @Override + public void provisionSatelliteService(@NonNull String token, @NonNull byte[] provisionData, + @NonNull IIntegerConsumer errorCallback) { + logd("provisionSatelliteService"); + runWithExecutor(() -> errorCallback.accept(SatelliteError.ERROR_NONE)); + updateSatelliteProvisionState(true); + } + + @Override + public void deprovisionSatelliteService(@NonNull String token, + @NonNull IIntegerConsumer errorCallback) { + logd("deprovisionSatelliteService"); + runWithExecutor(() -> errorCallback.accept(SatelliteError.ERROR_NONE)); + updateSatelliteProvisionState(false); + } + + @Override + public void requestIsSatelliteProvisioned(@NonNull IIntegerConsumer errorCallback, + @NonNull IBooleanConsumer callback) { + logd("requestIsSatelliteProvisioned"); + runWithExecutor(() -> callback.accept(mIsProvisioned)); + } + + @Override + public void pollPendingSatelliteDatagrams(@NonNull IIntegerConsumer errorCallback) { + logd("pollPendingSatelliteDatagrams"); + runWithExecutor(() -> errorCallback.accept(SatelliteError.ERROR_NONE)); + } + + @Override + public void sendSatelliteDatagram(@NonNull SatelliteDatagram datagram, boolean isEmergency, + @NonNull IIntegerConsumer errorCallback) { + logd("sendSatelliteDatagram"); + runWithExecutor(() -> errorCallback.accept(SatelliteError.ERROR_NONE)); + } + + @Override + public void requestSatelliteModemState(@NonNull IIntegerConsumer errorCallback, + @NonNull IIntegerConsumer callback) { + logd("requestSatelliteModemState"); + runWithExecutor(() -> callback.accept(mModemState)); + } + + @Override + public void requestIsSatelliteCommunicationAllowedForCurrentLocation( + @NonNull IIntegerConsumer errorCallback, @NonNull IBooleanConsumer callback) { + logd("requestIsSatelliteCommunicationAllowedForCurrentLocation"); + if (mIsCommunicationAllowedInLocation) { + runWithExecutor(() -> callback.accept(true)); + } else { + runWithExecutor(() -> callback.accept(false)); + } + } + + @Override + public void requestTimeForNextSatelliteVisibility(@NonNull IIntegerConsumer errorCallback, + @NonNull IIntegerConsumer callback) { + logd("requestTimeForNextSatelliteVisibility"); + runWithExecutor(() -> callback.accept(SATELLITE_ALWAYS_VISIBLE)); + } + + /** + * Helper method to verify that the satellite modem is properly configured to receive requests. + * + * @param errorCallback The callback to notify of any errors preventing satellite requests. + * @return {@code true} if the satellite modem is configured to receive requests and + * {@code false} if it is not. + */ + private boolean verifySatelliteModemState(@NonNull IIntegerConsumer errorCallback) { + if (!mIsSupported) { + runWithExecutor(() -> errorCallback.accept(SatelliteError.REQUEST_NOT_SUPPORTED)); + return false; + } + if (!mIsProvisioned) { + runWithExecutor(() -> errorCallback.accept(SatelliteError.SERVICE_NOT_PROVISIONED)); + return false; + } + if (!mIsEnabled) { + runWithExecutor(() -> errorCallback.accept(SatelliteError.INVALID_MODEM_STATE)); + return false; + } + return true; + } + + /** + * Update the satellite modem state and notify listeners if it changed. + * + * @param modemState The {@link SatelliteModemState} to update. + */ + private void updateSatelliteModemState(int modemState) { + if (modemState == mModemState) { + return; + } + mListeners.forEach(listener -> runWithExecutor(() -> + listener.onSatelliteModemStateChanged(modemState))); + mModemState = modemState; + } + + /** + * Update the satellite provision state and notify listeners if it changed. + * + * @param isProvisioned {@code true} if the satellite is currently provisioned and + * {@code false} if it is not. + */ + private void updateSatelliteProvisionState(boolean isProvisioned) { + if (isProvisioned == mIsProvisioned) { + return; + } + mIsProvisioned = isProvisioned; + mListeners.forEach(listener -> runWithExecutor(() -> + listener.onSatelliteProvisionStateChanged(mIsProvisioned))); + } + + /** + * Execute the given runnable using the executor that this service was created with. + * + * @param r A runnable that can throw an exception. + */ + private void runWithExecutor(@NonNull FunctionalUtils.ThrowingRunnable r) { + mExecutor.execute(() -> Binder.withCleanCallingIdentity(r)); + } + + /** + * Log the message to the radio buffer with {@code DEBUG} priority. + * + * @param log The message to log. + */ + private static void logd(@NonNull String log) { + Rlog.d(TAG, log); + } +} diff --git a/shared/device.mk b/shared/device.mk index 07c20317f..635366fc5 100644 --- a/shared/device.mk +++ b/shared/device.mk @@ -199,6 +199,11 @@ PRODUCT_PACKAGES += \ endif +# +# Satellite vendor service for CF +# +PRODUCT_PACKAGES += CFSatelliteService + # PRODUCT_AAPT_CONFIG and PRODUCT_AAPT_PREF_CONFIG are intentionally not set to # pick up every density resources. diff --git a/shared/phone/overlays/core/res/values/config.xml b/shared/phone/overlays/core/res/values/config.xml index 3a9225ef7..b7edba28b 100644 --- a/shared/phone/overlays/core/res/values/config.xml +++ b/shared/phone/overlays/core/res/values/config.xml @@ -65,4 +65,7 @@ true + + + com.google.android.telephony.satellite -- cgit v1.2.3 From 508bb84a6770d4c1edb82fe8ac83dd49d547f0a5 Mon Sep 17 00:00:00 2001 From: Steven Moreland Date: Tue, 11 Apr 2023 22:25:54 +0000 Subject: cf rild: move to radio V3 see hardware/interfaces CL for details Bug: 277379745 Test: build Change-Id: I77cbceee57d73e0d1c73bbd0b766e708609ef8e8 --- guest/hals/ril/reference-libril/Android.bp | 18 +++++++++--------- .../reference-libril/android.hardware.radio@2.1.xml | 16 +++++++++------- 2 files changed, 18 insertions(+), 16 deletions(-) diff --git a/guest/hals/ril/reference-libril/Android.bp b/guest/hals/ril/reference-libril/Android.bp index 59c4b24c6..978ed44c9 100644 --- a/guest/hals/ril/reference-libril/Android.bp +++ b/guest/hals/ril/reference-libril/Android.bp @@ -43,17 +43,17 @@ cc_library { ], shared_libs: [ "android.hardware.radio-library.compat", - "android.hardware.radio.config-V2-ndk", - "android.hardware.radio.data-V2-ndk", - "android.hardware.radio.ims-V1-ndk", - "android.hardware.radio.ims.media-V1-ndk", - "android.hardware.radio.messaging-V2-ndk", - "android.hardware.radio.modem-V2-ndk", - "android.hardware.radio.network-V2-ndk", + "android.hardware.radio.config-V3-ndk", + "android.hardware.radio.data-V3-ndk", + "android.hardware.radio.ims-V2-ndk", + "android.hardware.radio.ims.media-V2-ndk", + "android.hardware.radio.messaging-V3-ndk", + "android.hardware.radio.modem-V3-ndk", + "android.hardware.radio.network-V3-ndk", "android.hardware.radio.sap-V1-ndk", "android.hardware.radio.satellite-V1-ndk", - "android.hardware.radio.sim-V2-ndk", - "android.hardware.radio.voice-V2-ndk", + "android.hardware.radio.sim-V3-ndk", + "android.hardware.radio.voice-V3-ndk", "android.hardware.radio@1.0", "android.hardware.radio@1.1", "android.hardware.radio@1.2", diff --git a/guest/hals/ril/reference-libril/android.hardware.radio@2.1.xml b/guest/hals/ril/reference-libril/android.hardware.radio@2.1.xml index cffba5420..4d97a4f70 100644 --- a/guest/hals/ril/reference-libril/android.hardware.radio@2.1.xml +++ b/guest/hals/ril/reference-libril/android.hardware.radio@2.1.xml @@ -1,35 +1,37 @@ android.hardware.radio.config - 2 + 3 IRadioConfig/default android.hardware.radio.data - 2 + 3 IRadioData/slot1 android.hardware.radio.ims + 2 IRadioIms/slot1 android.hardware.radio.ims.media + 2 IImsMedia/default android.hardware.radio.messaging - 2 + 3 IRadioMessaging/slot1 android.hardware.radio.modem - 2 + 3 IRadioModem/slot1 android.hardware.radio.network - 2 + 3 IRadioNetwork/slot1 @@ -38,7 +40,7 @@ android.hardware.radio.sim - 2 + 3 IRadioSim/slot1 @@ -47,7 +49,7 @@ android.hardware.radio.voice - 2 + 3 IRadioVoice/slot1 -- cgit v1.2.3 From a64910a440767daf7f324264c1e86742837e8ff1 Mon Sep 17 00:00:00 2001 From: Steven Moreland Date: Wed, 12 Apr 2023 22:49:56 +0000 Subject: cuttlefish is an Android V device API and FCM levels updated Bug: 266741352 Test: TH Change-Id: Id3eda4793f6888ecae81913ff1db8de2499191b8 --- shared/config/manifest.xml | 2 +- shared/device.mk | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/shared/config/manifest.xml b/shared/config/manifest.xml index ceece96bf..eab12dbea 100644 --- a/shared/config/manifest.xml +++ b/shared/config/manifest.xml @@ -16,7 +16,7 @@ ** limitations under the License. */ --> - + diff --git a/shared/device.mk b/shared/device.mk index 635366fc5..f7b606263 100644 --- a/shared/device.mk +++ b/shared/device.mk @@ -37,7 +37,7 @@ PRODUCT_VENDOR_PROPERTIES += \ PRODUCT_SOONG_NAMESPACES += device/generic/goldfish # for audio and wifi -PRODUCT_SHIPPING_API_LEVEL := 34 +PRODUCT_SHIPPING_API_LEVEL := 35 PRODUCT_USE_DYNAMIC_PARTITIONS := true DISABLE_RILD_OEM_HOOK := true -- cgit v1.2.3 From 85017186b0cc942c0952b28a1c64046d308d96d2 Mon Sep 17 00:00:00 2001 From: Devin Moore Date: Wed, 19 Apr 2023 17:52:04 +0000 Subject: Update CF shipping API Level in metrics proto to V Test: none Bug: 266741352 Change-Id: I57b42bcd4c96ca697802b95dde7f3410d5c61ec8 --- shared/api_level.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shared/api_level.h b/shared/api_level.h index 36b3a87da..06cf49c5b 100644 --- a/shared/api_level.h +++ b/shared/api_level.h @@ -15,4 +15,4 @@ */ #pragma once -#define PRODUCT_SHIPPING_API_LEVEL 34 +#define PRODUCT_SHIPPING_API_LEVEL 35 -- cgit v1.2.3 From 7d1f7531bbfa9afa1a5842cf7a1626af93c35e4e Mon Sep 17 00:00:00 2001 From: Sungtak Lee Date: Thu, 20 Apr 2023 08:32:35 +0000 Subject: Revert "Remove android.hardware.media.c2 from HAL testing" This reverts commit 49b4d5813ae14239c6ab8a4ae7502ad250baf03c. Bug: 254050314 Change-Id: Ief57578b34f2010931b0cbc29ac06849bd2a5aa7 --- tests/hal/hal_implementation_test.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/hal/hal_implementation_test.cpp b/tests/hal/hal_implementation_test.cpp index d20442614..d9a3849e0 100644 --- a/tests/hal/hal_implementation_test.cpp +++ b/tests/hal/hal_implementation_test.cpp @@ -233,6 +233,7 @@ static const std::vector kKnownMissingAidl = { {"android.hardware.secure_element.", 1, 123254068}, {"android.hardware.soundtrigger3.", 1, 266941225}, {"android.media.soundtrigger.", 1, 266941225}, + {"android.hardware.media.c2.", 1, 251850069}, {"android.hardware.weaver.", 2, 262418065}, {"android.automotive.computepipe.registry.", 2, 273549907}, -- cgit v1.2.3 From 0d96961845023e4ad352155876b6895fbf58988b Mon Sep 17 00:00:00 2001 From: Devin Moore Date: Mon, 1 May 2023 23:47:22 +0000 Subject: hal_implementation_test remove automotive.evs from auto-only Now that Cuttlefish vendor software is at level 9, evs is no longer served by the framework on automotive Cuttlefish devices. Test: hal_implementation_test Bug: 280138893 Change-Id: I003cf96488fe5dcfd5be4fbd88458ef9e160c184 --- tests/hal/hal_implementation_test.cpp | 41 ++--------------------------------- 1 file changed, 2 insertions(+), 39 deletions(-) diff --git a/tests/hal/hal_implementation_test.cpp b/tests/hal/hal_implementation_test.cpp index 42ceee9cc..a777a0186 100644 --- a/tests/hal/hal_implementation_test.cpp +++ b/tests/hal/hal_implementation_test.cpp @@ -27,10 +27,6 @@ using namespace android; // clang-format off -static const std::set kAutomotiveOnlyHidl = { - "android.hardware.automotive.evs@1.1", -}; - static const std::set kKnownMissingHidl = { "android.frameworks.automotive.display@1.0", // converted to AIDL, see b/170401743 "android.frameworks.cameraservice.device@2.1", @@ -53,6 +49,7 @@ static const std::set kKnownMissingHidl = { "android.hardware.automotive.audiocontrol@1.0", "android.hardware.automotive.audiocontrol@2.0", "android.hardware.automotive.can@1.0", // converted to AIDL, see b/170405615 + "android.hardware.automotive.evs@1.1", "android.hardware.automotive.sv@1.0", "android.hardware.automotive.vehicle@2.0", "android.hardware.biometrics.fingerprint@2.3", // converted to AIDL, see b/152416783 @@ -364,40 +361,6 @@ static DeviceType getDeviceType() { return DeviceType::PHONE; } -static std::set getMissingHidl() { - static std::once_flag unionFlag; - static std::set missingHidl = kKnownMissingHidl; - - std::call_once(unionFlag, [&]() { - const DeviceType type = getDeviceType(); - switch (type) { - case DeviceType::AUTOMOTIVE: - LOG(INFO) << "Determined this is an Automotive device"; - break; - case DeviceType::TV: - missingHidl.insert(kAutomotiveOnlyHidl.begin(), - kAutomotiveOnlyHidl.end()); - LOG(INFO) << "Determined this is a TV device"; - break; - case DeviceType::WATCH: - missingHidl.insert(kAutomotiveOnlyHidl.begin(), - kAutomotiveOnlyHidl.end()); - LOG(INFO) << "Determined this is a Wear device"; - break; - case DeviceType::PHONE: - missingHidl.insert(kAutomotiveOnlyHidl.begin(), - kAutomotiveOnlyHidl.end()); - LOG(INFO) << "Determined this is a Phone device"; - break; - case DeviceType::UNKNOWN: - CHECK(false) << "getDeviceType return UNKNOWN type."; - break; - } - }); - - return missingHidl; -} - static bool isMissingAidl(const std::string& packageName) { static std::once_flag unionFlag; static std::set missingAidl = kAlwaysMissingAidl; @@ -471,7 +434,7 @@ TEST(Hal, HidlInterfacesImplemented) { // we'll be removing items from this which we know are missing // in order to be left with those elements which we thought we // knew were missing but are actually present - std::set thoughtMissing = getMissingHidl(); + std::set thoughtMissing = kKnownMissingHidl; for (const FQName& f : allHidlManifestInterfaces()) { if (thoughtMissing.erase(f.getPackageAndVersion().string()) > 0) { -- cgit v1.2.3 From e17ed497db49af6344c434a84131a4e62db8bba1 Mon Sep 17 00:00:00 2001 From: Devin Moore Date: Thu, 11 May 2023 17:08:26 +0000 Subject: Add new radio interfaces to RadioOnlyAidl These new interfaces aren't implemented on Android TV Cuttlefish devices. Test: lunch cf_x86_64_tv-userdebug && m Test: atest hal_implementation_test Bug: 266868403 Change-Id: I17493dc37264f1f50aa5525eeaf081aa56d19bef --- tests/hal/hal_implementation_test.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/hal/hal_implementation_test.cpp b/tests/hal/hal_implementation_test.cpp index 9959ab866..659fc4f45 100644 --- a/tests/hal/hal_implementation_test.cpp +++ b/tests/hal/hal_implementation_test.cpp @@ -187,6 +187,9 @@ static const std::set kRadioOnlyAidl = { "android.hardware.radio.messaging", "android.hardware.radio.modem", "android.hardware.radio.network", "android.hardware.radio.sap", "android.hardware.radio.sim", "android.hardware.radio.voice", + "android.hardware.radio.ims", "android.hardware.radio.ims.media", + "android.hardware.radio.satellite", + }; /* -- cgit v1.2.3 From ec509e4360ad64e311bee3f9bb352ba10804de08 Mon Sep 17 00:00:00 2001 From: moelsherif Date: Thu, 11 May 2023 10:43:53 -0700 Subject: Add demo test case for cvd load test scenarios. This CL moved to the master branch since it reference internal git-master branch for the demo Bug: 267109550 Test: cuttlefishPath=/usr/local/google/home/moelsherif/Desktop/main/device/google/cuttlefish/ input_file=$cuttlefishPath/host/commands/cvd_load_tester/end_to_end_test/multi/demo.json cvd load --config_path=$input_file Change-Id: Ic54e60ea06b66c2f3e2e075e8386be4f5373e90d --- .../end_to_end_test/multi/demo.json | 27 ++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 host/commands/cvd_load_tester/end_to_end_test/multi/demo.json diff --git a/host/commands/cvd_load_tester/end_to_end_test/multi/demo.json b/host/commands/cvd_load_tester/end_to_end_test/multi/demo.json new file mode 100644 index 000000000..00af4bdc6 --- /dev/null +++ b/host/commands/cvd_load_tester/end_to_end_test/multi/demo.json @@ -0,0 +1,27 @@ +{ + "instances" : + [ + { + "@import" : "phone", + "vm": { + "memory_mb": 8192, + "setupwizard_mode": "OPTIONAL", + "cpus": 4 + }, + "disk": { + "default_build": "git_master/cf_x86_64_phone-userdebug" + } + }, + { + "@import" : "wearable", + "vm": { + "memory_mb": 8192, + "setupwizard_mode": "REQUIRED", + "cpus": 4 + }, + "disk": { + "default_build": "git_master/cf_gwear_x86-userdebug" + } + } + ] +} -- cgit v1.2.3 From de94f0c8582ac5d125b6f061ed65f289c3c042cc Mon Sep 17 00:00:00 2001 From: Weilin Xu Date: Wed, 17 May 2023 17:47:35 +0000 Subject: Apply version 3 audio configuration for cuttlefish Upgraded car audio configuration from version 2 to version 3 for cuttlefish, and added occupant zone id to primary audio zone. Bug: 283012684 Test: atest android.car.cts.CarAudioManagerTest Change-Id: I18ab2d66a9011046a3a9021a82844b9d0e663205 --- shared/auto/car_audio_configuration.xml | 44 ++++++++++++++++++--------------- 1 file changed, 24 insertions(+), 20 deletions(-) diff --git a/shared/auto/car_audio_configuration.xml b/shared/auto/car_audio_configuration.xml index 53ca2175e..482726e7e 100644 --- a/shared/auto/car_audio_configuration.xml +++ b/shared/auto/car_audio_configuration.xml @@ -21,27 +21,31 @@ - Volume groups in the car environment. --> - + - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + -- cgit v1.2.3 From 60903b58408ce701ef3833fdaab7c3c3521b050f Mon Sep 17 00:00:00 2001 From: Jooyung Han Date: Thu, 25 May 2023 10:59:32 +0900 Subject: Install virtual fingerprint HAL APEX Cuttlefish installs the (virtual) fingerprint HAL APEX. Bug: 279674662 Test: follow biometrics/fingerprint/aidl/default/README.md from hardware/interfaces Change-Id: I850ba59dc4e2553556949ec24a789de022b66bed --- shared/device.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shared/device.mk b/shared/device.mk index 5954439c4..348d9ba2c 100644 --- a/shared/device.mk +++ b/shared/device.mk @@ -370,7 +370,7 @@ PRODUCT_PACKAGES += \ # BiometricsFingerprint HAL (AIDL) # PRODUCT_PACKAGES += \ - android.hardware.biometrics.fingerprint-service.example + com.android.hardware.biometrics.fingerprint.virtual # # Contexthub HAL -- cgit v1.2.3 From c1b466c71fb90eceb4d9221ca44e33ac5c9099f5 Mon Sep 17 00:00:00 2001 From: Henri Chataing Date: Tue, 30 May 2023 18:22:17 +0000 Subject: Import h4_packetizer_library from packages/modules/Bluetooth The original library is unused by rootcanal and rootcanal will be moved to github in the near future. Bug: 256013143 Test: m bt_vhci_forwarder (cherry picked from https://android-review.googlesource.com/q/commit:0ba45c99e80f104256f34402e10453df015e4804) Merged-In: I123fcd8d9118aab0542d7ef79def6c1310e13e11 Change-Id: I123fcd8d9118aab0542d7ef79def6c1310e13e11 --- guest/commands/bt_vhci_forwarder/Android.bp | 3 +- guest/commands/bt_vhci_forwarder/hci/h4.h | 32 +++ .../bt_vhci_forwarder/hci/h4_packetizer.cc | 92 +++++++++ .../commands/bt_vhci_forwarder/hci/h4_packetizer.h | 49 +++++ guest/commands/bt_vhci_forwarder/hci/h4_parser.cc | 215 +++++++++++++++++++++ guest/commands/bt_vhci_forwarder/hci/h4_parser.h | 131 +++++++++++++ guest/commands/bt_vhci_forwarder/hci/log.h | 30 +++ guest/commands/bt_vhci_forwarder/main.cpp | 2 +- 8 files changed, 552 insertions(+), 2 deletions(-) create mode 100644 guest/commands/bt_vhci_forwarder/hci/h4.h create mode 100644 guest/commands/bt_vhci_forwarder/hci/h4_packetizer.cc create mode 100644 guest/commands/bt_vhci_forwarder/hci/h4_packetizer.h create mode 100644 guest/commands/bt_vhci_forwarder/hci/h4_parser.cc create mode 100644 guest/commands/bt_vhci_forwarder/hci/h4_parser.h create mode 100644 guest/commands/bt_vhci_forwarder/hci/log.h diff --git a/guest/commands/bt_vhci_forwarder/Android.bp b/guest/commands/bt_vhci_forwarder/Android.bp index 03b7a0550..45308bacf 100644 --- a/guest/commands/bt_vhci_forwarder/Android.bp +++ b/guest/commands/bt_vhci_forwarder/Android.bp @@ -20,6 +20,8 @@ package { cc_binary { name: "bt_vhci_forwarder", srcs: [ + "hci/h4_packetizer.cc", + "hci/h4_parser.cc", "main.cpp", ], shared_libs: [ @@ -28,7 +30,6 @@ cc_binary { "liblog", ], static_libs: [ - "h4_packetizer_lib", "libgflags", ], defaults: ["cuttlefish_guest_only"] diff --git a/guest/commands/bt_vhci_forwarder/hci/h4.h b/guest/commands/bt_vhci_forwarder/hci/h4.h new file mode 100644 index 000000000..e05a129ed --- /dev/null +++ b/guest/commands/bt_vhci_forwarder/hci/h4.h @@ -0,0 +1,32 @@ +// +// Copyright 2021 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. +// + +#pragma once + +#include // for uint8_t + +namespace rootcanal { + +enum class PacketType : uint8_t { + UNKNOWN = 0, + COMMAND = 1, + ACL = 2, + SCO = 3, + EVENT = 4, + ISO = 5, +}; + +} // namespace rootcanal diff --git a/guest/commands/bt_vhci_forwarder/hci/h4_packetizer.cc b/guest/commands/bt_vhci_forwarder/hci/h4_packetizer.cc new file mode 100644 index 000000000..956466907 --- /dev/null +++ b/guest/commands/bt_vhci_forwarder/hci/h4_packetizer.cc @@ -0,0 +1,92 @@ +// +// Copyright 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. +// + +#include "h4_packetizer.h" + +#include +#include +#include +#include + +#include + +#include "log.h" + +namespace rootcanal { + +H4Packetizer::H4Packetizer(int fd, PacketReadCallback command_cb, + PacketReadCallback event_cb, + PacketReadCallback acl_cb, PacketReadCallback sco_cb, + PacketReadCallback iso_cb, + ClientDisconnectCallback disconnect_cb) + : uart_fd_(fd), + h4_parser_(command_cb, event_cb, acl_cb, sco_cb, iso_cb), + disconnect_cb_(std::move(disconnect_cb)) {} + +size_t H4Packetizer::Send(uint8_t type, const uint8_t* data, size_t length) { + struct iovec iov[] = {{&type, sizeof(type)}, + {const_cast(data), length}}; + ssize_t ret = 0; + do { + ret = writev(uart_fd_, iov, sizeof(iov) / sizeof(iov[0])); + } while (-1 == ret && (EINTR == errno || EAGAIN == errno)); + + if (ret == -1) { + LOG_ERROR("Error writing to UART (%s)", strerror(errno)); + } else if (ret < static_cast(length + 1)) { + LOG_ERROR("%d / %d bytes written - something went wrong...", + static_cast(ret), static_cast(length + 1)); + } + return ret; +} + +void H4Packetizer::OnDataReady(int fd) { + if (disconnected_) { + return; + } + ssize_t bytes_to_read = h4_parser_.BytesRequested(); + std::vector buffer(bytes_to_read); + + ssize_t bytes_read; + do { + bytes_read = read(fd, buffer.data(), bytes_to_read); + } while (bytes_read == -1 && errno == EINTR); + + if (bytes_read == 0) { + LOG_INFO("remote disconnected!"); + disconnected_ = true; + disconnect_cb_(); + return; + } + if (bytes_read < 0) { + if (errno == EAGAIN) { + // No data, try again later. + return; + } + if (errno == ECONNRESET) { + // They probably rejected our packet + disconnected_ = true; + disconnect_cb_(); + return; + } + + LOG_ALWAYS_FATAL("Read error in %d: %s", h4_parser_.CurrentState(), + strerror(errno)); + } + h4_parser_.Consume(buffer.data(), bytes_read); +} + +} // namespace rootcanal diff --git a/guest/commands/bt_vhci_forwarder/hci/h4_packetizer.h b/guest/commands/bt_vhci_forwarder/hci/h4_packetizer.h new file mode 100644 index 000000000..4feed95db --- /dev/null +++ b/guest/commands/bt_vhci_forwarder/hci/h4_packetizer.h @@ -0,0 +1,49 @@ +// +// Copyright 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. +// + +#pragma once + +#include +#include + +#include "h4_parser.h" + +namespace rootcanal { + +// A socket based H4Packetizer. Call OnDataReady whenever +// data can be read from file descriptor fd. +// +// This is only supported on unix. +class H4Packetizer { + public: + H4Packetizer(int fd, PacketReadCallback command_cb, + PacketReadCallback event_cb, PacketReadCallback acl_cb, + PacketReadCallback sco_cb, PacketReadCallback iso_cb, + ClientDisconnectCallback disconnect_cb); + + size_t Send(uint8_t type, const uint8_t* data, size_t length); + + void OnDataReady(int fd); + + private: + int uart_fd_; + H4Parser h4_parser_; + + ClientDisconnectCallback disconnect_cb_; + bool disconnected_{false}; +}; + +} // namespace rootcanal diff --git a/guest/commands/bt_vhci_forwarder/hci/h4_parser.cc b/guest/commands/bt_vhci_forwarder/hci/h4_parser.cc new file mode 100644 index 000000000..f61634020 --- /dev/null +++ b/guest/commands/bt_vhci_forwarder/hci/h4_parser.cc @@ -0,0 +1,215 @@ +// +// Copyright 20 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. +// + +#include "hci/h4_parser.h" // for H4Parser, PacketType, H4Pars... + +#include +#include // for size_t +#include // for uint8_t, int32_t +#include // for function +#include // for move +#include // for vector + +#include "log.h" // for LOG_ALWAYS_FATAL, LOG_INFO + +namespace rootcanal { + +void H4Parser::Reset() { + state_ = HCI_TYPE; + packet_.clear(); + bytes_wanted_ = 0; + packet_type_ = 0; +} + +size_t H4Parser::HciGetPacketLengthForType(PacketType type, + const uint8_t* preamble) { + static const size_t + packet_length_offset[static_cast(PacketType::ISO) + 1] = { + 0, + H4Parser::COMMAND_LENGTH_OFFSET, + H4Parser::ACL_LENGTH_OFFSET, + H4Parser::SCO_LENGTH_OFFSET, + H4Parser::EVENT_LENGTH_OFFSET, + H4Parser::ISO_LENGTH_OFFSET, + }; + + size_t offset = packet_length_offset[static_cast(type)]; + size_t size = preamble[offset]; + if (type == PacketType::ACL) { + size |= ((size_t)preamble[offset + 1]) << 8; + } + if (type == PacketType::ISO) { + size |= ((size_t)preamble[offset + 1] & 0x0fU) << 8; + } + return size; +} + +H4Parser::H4Parser(PacketReadCallback command_cb, PacketReadCallback event_cb, + PacketReadCallback acl_cb, PacketReadCallback sco_cb, + PacketReadCallback iso_cb, bool enable_recovery_state) + : command_cb_(std::move(command_cb)), + event_cb_(std::move(event_cb)), + acl_cb_(std::move(acl_cb)), + sco_cb_(std::move(sco_cb)), + iso_cb_(std::move(iso_cb)), + enable_recovery_state_(enable_recovery_state) {} + +void H4Parser::OnPacketReady() { + switch (hci_packet_type_) { + case PacketType::COMMAND: + command_cb_(packet_); + break; + case PacketType::ACL: + acl_cb_(packet_); + break; + case PacketType::SCO: + sco_cb_(packet_); + break; + case PacketType::EVENT: + event_cb_(packet_); + break; + case PacketType::ISO: + iso_cb_(packet_); + break; + default: + LOG_ALWAYS_FATAL("Unimplemented packet type %d", + static_cast(hci_packet_type_)); + } + // Get ready for the next type byte. + hci_packet_type_ = PacketType::UNKNOWN; +} + +size_t H4Parser::BytesRequested() { + switch (state_) { + case HCI_TYPE: + case HCI_RECOVERY: + return 1; + case HCI_PREAMBLE: + case HCI_PAYLOAD: + return bytes_wanted_; + } +} + +bool H4Parser::Consume(const uint8_t* buffer, int32_t bytes_read) { + size_t bytes_to_read = BytesRequested(); + if (bytes_read <= 0) { + LOG_INFO("remote disconnected, or unhandled error?"); + return false; + } + if ((uint32_t)bytes_read > BytesRequested()) { + LOG_ALWAYS_FATAL("More bytes read (%u) than expected (%u)!", + static_cast(bytes_read), + static_cast(bytes_to_read)); + } + + static const size_t preamble_size[static_cast(PacketType::ISO) + 1] = + { + 0, + H4Parser::COMMAND_PREAMBLE_SIZE, + H4Parser::ACL_PREAMBLE_SIZE, + H4Parser::SCO_PREAMBLE_SIZE, + H4Parser::EVENT_PREAMBLE_SIZE, + H4Parser::ISO_PREAMBLE_SIZE, + }; + switch (state_) { + case HCI_TYPE: + // bytes_read >= 1 + packet_type_ = *buffer; + packet_.clear(); + break; + + case HCI_RECOVERY: { + // Skip all received bytes until the HCI Reset command is received. + // The parser can end up in a bad state when the host is restarted. + const std::array reset_command{0x01, 0x03, 0x0c, 0x00}; + size_t offset = packet_.size(); + LOG_WARN("Received byte in recovery state : 0x%x", + static_cast(*buffer)); + packet_.push_back(*buffer); + + // Last byte does not match expected byte in the sequence. + // Drop all the bytes and start over. + if (packet_[offset] != reset_command[offset]) { + packet_.clear(); + // The mismatched byte can also be the first of the correct sequence. + if (*buffer == reset_command[0]) { + packet_.push_back(*buffer); + } + } + + // Received full reset command. + if (packet_.size() == reset_command.size()) { + LOG_INFO("Received HCI Reset command, exiting recovery state"); + // Pop the Idc from the received packet. + packet_.erase(packet_.begin()); + bytes_wanted_ = 0; + } + break; + } + + case HCI_PREAMBLE: + case HCI_PAYLOAD: + packet_.insert(packet_.end(), buffer, buffer + bytes_read); + bytes_wanted_ -= bytes_read; + break; + } + + switch (state_) { + case HCI_TYPE: + hci_packet_type_ = static_cast(packet_type_); + if (hci_packet_type_ != PacketType::ACL && + hci_packet_type_ != PacketType::SCO && + hci_packet_type_ != PacketType::COMMAND && + hci_packet_type_ != PacketType::EVENT && + hci_packet_type_ != PacketType::ISO) { + if (!enable_recovery_state_) { + LOG_ALWAYS_FATAL("Received invalid packet type 0x%x", + static_cast(packet_type_)); + } + LOG_ERROR("Received invalid packet type 0x%x, entering recovery state", + static_cast(packet_type_)); + state_ = HCI_RECOVERY; + hci_packet_type_ = PacketType::COMMAND; + bytes_wanted_ = 1; + } else { + state_ = HCI_PREAMBLE; + bytes_wanted_ = preamble_size[static_cast(hci_packet_type_)]; + } + break; + case HCI_PREAMBLE: + if (bytes_wanted_ == 0) { + size_t payload_size = + HciGetPacketLengthForType(hci_packet_type_, packet_.data()); + if (payload_size == 0) { + OnPacketReady(); + state_ = HCI_TYPE; + } else { + bytes_wanted_ = payload_size; + state_ = HCI_PAYLOAD; + } + } + break; + case HCI_RECOVERY: + case HCI_PAYLOAD: + if (bytes_wanted_ == 0) { + OnPacketReady(); + state_ = HCI_TYPE; + } + break; + } + return true; +} +} // namespace rootcanal diff --git a/guest/commands/bt_vhci_forwarder/hci/h4_parser.h b/guest/commands/bt_vhci_forwarder/hci/h4_parser.h new file mode 100644 index 000000000..825c41ac3 --- /dev/null +++ b/guest/commands/bt_vhci_forwarder/hci/h4_parser.h @@ -0,0 +1,131 @@ +// +// Copyright 2021 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. +// + +#pragma once + +#include // for size_t + +#include // for uint8_t, int32_t +#include // for function +#include // for operator<<, ostream +#include // for vector + +#include "hci/h4.h" // for PacketType + +namespace rootcanal { + +using PacketReadCallback = std::function&)>; +using HciPacketReadyCallback = std::function; +using ClientDisconnectCallback = std::function; + +// An H4 Parser can parse H4 Packets and will invoke the proper callback +// once a packet has been parsed. +// +// You use it as follows: +// +// H4Parser h4(....); +// size_t nr_bytes = h4.BytesRequested(); +// std::vector fill_this_vector_with_at_most_nr_bytes(nr_bytes); +// h4.Consume(fill_this_vector_with_at_most_nr_bytes.data(), nr_bytes.size()); +// +// The parser will invoke the proper callbacks once a packet has been parsed. +// The parser keeps internal state and is not thread safe. +class H4Parser { + public: + enum State { HCI_TYPE, HCI_PREAMBLE, HCI_PAYLOAD, HCI_RECOVERY }; + + H4Parser(PacketReadCallback command_cb, PacketReadCallback event_cb, + PacketReadCallback acl_cb, PacketReadCallback sco_cb, + PacketReadCallback iso_cb, bool enable_recovery_state = false); + + // Consumes the given number of bytes, returns true on success. + bool Consume(const uint8_t* buffer, int32_t bytes); + + // The maximum number of bytes the parser can consume in the current state. + size_t BytesRequested(); + + // Resets the parser to the empty, initial state. + void Reset(); + + State CurrentState() { return state_; }; + + void EnableRecovery() { enable_recovery_state_ = true; } + void DisableRecovery() { enable_recovery_state_ = false; } + + private: + void OnPacketReady(); + + // 2 bytes for opcode, 1 byte for parameter length (Volume 2, Part E, 5.4.1) + static constexpr size_t COMMAND_PREAMBLE_SIZE = 3; + static constexpr size_t COMMAND_LENGTH_OFFSET = 2; + // 2 bytes for handle, 2 bytes for data length (Volume 2, Part E, 5.4.2) + static constexpr size_t ACL_PREAMBLE_SIZE = 4; + static constexpr size_t ACL_LENGTH_OFFSET = 2; + + // 2 bytes for handle, 1 byte for data length (Volume 2, Part E, 5.4.3) + static constexpr size_t SCO_PREAMBLE_SIZE = 3; + static constexpr size_t SCO_LENGTH_OFFSET = 2; + + // 1 byte for event code, 1 byte for parameter length (Volume 2, Part + // E, 5.4.4) + static constexpr size_t EVENT_PREAMBLE_SIZE = 2; + static constexpr size_t EVENT_LENGTH_OFFSET = 1; + + // 2 bytes for handle and flags, 12 bits for length (Volume 2, Part E, 5.4.5) + static constexpr size_t ISO_PREAMBLE_SIZE = 4; + static constexpr size_t ISO_LENGTH_OFFSET = 2; + + PacketReadCallback command_cb_; + PacketReadCallback event_cb_; + PacketReadCallback acl_cb_; + PacketReadCallback sco_cb_; + PacketReadCallback iso_cb_; + + static size_t HciGetPacketLengthForType(PacketType type, + const uint8_t* preamble); + + PacketType hci_packet_type_{PacketType::UNKNOWN}; + + State state_{HCI_TYPE}; + uint8_t packet_type_{}; + std::vector packet_; + size_t bytes_wanted_{0}; + bool enable_recovery_state_{false}; +}; + +inline std::ostream& operator<<(std::ostream& os, + H4Parser::State const& state_) { + switch (state_) { + case H4Parser::State::HCI_TYPE: + os << "HCI_TYPE"; + break; + case H4Parser::State::HCI_PREAMBLE: + os << "HCI_PREAMBLE"; + break; + case H4Parser::State::HCI_PAYLOAD: + os << "HCI_PAYLOAD"; + break; + case H4Parser::State::HCI_RECOVERY: + os << "HCI_RECOVERY"; + break; + default: + os << "unknown state " << static_cast(state_); + break; + } + return os; +} + +} // namespace rootcanal diff --git a/guest/commands/bt_vhci_forwarder/hci/log.h b/guest/commands/bt_vhci_forwarder/hci/log.h new file mode 100644 index 000000000..f301a3274 --- /dev/null +++ b/guest/commands/bt_vhci_forwarder/hci/log.h @@ -0,0 +1,30 @@ +/* + * Copyright 2022 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. + */ + +#pragma once + +#include +#include + +// FIXME: remove those shims +#define LOG_DEBUG(...) LOG(DEBUG) << fmt::sprintf(__VA_ARGS__) +#define LOG_INFO(...) LOG(INFO) << fmt::sprintf(__VA_ARGS__) +#define LOG_WARN(...) LOG(WARNING) << fmt::sprintf(__VA_ARGS__) +#define LOG_ERROR(...) LOG(ERROR) << fmt::sprintf(__VA_ARGS__) +#define LOG_ALWAYS_FATAL(...) LOG(FATAL) << fmt::sprintf(__VA_ARGS__) + +#define ASSERT(cond) CHECK(cond) +#define ASSERT_LOG(cond, ...) CHECK(cond) << fmt::sprintf(__VA_ARGS__) diff --git a/guest/commands/bt_vhci_forwarder/main.cpp b/guest/commands/bt_vhci_forwarder/main.cpp index faf6b55cc..7c83a5ba1 100644 --- a/guest/commands/bt_vhci_forwarder/main.cpp +++ b/guest/commands/bt_vhci_forwarder/main.cpp @@ -26,7 +26,7 @@ #include "android-base/logging.h" -#include "model/hci/h4_packetizer.h" +#include "hci/h4_packetizer.h" // Copied from net/bluetooth/hci.h #define HCI_ACLDATA_PKT 0x02 -- cgit v1.2.3 From f84c662866e3f8a5b71ed3a8e10f51974a8e9620 Mon Sep 17 00:00:00 2001 From: Deyao Ren Date: Fri, 12 May 2023 14:26:25 +0000 Subject: Remove LOCAL_PREFER_VENDOR_APEX variable from .mk files for cuttlefish Bug: 259196894 Test: launch cuttlefish, CtsWifiTestCases Change-Id: I82a8af4861e338c771d2ec1b539e891ac6628f5c --- .../Android.bp | 44 --------- .../Android.bp | 45 --------- .../Android.bp | 57 +++++++++++ shared/bluetooth/device_vendor.mk | 17 ---- shared/device.mk | 104 +-------------------- shared/graphics/device_vendor.mk | 10 -- shared/phone/device_vendor.mk | 26 +----- shared/slim/device_vendor.mk | 21 +---- shared/telephony/device_vendor.mk | 15 --- vsoc_arm64_only/slim/aosp_cf.mk | 9 -- vsoc_riscv64/phone/aosp_cf.mk | 26 ------ vsoc_riscv64/slim/aosp_cf.mk | 1 - vsoc_x86_64/phone/aosp_cf.mk | 9 -- vsoc_x86_64_only/slim/aosp_cf.mk | 9 -- 14 files changed, 66 insertions(+), 327 deletions(-) delete mode 100644 apex/com.google.aosp_cf_phone.hardware.core_permissions/Android.bp delete mode 100644 apex/com.google.aosp_cf_slim.hardware.core_permissions/Android.bp create mode 100644 apex/com.google.cf.hardware.core_permissions/Android.bp diff --git a/apex/com.google.aosp_cf_phone.hardware.core_permissions/Android.bp b/apex/com.google.aosp_cf_phone.hardware.core_permissions/Android.bp deleted file mode 100644 index 2900f3296..000000000 --- a/apex/com.google.aosp_cf_phone.hardware.core_permissions/Android.bp +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright (C) 2021 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 { - default_applicable_licenses: ["Android-Apache-2.0"], -} - -override_apex { - name: "com.google.aosp_cf_phone.hardware.core_permissions", - base: "com.android.hardware.core_permissions", - prebuilts: [ - "android.hardware.audio.low_latency.prebuilt.xml", - "android.hardware.biometrics.face.prebuilt.xml", - "android.hardware.ethernet.prebuilt.xml", - "android.hardware.faketouch.prebuilt.xml", - "android.hardware.fingerprint.prebuilt.xml", - "android.hardware.location.gps.prebuilt.xml", - "android.hardware.reboot_escrow.prebuilt.xml", - "android.hardware.usb.accessory.prebuilt.xml", - "android.hardware.usb.host.prebuilt.xml", - "android.hardware.vulkan.level-0.prebuilt.xml", - "android.hardware.vulkan.version-1_0_3.prebuilt.xml", - "android.software.device_id_attestation.prebuilt.xml", - "android.software.ipsec_tunnels.prebuilt.xml", - "android.software.opengles.deqp.level-2022-03-01.prebuilt.xml", - "android.software.sip.voip.prebuilt.xml", - "android.software.verified_boot.prebuilt.xml", - "android.software.vulkan.deqp.level-2022-03-01.prebuilt.xml", - "aosp_excluded_hardware.prebuilt.xml", - "cuttlefish_excluded_hardware.prebuilt.xml", - "handheld_core_hardware.prebuilt.xml", - ], -} diff --git a/apex/com.google.aosp_cf_slim.hardware.core_permissions/Android.bp b/apex/com.google.aosp_cf_slim.hardware.core_permissions/Android.bp deleted file mode 100644 index 959c95076..000000000 --- a/apex/com.google.aosp_cf_slim.hardware.core_permissions/Android.bp +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright (C) 2022 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 { - default_applicable_licenses: ["Android-Apache-2.0"], -} - -override_apex { - name: "com.google.aosp_cf_slim.hardware.core_permissions", - base: "com.android.hardware.core_permissions", - prebuilts: [ - "android.hardware.audio.low_latency.prebuilt.xml", - "android.hardware.biometrics.face.prebuilt.xml", - "android.hardware.ethernet.prebuilt.xml", - "android.hardware.faketouch.prebuilt.xml", - "android.hardware.fingerprint.prebuilt.xml", - "android.hardware.location.gps.prebuilt.xml", - "android.hardware.reboot_escrow.prebuilt.xml", - "android.hardware.usb.accessory.prebuilt.xml", - "android.hardware.usb.host.prebuilt.xml", - "android.hardware.vulkan.level-0.prebuilt.xml", - "android.hardware.vulkan.version-1_0_3.prebuilt.xml", - "android.software.device_id_attestation.prebuilt.xml", - "android.software.ipsec_tunnels.prebuilt.xml", - "android.software.opengles.deqp.level-2022-03-01.prebuilt.xml", - "android.software.sip.voip.prebuilt.xml", - "android.software.verified_boot.prebuilt.xml", - "android.software.vulkan.deqp.level-2022-03-01.prebuilt.xml", - "aosp_excluded_hardware.prebuilt.xml", - "cuttlefish_excluded_hardware.prebuilt.xml", - "handheld_core_hardware.prebuilt.xml", - "slim_excluded_hardware.prebuilt.xml", - ], -} diff --git a/apex/com.google.cf.hardware.core_permissions/Android.bp b/apex/com.google.cf.hardware.core_permissions/Android.bp new file mode 100644 index 000000000..1f4c9cce0 --- /dev/null +++ b/apex/com.google.cf.hardware.core_permissions/Android.bp @@ -0,0 +1,57 @@ +// Copyright (C) 2023 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 { + default_applicable_licenses: ["Android-Apache-2.0"], +} +permission_prebuilts = [ + "android.hardware.audio.low_latency.prebuilt.xml", + "android.hardware.ethernet.prebuilt.xml", + "android.hardware.location.gps.prebuilt.xml", + "android.hardware.reboot_escrow.prebuilt.xml", + "android.hardware.usb.accessory.prebuilt.xml", + "android.hardware.usb.host.prebuilt.xml", + "android.hardware.vulkan.level-0.prebuilt.xml", + "android.hardware.vulkan.version-1_0_3.prebuilt.xml", + "android.software.device_id_attestation.prebuilt.xml", + "android.software.ipsec_tunnels.prebuilt.xml", + "android.software.opengles.deqp.level-2022-03-01.prebuilt.xml", + "android.software.sip.voip.prebuilt.xml", + "android.software.verified_boot.prebuilt.xml", + "android.software.vulkan.deqp.level-2022-03-01.prebuilt.xml", + "cuttlefish_excluded_hardware.prebuilt.xml", +] +handheld_extra_prebuilts = [ + "handheld_core_hardware.prebuilt.xml", + "android.hardware.biometrics.face.prebuilt.xml", + "android.hardware.faketouch.prebuilt.xml", + "android.hardware.fingerprint.prebuilt.xml", +] +slim_extra_prebuilts = [ + "slim_excluded_hardware.prebuilt.xml", +] +override_apex { + name: "com.google.cf.hardware.core_permissions", + base: "com.android.hardware.core_permissions", + prebuilts: permission_prebuilts, +} +override_apex { + name: "com.google.cf_handheld.hardware.core_permissions", + base: "com.android.hardware.core_permissions", + prebuilts: permission_prebuilts + handheld_extra_prebuilts, +} +override_apex { + name: "com.google.cf_handheld_slim.hardware.core_permissions", + base: "com.android.hardware.core_permissions", + prebuilts: permission_prebuilts + handheld_extra_prebuilts + slim_extra_prebuilts, +} diff --git a/shared/bluetooth/device_vendor.mk b/shared/bluetooth/device_vendor.mk index 82b460f6c..1eb55cec6 100644 --- a/shared/bluetooth/device_vendor.mk +++ b/shared/bluetooth/device_vendor.mk @@ -33,24 +33,7 @@ PRODUCT_COPY_FILES += \ # # Bluetooth HAL and Compatibility Bluetooth library (for older revs). # -ifneq ($(LOCAL_PREFER_VENDOR_APEX),true) -PRODUCT_COPY_FILES +=\ - frameworks/native/data/etc/android.hardware.bluetooth.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.bluetooth.xml \ - frameworks/native/data/etc/android.hardware.bluetooth_le.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.bluetooth_le.xml - -PRODUCT_PACKAGES += \ - android.hardware.bluetooth-service.default \ - bt_vhci_forwarder - -# Bluetooth initialization configuration is copied to the init folder here instead of being added -# as an init_rc attribute of the bt_vhci_forward binary. The bt_vhci_forward binary is used by -# multiple targets with different initialization configurations. -PRODUCT_COPY_FILES += \ - device/google/cuttlefish/guest/commands/bt_vhci_forwarder/bt_vhci_forwarder.rc:$(TARGET_COPY_OUT_VENDOR)/etc/init/bt_vhci_forwarder.rc - -else PRODUCT_PACKAGES += com.google.cf.bt -endif # # Bluetooth Audio AIDL HAL diff --git a/shared/device.mk b/shared/device.mk index 73892f648..2cbe3d8a6 100644 --- a/shared/device.mk +++ b/shared/device.mk @@ -181,15 +181,6 @@ PRODUCT_PACKAGES += \ hidl_lazy_test_server \ hidl_lazy_cb_test_server -# Runtime Resource Overlays -ifneq ($(LOCAL_PREFER_VENDOR_APEX),true) -PRODUCT_PACKAGES += \ - cuttlefish_overlay_connectivity \ - cuttlefish_overlay_frameworks_base_core \ - cuttlefish_overlay_settings_provider - -endif - # # Satellite vendor service for CF # @@ -208,37 +199,6 @@ DEVICE_MANIFEST_FILE += $(LOCAL_DEVICE_FCM_MANIFEST_FILE) # General files # - -ifneq ($(LOCAL_SENSOR_FILE_OVERRIDES),true) -ifneq ($(LOCAL_PREFER_VENDOR_APEX),true) - PRODUCT_COPY_FILES += \ - frameworks/native/data/etc/android.hardware.sensor.ambient_temperature.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.sensor.ambient_temperature.xml \ - frameworks/native/data/etc/android.hardware.sensor.barometer.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.sensor.barometer.xml \ - frameworks/native/data/etc/android.hardware.sensor.gyroscope.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.sensor.gyroscope.xml \ - frameworks/native/data/etc/android.hardware.sensor.hinge_angle.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.sensor.hinge_angle.xml \ - frameworks/native/data/etc/android.hardware.sensor.light.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.sensor.light.xml \ - frameworks/native/data/etc/android.hardware.sensor.proximity.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.sensor.proximity.xml \ - frameworks/native/data/etc/android.hardware.sensor.relative_humidity.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.sensor.relative_humidity.xml -endif -endif - -ifneq ($(LOCAL_PREFER_VENDOR_APEX),true) -PRODUCT_COPY_FILES += \ - device/google/cuttlefish/shared/permissions/cuttlefish_excluded_hardware.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/cuttlefish_excluded_hardware.xml \ - frameworks/native/data/etc/android.hardware.audio.low_latency.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.audio.low_latency.xml \ - frameworks/native/data/etc/android.hardware.ethernet.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.ethernet.xml \ - frameworks/native/data/etc/android.hardware.location.gps.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.location.gps.xml \ - frameworks/native/data/etc/android.hardware.reboot_escrow.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.reboot_escrow.xml \ - frameworks/native/data/etc/android.hardware.usb.accessory.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.usb.accessory.xml \ - frameworks/native/data/etc/android.hardware.usb.host.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.usb.host.xml \ - frameworks/native/data/etc/android.hardware.wifi.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.wifi.xml \ - frameworks/native/data/etc/android.hardware.wifi.direct.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.wifi.direct.xml \ - frameworks/native/data/etc/android.hardware.wifi.passpoint.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.wifi.passpoint.xml \ - frameworks/native/data/etc/android.software.ipsec_tunnels.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.software.ipsec_tunnels.xml \ - frameworks/native/data/etc/android.software.sip.voip.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.software.sip.voip.xml \ - frameworks/native/data/etc/android.software.verified_boot.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.software.verified_boot.xml - -endif PRODUCT_COPY_FILES += \ frameworks/native/data/etc/android.hardware.consumerir.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.consumerir.xml \ device/google/cuttlefish/shared/config/init.vendor.rc:$(TARGET_COPY_OUT_VENDOR)/etc/init/init.cutf_cvm.rc \ @@ -261,17 +221,10 @@ PRODUCT_COPY_FILES += \ device/google/cuttlefish/shared/config/task_profiles.json:$(TARGET_COPY_OUT_VENDOR)/etc/task_profiles.json \ frameworks/native/data/etc/android.software.credentials.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.software.credentials.xml \ -ifeq ($(LOCAL_PREFER_VENDOR_APEX),true) PRODUCT_PACKAGES += com.google.cf.input.config -else -PRODUCT_COPY_FILES += \ - device/google/cuttlefish/shared/config/input/Crosvm_Virtio_Multitouch_Touchscreen_0.idc:$(TARGET_COPY_OUT_VENDOR)/usr/idc/Crosvm_Virtio_Multitouch_Touchscreen_0.idc \ - device/google/cuttlefish/shared/config/input/Crosvm_Virtio_Multitouch_Touchscreen_1.idc:$(TARGET_COPY_OUT_VENDOR)/usr/idc/Crosvm_Virtio_Multitouch_Touchscreen_1.idc \ - device/google/cuttlefish/shared/config/input/Crosvm_Virtio_Multitouch_Touchscreen_2.idc:$(TARGET_COPY_OUT_VENDOR)/usr/idc/Crosvm_Virtio_Multitouch_Touchscreen_2.idc \ - device/google/cuttlefish/shared/config/input/Crosvm_Virtio_Multitouch_Touchscreen_3.idc:$(TARGET_COPY_OUT_VENDOR)/usr/idc/Crosvm_Virtio_Multitouch_Touchscreen_3.idc \ - device/google/cuttlefish/shared/config/input/Crosvm_Virtio_Rotary_0.idc:$(TARGET_COPY_OUT_VENDOR)/usr/idc/Crosvm_Virtio_Rotary_0.idc \ - -endif +# Default permission to access services +LOCAL_HARDWARE_PERMISSIONS_PRODUCT_PACKAGE ?= com.google.cf.hardware.core_permissions +PRODUCT_PACKAGES += $(LOCAL_HARDWARE_PERMISSIONS_PRODUCT_PACKAGE) PRODUCT_PACKAGES += \ fstab.cf.f2fs.hctr2 \ @@ -453,11 +406,7 @@ PRODUCT_PACKAGES += \ # Sensors # ifeq ($(LOCAL_SENSOR_PRODUCT_PACKAGE),) -ifeq ($(LOCAL_PREFER_VENDOR_APEX),true) LOCAL_SENSOR_PRODUCT_PACKAGE := com.android.hardware.sensors -else - LOCAL_SENSOR_PRODUCT_PACKAGE := android.hardware.sensors-service.example -endif endif PRODUCT_PACKAGES += \ $(LOCAL_SENSOR_PRODUCT_PACKAGE) @@ -485,14 +434,7 @@ PRODUCT_COPY_FILES += \ # # Power and PowerStats HALs # -ifeq ($(LOCAL_PREFER_VENDOR_APEX),true) PRODUCT_PACKAGES += com.android.hardware.power -else -PRODUCT_PACKAGES += \ - android.hardware.power-service.example \ - android.hardware.power.stats-service.example \ - -endif # # Tetheroffload HAL @@ -519,12 +461,7 @@ PRODUCT_PACKAGES += \ com.android.hardware.usb # Vibrator HAL -ifeq ($(LOCAL_PREFER_VENDOR_APEX),true) PRODUCT_PACKAGES += com.android.hardware.vibrator -else -PRODUCT_PACKAGES += \ - android.hardware.vibrator-service.example -endif PRODUCT_PACKAGES += \ android.hardware.secure_element-service.example @@ -572,48 +509,15 @@ PRODUCT_PACKAGES += linker.recovery shell_and_utilities_recovery endif # wifi -ifeq ($(LOCAL_PREFER_VENDOR_APEX),true) # Add com.android.hardware.wifi for android.hardware.wifi-service PRODUCT_PACKAGES += com.android.hardware.wifi # Add com.google.cf.wifi for hostapd, wpa_supplicant, etc. +# TODO(b/282956397): Clean up shared/config/wpa_supplicant.rc PRODUCT_PACKAGES += com.google.cf.wifi $(call add_soong_config_namespace, wpa_supplicant) $(call add_soong_config_var_value, wpa_supplicant, platform_version, $(PLATFORM_VERSION)) $(call add_soong_config_var_value, wpa_supplicant, nl80211_driver, CONFIG_DRIVER_NL80211_QCA) -else -PRODUCT_PACKAGES += \ - rename_netiface \ - wpa_supplicant \ - setup_wifi \ - mac80211_create_radios \ - hostapd \ - android.hardware.wifi-service \ - init.wifi -PRODUCT_COPY_FILES += \ - device/google/cuttlefish/shared/config/wpa_supplicant.rc:$(TARGET_COPY_OUT_VENDOR)/etc/init/wpa_supplicant.rc - -# VirtWifi interface configuration -ifeq ($(DEVICE_VIRTWIFI_PORT),) - DEVICE_VIRTWIFI_PORT := eth2 -endif -PRODUCT_VENDOR_PROPERTIES += ro.vendor.virtwifi.port=${DEVICE_VIRTWIFI_PORT} - -# WLAN driver configuration files -ifndef LOCAL_WPA_SUPPLICANT_OVERLAY -LOCAL_WPA_SUPPLICANT_OVERLAY := $(LOCAL_PATH)/config/wpa_supplicant_overlay.conf -endif - -ifndef LOCAL_P2P_SUPPLICANT -LOCAL_P2P_SUPPLICANT := $(LOCAL_PATH)/config/p2p_supplicant.conf -endif - -PRODUCT_COPY_FILES += \ - external/wpa_supplicant_8/wpa_supplicant/wpa_supplicant_template.conf:$(TARGET_COPY_OUT_VENDOR)/etc/wifi/wpa_supplicant.conf \ - $(LOCAL_WPA_SUPPLICANT_OVERLAY):$(TARGET_COPY_OUT_VENDOR)/etc/wifi/wpa_supplicant_overlay.conf \ - $(LOCAL_P2P_SUPPLICANT):$(TARGET_COPY_OUT_VENDOR)/etc/wifi/p2p_supplicant.conf -endif - # Wifi Runtime Resource Overlay PRODUCT_PACKAGES += \ CuttlefishTetheringOverlay \ diff --git a/shared/graphics/device_vendor.mk b/shared/graphics/device_vendor.mk index b5f410281..b760004c4 100644 --- a/shared/graphics/device_vendor.mk +++ b/shared/graphics/device_vendor.mk @@ -49,16 +49,6 @@ PRODUCT_PACKAGES += \ libvulkan_enc endif -ifeq ($(TARGET_VULKAN_SUPPORT),true) -ifneq ($(LOCAL_PREFER_VENDOR_APEX),true) -PRODUCT_COPY_FILES += \ - frameworks/native/data/etc/android.hardware.vulkan.level-0.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.vulkan.level.xml \ - frameworks/native/data/etc/android.hardware.vulkan.version-1_0_3.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.vulkan.version.xml \ - frameworks/native/data/etc/android.software.vulkan.deqp.level-2023-03-01.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.software.vulkan.deqp.level.xml \ - frameworks/native/data/etc/android.software.opengles.deqp.level-2023-03-01.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.software.opengles.deqp.level.xml -endif -endif - # # Hardware Composer HAL # diff --git a/shared/phone/device_vendor.mk b/shared/phone/device_vendor.mk index afb0641ac..b9b3d1e1b 100644 --- a/shared/phone/device_vendor.mk +++ b/shared/phone/device_vendor.mk @@ -16,16 +16,13 @@ PRODUCT_MANIFEST_FILES += device/google/cuttlefish/shared/config/product_manifest.xml SYSTEM_EXT_MANIFEST_FILES += device/google/cuttlefish/shared/config/system_ext_manifest.xml +# Permission to access services for phone +LOCAL_HARDWARE_PERMISSIONS_PRODUCT_PACKAGE := com.google.cf_handheld.hardware.core_permissions PRODUCT_MAX_PAGE_SIZE_SUPPORTED := 65536 $(call inherit-product, $(SRC_TARGET_DIR)/product/handheld_vendor.mk) -ifneq ($(LOCAL_PREFER_VENDOR_APEX),true) -PRODUCT_COPY_FILES += \ - frameworks/native/data/etc/handheld_core_hardware.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/handheld_core_hardware.xml -endif - $(call inherit-product, frameworks/native/build/phone-xhdpi-2048-dalvik-heap.mk) $(call inherit-product, device/google/cuttlefish/shared/bluetooth/device_vendor.mk) $(call inherit-product, device/google/cuttlefish/shared/camera/device_vendor.mk) @@ -39,25 +36,8 @@ PRODUCT_EXTRA_VNDK_VERSIONS := 29 30 31 TARGET_PRODUCT_PROP := $(LOCAL_PATH)/product.prop -ifneq ($(LOCAL_PREFER_VENDOR_APEX),true) -PRODUCT_COPY_FILES += \ - frameworks/native/data/etc/android.hardware.faketouch.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.faketouch.xml \ - frameworks/native/data/etc/android.hardware.fingerprint.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.fingerprint.xml \ - - ifneq ($(TARGET_DISABLE_BIOMETRICS_FACE),true) - PRODUCT_COPY_FILES += \ - frameworks/native/data/etc/android.hardware.biometrics.face.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.biometrics.face.xml \ - - endif -endif - - - # Runtime Resource Overlays -ifeq ($(LOCAL_PREFER_VENDOR_APEX),true) PRODUCT_PACKAGES += com.google.aosp_cf_phone.rros -else -PRODUCT_PACKAGES += cuttlefish_phone_overlay_frameworks_base_core -endif + TARGET_BOARD_INFO_FILE ?= device/google/cuttlefish/shared/phone/android-info.txt diff --git a/shared/slim/device_vendor.mk b/shared/slim/device_vendor.mk index a1ec725b8..8e24ac0c2 100644 --- a/shared/slim/device_vendor.mk +++ b/shared/slim/device_vendor.mk @@ -19,11 +19,8 @@ SYSTEM_EXT_MANIFEST_FILES += device/google/cuttlefish/shared/config/system_ext_m $(call inherit-product, $(SRC_TARGET_DIR)/product/handheld_vendor.mk) -ifneq ($(LOCAL_PREFER_VENDOR_APEX),true) -PRODUCT_COPY_FILES += \ - frameworks/native/data/etc/handheld_core_hardware.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/handheld_core_hardware.xml -PRODUCT_PACKAGES += slim_excluded_hardware.prebuilt.xml -endif +# Permission to access services +LOCAL_HARDWARE_PERMISSIONS_PRODUCT_PACKAGE := com.google.cf_handheld_slim.hardware.core_permissions $(call inherit-product, frameworks/native/build/phone-xhdpi-2048-dalvik-heap.mk) $(call inherit-product, device/google/cuttlefish/shared/bluetooth/device_vendor.mk) @@ -37,23 +34,9 @@ $(call inherit-product, device/google/cuttlefish/shared/device.mk) PRODUCT_VENDOR_PROPERTIES += \ debug.hwui.drawing_enabled=0 \ -ifneq ($(LOCAL_PREFER_VENDOR_APEX),true) -PRODUCT_COPY_FILES += \ - frameworks/native/data/etc/android.hardware.biometrics.face.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.biometrics.face.xml \ - frameworks/native/data/etc/android.hardware.faketouch.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.faketouch.xml \ - frameworks/native/data/etc/android.hardware.fingerprint.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.fingerprint.xml \ - -endif - # Runtime Resource Overlays -ifeq ($(LOCAL_PREFER_VENDOR_APEX),true) PRODUCT_PACKAGES += \ com.google.aosp_cf_phone.rros \ com.google.aosp_cf_slim.rros -else -PRODUCT_PACKAGES += \ - cuttlefish_phone_overlay_frameworks_base_core \ - slim_overlay_frameworks_base_core -endif TARGET_BOARD_INFO_FILE ?= device/google/cuttlefish/shared/slim/android-info.txt diff --git a/shared/telephony/device_vendor.mk b/shared/telephony/device_vendor.mk index bd78cc6d0..873bb468a 100644 --- a/shared/telephony/device_vendor.mk +++ b/shared/telephony/device_vendor.mk @@ -27,21 +27,6 @@ PRODUCT_VENDOR_PROPERTIES += \ ro.com.android.dataroaming=true \ ro.telephony.default_network=9 \ -ifeq ($(LOCAL_PREFER_VENDOR_APEX),true) PRODUCT_PACKAGES += com.google.cf.rild -else -# If downstream target provides its own RILD, set TARGET_USES_CF_RILD := false -# If the target prefers vendor APEX, this feature is not supported -TARGET_USES_CF_RILD ?= true -ifeq ($(TARGET_USES_CF_RILD),true) -PRODUCT_PACKAGES += \ - libcuttlefish-ril-2 \ - libcuttlefish-rild -endif -PRODUCT_COPY_FILES += \ - frameworks/native/data/etc/android.hardware.telephony.gsm.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.telephony.gsm.xml \ - frameworks/native/data/etc/android.hardware.telephony.ims.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.telephony.ims.xml \ - frameworks/native/data/etc/android.hardware.telephony.satellite.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.telephony.satellite.xml -endif # if not LOCAL_PREFER_VENDOR_APEX endif # if not TARGET_NO_TELEPHONY diff --git a/vsoc_arm64_only/slim/aosp_cf.mk b/vsoc_arm64_only/slim/aosp_cf.mk index d118163fe..46cdb1a25 100644 --- a/vsoc_arm64_only/slim/aosp_cf.mk +++ b/vsoc_arm64_only/slim/aosp_cf.mk @@ -37,7 +37,6 @@ PRODUCT_PACKAGES += FakeSystemApp # # All components inherited here go to vendor image # -LOCAL_PREFER_VENDOR_APEX := true $(call inherit-product, device/google/cuttlefish/shared/slim/device_vendor.mk) # @@ -45,14 +44,6 @@ $(call inherit-product, device/google/cuttlefish/shared/slim/device_vendor.mk) # $(call inherit-product, device/google/cuttlefish/vsoc_arm64/bootloader.mk) -# Exclude features that are not available on AOSP devices. -ifeq ($(LOCAL_PREFER_VENDOR_APEX),true) -PRODUCT_PACKAGES += com.google.aosp_cf_slim.hardware.core_permissions -else -PRODUCT_COPY_FILES += \ - frameworks/native/data/etc/aosp_excluded_hardware.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/aosp_excluded_hardware.xml -endif - PRODUCT_NAME := aosp_cf_arm64_slim PRODUCT_DEVICE := vsoc_arm64_only PRODUCT_MANUFACTURER := Google diff --git a/vsoc_riscv64/phone/aosp_cf.mk b/vsoc_riscv64/phone/aosp_cf.mk index d7f2e8aee..53b64ab81 100644 --- a/vsoc_riscv64/phone/aosp_cf.mk +++ b/vsoc_riscv64/phone/aosp_cf.mk @@ -36,7 +36,6 @@ $(call inherit-product, $(SRC_TARGET_DIR)/product/aosp_product.mk) # # All components inherited here go to vendor image # -LOCAL_PREFER_VENDOR_APEX := true #$(call inherit-product, device/google/cuttlefish/shared/phone/device_vendor.mk) # TODO: FIXME: Start workaround for phone/device_vendor.mk #################### @@ -45,11 +44,6 @@ SYSTEM_EXT_MANIFEST_FILES += device/google/cuttlefish/shared/config/system_ext_m $(call inherit-product, $(SRC_TARGET_DIR)/product/handheld_vendor.mk) -ifneq ($(LOCAL_PREFER_VENDOR_APEX),true) -PRODUCT_COPY_FILES += \ - frameworks/native/data/etc/handheld_core_hardware.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/handheld_core_hardware.xml -endif - $(call inherit-product, frameworks/native/build/phone-xhdpi-2048-dalvik-heap.mk) BOARD_HAVE_BLUETOOTH := false $(call inherit-product, device/google/cuttlefish/shared/bluetooth/device_vendor.mk) @@ -63,20 +57,8 @@ $(call inherit-product, device/google/cuttlefish/shared/device.mk) TARGET_PRODUCT_PROP := $(LOCAL_PATH)/../../shared/phone/product.prop -ifneq ($(LOCAL_PREFER_VENDOR_APEX),true) -PRODUCT_COPY_FILES += \ - frameworks/native/data/etc/android.hardware.biometrics.face.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.biometrics.face.xml \ - frameworks/native/data/etc/android.hardware.faketouch.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.faketouch.xml \ - frameworks/native/data/etc/android.hardware.fingerprint.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.fingerprint.xml \ - -endif - # Runtime Resource Overlays -ifeq ($(LOCAL_PREFER_VENDOR_APEX),true) PRODUCT_PACKAGES += com.google.aosp_cf_phone.rros -else -PRODUCT_PACKAGES += cuttlefish_phone_overlay_frameworks_base_core -endif TARGET_BOARD_INFO_FILE ?= device/google/cuttlefish/shared/phone/android-info.txt # TODO: FIXME: Stop workaround for phone/device_vendor.mk ##################### @@ -89,14 +71,6 @@ TARGET_BOARD_INFO_FILE ?= device/google/cuttlefish/shared/phone/android-info.txt # $(call inherit-product, device/google/cuttlefish/vsoc_riscv64/bootloader.mk) -# Exclude features that are not available on AOSP devices. -ifeq ($(LOCAL_PREFER_VENDOR_APEX),true) -PRODUCT_PACKAGES += com.google.aosp_cf_phone.hardware.core_permissions -else -PRODUCT_COPY_FILES += \ - frameworks/native/data/etc/aosp_excluded_hardware.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/aosp_excluded_hardware.xml -endif - # TODO(b/206676167): This property can be removed when renderscript is removed. # Prevents framework from attempting to load renderscript libraries, which are # not supported on this architecture. diff --git a/vsoc_riscv64/slim/aosp_cf.mk b/vsoc_riscv64/slim/aosp_cf.mk index b2a2ade61..afc246f3d 100644 --- a/vsoc_riscv64/slim/aosp_cf.mk +++ b/vsoc_riscv64/slim/aosp_cf.mk @@ -48,7 +48,6 @@ PRODUCT_PACKAGES += FakeSystemApp # # All components inherited here go to vendor image # -LOCAL_PREFER_VENDOR_APEX := true #$(call inherit-product, device/google/cuttlefish/shared/slim/device_vendor.mk) # TODO: FIXME: Start workaround for slim/device_vendor.mk #################### diff --git a/vsoc_x86_64/phone/aosp_cf.mk b/vsoc_x86_64/phone/aosp_cf.mk index f9e8d621a..b8632394f 100644 --- a/vsoc_x86_64/phone/aosp_cf.mk +++ b/vsoc_x86_64/phone/aosp_cf.mk @@ -36,7 +36,6 @@ $(call inherit-product, $(SRC_TARGET_DIR)/product/aosp_product.mk) # # All components inherited here go to vendor image # -LOCAL_PREFER_VENDOR_APEX := true $(call inherit-product, device/google/cuttlefish/shared/phone/device_vendor.mk) # Nested virtualization support @@ -47,14 +46,6 @@ $(call inherit-product, packages/modules/Virtualization/apex/product_packages.mk # $(call inherit-product, device/google/cuttlefish/vsoc_x86_64/bootloader.mk) -# Exclude features that are not available on AOSP devices. -ifeq ($(LOCAL_PREFER_VENDOR_APEX),true) -PRODUCT_PACKAGES += com.google.aosp_cf_phone.hardware.core_permissions -else -PRODUCT_COPY_FILES += \ - frameworks/native/data/etc/aosp_excluded_hardware.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/aosp_excluded_hardware.xml -endif - PRODUCT_NAME := aosp_cf_x86_64_phone PRODUCT_DEVICE := vsoc_x86_64 PRODUCT_MANUFACTURER := Google diff --git a/vsoc_x86_64_only/slim/aosp_cf.mk b/vsoc_x86_64_only/slim/aosp_cf.mk index 536a4b7f5..227e662e7 100644 --- a/vsoc_x86_64_only/slim/aosp_cf.mk +++ b/vsoc_x86_64_only/slim/aosp_cf.mk @@ -37,7 +37,6 @@ PRODUCT_PACKAGES += FakeSystemApp # # All components inherited here go to vendor image # -LOCAL_PREFER_VENDOR_APEX := true $(call inherit-product, device/google/cuttlefish/shared/slim/device_vendor.mk) # @@ -45,14 +44,6 @@ $(call inherit-product, device/google/cuttlefish/shared/slim/device_vendor.mk) # $(call inherit-product, device/google/cuttlefish/vsoc_x86_64/bootloader.mk) -# Exclude features that are not available on AOSP devices. -ifeq ($(LOCAL_PREFER_VENDOR_APEX),true) -PRODUCT_PACKAGES += com.google.aosp_cf_slim.hardware.core_permissions -else -PRODUCT_COPY_FILES += \ - frameworks/native/data/etc/aosp_excluded_hardware.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/aosp_excluded_hardware.xml -endif - PRODUCT_NAME := aosp_cf_x86_64_slim PRODUCT_DEVICE := vsoc_x86_64_only PRODUCT_MANUFACTURER := Google -- cgit v1.2.3 From 3a77bb608c68e9be4f647bd8d30be7a9eedd4be9 Mon Sep 17 00:00:00 2001 From: William Leshner Date: Fri, 2 Jun 2023 18:29:44 +0000 Subject: Revert "Remove LOCAL_PREFER_VENDOR_APEX variable from .mk files for cuttlefish" This reverts commit f84c662866e3f8a5b71ed3a8e10f51974a8e9620. Reason for revert: DroidMonitor: Potential culprit for Bug 285602206 - verifying through ABTD before revert submission. This is part of the standard investigation process, and does not mean your CL will be reverted. Change-Id: I9f60425dfc5be9c06a8e7083aafa17f6cfb7cae8 --- .../Android.bp | 44 +++++++++ .../Android.bp | 45 +++++++++ .../Android.bp | 57 ----------- shared/bluetooth/device_vendor.mk | 17 ++++ shared/device.mk | 104 ++++++++++++++++++++- shared/graphics/device_vendor.mk | 10 ++ shared/phone/device_vendor.mk | 26 +++++- shared/slim/device_vendor.mk | 21 ++++- shared/telephony/device_vendor.mk | 15 +++ vsoc_arm64_only/slim/aosp_cf.mk | 9 ++ vsoc_riscv64/phone/aosp_cf.mk | 26 ++++++ vsoc_riscv64/slim/aosp_cf.mk | 1 + vsoc_x86_64/phone/aosp_cf.mk | 9 ++ vsoc_x86_64_only/slim/aosp_cf.mk | 9 ++ 14 files changed, 327 insertions(+), 66 deletions(-) create mode 100644 apex/com.google.aosp_cf_phone.hardware.core_permissions/Android.bp create mode 100644 apex/com.google.aosp_cf_slim.hardware.core_permissions/Android.bp delete mode 100644 apex/com.google.cf.hardware.core_permissions/Android.bp diff --git a/apex/com.google.aosp_cf_phone.hardware.core_permissions/Android.bp b/apex/com.google.aosp_cf_phone.hardware.core_permissions/Android.bp new file mode 100644 index 000000000..2900f3296 --- /dev/null +++ b/apex/com.google.aosp_cf_phone.hardware.core_permissions/Android.bp @@ -0,0 +1,44 @@ +// Copyright (C) 2021 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 { + default_applicable_licenses: ["Android-Apache-2.0"], +} + +override_apex { + name: "com.google.aosp_cf_phone.hardware.core_permissions", + base: "com.android.hardware.core_permissions", + prebuilts: [ + "android.hardware.audio.low_latency.prebuilt.xml", + "android.hardware.biometrics.face.prebuilt.xml", + "android.hardware.ethernet.prebuilt.xml", + "android.hardware.faketouch.prebuilt.xml", + "android.hardware.fingerprint.prebuilt.xml", + "android.hardware.location.gps.prebuilt.xml", + "android.hardware.reboot_escrow.prebuilt.xml", + "android.hardware.usb.accessory.prebuilt.xml", + "android.hardware.usb.host.prebuilt.xml", + "android.hardware.vulkan.level-0.prebuilt.xml", + "android.hardware.vulkan.version-1_0_3.prebuilt.xml", + "android.software.device_id_attestation.prebuilt.xml", + "android.software.ipsec_tunnels.prebuilt.xml", + "android.software.opengles.deqp.level-2022-03-01.prebuilt.xml", + "android.software.sip.voip.prebuilt.xml", + "android.software.verified_boot.prebuilt.xml", + "android.software.vulkan.deqp.level-2022-03-01.prebuilt.xml", + "aosp_excluded_hardware.prebuilt.xml", + "cuttlefish_excluded_hardware.prebuilt.xml", + "handheld_core_hardware.prebuilt.xml", + ], +} diff --git a/apex/com.google.aosp_cf_slim.hardware.core_permissions/Android.bp b/apex/com.google.aosp_cf_slim.hardware.core_permissions/Android.bp new file mode 100644 index 000000000..959c95076 --- /dev/null +++ b/apex/com.google.aosp_cf_slim.hardware.core_permissions/Android.bp @@ -0,0 +1,45 @@ +// Copyright (C) 2022 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 { + default_applicable_licenses: ["Android-Apache-2.0"], +} + +override_apex { + name: "com.google.aosp_cf_slim.hardware.core_permissions", + base: "com.android.hardware.core_permissions", + prebuilts: [ + "android.hardware.audio.low_latency.prebuilt.xml", + "android.hardware.biometrics.face.prebuilt.xml", + "android.hardware.ethernet.prebuilt.xml", + "android.hardware.faketouch.prebuilt.xml", + "android.hardware.fingerprint.prebuilt.xml", + "android.hardware.location.gps.prebuilt.xml", + "android.hardware.reboot_escrow.prebuilt.xml", + "android.hardware.usb.accessory.prebuilt.xml", + "android.hardware.usb.host.prebuilt.xml", + "android.hardware.vulkan.level-0.prebuilt.xml", + "android.hardware.vulkan.version-1_0_3.prebuilt.xml", + "android.software.device_id_attestation.prebuilt.xml", + "android.software.ipsec_tunnels.prebuilt.xml", + "android.software.opengles.deqp.level-2022-03-01.prebuilt.xml", + "android.software.sip.voip.prebuilt.xml", + "android.software.verified_boot.prebuilt.xml", + "android.software.vulkan.deqp.level-2022-03-01.prebuilt.xml", + "aosp_excluded_hardware.prebuilt.xml", + "cuttlefish_excluded_hardware.prebuilt.xml", + "handheld_core_hardware.prebuilt.xml", + "slim_excluded_hardware.prebuilt.xml", + ], +} diff --git a/apex/com.google.cf.hardware.core_permissions/Android.bp b/apex/com.google.cf.hardware.core_permissions/Android.bp deleted file mode 100644 index 1f4c9cce0..000000000 --- a/apex/com.google.cf.hardware.core_permissions/Android.bp +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright (C) 2023 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 { - default_applicable_licenses: ["Android-Apache-2.0"], -} -permission_prebuilts = [ - "android.hardware.audio.low_latency.prebuilt.xml", - "android.hardware.ethernet.prebuilt.xml", - "android.hardware.location.gps.prebuilt.xml", - "android.hardware.reboot_escrow.prebuilt.xml", - "android.hardware.usb.accessory.prebuilt.xml", - "android.hardware.usb.host.prebuilt.xml", - "android.hardware.vulkan.level-0.prebuilt.xml", - "android.hardware.vulkan.version-1_0_3.prebuilt.xml", - "android.software.device_id_attestation.prebuilt.xml", - "android.software.ipsec_tunnels.prebuilt.xml", - "android.software.opengles.deqp.level-2022-03-01.prebuilt.xml", - "android.software.sip.voip.prebuilt.xml", - "android.software.verified_boot.prebuilt.xml", - "android.software.vulkan.deqp.level-2022-03-01.prebuilt.xml", - "cuttlefish_excluded_hardware.prebuilt.xml", -] -handheld_extra_prebuilts = [ - "handheld_core_hardware.prebuilt.xml", - "android.hardware.biometrics.face.prebuilt.xml", - "android.hardware.faketouch.prebuilt.xml", - "android.hardware.fingerprint.prebuilt.xml", -] -slim_extra_prebuilts = [ - "slim_excluded_hardware.prebuilt.xml", -] -override_apex { - name: "com.google.cf.hardware.core_permissions", - base: "com.android.hardware.core_permissions", - prebuilts: permission_prebuilts, -} -override_apex { - name: "com.google.cf_handheld.hardware.core_permissions", - base: "com.android.hardware.core_permissions", - prebuilts: permission_prebuilts + handheld_extra_prebuilts, -} -override_apex { - name: "com.google.cf_handheld_slim.hardware.core_permissions", - base: "com.android.hardware.core_permissions", - prebuilts: permission_prebuilts + handheld_extra_prebuilts + slim_extra_prebuilts, -} diff --git a/shared/bluetooth/device_vendor.mk b/shared/bluetooth/device_vendor.mk index 1eb55cec6..82b460f6c 100644 --- a/shared/bluetooth/device_vendor.mk +++ b/shared/bluetooth/device_vendor.mk @@ -33,7 +33,24 @@ PRODUCT_COPY_FILES += \ # # Bluetooth HAL and Compatibility Bluetooth library (for older revs). # +ifneq ($(LOCAL_PREFER_VENDOR_APEX),true) +PRODUCT_COPY_FILES +=\ + frameworks/native/data/etc/android.hardware.bluetooth.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.bluetooth.xml \ + frameworks/native/data/etc/android.hardware.bluetooth_le.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.bluetooth_le.xml + +PRODUCT_PACKAGES += \ + android.hardware.bluetooth-service.default \ + bt_vhci_forwarder + +# Bluetooth initialization configuration is copied to the init folder here instead of being added +# as an init_rc attribute of the bt_vhci_forward binary. The bt_vhci_forward binary is used by +# multiple targets with different initialization configurations. +PRODUCT_COPY_FILES += \ + device/google/cuttlefish/guest/commands/bt_vhci_forwarder/bt_vhci_forwarder.rc:$(TARGET_COPY_OUT_VENDOR)/etc/init/bt_vhci_forwarder.rc + +else PRODUCT_PACKAGES += com.google.cf.bt +endif # # Bluetooth Audio AIDL HAL diff --git a/shared/device.mk b/shared/device.mk index 2cbe3d8a6..73892f648 100644 --- a/shared/device.mk +++ b/shared/device.mk @@ -181,6 +181,15 @@ PRODUCT_PACKAGES += \ hidl_lazy_test_server \ hidl_lazy_cb_test_server +# Runtime Resource Overlays +ifneq ($(LOCAL_PREFER_VENDOR_APEX),true) +PRODUCT_PACKAGES += \ + cuttlefish_overlay_connectivity \ + cuttlefish_overlay_frameworks_base_core \ + cuttlefish_overlay_settings_provider + +endif + # # Satellite vendor service for CF # @@ -199,6 +208,37 @@ DEVICE_MANIFEST_FILE += $(LOCAL_DEVICE_FCM_MANIFEST_FILE) # General files # + +ifneq ($(LOCAL_SENSOR_FILE_OVERRIDES),true) +ifneq ($(LOCAL_PREFER_VENDOR_APEX),true) + PRODUCT_COPY_FILES += \ + frameworks/native/data/etc/android.hardware.sensor.ambient_temperature.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.sensor.ambient_temperature.xml \ + frameworks/native/data/etc/android.hardware.sensor.barometer.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.sensor.barometer.xml \ + frameworks/native/data/etc/android.hardware.sensor.gyroscope.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.sensor.gyroscope.xml \ + frameworks/native/data/etc/android.hardware.sensor.hinge_angle.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.sensor.hinge_angle.xml \ + frameworks/native/data/etc/android.hardware.sensor.light.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.sensor.light.xml \ + frameworks/native/data/etc/android.hardware.sensor.proximity.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.sensor.proximity.xml \ + frameworks/native/data/etc/android.hardware.sensor.relative_humidity.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.sensor.relative_humidity.xml +endif +endif + +ifneq ($(LOCAL_PREFER_VENDOR_APEX),true) +PRODUCT_COPY_FILES += \ + device/google/cuttlefish/shared/permissions/cuttlefish_excluded_hardware.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/cuttlefish_excluded_hardware.xml \ + frameworks/native/data/etc/android.hardware.audio.low_latency.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.audio.low_latency.xml \ + frameworks/native/data/etc/android.hardware.ethernet.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.ethernet.xml \ + frameworks/native/data/etc/android.hardware.location.gps.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.location.gps.xml \ + frameworks/native/data/etc/android.hardware.reboot_escrow.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.reboot_escrow.xml \ + frameworks/native/data/etc/android.hardware.usb.accessory.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.usb.accessory.xml \ + frameworks/native/data/etc/android.hardware.usb.host.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.usb.host.xml \ + frameworks/native/data/etc/android.hardware.wifi.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.wifi.xml \ + frameworks/native/data/etc/android.hardware.wifi.direct.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.wifi.direct.xml \ + frameworks/native/data/etc/android.hardware.wifi.passpoint.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.wifi.passpoint.xml \ + frameworks/native/data/etc/android.software.ipsec_tunnels.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.software.ipsec_tunnels.xml \ + frameworks/native/data/etc/android.software.sip.voip.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.software.sip.voip.xml \ + frameworks/native/data/etc/android.software.verified_boot.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.software.verified_boot.xml + +endif PRODUCT_COPY_FILES += \ frameworks/native/data/etc/android.hardware.consumerir.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.consumerir.xml \ device/google/cuttlefish/shared/config/init.vendor.rc:$(TARGET_COPY_OUT_VENDOR)/etc/init/init.cutf_cvm.rc \ @@ -221,10 +261,17 @@ PRODUCT_COPY_FILES += \ device/google/cuttlefish/shared/config/task_profiles.json:$(TARGET_COPY_OUT_VENDOR)/etc/task_profiles.json \ frameworks/native/data/etc/android.software.credentials.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.software.credentials.xml \ +ifeq ($(LOCAL_PREFER_VENDOR_APEX),true) PRODUCT_PACKAGES += com.google.cf.input.config -# Default permission to access services -LOCAL_HARDWARE_PERMISSIONS_PRODUCT_PACKAGE ?= com.google.cf.hardware.core_permissions -PRODUCT_PACKAGES += $(LOCAL_HARDWARE_PERMISSIONS_PRODUCT_PACKAGE) +else +PRODUCT_COPY_FILES += \ + device/google/cuttlefish/shared/config/input/Crosvm_Virtio_Multitouch_Touchscreen_0.idc:$(TARGET_COPY_OUT_VENDOR)/usr/idc/Crosvm_Virtio_Multitouch_Touchscreen_0.idc \ + device/google/cuttlefish/shared/config/input/Crosvm_Virtio_Multitouch_Touchscreen_1.idc:$(TARGET_COPY_OUT_VENDOR)/usr/idc/Crosvm_Virtio_Multitouch_Touchscreen_1.idc \ + device/google/cuttlefish/shared/config/input/Crosvm_Virtio_Multitouch_Touchscreen_2.idc:$(TARGET_COPY_OUT_VENDOR)/usr/idc/Crosvm_Virtio_Multitouch_Touchscreen_2.idc \ + device/google/cuttlefish/shared/config/input/Crosvm_Virtio_Multitouch_Touchscreen_3.idc:$(TARGET_COPY_OUT_VENDOR)/usr/idc/Crosvm_Virtio_Multitouch_Touchscreen_3.idc \ + device/google/cuttlefish/shared/config/input/Crosvm_Virtio_Rotary_0.idc:$(TARGET_COPY_OUT_VENDOR)/usr/idc/Crosvm_Virtio_Rotary_0.idc \ + +endif PRODUCT_PACKAGES += \ fstab.cf.f2fs.hctr2 \ @@ -406,7 +453,11 @@ PRODUCT_PACKAGES += \ # Sensors # ifeq ($(LOCAL_SENSOR_PRODUCT_PACKAGE),) +ifeq ($(LOCAL_PREFER_VENDOR_APEX),true) LOCAL_SENSOR_PRODUCT_PACKAGE := com.android.hardware.sensors +else + LOCAL_SENSOR_PRODUCT_PACKAGE := android.hardware.sensors-service.example +endif endif PRODUCT_PACKAGES += \ $(LOCAL_SENSOR_PRODUCT_PACKAGE) @@ -434,7 +485,14 @@ PRODUCT_COPY_FILES += \ # # Power and PowerStats HALs # +ifeq ($(LOCAL_PREFER_VENDOR_APEX),true) PRODUCT_PACKAGES += com.android.hardware.power +else +PRODUCT_PACKAGES += \ + android.hardware.power-service.example \ + android.hardware.power.stats-service.example \ + +endif # # Tetheroffload HAL @@ -461,7 +519,12 @@ PRODUCT_PACKAGES += \ com.android.hardware.usb # Vibrator HAL +ifeq ($(LOCAL_PREFER_VENDOR_APEX),true) PRODUCT_PACKAGES += com.android.hardware.vibrator +else +PRODUCT_PACKAGES += \ + android.hardware.vibrator-service.example +endif PRODUCT_PACKAGES += \ android.hardware.secure_element-service.example @@ -509,15 +572,48 @@ PRODUCT_PACKAGES += linker.recovery shell_and_utilities_recovery endif # wifi +ifeq ($(LOCAL_PREFER_VENDOR_APEX),true) # Add com.android.hardware.wifi for android.hardware.wifi-service PRODUCT_PACKAGES += com.android.hardware.wifi # Add com.google.cf.wifi for hostapd, wpa_supplicant, etc. -# TODO(b/282956397): Clean up shared/config/wpa_supplicant.rc PRODUCT_PACKAGES += com.google.cf.wifi $(call add_soong_config_namespace, wpa_supplicant) $(call add_soong_config_var_value, wpa_supplicant, platform_version, $(PLATFORM_VERSION)) $(call add_soong_config_var_value, wpa_supplicant, nl80211_driver, CONFIG_DRIVER_NL80211_QCA) +else +PRODUCT_PACKAGES += \ + rename_netiface \ + wpa_supplicant \ + setup_wifi \ + mac80211_create_radios \ + hostapd \ + android.hardware.wifi-service \ + init.wifi +PRODUCT_COPY_FILES += \ + device/google/cuttlefish/shared/config/wpa_supplicant.rc:$(TARGET_COPY_OUT_VENDOR)/etc/init/wpa_supplicant.rc + +# VirtWifi interface configuration +ifeq ($(DEVICE_VIRTWIFI_PORT),) + DEVICE_VIRTWIFI_PORT := eth2 +endif +PRODUCT_VENDOR_PROPERTIES += ro.vendor.virtwifi.port=${DEVICE_VIRTWIFI_PORT} + +# WLAN driver configuration files +ifndef LOCAL_WPA_SUPPLICANT_OVERLAY +LOCAL_WPA_SUPPLICANT_OVERLAY := $(LOCAL_PATH)/config/wpa_supplicant_overlay.conf +endif + +ifndef LOCAL_P2P_SUPPLICANT +LOCAL_P2P_SUPPLICANT := $(LOCAL_PATH)/config/p2p_supplicant.conf +endif + +PRODUCT_COPY_FILES += \ + external/wpa_supplicant_8/wpa_supplicant/wpa_supplicant_template.conf:$(TARGET_COPY_OUT_VENDOR)/etc/wifi/wpa_supplicant.conf \ + $(LOCAL_WPA_SUPPLICANT_OVERLAY):$(TARGET_COPY_OUT_VENDOR)/etc/wifi/wpa_supplicant_overlay.conf \ + $(LOCAL_P2P_SUPPLICANT):$(TARGET_COPY_OUT_VENDOR)/etc/wifi/p2p_supplicant.conf +endif + # Wifi Runtime Resource Overlay PRODUCT_PACKAGES += \ CuttlefishTetheringOverlay \ diff --git a/shared/graphics/device_vendor.mk b/shared/graphics/device_vendor.mk index b760004c4..b5f410281 100644 --- a/shared/graphics/device_vendor.mk +++ b/shared/graphics/device_vendor.mk @@ -49,6 +49,16 @@ PRODUCT_PACKAGES += \ libvulkan_enc endif +ifeq ($(TARGET_VULKAN_SUPPORT),true) +ifneq ($(LOCAL_PREFER_VENDOR_APEX),true) +PRODUCT_COPY_FILES += \ + frameworks/native/data/etc/android.hardware.vulkan.level-0.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.vulkan.level.xml \ + frameworks/native/data/etc/android.hardware.vulkan.version-1_0_3.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.vulkan.version.xml \ + frameworks/native/data/etc/android.software.vulkan.deqp.level-2023-03-01.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.software.vulkan.deqp.level.xml \ + frameworks/native/data/etc/android.software.opengles.deqp.level-2023-03-01.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.software.opengles.deqp.level.xml +endif +endif + # # Hardware Composer HAL # diff --git a/shared/phone/device_vendor.mk b/shared/phone/device_vendor.mk index b9b3d1e1b..afb0641ac 100644 --- a/shared/phone/device_vendor.mk +++ b/shared/phone/device_vendor.mk @@ -16,13 +16,16 @@ PRODUCT_MANIFEST_FILES += device/google/cuttlefish/shared/config/product_manifest.xml SYSTEM_EXT_MANIFEST_FILES += device/google/cuttlefish/shared/config/system_ext_manifest.xml -# Permission to access services for phone -LOCAL_HARDWARE_PERMISSIONS_PRODUCT_PACKAGE := com.google.cf_handheld.hardware.core_permissions PRODUCT_MAX_PAGE_SIZE_SUPPORTED := 65536 $(call inherit-product, $(SRC_TARGET_DIR)/product/handheld_vendor.mk) +ifneq ($(LOCAL_PREFER_VENDOR_APEX),true) +PRODUCT_COPY_FILES += \ + frameworks/native/data/etc/handheld_core_hardware.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/handheld_core_hardware.xml +endif + $(call inherit-product, frameworks/native/build/phone-xhdpi-2048-dalvik-heap.mk) $(call inherit-product, device/google/cuttlefish/shared/bluetooth/device_vendor.mk) $(call inherit-product, device/google/cuttlefish/shared/camera/device_vendor.mk) @@ -36,8 +39,25 @@ PRODUCT_EXTRA_VNDK_VERSIONS := 29 30 31 TARGET_PRODUCT_PROP := $(LOCAL_PATH)/product.prop +ifneq ($(LOCAL_PREFER_VENDOR_APEX),true) +PRODUCT_COPY_FILES += \ + frameworks/native/data/etc/android.hardware.faketouch.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.faketouch.xml \ + frameworks/native/data/etc/android.hardware.fingerprint.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.fingerprint.xml \ + + ifneq ($(TARGET_DISABLE_BIOMETRICS_FACE),true) + PRODUCT_COPY_FILES += \ + frameworks/native/data/etc/android.hardware.biometrics.face.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.biometrics.face.xml \ + + endif +endif + + + # Runtime Resource Overlays +ifeq ($(LOCAL_PREFER_VENDOR_APEX),true) PRODUCT_PACKAGES += com.google.aosp_cf_phone.rros - +else +PRODUCT_PACKAGES += cuttlefish_phone_overlay_frameworks_base_core +endif TARGET_BOARD_INFO_FILE ?= device/google/cuttlefish/shared/phone/android-info.txt diff --git a/shared/slim/device_vendor.mk b/shared/slim/device_vendor.mk index 8e24ac0c2..a1ec725b8 100644 --- a/shared/slim/device_vendor.mk +++ b/shared/slim/device_vendor.mk @@ -19,8 +19,11 @@ SYSTEM_EXT_MANIFEST_FILES += device/google/cuttlefish/shared/config/system_ext_m $(call inherit-product, $(SRC_TARGET_DIR)/product/handheld_vendor.mk) -# Permission to access services -LOCAL_HARDWARE_PERMISSIONS_PRODUCT_PACKAGE := com.google.cf_handheld_slim.hardware.core_permissions +ifneq ($(LOCAL_PREFER_VENDOR_APEX),true) +PRODUCT_COPY_FILES += \ + frameworks/native/data/etc/handheld_core_hardware.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/handheld_core_hardware.xml +PRODUCT_PACKAGES += slim_excluded_hardware.prebuilt.xml +endif $(call inherit-product, frameworks/native/build/phone-xhdpi-2048-dalvik-heap.mk) $(call inherit-product, device/google/cuttlefish/shared/bluetooth/device_vendor.mk) @@ -34,9 +37,23 @@ $(call inherit-product, device/google/cuttlefish/shared/device.mk) PRODUCT_VENDOR_PROPERTIES += \ debug.hwui.drawing_enabled=0 \ +ifneq ($(LOCAL_PREFER_VENDOR_APEX),true) +PRODUCT_COPY_FILES += \ + frameworks/native/data/etc/android.hardware.biometrics.face.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.biometrics.face.xml \ + frameworks/native/data/etc/android.hardware.faketouch.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.faketouch.xml \ + frameworks/native/data/etc/android.hardware.fingerprint.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.fingerprint.xml \ + +endif + # Runtime Resource Overlays +ifeq ($(LOCAL_PREFER_VENDOR_APEX),true) PRODUCT_PACKAGES += \ com.google.aosp_cf_phone.rros \ com.google.aosp_cf_slim.rros +else +PRODUCT_PACKAGES += \ + cuttlefish_phone_overlay_frameworks_base_core \ + slim_overlay_frameworks_base_core +endif TARGET_BOARD_INFO_FILE ?= device/google/cuttlefish/shared/slim/android-info.txt diff --git a/shared/telephony/device_vendor.mk b/shared/telephony/device_vendor.mk index 873bb468a..bd78cc6d0 100644 --- a/shared/telephony/device_vendor.mk +++ b/shared/telephony/device_vendor.mk @@ -27,6 +27,21 @@ PRODUCT_VENDOR_PROPERTIES += \ ro.com.android.dataroaming=true \ ro.telephony.default_network=9 \ +ifeq ($(LOCAL_PREFER_VENDOR_APEX),true) PRODUCT_PACKAGES += com.google.cf.rild +else +# If downstream target provides its own RILD, set TARGET_USES_CF_RILD := false +# If the target prefers vendor APEX, this feature is not supported +TARGET_USES_CF_RILD ?= true +ifeq ($(TARGET_USES_CF_RILD),true) +PRODUCT_PACKAGES += \ + libcuttlefish-ril-2 \ + libcuttlefish-rild +endif +PRODUCT_COPY_FILES += \ + frameworks/native/data/etc/android.hardware.telephony.gsm.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.telephony.gsm.xml \ + frameworks/native/data/etc/android.hardware.telephony.ims.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.telephony.ims.xml \ + frameworks/native/data/etc/android.hardware.telephony.satellite.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.telephony.satellite.xml +endif # if not LOCAL_PREFER_VENDOR_APEX endif # if not TARGET_NO_TELEPHONY diff --git a/vsoc_arm64_only/slim/aosp_cf.mk b/vsoc_arm64_only/slim/aosp_cf.mk index 46cdb1a25..d118163fe 100644 --- a/vsoc_arm64_only/slim/aosp_cf.mk +++ b/vsoc_arm64_only/slim/aosp_cf.mk @@ -37,6 +37,7 @@ PRODUCT_PACKAGES += FakeSystemApp # # All components inherited here go to vendor image # +LOCAL_PREFER_VENDOR_APEX := true $(call inherit-product, device/google/cuttlefish/shared/slim/device_vendor.mk) # @@ -44,6 +45,14 @@ $(call inherit-product, device/google/cuttlefish/shared/slim/device_vendor.mk) # $(call inherit-product, device/google/cuttlefish/vsoc_arm64/bootloader.mk) +# Exclude features that are not available on AOSP devices. +ifeq ($(LOCAL_PREFER_VENDOR_APEX),true) +PRODUCT_PACKAGES += com.google.aosp_cf_slim.hardware.core_permissions +else +PRODUCT_COPY_FILES += \ + frameworks/native/data/etc/aosp_excluded_hardware.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/aosp_excluded_hardware.xml +endif + PRODUCT_NAME := aosp_cf_arm64_slim PRODUCT_DEVICE := vsoc_arm64_only PRODUCT_MANUFACTURER := Google diff --git a/vsoc_riscv64/phone/aosp_cf.mk b/vsoc_riscv64/phone/aosp_cf.mk index 53b64ab81..d7f2e8aee 100644 --- a/vsoc_riscv64/phone/aosp_cf.mk +++ b/vsoc_riscv64/phone/aosp_cf.mk @@ -36,6 +36,7 @@ $(call inherit-product, $(SRC_TARGET_DIR)/product/aosp_product.mk) # # All components inherited here go to vendor image # +LOCAL_PREFER_VENDOR_APEX := true #$(call inherit-product, device/google/cuttlefish/shared/phone/device_vendor.mk) # TODO: FIXME: Start workaround for phone/device_vendor.mk #################### @@ -44,6 +45,11 @@ SYSTEM_EXT_MANIFEST_FILES += device/google/cuttlefish/shared/config/system_ext_m $(call inherit-product, $(SRC_TARGET_DIR)/product/handheld_vendor.mk) +ifneq ($(LOCAL_PREFER_VENDOR_APEX),true) +PRODUCT_COPY_FILES += \ + frameworks/native/data/etc/handheld_core_hardware.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/handheld_core_hardware.xml +endif + $(call inherit-product, frameworks/native/build/phone-xhdpi-2048-dalvik-heap.mk) BOARD_HAVE_BLUETOOTH := false $(call inherit-product, device/google/cuttlefish/shared/bluetooth/device_vendor.mk) @@ -57,8 +63,20 @@ $(call inherit-product, device/google/cuttlefish/shared/device.mk) TARGET_PRODUCT_PROP := $(LOCAL_PATH)/../../shared/phone/product.prop +ifneq ($(LOCAL_PREFER_VENDOR_APEX),true) +PRODUCT_COPY_FILES += \ + frameworks/native/data/etc/android.hardware.biometrics.face.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.biometrics.face.xml \ + frameworks/native/data/etc/android.hardware.faketouch.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.faketouch.xml \ + frameworks/native/data/etc/android.hardware.fingerprint.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.fingerprint.xml \ + +endif + # Runtime Resource Overlays +ifeq ($(LOCAL_PREFER_VENDOR_APEX),true) PRODUCT_PACKAGES += com.google.aosp_cf_phone.rros +else +PRODUCT_PACKAGES += cuttlefish_phone_overlay_frameworks_base_core +endif TARGET_BOARD_INFO_FILE ?= device/google/cuttlefish/shared/phone/android-info.txt # TODO: FIXME: Stop workaround for phone/device_vendor.mk ##################### @@ -71,6 +89,14 @@ TARGET_BOARD_INFO_FILE ?= device/google/cuttlefish/shared/phone/android-info.txt # $(call inherit-product, device/google/cuttlefish/vsoc_riscv64/bootloader.mk) +# Exclude features that are not available on AOSP devices. +ifeq ($(LOCAL_PREFER_VENDOR_APEX),true) +PRODUCT_PACKAGES += com.google.aosp_cf_phone.hardware.core_permissions +else +PRODUCT_COPY_FILES += \ + frameworks/native/data/etc/aosp_excluded_hardware.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/aosp_excluded_hardware.xml +endif + # TODO(b/206676167): This property can be removed when renderscript is removed. # Prevents framework from attempting to load renderscript libraries, which are # not supported on this architecture. diff --git a/vsoc_riscv64/slim/aosp_cf.mk b/vsoc_riscv64/slim/aosp_cf.mk index afc246f3d..b2a2ade61 100644 --- a/vsoc_riscv64/slim/aosp_cf.mk +++ b/vsoc_riscv64/slim/aosp_cf.mk @@ -48,6 +48,7 @@ PRODUCT_PACKAGES += FakeSystemApp # # All components inherited here go to vendor image # +LOCAL_PREFER_VENDOR_APEX := true #$(call inherit-product, device/google/cuttlefish/shared/slim/device_vendor.mk) # TODO: FIXME: Start workaround for slim/device_vendor.mk #################### diff --git a/vsoc_x86_64/phone/aosp_cf.mk b/vsoc_x86_64/phone/aosp_cf.mk index b8632394f..f9e8d621a 100644 --- a/vsoc_x86_64/phone/aosp_cf.mk +++ b/vsoc_x86_64/phone/aosp_cf.mk @@ -36,6 +36,7 @@ $(call inherit-product, $(SRC_TARGET_DIR)/product/aosp_product.mk) # # All components inherited here go to vendor image # +LOCAL_PREFER_VENDOR_APEX := true $(call inherit-product, device/google/cuttlefish/shared/phone/device_vendor.mk) # Nested virtualization support @@ -46,6 +47,14 @@ $(call inherit-product, packages/modules/Virtualization/apex/product_packages.mk # $(call inherit-product, device/google/cuttlefish/vsoc_x86_64/bootloader.mk) +# Exclude features that are not available on AOSP devices. +ifeq ($(LOCAL_PREFER_VENDOR_APEX),true) +PRODUCT_PACKAGES += com.google.aosp_cf_phone.hardware.core_permissions +else +PRODUCT_COPY_FILES += \ + frameworks/native/data/etc/aosp_excluded_hardware.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/aosp_excluded_hardware.xml +endif + PRODUCT_NAME := aosp_cf_x86_64_phone PRODUCT_DEVICE := vsoc_x86_64 PRODUCT_MANUFACTURER := Google diff --git a/vsoc_x86_64_only/slim/aosp_cf.mk b/vsoc_x86_64_only/slim/aosp_cf.mk index 227e662e7..536a4b7f5 100644 --- a/vsoc_x86_64_only/slim/aosp_cf.mk +++ b/vsoc_x86_64_only/slim/aosp_cf.mk @@ -37,6 +37,7 @@ PRODUCT_PACKAGES += FakeSystemApp # # All components inherited here go to vendor image # +LOCAL_PREFER_VENDOR_APEX := true $(call inherit-product, device/google/cuttlefish/shared/slim/device_vendor.mk) # @@ -44,6 +45,14 @@ $(call inherit-product, device/google/cuttlefish/shared/slim/device_vendor.mk) # $(call inherit-product, device/google/cuttlefish/vsoc_x86_64/bootloader.mk) +# Exclude features that are not available on AOSP devices. +ifeq ($(LOCAL_PREFER_VENDOR_APEX),true) +PRODUCT_PACKAGES += com.google.aosp_cf_slim.hardware.core_permissions +else +PRODUCT_COPY_FILES += \ + frameworks/native/data/etc/aosp_excluded_hardware.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/aosp_excluded_hardware.xml +endif + PRODUCT_NAME := aosp_cf_x86_64_slim PRODUCT_DEVICE := vsoc_x86_64_only PRODUCT_MANUFACTURER := Google -- cgit v1.2.3 From 6429db8ca34f6c3cc9c25131aa00ab8e005b5e2c Mon Sep 17 00:00:00 2001 From: Johanna Ye Date: Wed, 14 Jun 2023 14:02:48 +0800 Subject: Add Bluetooth profile configurations to TV Cuttlefish target. Test: atest pts-bot:AVCTP/TG/FRA/BV-03-C -v Bug: 281643033 Change-Id: Ib5a73319d3f973cbc1e2becba31751cc7894fc3f --- shared/tv/device_vendor.mk | 5 +++++ shared/tv/product.prop | 31 +++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 shared/tv/product.prop diff --git a/shared/tv/device_vendor.mk b/shared/tv/device_vendor.mk index 50728b795..40310dfc5 100644 --- a/shared/tv/device_vendor.mk +++ b/shared/tv/device_vendor.mk @@ -40,6 +40,11 @@ PRODUCT_COPY_FILES += \ hardware/interfaces/tv/tuner/config/sample_tuner_vts_config_1_1.xml:$(TARGET_COPY_OUT_VENDOR)/etc/tuner_vts_config_1_1.xml \ hardware/interfaces/tv/tuner/config/sample_tuner_vts_config_aidl_V1.xml:$(TARGET_COPY_OUT_VENDOR)/etc/tuner_vts_config_aidl_V1.xml +# Bluetooth hardware properties. +ifeq ($(TARGET_PRODUCT_PROP),) +TARGET_PRODUCT_PROP := $(LOCAL_PATH)/product.prop +endif + # HDMI AIDL HAL PRODUCT_PACKAGES += \ android.hardware.tv.hdmi.connection-service diff --git a/shared/tv/product.prop b/shared/tv/product.prop new file mode 100644 index 000000000..b61ec30c0 --- /dev/null +++ b/shared/tv/product.prop @@ -0,0 +1,31 @@ +# Set the Bluetooth Class of Device +# Service Field: 0x22 -> 34 +# Bit 17: Networking +# Bit 21: Audio +# MAJOR_CLASS: 0x04 -> 4 (Audio / Video) +# MINOR_CLASS: 0x24 -> 36 (Set-top box) +bluetooth.device.class_of_device=34,4,36 + +# Set supported Bluetooth profiles to enabled +bluetooth.profile.asha.central.enabled=true +bluetooth.profile.a2dp.source.enabled=true +bluetooth.profile.avrcp.target.enabled=true +bluetooth.profile.gatt.enabled=true +bluetooth.profile.hfp.ag.enabled=true +bluetooth.profile.hid.device.enabled=true +bluetooth.profile.hid.host.enabled=true +bluetooth.profile.map.server.enabled=true +bluetooth.profile.mcp.server.enabled=true +bluetooth.profile.opp.enabled=true +bluetooth.profile.pan.nap.enabled=true +bluetooth.profile.pan.panu.enabled=true +bluetooth.profile.pbap.server.enabled=true + +# Disable LeAudio related profile as there is no support for it +bluetooth.profile.bap.broadcast.assist.enabled=false +bluetooth.profile.bap.unicast.client.enabled=false +bluetooth.profile.bas.client.enabled=false +bluetooth.profile.ccp.server.enabled=false +bluetooth.profile.csip.set_coordinator.enabled=false +bluetooth.profile.hap.client.enabled=false +bluetooth.profile.vcp.controller.enabled=false -- cgit v1.2.3 From e2b6b1cfe2b29408f5224cac2cafe44195fa781a Mon Sep 17 00:00:00 2001 From: Alfred Piccioni Date: Thu, 15 Jun 2023 14:04:17 +0000 Subject: Set HDMI CEC as playback device in ATV CF Change-Id: Ib38c165b5f0ba52825f8f8c12646075bfa305d43 Fixes: 287450360 Test: Presubmits --- shared/tv/device_vendor.mk | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/shared/tv/device_vendor.mk b/shared/tv/device_vendor.mk index 50728b795..3ae06184e 100644 --- a/shared/tv/device_vendor.mk +++ b/shared/tv/device_vendor.mk @@ -53,7 +53,9 @@ PRODUCT_PACKAGES += \ android.hardware.tv.hdmi.earc-service # Setup HDMI CEC as Playback Device -PRODUCT_PROPERTY_OVERRIDES += ro.hdmi.device_type=4 +PRODUCT_PROPERTY_OVERRIDES += \ + ro.hdmi.device_type=4 \ + ro.hdmi.cec_device_types=playback_device # Tuner lazy HAL PRODUCT_PACKAGES += android.hardware.tv.tuner-service.example-lazy -- cgit v1.2.3 From 3b96c23c681da86540fd2c98eafa08d5cf1f0b00 Mon Sep 17 00:00:00 2001 From: Antonio Kantek Date: Fri, 23 Jun 2023 21:46:14 +0000 Subject: Decommission mumd-ime Test: m Bug: 288604465 Change-Id: I640149b4e4c7df0de07d3c591ca749b063c58915 --- shared/auto_md/overlay/frameworks/base/core/res/res/values/config.xml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/shared/auto_md/overlay/frameworks/base/core/res/res/values/config.xml b/shared/auto_md/overlay/frameworks/base/core/res/res/values/config.xml index 2ffb57a80..8ccc195dc 100644 --- a/shared/auto_md/overlay/frameworks/base/core/res/res/values/config.xml +++ b/shared/auto_md/overlay/frameworks/base/core/res/res/values/config.xml @@ -59,8 +59,4 @@ true - - - com.android.server.inputmethod.InputMethodManagerServiceProxy$Lifecycle - -- cgit v1.2.3 From e184c26eaf7112dc4ed9a52c8a6d9425bfcde99e Mon Sep 17 00:00:00 2001 From: Sicheng Duan Date: Thu, 29 Jun 2023 12:58:32 +0800 Subject: Disable android.hardware.camera.autofocus in tablet. Test: This is a newly introduced config file thus no target is affected currently. Bug: 281798479 Change-Id: I11fbd89c5dced4edab55e7481d6a2e81a5b086d9 --- shared/tablet/Android.bp | 25 +++++++++++++++++++++++++ shared/tablet/tablet_excluded_hardware.xml | 20 ++++++++++++++++++++ 2 files changed, 45 insertions(+) create mode 100644 shared/tablet/Android.bp create mode 100644 shared/tablet/tablet_excluded_hardware.xml diff --git a/shared/tablet/Android.bp b/shared/tablet/Android.bp new file mode 100644 index 000000000..83ae87d58 --- /dev/null +++ b/shared/tablet/Android.bp @@ -0,0 +1,25 @@ +// +// Copyright (C) 2023 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 { + default_applicable_licenses: ["Android-Apache-2.0"], +} + +prebuilt_etc { + name: "tablet_excluded_hardware.prebuilt.xml", + src: "tablet_excluded_hardware.xml", + relative_install_path: "permissions", + soc_specific: true, +} \ No newline at end of file diff --git a/shared/tablet/tablet_excluded_hardware.xml b/shared/tablet/tablet_excluded_hardware.xml new file mode 100644 index 000000000..901de8261 --- /dev/null +++ b/shared/tablet/tablet_excluded_hardware.xml @@ -0,0 +1,20 @@ + + + + + + + \ No newline at end of file -- cgit v1.2.3 From 9129e0626f46d3fa6a497be42cf7435af56c4d89 Mon Sep 17 00:00:00 2001 From: Alfred Piccioni Date: Wed, 21 Jun 2023 15:17:19 +0200 Subject: Move Fingerprint Biometrics to Cuttlefish fragment Bug: 244594222 Test: Build and boot Android TV, presubmits. Change-Id: I9c762778a0792635c72d9743fd271be79c544226 --- shared/biometrics_fingerprint/device_vendor.mk | 23 +++++++++++++++++++++++ shared/device.mk | 6 ------ shared/phone/device_vendor.mk | 2 +- shared/slim/device_vendor.mk | 2 +- vsoc_riscv64/phone/aosp_cf.mk | 2 +- vsoc_riscv64/slim/aosp_cf.mk | 1 + 6 files changed, 27 insertions(+), 9 deletions(-) create mode 100644 shared/biometrics_fingerprint/device_vendor.mk diff --git a/shared/biometrics_fingerprint/device_vendor.mk b/shared/biometrics_fingerprint/device_vendor.mk new file mode 100644 index 000000000..24bef1e2c --- /dev/null +++ b/shared/biometrics_fingerprint/device_vendor.mk @@ -0,0 +1,23 @@ +# +# Copyright (C) 2023 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. +# + +ifneq ($(LOCAL_PREFER_VENDOR_APEX),true) +PRODUCT_COPY_FILES += \ + frameworks/native/data/etc/android.hardware.fingerprint.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.fingerprint.xml +endif + +PRODUCT_PACKAGES += \ + com.android.hardware.biometrics.fingerprint.virtual diff --git a/shared/device.mk b/shared/device.mk index f6f548d49..a331bdecb 100644 --- a/shared/device.mk +++ b/shared/device.mk @@ -346,12 +346,6 @@ PRODUCT_PACKAGES += $(LOCAL_AUDIO_PRODUCT_PACKAGE) PRODUCT_COPY_FILES += $(LOCAL_AUDIO_PRODUCT_COPY_FILES) DEVICE_PACKAGE_OVERLAYS += $(LOCAL_AUDIO_DEVICE_PACKAGE_OVERLAYS) -# -# BiometricsFingerprint HAL (AIDL) -# -PRODUCT_PACKAGES += \ - com.android.hardware.biometrics.fingerprint.virtual - # # Contexthub HAL # diff --git a/shared/phone/device_vendor.mk b/shared/phone/device_vendor.mk index 2ffa03e76..5954d54c2 100644 --- a/shared/phone/device_vendor.mk +++ b/shared/phone/device_vendor.mk @@ -29,6 +29,7 @@ endif $(call inherit-product, frameworks/native/build/phone-xhdpi-2048-dalvik-heap.mk) $(call inherit-product, device/google/cuttlefish/shared/biometrics_face/device_vendor.mk) +$(call inherit-product, device/google/cuttlefish/shared/biometrics_fingerprint/device_vendor.mk) $(call inherit-product, device/google/cuttlefish/shared/bluetooth/device_vendor.mk) $(call inherit-product, device/google/cuttlefish/shared/camera/device_vendor.mk) $(call inherit-product, device/google/cuttlefish/shared/consumerir/device_vendor.mk) @@ -46,7 +47,6 @@ TARGET_PRODUCT_PROP := $(LOCAL_PATH)/product.prop ifneq ($(LOCAL_PREFER_VENDOR_APEX),true) PRODUCT_COPY_FILES += \ frameworks/native/data/etc/android.hardware.faketouch.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.faketouch.xml \ - frameworks/native/data/etc/android.hardware.fingerprint.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.fingerprint.xml \ ifneq ($(TARGET_DISABLE_BIOMETRICS_FACE),true) PRODUCT_COPY_FILES += \ diff --git a/shared/slim/device_vendor.mk b/shared/slim/device_vendor.mk index c5dfebfdc..7bfbdb037 100644 --- a/shared/slim/device_vendor.mk +++ b/shared/slim/device_vendor.mk @@ -28,6 +28,7 @@ endif $(call inherit-product, frameworks/native/build/phone-xhdpi-2048-dalvik-heap.mk) $(call inherit-product, device/google/cuttlefish/shared/biometrics_face/device_vendor.mk) +$(call inherit-product, device/google/cuttlefish/shared/biometrics_fingerprint/device_vendor.mk) $(call inherit-product, device/google/cuttlefish/shared/bluetooth/device_vendor.mk) $(call inherit-product, device/google/cuttlefish/shared/camera/device_vendor.mk) $(call inherit-product, device/google/cuttlefish/shared/consumerir/device_vendor.mk) @@ -44,7 +45,6 @@ PRODUCT_VENDOR_PROPERTIES += \ ifneq ($(LOCAL_PREFER_VENDOR_APEX),true) PRODUCT_COPY_FILES += \ frameworks/native/data/etc/android.hardware.faketouch.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.faketouch.xml \ - frameworks/native/data/etc/android.hardware.fingerprint.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.fingerprint.xml \ endif diff --git a/vsoc_riscv64/phone/aosp_cf.mk b/vsoc_riscv64/phone/aosp_cf.mk index f033a8d17..36947bc1c 100644 --- a/vsoc_riscv64/phone/aosp_cf.mk +++ b/vsoc_riscv64/phone/aosp_cf.mk @@ -53,6 +53,7 @@ endif $(call inherit-product, frameworks/native/build/phone-xhdpi-2048-dalvik-heap.mk) $(call inherit-product, device/google/cuttlefish/shared/biometrics_face/device_vendor.mk) +$(call inherit-product, device/google/cuttlefish/shared/biometrics_fingerprint/device_vendor.mk) BOARD_HAVE_BLUETOOTH := false $(call inherit-product, device/google/cuttlefish/shared/bluetooth/device_vendor.mk) $(call inherit-product, device/google/cuttlefish/shared/camera/device_vendor.mk) @@ -74,7 +75,6 @@ TARGET_PRODUCT_PROP := $(LOCAL_PATH)/../../shared/phone/product.prop ifneq ($(LOCAL_PREFER_VENDOR_APEX),true) PRODUCT_COPY_FILES += \ frameworks/native/data/etc/android.hardware.faketouch.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.faketouch.xml \ - frameworks/native/data/etc/android.hardware.fingerprint.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.fingerprint.xml \ endif diff --git a/vsoc_riscv64/slim/aosp_cf.mk b/vsoc_riscv64/slim/aosp_cf.mk index b8f32a691..bc8bd242e 100644 --- a/vsoc_riscv64/slim/aosp_cf.mk +++ b/vsoc_riscv64/slim/aosp_cf.mk @@ -67,6 +67,7 @@ PRODUCT_PACKAGES += slim_excluded_hardware.prebuilt.xml endif $(call inherit-product, device/google/cuttlefish/shared/biometrics_face/device_vendor.mk) +$(call inherit-product, device/google/cuttlefish/shared/biometrics_fingerprint/device_vendor.mk) BOARD_HAVE_BLUETOOTH := false $(call inherit-product, device/google/cuttlefish/shared/bluetooth/device_vendor.mk) $(call inherit-product, device/google/cuttlefish/shared/camera/device_vendor.mk) -- cgit v1.2.3 From 77db31e6b1f8699d7c2c2c847c68f9fe6b932975 Mon Sep 17 00:00:00 2001 From: Paul Daniel Faria Date: Wed, 12 Jul 2023 20:00:52 +0000 Subject: Mimicking wear wallpapers top app in cuttlefish Bug: 272527880 Test: adb shell dumpsys activity processes -> Wallpapers get top-app schedule group Change-Id: I46e7689bcf5f6112275aed7ce7c6c57aefd3c51d --- shared/wear/overlays/core/res/values/config.xml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/shared/wear/overlays/core/res/values/config.xml b/shared/wear/overlays/core/res/values/config.xml index 8d9c4fddf..2d7359a56 100644 --- a/shared/wear/overlays/core/res/values/config.xml +++ b/shared/wear/overlays/core/res/values/config.xml @@ -40,6 +40,8 @@ true true true + + true false -- cgit v1.2.3 From 7979291a3939a0348631c87aed15ad66b0b8597e Mon Sep 17 00:00:00 2001 From: Hakjun Choi Date: Wed, 21 Jun 2023 04:44:48 +0000 Subject: Add setSatellitePlmn() in cuttlefish To support the satellite technologies, which treat satellite cells as roaming networks BUG: 287538011 Test: atest VtsHalRadioTargetTest Change-Id: Ib64eeb975f7ea87c4c320018a19af3bc836d3e29 --- guest/hals/ril/reference-libril/RefRadioNetwork.cpp | 6 ++++++ guest/hals/ril/reference-libril/RefRadioNetwork.h | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/guest/hals/ril/reference-libril/RefRadioNetwork.cpp b/guest/hals/ril/reference-libril/RefRadioNetwork.cpp index 407efaa5e..9d8ebebf8 100644 --- a/guest/hals/ril/reference-libril/RefRadioNetwork.cpp +++ b/guest/hals/ril/reference-libril/RefRadioNetwork.cpp @@ -89,4 +89,10 @@ ScopedAStatus RefRadioNetwork::isNullCipherAndIntegrityEnabled(int32_t serial) { respond()->isNullCipherAndIntegrityEnabledResponse(responseInfo(serial), true); return ok(); } + +ScopedAStatus RefRadioNetwork::setSatellitePlmn(int32_t serial, + const std::vector& plmnList) { + respond()->setSatellitePlmnResponse(responseInfo(serial)); + return ok(); +} } // namespace cf::ril diff --git a/guest/hals/ril/reference-libril/RefRadioNetwork.h b/guest/hals/ril/reference-libril/RefRadioNetwork.h index c99bf1827..d8c8d1b3c 100644 --- a/guest/hals/ril/reference-libril/RefRadioNetwork.h +++ b/guest/hals/ril/reference-libril/RefRadioNetwork.h @@ -49,7 +49,11 @@ class RefRadioNetwork : public android::hardware::radio::compat::RadioNetwork { ::ndk::ScopedAStatus setN1ModeEnabled(int32_t serial, bool enable) override; ::ndk::ScopedAStatus setNullCipherAndIntegrityEnabled(int32_t serial, bool enabled) override; + ::ndk::ScopedAStatus isNullCipherAndIntegrityEnabled(int32_t serial) override; + + ::ndk::ScopedAStatus setSatellitePlmn(int32_t serial, + const std::vector& plmnList) override; }; } // namespace cf::ril -- cgit v1.2.3 From 409c9212bfc3bd1e7cd74076571941a0c9565674 Mon Sep 17 00:00:00 2001 From: Hung-ying Tyan Date: Fri, 14 Jul 2023 09:34:36 +0000 Subject: Add VNDK 33, 34/remove VNDK 29 to support mixed testing on vendor 33 and 34. Bug: 290257919 Bug: 291204040 Bug: 291535640 Bug: 279809679 Change-Id: I9a2a8e66a365bc1351a194c6b8f257266776832c Test: boot cf_arm64_only_phone system/system_ext/product on T/U Pixels --- shared/phone/device_vendor.mk | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/shared/phone/device_vendor.mk b/shared/phone/device_vendor.mk index 3860a987e..1a69b943d 100644 --- a/shared/phone/device_vendor.mk +++ b/shared/phone/device_vendor.mk @@ -43,7 +43,9 @@ $(call inherit-product, device/google/cuttlefish/shared/sensors/device_vendor.mk $(call inherit-product, device/google/cuttlefish/shared/virgl/device_vendor.mk) $(call inherit-product, device/google/cuttlefish/shared/device.mk) -PRODUCT_EXTRA_VNDK_VERSIONS := 29 30 31 +# Support mixing CF system onto previous versions of vendor +# Skipping SC-V2 (32) as VINTF does not change in that version +PRODUCT_EXTRA_VNDK_VERSIONS := 30 31 33 34 TARGET_PRODUCT_PROP := $(LOCAL_PATH)/product.prop -- cgit v1.2.3 From 572892ce7a42ab1e4ff6e73963177f60cb4ea48e Mon Sep 17 00:00:00 2001 From: Alfred Piccioni Date: Wed, 28 Jun 2023 18:11:01 +0200 Subject: Change Camera Apex for TV Config Bug: 244594222 Test: atest CtsCameraTestCases + dumpsys media.camera. Change-Id: I586a90ab0ba8ac67b8530a66a949d6d682f9c32e --- shared/camera/sepolicy/hal_camera_default.te | 4 ++++ shared/camera/sepolicy/property.te | 1 + shared/camera/sepolicy/property_contexts | 2 ++ shared/tv/device_vendor.mk | 4 ++++ 4 files changed, 11 insertions(+) diff --git a/shared/camera/sepolicy/hal_camera_default.te b/shared/camera/sepolicy/hal_camera_default.te index d1230177a..8783a4472 100644 --- a/shared/camera/sepolicy/hal_camera_default.te +++ b/shared/camera/sepolicy/hal_camera_default.te @@ -16,3 +16,7 @@ set_prop(hal_camera_default, vendor_camera_prop) # For observing apex file changes allow hal_camera_default apex_info_file:file r_file_perms; + +# Allow vendor files to define their own config. +set_prop(vendor_init, vendor_camera_config) +get_prop(domain, vendor_camera_config) diff --git a/shared/camera/sepolicy/property.te b/shared/camera/sepolicy/property.te index bb7a5b110..4bb4accf9 100644 --- a/shared/camera/sepolicy/property.te +++ b/shared/camera/sepolicy/property.te @@ -1 +1,2 @@ vendor_internal_prop(vendor_camera_prop) +vendor_restricted_prop(vendor_camera_config) diff --git a/shared/camera/sepolicy/property_contexts b/shared/camera/sepolicy/property_contexts index 3d6ebfb27..26abad973 100644 --- a/shared/camera/sepolicy/property_contexts +++ b/shared/camera/sepolicy/property_contexts @@ -1,2 +1,4 @@ persist.vendor.camera. u:object_r:vendor_camera_prop:s0 vendor.camera. u:object_r:vendor_camera_prop:s0 + +ro.vendor.camera.config u:object_r:vendor_camera_config:s0 exact string diff --git a/shared/tv/device_vendor.mk b/shared/tv/device_vendor.mk index 24efc3261..4cb7458f1 100644 --- a/shared/tv/device_vendor.mk +++ b/shared/tv/device_vendor.mk @@ -27,6 +27,10 @@ $(call inherit-product, device/google/cuttlefish/shared/camera/device_vendor.mk) $(call inherit-product, device/google/cuttlefish/shared/virgl/device_vendor.mk) $(call inherit-product, device/google/cuttlefish/shared/device.mk) +# Inform the camera HAL that we only want an external camera loaded. +PRODUCT_VENDOR_PROPERTIES += \ + ro.vendor.camera.config=external + # Extend cuttlefish common sepolicy with tv-specific functionality BOARD_SEPOLICY_DIRS += device/google/cuttlefish/shared/tv/sepolicy/vendor -- cgit v1.2.3 From 81d0d81f3bf3553361974a9b7d6cb9d9645f319e Mon Sep 17 00:00:00 2001 From: Alfred Piccioni Date: Mon, 17 Jul 2023 08:59:56 +0000 Subject: Set TV Camera Features to external only Fixes: 291056193 Test: Boot and check features. Change-Id: Ie33da2234cec1189822430d652f8a7c048671b3d --- shared/tv/device_vendor.mk | 1 + shared/tv/tv_excluded_hardware.xml | 3 +++ 2 files changed, 4 insertions(+) diff --git a/shared/tv/device_vendor.mk b/shared/tv/device_vendor.mk index 4cb7458f1..c6ca9a5d8 100644 --- a/shared/tv/device_vendor.mk +++ b/shared/tv/device_vendor.mk @@ -39,6 +39,7 @@ ifneq ($(LOCAL_PREFER_VENDOR_APEX),true) endif PRODUCT_COPY_FILES += \ + frameworks/native/data/etc/android.hardware.camera.external.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.camera.external.xml \ device/google/cuttlefish/shared/config/media_codecs_google_tv.xml:$(TARGET_COPY_OUT_VENDOR)/etc/media_codecs_google_tv.xml \ frameworks/native/data/etc/android.hardware.hdmi.cec.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.hdmi.cec.xml \ frameworks/native/data/etc/android.hardware.tv.tuner.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.tv.tuner.xml \ diff --git a/shared/tv/tv_excluded_hardware.xml b/shared/tv/tv_excluded_hardware.xml index b74dbf549..0f8f31b72 100644 --- a/shared/tv/tv_excluded_hardware.xml +++ b/shared/tv/tv_excluded_hardware.xml @@ -17,13 +17,16 @@ + + + -- cgit v1.2.3 From 990b89396a7fbb08f0785ff45aabd7467d9b58e1 Mon Sep 17 00:00:00 2001 From: Prashanth Swaminathan Date: Tue, 18 Jul 2023 09:27:25 -0700 Subject: Remove temporary build workarounds As ART and graphics libraries were being enabled, we temporarily expanded certain includes to selectively disable features. Now that all those features have been enabled, remove the workarounds and simply include the common include files. Bug: 271573990 Test: Verified boot of riscv64 cuttlefish phone target. Change-Id: Id5a48c5c611e30d93e84337f003684f3b7a54331 --- vsoc_riscv64/phone/aosp_cf.mk | 50 +-------------------------------------- vsoc_riscv64/slim/aosp_cf.mk | 55 +------------------------------------------ vsoc_riscv64/wear/aosp_cf.mk | 51 +-------------------------------------- 3 files changed, 3 insertions(+), 153 deletions(-) diff --git a/vsoc_riscv64/phone/aosp_cf.mk b/vsoc_riscv64/phone/aosp_cf.mk index 3617f39a0..c5a19a318 100644 --- a/vsoc_riscv64/phone/aosp_cf.mk +++ b/vsoc_riscv64/phone/aosp_cf.mk @@ -37,55 +37,7 @@ $(call inherit-product, $(SRC_TARGET_DIR)/product/aosp_product.mk) # All components inherited here go to vendor image # LOCAL_PREFER_VENDOR_APEX := true -#$(call inherit-product, device/google/cuttlefish/shared/phone/device_vendor.mk) - -# TODO: FIXME: Start workaround for phone/device_vendor.mk #################### -PRODUCT_MANIFEST_FILES += device/google/cuttlefish/shared/config/product_manifest.xml -SYSTEM_EXT_MANIFEST_FILES += device/google/cuttlefish/shared/config/system_ext_manifest.xml - -$(call inherit-product, $(SRC_TARGET_DIR)/product/handheld_vendor.mk) - -ifneq ($(LOCAL_PREFER_VENDOR_APEX),true) -PRODUCT_COPY_FILES += \ - frameworks/native/data/etc/android.software.sip.voip.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.software.sip.voip.xml \ - frameworks/native/data/etc/handheld_core_hardware.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/handheld_core_hardware.xml -endif - -$(call inherit-product, frameworks/native/build/phone-xhdpi-2048-dalvik-heap.mk) -$(call inherit-product, device/google/cuttlefish/shared/biometrics_face/device_vendor.mk) -$(call inherit-product, device/google/cuttlefish/shared/biometrics_fingerprint/device_vendor.mk) -BOARD_HAVE_BLUETOOTH := false -$(call inherit-product, device/google/cuttlefish/shared/bluetooth/device_vendor.mk) -$(call inherit-product, device/google/cuttlefish/shared/camera/device_vendor.mk) -$(call inherit-product, device/google/cuttlefish/shared/consumerir/device_vendor.mk) -$(call inherit-product, device/google/cuttlefish/shared/gnss/device_vendor.mk) -$(call inherit-product, device/google/cuttlefish/shared/graphics/device_vendor.mk) -$(call inherit-product, device/google/cuttlefish/shared/identity/device_vendor.mk) -$(call inherit-product, device/google/cuttlefish/shared/reboot_escrow/device_vendor.mk) -$(call inherit-product, device/google/cuttlefish/shared/secure_element/device_vendor.mk) -$(call inherit-product, device/google/cuttlefish/shared/sensors/device_vendor.mk) -$(call inherit-product, device/google/cuttlefish/shared/swiftshader/device_vendor.mk) -$(call inherit-product, device/google/cuttlefish/shared/telephony/device_vendor.mk) -$(call inherit-product, device/google/cuttlefish/shared/virgl/device_vendor.mk) -$(call inherit-product, device/google/cuttlefish/shared/device.mk) - -TARGET_PRODUCT_PROP := $(LOCAL_PATH)/../../shared/phone/product.prop - -ifneq ($(LOCAL_PREFER_VENDOR_APEX),true) -PRODUCT_COPY_FILES += \ - frameworks/native/data/etc/android.hardware.faketouch.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.faketouch.xml \ - -endif - -# Runtime Resource Overlays -ifeq ($(LOCAL_PREFER_VENDOR_APEX),true) -PRODUCT_PACKAGES += com.google.aosp_cf_phone.rros -else -PRODUCT_PACKAGES += cuttlefish_phone_overlay_frameworks_base_core -endif - -TARGET_BOARD_INFO_FILE ?= device/google/cuttlefish/shared/phone/android-info.txt -# TODO: FIXME: Stop workaround for phone/device_vendor.mk ##################### +$(call inherit-product, device/google/cuttlefish/shared/phone/device_vendor.mk) # TODO: Nested virtualization support # $(call inherit-product, packages/modules/Virtualization/apex/product_packages.mk) diff --git a/vsoc_riscv64/slim/aosp_cf.mk b/vsoc_riscv64/slim/aosp_cf.mk index 8b11d0391..ab79b4999 100644 --- a/vsoc_riscv64/slim/aosp_cf.mk +++ b/vsoc_riscv64/slim/aosp_cf.mk @@ -22,17 +22,6 @@ $(call inherit-product, $(SRC_TARGET_DIR)/product/generic_system.mk) PRODUCT_ENFORCE_ARTIFACT_PATH_REQUIREMENTS := relaxed -# TODO: FIXME: Start workaround for generic_system.mk ######################## - -# TODO(b/271573990): It is currently required that dexpreopt be enabled for -# userdebug builds, but dexpreopt is not yet supported for this architecture. -# In the interim, this flag allows us to indicate that we cannot run dex2oat -# to build the ART boot image. Once the requirement is relaxed or support -# is enabled for this architecture, this flag can be removed. -PRODUCT_USES_DEFAULT_ART_CONFIG := false - -# TODO: FIXME: Stop workaround for generic_system.mk ######################### - # # All components inherited here go to system_ext image # @@ -49,49 +38,7 @@ PRODUCT_PACKAGES += FakeSystemApp # All components inherited here go to vendor image # LOCAL_PREFER_VENDOR_APEX := true -#$(call inherit-product, device/google/cuttlefish/shared/slim/device_vendor.mk) - -# TODO: FIXME: Start workaround for slim/device_vendor.mk #################### -PRODUCT_MANIFEST_FILES += device/google/cuttlefish/shared/config/product_manifest.xml -SYSTEM_EXT_MANIFEST_FILES += device/google/cuttlefish/shared/config/system_ext_manifest.xml - -$(call inherit-product, $(SRC_TARGET_DIR)/product/handheld_vendor.mk) - -$(call inherit-product, frameworks/native/build/phone-xhdpi-2048-dalvik-heap.mk) - -ifneq ($(LOCAL_PREFER_VENDOR_APEX),true) -PRODUCT_COPY_FILES += \ - frameworks/native/data/etc/android.software.sip.voip.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.software.sip.voip.xml \ - frameworks/native/data/etc/handheld_core_hardware.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/handheld_core_hardware.xml -PRODUCT_PACKAGES += slim_excluded_hardware.prebuilt.xml -endif - -$(call inherit-product, device/google/cuttlefish/shared/biometrics_face/device_vendor.mk) -$(call inherit-product, device/google/cuttlefish/shared/biometrics_fingerprint/device_vendor.mk) -BOARD_HAVE_BLUETOOTH := false -$(call inherit-product, device/google/cuttlefish/shared/bluetooth/device_vendor.mk) -$(call inherit-product, device/google/cuttlefish/shared/camera/device_vendor.mk) -$(call inherit-product, device/google/cuttlefish/shared/consumerir/device_vendor.mk) -$(call inherit-product, device/google/cuttlefish/shared/gnss/device_vendor.mk) -$(call inherit-product, device/google/cuttlefish/shared/graphics/device_vendor.mk) -$(call inherit-product, device/google/cuttlefish/shared/identity/device_vendor.mk) -$(call inherit-product, device/google/cuttlefish/shared/reboot_escrow/device_vendor.mk) -$(call inherit-product, device/google/cuttlefish/shared/secure_element/device_vendor.mk) -$(call inherit-product, device/google/cuttlefish/shared/sensors/device_vendor.mk) -$(call inherit-product, device/google/cuttlefish/shared/swiftshader/device_vendor.mk) -$(call inherit-product, device/google/cuttlefish/shared/telephony/device_vendor.mk) -$(call inherit-product, device/google/cuttlefish/shared/virgl/device_vendor.mk) -$(call inherit-product, device/google/cuttlefish/shared/device.mk) - -PRODUCT_VENDOR_PROPERTIES += \ - debug.hwui.drawing_enabled=0 \ - -PRODUCT_PACKAGES += \ - com.google.aosp_cf_phone.rros \ - com.google.aosp_cf_slim.rros - -TARGET_BOARD_INFO_FILE ?= device/google/cuttlefish/shared/slim/android-info.txt -# TODO: FIXME: Stop workaround for slim/device_vendor.mk ##################### +$(call inherit-product, device/google/cuttlefish/shared/slim/device_vendor.mk) # TODO(b/205788876) remove this when openwrt has an image for riscv64 #PRODUCT_ENFORCE_MAC80211_HWSIM := false diff --git a/vsoc_riscv64/wear/aosp_cf.mk b/vsoc_riscv64/wear/aosp_cf.mk index 8be57599c..215ede6af 100644 --- a/vsoc_riscv64/wear/aosp_cf.mk +++ b/vsoc_riscv64/wear/aosp_cf.mk @@ -20,17 +20,6 @@ $(call inherit-product, $(SRC_TARGET_DIR)/product/core_64_bit_only.mk) $(call inherit-product, device/google/cuttlefish/shared/wear/aosp_system.mk) -# TODO: FIXME: Start workaround for aosp_system.mk ######################## - -# TODO(b/271573990): It is currently required that dexpreopt be enabled for -# userdebug builds, but dexpreopt is not yet supported for this architecture. -# In the interim, this flag allows us to indicate that we cannot run dex2oat -# to build the ART boot image. Once the requirement is relaxed or support -# is enabled for this architecture, this flag can be removed. -PRODUCT_USES_DEFAULT_ART_CONFIG := false - -# TODO: FIXME: Stop workaround for aosp_system.mk ######################### - # Cuttlefish uses A/B with system_b preopt, so we must install these PRODUCT_PACKAGES += \ cppreopts.sh \ @@ -62,45 +51,7 @@ $(call inherit-product, device/google/cuttlefish/shared/wear/aosp_product.mk) # All components inherited here go to vendor image # $(call inherit-product, device/google/cuttlefish/shared/wear/aosp_vendor.mk) -#$(call inherit-product, device/google/cuttlefish/shared/wear/device_vendor.mk) - -# TODO: FIXME: Start workaround for wear/device_vendor.mk #################### -PRODUCT_MANIFEST_FILES += device/google/cuttlefish/shared/config/product_manifest.xml -SYSTEM_EXT_MANIFEST_FILES += device/google/cuttlefish/shared/config/system_ext_manifest.xml - -$(call inherit-product, $(SRC_TARGET_DIR)/product/handheld_vendor.mk) - -PRODUCT_COPY_FILES += \ - frameworks/native/data/etc/android.software.backup.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.software.backup.xml \ - frameworks/native/data/etc/android.software.connectionservice.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.software.connectionservice.xml \ - frameworks/native/data/etc/android.software.device_admin.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.software.device_admin.xml \ - frameworks/native/data/etc/wearable_core_hardware.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/wearable_core_hardware.xml \ - -$(call inherit-product, device/google/cuttlefish/shared/graphics/device_vendor.mk) -$(call inherit-product, device/google/cuttlefish/shared/swiftshader/device_vendor.mk) -$(call inherit-product, device/google/cuttlefish/shared/telephony/device_vendor.mk) -$(call inherit-product, device/google/cuttlefish/shared/sensors/device_vendor.mk) -$(call inherit-product, device/google/cuttlefish/shared/virgl/device_vendor.mk) -$(call inherit-product, device/google/cuttlefish/shared/device.mk) - -PRODUCT_COPY_FILES += \ - frameworks/native/data/etc/android.hardware.audio.output.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.audio.output.xml \ - frameworks/native/data/etc/android.hardware.faketouch.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.faketouch.xml \ - frameworks/native/data/etc/android.hardware.location.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.location.xml \ - -# Runtime Resource Overlays -PRODUCT_PACKAGES += \ - cuttlefish_phone_overlay_frameworks_base_core \ - cuttlefish_wear_overlay_frameworks_base_core \ - cuttlefish_wear_overlay_settings_provider \ - -PRODUCT_PRODUCT_PROPERTIES += \ - config.disable_cameraservice=true - -PRODUCT_CHARACTERISTICS := nosdcard,watch - -TARGET_BOARD_INFO_FILE ?= device/google/cuttlefish/shared/wear/android-info.txt -# TODO: FIXME: Stop workaround for wear/device_vendor.mk ##################### +$(call inherit-product, device/google/cuttlefish/shared/wear/device_vendor.mk) # # Special settings for the target -- cgit v1.2.3 From f52fc40682ae0052f9fd8cea13723d0f828259ce Mon Sep 17 00:00:00 2001 From: Weilin Xu Date: Thu, 20 Jul 2023 20:27:12 +0000 Subject: Update zone config in cuttlefish audio configuration Updated documentation in car audio configuration of car cuttlefish with zone config. Bug: 289137791 Test: m -j Change-Id: Ib7aabc7cfade473c2d206d5140a2d680bbc40d75 --- shared/auto/car_audio_configuration.xml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/shared/auto/car_audio_configuration.xml b/shared/auto/car_audio_configuration.xml index 482726e7e..7b2cf687a 100644 --- a/shared/auto/car_audio_configuration.xml +++ b/shared/auto/car_audio_configuration.xml @@ -17,8 +17,9 @@ -- cgit v1.2.3 From ef95b1e0eba77daeeb48c182bd1a2a1cb95e6b89 Mon Sep 17 00:00:00 2001 From: Deyao Ren Date: Wed, 3 May 2023 21:39:37 +0000 Subject: cuttlefish uses new wpa_supplicant Bug: 274020242 Change-Id: I4b12d1567370f224d098531235ff0227345eaf4b --- apex/com.google.cf.wifi/Android.bp | 2 +- apex/com.google.cf.wifi/com.google.cf.wifi.rc | 2 +- apex/com.google.cf.wifi/file_contexts | 2 +- guest/hals/wpa_supplicant/Android.bp | 27 --------------------------- 4 files changed, 3 insertions(+), 30 deletions(-) delete mode 100644 guest/hals/wpa_supplicant/Android.bp diff --git a/apex/com.google.cf.wifi/Android.bp b/apex/com.google.cf.wifi/Android.bp index 6d63886de..cd6d7a64d 100644 --- a/apex/com.google.cf.wifi/Android.bp +++ b/apex/com.google.cf.wifi/Android.bp @@ -42,7 +42,7 @@ apex { soc_specific: true, binaries: [ "rename_netiface", - "wpa_supplicant_cf", + "//external/wpa_supplicant_8/wpa_supplicant/wpa_supplicant:wpa_supplicant", "setup_wifi", "//device/generic/goldfish:mac80211_create_radios", "hostapd_cf", diff --git a/apex/com.google.cf.wifi/com.google.cf.wifi.rc b/apex/com.google.cf.wifi/com.google.cf.wifi.rc index 1465d13f4..c0fff55a3 100644 --- a/apex/com.google.cf.wifi/com.google.cf.wifi.rc +++ b/apex/com.google.cf.wifi/com.google.cf.wifi.rc @@ -15,7 +15,7 @@ service init_wifi_sh /apex/com.android.wifi.hal/bin/init.wifi oneshot disabled # Started on post-fs-data -service wpa_supplicant /apex/com.android.wifi.hal/bin/hw/wpa_supplicant_cf \ +service wpa_supplicant /apex/com.android.wifi.hal/bin/hw/wpa_supplicant \ -O/data/vendor/wifi/wpa/sockets -puse_p2p_group_interface=1p2p_device=1 \ -m/apex/com.android.wifi.hal/etc/wifi/p2p_supplicant.conf \ -g@android:wpa_wlan0 -dd diff --git a/apex/com.google.cf.wifi/file_contexts b/apex/com.google.cf.wifi/file_contexts index 8c9bf899b..bb96251e2 100644 --- a/apex/com.google.cf.wifi/file_contexts +++ b/apex/com.google.cf.wifi/file_contexts @@ -2,7 +2,7 @@ /bin/rename_netiface u:object_r:rename_netiface_exec:s0 /bin/setup_wifi u:object_r:setup_wifi_exec:s0 /bin/init\.wifi u:object_r:init_wifi_sh_exec:s0 -/bin/hw/wpa_supplicant_cf u:object_r:hal_wifi_supplicant_default_exec:s0 +/bin/hw/wpa_supplicant u:object_r:hal_wifi_supplicant_default_exec:s0 /bin/hw/hostapd_cf u:object_r:hal_wifi_hostapd_default_exec:s0 /bin/mac80211_create_radios u:object_r:mac80211_create_radios_exec:s0 /etc/permissions(/.*)? u:object_r:vendor_configs_file:s0 diff --git a/guest/hals/wpa_supplicant/Android.bp b/guest/hals/wpa_supplicant/Android.bp deleted file mode 100644 index 888b6e049..000000000 --- a/guest/hals/wpa_supplicant/Android.bp +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (C) 2021 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 { - default_applicable_licenses: [ - "external_wpa_supplicant_8_license", - ], -} - -cc_binary { - name: "wpa_supplicant_cf", - defaults: ["wpa_supplicant_defaults"], - static_libs: [ - "lib_driver_cmd_simulated_cf_bp", - ], -} -- cgit v1.2.3 From 6ba4c41144edb0e8cb7fe61c1425cb663f496325 Mon Sep 17 00:00:00 2001 From: Yi-Yo Chiang Date: Thu, 27 Jul 2023 07:09:21 +0000 Subject: Add VNDK 32 To support mixed testing on sc-v2 / sc-qpr3 / API level 32 vendors. Bug: 291535640 Bug: 290257919 Change-Id: I9267167e033fa8c858494e5633af5164541c6b1b --- shared/phone/device_vendor.mk | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/shared/phone/device_vendor.mk b/shared/phone/device_vendor.mk index 8c79f2d4f..114ca8bb2 100644 --- a/shared/phone/device_vendor.mk +++ b/shared/phone/device_vendor.mk @@ -43,8 +43,7 @@ $(call inherit-product, device/google/cuttlefish/shared/virgl/device_vendor.mk) $(call inherit-product, device/google/cuttlefish/shared/device.mk) # Support mixing CF system onto previous versions of vendor -# Skipping SC-V2 (32) as VINTF does not change in that version -PRODUCT_EXTRA_VNDK_VERSIONS := 30 31 33 34 +PRODUCT_EXTRA_VNDK_VERSIONS := 30 31 32 33 34 TARGET_PRODUCT_PROP := $(LOCAL_PATH)/product.prop -- cgit v1.2.3 From 8ae02f495fbde4ce128b47f415d9ba4d2941dee1 Mon Sep 17 00:00:00 2001 From: Yeabkal Wubshit Date: Tue, 1 Aug 2023 08:02:28 +0000 Subject: Remove config_mashPressVibrateTimeOnPowerButton The config has been moved to Wear System UI. Bug: 293929749 Change-Id: I6522083420f3ccd8313df3cb1d951310d829eb27 Test: N/A --- shared/wear/overlays/core/res/values/config.xml | 2 -- 1 file changed, 2 deletions(-) diff --git a/shared/wear/overlays/core/res/values/config.xml b/shared/wear/overlays/core/res/values/config.xml index 2d7359a56..8e5b62e8a 100644 --- a/shared/wear/overlays/core/res/values/config.xml +++ b/shared/wear/overlays/core/res/values/config.xml @@ -93,8 +93,6 @@ 1 3 3000 - 1 - 500 0 1 true -- cgit v1.2.3 From 5dd4693ead41fea4d98c78728196035487e4ceca Mon Sep 17 00:00:00 2001 From: Hakjun Choi Date: Tue, 8 Aug 2023 02:50:28 +0000 Subject: Revert "Add setSatellitePlmn() in cuttlefish" Revert submission 23748984-SATELLITE_ROAMING_PLMN Reason for revert: satellite roaming plmn will be moved from radio network HAL to satellite modem interface, to reduce change revert first Reverted changes: /q/submissionid:23748984-SATELLITE_ROAMING_PLMN Change-Id: If694dc614428680f2c4cd408ed89f700a46957c1 --- guest/hals/ril/reference-libril/RefRadioNetwork.cpp | 6 ------ guest/hals/ril/reference-libril/RefRadioNetwork.h | 3 --- 2 files changed, 9 deletions(-) diff --git a/guest/hals/ril/reference-libril/RefRadioNetwork.cpp b/guest/hals/ril/reference-libril/RefRadioNetwork.cpp index 9d8ebebf8..407efaa5e 100644 --- a/guest/hals/ril/reference-libril/RefRadioNetwork.cpp +++ b/guest/hals/ril/reference-libril/RefRadioNetwork.cpp @@ -89,10 +89,4 @@ ScopedAStatus RefRadioNetwork::isNullCipherAndIntegrityEnabled(int32_t serial) { respond()->isNullCipherAndIntegrityEnabledResponse(responseInfo(serial), true); return ok(); } - -ScopedAStatus RefRadioNetwork::setSatellitePlmn(int32_t serial, - const std::vector& plmnList) { - respond()->setSatellitePlmnResponse(responseInfo(serial)); - return ok(); -} } // namespace cf::ril diff --git a/guest/hals/ril/reference-libril/RefRadioNetwork.h b/guest/hals/ril/reference-libril/RefRadioNetwork.h index d8c8d1b3c..3b6ad5ea9 100644 --- a/guest/hals/ril/reference-libril/RefRadioNetwork.h +++ b/guest/hals/ril/reference-libril/RefRadioNetwork.h @@ -51,9 +51,6 @@ class RefRadioNetwork : public android::hardware::radio::compat::RadioNetwork { ::ndk::ScopedAStatus setNullCipherAndIntegrityEnabled(int32_t serial, bool enabled) override; ::ndk::ScopedAStatus isNullCipherAndIntegrityEnabled(int32_t serial) override; - - ::ndk::ScopedAStatus setSatellitePlmn(int32_t serial, - const std::vector& plmnList) override; }; } // namespace cf::ril -- cgit v1.2.3 From 3de1e141ac5486164bcc7f364bc9cae3eca758e2 Mon Sep 17 00:00:00 2001 From: Devin Moore Date: Fri, 11 Aug 2023 00:07:36 +0000 Subject: Reference rild be tolerant of registration denial In the `next` release config, new unfrozen interfaces are not allowed to be used so service manager denies the registration. Don't abort in this case. Log a warning and exit nicely. Test: lunch cf_x86_64_phone-next-userdebug Test: m && launch_cvd # check logs Bug: 292151564 Change-Id: Idb1c2db8e95d5fd0f59f74c7359c931f9dfa846a --- guest/hals/ril/reference-libril/ril_service.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/guest/hals/ril/reference-libril/ril_service.cpp b/guest/hals/ril/reference-libril/ril_service.cpp index 396ca3eb9..deef66877 100644 --- a/guest/hals/ril/reference-libril/ril_service.cpp +++ b/guest/hals/ril/reference-libril/ril_service.cpp @@ -13383,6 +13383,13 @@ static void publishRadioHal(std::shared_ptr ctx, sp(ctx, hidlHal, cm); gPublishedHals.push_back(aidlHal); const auto status = AServiceManager_addService(aidlHal->asBinder().get(), instance.c_str()); -- cgit v1.2.3 From 4432e2d5f928a04068efd59f0019c30e6d6d0e08 Mon Sep 17 00:00:00 2001 From: Devin Moore Date: Thu, 17 Aug 2023 18:28:37 +0000 Subject: Do not install the new threadnetwork service on 'next' This is a new unfrozen interface, so it can't be served in 'next'. Test: m Bug: 292151564 Change-Id: I6ff9b9c7aacf4a889d171a018b3431570ad2d35f --- shared/device.mk | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/shared/device.mk b/shared/device.mk index d80d22f62..b40ffb644 100644 --- a/shared/device.mk +++ b/shared/device.mk @@ -606,9 +606,13 @@ PRODUCT_PACKAGES += \ PRODUCT_COPY_FILES += \ device/google/cuttlefish/shared/config/pci.ids:$(TARGET_COPY_OUT_VENDOR)/pci.ids +# New in-development HAL services using unfrozen interfaces. Do not include if +# RELEASE_AIDL_USE_UNFROZEN is true (in the 'next' release configuration). +ifeq ($(RELEASE_AIDL_USE_UNFROZEN),true) # Thread Network AIDL HAL and simulation CLI PRODUCT_PACKAGES += \ android.hardware.threadnetwork-service.sim \ ot-cli-ftd PRODUCT_COPY_FILES += \ frameworks/native/data/etc/android.hardware.thread_network.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.thread_network.xml +endif # RELEASE_AIDL_USE_UNFROZEN -- cgit v1.2.3 From d07ff40d9c9e9af46825dcd5c88b6f0747049469 Mon Sep 17 00:00:00 2001 From: Gabriel Biren Date: Mon, 21 Aug 2023 19:37:10 +0000 Subject: Add android.hardware.wifi.common to the kAlwaysMissingAidl list. This is a types-only package. Bug: 296069900 Test: Treehugger tests Change-Id: Ibc1f5b6793883fe76ff2548c650b83a35d385f2a --- tests/hal/hal_implementation_test.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/hal/hal_implementation_test.cpp b/tests/hal/hal_implementation_test.cpp index b0de53615..88f732e50 100644 --- a/tests/hal/hal_implementation_test.cpp +++ b/tests/hal/hal_implementation_test.cpp @@ -219,6 +219,7 @@ static const std::set kAlwaysMissingAidl = { "android.media.audio.common.types", "android.hardware.radio", "android.hardware.uwb.fira_android", + "android.hardware.wifi.common", "android.hardware.keymaster", "android.hardware.automotive.vehicle.property", // not on Cuttlefish since it's needed only on systems using HIDL audio HAL -- cgit v1.2.3 From 5c45fce00c34f0a4b0bc6b985d10d4b0251e06a9 Mon Sep 17 00:00:00 2001 From: Yu Shan Date: Wed, 23 Aug 2023 16:01:07 -0700 Subject: Move IVN hal to auto only AIDL HAL list. Test: atest hal_implementation_test Bug: 283233896 Change-Id: Ib642af877168627a06d7e6c0addb597de4a0b95c --- tests/hal/hal_implementation_test.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/hal/hal_implementation_test.cpp b/tests/hal/hal_implementation_test.cpp index b0de53615..c6c0b1baf 100644 --- a/tests/hal/hal_implementation_test.cpp +++ b/tests/hal/hal_implementation_test.cpp @@ -173,6 +173,7 @@ static const std::set kAutomotiveOnlyAidl = { "android.hardware.automotive.occupant_awareness", "android.hardware.automotive.remoteaccess", "android.hardware.automotive.vehicle", + "android.hardware.automotive.ivn", }; static const std::set kTvOnlyAidl = { @@ -263,7 +264,6 @@ static const std::vector kKnownMissingAidl = { {"android.automotive.computepipe.runner.", 2, 273549907}, {"android.frameworks.automotive.powerpolicy.", 2, 274160980}, {"android.hardware.automotive.evs.", 2, 274162534}, - {"android.hardware.automotive.ivn.", 1, 274139217}, }; // AOSP packages which are never considered -- cgit v1.2.3 From 5c5302a0df134959045fc20591fae79c0e417c7b Mon Sep 17 00:00:00 2001 From: Aishwarya Mallamapti Date: Fri, 25 Aug 2023 00:50:40 +0000 Subject: Change SatelliteError to SatelliteResult enum The following changes are made in this cl: - SatelliteError is changed to SatelliteResult - SATELLITE_ERROR_NONE is changed to SATELLITE_RESULT_SUCCESS - SATELLITE_RESULT prefix is added to all the values in the enum Bug: 296925011 Test: Flashed device on raven-userdebug and performed basic functionality tests - atest android.telephony.satellite.cts - atest com.android.internal.telephony.satellite - atest com.google.android.telephony.satellite Change-Id: I66a6d522bcc426a628749c1040237d255aca2d53 --- .../telephony/satellite/CFSatelliteService.java | 29 ++++++++++++---------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/guest/services/cf_satellite_service/src/com/google/android/telephony/satellite/CFSatelliteService.java b/guest/services/cf_satellite_service/src/com/google/android/telephony/satellite/CFSatelliteService.java index a514e33e5..77ea7d41e 100644 --- a/guest/services/cf_satellite_service/src/com/google/android/telephony/satellite/CFSatelliteService.java +++ b/guest/services/cf_satellite_service/src/com/google/android/telephony/satellite/CFSatelliteService.java @@ -27,7 +27,7 @@ import android.telephony.satellite.stub.NTRadioTechnology; import android.telephony.satellite.stub.PointingInfo; import android.telephony.satellite.stub.SatelliteCapabilities; import android.telephony.satellite.stub.SatelliteDatagram; -import android.telephony.satellite.stub.SatelliteError; +import android.telephony.satellite.stub.SatelliteResult; import android.telephony.satellite.stub.SatelliteImplBase; import android.telephony.satellite.stub.SatelliteModemState; import android.telephony.satellite.stub.SatelliteService; @@ -125,7 +125,7 @@ public class CFSatelliteService extends SatelliteImplBase { } else { updateSatelliteModemState(SatelliteModemState.SATELLITE_MODEM_STATE_IDLE); } - runWithExecutor(() -> errorCallback.accept(SatelliteError.ERROR_NONE)); + runWithExecutor(() -> errorCallback.accept(SatelliteResult.SATELLITE_RESULT_SUCCESS)); } @Override @@ -142,13 +142,13 @@ public class CFSatelliteService extends SatelliteImplBase { private void enableSatellite(@NonNull IIntegerConsumer errorCallback) { mIsEnabled = true; updateSatelliteModemState(SatelliteModemState.SATELLITE_MODEM_STATE_IDLE); - runWithExecutor(() -> errorCallback.accept(SatelliteError.ERROR_NONE)); + runWithExecutor(() -> errorCallback.accept(SatelliteResult.SATELLITE_RESULT_SUCCESS)); } private void disableSatellite(@NonNull IIntegerConsumer errorCallback) { mIsEnabled = false; updateSatelliteModemState(SatelliteModemState.SATELLITE_MODEM_STATE_OFF); - runWithExecutor(() -> errorCallback.accept(SatelliteError.ERROR_NONE)); + runWithExecutor(() -> errorCallback.accept(SatelliteResult.SATELLITE_RESULT_SUCCESS)); } @Override @@ -182,20 +182,20 @@ public class CFSatelliteService extends SatelliteImplBase { if (!verifySatelliteModemState(errorCallback)) { return; } - runWithExecutor(() -> errorCallback.accept(SatelliteError.ERROR_NONE)); + runWithExecutor(() -> errorCallback.accept(SatelliteResult.SATELLITE_RESULT_SUCCESS)); } @Override public void stopSendingSatellitePointingInfo(@NonNull IIntegerConsumer errorCallback) { logd("stopSendingSatellitePointingInfo"); - runWithExecutor(() -> errorCallback.accept(SatelliteError.ERROR_NONE)); + runWithExecutor(() -> errorCallback.accept(SatelliteResult.SATELLITE_RESULT_SUCCESS)); } @Override public void provisionSatelliteService(@NonNull String token, @NonNull byte[] provisionData, @NonNull IIntegerConsumer errorCallback) { logd("provisionSatelliteService"); - runWithExecutor(() -> errorCallback.accept(SatelliteError.ERROR_NONE)); + runWithExecutor(() -> errorCallback.accept(SatelliteResult.SATELLITE_RESULT_SUCCESS)); updateSatelliteProvisionState(true); } @@ -203,7 +203,7 @@ public class CFSatelliteService extends SatelliteImplBase { public void deprovisionSatelliteService(@NonNull String token, @NonNull IIntegerConsumer errorCallback) { logd("deprovisionSatelliteService"); - runWithExecutor(() -> errorCallback.accept(SatelliteError.ERROR_NONE)); + runWithExecutor(() -> errorCallback.accept(SatelliteResult.SATELLITE_RESULT_SUCCESS)); updateSatelliteProvisionState(false); } @@ -217,14 +217,14 @@ public class CFSatelliteService extends SatelliteImplBase { @Override public void pollPendingSatelliteDatagrams(@NonNull IIntegerConsumer errorCallback) { logd("pollPendingSatelliteDatagrams"); - runWithExecutor(() -> errorCallback.accept(SatelliteError.ERROR_NONE)); + runWithExecutor(() -> errorCallback.accept(SatelliteResult.SATELLITE_RESULT_SUCCESS)); } @Override public void sendSatelliteDatagram(@NonNull SatelliteDatagram datagram, boolean isEmergency, @NonNull IIntegerConsumer errorCallback) { logd("sendSatelliteDatagram"); - runWithExecutor(() -> errorCallback.accept(SatelliteError.ERROR_NONE)); + runWithExecutor(() -> errorCallback.accept(SatelliteResult.SATELLITE_RESULT_SUCCESS)); } @Override @@ -261,15 +261,18 @@ public class CFSatelliteService extends SatelliteImplBase { */ private boolean verifySatelliteModemState(@NonNull IIntegerConsumer errorCallback) { if (!mIsSupported) { - runWithExecutor(() -> errorCallback.accept(SatelliteError.REQUEST_NOT_SUPPORTED)); + runWithExecutor(() -> errorCallback.accept( + SatelliteResult.SATELLITE_RESULT_REQUEST_NOT_SUPPORTED)); return false; } if (!mIsProvisioned) { - runWithExecutor(() -> errorCallback.accept(SatelliteError.SERVICE_NOT_PROVISIONED)); + runWithExecutor(() -> errorCallback.accept( + SatelliteResult.SATELLITE_RESULT_SERVICE_NOT_PROVISIONED)); return false; } if (!mIsEnabled) { - runWithExecutor(() -> errorCallback.accept(SatelliteError.INVALID_MODEM_STATE)); + runWithExecutor(() -> errorCallback.accept( + SatelliteResult.SATELLITE_RESULT_INVALID_MODEM_STATE)); return false; } return true; -- cgit v1.2.3 From dce639be45cce42c6c945ab442e33a1f9e379e30 Mon Sep 17 00:00:00 2001 From: Alfred Piccioni Date: Mon, 28 Aug 2023 14:19:08 +0000 Subject: Change TV camera config from front to external This change was already made in the APEX configs, but I missed it here. Should keep these two synced for APEX and non-APEX validity. Bug: 24309276 Change-Id: Ia63da5f4fd3ece85c6816ce6aa24607ed99fc00b Test: Boot and check file. --- shared/camera/device_vendor.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shared/camera/device_vendor.mk b/shared/camera/device_vendor.mk index 600c705be..f116fa146 100644 --- a/shared/camera/device_vendor.mk +++ b/shared/camera/device_vendor.mk @@ -53,7 +53,7 @@ PRODUCT_COPY_FILES += \ ifeq ($(PRODUCT_IS_ATV_CF),true) PRODUCT_COPY_FILES += \ - hardware/google/camera/devices/EmulatedCamera/hwl/configs/emu_camera_front.json:$(TARGET_COPY_OUT_VENDOR)/etc/config/emu_camera_front.json + hardware/google/camera/devices/EmulatedCamera/hwl/configs/emu_camera_external.json:$(TARGET_COPY_OUT_VENDOR)/etc/config/emu_camera_external.json else PRODUCT_COPY_FILES += \ hardware/google/camera/devices/EmulatedCamera/hwl/configs/emu_camera_back.json:$(TARGET_COPY_OUT_VENDOR)/etc/config/emu_camera_back.json \ -- cgit v1.2.3 From 3a6697e6edf2d8f68c352ef4c2a0e52d0be03dc7 Mon Sep 17 00:00:00 2001 From: dshivangi Date: Thu, 17 Aug 2023 13:10:54 +0000 Subject: Refine fold setting MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Current fold setting has a toggle button which can enable the “Stay unlocked on fold” setting. Create a new page for fold setting which will allow us to choose something from three options.(https://screenshot.googleplex.com/6W65aTYtigGpr3v) *Always - Front display turns on when you fold your device [Currently available setting] *Only games, videos, and more - Front display turns on for apps that stop your screen going idle [Default] *Never - Front display locks when you fold your device [New option for user] Test: atest FoldLockBehaviorSettingsTest FoldLockBehaviorPreferenceControllerTest *Manual Flash the build with these changes Manually select options one by one Observe the behavior Fixes: 294194379 Change-Id: I97f28c6fe286c978e8a8cc7da100eceec276b37c --- shared/overlays/foldable/core/res/values/config.xml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/shared/overlays/foldable/core/res/values/config.xml b/shared/overlays/foldable/core/res/values/config.xml index b101b36b5..0ac21a53e 100644 --- a/shared/overlays/foldable/core/res/values/config.xml +++ b/shared/overlays/foldable/core/res/values/config.xml @@ -75,6 +75,8 @@ true 34px + + true -- cgit v1.2.3 From f3c082fc0c444c5b38593bce10237cc58165854c Mon Sep 17 00:00:00 2001 From: Prashanth Swaminathan Date: Wed, 6 Sep 2023 16:54:46 -0700 Subject: Remove TARGET_VNDK_USE_CORE_VARIANT from CF Wear This feature is being deprecated, along with the VNDK. This isn't used for the product Wear targets, nor is it being used for CF phone targets. Deprecating this for CF builds, as it's no longer required. Bug: 299331764 Test: Confirmed cf_gwear_x86 and cf_riscv64_wear build and boot. Change-Id: I7ea2c48720c73c51b743347bf83bd5326b10fa1f --- shared/wear/aosp_vendor.mk | 2 -- 1 file changed, 2 deletions(-) diff --git a/shared/wear/aosp_vendor.mk b/shared/wear/aosp_vendor.mk index ef4cd2e07..9ce5d967b 100644 --- a/shared/wear/aosp_vendor.mk +++ b/shared/wear/aosp_vendor.mk @@ -39,5 +39,3 @@ ifneq (,$(filter eng, $(TARGET_BUILD_VARIANT))) endif TARGET_SYSTEM_PROP += device/google/cuttlefish/shared/wear/wearable-1024.prop - -TARGET_VNDK_USE_CORE_VARIANT := true -- cgit v1.2.3 From d8791b955f732ae5be8954d3d052fcc8fb372d2f Mon Sep 17 00:00:00 2001 From: Jeff Pu Date: Fri, 8 Sep 2023 15:03:31 +0000 Subject: Face Biometrics Virtual HAL Bug: 294254230 Test: Manual Change-Id: I4f40a431f128014e0f4c0afcedcc07594d740005 --- shared/biometrics_face/device_vendor.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shared/biometrics_face/device_vendor.mk b/shared/biometrics_face/device_vendor.mk index 1df7068d4..d2649bc1d 100644 --- a/shared/biometrics_face/device_vendor.mk +++ b/shared/biometrics_face/device_vendor.mk @@ -20,4 +20,4 @@ PRODUCT_COPY_FILES += \ endif PRODUCT_PACKAGES += \ - com.android.hardware.biometrics.face + com.android.hardware.biometrics.face.virtual -- cgit v1.2.3 From 8b14ba8e92fd16c39a8ec74680d885a394bc6246 Mon Sep 17 00:00:00 2001 From: Devin Moore Date: Fri, 8 Sep 2023 21:34:39 +0000 Subject: Remove HIDL graphics.mapper service from Cuttlefish The native HAL replacement is already installed. Test: launch_cvd # look for crashes, exceptions, and mapper logs Test: atest hal_implementation_test vts_treble_vintf_vendor_test Bug: 285605852 Change-Id: I2564031771fe11275bb0f3f517b780c11252b2a5 --- shared/graphics/device_vendor.mk | 1 - tests/hal/hal_implementation_test.cpp | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/shared/graphics/device_vendor.mk b/shared/graphics/device_vendor.mk index b5f410281..a4768b01f 100644 --- a/shared/graphics/device_vendor.mk +++ b/shared/graphics/device_vendor.mk @@ -82,5 +82,4 @@ PRODUCT_VENDOR_PROPERTIES += \ # Gralloc implementation PRODUCT_PACKAGES += \ android.hardware.graphics.allocator-service.minigbm \ - android.hardware.graphics.mapper@4.0-impl.minigbm \ mapper.minigbm diff --git a/tests/hal/hal_implementation_test.cpp b/tests/hal/hal_implementation_test.cpp index c6c0b1baf..e34ffc142 100644 --- a/tests/hal/hal_implementation_test.cpp +++ b/tests/hal/hal_implementation_test.cpp @@ -98,6 +98,7 @@ static const std::set kKnownMissingHidl = { "android.hardware.graphics.composer@2.4", // converted to AIDL, see b/193240715 "android.hardware.graphics.mapper@2.1", "android.hardware.graphics.mapper@3.0", + "android.hardware.graphics.mapper@4.0", // converted to Stable C, see b/205761028 "android.hardware.health.storage@1.0", // converted to AIDL, see b/177470478 "android.hardware.health@2.1", // converted to AIDL, see b/177269435 "android.hardware.input.classifier@1.0", // converted to AIDL, see b/205761620 -- cgit v1.2.3 From 5777e89396969b33b0cdf34e6f2e960806d58933 Mon Sep 17 00:00:00 2001 From: Devin Moore Date: Tue, 12 Sep 2023 20:55:18 +0000 Subject: Revert "Remove HIDL graphics.mapper service from Cuttlefish" Revert submission 24707439-mapper5_cf Reason for revert: Camera CTS tests fail b/300115646 Reverted changes: /q/submissionid:24707439-mapper5_cf Change-Id: I09a4a774761d0c33061d7930e695e2ddd98faa28 --- shared/graphics/device_vendor.mk | 1 + tests/hal/hal_implementation_test.cpp | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/shared/graphics/device_vendor.mk b/shared/graphics/device_vendor.mk index a4768b01f..b5f410281 100644 --- a/shared/graphics/device_vendor.mk +++ b/shared/graphics/device_vendor.mk @@ -82,4 +82,5 @@ PRODUCT_VENDOR_PROPERTIES += \ # Gralloc implementation PRODUCT_PACKAGES += \ android.hardware.graphics.allocator-service.minigbm \ + android.hardware.graphics.mapper@4.0-impl.minigbm \ mapper.minigbm diff --git a/tests/hal/hal_implementation_test.cpp b/tests/hal/hal_implementation_test.cpp index e34ffc142..c6c0b1baf 100644 --- a/tests/hal/hal_implementation_test.cpp +++ b/tests/hal/hal_implementation_test.cpp @@ -98,7 +98,6 @@ static const std::set kKnownMissingHidl = { "android.hardware.graphics.composer@2.4", // converted to AIDL, see b/193240715 "android.hardware.graphics.mapper@2.1", "android.hardware.graphics.mapper@3.0", - "android.hardware.graphics.mapper@4.0", // converted to Stable C, see b/205761028 "android.hardware.health.storage@1.0", // converted to AIDL, see b/177470478 "android.hardware.health@2.1", // converted to AIDL, see b/177269435 "android.hardware.input.classifier@1.0", // converted to AIDL, see b/205761620 -- cgit v1.2.3 From 7b3aac6f49710544143dd1a569e83473b680cb40 Mon Sep 17 00:00:00 2001 From: Yu Shan Date: Fri, 15 Sep 2023 17:48:32 -0700 Subject: Update emulator VHAL name to V3. Test: Presubmit Bug: 300694866 Change-Id: I2d21b7120e7f653fcce36506fd9ad0a1a4a27f0b --- shared/auto/device_vendor.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shared/auto/device_vendor.mk b/shared/auto/device_vendor.mk index 1c134e897..100bac519 100644 --- a/shared/auto/device_vendor.mk +++ b/shared/auto/device_vendor.mk @@ -70,7 +70,7 @@ PRODUCT_COPY_FILES += \ # vehicle HAL ifeq ($(LOCAL_VHAL_PRODUCT_PACKAGE),) - LOCAL_VHAL_PRODUCT_PACKAGE := android.hardware.automotive.vehicle@V1-emulator-service + LOCAL_VHAL_PRODUCT_PACKAGE := android.hardware.automotive.vehicle@V3-emulator-service BOARD_SEPOLICY_DIRS += device/google/cuttlefish/shared/auto/sepolicy/vhal endif PRODUCT_PACKAGES += $(LOCAL_VHAL_PRODUCT_PACKAGE) -- cgit v1.2.3 From 5be0e184b94e6db35d294e60c09b9fe2b9cde3ae Mon Sep 17 00:00:00 2001 From: Deyao Ren Date: Thu, 20 Jul 2023 23:33:32 +0000 Subject: Remove LOCAL_PREFER_VENDOR_APEX variable from .mk files for cuttlefish Bug: 259196894 Test: launch cuttlefish, CtsWifiTestCases Change-Id: I26be5a9d57d46d8a4bd8aa86f7497720492b82e1 (cherry picked from commit c73c14ced847fca59adcb918bc1d9f130340e86e) --- .../Android.bp | 44 ------------ .../Android.bp | 45 ------------ .../Android.bp | 57 +++++++++++++++ shared/biometrics_face/device_vendor.mk | 5 -- shared/biometrics_fingerprint/device_vendor.mk | 5 -- shared/bluetooth/device_vendor.mk | 17 ----- shared/device.mk | 81 +--------------------- shared/gnss/device_vendor.mk | 5 -- shared/graphics/device_vendor.mk | 10 --- shared/phone/device_vendor.mk | 23 +----- shared/reboot_escrow/device_vendor.mk | 5 -- shared/sensors/device_vendor.mk | 18 ----- shared/slim/device_vendor.mk | 20 +----- shared/telephony/device_vendor.mk | 15 ---- shared/tv/device_vendor.mk | 4 -- vsoc_arm64_only/slim/aosp_cf.mk | 9 --- vsoc_riscv64/phone/aosp_cf.mk | 9 --- vsoc_riscv64/slim/aosp_cf.mk | 1 - vsoc_x86_64/phone/aosp_cf.mk | 9 --- vsoc_x86_64_only/slim/aosp_cf.mk | 9 --- 20 files changed, 64 insertions(+), 327 deletions(-) delete mode 100644 apex/com.google.aosp_cf_phone.hardware.core_permissions/Android.bp delete mode 100644 apex/com.google.aosp_cf_slim.hardware.core_permissions/Android.bp create mode 100644 apex/com.google.cf.hardware.core_permission/Android.bp diff --git a/apex/com.google.aosp_cf_phone.hardware.core_permissions/Android.bp b/apex/com.google.aosp_cf_phone.hardware.core_permissions/Android.bp deleted file mode 100644 index 2900f3296..000000000 --- a/apex/com.google.aosp_cf_phone.hardware.core_permissions/Android.bp +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright (C) 2021 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 { - default_applicable_licenses: ["Android-Apache-2.0"], -} - -override_apex { - name: "com.google.aosp_cf_phone.hardware.core_permissions", - base: "com.android.hardware.core_permissions", - prebuilts: [ - "android.hardware.audio.low_latency.prebuilt.xml", - "android.hardware.biometrics.face.prebuilt.xml", - "android.hardware.ethernet.prebuilt.xml", - "android.hardware.faketouch.prebuilt.xml", - "android.hardware.fingerprint.prebuilt.xml", - "android.hardware.location.gps.prebuilt.xml", - "android.hardware.reboot_escrow.prebuilt.xml", - "android.hardware.usb.accessory.prebuilt.xml", - "android.hardware.usb.host.prebuilt.xml", - "android.hardware.vulkan.level-0.prebuilt.xml", - "android.hardware.vulkan.version-1_0_3.prebuilt.xml", - "android.software.device_id_attestation.prebuilt.xml", - "android.software.ipsec_tunnels.prebuilt.xml", - "android.software.opengles.deqp.level-2022-03-01.prebuilt.xml", - "android.software.sip.voip.prebuilt.xml", - "android.software.verified_boot.prebuilt.xml", - "android.software.vulkan.deqp.level-2022-03-01.prebuilt.xml", - "aosp_excluded_hardware.prebuilt.xml", - "cuttlefish_excluded_hardware.prebuilt.xml", - "handheld_core_hardware.prebuilt.xml", - ], -} diff --git a/apex/com.google.aosp_cf_slim.hardware.core_permissions/Android.bp b/apex/com.google.aosp_cf_slim.hardware.core_permissions/Android.bp deleted file mode 100644 index 959c95076..000000000 --- a/apex/com.google.aosp_cf_slim.hardware.core_permissions/Android.bp +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright (C) 2022 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 { - default_applicable_licenses: ["Android-Apache-2.0"], -} - -override_apex { - name: "com.google.aosp_cf_slim.hardware.core_permissions", - base: "com.android.hardware.core_permissions", - prebuilts: [ - "android.hardware.audio.low_latency.prebuilt.xml", - "android.hardware.biometrics.face.prebuilt.xml", - "android.hardware.ethernet.prebuilt.xml", - "android.hardware.faketouch.prebuilt.xml", - "android.hardware.fingerprint.prebuilt.xml", - "android.hardware.location.gps.prebuilt.xml", - "android.hardware.reboot_escrow.prebuilt.xml", - "android.hardware.usb.accessory.prebuilt.xml", - "android.hardware.usb.host.prebuilt.xml", - "android.hardware.vulkan.level-0.prebuilt.xml", - "android.hardware.vulkan.version-1_0_3.prebuilt.xml", - "android.software.device_id_attestation.prebuilt.xml", - "android.software.ipsec_tunnels.prebuilt.xml", - "android.software.opengles.deqp.level-2022-03-01.prebuilt.xml", - "android.software.sip.voip.prebuilt.xml", - "android.software.verified_boot.prebuilt.xml", - "android.software.vulkan.deqp.level-2022-03-01.prebuilt.xml", - "aosp_excluded_hardware.prebuilt.xml", - "cuttlefish_excluded_hardware.prebuilt.xml", - "handheld_core_hardware.prebuilt.xml", - "slim_excluded_hardware.prebuilt.xml", - ], -} diff --git a/apex/com.google.cf.hardware.core_permission/Android.bp b/apex/com.google.cf.hardware.core_permission/Android.bp new file mode 100644 index 000000000..1f4c9cce0 --- /dev/null +++ b/apex/com.google.cf.hardware.core_permission/Android.bp @@ -0,0 +1,57 @@ +// Copyright (C) 2023 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 { + default_applicable_licenses: ["Android-Apache-2.0"], +} +permission_prebuilts = [ + "android.hardware.audio.low_latency.prebuilt.xml", + "android.hardware.ethernet.prebuilt.xml", + "android.hardware.location.gps.prebuilt.xml", + "android.hardware.reboot_escrow.prebuilt.xml", + "android.hardware.usb.accessory.prebuilt.xml", + "android.hardware.usb.host.prebuilt.xml", + "android.hardware.vulkan.level-0.prebuilt.xml", + "android.hardware.vulkan.version-1_0_3.prebuilt.xml", + "android.software.device_id_attestation.prebuilt.xml", + "android.software.ipsec_tunnels.prebuilt.xml", + "android.software.opengles.deqp.level-2022-03-01.prebuilt.xml", + "android.software.sip.voip.prebuilt.xml", + "android.software.verified_boot.prebuilt.xml", + "android.software.vulkan.deqp.level-2022-03-01.prebuilt.xml", + "cuttlefish_excluded_hardware.prebuilt.xml", +] +handheld_extra_prebuilts = [ + "handheld_core_hardware.prebuilt.xml", + "android.hardware.biometrics.face.prebuilt.xml", + "android.hardware.faketouch.prebuilt.xml", + "android.hardware.fingerprint.prebuilt.xml", +] +slim_extra_prebuilts = [ + "slim_excluded_hardware.prebuilt.xml", +] +override_apex { + name: "com.google.cf.hardware.core_permissions", + base: "com.android.hardware.core_permissions", + prebuilts: permission_prebuilts, +} +override_apex { + name: "com.google.cf_handheld.hardware.core_permissions", + base: "com.android.hardware.core_permissions", + prebuilts: permission_prebuilts + handheld_extra_prebuilts, +} +override_apex { + name: "com.google.cf_handheld_slim.hardware.core_permissions", + base: "com.android.hardware.core_permissions", + prebuilts: permission_prebuilts + handheld_extra_prebuilts + slim_extra_prebuilts, +} diff --git a/shared/biometrics_face/device_vendor.mk b/shared/biometrics_face/device_vendor.mk index 1df7068d4..45eb7c4cd 100644 --- a/shared/biometrics_face/device_vendor.mk +++ b/shared/biometrics_face/device_vendor.mk @@ -14,10 +14,5 @@ # limitations under the License. # -ifneq ($(LOCAL_PREFER_VENDOR_APEX),true) -PRODUCT_COPY_FILES += \ - frameworks/native/data/etc/android.hardware.biometrics.face.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.biometrics.face.xml -endif - PRODUCT_PACKAGES += \ com.android.hardware.biometrics.face diff --git a/shared/biometrics_fingerprint/device_vendor.mk b/shared/biometrics_fingerprint/device_vendor.mk index 24bef1e2c..72b52a808 100644 --- a/shared/biometrics_fingerprint/device_vendor.mk +++ b/shared/biometrics_fingerprint/device_vendor.mk @@ -14,10 +14,5 @@ # limitations under the License. # -ifneq ($(LOCAL_PREFER_VENDOR_APEX),true) -PRODUCT_COPY_FILES += \ - frameworks/native/data/etc/android.hardware.fingerprint.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.fingerprint.xml -endif - PRODUCT_PACKAGES += \ com.android.hardware.biometrics.fingerprint.virtual diff --git a/shared/bluetooth/device_vendor.mk b/shared/bluetooth/device_vendor.mk index 82b460f6c..1eb55cec6 100644 --- a/shared/bluetooth/device_vendor.mk +++ b/shared/bluetooth/device_vendor.mk @@ -33,24 +33,7 @@ PRODUCT_COPY_FILES += \ # # Bluetooth HAL and Compatibility Bluetooth library (for older revs). # -ifneq ($(LOCAL_PREFER_VENDOR_APEX),true) -PRODUCT_COPY_FILES +=\ - frameworks/native/data/etc/android.hardware.bluetooth.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.bluetooth.xml \ - frameworks/native/data/etc/android.hardware.bluetooth_le.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.bluetooth_le.xml - -PRODUCT_PACKAGES += \ - android.hardware.bluetooth-service.default \ - bt_vhci_forwarder - -# Bluetooth initialization configuration is copied to the init folder here instead of being added -# as an init_rc attribute of the bt_vhci_forward binary. The bt_vhci_forward binary is used by -# multiple targets with different initialization configurations. -PRODUCT_COPY_FILES += \ - device/google/cuttlefish/guest/commands/bt_vhci_forwarder/bt_vhci_forwarder.rc:$(TARGET_COPY_OUT_VENDOR)/etc/init/bt_vhci_forwarder.rc - -else PRODUCT_PACKAGES += com.google.cf.bt -endif # # Bluetooth Audio AIDL HAL diff --git a/shared/device.mk b/shared/device.mk index d5dae4ddb..c8359b68f 100644 --- a/shared/device.mk +++ b/shared/device.mk @@ -179,15 +179,6 @@ PRODUCT_PACKAGES += \ hidl_lazy_test_server \ hidl_lazy_cb_test_server -# Runtime Resource Overlays -ifneq ($(LOCAL_PREFER_VENDOR_APEX),true) -PRODUCT_PACKAGES += \ - cuttlefish_overlay_connectivity \ - cuttlefish_overlay_frameworks_base_core \ - cuttlefish_overlay_settings_provider - -endif - # # Satellite vendor service for CF # @@ -212,20 +203,6 @@ DEVICE_MANIFEST_FILE += $(LOCAL_DEVICE_FCM_MANIFEST_FILE) # General files # -ifneq ($(LOCAL_PREFER_VENDOR_APEX),true) -PRODUCT_COPY_FILES += \ - device/google/cuttlefish/shared/permissions/cuttlefish_excluded_hardware.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/cuttlefish_excluded_hardware.xml \ - frameworks/native/data/etc/android.hardware.audio.low_latency.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.audio.low_latency.xml \ - frameworks/native/data/etc/android.hardware.ethernet.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.ethernet.xml \ - frameworks/native/data/etc/android.hardware.usb.accessory.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.usb.accessory.xml \ - frameworks/native/data/etc/android.hardware.usb.host.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.usb.host.xml \ - frameworks/native/data/etc/android.hardware.wifi.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.wifi.xml \ - frameworks/native/data/etc/android.hardware.wifi.direct.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.wifi.direct.xml \ - frameworks/native/data/etc/android.hardware.wifi.passpoint.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.wifi.passpoint.xml \ - frameworks/native/data/etc/android.software.ipsec_tunnels.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.software.ipsec_tunnels.xml \ - frameworks/native/data/etc/android.software.verified_boot.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.software.verified_boot.xml - -endif PRODUCT_COPY_FILES += \ device/google/cuttlefish/shared/config/init.vendor.rc:$(TARGET_COPY_OUT_VENDOR)/etc/init/init.cutf_cvm.rc \ device/google/cuttlefish/shared/config/init.product.rc:$(TARGET_COPY_OUT_PRODUCT)/etc/init/init.rc \ @@ -249,17 +226,11 @@ PRODUCT_COPY_FILES += \ device/google/cuttlefish/shared/config/task_profiles.json:$(TARGET_COPY_OUT_VENDOR)/etc/task_profiles.json \ frameworks/native/data/etc/android.software.credentials.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.software.credentials.xml \ -ifeq ($(LOCAL_PREFER_VENDOR_APEX),true) PRODUCT_PACKAGES += com.google.cf.input.config -else -PRODUCT_COPY_FILES += \ - device/google/cuttlefish/shared/config/input/Crosvm_Virtio_Multitouch_Touchscreen_0.idc:$(TARGET_COPY_OUT_VENDOR)/usr/idc/Crosvm_Virtio_Multitouch_Touchscreen_0.idc \ - device/google/cuttlefish/shared/config/input/Crosvm_Virtio_Multitouch_Touchscreen_1.idc:$(TARGET_COPY_OUT_VENDOR)/usr/idc/Crosvm_Virtio_Multitouch_Touchscreen_1.idc \ - device/google/cuttlefish/shared/config/input/Crosvm_Virtio_Multitouch_Touchscreen_2.idc:$(TARGET_COPY_OUT_VENDOR)/usr/idc/Crosvm_Virtio_Multitouch_Touchscreen_2.idc \ - device/google/cuttlefish/shared/config/input/Crosvm_Virtio_Multitouch_Touchscreen_3.idc:$(TARGET_COPY_OUT_VENDOR)/usr/idc/Crosvm_Virtio_Multitouch_Touchscreen_3.idc \ - device/google/cuttlefish/shared/config/input/Crosvm_Virtio_Rotary_0.idc:$(TARGET_COPY_OUT_VENDOR)/usr/idc/Crosvm_Virtio_Rotary_0.idc \ -endif +# Default permission to access services +LOCAL_HARDWARE_PERMISSIONS_PRODUCT_PACKAGE ?= com.google.cf.hardware.core_permissions +PRODUCT_PACKAGES += $(LOCAL_HARDWARE_PERMISSIONS_PRODUCT_PACKAGE) PRODUCT_PACKAGES += \ fstab.cf.f2fs.hctr2 \ @@ -439,14 +410,7 @@ PRODUCT_COPY_FILES += \ # # Power and PowerStats HALs # -ifeq ($(LOCAL_PREFER_VENDOR_APEX),true) PRODUCT_PACKAGES += com.android.hardware.power -else -PRODUCT_PACKAGES += \ - android.hardware.power-service.example \ - android.hardware.power.stats-service.example \ - -endif # # Tetheroffload HAL @@ -471,12 +435,7 @@ PRODUCT_PACKAGES += \ com.android.hardware.usb # Vibrator HAL -ifeq ($(LOCAL_PREFER_VENDOR_APEX),true) PRODUCT_PACKAGES += com.android.hardware.vibrator -else -PRODUCT_PACKAGES += \ - android.hardware.vibrator-service.example -endif # BootControl HAL PRODUCT_PACKAGES += \ @@ -514,7 +473,6 @@ PRODUCT_PACKAGES += linker.recovery shell_and_utilities_recovery endif # wifi -ifeq ($(LOCAL_PREFER_VENDOR_APEX),true) # Add com.android.hardware.wifi for android.hardware.wifi-service PRODUCT_PACKAGES += com.android.hardware.wifi # Add com.google.cf.wifi for hostapd, wpa_supplicant, etc. @@ -523,39 +481,6 @@ $(call add_soong_config_namespace, wpa_supplicant) $(call add_soong_config_var_value, wpa_supplicant, platform_version, $(PLATFORM_VERSION)) $(call add_soong_config_var_value, wpa_supplicant, nl80211_driver, CONFIG_DRIVER_NL80211_QCA) -else -PRODUCT_PACKAGES += \ - rename_netiface \ - wpa_supplicant \ - setup_wifi \ - mac80211_create_radios \ - hostapd \ - android.hardware.wifi-service \ - init.wifi -PRODUCT_COPY_FILES += \ - device/google/cuttlefish/shared/config/wpa_supplicant.rc:$(TARGET_COPY_OUT_VENDOR)/etc/init/wpa_supplicant.rc - -# VirtWifi interface configuration -ifeq ($(DEVICE_VIRTWIFI_PORT),) - DEVICE_VIRTWIFI_PORT := eth2 -endif -PRODUCT_VENDOR_PROPERTIES += ro.vendor.virtwifi.port=${DEVICE_VIRTWIFI_PORT} - -# WLAN driver configuration files -ifndef LOCAL_WPA_SUPPLICANT_OVERLAY -LOCAL_WPA_SUPPLICANT_OVERLAY := $(LOCAL_PATH)/config/wpa_supplicant_overlay.conf -endif - -ifndef LOCAL_P2P_SUPPLICANT -LOCAL_P2P_SUPPLICANT := $(LOCAL_PATH)/config/p2p_supplicant.conf -endif - -PRODUCT_COPY_FILES += \ - external/wpa_supplicant_8/wpa_supplicant/wpa_supplicant_template.conf:$(TARGET_COPY_OUT_VENDOR)/etc/wifi/wpa_supplicant.conf \ - $(LOCAL_WPA_SUPPLICANT_OVERLAY):$(TARGET_COPY_OUT_VENDOR)/etc/wifi/wpa_supplicant_overlay.conf \ - $(LOCAL_P2P_SUPPLICANT):$(TARGET_COPY_OUT_VENDOR)/etc/wifi/p2p_supplicant.conf -endif - # Wifi Runtime Resource Overlay PRODUCT_PACKAGES += \ CuttlefishTetheringOverlay \ diff --git a/shared/gnss/device_vendor.mk b/shared/gnss/device_vendor.mk index da5b68041..0c76d97f4 100644 --- a/shared/gnss/device_vendor.mk +++ b/shared/gnss/device_vendor.mk @@ -14,11 +14,6 @@ # limitations under the License. # -ifneq ($(LOCAL_PREFER_VENDOR_APEX),true) -PRODUCT_COPY_FILES += \ - frameworks/native/data/etc/android.hardware.location.gps.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.location.gps.xml -endif - LOCAL_GNSS_PRODUCT_PACKAGE ?= \ android.hardware.gnss-service.example diff --git a/shared/graphics/device_vendor.mk b/shared/graphics/device_vendor.mk index b5f410281..b760004c4 100644 --- a/shared/graphics/device_vendor.mk +++ b/shared/graphics/device_vendor.mk @@ -49,16 +49,6 @@ PRODUCT_PACKAGES += \ libvulkan_enc endif -ifeq ($(TARGET_VULKAN_SUPPORT),true) -ifneq ($(LOCAL_PREFER_VENDOR_APEX),true) -PRODUCT_COPY_FILES += \ - frameworks/native/data/etc/android.hardware.vulkan.level-0.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.vulkan.level.xml \ - frameworks/native/data/etc/android.hardware.vulkan.version-1_0_3.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.vulkan.version.xml \ - frameworks/native/data/etc/android.software.vulkan.deqp.level-2023-03-01.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.software.vulkan.deqp.level.xml \ - frameworks/native/data/etc/android.software.opengles.deqp.level-2023-03-01.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.software.opengles.deqp.level.xml -endif -endif - # # Hardware Composer HAL # diff --git a/shared/phone/device_vendor.mk b/shared/phone/device_vendor.mk index f6424b802..cecf564b4 100644 --- a/shared/phone/device_vendor.mk +++ b/shared/phone/device_vendor.mk @@ -16,15 +16,11 @@ PRODUCT_MANIFEST_FILES += device/google/cuttlefish/shared/config/product_manifest.xml SYSTEM_EXT_MANIFEST_FILES += device/google/cuttlefish/shared/config/system_ext_manifest.xml +# Permission to access services for phone +LOCAL_HARDWARE_PERMISSIONS_PRODUCT_PACKAGE := com.google.cf_handheld.hardware.core_permissions $(call inherit-product, $(SRC_TARGET_DIR)/product/handheld_vendor.mk) -ifneq ($(LOCAL_PREFER_VENDOR_APEX),true) -PRODUCT_COPY_FILES += \ - frameworks/native/data/etc/android.software.sip.voip.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.software.sip.voip.xml \ - frameworks/native/data/etc/handheld_core_hardware.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/handheld_core_hardware.xml -endif - $(call inherit-product, frameworks/native/build/phone-xhdpi-2048-dalvik-heap.mk) $(call inherit-product, device/google/cuttlefish/shared/biometrics_face/device_vendor.mk) $(call inherit-product, device/google/cuttlefish/shared/biometrics_fingerprint/device_vendor.mk) @@ -47,24 +43,9 @@ PRODUCT_EXTRA_VNDK_VERSIONS := 30 31 32 33 34 TARGET_PRODUCT_PROP := $(LOCAL_PATH)/product.prop -ifneq ($(LOCAL_PREFER_VENDOR_APEX),true) -PRODUCT_COPY_FILES += \ - frameworks/native/data/etc/android.hardware.faketouch.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.faketouch.xml \ - - ifneq ($(TARGET_DISABLE_BIOMETRICS_FACE),true) - PRODUCT_COPY_FILES += \ - frameworks/native/data/etc/android.hardware.biometrics.face.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.biometrics.face.xml \ - - endif -endif - DEVICE_PACKAGE_OVERLAYS += device/google/cuttlefish/shared/phone/overlay # Runtime Resource Overlays -ifeq ($(LOCAL_PREFER_VENDOR_APEX),true) PRODUCT_PACKAGES += com.google.aosp_cf_phone.rros -else -PRODUCT_PACKAGES += cuttlefish_phone_overlay_frameworks_base_core -endif TARGET_BOARD_INFO_FILE ?= device/google/cuttlefish/shared/phone/android-info.txt diff --git a/shared/reboot_escrow/device_vendor.mk b/shared/reboot_escrow/device_vendor.mk index cc58fe884..e977c9813 100644 --- a/shared/reboot_escrow/device_vendor.mk +++ b/shared/reboot_escrow/device_vendor.mk @@ -14,11 +14,6 @@ # limitations under the License. # -ifneq ($(LOCAL_PREFER_VENDOR_APEX),true) -PRODUCT_COPY_FILES += \ - frameworks/native/data/etc/android.hardware.reboot_escrow.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.reboot_escrow.xml -endif - PRODUCT_VENDOR_PROPERTIES += \ ro.rebootescrow.device=/dev/block/pmem0 diff --git a/shared/sensors/device_vendor.mk b/shared/sensors/device_vendor.mk index 3bee726bd..99a56cfd7 100644 --- a/shared/sensors/device_vendor.mk +++ b/shared/sensors/device_vendor.mk @@ -14,29 +14,11 @@ # limitations under the License. # - -ifneq ($(LOCAL_SENSOR_FILE_OVERRIDES),true) -ifneq ($(LOCAL_PREFER_VENDOR_APEX),true) - PRODUCT_COPY_FILES += \ - frameworks/native/data/etc/android.hardware.sensor.ambient_temperature.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.sensor.ambient_temperature.xml \ - frameworks/native/data/etc/android.hardware.sensor.barometer.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.sensor.barometer.xml \ - frameworks/native/data/etc/android.hardware.sensor.gyroscope.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.sensor.gyroscope.xml \ - frameworks/native/data/etc/android.hardware.sensor.hinge_angle.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.sensor.hinge_angle.xml \ - frameworks/native/data/etc/android.hardware.sensor.light.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.sensor.light.xml \ - frameworks/native/data/etc/android.hardware.sensor.proximity.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.sensor.proximity.xml \ - frameworks/native/data/etc/android.hardware.sensor.relative_humidity.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.sensor.relative_humidity.xml -endif -endif - # # Sensors # ifeq ($(LOCAL_SENSOR_PRODUCT_PACKAGE),) -ifeq ($(LOCAL_PREFER_VENDOR_APEX),true) LOCAL_SENSOR_PRODUCT_PACKAGE := com.android.hardware.sensors -else - LOCAL_SENSOR_PRODUCT_PACKAGE := android.hardware.sensors-service.example -endif endif PRODUCT_PACKAGES += \ $(LOCAL_SENSOR_PRODUCT_PACKAGE) diff --git a/shared/slim/device_vendor.mk b/shared/slim/device_vendor.mk index c5e535c04..dc5b49edf 100644 --- a/shared/slim/device_vendor.mk +++ b/shared/slim/device_vendor.mk @@ -19,12 +19,8 @@ SYSTEM_EXT_MANIFEST_FILES += device/google/cuttlefish/shared/config/system_ext_m $(call inherit-product, $(SRC_TARGET_DIR)/product/handheld_vendor.mk) -ifneq ($(LOCAL_PREFER_VENDOR_APEX),true) -PRODUCT_COPY_FILES += \ - frameworks/native/data/etc/android.software.sip.voip.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.software.sip.voip.xml \ - frameworks/native/data/etc/handheld_core_hardware.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/handheld_core_hardware.xml -PRODUCT_PACKAGES += slim_excluded_hardware.prebuilt.xml -endif +# Permission to access services +LOCAL_HARDWARE_PERMISSIONS_PRODUCT_PACKAGE := com.google.cf_handheld_slim.hardware.core_permissions $(call inherit-product, frameworks/native/build/phone-xhdpi-2048-dalvik-heap.mk) $(call inherit-product, device/google/cuttlefish/shared/biometrics_face/device_vendor.mk) @@ -46,21 +42,9 @@ $(call inherit-product, device/google/cuttlefish/shared/device.mk) PRODUCT_VENDOR_PROPERTIES += \ debug.hwui.drawing_enabled=0 \ -ifneq ($(LOCAL_PREFER_VENDOR_APEX),true) -PRODUCT_COPY_FILES += \ - frameworks/native/data/etc/android.hardware.faketouch.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.faketouch.xml \ - -endif - # Runtime Resource Overlays -ifeq ($(LOCAL_PREFER_VENDOR_APEX),true) PRODUCT_PACKAGES += \ com.google.aosp_cf_phone.rros \ com.google.aosp_cf_slim.rros -else -PRODUCT_PACKAGES += \ - cuttlefish_phone_overlay_frameworks_base_core \ - slim_overlay_frameworks_base_core -endif TARGET_BOARD_INFO_FILE ?= device/google/cuttlefish/shared/slim/android-info.txt diff --git a/shared/telephony/device_vendor.mk b/shared/telephony/device_vendor.mk index bd78cc6d0..873bb468a 100644 --- a/shared/telephony/device_vendor.mk +++ b/shared/telephony/device_vendor.mk @@ -27,21 +27,6 @@ PRODUCT_VENDOR_PROPERTIES += \ ro.com.android.dataroaming=true \ ro.telephony.default_network=9 \ -ifeq ($(LOCAL_PREFER_VENDOR_APEX),true) PRODUCT_PACKAGES += com.google.cf.rild -else -# If downstream target provides its own RILD, set TARGET_USES_CF_RILD := false -# If the target prefers vendor APEX, this feature is not supported -TARGET_USES_CF_RILD ?= true -ifeq ($(TARGET_USES_CF_RILD),true) -PRODUCT_PACKAGES += \ - libcuttlefish-ril-2 \ - libcuttlefish-rild -endif -PRODUCT_COPY_FILES += \ - frameworks/native/data/etc/android.hardware.telephony.gsm.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.telephony.gsm.xml \ - frameworks/native/data/etc/android.hardware.telephony.ims.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.telephony.ims.xml \ - frameworks/native/data/etc/android.hardware.telephony.satellite.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.telephony.satellite.xml -endif # if not LOCAL_PREFER_VENDOR_APEX endif # if not TARGET_NO_TELEPHONY diff --git a/shared/tv/device_vendor.mk b/shared/tv/device_vendor.mk index c6ca9a5d8..de7a98d8a 100644 --- a/shared/tv/device_vendor.mk +++ b/shared/tv/device_vendor.mk @@ -34,10 +34,6 @@ PRODUCT_VENDOR_PROPERTIES += \ # Extend cuttlefish common sepolicy with tv-specific functionality BOARD_SEPOLICY_DIRS += device/google/cuttlefish/shared/tv/sepolicy/vendor -ifneq ($(LOCAL_PREFER_VENDOR_APEX),true) - PRODUCT_PACKAGES += tv_excluded_hardware.prebuilt.xml -endif - PRODUCT_COPY_FILES += \ frameworks/native/data/etc/android.hardware.camera.external.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.camera.external.xml \ device/google/cuttlefish/shared/config/media_codecs_google_tv.xml:$(TARGET_COPY_OUT_VENDOR)/etc/media_codecs_google_tv.xml \ diff --git a/vsoc_arm64_only/slim/aosp_cf.mk b/vsoc_arm64_only/slim/aosp_cf.mk index d118163fe..46cdb1a25 100644 --- a/vsoc_arm64_only/slim/aosp_cf.mk +++ b/vsoc_arm64_only/slim/aosp_cf.mk @@ -37,7 +37,6 @@ PRODUCT_PACKAGES += FakeSystemApp # # All components inherited here go to vendor image # -LOCAL_PREFER_VENDOR_APEX := true $(call inherit-product, device/google/cuttlefish/shared/slim/device_vendor.mk) # @@ -45,14 +44,6 @@ $(call inherit-product, device/google/cuttlefish/shared/slim/device_vendor.mk) # $(call inherit-product, device/google/cuttlefish/vsoc_arm64/bootloader.mk) -# Exclude features that are not available on AOSP devices. -ifeq ($(LOCAL_PREFER_VENDOR_APEX),true) -PRODUCT_PACKAGES += com.google.aosp_cf_slim.hardware.core_permissions -else -PRODUCT_COPY_FILES += \ - frameworks/native/data/etc/aosp_excluded_hardware.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/aosp_excluded_hardware.xml -endif - PRODUCT_NAME := aosp_cf_arm64_slim PRODUCT_DEVICE := vsoc_arm64_only PRODUCT_MANUFACTURER := Google diff --git a/vsoc_riscv64/phone/aosp_cf.mk b/vsoc_riscv64/phone/aosp_cf.mk index bc2af1f3f..0f0d3f810 100644 --- a/vsoc_riscv64/phone/aosp_cf.mk +++ b/vsoc_riscv64/phone/aosp_cf.mk @@ -36,7 +36,6 @@ $(call inherit-product, $(SRC_TARGET_DIR)/product/aosp_product.mk) # # All components inherited here go to vendor image # -LOCAL_PREFER_VENDOR_APEX := true $(call inherit-product, device/google/cuttlefish/shared/phone/device_vendor.mk) PRODUCT_ENFORCE_MAC80211_HWSIM := false @@ -49,14 +48,6 @@ PRODUCT_ENFORCE_MAC80211_HWSIM := false # $(call inherit-product, device/google/cuttlefish/vsoc_riscv64/bootloader.mk) -# Exclude features that are not available on AOSP devices. -ifeq ($(LOCAL_PREFER_VENDOR_APEX),true) -PRODUCT_PACKAGES += com.google.aosp_cf_phone.hardware.core_permissions -else -PRODUCT_COPY_FILES += \ - frameworks/native/data/etc/aosp_excluded_hardware.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/aosp_excluded_hardware.xml -endif - # TODO(b/206676167): This property can be removed when renderscript is removed. # Prevents framework from attempting to load renderscript libraries, which are # not supported on this architecture. diff --git a/vsoc_riscv64/slim/aosp_cf.mk b/vsoc_riscv64/slim/aosp_cf.mk index b85b738fa..5bddf1824 100644 --- a/vsoc_riscv64/slim/aosp_cf.mk +++ b/vsoc_riscv64/slim/aosp_cf.mk @@ -37,7 +37,6 @@ PRODUCT_PACKAGES += FakeSystemApp # # All components inherited here go to vendor image # -LOCAL_PREFER_VENDOR_APEX := true $(call inherit-product, device/google/cuttlefish/shared/slim/device_vendor.mk) PRODUCT_ENFORCE_MAC80211_HWSIM := false diff --git a/vsoc_x86_64/phone/aosp_cf.mk b/vsoc_x86_64/phone/aosp_cf.mk index f9e8d621a..b8632394f 100644 --- a/vsoc_x86_64/phone/aosp_cf.mk +++ b/vsoc_x86_64/phone/aosp_cf.mk @@ -36,7 +36,6 @@ $(call inherit-product, $(SRC_TARGET_DIR)/product/aosp_product.mk) # # All components inherited here go to vendor image # -LOCAL_PREFER_VENDOR_APEX := true $(call inherit-product, device/google/cuttlefish/shared/phone/device_vendor.mk) # Nested virtualization support @@ -47,14 +46,6 @@ $(call inherit-product, packages/modules/Virtualization/apex/product_packages.mk # $(call inherit-product, device/google/cuttlefish/vsoc_x86_64/bootloader.mk) -# Exclude features that are not available on AOSP devices. -ifeq ($(LOCAL_PREFER_VENDOR_APEX),true) -PRODUCT_PACKAGES += com.google.aosp_cf_phone.hardware.core_permissions -else -PRODUCT_COPY_FILES += \ - frameworks/native/data/etc/aosp_excluded_hardware.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/aosp_excluded_hardware.xml -endif - PRODUCT_NAME := aosp_cf_x86_64_phone PRODUCT_DEVICE := vsoc_x86_64 PRODUCT_MANUFACTURER := Google diff --git a/vsoc_x86_64_only/slim/aosp_cf.mk b/vsoc_x86_64_only/slim/aosp_cf.mk index 536a4b7f5..227e662e7 100644 --- a/vsoc_x86_64_only/slim/aosp_cf.mk +++ b/vsoc_x86_64_only/slim/aosp_cf.mk @@ -37,7 +37,6 @@ PRODUCT_PACKAGES += FakeSystemApp # # All components inherited here go to vendor image # -LOCAL_PREFER_VENDOR_APEX := true $(call inherit-product, device/google/cuttlefish/shared/slim/device_vendor.mk) # @@ -45,14 +44,6 @@ $(call inherit-product, device/google/cuttlefish/shared/slim/device_vendor.mk) # $(call inherit-product, device/google/cuttlefish/vsoc_x86_64/bootloader.mk) -# Exclude features that are not available on AOSP devices. -ifeq ($(LOCAL_PREFER_VENDOR_APEX),true) -PRODUCT_PACKAGES += com.google.aosp_cf_slim.hardware.core_permissions -else -PRODUCT_COPY_FILES += \ - frameworks/native/data/etc/aosp_excluded_hardware.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/aosp_excluded_hardware.xml -endif - PRODUCT_NAME := aosp_cf_x86_64_slim PRODUCT_DEVICE := vsoc_x86_64_only PRODUCT_MANUFACTURER := Google -- cgit v1.2.3 From 835d189eac384e6ba809ed872e448ae7581b17b7 Mon Sep 17 00:00:00 2001 From: Deyao Ren Date: Tue, 19 Sep 2023 20:37:59 +0000 Subject: Revert "Remove LOCAL_PREFER_VENDOR_APEX variable from .mk files for cuttlefish" This reverts commit 5be0e184b94e6db35d294e60c09b9fe2b9cde3ae. Reason for revert: b/301118364 Change-Id: Ie6e6352b6f6166e115eed52d409fda6a35c1ecaf --- .../Android.bp | 44 ++++++++++++ .../Android.bp | 45 ++++++++++++ .../Android.bp | 57 --------------- shared/biometrics_face/device_vendor.mk | 5 ++ shared/biometrics_fingerprint/device_vendor.mk | 5 ++ shared/bluetooth/device_vendor.mk | 17 +++++ shared/device.mk | 81 +++++++++++++++++++++- shared/gnss/device_vendor.mk | 5 ++ shared/graphics/device_vendor.mk | 10 +++ shared/phone/device_vendor.mk | 23 +++++- shared/reboot_escrow/device_vendor.mk | 5 ++ shared/sensors/device_vendor.mk | 18 +++++ shared/slim/device_vendor.mk | 20 +++++- shared/telephony/device_vendor.mk | 15 ++++ shared/tv/device_vendor.mk | 4 ++ vsoc_arm64_only/slim/aosp_cf.mk | 9 +++ vsoc_riscv64/phone/aosp_cf.mk | 9 +++ vsoc_riscv64/slim/aosp_cf.mk | 1 + vsoc_x86_64/phone/aosp_cf.mk | 9 +++ vsoc_x86_64_only/slim/aosp_cf.mk | 9 +++ 20 files changed, 327 insertions(+), 64 deletions(-) create mode 100644 apex/com.google.aosp_cf_phone.hardware.core_permissions/Android.bp create mode 100644 apex/com.google.aosp_cf_slim.hardware.core_permissions/Android.bp delete mode 100644 apex/com.google.cf.hardware.core_permission/Android.bp diff --git a/apex/com.google.aosp_cf_phone.hardware.core_permissions/Android.bp b/apex/com.google.aosp_cf_phone.hardware.core_permissions/Android.bp new file mode 100644 index 000000000..2900f3296 --- /dev/null +++ b/apex/com.google.aosp_cf_phone.hardware.core_permissions/Android.bp @@ -0,0 +1,44 @@ +// Copyright (C) 2021 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 { + default_applicable_licenses: ["Android-Apache-2.0"], +} + +override_apex { + name: "com.google.aosp_cf_phone.hardware.core_permissions", + base: "com.android.hardware.core_permissions", + prebuilts: [ + "android.hardware.audio.low_latency.prebuilt.xml", + "android.hardware.biometrics.face.prebuilt.xml", + "android.hardware.ethernet.prebuilt.xml", + "android.hardware.faketouch.prebuilt.xml", + "android.hardware.fingerprint.prebuilt.xml", + "android.hardware.location.gps.prebuilt.xml", + "android.hardware.reboot_escrow.prebuilt.xml", + "android.hardware.usb.accessory.prebuilt.xml", + "android.hardware.usb.host.prebuilt.xml", + "android.hardware.vulkan.level-0.prebuilt.xml", + "android.hardware.vulkan.version-1_0_3.prebuilt.xml", + "android.software.device_id_attestation.prebuilt.xml", + "android.software.ipsec_tunnels.prebuilt.xml", + "android.software.opengles.deqp.level-2022-03-01.prebuilt.xml", + "android.software.sip.voip.prebuilt.xml", + "android.software.verified_boot.prebuilt.xml", + "android.software.vulkan.deqp.level-2022-03-01.prebuilt.xml", + "aosp_excluded_hardware.prebuilt.xml", + "cuttlefish_excluded_hardware.prebuilt.xml", + "handheld_core_hardware.prebuilt.xml", + ], +} diff --git a/apex/com.google.aosp_cf_slim.hardware.core_permissions/Android.bp b/apex/com.google.aosp_cf_slim.hardware.core_permissions/Android.bp new file mode 100644 index 000000000..959c95076 --- /dev/null +++ b/apex/com.google.aosp_cf_slim.hardware.core_permissions/Android.bp @@ -0,0 +1,45 @@ +// Copyright (C) 2022 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 { + default_applicable_licenses: ["Android-Apache-2.0"], +} + +override_apex { + name: "com.google.aosp_cf_slim.hardware.core_permissions", + base: "com.android.hardware.core_permissions", + prebuilts: [ + "android.hardware.audio.low_latency.prebuilt.xml", + "android.hardware.biometrics.face.prebuilt.xml", + "android.hardware.ethernet.prebuilt.xml", + "android.hardware.faketouch.prebuilt.xml", + "android.hardware.fingerprint.prebuilt.xml", + "android.hardware.location.gps.prebuilt.xml", + "android.hardware.reboot_escrow.prebuilt.xml", + "android.hardware.usb.accessory.prebuilt.xml", + "android.hardware.usb.host.prebuilt.xml", + "android.hardware.vulkan.level-0.prebuilt.xml", + "android.hardware.vulkan.version-1_0_3.prebuilt.xml", + "android.software.device_id_attestation.prebuilt.xml", + "android.software.ipsec_tunnels.prebuilt.xml", + "android.software.opengles.deqp.level-2022-03-01.prebuilt.xml", + "android.software.sip.voip.prebuilt.xml", + "android.software.verified_boot.prebuilt.xml", + "android.software.vulkan.deqp.level-2022-03-01.prebuilt.xml", + "aosp_excluded_hardware.prebuilt.xml", + "cuttlefish_excluded_hardware.prebuilt.xml", + "handheld_core_hardware.prebuilt.xml", + "slim_excluded_hardware.prebuilt.xml", + ], +} diff --git a/apex/com.google.cf.hardware.core_permission/Android.bp b/apex/com.google.cf.hardware.core_permission/Android.bp deleted file mode 100644 index 1f4c9cce0..000000000 --- a/apex/com.google.cf.hardware.core_permission/Android.bp +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright (C) 2023 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 { - default_applicable_licenses: ["Android-Apache-2.0"], -} -permission_prebuilts = [ - "android.hardware.audio.low_latency.prebuilt.xml", - "android.hardware.ethernet.prebuilt.xml", - "android.hardware.location.gps.prebuilt.xml", - "android.hardware.reboot_escrow.prebuilt.xml", - "android.hardware.usb.accessory.prebuilt.xml", - "android.hardware.usb.host.prebuilt.xml", - "android.hardware.vulkan.level-0.prebuilt.xml", - "android.hardware.vulkan.version-1_0_3.prebuilt.xml", - "android.software.device_id_attestation.prebuilt.xml", - "android.software.ipsec_tunnels.prebuilt.xml", - "android.software.opengles.deqp.level-2022-03-01.prebuilt.xml", - "android.software.sip.voip.prebuilt.xml", - "android.software.verified_boot.prebuilt.xml", - "android.software.vulkan.deqp.level-2022-03-01.prebuilt.xml", - "cuttlefish_excluded_hardware.prebuilt.xml", -] -handheld_extra_prebuilts = [ - "handheld_core_hardware.prebuilt.xml", - "android.hardware.biometrics.face.prebuilt.xml", - "android.hardware.faketouch.prebuilt.xml", - "android.hardware.fingerprint.prebuilt.xml", -] -slim_extra_prebuilts = [ - "slim_excluded_hardware.prebuilt.xml", -] -override_apex { - name: "com.google.cf.hardware.core_permissions", - base: "com.android.hardware.core_permissions", - prebuilts: permission_prebuilts, -} -override_apex { - name: "com.google.cf_handheld.hardware.core_permissions", - base: "com.android.hardware.core_permissions", - prebuilts: permission_prebuilts + handheld_extra_prebuilts, -} -override_apex { - name: "com.google.cf_handheld_slim.hardware.core_permissions", - base: "com.android.hardware.core_permissions", - prebuilts: permission_prebuilts + handheld_extra_prebuilts + slim_extra_prebuilts, -} diff --git a/shared/biometrics_face/device_vendor.mk b/shared/biometrics_face/device_vendor.mk index 45eb7c4cd..1df7068d4 100644 --- a/shared/biometrics_face/device_vendor.mk +++ b/shared/biometrics_face/device_vendor.mk @@ -14,5 +14,10 @@ # limitations under the License. # +ifneq ($(LOCAL_PREFER_VENDOR_APEX),true) +PRODUCT_COPY_FILES += \ + frameworks/native/data/etc/android.hardware.biometrics.face.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.biometrics.face.xml +endif + PRODUCT_PACKAGES += \ com.android.hardware.biometrics.face diff --git a/shared/biometrics_fingerprint/device_vendor.mk b/shared/biometrics_fingerprint/device_vendor.mk index 72b52a808..24bef1e2c 100644 --- a/shared/biometrics_fingerprint/device_vendor.mk +++ b/shared/biometrics_fingerprint/device_vendor.mk @@ -14,5 +14,10 @@ # limitations under the License. # +ifneq ($(LOCAL_PREFER_VENDOR_APEX),true) +PRODUCT_COPY_FILES += \ + frameworks/native/data/etc/android.hardware.fingerprint.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.fingerprint.xml +endif + PRODUCT_PACKAGES += \ com.android.hardware.biometrics.fingerprint.virtual diff --git a/shared/bluetooth/device_vendor.mk b/shared/bluetooth/device_vendor.mk index 1eb55cec6..82b460f6c 100644 --- a/shared/bluetooth/device_vendor.mk +++ b/shared/bluetooth/device_vendor.mk @@ -33,7 +33,24 @@ PRODUCT_COPY_FILES += \ # # Bluetooth HAL and Compatibility Bluetooth library (for older revs). # +ifneq ($(LOCAL_PREFER_VENDOR_APEX),true) +PRODUCT_COPY_FILES +=\ + frameworks/native/data/etc/android.hardware.bluetooth.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.bluetooth.xml \ + frameworks/native/data/etc/android.hardware.bluetooth_le.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.bluetooth_le.xml + +PRODUCT_PACKAGES += \ + android.hardware.bluetooth-service.default \ + bt_vhci_forwarder + +# Bluetooth initialization configuration is copied to the init folder here instead of being added +# as an init_rc attribute of the bt_vhci_forward binary. The bt_vhci_forward binary is used by +# multiple targets with different initialization configurations. +PRODUCT_COPY_FILES += \ + device/google/cuttlefish/guest/commands/bt_vhci_forwarder/bt_vhci_forwarder.rc:$(TARGET_COPY_OUT_VENDOR)/etc/init/bt_vhci_forwarder.rc + +else PRODUCT_PACKAGES += com.google.cf.bt +endif # # Bluetooth Audio AIDL HAL diff --git a/shared/device.mk b/shared/device.mk index c8359b68f..d5dae4ddb 100644 --- a/shared/device.mk +++ b/shared/device.mk @@ -179,6 +179,15 @@ PRODUCT_PACKAGES += \ hidl_lazy_test_server \ hidl_lazy_cb_test_server +# Runtime Resource Overlays +ifneq ($(LOCAL_PREFER_VENDOR_APEX),true) +PRODUCT_PACKAGES += \ + cuttlefish_overlay_connectivity \ + cuttlefish_overlay_frameworks_base_core \ + cuttlefish_overlay_settings_provider + +endif + # # Satellite vendor service for CF # @@ -203,6 +212,20 @@ DEVICE_MANIFEST_FILE += $(LOCAL_DEVICE_FCM_MANIFEST_FILE) # General files # +ifneq ($(LOCAL_PREFER_VENDOR_APEX),true) +PRODUCT_COPY_FILES += \ + device/google/cuttlefish/shared/permissions/cuttlefish_excluded_hardware.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/cuttlefish_excluded_hardware.xml \ + frameworks/native/data/etc/android.hardware.audio.low_latency.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.audio.low_latency.xml \ + frameworks/native/data/etc/android.hardware.ethernet.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.ethernet.xml \ + frameworks/native/data/etc/android.hardware.usb.accessory.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.usb.accessory.xml \ + frameworks/native/data/etc/android.hardware.usb.host.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.usb.host.xml \ + frameworks/native/data/etc/android.hardware.wifi.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.wifi.xml \ + frameworks/native/data/etc/android.hardware.wifi.direct.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.wifi.direct.xml \ + frameworks/native/data/etc/android.hardware.wifi.passpoint.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.wifi.passpoint.xml \ + frameworks/native/data/etc/android.software.ipsec_tunnels.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.software.ipsec_tunnels.xml \ + frameworks/native/data/etc/android.software.verified_boot.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.software.verified_boot.xml + +endif PRODUCT_COPY_FILES += \ device/google/cuttlefish/shared/config/init.vendor.rc:$(TARGET_COPY_OUT_VENDOR)/etc/init/init.cutf_cvm.rc \ device/google/cuttlefish/shared/config/init.product.rc:$(TARGET_COPY_OUT_PRODUCT)/etc/init/init.rc \ @@ -226,11 +249,17 @@ PRODUCT_COPY_FILES += \ device/google/cuttlefish/shared/config/task_profiles.json:$(TARGET_COPY_OUT_VENDOR)/etc/task_profiles.json \ frameworks/native/data/etc/android.software.credentials.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.software.credentials.xml \ +ifeq ($(LOCAL_PREFER_VENDOR_APEX),true) PRODUCT_PACKAGES += com.google.cf.input.config +else +PRODUCT_COPY_FILES += \ + device/google/cuttlefish/shared/config/input/Crosvm_Virtio_Multitouch_Touchscreen_0.idc:$(TARGET_COPY_OUT_VENDOR)/usr/idc/Crosvm_Virtio_Multitouch_Touchscreen_0.idc \ + device/google/cuttlefish/shared/config/input/Crosvm_Virtio_Multitouch_Touchscreen_1.idc:$(TARGET_COPY_OUT_VENDOR)/usr/idc/Crosvm_Virtio_Multitouch_Touchscreen_1.idc \ + device/google/cuttlefish/shared/config/input/Crosvm_Virtio_Multitouch_Touchscreen_2.idc:$(TARGET_COPY_OUT_VENDOR)/usr/idc/Crosvm_Virtio_Multitouch_Touchscreen_2.idc \ + device/google/cuttlefish/shared/config/input/Crosvm_Virtio_Multitouch_Touchscreen_3.idc:$(TARGET_COPY_OUT_VENDOR)/usr/idc/Crosvm_Virtio_Multitouch_Touchscreen_3.idc \ + device/google/cuttlefish/shared/config/input/Crosvm_Virtio_Rotary_0.idc:$(TARGET_COPY_OUT_VENDOR)/usr/idc/Crosvm_Virtio_Rotary_0.idc \ -# Default permission to access services -LOCAL_HARDWARE_PERMISSIONS_PRODUCT_PACKAGE ?= com.google.cf.hardware.core_permissions -PRODUCT_PACKAGES += $(LOCAL_HARDWARE_PERMISSIONS_PRODUCT_PACKAGE) +endif PRODUCT_PACKAGES += \ fstab.cf.f2fs.hctr2 \ @@ -410,7 +439,14 @@ PRODUCT_COPY_FILES += \ # # Power and PowerStats HALs # +ifeq ($(LOCAL_PREFER_VENDOR_APEX),true) PRODUCT_PACKAGES += com.android.hardware.power +else +PRODUCT_PACKAGES += \ + android.hardware.power-service.example \ + android.hardware.power.stats-service.example \ + +endif # # Tetheroffload HAL @@ -435,7 +471,12 @@ PRODUCT_PACKAGES += \ com.android.hardware.usb # Vibrator HAL +ifeq ($(LOCAL_PREFER_VENDOR_APEX),true) PRODUCT_PACKAGES += com.android.hardware.vibrator +else +PRODUCT_PACKAGES += \ + android.hardware.vibrator-service.example +endif # BootControl HAL PRODUCT_PACKAGES += \ @@ -473,6 +514,7 @@ PRODUCT_PACKAGES += linker.recovery shell_and_utilities_recovery endif # wifi +ifeq ($(LOCAL_PREFER_VENDOR_APEX),true) # Add com.android.hardware.wifi for android.hardware.wifi-service PRODUCT_PACKAGES += com.android.hardware.wifi # Add com.google.cf.wifi for hostapd, wpa_supplicant, etc. @@ -481,6 +523,39 @@ $(call add_soong_config_namespace, wpa_supplicant) $(call add_soong_config_var_value, wpa_supplicant, platform_version, $(PLATFORM_VERSION)) $(call add_soong_config_var_value, wpa_supplicant, nl80211_driver, CONFIG_DRIVER_NL80211_QCA) +else +PRODUCT_PACKAGES += \ + rename_netiface \ + wpa_supplicant \ + setup_wifi \ + mac80211_create_radios \ + hostapd \ + android.hardware.wifi-service \ + init.wifi +PRODUCT_COPY_FILES += \ + device/google/cuttlefish/shared/config/wpa_supplicant.rc:$(TARGET_COPY_OUT_VENDOR)/etc/init/wpa_supplicant.rc + +# VirtWifi interface configuration +ifeq ($(DEVICE_VIRTWIFI_PORT),) + DEVICE_VIRTWIFI_PORT := eth2 +endif +PRODUCT_VENDOR_PROPERTIES += ro.vendor.virtwifi.port=${DEVICE_VIRTWIFI_PORT} + +# WLAN driver configuration files +ifndef LOCAL_WPA_SUPPLICANT_OVERLAY +LOCAL_WPA_SUPPLICANT_OVERLAY := $(LOCAL_PATH)/config/wpa_supplicant_overlay.conf +endif + +ifndef LOCAL_P2P_SUPPLICANT +LOCAL_P2P_SUPPLICANT := $(LOCAL_PATH)/config/p2p_supplicant.conf +endif + +PRODUCT_COPY_FILES += \ + external/wpa_supplicant_8/wpa_supplicant/wpa_supplicant_template.conf:$(TARGET_COPY_OUT_VENDOR)/etc/wifi/wpa_supplicant.conf \ + $(LOCAL_WPA_SUPPLICANT_OVERLAY):$(TARGET_COPY_OUT_VENDOR)/etc/wifi/wpa_supplicant_overlay.conf \ + $(LOCAL_P2P_SUPPLICANT):$(TARGET_COPY_OUT_VENDOR)/etc/wifi/p2p_supplicant.conf +endif + # Wifi Runtime Resource Overlay PRODUCT_PACKAGES += \ CuttlefishTetheringOverlay \ diff --git a/shared/gnss/device_vendor.mk b/shared/gnss/device_vendor.mk index 0c76d97f4..da5b68041 100644 --- a/shared/gnss/device_vendor.mk +++ b/shared/gnss/device_vendor.mk @@ -14,6 +14,11 @@ # limitations under the License. # +ifneq ($(LOCAL_PREFER_VENDOR_APEX),true) +PRODUCT_COPY_FILES += \ + frameworks/native/data/etc/android.hardware.location.gps.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.location.gps.xml +endif + LOCAL_GNSS_PRODUCT_PACKAGE ?= \ android.hardware.gnss-service.example diff --git a/shared/graphics/device_vendor.mk b/shared/graphics/device_vendor.mk index b760004c4..b5f410281 100644 --- a/shared/graphics/device_vendor.mk +++ b/shared/graphics/device_vendor.mk @@ -49,6 +49,16 @@ PRODUCT_PACKAGES += \ libvulkan_enc endif +ifeq ($(TARGET_VULKAN_SUPPORT),true) +ifneq ($(LOCAL_PREFER_VENDOR_APEX),true) +PRODUCT_COPY_FILES += \ + frameworks/native/data/etc/android.hardware.vulkan.level-0.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.vulkan.level.xml \ + frameworks/native/data/etc/android.hardware.vulkan.version-1_0_3.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.vulkan.version.xml \ + frameworks/native/data/etc/android.software.vulkan.deqp.level-2023-03-01.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.software.vulkan.deqp.level.xml \ + frameworks/native/data/etc/android.software.opengles.deqp.level-2023-03-01.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.software.opengles.deqp.level.xml +endif +endif + # # Hardware Composer HAL # diff --git a/shared/phone/device_vendor.mk b/shared/phone/device_vendor.mk index cecf564b4..f6424b802 100644 --- a/shared/phone/device_vendor.mk +++ b/shared/phone/device_vendor.mk @@ -16,11 +16,15 @@ PRODUCT_MANIFEST_FILES += device/google/cuttlefish/shared/config/product_manifest.xml SYSTEM_EXT_MANIFEST_FILES += device/google/cuttlefish/shared/config/system_ext_manifest.xml -# Permission to access services for phone -LOCAL_HARDWARE_PERMISSIONS_PRODUCT_PACKAGE := com.google.cf_handheld.hardware.core_permissions $(call inherit-product, $(SRC_TARGET_DIR)/product/handheld_vendor.mk) +ifneq ($(LOCAL_PREFER_VENDOR_APEX),true) +PRODUCT_COPY_FILES += \ + frameworks/native/data/etc/android.software.sip.voip.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.software.sip.voip.xml \ + frameworks/native/data/etc/handheld_core_hardware.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/handheld_core_hardware.xml +endif + $(call inherit-product, frameworks/native/build/phone-xhdpi-2048-dalvik-heap.mk) $(call inherit-product, device/google/cuttlefish/shared/biometrics_face/device_vendor.mk) $(call inherit-product, device/google/cuttlefish/shared/biometrics_fingerprint/device_vendor.mk) @@ -43,9 +47,24 @@ PRODUCT_EXTRA_VNDK_VERSIONS := 30 31 32 33 34 TARGET_PRODUCT_PROP := $(LOCAL_PATH)/product.prop +ifneq ($(LOCAL_PREFER_VENDOR_APEX),true) +PRODUCT_COPY_FILES += \ + frameworks/native/data/etc/android.hardware.faketouch.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.faketouch.xml \ + + ifneq ($(TARGET_DISABLE_BIOMETRICS_FACE),true) + PRODUCT_COPY_FILES += \ + frameworks/native/data/etc/android.hardware.biometrics.face.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.biometrics.face.xml \ + + endif +endif + DEVICE_PACKAGE_OVERLAYS += device/google/cuttlefish/shared/phone/overlay # Runtime Resource Overlays +ifeq ($(LOCAL_PREFER_VENDOR_APEX),true) PRODUCT_PACKAGES += com.google.aosp_cf_phone.rros +else +PRODUCT_PACKAGES += cuttlefish_phone_overlay_frameworks_base_core +endif TARGET_BOARD_INFO_FILE ?= device/google/cuttlefish/shared/phone/android-info.txt diff --git a/shared/reboot_escrow/device_vendor.mk b/shared/reboot_escrow/device_vendor.mk index e977c9813..cc58fe884 100644 --- a/shared/reboot_escrow/device_vendor.mk +++ b/shared/reboot_escrow/device_vendor.mk @@ -14,6 +14,11 @@ # limitations under the License. # +ifneq ($(LOCAL_PREFER_VENDOR_APEX),true) +PRODUCT_COPY_FILES += \ + frameworks/native/data/etc/android.hardware.reboot_escrow.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.reboot_escrow.xml +endif + PRODUCT_VENDOR_PROPERTIES += \ ro.rebootescrow.device=/dev/block/pmem0 diff --git a/shared/sensors/device_vendor.mk b/shared/sensors/device_vendor.mk index 99a56cfd7..3bee726bd 100644 --- a/shared/sensors/device_vendor.mk +++ b/shared/sensors/device_vendor.mk @@ -14,11 +14,29 @@ # limitations under the License. # + +ifneq ($(LOCAL_SENSOR_FILE_OVERRIDES),true) +ifneq ($(LOCAL_PREFER_VENDOR_APEX),true) + PRODUCT_COPY_FILES += \ + frameworks/native/data/etc/android.hardware.sensor.ambient_temperature.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.sensor.ambient_temperature.xml \ + frameworks/native/data/etc/android.hardware.sensor.barometer.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.sensor.barometer.xml \ + frameworks/native/data/etc/android.hardware.sensor.gyroscope.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.sensor.gyroscope.xml \ + frameworks/native/data/etc/android.hardware.sensor.hinge_angle.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.sensor.hinge_angle.xml \ + frameworks/native/data/etc/android.hardware.sensor.light.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.sensor.light.xml \ + frameworks/native/data/etc/android.hardware.sensor.proximity.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.sensor.proximity.xml \ + frameworks/native/data/etc/android.hardware.sensor.relative_humidity.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.sensor.relative_humidity.xml +endif +endif + # # Sensors # ifeq ($(LOCAL_SENSOR_PRODUCT_PACKAGE),) +ifeq ($(LOCAL_PREFER_VENDOR_APEX),true) LOCAL_SENSOR_PRODUCT_PACKAGE := com.android.hardware.sensors +else + LOCAL_SENSOR_PRODUCT_PACKAGE := android.hardware.sensors-service.example +endif endif PRODUCT_PACKAGES += \ $(LOCAL_SENSOR_PRODUCT_PACKAGE) diff --git a/shared/slim/device_vendor.mk b/shared/slim/device_vendor.mk index dc5b49edf..c5e535c04 100644 --- a/shared/slim/device_vendor.mk +++ b/shared/slim/device_vendor.mk @@ -19,8 +19,12 @@ SYSTEM_EXT_MANIFEST_FILES += device/google/cuttlefish/shared/config/system_ext_m $(call inherit-product, $(SRC_TARGET_DIR)/product/handheld_vendor.mk) -# Permission to access services -LOCAL_HARDWARE_PERMISSIONS_PRODUCT_PACKAGE := com.google.cf_handheld_slim.hardware.core_permissions +ifneq ($(LOCAL_PREFER_VENDOR_APEX),true) +PRODUCT_COPY_FILES += \ + frameworks/native/data/etc/android.software.sip.voip.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.software.sip.voip.xml \ + frameworks/native/data/etc/handheld_core_hardware.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/handheld_core_hardware.xml +PRODUCT_PACKAGES += slim_excluded_hardware.prebuilt.xml +endif $(call inherit-product, frameworks/native/build/phone-xhdpi-2048-dalvik-heap.mk) $(call inherit-product, device/google/cuttlefish/shared/biometrics_face/device_vendor.mk) @@ -42,9 +46,21 @@ $(call inherit-product, device/google/cuttlefish/shared/device.mk) PRODUCT_VENDOR_PROPERTIES += \ debug.hwui.drawing_enabled=0 \ +ifneq ($(LOCAL_PREFER_VENDOR_APEX),true) +PRODUCT_COPY_FILES += \ + frameworks/native/data/etc/android.hardware.faketouch.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.faketouch.xml \ + +endif + # Runtime Resource Overlays +ifeq ($(LOCAL_PREFER_VENDOR_APEX),true) PRODUCT_PACKAGES += \ com.google.aosp_cf_phone.rros \ com.google.aosp_cf_slim.rros +else +PRODUCT_PACKAGES += \ + cuttlefish_phone_overlay_frameworks_base_core \ + slim_overlay_frameworks_base_core +endif TARGET_BOARD_INFO_FILE ?= device/google/cuttlefish/shared/slim/android-info.txt diff --git a/shared/telephony/device_vendor.mk b/shared/telephony/device_vendor.mk index 873bb468a..bd78cc6d0 100644 --- a/shared/telephony/device_vendor.mk +++ b/shared/telephony/device_vendor.mk @@ -27,6 +27,21 @@ PRODUCT_VENDOR_PROPERTIES += \ ro.com.android.dataroaming=true \ ro.telephony.default_network=9 \ +ifeq ($(LOCAL_PREFER_VENDOR_APEX),true) PRODUCT_PACKAGES += com.google.cf.rild +else +# If downstream target provides its own RILD, set TARGET_USES_CF_RILD := false +# If the target prefers vendor APEX, this feature is not supported +TARGET_USES_CF_RILD ?= true +ifeq ($(TARGET_USES_CF_RILD),true) +PRODUCT_PACKAGES += \ + libcuttlefish-ril-2 \ + libcuttlefish-rild +endif +PRODUCT_COPY_FILES += \ + frameworks/native/data/etc/android.hardware.telephony.gsm.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.telephony.gsm.xml \ + frameworks/native/data/etc/android.hardware.telephony.ims.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.telephony.ims.xml \ + frameworks/native/data/etc/android.hardware.telephony.satellite.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.telephony.satellite.xml +endif # if not LOCAL_PREFER_VENDOR_APEX endif # if not TARGET_NO_TELEPHONY diff --git a/shared/tv/device_vendor.mk b/shared/tv/device_vendor.mk index de7a98d8a..c6ca9a5d8 100644 --- a/shared/tv/device_vendor.mk +++ b/shared/tv/device_vendor.mk @@ -34,6 +34,10 @@ PRODUCT_VENDOR_PROPERTIES += \ # Extend cuttlefish common sepolicy with tv-specific functionality BOARD_SEPOLICY_DIRS += device/google/cuttlefish/shared/tv/sepolicy/vendor +ifneq ($(LOCAL_PREFER_VENDOR_APEX),true) + PRODUCT_PACKAGES += tv_excluded_hardware.prebuilt.xml +endif + PRODUCT_COPY_FILES += \ frameworks/native/data/etc/android.hardware.camera.external.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.camera.external.xml \ device/google/cuttlefish/shared/config/media_codecs_google_tv.xml:$(TARGET_COPY_OUT_VENDOR)/etc/media_codecs_google_tv.xml \ diff --git a/vsoc_arm64_only/slim/aosp_cf.mk b/vsoc_arm64_only/slim/aosp_cf.mk index 46cdb1a25..d118163fe 100644 --- a/vsoc_arm64_only/slim/aosp_cf.mk +++ b/vsoc_arm64_only/slim/aosp_cf.mk @@ -37,6 +37,7 @@ PRODUCT_PACKAGES += FakeSystemApp # # All components inherited here go to vendor image # +LOCAL_PREFER_VENDOR_APEX := true $(call inherit-product, device/google/cuttlefish/shared/slim/device_vendor.mk) # @@ -44,6 +45,14 @@ $(call inherit-product, device/google/cuttlefish/shared/slim/device_vendor.mk) # $(call inherit-product, device/google/cuttlefish/vsoc_arm64/bootloader.mk) +# Exclude features that are not available on AOSP devices. +ifeq ($(LOCAL_PREFER_VENDOR_APEX),true) +PRODUCT_PACKAGES += com.google.aosp_cf_slim.hardware.core_permissions +else +PRODUCT_COPY_FILES += \ + frameworks/native/data/etc/aosp_excluded_hardware.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/aosp_excluded_hardware.xml +endif + PRODUCT_NAME := aosp_cf_arm64_slim PRODUCT_DEVICE := vsoc_arm64_only PRODUCT_MANUFACTURER := Google diff --git a/vsoc_riscv64/phone/aosp_cf.mk b/vsoc_riscv64/phone/aosp_cf.mk index 0f0d3f810..bc2af1f3f 100644 --- a/vsoc_riscv64/phone/aosp_cf.mk +++ b/vsoc_riscv64/phone/aosp_cf.mk @@ -36,6 +36,7 @@ $(call inherit-product, $(SRC_TARGET_DIR)/product/aosp_product.mk) # # All components inherited here go to vendor image # +LOCAL_PREFER_VENDOR_APEX := true $(call inherit-product, device/google/cuttlefish/shared/phone/device_vendor.mk) PRODUCT_ENFORCE_MAC80211_HWSIM := false @@ -48,6 +49,14 @@ PRODUCT_ENFORCE_MAC80211_HWSIM := false # $(call inherit-product, device/google/cuttlefish/vsoc_riscv64/bootloader.mk) +# Exclude features that are not available on AOSP devices. +ifeq ($(LOCAL_PREFER_VENDOR_APEX),true) +PRODUCT_PACKAGES += com.google.aosp_cf_phone.hardware.core_permissions +else +PRODUCT_COPY_FILES += \ + frameworks/native/data/etc/aosp_excluded_hardware.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/aosp_excluded_hardware.xml +endif + # TODO(b/206676167): This property can be removed when renderscript is removed. # Prevents framework from attempting to load renderscript libraries, which are # not supported on this architecture. diff --git a/vsoc_riscv64/slim/aosp_cf.mk b/vsoc_riscv64/slim/aosp_cf.mk index 5bddf1824..b85b738fa 100644 --- a/vsoc_riscv64/slim/aosp_cf.mk +++ b/vsoc_riscv64/slim/aosp_cf.mk @@ -37,6 +37,7 @@ PRODUCT_PACKAGES += FakeSystemApp # # All components inherited here go to vendor image # +LOCAL_PREFER_VENDOR_APEX := true $(call inherit-product, device/google/cuttlefish/shared/slim/device_vendor.mk) PRODUCT_ENFORCE_MAC80211_HWSIM := false diff --git a/vsoc_x86_64/phone/aosp_cf.mk b/vsoc_x86_64/phone/aosp_cf.mk index b8632394f..f9e8d621a 100644 --- a/vsoc_x86_64/phone/aosp_cf.mk +++ b/vsoc_x86_64/phone/aosp_cf.mk @@ -36,6 +36,7 @@ $(call inherit-product, $(SRC_TARGET_DIR)/product/aosp_product.mk) # # All components inherited here go to vendor image # +LOCAL_PREFER_VENDOR_APEX := true $(call inherit-product, device/google/cuttlefish/shared/phone/device_vendor.mk) # Nested virtualization support @@ -46,6 +47,14 @@ $(call inherit-product, packages/modules/Virtualization/apex/product_packages.mk # $(call inherit-product, device/google/cuttlefish/vsoc_x86_64/bootloader.mk) +# Exclude features that are not available on AOSP devices. +ifeq ($(LOCAL_PREFER_VENDOR_APEX),true) +PRODUCT_PACKAGES += com.google.aosp_cf_phone.hardware.core_permissions +else +PRODUCT_COPY_FILES += \ + frameworks/native/data/etc/aosp_excluded_hardware.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/aosp_excluded_hardware.xml +endif + PRODUCT_NAME := aosp_cf_x86_64_phone PRODUCT_DEVICE := vsoc_x86_64 PRODUCT_MANUFACTURER := Google diff --git a/vsoc_x86_64_only/slim/aosp_cf.mk b/vsoc_x86_64_only/slim/aosp_cf.mk index 227e662e7..536a4b7f5 100644 --- a/vsoc_x86_64_only/slim/aosp_cf.mk +++ b/vsoc_x86_64_only/slim/aosp_cf.mk @@ -37,6 +37,7 @@ PRODUCT_PACKAGES += FakeSystemApp # # All components inherited here go to vendor image # +LOCAL_PREFER_VENDOR_APEX := true $(call inherit-product, device/google/cuttlefish/shared/slim/device_vendor.mk) # @@ -44,6 +45,14 @@ $(call inherit-product, device/google/cuttlefish/shared/slim/device_vendor.mk) # $(call inherit-product, device/google/cuttlefish/vsoc_x86_64/bootloader.mk) +# Exclude features that are not available on AOSP devices. +ifeq ($(LOCAL_PREFER_VENDOR_APEX),true) +PRODUCT_PACKAGES += com.google.aosp_cf_slim.hardware.core_permissions +else +PRODUCT_COPY_FILES += \ + frameworks/native/data/etc/aosp_excluded_hardware.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/aosp_excluded_hardware.xml +endif + PRODUCT_NAME := aosp_cf_x86_64_slim PRODUCT_DEVICE := vsoc_x86_64_only PRODUCT_MANUFACTURER := Google -- cgit v1.2.3 From c7cf8af4d196a5c3efe78a9c9acb48e5a4632150 Mon Sep 17 00:00:00 2001 From: Devin Moore Date: Wed, 20 Sep 2023 19:37:12 +0000 Subject: Fix up the Cuttlefish camera vsock impl Moving away from the old HIDL mapper4 required changes to HandleImporter in the camera helper library. It is still backward compatible and adds support for the new mapper5. This particular library isn't actually used anywhere (and can't be included in Cuttlefish because it doesn't implement the new AIDL interface). But it is built with check builds in presubmits so it needed to be updated. atest CtsCameraTestCases CtsAppOpsTestCases Bug: 285605852 Bug: 300115646 Change-Id: I343d187fc5de98513d6c5883d149eab11e41c78f --- guest/hals/camera/Android.bp | 1 + guest/hals/camera/cached_stream_buffer.cpp | 19 +++++++++++++++++-- guest/hals/camera/cached_stream_buffer.h | 4 ++++ 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/guest/hals/camera/Android.bp b/guest/hals/camera/Android.bp index ce4c46c1e..c6c87329f 100644 --- a/guest/hals/camera/Android.bp +++ b/guest/hals/camera/Android.bp @@ -77,6 +77,7 @@ cc_library_shared { "libhidlbase", "liblog", "libutils", + "libui", "libvsock_utils", "libcuttlefish_fs", "libjsoncpp", diff --git a/guest/hals/camera/cached_stream_buffer.cpp b/guest/hals/camera/cached_stream_buffer.cpp index ff692c7dc..7e99581aa 100644 --- a/guest/hals/camera/cached_stream_buffer.cpp +++ b/guest/hals/camera/cached_stream_buffer.cpp @@ -96,8 +96,23 @@ YCbCrLayout CachedStreamBuffer::acquireAsYUV(int32_t width, int32_t height, acquire_fence_ = -1; } } - IMapper::Rect region{0, 0, width, height}; - return g_importer.lockYCbCr(buffer_, GRALLOC_USAGE_SW_WRITE_OFTEN, region); + android::Rect region{0, 0, width, height}; + android_ycbcr result = + g_importer.lockYCbCr(buffer_, GRALLOC_USAGE_SW_WRITE_OFTEN, region); + if (result.ystride > UINT32_MAX || result.cstride > UINT32_MAX || + result.chroma_step > UINT32_MAX) { + ALOGE( + "%s: lockYCbCr failed. Unexpected values! ystride: %zu cstride: %zu " + "chroma_step: %zu", + __FUNCTION__, result.ystride, result.cstride, result.chroma_step); + return {}; + } + return {.y = result.y, + .cb = result.cb, + .cr = result.cr, + .yStride = static_cast(result.ystride), + .cStride = static_cast(result.cstride), + .chromaStep = static_cast(result.chroma_step)}; } void* CachedStreamBuffer::acquireAsBlob(int32_t size, int timeout_ms) { diff --git a/guest/hals/camera/cached_stream_buffer.h b/guest/hals/camera/cached_stream_buffer.h index 09a404738..19d738d2b 100644 --- a/guest/hals/camera/cached_stream_buffer.h +++ b/guest/hals/camera/cached_stream_buffer.h @@ -15,12 +15,16 @@ */ #pragma once #include +#include +#include +#include #include "HandleImporter.h" namespace android::hardware::camera::device::V3_4::implementation { using ::android::hardware::camera::common::V1_0::helper::HandleImporter; using ::android::hardware::camera::device::V3_2::StreamBuffer; +using ::android::hardware::graphics::mapper::V2_0::YCbCrLayout; // Small wrapper for allocating/freeing native handles class ReleaseFence { -- cgit v1.2.3 From 5c4285ac0517e57aaa94e8ae6f24b296ed1b6c2b Mon Sep 17 00:00:00 2001 From: Yu Shan Date: Wed, 23 Aug 2023 17:34:45 -0700 Subject: Use remoteaccess ref impl V2. Test: Build Bug: 297271235 Change-Id: I5602cce730ab574c2cd7faf2653e0cae9c5a8457 --- shared/auto/device_vendor.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shared/auto/device_vendor.mk b/shared/auto/device_vendor.mk index 1c134e897..3a5e2c3a7 100644 --- a/shared/auto/device_vendor.mk +++ b/shared/auto/device_vendor.mk @@ -76,7 +76,7 @@ endif PRODUCT_PACKAGES += $(LOCAL_VHAL_PRODUCT_PACKAGE) # Remote access HAL -PRODUCT_PACKAGES += android.hardware.automotive.remoteaccess@V1-default-service +PRODUCT_PACKAGES += android.hardware.automotive.remoteaccess@V2-default-service # Broadcast Radio PRODUCT_PACKAGES += android.hardware.broadcastradio-service.default -- cgit v1.2.3 From 96dcb4dfd46a6ded35695bd897faf256e8f95cdd Mon Sep 17 00:00:00 2001 From: Shivangi Dubey Date: Wed, 27 Sep 2023 11:32:57 +0000 Subject: Enable Fold Lock Behavior in config.xml Enable Fold Lock Behavior in config.xml and let it be controlled by sysprop flag 'persist.fold_lock_setting_enabled'. Bug: 298200843 Test: Flash the device with this build. * Manually check if the setting accessible. Change-Id: Ia9c2aa4abaf1342c7a29a80657312331f00f1535 --- shared/overlays/foldable/core/res/values/config.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shared/overlays/foldable/core/res/values/config.xml b/shared/overlays/foldable/core/res/values/config.xml index 6a2fdd5d4..0ac21a53e 100644 --- a/shared/overlays/foldable/core/res/values/config.xml +++ b/shared/overlays/foldable/core/res/values/config.xml @@ -76,7 +76,7 @@ 34px - false + true -- cgit v1.2.3 From 0f3b0fccf133cd8c2ddde9164c9d0978b84e7a1e Mon Sep 17 00:00:00 2001 From: Michael Stokes Date: Mon, 2 Oct 2023 09:56:59 +0000 Subject: Revert "Fix up the Cuttlefish camera vsock impl" Revert submission 24747509-camera_fail2 Reason for revert: DroidMonitor-triggered revert due to breakage b/302990858. This may cause CtsAppOpsTestCases b/300115646 to fail again, unfortunately (b/300115646). Bug: 302990858 Reverted changes: /q/submissionid:24747509-camera_fail2 Change-Id: Idaccc7239176a11c3627c0b5cf6004bcb13dc2ca --- guest/hals/camera/Android.bp | 1 - guest/hals/camera/cached_stream_buffer.cpp | 19 ++----------------- guest/hals/camera/cached_stream_buffer.h | 4 ---- 3 files changed, 2 insertions(+), 22 deletions(-) diff --git a/guest/hals/camera/Android.bp b/guest/hals/camera/Android.bp index c6c87329f..ce4c46c1e 100644 --- a/guest/hals/camera/Android.bp +++ b/guest/hals/camera/Android.bp @@ -77,7 +77,6 @@ cc_library_shared { "libhidlbase", "liblog", "libutils", - "libui", "libvsock_utils", "libcuttlefish_fs", "libjsoncpp", diff --git a/guest/hals/camera/cached_stream_buffer.cpp b/guest/hals/camera/cached_stream_buffer.cpp index 7e99581aa..ff692c7dc 100644 --- a/guest/hals/camera/cached_stream_buffer.cpp +++ b/guest/hals/camera/cached_stream_buffer.cpp @@ -96,23 +96,8 @@ YCbCrLayout CachedStreamBuffer::acquireAsYUV(int32_t width, int32_t height, acquire_fence_ = -1; } } - android::Rect region{0, 0, width, height}; - android_ycbcr result = - g_importer.lockYCbCr(buffer_, GRALLOC_USAGE_SW_WRITE_OFTEN, region); - if (result.ystride > UINT32_MAX || result.cstride > UINT32_MAX || - result.chroma_step > UINT32_MAX) { - ALOGE( - "%s: lockYCbCr failed. Unexpected values! ystride: %zu cstride: %zu " - "chroma_step: %zu", - __FUNCTION__, result.ystride, result.cstride, result.chroma_step); - return {}; - } - return {.y = result.y, - .cb = result.cb, - .cr = result.cr, - .yStride = static_cast(result.ystride), - .cStride = static_cast(result.cstride), - .chromaStep = static_cast(result.chroma_step)}; + IMapper::Rect region{0, 0, width, height}; + return g_importer.lockYCbCr(buffer_, GRALLOC_USAGE_SW_WRITE_OFTEN, region); } void* CachedStreamBuffer::acquireAsBlob(int32_t size, int timeout_ms) { diff --git a/guest/hals/camera/cached_stream_buffer.h b/guest/hals/camera/cached_stream_buffer.h index 19d738d2b..09a404738 100644 --- a/guest/hals/camera/cached_stream_buffer.h +++ b/guest/hals/camera/cached_stream_buffer.h @@ -15,16 +15,12 @@ */ #pragma once #include -#include -#include -#include #include "HandleImporter.h" namespace android::hardware::camera::device::V3_4::implementation { using ::android::hardware::camera::common::V1_0::helper::HandleImporter; using ::android::hardware::camera::device::V3_2::StreamBuffer; -using ::android::hardware::graphics::mapper::V2_0::YCbCrLayout; // Small wrapper for allocating/freeing native handles class ReleaseFence { -- cgit v1.2.3 From cfba6318a9a036178981b626aeebbad52ba77d51 Mon Sep 17 00:00:00 2001 From: Devin Moore Date: Mon, 2 Oct 2023 15:55:11 +0000 Subject: Revert^2 "Fix up the Cuttlefish camera vsock impl" 0f3b0fccf133cd8c2ddde9164c9d0978b84e7a1e Change-Id: I39d60b11ef6ceef9029ebc9bb387a50ea84c930e --- guest/hals/camera/Android.bp | 1 + guest/hals/camera/cached_stream_buffer.cpp | 19 +++++++++++++++++-- guest/hals/camera/cached_stream_buffer.h | 4 ++++ 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/guest/hals/camera/Android.bp b/guest/hals/camera/Android.bp index ce4c46c1e..c6c87329f 100644 --- a/guest/hals/camera/Android.bp +++ b/guest/hals/camera/Android.bp @@ -77,6 +77,7 @@ cc_library_shared { "libhidlbase", "liblog", "libutils", + "libui", "libvsock_utils", "libcuttlefish_fs", "libjsoncpp", diff --git a/guest/hals/camera/cached_stream_buffer.cpp b/guest/hals/camera/cached_stream_buffer.cpp index ff692c7dc..7e99581aa 100644 --- a/guest/hals/camera/cached_stream_buffer.cpp +++ b/guest/hals/camera/cached_stream_buffer.cpp @@ -96,8 +96,23 @@ YCbCrLayout CachedStreamBuffer::acquireAsYUV(int32_t width, int32_t height, acquire_fence_ = -1; } } - IMapper::Rect region{0, 0, width, height}; - return g_importer.lockYCbCr(buffer_, GRALLOC_USAGE_SW_WRITE_OFTEN, region); + android::Rect region{0, 0, width, height}; + android_ycbcr result = + g_importer.lockYCbCr(buffer_, GRALLOC_USAGE_SW_WRITE_OFTEN, region); + if (result.ystride > UINT32_MAX || result.cstride > UINT32_MAX || + result.chroma_step > UINT32_MAX) { + ALOGE( + "%s: lockYCbCr failed. Unexpected values! ystride: %zu cstride: %zu " + "chroma_step: %zu", + __FUNCTION__, result.ystride, result.cstride, result.chroma_step); + return {}; + } + return {.y = result.y, + .cb = result.cb, + .cr = result.cr, + .yStride = static_cast(result.ystride), + .cStride = static_cast(result.cstride), + .chromaStep = static_cast(result.chroma_step)}; } void* CachedStreamBuffer::acquireAsBlob(int32_t size, int timeout_ms) { diff --git a/guest/hals/camera/cached_stream_buffer.h b/guest/hals/camera/cached_stream_buffer.h index 09a404738..19d738d2b 100644 --- a/guest/hals/camera/cached_stream_buffer.h +++ b/guest/hals/camera/cached_stream_buffer.h @@ -15,12 +15,16 @@ */ #pragma once #include +#include +#include +#include #include "HandleImporter.h" namespace android::hardware::camera::device::V3_4::implementation { using ::android::hardware::camera::common::V1_0::helper::HandleImporter; using ::android::hardware::camera::device::V3_2::StreamBuffer; +using ::android::hardware::graphics::mapper::V2_0::YCbCrLayout; // Small wrapper for allocating/freeing native handles class ReleaseFence { -- cgit v1.2.3 From 4724df7ced7c4865f2eaeb75d5ef1024a811419e Mon Sep 17 00:00:00 2001 From: Eric Jeong Date: Fri, 22 Sep 2023 12:57:03 -0700 Subject: Exclude power policy from hal_implementation test - power policy is not expected to be installed on phone. Bug: 301641429 Test: atest hal_implementation_test Change-Id: I3e1d356e2e384d8534ea026435232789e9e26ef4 --- tests/hal/hal_implementation_test.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/hal/hal_implementation_test.cpp b/tests/hal/hal_implementation_test.cpp index c6c0b1baf..6299ee9f7 100644 --- a/tests/hal/hal_implementation_test.cpp +++ b/tests/hal/hal_implementation_test.cpp @@ -165,6 +165,7 @@ static const std::set kAutomotiveOnlyAidl = { */ "android.automotive.watchdog", "android.frameworks.automotive.display", + "android.frameworks.automotive.powerpolicy", "android.frameworks.automotive.powerpolicy.internal", "android.frameworks.automotive.telemetry", "android.hardware.automotive.audiocontrol", @@ -262,7 +263,6 @@ static const std::vector kKnownMissingAidl = { {"android.automotive.computepipe.registry.", 2, 273549907}, {"android.automotive.computepipe.runner.", 2, 273549907}, - {"android.frameworks.automotive.powerpolicy.", 2, 274160980}, {"android.hardware.automotive.evs.", 2, 274162534}, }; -- cgit v1.2.3 From b5ce559d4cc07fd9af37b3a8361d5753d9bf4120 Mon Sep 17 00:00:00 2001 From: "A. Cody Schuffelen" Date: Mon, 1 May 2023 12:31:47 -0700 Subject: Support legacy multi-device launches with socket waiting In legacy multi-device launches, `wmediumd_api_server_socket` is not set because the device is not launching wmediumd, because the file pointed to by `vhost_user_mac80211_hwsim` is provided by a different `launch_cvd` invocation. Test: legacy multi device launch Bug: 279044681 Bug: 293148635 Change-Id: I8aa015e00edb2303ae4451c847c81398a9fe812f Merged-In: I8aa015e00edb2303ae4451c847c81398a9fe812f (cherry picked from commit ac72f5a499051136e8feae685e9c3cdba1a44c86) --- host/commands/run_cvd/launch/wmediumd_server.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/host/commands/run_cvd/launch/wmediumd_server.cpp b/host/commands/run_cvd/launch/wmediumd_server.cpp index 4c5ec0fd8..90a6ca2d4 100644 --- a/host/commands/run_cvd/launch/wmediumd_server.cpp +++ b/host/commands/run_cvd/launch/wmediumd_server.cpp @@ -110,7 +110,9 @@ class ValidateWmediumdService : public SetupFeature { private: std::unordered_set Dependencies() const override { return {}; } Result ResultSetup() override { - CF_EXPECT(WaitForUnixSocket(config_.wmediumd_api_server_socket(), 30)); + if (!config_.wmediumd_api_server_socket().empty()) { + CF_EXPECT(WaitForUnixSocket(config_.wmediumd_api_server_socket(), 30)); + } CF_EXPECT(WaitForUnixSocket(config_.vhost_user_mac80211_hwsim(), 30)); return {}; -- cgit v1.2.3 From 535171a4f1fbcc1abe13a9fb721adc5bc8240b25 Mon Sep 17 00:00:00 2001 From: Roshan Pius Date: Mon, 9 Oct 2023 19:56:18 +0000 Subject: cuttlefish: Replace NFC app with NFC apex Bug: 303286040 Test: Compiles (cherry picked from https://android-review.googlesource.com/q/commit:d01beb6ea333ab91444742446ac7c5f57a235b6a) Merged-In: I8ff035659e7af99411871125c3f130a25d3a936d Change-Id: I8ff035659e7af99411871125c3f130a25d3a936d --- shared/wear/aosp_system.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shared/wear/aosp_system.mk b/shared/wear/aosp_system.mk index e1b076822..459b3d8bb 100644 --- a/shared/wear/aosp_system.mk +++ b/shared/wear/aosp_system.mk @@ -36,7 +36,7 @@ PRODUCT_PACKAGES += \ librs_jni \ ManagedProvisioning \ MmsService \ - NfcNci \ + com.android.nfcservices \ netutils-wrapper-1.0 \ screenrecord \ StatementService \ -- cgit v1.2.3 From 9ac0a4debb4c1ea2fad5dd99c77bde8b580d1cc2 Mon Sep 17 00:00:00 2001 From: Devin Moore Date: Tue, 10 Oct 2023 21:33:04 +0000 Subject: Revert^2 "Remove HIDL graphics.mapper service from Cuttlefish" 5777e89396969b33b0cdf34e6f2e960806d58933 This topic fixes the dependencies that caused the inital revert (b/300115646): https://googleplex-android-review.git.corp.google.com/q/topic:%22camera_fail2%22 Test: CtsCameraTestCases CtsAppOpsTestCases Bug: 285605852 Change-Id: I8fe67ae6a63d87a2eb7cf174ff0d25fe961d7085 --- shared/graphics/device_vendor.mk | 1 - tests/hal/hal_implementation_test.cpp | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/shared/graphics/device_vendor.mk b/shared/graphics/device_vendor.mk index b5f410281..a4768b01f 100644 --- a/shared/graphics/device_vendor.mk +++ b/shared/graphics/device_vendor.mk @@ -82,5 +82,4 @@ PRODUCT_VENDOR_PROPERTIES += \ # Gralloc implementation PRODUCT_PACKAGES += \ android.hardware.graphics.allocator-service.minigbm \ - android.hardware.graphics.mapper@4.0-impl.minigbm \ mapper.minigbm diff --git a/tests/hal/hal_implementation_test.cpp b/tests/hal/hal_implementation_test.cpp index c6c0b1baf..e34ffc142 100644 --- a/tests/hal/hal_implementation_test.cpp +++ b/tests/hal/hal_implementation_test.cpp @@ -98,6 +98,7 @@ static const std::set kKnownMissingHidl = { "android.hardware.graphics.composer@2.4", // converted to AIDL, see b/193240715 "android.hardware.graphics.mapper@2.1", "android.hardware.graphics.mapper@3.0", + "android.hardware.graphics.mapper@4.0", // converted to Stable C, see b/205761028 "android.hardware.health.storage@1.0", // converted to AIDL, see b/177470478 "android.hardware.health@2.1", // converted to AIDL, see b/177269435 "android.hardware.input.classifier@1.0", // converted to AIDL, see b/205761620 -- cgit v1.2.3 From 25e6b2f9866affbcc00bc965a6254010c76a4ad6 Mon Sep 17 00:00:00 2001 From: Kyle Holm Date: Fri, 6 Oct 2023 17:15:35 -0700 Subject: Change cuttlefish wear ext services package This change makes the wear shared overlay higher priority than GoogleConfigOverlay. This is needed to get the ext services package correct for cuttlefish Bug: 288584197 Test: Built and flashed. Booted and Verified ExtServices package and its apex files were installed on device. Change-Id: I8dbd2e7f0bd1a7a17c6174e2ff5ed1f09b0a0c83 --- shared/wear/overlays/core/Android.bp | 2 +- shared/wear/overlays/core/res/values/config.xml | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/shared/wear/overlays/core/Android.bp b/shared/wear/overlays/core/Android.bp index daaa48aa4..31cba54ed 100644 --- a/shared/wear/overlays/core/Android.bp +++ b/shared/wear/overlays/core/Android.bp @@ -19,5 +19,5 @@ package { runtime_resource_overlay { name: "cuttlefish_wear_overlay_frameworks_base_core", - soc_specific: true, + product_specific: true, } diff --git a/shared/wear/overlays/core/res/values/config.xml b/shared/wear/overlays/core/res/values/config.xml index 8e5b62e8a..1314b97fd 100644 --- a/shared/wear/overlays/core/res/values/config.xml +++ b/shared/wear/overlays/core/res/values/config.xml @@ -121,4 +121,7 @@ 1 true + + + android.ext.services -- cgit v1.2.3 From 68de7976796d25b488157847a536f9677c3af21e Mon Sep 17 00:00:00 2001 From: Devin Moore Date: Thu, 12 Oct 2023 00:10:09 +0000 Subject: Revert "Revert^2 "Remove HIDL graphics.mapper service from Cuttl..." Revert submission 25010967-revert-24736974-revert-24707439-mapper5_cf-REMQWOTVGG-JRJETIBTHL Reason for revert: b/304843606 the sensors VTS tests require mapper4. Reverted changes: /q/submissionid:25010967-revert-24736974-revert-24707439-mapper5_cf-REMQWOTVGG-JRJETIBTHL Change-Id: I6f969ac3d370c2ddca34bd98c99c01cf6c9dc254 --- shared/graphics/device_vendor.mk | 1 + tests/hal/hal_implementation_test.cpp | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/shared/graphics/device_vendor.mk b/shared/graphics/device_vendor.mk index a4768b01f..b5f410281 100644 --- a/shared/graphics/device_vendor.mk +++ b/shared/graphics/device_vendor.mk @@ -82,4 +82,5 @@ PRODUCT_VENDOR_PROPERTIES += \ # Gralloc implementation PRODUCT_PACKAGES += \ android.hardware.graphics.allocator-service.minigbm \ + android.hardware.graphics.mapper@4.0-impl.minigbm \ mapper.minigbm diff --git a/tests/hal/hal_implementation_test.cpp b/tests/hal/hal_implementation_test.cpp index e34ffc142..c6c0b1baf 100644 --- a/tests/hal/hal_implementation_test.cpp +++ b/tests/hal/hal_implementation_test.cpp @@ -98,7 +98,6 @@ static const std::set kKnownMissingHidl = { "android.hardware.graphics.composer@2.4", // converted to AIDL, see b/193240715 "android.hardware.graphics.mapper@2.1", "android.hardware.graphics.mapper@3.0", - "android.hardware.graphics.mapper@4.0", // converted to Stable C, see b/205761028 "android.hardware.health.storage@1.0", // converted to AIDL, see b/177470478 "android.hardware.health@2.1", // converted to AIDL, see b/177269435 "android.hardware.input.classifier@1.0", // converted to AIDL, see b/205761620 -- cgit v1.2.3 From 22f82308762977c4fdd923b1f2558b3865285094 Mon Sep 17 00:00:00 2001 From: Ken Yang Date: Fri, 13 Oct 2023 03:29:35 +0000 Subject: SELinux: fix the wireless_charger denials Bug: 305026835 Change-Id: Ie46d7847c6bef5bc886c06d52a826512e9971182 Signed-off-by: Ken Yang --- shared/sepolicy/vendor/google/hal_wireless_charger.te | 7 +++++++ shared/sepolicy/vendor/google/system_app.te | 4 +++- shared/sepolicy/vendor/platform_app.te | 4 ++++ shared/sepolicy/vendor/service.te | 3 +++ shared/sepolicy/vendor/service_contexts | 2 ++ 5 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 shared/sepolicy/vendor/google/hal_wireless_charger.te diff --git a/shared/sepolicy/vendor/google/hal_wireless_charger.te b/shared/sepolicy/vendor/google/hal_wireless_charger.te new file mode 100644 index 000000000..aee09411f --- /dev/null +++ b/shared/sepolicy/vendor/google/hal_wireless_charger.te @@ -0,0 +1,7 @@ +type hal_wireless_charger, domain; +type hal_wireless_charger_exec, exec_type, vendor_file_type, file_type; + +# target is not real device, not needed +# r_dir_file(hal_wireless_charger, sysfs_wlc) +# allow hal_wireless_charger sysfs_wlc:dir search; +# allow hal_wireless_charger sysfs_wlc:file rw_file_perms; diff --git a/shared/sepolicy/vendor/google/system_app.te b/shared/sepolicy/vendor/google/system_app.te index cb6287b9d..4677e9807 100644 --- a/shared/sepolicy/vendor/google/system_app.te +++ b/shared/sepolicy/vendor/google/system_app.te @@ -1 +1,3 @@ -allow system_app hal_wlc_hwservice:hwservice_manager find; +# WLC +allow system_app hal_wireless_charger_service:service_manager find; +binder_call(system_app, hal_wireless_charger) diff --git a/shared/sepolicy/vendor/platform_app.te b/shared/sepolicy/vendor/platform_app.te index 703e39be4..cc5c5d9a2 100644 --- a/shared/sepolicy/vendor/platform_app.te +++ b/shared/sepolicy/vendor/platform_app.te @@ -7,3 +7,7 @@ allow platform_app hal_wlc_hwservice:hwservice_manager find; # Ignore lookup for vendor.google.wireless_charger.IWirelessCharger/default # and vendor.google.google_battery.IGoogleBattery/default. dontaudit platform_app default_android_service:service_manager find; + +# WLC +allow platform_app hal_wireless_charger_service:service_manager find; +binder_call(platform_app, hal_wireless_charger) diff --git a/shared/sepolicy/vendor/service.te b/shared/sepolicy/vendor/service.te index 67d79391a..1205f9299 100644 --- a/shared/sepolicy/vendor/service.te +++ b/shared/sepolicy/vendor/service.te @@ -1,2 +1,5 @@ # Binder service types type gce_service, service_manager_type; + +# WLC +type hal_wireless_charger_service, hal_service_type, protected_service, service_manager_type; diff --git a/shared/sepolicy/vendor/service_contexts b/shared/sepolicy/vendor/service_contexts index 6aaa86b56..85d268851 100644 --- a/shared/sepolicy/vendor/service_contexts +++ b/shared/sepolicy/vendor/service_contexts @@ -5,3 +5,5 @@ android.hardware.neuralnetworks.IDevice/nnapi-sample_sl_shim u:object_r:hal_neu # Binder service mappings gce u:object_r:gce_service:s0 + +vendor.google.wireless_charger.IWirelessCharger/default u:object_r:hal_wireless_charger_service:s0 -- cgit v1.2.3 From fd2ee74943b7696985efdc406ee0517e35ea2417 Mon Sep 17 00:00:00 2001 From: Manali Bhutiyani Date: Sun, 15 Oct 2023 03:51:48 +0000 Subject: Revert "Merge "update crosvm seccomp policies" into main am: f69..." Revert submission 25047701-am-82d7bea477cb4c19b884cd3abcb94104 Reason for revert: Reverted changes: /q/submissionid:25047701-am-82d7bea477cb4c19b884cd3abcb94104 Change-Id: If48a5605d9b3557630c71bdf70061164f1139cb3 --- build/Android.bp | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/build/Android.bp b/build/Android.bp index b7b72e6b2..927be3a8f 100644 --- a/build/Android.bp +++ b/build/Android.bp @@ -189,19 +189,6 @@ cvd_host_x86_64 = [ "x86_64_linux_gnu_libvirglrenderer.so.1_for_crosvm", "x86_64_linux_gnu_libwayland_client.so.0_for_crosvm", ] - -cvd_host_aarch64 = [ - "aarch64_linux_gnu_crosvm", - "aarch64_linux_gnu_libdrm.so.2_for_crosvm", - "aarch64_linux_gnu_libepoxy.so.0_for_crosvm", - "aarch64_linux_gnu_libffi.so.7_for_crosvm", - "aarch64_linux_gnu_libgbm.so.1_for_crosvm", - "aarch64_linux_gnu_libgfxstream_backend.so_for_crosvm", - "aarch64_linux_gnu_libminijail.so_for_crosvm", - "aarch64_linux_gnu_libvirglrenderer.so.1_for_crosvm", - "aarch64_linux_gnu_libwayland_client.so.0_for_crosvm", -] - cvd_host_seccomp_policy_x86_64 = [ "9p_device.policy_x86_64", "balloon_device.policy_x86_64", @@ -218,6 +205,7 @@ cvd_host_seccomp_policy_x86_64 = [ "iommu_device.policy_x86_64", "jail_warden.policy_x86_64", "net_device.policy_x86_64", + "net_device_vhost_user.policy_x86_64", "null_audio_device.policy_x86_64", "pmem_device.policy_x86_64", "rng_device.policy_x86_64", @@ -225,9 +213,12 @@ cvd_host_seccomp_policy_x86_64 = [ "serial_device_vhost_user.policy_x86_64", "snd_cras_device.policy_x86_64", "snd_null_device.policy_x86_64", + "swap_monitor.policy_x86_64", + "tpm_device.policy_x86_64", "vfio_device.policy_x86_64", "vhost_net_device.policy_x86_64", "vhost_vsock_device.policy_x86_64", + "vhost_vsock_device_vhost_user.policy_x86_64", "video_device.policy_x86_64", "vios_audio_device.policy_x86_64", "vtpm_proxy_device.policy_x86_64", @@ -235,6 +226,17 @@ cvd_host_seccomp_policy_x86_64 = [ "xhci_device.policy_x86_64", ] +cvd_host_aarch64 = [ + "aarch64_linux_gnu_crosvm", + "aarch64_linux_gnu_libdrm.so.2_for_crosvm", + "aarch64_linux_gnu_libepoxy.so.0_for_crosvm", + "aarch64_linux_gnu_libffi.so.7_for_crosvm", + "aarch64_linux_gnu_libgbm.so.1_for_crosvm", + "aarch64_linux_gnu_libgfxstream_backend.so_for_crosvm", + "aarch64_linux_gnu_libminijail.so_for_crosvm", + "aarch64_linux_gnu_libvirglrenderer.so.1_for_crosvm", + "aarch64_linux_gnu_libwayland_client.so.0_for_crosvm", +] cvd_host_seccomp_policy_aarch64 = [ "9p_device.policy_aarch64", "balloon_device.policy_aarch64", @@ -253,6 +255,7 @@ cvd_host_seccomp_policy_aarch64 = [ "serial_device.policy_aarch64", "snd_cras_device.policy_aarch64", "snd_null_device.policy_aarch64", + "tpm_device.policy_aarch64", "vhost_net_device.policy_aarch64", "vhost_scmi_device.policy_aarch64", "vhost_vsock_device.policy_aarch64", -- cgit v1.2.3 From 58a1a381d297ad9570daec42a72327d01e920724 Mon Sep 17 00:00:00 2001 From: Thomas Nguyen Date: Fri, 13 Oct 2023 00:00:52 +0000 Subject: Revert "Implement ISatellite in CuttleFish" Revert submission 20583557-Satellite APIs Reason for revert: Radio HAL for satellite APIs are not needed. Reverted changes: /q/submissionid:20583557-Satellite+APIs Bug: 304622222 Test: SMS, MMS, call with live network. SatelliteManagerTestOnMockService SatelliteManagerTest SatelliteControllerTest DatagramDispatcherTest DatagramReceiverTest SatelliteSOSMessageRecommenderTest NtnCapabilityResolverTest ServiceStateTrackerTest VtsHalRadioTargetTest Change-Id: I0ad5977df8cf9fa72489588f60b3ffd1d52b0d90 --- apex/com.google.cf.rild/Android.bp | 1 - guest/hals/ril/reference-libril/Android.bp | 2 - .../ril/reference-libril/RefRadioSatellite.cpp | 101 --------------------- .../hals/ril/reference-libril/RefRadioSatellite.h | 50 ---------- .../android.hardware.radio@2.1.xml | 4 - guest/hals/ril/reference-libril/ril_service.cpp | 8 +- shared/telephony/device_vendor.mk | 5 +- 7 files changed, 5 insertions(+), 166 deletions(-) delete mode 100644 guest/hals/ril/reference-libril/RefRadioSatellite.cpp delete mode 100644 guest/hals/ril/reference-libril/RefRadioSatellite.h diff --git a/apex/com.google.cf.rild/Android.bp b/apex/com.google.cf.rild/Android.bp index aee3fac51..9e237b519 100644 --- a/apex/com.google.cf.rild/Android.bp +++ b/apex/com.google.cf.rild/Android.bp @@ -47,7 +47,6 @@ apex { prebuilts: [ "android.hardware.telephony.gsm.prebuilt.xml", "android.hardware.telephony.ims.prebuilt.xml", - "android.hardware.telephony.satellite.prebuilt.xml", "com.google.cf.rild.rc", "ld.config.txt", ], diff --git a/guest/hals/ril/reference-libril/Android.bp b/guest/hals/ril/reference-libril/Android.bp index d155cc1a1..09acbd451 100644 --- a/guest/hals/ril/reference-libril/Android.bp +++ b/guest/hals/ril/reference-libril/Android.bp @@ -30,7 +30,6 @@ cc_library { "RefImsMedia.cpp", "RefImsMediaSession.cpp", "RefRadioNetwork.cpp", - "RefRadioSatellite.cpp", "ril.cpp", "RilSapSocket.cpp", "ril_config.cpp", @@ -52,7 +51,6 @@ cc_library { "android.hardware.radio.modem-V3-ndk", "android.hardware.radio.network-V3-ndk", "android.hardware.radio.sap-V1-ndk", - "android.hardware.radio.satellite-V1-ndk", "android.hardware.radio.sim-V3-ndk", "android.hardware.radio.voice-V3-ndk", "android.hardware.radio@1.0", diff --git a/guest/hals/ril/reference-libril/RefRadioSatellite.cpp b/guest/hals/ril/reference-libril/RefRadioSatellite.cpp deleted file mode 100644 index 651962aef..000000000 --- a/guest/hals/ril/reference-libril/RefRadioSatellite.cpp +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Copyright (C) 2022 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. - */ - -#include "RefRadioSatellite.h" - -namespace cf::ril { - -using ::ndk::ScopedAStatus; -using namespace ::aidl::android::hardware::radio; -constexpr auto ok = &ScopedAStatus::ok; - -static RadioResponseInfo responseInfo(int32_t serial) { - return { - .type = RadioResponseType::SOLICITED, - .serial = serial, - .error = RadioError::NONE, - }; -} - -ScopedAStatus RefRadioSatellite::getCapabilities(int32_t serial) { - satellite::SatelliteCapabilities capabilities; - respond()->getCapabilitiesResponse(responseInfo(serial), capabilities); - return ok(); -} -ScopedAStatus RefRadioSatellite::setPower(int32_t serial, bool on) { - respond()->setPowerResponse(responseInfo(serial)); - return ok(); -} -ScopedAStatus RefRadioSatellite::getPowerState(int32_t serial) { - respond()->getPowerStateResponse(responseInfo(serial), true); - return ok(); -} -ScopedAStatus RefRadioSatellite::provisionService( - int32_t serial, const std::string& imei, const std::string& msisdn, const std::string& imsi, - const std::vector<::aidl::android::hardware::radio::satellite::SatelliteFeature>& - features) { - respond()->provisionServiceResponse(responseInfo(serial), true); - return ok(); -} -ScopedAStatus RefRadioSatellite::addAllowedSatelliteContacts( - int32_t serial, const std::vector& contacts) { - respond()->addAllowedSatelliteContactsResponse(responseInfo(serial)); - return ok(); -} -ScopedAStatus RefRadioSatellite::removeAllowedSatelliteContacts( - int32_t serial, const std::vector& contacts) { - respond()->removeAllowedSatelliteContactsResponse(responseInfo(serial)); - return ok(); -} -ScopedAStatus RefRadioSatellite::sendMessages(int32_t serial, - const std::vector& messages, - const std::string& destination, double latitude, - double longitude) { - respond()->sendMessagesResponse(responseInfo(serial)); - return ok(); -} -ScopedAStatus RefRadioSatellite::getPendingMessages(int32_t serial) { - std::vector messages = {"This is a test message."}; - respond()->getPendingMessagesResponse(responseInfo(serial), messages); - return ok(); -} -ScopedAStatus RefRadioSatellite::getSatelliteMode(int32_t serial) { - satellite::SatelliteMode mode = satellite::SatelliteMode::ACQUIRED; - satellite::NTRadioTechnology radioTechnology = satellite::NTRadioTechnology::NB_IOT_NTN; - respond()->getSatelliteModeResponse(responseInfo(serial), mode, radioTechnology); - return ok(); -} -ScopedAStatus RefRadioSatellite::setIndicationFilter(int32_t serial, int32_t filterBitmask) { - respond()->setIndicationFilterResponse(responseInfo(serial)); - return ok(); -} -ScopedAStatus RefRadioSatellite::startSendingSatellitePointingInfo(int32_t serial) { - respond()->startSendingSatellitePointingInfoResponse(responseInfo(serial)); - return ok(); -} -ScopedAStatus RefRadioSatellite::stopSendingSatellitePointingInfo(int32_t serial) { - respond()->stopSendingSatellitePointingInfoResponse(responseInfo(serial)); - return ok(); -} -ScopedAStatus RefRadioSatellite::getMaxCharactersPerTextMessage(int32_t serial) { - respond()->getMaxCharactersPerTextMessageResponse(responseInfo(serial), 100); - return ok(); -} -ScopedAStatus RefRadioSatellite::getTimeForNextSatelliteVisibility(int32_t serial) { - respond()->getTimeForNextSatelliteVisibilityResponse(responseInfo(serial), 10); - return ok(); -} -} // namespace cf::ril diff --git a/guest/hals/ril/reference-libril/RefRadioSatellite.h b/guest/hals/ril/reference-libril/RefRadioSatellite.h deleted file mode 100644 index dab949052..000000000 --- a/guest/hals/ril/reference-libril/RefRadioSatellite.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (C) 2022 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. - */ -#pragma once - -#include - -namespace cf::ril { - -class RefRadioSatellite : public android::hardware::radio::compat::RadioSatellite { - public: - using android::hardware::radio::compat::RadioSatellite::RadioSatellite; - - ::ndk::ScopedAStatus getCapabilities(int32_t serial) override; - ::ndk::ScopedAStatus setPower(int32_t serial, bool on) override; - ::ndk::ScopedAStatus getPowerState(int32_t serial) override; - ::ndk::ScopedAStatus provisionService( - int32_t serial, const std::string& imei, const std::string& msisdn, - const std::string& imsi, - const std::vector<::aidl::android::hardware::radio::satellite::SatelliteFeature>& - features) override; - ::ndk::ScopedAStatus addAllowedSatelliteContacts( - int32_t serial, const std::vector& contacts) override; - ::ndk::ScopedAStatus removeAllowedSatelliteContacts( - int32_t serial, const std::vector& contacts) override; - ::ndk::ScopedAStatus sendMessages(int32_t serial, const std::vector& messages, - const std::string& destination, double latitude, - double longitude) override; - ::ndk::ScopedAStatus getPendingMessages(int32_t serial) override; - ::ndk::ScopedAStatus getSatelliteMode(int32_t serial) override; - ::ndk::ScopedAStatus setIndicationFilter(int32_t serial, int32_t filterBitmask) override; - ::ndk::ScopedAStatus startSendingSatellitePointingInfo(int32_t serial) override; - ::ndk::ScopedAStatus stopSendingSatellitePointingInfo(int32_t serial) override; - ::ndk::ScopedAStatus getMaxCharactersPerTextMessage(int32_t serial) override; - ::ndk::ScopedAStatus getTimeForNextSatelliteVisibility(int32_t serial) override; -}; - -} // namespace cf::ril diff --git a/guest/hals/ril/reference-libril/android.hardware.radio@2.1.xml b/guest/hals/ril/reference-libril/android.hardware.radio@2.1.xml index 4d97a4f70..a581292ec 100644 --- a/guest/hals/ril/reference-libril/android.hardware.radio@2.1.xml +++ b/guest/hals/ril/reference-libril/android.hardware.radio@2.1.xml @@ -34,10 +34,6 @@ 3 IRadioNetwork/slot1 - - android.hardware.radio.satellite - IRadioSatellite/slot1 - android.hardware.radio.sim 3 diff --git a/guest/hals/ril/reference-libril/ril_service.cpp b/guest/hals/ril/reference-libril/ril_service.cpp index 371e7fd1f..146f15552 100644 --- a/guest/hals/ril/reference-libril/ril_service.cpp +++ b/guest/hals/ril/reference-libril/ril_service.cpp @@ -16,12 +16,11 @@ #define LOG_TAG "RILC" -#include "RefRadioSim.h" #include "RefImsMedia.h" #include "RefRadioIms.h" -#include "RefRadioNetwork.h" -#include "RefRadioSatellite.h" #include "RefRadioModem.h" +#include "RefRadioNetwork.h" +#include "RefRadioSim.h" #include #include @@ -36,7 +35,6 @@ #include #include #include -#include #include #include @@ -13448,11 +13446,11 @@ void radio_1_6::registerService(RIL_RadioFunctions *callbacks, CommandInfo *comm publishRadioHal(context, radioHidl, callbackMgr, slot); publishRadioHal(context, radioHidl, callbackMgr, slot); publishRadioHal(context, radioHidl, callbackMgr, slot); - publishRadioHal(context, radioHidl, callbackMgr, slot); publishRadioHal(context, radioHidl, callbackMgr, std::string("default")); publishRadioHal(context, radioHidl, callbackMgr, slot); publishRadioHal(context, radioHidl, callbackMgr, slot); + RLOGD("registerService: OemHook is enabled = %s", kOemHookEnabled ? "true" : "false"); if (kOemHookEnabled) { oemHookService[i] = new OemHookImpl; diff --git a/shared/telephony/device_vendor.mk b/shared/telephony/device_vendor.mk index bd78cc6d0..0c4675aa7 100644 --- a/shared/telephony/device_vendor.mk +++ b/shared/telephony/device_vendor.mk @@ -40,8 +40,7 @@ PRODUCT_PACKAGES += \ endif PRODUCT_COPY_FILES += \ frameworks/native/data/etc/android.hardware.telephony.gsm.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.telephony.gsm.xml \ - frameworks/native/data/etc/android.hardware.telephony.ims.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.telephony.ims.xml \ - frameworks/native/data/etc/android.hardware.telephony.satellite.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.telephony.satellite.xml + frameworks/native/data/etc/android.hardware.telephony.ims.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.telephony.ims.xml endif # if not LOCAL_PREFER_VENDOR_APEX -endif # if not TARGET_NO_TELEPHONY +endif # if not TARGET_NO_TELEPHONY \ No newline at end of file -- cgit v1.2.3 From 872138543b3110bee4c2d90e4e9da2101c456d75 Mon Sep 17 00:00:00 2001 From: sadiqsada Date: Wed, 18 Oct 2023 14:08:59 -0700 Subject: Enable CBS on cuttlefish by default CBS was not enabled on cuttlefish by default. This CL modifies cuttlefish device configuration to install CBS. Test: m Bug: 306233106 Change-Id: I479dccf5cdd52314a9a45dd15a3ed9f952e2474c --- shared/tv/device_vendor.mk | 1 + vsoc_x86/BoardConfig.mk | 1 + 2 files changed, 2 insertions(+) diff --git a/shared/tv/device_vendor.mk b/shared/tv/device_vendor.mk index 439d7f67d..23f9c961d 100644 --- a/shared/tv/device_vendor.mk +++ b/shared/tv/device_vendor.mk @@ -26,6 +26,7 @@ $(call inherit-product, device/google/cuttlefish/shared/swiftshader/device_vendo $(call inherit-product, device/google/cuttlefish/shared/camera/device_vendor.mk) $(call inherit-product, device/google/cuttlefish/shared/virgl/device_vendor.mk) $(call inherit-product, device/google/cuttlefish/shared/device.mk) +$(call inherit-product, vendor/google/tv/gcbs/projects/reference-v4/dtvstack.mk) # Inform the camera HAL that we only want an external camera loaded. PRODUCT_VENDOR_PROPERTIES += \ diff --git a/vsoc_x86/BoardConfig.mk b/vsoc_x86/BoardConfig.mk index b801440ad..aa190ff14 100644 --- a/vsoc_x86/BoardConfig.mk +++ b/vsoc_x86/BoardConfig.mk @@ -46,3 +46,4 @@ TARGET_KERNEL_ARCH := x86_64 -include device/google/cuttlefish/shared/swiftshader/BoardConfig.mk -include device/google/cuttlefish/shared/telephony/BoardConfig.mk -include device/google/cuttlefish/shared/virgl/BoardConfig.mk +-include vendor/google/tv/gcbs/projects/reference-v4/dtvBoardConfig.mk -- cgit v1.2.3 From c2e1423f4a21a07e26ec5605130fe971acba9a16 Mon Sep 17 00:00:00 2001 From: Shunkai Yao Date: Tue, 17 Oct 2023 01:12:07 +0000 Subject: Update missing AIDL SoundTrigger versions in kKnownMissingAidl Bug: 273373363 Test: m Change-Id: I2f68b6e227110239683a33338732c16aecef3324 --- tests/hal/hal_implementation_test.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/hal/hal_implementation_test.cpp b/tests/hal/hal_implementation_test.cpp index 6299ee9f7..cd52b35e7 100644 --- a/tests/hal/hal_implementation_test.cpp +++ b/tests/hal/hal_implementation_test.cpp @@ -256,8 +256,8 @@ static const std::vector kKnownMissingAidl = { {"android.hardware.identity.", 5, 266869317}, {"android.se.omapi.", 1, 266870904}, - {"android.hardware.soundtrigger3.", 1, 266941225}, - {"android.media.soundtrigger.", 1, 266941225}, + {"android.hardware.soundtrigger3.", 2, 266941225}, + {"android.media.soundtrigger.", 2, 266941225}, {"android.hardware.media.c2.", 1, 251850069}, {"android.hardware.weaver.", 2, 262418065}, -- cgit v1.2.3 From 390e4a4311bfbc362e08422b682c7908f158be55 Mon Sep 17 00:00:00 2001 From: Yeabkal Wubshit Date: Thu, 19 Oct 2023 18:57:09 +0000 Subject: Fix Wear Cuttlefish Default Assistant The default assistant for Wear Cuttlefish was being set from the shared Google overlay folder (see comment#12 in linked bug for more info). Since the package used in the shared Google overlaly didn't correspond to Wear's Assistant app, long pressing the STEM button did not properly open Assistant on Wear Cuttlefish. This change sets Wear Cuttlefish's default assistant package value to Wear's Assistant package, which fixes this issue. Bug: 304967983 Change-Id: I6b1cc1dd92d57dadaa527facfaa054616f2a2aa4 Test: long pressing STEM launches Assistant --- shared/wear/overlays/core/res/values/config.xml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/shared/wear/overlays/core/res/values/config.xml b/shared/wear/overlays/core/res/values/config.xml index 1314b97fd..13e8a049e 100644 --- a/shared/wear/overlays/core/res/values/config.xml +++ b/shared/wear/overlays/core/res/values/config.xml @@ -124,4 +124,7 @@ android.ext.services + + + com.google.android.wearable.assistant -- cgit v1.2.3 From 717dafd56985c8bd1432c28e46c70855803f97d5 Mon Sep 17 00:00:00 2001 From: Alfred Piccioni Date: Wed, 18 Oct 2023 16:44:02 +0200 Subject: Refactor Cuttlefish camera config Since the external camera config needs a few differences from the standard config, splitting this up into different files should avoid having a bunch of if statements scattered around. Since this has internal dependencies, this should merge internally first and then get cherry-picked to AOSP. Bug: 306609788 Test: Build and run tests. Change-Id: I3fd7ebfe587c26ab9dff2851f150a694507bbda5 --- shared/camera/config/external.mk | 27 +++++++++++++++++++++++++++ shared/camera/config/standard.mk | 33 +++++++++++++++++++++++++++++++++ shared/camera/device_vendor.mk | 20 -------------------- shared/go/device_vendor.mk | 5 ++++- shared/pc/device_vendor.mk | 5 ++++- shared/phone/device_vendor.mk | 5 ++++- shared/slim/device_vendor.mk | 5 ++++- shared/tv/device_vendor.mk | 8 +++----- 8 files changed, 79 insertions(+), 29 deletions(-) create mode 100644 shared/camera/config/external.mk create mode 100644 shared/camera/config/standard.mk diff --git a/shared/camera/config/external.mk b/shared/camera/config/external.mk new file mode 100644 index 000000000..c9886993d --- /dev/null +++ b/shared/camera/config/external.mk @@ -0,0 +1,27 @@ +# +# Copyright (C) 2023 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. +# + +# Load the external feature permissions. +PRODUCT_COPY_FILES += \ + frameworks/native/data/etc/android.hardware.camera.external.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.camera.external.xml + +# Inform the camera HAL that we only want an external camera loaded. +PRODUCT_VENDOR_PROPERTIES += \ + ro.vendor.camera.config=external + +# Load the non-APEX external camera config. The APEX loads all the configs by default, which the HAl picks from. +PRODUCT_COPY_FILES += \ + hardware/google/camera/devices/EmulatedCamera/hwl/configs/emu_camera_external.json:$(TARGET_COPY_OUT_VENDOR)/etc/config/emu_camera_external.json diff --git a/shared/camera/config/standard.mk b/shared/camera/config/standard.mk new file mode 100644 index 000000000..ff6c3f3fe --- /dev/null +++ b/shared/camera/config/standard.mk @@ -0,0 +1,33 @@ +# +# Copyright (C) 2023 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. +# + +# Fills in the features that the full camera array needs. +PRODUCT_COPY_FILES += \ + frameworks/native/data/etc/android.hardware.camera.concurrent.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.camera.concurrent.xml \ + frameworks/native/data/etc/android.hardware.camera.flash-autofocus.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.camera.flash-autofocus.xml \ + frameworks/native/data/etc/android.hardware.camera.front.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.camera.front.xml \ + frameworks/native/data/etc/android.hardware.camera.full.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.camera.full.xml \ + frameworks/native/data/etc/android.hardware.camera.raw.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.camera.raw.xml \ + +# Camera support library; this isn't supported by the external camera config. +PRODUCT_VENDOR_PROPERTIES += \ + ro.camerax.extensions.enabled=true + +# Loads the non-APEX config files. The APEX loads all the configs by default, which the HAl picks from. +PRODUCT_COPY_FILES += \ + hardware/google/camera/devices/EmulatedCamera/hwl/configs/emu_camera_back.json:$(TARGET_COPY_OUT_VENDOR)/etc/config/emu_camera_back.json \ + hardware/google/camera/devices/EmulatedCamera/hwl/configs/emu_camera_front.json:$(TARGET_COPY_OUT_VENDOR)/etc/config/emu_camera_front.json \ + hardware/google/camera/devices/EmulatedCamera/hwl/configs/emu_camera_depth.json:$(TARGET_COPY_OUT_VENDOR)/etc/config/emu_camera_depth.json diff --git a/shared/camera/device_vendor.mk b/shared/camera/device_vendor.mk index f116fa146..85533dabb 100644 --- a/shared/camera/device_vendor.mk +++ b/shared/camera/device_vendor.mk @@ -14,9 +14,6 @@ # limitations under the License. # -PRODUCT_VENDOR_PROPERTIES += \ - ro.camerax.extensions.enabled=true - # Enable Camera Extension sample ifeq ($(TARGET_USE_CAMERA_ADVANCED_EXTENSION_SAMPLE),true) PRODUCT_PACKAGES += \ @@ -44,23 +41,6 @@ $(call soong_config_set,lyric,camera_hardware,cuttlefish) $(call soong_config_set,lyric,tuning_product,cuttlefish) $(call soong_config_set,google3a_config,target_device,cuttlefish) -PRODUCT_COPY_FILES += \ - frameworks/native/data/etc/android.hardware.camera.concurrent.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.camera.concurrent.xml \ - frameworks/native/data/etc/android.hardware.camera.flash-autofocus.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.camera.flash-autofocus.xml \ - frameworks/native/data/etc/android.hardware.camera.front.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.camera.front.xml \ - frameworks/native/data/etc/android.hardware.camera.full.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.camera.full.xml \ - frameworks/native/data/etc/android.hardware.camera.raw.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.camera.raw.xml \ - -ifeq ($(PRODUCT_IS_ATV_CF),true) - PRODUCT_COPY_FILES += \ - hardware/google/camera/devices/EmulatedCamera/hwl/configs/emu_camera_external.json:$(TARGET_COPY_OUT_VENDOR)/etc/config/emu_camera_external.json -else - PRODUCT_COPY_FILES += \ - hardware/google/camera/devices/EmulatedCamera/hwl/configs/emu_camera_back.json:$(TARGET_COPY_OUT_VENDOR)/etc/config/emu_camera_back.json \ - hardware/google/camera/devices/EmulatedCamera/hwl/configs/emu_camera_front.json:$(TARGET_COPY_OUT_VENDOR)/etc/config/emu_camera_front.json \ - hardware/google/camera/devices/EmulatedCamera/hwl/configs/emu_camera_depth.json:$(TARGET_COPY_OUT_VENDOR)/etc/config/emu_camera_depth.json -endif - ifeq ($(TARGET_USE_VSOCK_CAMERA_HAL_IMPL),true) PRODUCT_PACKAGES += \ android.hardware.camera.provider@2.7-external-vsock-service \ diff --git a/shared/go/device_vendor.mk b/shared/go/device_vendor.mk index b3a095215..3df5a32e7 100644 --- a/shared/go/device_vendor.mk +++ b/shared/go/device_vendor.mk @@ -26,7 +26,6 @@ PRODUCT_COPY_FILES += \ $(call inherit-product, frameworks/native/build/phone-xhdpi-2048-dalvik-heap.mk) $(call inherit-product, device/google/cuttlefish/shared/biometrics_face/device_vendor.mk) $(call inherit-product, device/google/cuttlefish/shared/bluetooth/device_vendor.mk) -$(call inherit-product, device/google/cuttlefish/shared/camera/device_vendor.mk) $(call inherit-product, device/google/cuttlefish/shared/gnss/device_vendor.mk) $(call inherit-product, device/google/cuttlefish/shared/graphics/device_vendor.mk) $(call inherit-product, device/google/cuttlefish/shared/identity/device_vendor.mk) @@ -38,6 +37,10 @@ $(call inherit-product, device/google/cuttlefish/shared/sensors/device_vendor.mk $(call inherit-product, device/google/cuttlefish/shared/virgl/device_vendor.mk) $(call inherit-product, device/google/cuttlefish/shared/device.mk) +# Loads the camera HAL and which set of cameras is required. +$(call inherit-product, device/google/cuttlefish/shared/camera/device_vendor.mk) +$(call inherit-product, device/google/cuttlefish/shared/camera/config/standard.mk) + PRODUCT_PACKAGES += \ cuttlefish_phone_overlay_frameworks_base_core \ cuttlefish_go_phone_overlay_frameworks_base_core \ diff --git a/shared/pc/device_vendor.mk b/shared/pc/device_vendor.mk index 83c082cf6..8ec1897d6 100644 --- a/shared/pc/device_vendor.mk +++ b/shared/pc/device_vendor.mk @@ -24,7 +24,6 @@ PRODUCT_COPY_FILES += \ $(call inherit-product, frameworks/native/build/tablet-7in-xhdpi-2048-dalvik-heap.mk) $(call inherit-product, device/google/cuttlefish/shared/bluetooth/device_vendor.mk) -$(call inherit-product, device/google/cuttlefish/shared/camera/device_vendor.mk) $(call inherit-product, device/google/cuttlefish/shared/gnss/device_vendor.mk) $(call inherit-product, device/google/cuttlefish/shared/graphics/device_vendor.mk) $(call inherit-product, device/google/cuttlefish/shared/reboot_escrow/device_vendor.mk) @@ -34,4 +33,8 @@ $(call inherit-product, device/google/cuttlefish/shared/sensors/device_vendor.mk $(call inherit-product, device/google/cuttlefish/shared/virgl/device_vendor.mk) $(call inherit-product, device/google/cuttlefish/shared/device.mk) +# Loads the camera HAL and which set of cameras is required. +$(call inherit-product, device/google/cuttlefish/shared/camera/device_vendor.mk) +$(call inherit-product, device/google/cuttlefish/shared/camera/config/standard.mk) + DEVICE_PACKAGE_OVERLAYS += device/google/cuttlefish/shared/pc/overlay diff --git a/shared/phone/device_vendor.mk b/shared/phone/device_vendor.mk index a602f3158..2e1612b85 100644 --- a/shared/phone/device_vendor.mk +++ b/shared/phone/device_vendor.mk @@ -29,7 +29,6 @@ $(call inherit-product, frameworks/native/build/phone-xhdpi-2048-dalvik-heap.mk) $(call inherit-product, device/google/cuttlefish/shared/biometrics_face/device_vendor.mk) $(call inherit-product, device/google/cuttlefish/shared/biometrics_fingerprint/device_vendor.mk) $(call inherit-product, device/google/cuttlefish/shared/bluetooth/device_vendor.mk) -$(call inherit-product, device/google/cuttlefish/shared/camera/device_vendor.mk) $(call inherit-product, device/google/cuttlefish/shared/consumerir/device_vendor.mk) $(call inherit-product, device/google/cuttlefish/shared/gnss/device_vendor.mk) $(call inherit-product, device/google/cuttlefish/shared/graphics/device_vendor.mk) @@ -42,6 +41,10 @@ $(call inherit-product, device/google/cuttlefish/shared/sensors/device_vendor.mk $(call inherit-product, device/google/cuttlefish/shared/virgl/device_vendor.mk) $(call inherit-product, device/google/cuttlefish/shared/device.mk) +# Loads the camera HAL and which set of cameras is required. +$(call inherit-product, device/google/cuttlefish/shared/camera/device_vendor.mk) +$(call inherit-product, device/google/cuttlefish/shared/camera/config/standard.mk) + # Support mixing CF system onto previous versions of vendor PRODUCT_EXTRA_VNDK_VERSIONS := 30 31 32 33 34 diff --git a/shared/slim/device_vendor.mk b/shared/slim/device_vendor.mk index c5e535c04..d4cb7dcd0 100644 --- a/shared/slim/device_vendor.mk +++ b/shared/slim/device_vendor.mk @@ -30,7 +30,6 @@ $(call inherit-product, frameworks/native/build/phone-xhdpi-2048-dalvik-heap.mk) $(call inherit-product, device/google/cuttlefish/shared/biometrics_face/device_vendor.mk) $(call inherit-product, device/google/cuttlefish/shared/biometrics_fingerprint/device_vendor.mk) $(call inherit-product, device/google/cuttlefish/shared/bluetooth/device_vendor.mk) -$(call inherit-product, device/google/cuttlefish/shared/camera/device_vendor.mk) $(call inherit-product, device/google/cuttlefish/shared/consumerir/device_vendor.mk) $(call inherit-product, device/google/cuttlefish/shared/gnss/device_vendor.mk) $(call inherit-product, device/google/cuttlefish/shared/graphics/device_vendor.mk) @@ -43,6 +42,10 @@ $(call inherit-product, device/google/cuttlefish/shared/sensors/device_vendor.mk $(call inherit-product, device/google/cuttlefish/shared/virgl/device_vendor.mk) $(call inherit-product, device/google/cuttlefish/shared/device.mk) +# Loads the camera HAL and which set of cameras is required. +$(call inherit-product, device/google/cuttlefish/shared/camera/device_vendor.mk) +$(call inherit-product, device/google/cuttlefish/shared/camera/config/standard.mk) + PRODUCT_VENDOR_PROPERTIES += \ debug.hwui.drawing_enabled=0 \ diff --git a/shared/tv/device_vendor.mk b/shared/tv/device_vendor.mk index 439d7f67d..944d73245 100644 --- a/shared/tv/device_vendor.mk +++ b/shared/tv/device_vendor.mk @@ -23,13 +23,12 @@ $(call inherit-product, frameworks/native/build/phone-xhdpi-2048-dalvik-heap.mk) $(call inherit-product, device/google/cuttlefish/shared/bluetooth/device_vendor.mk) $(call inherit-product, device/google/cuttlefish/shared/graphics/device_vendor.mk) $(call inherit-product, device/google/cuttlefish/shared/swiftshader/device_vendor.mk) -$(call inherit-product, device/google/cuttlefish/shared/camera/device_vendor.mk) $(call inherit-product, device/google/cuttlefish/shared/virgl/device_vendor.mk) $(call inherit-product, device/google/cuttlefish/shared/device.mk) -# Inform the camera HAL that we only want an external camera loaded. -PRODUCT_VENDOR_PROPERTIES += \ - ro.vendor.camera.config=external +# Loads the camera HAL and which set of cameras is required. +$(call inherit-product, device/google/cuttlefish/shared/camera/device_vendor.mk) +$(call inherit-product, device/google/cuttlefish/shared/camera/config/external.mk) # Extend cuttlefish common sepolicy with tv-specific functionality BOARD_SEPOLICY_DIRS += device/google/cuttlefish/shared/tv/sepolicy/vendor @@ -39,7 +38,6 @@ ifneq ($(LOCAL_PREFER_VENDOR_APEX),true) endif PRODUCT_COPY_FILES += \ - frameworks/native/data/etc/android.hardware.camera.external.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.camera.external.xml \ device/google/cuttlefish/shared/config/media_codecs_google_tv.xml:$(TARGET_COPY_OUT_VENDOR)/etc/media_codecs_google_tv.xml \ frameworks/native/data/etc/android.hardware.hdmi.cec.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.hdmi.cec.xml \ frameworks/native/data/etc/android.hardware.tv.tuner.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.tv.tuner.xml \ -- cgit v1.2.3 From 8202768b546df6319b375b63fdb24100bfce4fb3 Mon Sep 17 00:00:00 2001 From: Greg Kaiser Date: Wed, 25 Oct 2023 16:16:51 -0600 Subject: Fix lunch choices for git_main We add "trunk_staging-" for all COMMON_LUNCH_CHOICES so they are valid in the trunk stable setup. Bug: 307738446 Test: lunch Change-Id: Ib2f679ddb770d4fa371eeb5fe43b0b005bcb8fad --- AndroidProducts.mk | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/AndroidProducts.mk b/AndroidProducts.mk index 629b2a395..8a6d58dc3 100644 --- a/AndroidProducts.mk +++ b/AndroidProducts.mk @@ -53,15 +53,15 @@ PRODUCT_MAKEFILES := \ aosp_cf_x86_wear:$(LOCAL_DIR)/vsoc_x86/wear/aosp_cf.mk \ COMMON_LUNCH_CHOICES := \ - aosp_cf_arm64_auto-userdebug \ - aosp_cf_arm64_phone-userdebug \ - aosp_cf_riscv64_phone-userdebug \ - aosp_cf_x86_64_only_phone_hsum-userdebug \ - aosp_cf_x86_64_pc-userdebug \ - aosp_cf_x86_64_phone-userdebug \ - aosp_cf_x86_64_foldable-userdebug \ - aosp_cf_x86_64_auto-userdebug \ - aosp_cf_x86_64_auto_mdnd-userdebug \ - aosp_cf_x86_phone-userdebug \ - aosp_cf_x86_tv-userdebug \ - aosp_cf_x86_64_tv-userdebug + aosp_cf_arm64_auto-trunk_staging-userdebug \ + aosp_cf_arm64_phone-trunk_staging-userdebug \ + aosp_cf_riscv64_phone-trunk_staging-userdebug \ + aosp_cf_x86_64_only_phone_hsum-trunk_staging-userdebug \ + aosp_cf_x86_64_pc-trunk_staging-userdebug \ + aosp_cf_x86_64_phone-trunk_staging-userdebug \ + aosp_cf_x86_64_foldable-trunk_staging-userdebug \ + aosp_cf_x86_64_auto-trunk_staging-userdebug \ + aosp_cf_x86_64_auto_mdnd-trunk_staging-userdebug \ + aosp_cf_x86_phone-trunk_staging-userdebug \ + aosp_cf_x86_tv-trunk_staging-userdebug \ + aosp_cf_x86_64_tv-trunk_staging-userdebug -- cgit v1.2.3 From ff3f449e1d4188a59888d20c875c36d0154c3c9d Mon Sep 17 00:00:00 2001 From: Dmitrii Merkurev Date: Wed, 31 May 2023 20:03:58 +0100 Subject: Fix misc and metadata images caching Recreating of metadata and misc leads to CVD wipe Bug: 285167626 Bug: 265068221 Bug: 307584049 Signed-off-by: Dmitrii Merkurev (cherry picked from https://android-review.googlesource.com/q/commit:d3b21b11d73b818b0f5ea77f8bff3c4740e7f0ba) Merged-In: I046da502f1f92a8905ef45b8e42891f3a618e3b1 Change-Id: I046da502f1f92a8905ef45b8e42891f3a618e3b1 --- host/commands/assemble_cvd/disk_flags.cc | 4 ++-- host/libs/config/data_image.cpp | 9 +++------ 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/host/commands/assemble_cvd/disk_flags.cc b/host/commands/assemble_cvd/disk_flags.cc index dc6e4f2f2..beae35e48 100644 --- a/host/commands/assemble_cvd/disk_flags.cc +++ b/host/commands/assemble_cvd/disk_flags.cc @@ -901,8 +901,8 @@ class InitializeMetadataImage : public SetupFeature { private: std::unordered_set Dependencies() const override { return {}; } Result ResultSetup() override { - if (FileExists(instance_.metadata_image()) && - FileSize(instance_.metadata_image()) == instance_.blank_metadata_image_mb() << 20) { + if (FileExists(instance_.new_metadata_image()) && + FileSize(instance_.new_metadata_image()) == instance_.blank_metadata_image_mb() << 20) { return {}; } diff --git a/host/libs/config/data_image.cpp b/host/libs/config/data_image.cpp index 45dbad845..e3a6fe48d 100644 --- a/host/libs/config/data_image.cpp +++ b/host/libs/config/data_image.cpp @@ -307,16 +307,13 @@ class InitializeMiscImageImpl : public InitializeMiscImage { private: std::unordered_set Dependencies() const override { return {}; } bool Setup() override { - bool misc_exists = FileHasContent(instance_.misc_image()); - - if (misc_exists) { - LOG(DEBUG) << "misc partition image: use existing at \"" - << instance_.misc_image() << "\""; + if (FileHasContent(instance_.new_misc_image())) { + LOG(DEBUG) << "misc partition image already exists"; return true; } LOG(DEBUG) << "misc partition image: creating empty at \"" - << instance_.misc_image() << "\""; + << instance_.new_misc_image() << "\""; if (!CreateBlankImage(instance_.new_misc_image(), 1 /* mb */, "none")) { LOG(ERROR) << "Failed to create misc image"; return false; -- cgit v1.2.3 From 93f6c89738887809fa1a576edb080a58b13b4cfd Mon Sep 17 00:00:00 2001 From: Dmitrii Merkurev Date: Wed, 31 May 2023 20:13:00 +0100 Subject: Avoid redundant deletion of misc and metadata partitions They're backing the overlay, any deletion of them triggers device wipe, so preserving them alongside with other similar images. Bug: 285167626 Bug: 265068221 Bug: 307584049 Signed-off-by: Dmitrii Merkurev (cherry picked from https://android-review.googlesource.com/q/commit:aeee1f6356ed6893c1343193320218e9e8f82925) Merged-In: I66b6fc94834f3a57bf5fb076049a09221eafa95f Change-Id: I66b6fc94834f3a57bf5fb076049a09221eafa95f --- host/commands/assemble_cvd/assemble_cvd.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/host/commands/assemble_cvd/assemble_cvd.cc b/host/commands/assemble_cvd/assemble_cvd.cc index 9d285ecab..cfaac2991 100644 --- a/host/commands/assemble_cvd/assemble_cvd.cc +++ b/host/commands/assemble_cvd/assemble_cvd.cc @@ -254,6 +254,8 @@ Result InitFilesystemAndCreateConfig( preserving.insert("persistent_composite.img"); preserving.insert("uboot_env.img"); preserving.insert("factory_reset_protected.img"); + preserving.insert("misc.img"); + preserving.insert("metadata.img"); std::stringstream ss; for (int i = 0; i < modem_simulator_count; i++) { ss.clear(); -- cgit v1.2.3 From 1ec6fb25e34c708d89f00d7cb8e193824d2f8a7b Mon Sep 17 00:00:00 2001 From: Dmitrii Merkurev Date: Thu, 8 Jun 2023 19:10:13 +0100 Subject: Use ManagedMessage in channel signatures This helps to avoid redundant copy for more complicated messages then primitive types. Particularly it allowes us to form full message using CreateMessage + GateKeeperMessage:: Serialize(message->payload) without serializing it to an intermidiate argument Test: atest VtsHalOemLockTargetTest Bug: 282160400 Bug: 307584049 Signed-off-by: Dmitrii Merkurev (cherry picked from https://android-review.googlesource.com/q/commit:a9866877ba8a36935eef480baab32a4ed2540c9c) Merged-In: I48d5447ecc716b8e60f08ed9d6b3e947dde5bc36 Change-Id: I48d5447ecc716b8e60f08ed9d6b3e947dde5bc36 --- common/libs/security/channel.cpp | 20 +++++++++++++ common/libs/security/channel.h | 11 +++++-- common/libs/security/channel_sharedfd.cpp | 41 +++++++------------------- common/libs/security/channel_sharedfd.h | 6 ++-- guest/hals/oemlock/remote/remote_oemlock.cpp | 11 +++++-- host/commands/secure_env/oemlock_responder.cpp | 5 +++- 6 files changed, 55 insertions(+), 39 deletions(-) diff --git a/common/libs/security/channel.cpp b/common/libs/security/channel.cpp index 009617da1..e2891aa2f 100644 --- a/common/libs/security/channel.cpp +++ b/common/libs/security/channel.cpp @@ -28,5 +28,25 @@ void MessageDestroyer::operator()(RawMessage* ptr) { std::free(ptr); } +/** + * Allocates memory for a RawMessage carrying a message of size + * `payload_size`. + */ +Result CreateMessage(uint32_t command, bool is_response, size_t payload_size) { + const auto bytes_to_allocate = sizeof(RawMessage) + payload_size; + auto memory = std::malloc(bytes_to_allocate); + CF_EXPECT(memory != nullptr, + "Cannot allocate " << bytes_to_allocate << " bytes for secure_env RPC message"); + auto message = reinterpret_cast(memory); + message->command = command; + message->is_response = is_response; + message->payload_size = payload_size; + return ManagedMessage(message); +} + +Result CreateMessage(uint32_t command, size_t payload_size) { + return CreateMessage(command, false, payload_size); +} + } // namespace secure_env } // namespace cuttlefish \ No newline at end of file diff --git a/common/libs/security/channel.h b/common/libs/security/channel.h index bbfb86779..eb415e2a0 100644 --- a/common/libs/security/channel.h +++ b/common/libs/security/channel.h @@ -52,14 +52,21 @@ class MessageDestroyer { /** An owning pointer for a RawMessage instance. */ using ManagedMessage = std::unique_ptr; +/** + * Allocates memory for a RawMessage carrying a message of size + * `payload_size`. + */ +Result CreateMessage(uint32_t command, bool is_response, size_t payload_size); +Result CreateMessage(uint32_t command, size_t payload_size); + /* * Interface for communication channels that synchronously communicate * HAL IPC/RPC calls. */ class Channel { public: - virtual Result SendRequest(uint32_t command, void* message, size_t message_size) = 0; - virtual Result SendResponse(uint32_t command, void* message, size_t message_size) = 0; + virtual Result SendRequest(RawMessage& message) = 0; + virtual Result SendResponse(RawMessage& message) = 0; virtual Result ReceiveMessage() = 0; virtual ~Channel() {} }; diff --git a/common/libs/security/channel_sharedfd.cpp b/common/libs/security/channel_sharedfd.cpp index c07d876b0..a152cf32b 100644 --- a/common/libs/security/channel_sharedfd.cpp +++ b/common/libs/security/channel_sharedfd.cpp @@ -20,35 +20,16 @@ namespace cuttlefish { namespace secure_env { -namespace { - -/** - * Allocates memory for a RawMessage carrying a message of size - * `payload_size`. - */ -Result CreateMessage(uint32_t command, bool is_response, size_t payload_size) { - const auto bytes_to_allocate = sizeof(RawMessage) + payload_size; - auto memory = std::malloc(bytes_to_allocate); - CF_EXPECT(memory != nullptr, - "Cannot allocate " << bytes_to_allocate << " bytes for secure_env RPC message"); - auto message = reinterpret_cast(memory); - message->command = command; - message->is_response = is_response; - message->payload_size = payload_size; - return ManagedMessage(message); -} - -} SharedFdChannel::SharedFdChannel(SharedFD input, SharedFD output) : input_(std::move(input)), output_(std::move(output)) {} -Result SharedFdChannel::SendRequest(uint32_t command, void* message, size_t message_size) { - return SendMessage(command, false, message, message_size); +Result SharedFdChannel::SendRequest(RawMessage& message) { + return SendMessage(message, false); } -Result SharedFdChannel::SendResponse(uint32_t command, void* message, size_t message_size) { - return SendMessage(command, true, message, message_size); +Result SharedFdChannel::SendResponse(RawMessage& message) { + return SendMessage(message, true); } Result SharedFdChannel::ReceiveMessage() { @@ -69,14 +50,12 @@ Result SharedFdChannel::ReceiveMessage() { return message; } -Result SharedFdChannel::SendMessage(uint32_t command, bool response, - void* message, size_t message_size) { - auto to_send = CF_EXPECT(CreateMessage(command, response, message_size)); - memcpy(to_send->payload, message, message_size); - auto write_size = sizeof(RawMessage) + message_size; - auto to_send_bytes = reinterpret_cast(to_send.get()); - auto written = WriteAll(output_, to_send_bytes, write_size); - CF_EXPECT(written != -1, +Result SharedFdChannel::SendMessage(RawMessage& message, bool response) { + message.is_response = response; + auto write_size = sizeof(RawMessage) + message.payload_size; + auto message_bytes = reinterpret_cast(&message); + auto written = WriteAll(output_, message_bytes, write_size); + CF_EXPECT(written == write_size, "Could not write message: " << output_->StrError()); return {}; } diff --git a/common/libs/security/channel_sharedfd.h b/common/libs/security/channel_sharedfd.h index 3d0fdbcda..39f27490d 100644 --- a/common/libs/security/channel_sharedfd.h +++ b/common/libs/security/channel_sharedfd.h @@ -25,15 +25,15 @@ namespace secure_env { class SharedFdChannel : public Channel { public: SharedFdChannel(SharedFD input, SharedFD output); - Result SendRequest(uint32_t command, void* message, size_t message_size) override; - Result SendResponse(uint32_t command, void* message, size_t message_size) override; + Result SendRequest(RawMessage& message) override; + Result SendResponse(RawMessage& message) override; Result ReceiveMessage() override; private: SharedFD input_; SharedFD output_; - Result SendMessage(uint32_t command, bool response, void* message, size_t message_size); + Result SendMessage(RawMessage& message, bool response); }; } // namespace secure_env diff --git a/guest/hals/oemlock/remote/remote_oemlock.cpp b/guest/hals/oemlock/remote/remote_oemlock.cpp index f427ec028..46727be62 100644 --- a/guest/hals/oemlock/remote/remote_oemlock.cpp +++ b/guest/hals/oemlock/remote/remote_oemlock.cpp @@ -65,7 +65,10 @@ OemLock::OemLock(secure_env::Channel& channel) : channel_(channel) {} } Result OemLock::requestValue(secure_env::OemLockField field, bool *out) { - CF_EXPECT(channel_.SendRequest(static_cast(field), nullptr, 0), + auto message = CF_EXPECT(secure_env::CreateMessage(static_cast(field), 0), + "Cannot allocate message for oemlock request: " << + static_cast(field)); + CF_EXPECT(channel_.SendRequest(*message), "Can't send get value request for field: " << static_cast(field)); auto response = CF_EXPECT(channel_.ReceiveMessage(), "Haven't received an answer for getting the field: " << @@ -75,7 +78,11 @@ Result OemLock::requestValue(secure_env::OemLockField field, bool *out) { } Result OemLock::setValue(secure_env::OemLockField field, bool value) { - CF_EXPECT(channel_.SendRequest(static_cast(field), &value, sizeof(bool)), + auto message = CF_EXPECT(secure_env::CreateMessage(static_cast(field), sizeof(bool)), + "Cannot allocate message for oemlock request: " << + static_cast(field)); + memcpy(message->payload, &value, sizeof(bool)); + CF_EXPECT(channel_.SendRequest(*message), "Can't send set value request for field: " << static_cast(field)); auto response = CF_EXPECT(channel_.ReceiveMessage(), "Haven't received an answer for setting the field: " << diff --git a/host/commands/secure_env/oemlock_responder.cpp b/host/commands/secure_env/oemlock_responder.cpp index 3f9ad50c0..698be32ff 100644 --- a/host/commands/secure_env/oemlock_responder.cpp +++ b/host/commands/secure_env/oemlock_responder.cpp @@ -55,7 +55,10 @@ Result OemLockResponder::ProcessMessage() { return CF_ERR("Unrecognized message id " << reinterpret_cast(request->command)); } - CF_EXPECT(channel_.SendResponse(request->command, &allowed, sizeof(bool)), + auto message = CF_EXPECT(secure_env::CreateMessage(request->command, sizeof(bool)), + "Failed to allocate message for oemlock response"); + memcpy(message->payload, &allowed, sizeof(bool)); + CF_EXPECT(channel_.SendResponse(*message), "Could not answer to " << reinterpret_cast(request->command) << " request"); return {}; -- cgit v1.2.3 From 61677e8fa3b63657881876a577dd3e5a282b5475 Mon Sep 17 00:00:00 2001 From: Dmitrii Merkurev Date: Sun, 11 Jun 2023 19:03:30 +0100 Subject: Introduce key(string):value(binary) storage This is needed to reuse existing gatekeeper TPM NV storage logic in oemlock. Also introduced insecure json implementation for software oemlock implementation (in case TPM isn't available) Bug: 282160400 Bug: 307584049 Test: atest VtsHalOemLockTargetTest with other local changes Signed-off-by: Dmitrii Merkurev (cherry picked from https://android-review.googlesource.com/q/commit:ec2fc895b6d3d656d2a1d67b1bce86cfd8bc9253) Merged-In: I843c5937b48a06d763f7cee46fd4bfb10f31aeaa Change-Id: I843c5937b48a06d763f7cee46fd4bfb10f31aeaa --- host/commands/secure_env/Android.bp | 6 ++ .../secure_env/storage/insecure_json_storage.cpp | 88 ++++++++++++++++++++++ .../secure_env/storage/insecure_json_storage.h | 37 +++++++++ host/commands/secure_env/storage/storage.cpp | 48 ++++++++++++ host/commands/secure_env/storage/storage.h | 69 +++++++++++++++++ 5 files changed, 248 insertions(+) create mode 100644 host/commands/secure_env/storage/insecure_json_storage.cpp create mode 100644 host/commands/secure_env/storage/insecure_json_storage.h create mode 100644 host/commands/secure_env/storage/storage.cpp create mode 100644 host/commands/secure_env/storage/storage.h diff --git a/host/commands/secure_env/Android.bp b/host/commands/secure_env/Android.bp index 73d443b17..0bd3690b7 100644 --- a/host/commands/secure_env/Android.bp +++ b/host/commands/secure_env/Android.bp @@ -79,6 +79,7 @@ common_libsecure_srcs = [ "keymaster_responder.cpp", "oemlock_responder.cpp", "primary_key_builder.cpp", + "storage/storage.cpp", "tpm_attestation_record.cpp", "tpm_auth.cpp", "tpm_commands.cpp", @@ -95,11 +96,16 @@ common_libsecure_srcs = [ "tpm_serialize.cpp", ] +// Things blocking us to use oemlock on windows: +// 1. Missing transport implementation +// 2. Missing file utils +// 3. Base64 isn't supported (need for software oemlock implementation) cc_library_host_static { name: "libsecure_env_linux", srcs: common_libsecure_srcs + [ "confui_sign_server.cpp", "device_tpm.cpp", + "storage/insecure_json_storage.cpp", ], defaults: ["cuttlefish_buildhost_only", "secure_env_defaults"], } diff --git a/host/commands/secure_env/storage/insecure_json_storage.cpp b/host/commands/secure_env/storage/insecure_json_storage.cpp new file mode 100644 index 000000000..a85e7e427 --- /dev/null +++ b/host/commands/secure_env/storage/insecure_json_storage.cpp @@ -0,0 +1,88 @@ +// +// Copyright (C) 2023 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. + +#include "host/commands/secure_env/storage/insecure_json_storage.h" + +#include + +#include +#include + +#include "common/libs/utils/base64.h" +#include "common/libs/utils/files.h" +#include "common/libs/utils/json.h" + +namespace cuttlefish { +namespace secure_env { +namespace { + +Result ReadJson(const std::string& path) { + std::string json; + CF_EXPECT(android::base::ReadFileToString(path, &json)); + return CF_EXPECT(ParseJson(json)); +} + +Result WriteJson(const std::string& path, const Json::Value& root) { + Json::StreamWriterBuilder builder; + auto json = Json::writeString(builder, root); + CF_EXPECT(android::base::WriteStringToFile(json, path)); + return {}; +} + +} // namespace + +InsecureJsonStorage::InsecureJsonStorage(std::string path) : path_(std::move(path)) {} + +bool InsecureJsonStorage::Exists() const { + return ReadJson(path_).ok(); +} + +Result InsecureJsonStorage::HasKey(const std::string& key) const { + if (!FileHasContent(path_)) { + return false; + } + return CF_EXPECT(ReadJson(path_)).isMember(key); +} + +Result InsecureJsonStorage::Read(const std::string& key) const { + auto root = CF_EXPECT(ReadJson(path_)); + CF_EXPECT(root.isMember(key), "Key: " << key << " not found in " << path_); + + std::vector base64_buffer; + CF_EXPECT(DecodeBase64(root[key].asString(), &base64_buffer), + "Failed to decode base64 to read key: " << key); + auto storage_data = CF_EXPECT(CreateStorageData(base64_buffer.size())); + std::memcpy(storage_data->payload, reinterpret_cast(base64_buffer.data()), + base64_buffer.size()); + return storage_data; +} + +Result InsecureJsonStorage::Write(const std::string& key, const StorageData& data) { + Json::Value root; + if (FileHasContent(path_)) { + root = CF_EXPECT(ReadJson(path_)); + } + + std::string value_base64; + CF_EXPECT(EncodeBase64(data.payload, data.size, &value_base64), + "Failed to encode base64 to write key: " << key); + root[key] = value_base64; + + CF_EXPECT(WriteJson(path_, root)); + return {}; +} + +} // namespace oemlock +} // namespace cuttlefish diff --git a/host/commands/secure_env/storage/insecure_json_storage.h b/host/commands/secure_env/storage/insecure_json_storage.h new file mode 100644 index 000000000..f811774cd --- /dev/null +++ b/host/commands/secure_env/storage/insecure_json_storage.h @@ -0,0 +1,37 @@ +// +// Copyright (C) 2023 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. + +#pragma once + +#include "host/commands/secure_env/storage/storage.h" + +namespace cuttlefish { +namespace secure_env { + +class InsecureJsonStorage : public secure_env::Storage { + public: + InsecureJsonStorage(std::string path); + + Result HasKey(const std::string& key) const override; + Result Read(const std::string& key) const override; + Result Write(const std::string& key, const StorageData& data) override; + bool Exists() const override; + + private: + std::string path_; +}; + +} // namespace secure_env +} // namespace cuttlefish diff --git a/host/commands/secure_env/storage/storage.cpp b/host/commands/secure_env/storage/storage.cpp new file mode 100644 index 000000000..5c7cb2f11 --- /dev/null +++ b/host/commands/secure_env/storage/storage.cpp @@ -0,0 +1,48 @@ +/* + * Copyright 2023 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. + */ + +#include "host/commands/secure_env/storage/storage.h" + +#include "keymaster/android_keymaster_utils.h" + +namespace cuttlefish { +namespace secure_env { + +void StorageDataDestroyer::operator()(StorageData* ptr) { + { + keymaster::Eraser(ptr, sizeof(StorageData) + ptr->size); + } + std::free(ptr); +} + +Result CreateStorageData(size_t size) { + const auto bytes_to_allocate = sizeof(StorageData) + size; + auto memory = std::malloc(bytes_to_allocate); + CF_EXPECT(memory != nullptr, + "Cannot allocate " << bytes_to_allocate << " bytes for storage data"); + auto data = reinterpret_cast(memory); + data->size = size; + return ManagedStorageData(data); +} + +Result CreateStorageData(const void* data, size_t size) { + auto managed_data = CF_EXPECT(CreateStorageData(size)); + std::memcpy(managed_data->payload, data, size); + return managed_data; +} + +} // namespace secure_env +} // namespace cuttlefish diff --git a/host/commands/secure_env/storage/storage.h b/host/commands/secure_env/storage/storage.h new file mode 100644 index 000000000..6815c3476 --- /dev/null +++ b/host/commands/secure_env/storage/storage.h @@ -0,0 +1,69 @@ +// +// Copyright (C) 2023 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. + +#pragma once + +#include +#include + +#include "common/libs/utils/result.h" + +namespace cuttlefish { +namespace secure_env { + +struct StorageData { + uint32_t size; + uint8_t payload[0]; + + Result asUint8() { + CF_EXPECT(size == sizeof(uint8_t), "Size of payload is not matched with uint8 size"); + return *reinterpret_cast(payload); + } +}; + +/** + * A destroyer for StorageData instances created with + * CreateStorageData. Wipes memory from the StorageData instances. + */ +class StorageDataDestroyer { + public: + void operator()(StorageData* ptr); +}; + +/** An owning pointer for a StorageData instance. */ +using ManagedStorageData = std::unique_ptr; + +/** + * Allocates memory for a StorageData carrying a message of size + * `size`. + */ +Result CreateStorageData(size_t size); +Result CreateStorageData(const void* data, size_t size); + +/** + * Storage abstraction to store binary blobs associated with string key +*/ +class Storage { + public: + virtual Result HasKey(const std::string& key) const = 0; + virtual Result Read(const std::string& key) const = 0; + virtual Result Write(const std::string& key, const StorageData& data) = 0; + virtual bool Exists() const = 0; + + virtual ~Storage() = default; +}; + +} // namespace secure_env +} // namespace cuttlefish -- cgit v1.2.3 From 129eecf8e64117e4f77931207d0a39e1a7c60e48 Mon Sep 17 00:00:00 2001 From: Dmitrii Merkurev Date: Tue, 13 Jun 2023 14:56:59 +0100 Subject: Use introduced json binary storage to store oemlock state Alongside with that introduce LOCKED/UNLOCKED state and single RPC to check unlock is allowed to reduce amount of calls we need to execute on bootloader side Bug: 282160400 Bug: 307584049 Test: Test: atest VtsHalOemLockTargetTest Signed-off-by: Dmitrii Merkurev (cherry picked from https://android-review.googlesource.com/q/commit:dbcf615d82d79ff6a686c9a8f4abbb084a9c2960) Merged-In: Ia554a16eede741c7e6c4253d0aa4a5dc3674e405 Change-Id: Ia554a16eede741c7e6c4253d0aa4a5dc3674e405 --- common/libs/security/oemlock.h | 4 +- host/commands/assemble_cvd/assemble_cvd.cc | 1 + host/commands/secure_env/Android.bp | 3 +- host/commands/secure_env/oemlock.h | 38 -------- host/commands/secure_env/oemlock/oemlock.cpp | 102 +++++++++++++++++++++ host/commands/secure_env/oemlock/oemlock.h | 51 +++++++++++ .../secure_env/oemlock/oemlock_responder.cpp | 83 +++++++++++++++++ .../secure_env/oemlock/oemlock_responder.h | 38 ++++++++ host/commands/secure_env/oemlock_responder.cpp | 68 -------------- host/commands/secure_env/oemlock_responder.h | 38 -------- host/commands/secure_env/secure_env_linux_main.cpp | 40 ++++---- 11 files changed, 303 insertions(+), 163 deletions(-) delete mode 100644 host/commands/secure_env/oemlock.h create mode 100644 host/commands/secure_env/oemlock/oemlock.cpp create mode 100644 host/commands/secure_env/oemlock/oemlock.h create mode 100644 host/commands/secure_env/oemlock/oemlock_responder.cpp create mode 100644 host/commands/secure_env/oemlock/oemlock_responder.h delete mode 100644 host/commands/secure_env/oemlock_responder.cpp delete mode 100644 host/commands/secure_env/oemlock_responder.h diff --git a/common/libs/security/oemlock.h b/common/libs/security/oemlock.h index ab980a90e..d5fb62d06 100644 --- a/common/libs/security/oemlock.h +++ b/common/libs/security/oemlock.h @@ -23,7 +23,9 @@ namespace secure_env { enum class OemLockField : uint32_t { ALLOWED_BY_CARRIER = 0, - ALLOWED_BY_DEVICE = 1, + ALLOWED_BY_DEVICE, + ALLOWED, + LOCKED, }; } // namespace secure_env diff --git a/host/commands/assemble_cvd/assemble_cvd.cc b/host/commands/assemble_cvd/assemble_cvd.cc index cfaac2991..266547ae2 100644 --- a/host/commands/assemble_cvd/assemble_cvd.cc +++ b/host/commands/assemble_cvd/assemble_cvd.cc @@ -256,6 +256,7 @@ Result InitFilesystemAndCreateConfig( preserving.insert("factory_reset_protected.img"); preserving.insert("misc.img"); preserving.insert("metadata.img"); + preserving.insert("oemlock_insecure"); std::stringstream ss; for (int i = 0; i < modem_simulator_count; i++) { ss.clear(); diff --git a/host/commands/secure_env/Android.bp b/host/commands/secure_env/Android.bp index 0bd3690b7..a18ab2679 100644 --- a/host/commands/secure_env/Android.bp +++ b/host/commands/secure_env/Android.bp @@ -77,7 +77,6 @@ common_libsecure_srcs = [ "insecure_fallback_storage.cpp", "json_serializable.cpp", "keymaster_responder.cpp", - "oemlock_responder.cpp", "primary_key_builder.cpp", "storage/storage.cpp", "tpm_attestation_record.cpp", @@ -105,6 +104,8 @@ cc_library_host_static { srcs: common_libsecure_srcs + [ "confui_sign_server.cpp", "device_tpm.cpp", + "oemlock/oemlock.cpp", + "oemlock/oemlock_responder.cpp", "storage/insecure_json_storage.cpp", ], defaults: ["cuttlefish_buildhost_only", "secure_env_defaults"], diff --git a/host/commands/secure_env/oemlock.h b/host/commands/secure_env/oemlock.h deleted file mode 100644 index 8ac29ffb2..000000000 --- a/host/commands/secure_env/oemlock.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright 2023 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. - * - */ - -#pragma once - -namespace cuttlefish { -namespace oemlock { - -/** - * OEMLock TPM server interface - * - * Inspired by OemLock HAL interface: - * https://cs.android.com/android/platform/superproject/+/master:hardware/interfaces/oemlock/aidl/default/Android.bp -*/ -class OemLock { - public: - virtual bool IsOemUnlockAllowedByCarrier() const = 0; - virtual bool IsOemUnlockAllowedByDevice() const = 0; - virtual void SetOemUnlockAllowedByCarrier(bool allowed) = 0; - virtual void SetOemUnlockAllowedByDevice(bool allowed) = 0; -}; - -} // namespace oemlock -} // namespace cuttlefish \ No newline at end of file diff --git a/host/commands/secure_env/oemlock/oemlock.cpp b/host/commands/secure_env/oemlock/oemlock.cpp new file mode 100644 index 000000000..05709f6f7 --- /dev/null +++ b/host/commands/secure_env/oemlock/oemlock.cpp @@ -0,0 +1,102 @@ +/* + * Copyright 2023 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. + * + */ + +#include "host/commands/secure_env/oemlock/oemlock.h" + +namespace cuttlefish { +namespace oemlock { +namespace { + +constexpr char kStateKey[] = "oemlock_state"; +constexpr int kAllowedByCarrierBit = 0; +constexpr int kAllowedByDeviceBit = 1; +constexpr int kOemLockedBit = 2; + +// Default state is allowed_by_carrier = true +// allowed_by_device = false +// locked = true +constexpr uint8_t kDefaultState = 0 | (1 << kAllowedByCarrierBit) | (1 << kOemLockedBit); + +Result InitializeDefaultState(secure_env::Storage& storage) { + if (storage.Exists()) { return {}; }; + auto data = CF_EXPECT(secure_env::CreateStorageData(&kDefaultState, sizeof(kDefaultState))); + CF_EXPECT(storage.Write(kStateKey, *data)); + return {}; +} + +Result ReadFlag(secure_env::Storage& storage, int bit) { + auto data = CF_EXPECT(storage.Read(kStateKey)); + auto state = CF_EXPECT(data->asUint8()); + return (state >> bit) & 1; +} + +Result WriteFlag(secure_env::Storage& storage, int bit, bool value) { + auto data = CF_EXPECT(storage.Read(kStateKey)); + auto state = CF_EXPECT(data->asUint8()); + value ? state |= (1 << bit) : state &= ~(1 << bit); + auto data_to_write = CF_EXPECT(secure_env::CreateStorageData(&state, sizeof(state))); + CF_EXPECT(storage.Write(kStateKey, *data_to_write)); + return {}; +} + +} // namespace + +OemLock::OemLock(secure_env::Storage& storage) : storage_(storage) { + auto result = InitializeDefaultState(storage_); + if (!result.ok()) { + LOG(FATAL) << "Failed to initialize default state for OemLock TEE storage: " + << result.error().Message(); + } +} + +Result OemLock::IsOemUnlockAllowedByCarrier() const { + return CF_EXPECT(ReadFlag(storage_, kAllowedByCarrierBit)); +} + +Result OemLock::IsOemUnlockAllowedByDevice() const { + return CF_EXPECT(ReadFlag(storage_, kAllowedByDeviceBit)); +} + +Result OemLock::IsOemUnlockAllowed() const { + auto data = CF_EXPECT(storage_.Read(kStateKey)); + auto state = CF_EXPECT(data->asUint8()); + const bool allowed_by_device = (state >> kAllowedByDeviceBit) & 1; + const bool allowed_by_carrier = (state >> kAllowedByCarrierBit) & 1; + return allowed_by_device && allowed_by_carrier; +} + +Result OemLock::IsOemLocked() const { + return CF_EXPECT(ReadFlag(storage_, kOemLockedBit)); +} + +Result OemLock::SetOemUnlockAllowedByCarrier(bool allowed) { + CF_EXPECT(WriteFlag(storage_, kAllowedByCarrierBit, allowed)); + return {}; +} + +Result OemLock::SetOemUnlockAllowedByDevice(bool allowed) { + CF_EXPECT(WriteFlag(storage_, kAllowedByDeviceBit, allowed)); + return {}; +} + +Result OemLock::SetOemLocked(bool locked) { + CF_EXPECT(WriteFlag(storage_, kOemLockedBit, locked)); + return {}; +} + +} // namespace oemlock +} // namespace cuttlefish \ No newline at end of file diff --git a/host/commands/secure_env/oemlock/oemlock.h b/host/commands/secure_env/oemlock/oemlock.h new file mode 100644 index 000000000..306ec78e4 --- /dev/null +++ b/host/commands/secure_env/oemlock/oemlock.h @@ -0,0 +1,51 @@ +/* + * Copyright 2023 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. + * + */ + +#pragma once + +#include "common/libs/utils/result.h" + +#include "host/commands/secure_env/storage/storage.h" + +namespace cuttlefish { +namespace oemlock { + +/** + * OEMLock TPM server interface + * + * Inspired by OemLock HAL interface: + * https://cs.android.com/android/platform/superproject/+/master:hardware/interfaces/oemlock/aidl/default/Android.bp +*/ +class OemLock { + public: + OemLock(secure_env::Storage& storage); + + Result IsOemUnlockAllowedByCarrier() const; + Result IsOemUnlockAllowedByDevice() const; + Result IsOemUnlockAllowed() const; + Result IsOemLocked() const; + Result SetOemUnlockAllowedByCarrier(bool allowed); + Result SetOemUnlockAllowedByDevice(bool allowed); + // TODO(b/286558252): add ConfirmationUI token to the signature + Result SetOemLocked(bool locked); + + private: + secure_env::Storage& storage_; +}; + +} // namespace oemlock +} // namespace cuttlefish diff --git a/host/commands/secure_env/oemlock/oemlock_responder.cpp b/host/commands/secure_env/oemlock/oemlock_responder.cpp new file mode 100644 index 000000000..be434ae3b --- /dev/null +++ b/host/commands/secure_env/oemlock/oemlock_responder.cpp @@ -0,0 +1,83 @@ +// +// Copyright (C) 2023 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. + +#include "host/commands/secure_env/oemlock/oemlock_responder.h" + +#include "common/libs/security/oemlock.h" + +namespace cuttlefish { +namespace oemlock { + +OemLockResponder::OemLockResponder(secure_env::Channel& channel, + OemLock& oemlock) + : channel_(channel), oemlock_(oemlock) {} + +Result OemLockResponder::ProcessMessage() { + auto request = CF_EXPECT(channel_.ReceiveMessage(), "Could not receive message"); + + bool result = false; + switch(secure_env::OemLockField(request->command)) { + case secure_env::OemLockField::ALLOWED_BY_CARRIER: { + if (request->payload_size == 0) { + result = CF_EXPECT(oemlock_.IsOemUnlockAllowedByCarrier()); + } else if (request->payload_size == sizeof(bool)) { + result = *reinterpret_cast(request->payload); + CF_EXPECT(oemlock_.SetOemUnlockAllowedByCarrier(result)); + } + break; + } + + case secure_env::OemLockField::ALLOWED_BY_DEVICE: { + if (request->payload_size == 0) { + result = CF_EXPECT(oemlock_.IsOemUnlockAllowedByDevice()); + } else if (request->payload_size == sizeof(bool)) { + result = *reinterpret_cast(request->payload); + CF_EXPECT(oemlock_.SetOemUnlockAllowedByDevice(result)); + } + break; + } + + case secure_env::OemLockField::ALLOWED: { + if (request->payload_size == 0) { + result = CF_EXPECT(oemlock_.IsOemUnlockAllowed()); + } + break; + } + + case secure_env::OemLockField::LOCKED: { + if (request->payload_size == 0) { + result = CF_EXPECT(oemlock_.IsOemLocked()); + } else if (request->payload_size == sizeof(bool)) { + result = *reinterpret_cast(request->payload); + CF_EXPECT(oemlock_.SetOemLocked(result)); + } + break; + } + + default: + return CF_ERR("Unrecognized message id " << reinterpret_cast(request->command)); + } + + auto message = CF_EXPECT(secure_env::CreateMessage(request->command, sizeof(bool)), + "Failed to allocate message for oemlock response"); + memcpy(message->payload, &result, sizeof(bool)); + CF_EXPECT(channel_.SendResponse(*message), + "Could not answer to " << reinterpret_cast(request->command) << " request"); + + return {}; +} + +} // namespace oemlock +} // namespace cuttlefish diff --git a/host/commands/secure_env/oemlock/oemlock_responder.h b/host/commands/secure_env/oemlock/oemlock_responder.h new file mode 100644 index 000000000..0b5fadbf2 --- /dev/null +++ b/host/commands/secure_env/oemlock/oemlock_responder.h @@ -0,0 +1,38 @@ +// +// Copyright (C) 2023 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. + +#pragma once + +#include "common/libs/security/channel.h" +#include "common/libs/utils/result.h" +#include "host/commands/secure_env/oemlock/oemlock.h" + +namespace cuttlefish { +namespace oemlock { + +class OemLockResponder { + public: + OemLockResponder(secure_env::Channel& channel, + OemLock& oemlock); + + Result ProcessMessage(); + + private: + secure_env::Channel& channel_; + OemLock& oemlock_; +}; + +} // namespace oemlock +} // namespace cuttlefish diff --git a/host/commands/secure_env/oemlock_responder.cpp b/host/commands/secure_env/oemlock_responder.cpp deleted file mode 100644 index 698be32ff..000000000 --- a/host/commands/secure_env/oemlock_responder.cpp +++ /dev/null @@ -1,68 +0,0 @@ -// -// Copyright (C) 2023 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. - -#include "host/commands/secure_env/oemlock_responder.h" - -#include - -#include "common/libs/security/oemlock.h" - -namespace cuttlefish { -namespace oemlock { - -OemLockResponder::OemLockResponder(secure_env::Channel& channel, - OemLock& oemlock) - : channel_(channel), oemlock_(oemlock) {} - -Result OemLockResponder::ProcessMessage() { - auto request = CF_EXPECT(channel_.ReceiveMessage(), "Could not receive message"); - - bool allowed = false; - switch(secure_env::OemLockField(request->command)) { - case secure_env::OemLockField::ALLOWED_BY_CARRIER: { - if (request->payload_size == 0) { - allowed = oemlock_.IsOemUnlockAllowedByCarrier(); - } else if (request->payload_size == sizeof(bool)) { - allowed = *reinterpret_cast(request->payload); - oemlock_.SetOemUnlockAllowedByCarrier(allowed); - } - break; - } - - case secure_env::OemLockField::ALLOWED_BY_DEVICE: { - if (request->payload_size == 0) { - allowed = oemlock_.IsOemUnlockAllowedByDevice(); - } else if (request->payload_size == sizeof(bool)) { - allowed = *reinterpret_cast(request->payload); - oemlock_.SetOemUnlockAllowedByDevice(allowed); - } - break; - } - - default: - return CF_ERR("Unrecognized message id " << reinterpret_cast(request->command)); - } - - auto message = CF_EXPECT(secure_env::CreateMessage(request->command, sizeof(bool)), - "Failed to allocate message for oemlock response"); - memcpy(message->payload, &allowed, sizeof(bool)); - CF_EXPECT(channel_.SendResponse(*message), - "Could not answer to " << reinterpret_cast(request->command) << " request"); - - return {}; -} - -} // namespace oemlock -} // namespace cuttlefish diff --git a/host/commands/secure_env/oemlock_responder.h b/host/commands/secure_env/oemlock_responder.h deleted file mode 100644 index 3b02472a4..000000000 --- a/host/commands/secure_env/oemlock_responder.h +++ /dev/null @@ -1,38 +0,0 @@ -// -// Copyright (C) 2023 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. - -#pragma once - -#include "common/libs/security/channel.h" -#include "common/libs/utils/result.h" -#include "host/commands/secure_env/oemlock.h" - -namespace cuttlefish { -namespace oemlock { - -class OemLockResponder { - public: - OemLockResponder(secure_env::Channel& channel, - OemLock& oemlock); - - Result ProcessMessage(); - - private: - secure_env::Channel& channel_; - OemLock& oemlock_; -}; - -} // namespace oemlock -} // namespace cuttlefish diff --git a/host/commands/secure_env/secure_env_linux_main.cpp b/host/commands/secure_env/secure_env_linux_main.cpp index 56428c901..1164ef2d8 100644 --- a/host/commands/secure_env/secure_env_linux_main.cpp +++ b/host/commands/secure_env/secure_env_linux_main.cpp @@ -39,12 +39,13 @@ #include "host/commands/secure_env/in_process_tpm.h" #include "host/commands/secure_env/insecure_fallback_storage.h" #include "host/commands/secure_env/keymaster_responder.h" -#include "host/commands/secure_env/oemlock_responder.h" -#include "host/commands/secure_env/oemlock.h" +#include "host/commands/secure_env/oemlock/oemlock_responder.h" +#include "host/commands/secure_env/oemlock/oemlock.h" #include "host/commands/secure_env/proxy_keymaster_context.h" #include "host/commands/secure_env/rust/kmr_ta.h" #include "host/commands/secure_env/soft_gatekeeper.h" -#include "host/commands/secure_env/soft_oemlock.h" +#include "host/commands/secure_env/storage/insecure_json_storage.h" +#include "host/commands/secure_env/storage/storage.h" #include "host/commands/secure_env/tpm_gatekeeper.h" #include "host/commands/secure_env/tpm_keymaster_context.h" #include "host/commands/secure_env/tpm_keymaster_enforcement.h" @@ -150,22 +151,27 @@ ChooseGatekeeperComponent() { } } -fruit::Component ChooseOemlockComponent() { - if (FLAGS_oemlock_impl == "software") { - return fruit::createComponent() - .bind(); - } else if (FLAGS_oemlock_impl == "tpm") { - LOG(FATAL) << "Oemlock doesn't support TPM implementation"; - abort(); - } else { - LOG(FATAL) << "Invalid oemlock implementation: " - << FLAGS_oemlock_impl; - abort(); - } +fruit::Component ChooseOemlockComponent() { + return fruit::createComponent() + .registerProvider([]() -> secure_env::Storage* { + if (FLAGS_oemlock_impl == "software") { + return new secure_env::InsecureJsonStorage("oemlock_insecure"); + } else if (FLAGS_oemlock_impl == "tpm") { + LOG(FATAL) << "Oemlock doesn't support TPM implementation"; + abort(); + } else { + LOG(FATAL) << "Invalid oemlock implementation: " + << FLAGS_oemlock_impl; + abort(); + } + }) + .registerProvider([](secure_env::Storage& storage) -> oemlock::OemLock* { + return new oemlock::OemLock(storage); + });; } fruit::Component + secure_env::Storage, oemlock::OemLock, keymaster::KeymasterEnforcement> SecureEnvComponent() { return fruit::createComponent() .registerProvider([]() -> Tpm* { // fruit will take ownership @@ -224,7 +230,7 @@ int SecureEnvMain(int argc, char** argv) { keymaster::SoftKeymasterLogger km_logger; fruit::Injector + secure_env::Storage, oemlock::OemLock, keymaster::KeymasterEnforcement> injector(SecureEnvComponent); TpmResourceManager* resource_manager = injector.get(); gatekeeper::GateKeeper* gatekeeper = injector.get(); -- cgit v1.2.3 From 52a18348f3088b406a9f8845e2b97420c6e5f6d3 Mon Sep 17 00:00:00 2001 From: Rachit Jain Date: Thu, 26 Oct 2023 19:57:27 +0000 Subject: Update configs with MAIN display type to have inputType TOUCH_SCREEN Bug: 307807755 Test: atest CarOccupantZoneManagerTest Change-Id: Ibcc9f354c8194ad820224766795d7ac2023d42ba --- shared/auto/rro_overlay/CarServiceOverlay/res/values/config.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/shared/auto/rro_overlay/CarServiceOverlay/res/values/config.xml b/shared/auto/rro_overlay/CarServiceOverlay/res/values/config.xml index e889df36a..fb11fa82c 100644 --- a/shared/auto/rro_overlay/CarServiceOverlay/res/values/config.xml +++ b/shared/auto/rro_overlay/CarServiceOverlay/res/values/config.xml @@ -62,15 +62,15 @@ Some examples are: displayPort=0,displayType=MAIN,occupantZoneId=0,inputTypes=DPAD_KEYS| - NAVIGATE_KEYS|ROTARY_NAVIGATION + NAVIGATE_KEYS|ROTARY_NAVIGATION|TOUCH_SCREEN displayPort=1,displayType=INSTRUMENT_CLUSTER,occupantZoneId=0, inputTypes=DPAD_KEYS displayPort=2,displayType=MAIN,occupantZoneId=1, - inputTypes=NAVIGATE_KEYS + inputTypes=TOUCH_SCREEN displayPort=3,displayType=MAIN,occupantZoneId=2, - inputTypes=NAVIGATE_KEYS + inputTypes=TOUCH_SCREEN displayUniqueId=virtual:com.example:MainD,displayType=MAIN,occupantZoneId=3, - inputTypes=NAVIGATE_KEYS + inputTypes=TOUCH_SCREEN displayPort: Unique port id for the display. displayType: Display type for the display. Use * part from -- cgit v1.2.3 From 4ec8f4fe1dd1f102b3a9c0795cf358d8d8f5e8b4 Mon Sep 17 00:00:00 2001 From: Devin Moore Date: Fri, 27 Oct 2023 16:17:18 +0000 Subject: Revert "Revert "Revert^2 "Remove HIDL graphics.mapper service fr..." Revert submission 25023954-revert-25010967-revert-24736974-revert-24707439-mapper5_cf-REMQWOTVGG-JRJETIBTHL-EWHRRCQAEN Reason for revert: b/304843606 the sensors VTS tests was fixed with ag/25032879 Reverted changes: /q/submissionid:25023954-revert-25010967-revert-24736974-revert-24707439-mapper5_cf-REMQWOTVGG-JRJETIBTHL-EWHRRCQAEN Change-Id: Id2e99f897305747a5e9a10df29cfaa281c3e2784 --- shared/graphics/device_vendor.mk | 1 - tests/hal/hal_implementation_test.cpp | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/shared/graphics/device_vendor.mk b/shared/graphics/device_vendor.mk index b5f410281..a4768b01f 100644 --- a/shared/graphics/device_vendor.mk +++ b/shared/graphics/device_vendor.mk @@ -82,5 +82,4 @@ PRODUCT_VENDOR_PROPERTIES += \ # Gralloc implementation PRODUCT_PACKAGES += \ android.hardware.graphics.allocator-service.minigbm \ - android.hardware.graphics.mapper@4.0-impl.minigbm \ mapper.minigbm diff --git a/tests/hal/hal_implementation_test.cpp b/tests/hal/hal_implementation_test.cpp index c6c0b1baf..e34ffc142 100644 --- a/tests/hal/hal_implementation_test.cpp +++ b/tests/hal/hal_implementation_test.cpp @@ -98,6 +98,7 @@ static const std::set kKnownMissingHidl = { "android.hardware.graphics.composer@2.4", // converted to AIDL, see b/193240715 "android.hardware.graphics.mapper@2.1", "android.hardware.graphics.mapper@3.0", + "android.hardware.graphics.mapper@4.0", // converted to Stable C, see b/205761028 "android.hardware.health.storage@1.0", // converted to AIDL, see b/177470478 "android.hardware.health@2.1", // converted to AIDL, see b/177269435 "android.hardware.input.classifier@1.0", // converted to AIDL, see b/205761620 -- cgit v1.2.3 From b74e96d9dd48a23b2a3ffda41f6bbcac7b28b461 Mon Sep 17 00:00:00 2001 From: Hakjun Choi Date: Tue, 31 Oct 2023 03:00:19 +0000 Subject: fix usage of internal IIntegerConsumer IBooleanConsumer Moved Consumer interfaces from internal telephony to android.telephony, as it is used by vendor satellite service Bug: 307982863 Test: Build test Change-Id: Id8c645acdf1ab89f947cc6b862ca82bff03a46a2 --- .../com/google/android/telephony/satellite/CFSatelliteService.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/guest/services/cf_satellite_service/src/com/google/android/telephony/satellite/CFSatelliteService.java b/guest/services/cf_satellite_service/src/com/google/android/telephony/satellite/CFSatelliteService.java index 77ea7d41e..147383555 100644 --- a/guest/services/cf_satellite_service/src/com/google/android/telephony/satellite/CFSatelliteService.java +++ b/guest/services/cf_satellite_service/src/com/google/android/telephony/satellite/CFSatelliteService.java @@ -21,6 +21,8 @@ import android.annotation.Nullable; import android.content.Intent; import android.os.Binder; import android.os.IBinder; +import android.telephony.IBooleanConsumer; +import android.telephony.IIntegerConsumer; import android.telephony.satellite.stub.ISatelliteCapabilitiesConsumer; import android.telephony.satellite.stub.ISatelliteListener; import android.telephony.satellite.stub.NTRadioTechnology; @@ -32,8 +34,6 @@ import android.telephony.satellite.stub.SatelliteImplBase; import android.telephony.satellite.stub.SatelliteModemState; import android.telephony.satellite.stub.SatelliteService; -import com.android.internal.telephony.IBooleanConsumer; -import com.android.internal.telephony.IIntegerConsumer; import com.android.internal.util.FunctionalUtils; import com.android.telephony.Rlog; -- cgit v1.2.3 From 8ef57b1add0c5a6d306a86647c19e779ab9d8002 Mon Sep 17 00:00:00 2001 From: Shunkai Yao Date: Tue, 17 Oct 2023 01:12:07 +0000 Subject: Update missing AIDL SoundTrigger versions in kKnownMissingAidl Bug: 273373363 Test: m Test: lunch panther-trunk_staging-userdebug; m Test: Test Bluetooth Audio functionality on Panther Change-Id: I2f68b6e227110239683a33338732c16aecef3324 Merged-In: I2f68b6e227110239683a33338732c16aecef3324 --- tests/hal/hal_implementation_test.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/hal/hal_implementation_test.cpp b/tests/hal/hal_implementation_test.cpp index 7ea01f9ee..386748cda 100644 --- a/tests/hal/hal_implementation_test.cpp +++ b/tests/hal/hal_implementation_test.cpp @@ -251,8 +251,8 @@ static const std::vector kKnownMissingAidl = { {"android.hardware.identity.", 5, 266869317}, {"android.se.omapi.", 1, 266870904}, - {"android.hardware.soundtrigger3.", 1, 266941225}, - {"android.media.soundtrigger.", 1, 266941225}, + {"android.hardware.soundtrigger3.", 2, 266941225}, + {"android.media.soundtrigger.", 2, 266941225}, {"android.hardware.media.c2.", 1, 251850069}, {"android.hardware.weaver.", 2, 262418065}, -- cgit v1.2.3 From f68166f56f022d2813af1ee082ba9f59ac7abb56 Mon Sep 17 00:00:00 2001 From: alukin Date: Thu, 2 Nov 2023 14:28:20 +0000 Subject: Add new modules to TEST_MAPPING Adding new modules to TEST_MAPPING after splitting CtsScopedStorageDeviceOnlyTest Bug: 294741813 Test: atest Change-Id: I30fd7c0e4f95cc2832272194da89da2ec866540c --- TEST_MAPPING | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/TEST_MAPPING b/TEST_MAPPING index f711b636d..fadf79d77 100644 --- a/TEST_MAPPING +++ b/TEST_MAPPING @@ -28,6 +28,15 @@ }, { "name": "CtsScopedStorageDeviceOnlyTest" + }, + { + "name": "CtsScopedStorageBypassDatabaseOperationsTest" + }, + { + "name": "CtsScopedStorageGeneralTest" + }, + { + "name": "CtsScopedStorageRedactUriTest" } ], "auto-presubmit": [ -- cgit v1.2.3 From 43af67e1eff775e9c13ebc7c30ce634568209bf0 Mon Sep 17 00:00:00 2001 From: Ludovic Barman Date: Thu, 2 Nov 2023 14:08:21 +0000 Subject: Rust protobuf 2->3: Update cuttlefish tldr: remove protobuf2 from Android Rust and upgrade everything to pb3. These commits update: - The grpcio rust crate to use protobuf 3 - The build system to always use the new libprotobuf (pb3) instead of the _deprecated variant (for pb2); they also force-enable libprotobuf everywhere, ignoring the use_protobuf3 flag, removes the tests related to pb2 - The following modules, which required syntax changes: -- packages/modules/Bluetooth -- device/google/cuttlefish -- vendor/auto Bug: 308790516 Test: m rust Ignore-AOSP-First: must be done in main to upgrade cuttlefish+vendor with the rest all at once Change-Id: I719bce106b19eed834430ef85ec92dad5e515d55 --- host/commands/secure_env/rust/Android.bp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/host/commands/secure_env/rust/Android.bp b/host/commands/secure_env/rust/Android.bp index 176430efb..0d7df9a77 100644 --- a/host/commands/secure_env/rust/Android.bp +++ b/host/commands/secure_env/rust/Android.bp @@ -23,6 +23,7 @@ rust_protobuf { protos: ["storage.proto"], source_stem: "kmr_proto", host_supported: true, + use_protobuf3: true, } rust_library_host { @@ -38,7 +39,7 @@ rust_library_host { "libkmr_wire", "liblibc", "liblog_rust", - "libprotobuf_deprecated", + "libprotobuf", "libsecure_env_tpm", ], defaults: ["cuttlefish_buildhost_only"], @@ -71,7 +72,7 @@ rust_test_host { "libkmr_wire", "liblibc", "liblog_rust", - "libprotobuf_deprecated", + "libprotobuf", "libsecure_env_tpm", ], defaults: ["cuttlefish_buildhost_only"], -- cgit v1.2.3 From e7877a0c67826a824f776ff5b686b019cabc996c Mon Sep 17 00:00:00 2001 From: Devin Moore Date: Thu, 2 Nov 2023 19:57:08 +0000 Subject: Remove media.c2 AIDL HAL from knowMissingList It is now installed on cuttlefish. Test: none Bug: 308991806 Change-Id: I02ce7ffc1c709ab0b200cc167fddbd7a8731483d --- tests/hal/hal_implementation_test.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/hal/hal_implementation_test.cpp b/tests/hal/hal_implementation_test.cpp index 0f69aad53..a7ca68913 100644 --- a/tests/hal/hal_implementation_test.cpp +++ b/tests/hal/hal_implementation_test.cpp @@ -259,7 +259,6 @@ static const std::vector kKnownMissingAidl = { {"android.se.omapi.", 1, 266870904}, {"android.hardware.soundtrigger3.", 2, 266941225}, {"android.media.soundtrigger.", 2, 266941225}, - {"android.hardware.media.c2.", 1, 251850069}, {"android.hardware.weaver.", 2, 262418065}, {"android.automotive.computepipe.registry.", 2, 273549907}, -- cgit v1.2.3 From e99e7fb1d2cefd2fe631920a11ef7e354d64d201 Mon Sep 17 00:00:00 2001 From: Roshan Pius Date: Sat, 4 Nov 2023 14:58:26 +0000 Subject: Revert "cuttlefish: Replace NFC app with NFC apex" Revert submission 24993894-cherrypicker-L80100000963393177:N49200001411943056 Reason for revert: Causing bootloop with signed builds Reverted changes: /q/submissionid:24993894-cherrypicker-L80100000963393177:N49200001411943056 Bug: 309117462 Change-Id: I94eaefe656b3e4bb03a7409a52aaaa116a543e4b Test: Compiles, device boots up --- shared/wear/aosp_system.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shared/wear/aosp_system.mk b/shared/wear/aosp_system.mk index 459b3d8bb..e1b076822 100644 --- a/shared/wear/aosp_system.mk +++ b/shared/wear/aosp_system.mk @@ -36,7 +36,7 @@ PRODUCT_PACKAGES += \ librs_jni \ ManagedProvisioning \ MmsService \ - com.android.nfcservices \ + NfcNci \ netutils-wrapper-1.0 \ screenrecord \ StatementService \ -- cgit v1.2.3 From e3dee42be683c254f2338ea6f776d3b3a74955ce Mon Sep 17 00:00:00 2001 From: Ludovic Barman Date: Thu, 2 Nov 2023 14:08:21 +0000 Subject: Rust protobuf 2->3: Update cuttlefish tldr: remove protobuf2 from Android Rust and upgrade everything to pb3. These commits update: - The grpcio rust crate to use protobuf 3 - The build system to always use the new libprotobuf (pb3) instead of the _deprecated variant (for pb2); they also force-enable libprotobuf everywhere, ignoring the use_protobuf3 flag, removes the tests related to pb2 - The following modules, which required syntax changes: -- packages/modules/Bluetooth -- device/google/cuttlefish -- vendor/auto Bug: 308790516 Test: m rust Ignore-AOSP-First: must be done in main to upgrade cuttlefish+vendor with the rest all at once (cherry picked from https://googleplex-android-review.googlesource.com/q/commit:43af67e1eff775e9c13ebc7c30ce634568209bf0) Merged-In: I719bce106b19eed834430ef85ec92dad5e515d55 Change-Id: I719bce106b19eed834430ef85ec92dad5e515d55 --- host/commands/secure_env/rust/Android.bp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/host/commands/secure_env/rust/Android.bp b/host/commands/secure_env/rust/Android.bp index 176430efb..0d7df9a77 100644 --- a/host/commands/secure_env/rust/Android.bp +++ b/host/commands/secure_env/rust/Android.bp @@ -23,6 +23,7 @@ rust_protobuf { protos: ["storage.proto"], source_stem: "kmr_proto", host_supported: true, + use_protobuf3: true, } rust_library_host { @@ -38,7 +39,7 @@ rust_library_host { "libkmr_wire", "liblibc", "liblog_rust", - "libprotobuf_deprecated", + "libprotobuf", "libsecure_env_tpm", ], defaults: ["cuttlefish_buildhost_only"], @@ -71,7 +72,7 @@ rust_test_host { "libkmr_wire", "liblibc", "liblog_rust", - "libprotobuf_deprecated", + "libprotobuf", "libsecure_env_tpm", ], defaults: ["cuttlefish_buildhost_only"], -- cgit v1.2.3 From 9ff0a54a90034d7671a3e6b697e28572f54b103c Mon Sep 17 00:00:00 2001 From: Shunkai Yao Date: Tue, 17 Oct 2023 01:12:07 +0000 Subject: Update missing AIDL SoundTrigger versions in kKnownMissingAidl Bug: 273373363 Test: m Test: lunch panther-trunk_staging-userdebug; m Test: Test Bluetooth Audio functionality on Panther Change-Id: I2f68b6e227110239683a33338732c16aecef3324 Merged-In: I2f68b6e227110239683a33338732c16aecef3324 --- tests/hal/hal_implementation_test.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/hal/hal_implementation_test.cpp b/tests/hal/hal_implementation_test.cpp index 7ea01f9ee..386748cda 100644 --- a/tests/hal/hal_implementation_test.cpp +++ b/tests/hal/hal_implementation_test.cpp @@ -251,8 +251,8 @@ static const std::vector kKnownMissingAidl = { {"android.hardware.identity.", 5, 266869317}, {"android.se.omapi.", 1, 266870904}, - {"android.hardware.soundtrigger3.", 1, 266941225}, - {"android.media.soundtrigger.", 1, 266941225}, + {"android.hardware.soundtrigger3.", 2, 266941225}, + {"android.media.soundtrigger.", 2, 266941225}, {"android.hardware.media.c2.", 1, 251850069}, {"android.hardware.weaver.", 2, 262418065}, -- cgit v1.2.3 From 467dfbb5a886fcfee94f171a343ca907e195406d Mon Sep 17 00:00:00 2001 From: Frederick Mayle Date: Wed, 1 Nov 2023 14:09:17 -0700 Subject: secure_env: add suspend-resume support to rust impl This mimics the logic of the C++ suspend-resume code, but to reduce FFI surface area, instead of using a few different primitives (two event_fds and a condition variable), it uses one socket pair and a simple protocol. (cherry picked from https://android-review.googlesource.com/q/commit:ef6ee5db70574d3cb711366c2c4d1f246bf3d04b) Bug: 295028759 Test: cvd suspend; cvd resume Change-Id: I55628436e9236efa08d85f101b8684a6d2093547 --- host/commands/secure_env/rust/Android.bp | 2 + host/commands/secure_env/rust/ffi.rs | 11 +- host/commands/secure_env/rust/kmr_ta.h | 5 +- host/commands/secure_env/rust/lib.rs | 145 +++++++++++++++------ .../secure_env/secure_env_not_windows_main.cpp | 13 +- .../commands/secure_env/suspend_resume_handler.cpp | 42 +++++- host/commands/secure_env/suspend_resume_handler.h | 33 ++++- 7 files changed, 201 insertions(+), 50 deletions(-) diff --git a/host/commands/secure_env/rust/Android.bp b/host/commands/secure_env/rust/Android.bp index 0d7df9a77..2902997d4 100644 --- a/host/commands/secure_env/rust/Android.bp +++ b/host/commands/secure_env/rust/Android.bp @@ -39,6 +39,7 @@ rust_library_host { "libkmr_wire", "liblibc", "liblog_rust", + "libnix", "libprotobuf", "libsecure_env_tpm", ], @@ -72,6 +73,7 @@ rust_test_host { "libkmr_wire", "liblibc", "liblog_rust", + "libnix", "libprotobuf", "libsecure_env_tpm", ], diff --git a/host/commands/secure_env/rust/ffi.rs b/host/commands/secure_env/rust/ffi.rs index e6360cdd4..9ffed7b7c 100644 --- a/host/commands/secure_env/rust/ffi.rs +++ b/host/commands/secure_env/rust/ffi.rs @@ -20,18 +20,21 @@ extern crate alloc; use kmr_wire::keymint::SecurityLevel; use libc::c_int; use log::error; +use std::os::fd::FromRawFd; /// FFI wrapper around [`kmr_cf::ta_main`]. /// /// # Safety /// -/// `fd_in` and `fd_out` must be valid and open file descriptors. +/// `fd_in`, `fd_out`, and `snapshot_socket_fd` must be valid and open file descriptors and the +/// caller must not use or close them after the call. #[no_mangle] pub unsafe extern "C" fn kmr_ta_main( fd_in: c_int, fd_out: c_int, security_level: c_int, trm: *mut libc::c_void, + snapshot_socket_fd: c_int, ) { let security_level = match security_level { x if x == SecurityLevel::TrustedEnvironment as i32 => SecurityLevel::TrustedEnvironment, @@ -42,6 +45,10 @@ pub unsafe extern "C" fn kmr_ta_main( SecurityLevel::Software } }; + let snapshot_socket = + // SAFETY: fd being valid and open and exclusive is asserted in the unsafe function's + // preconditions, so this is pushed up to the caller. + unsafe { std::os::unix::net::UnixStream::from_raw_fd(snapshot_socket_fd) }; // SAFETY: The caller guarantees that `fd_in` and `fd_out` are valid and open. - unsafe { kmr_cf::ta_main(fd_in, fd_out, security_level, trm) } + unsafe { kmr_cf::ta_main(fd_in, fd_out, security_level, trm, snapshot_socket) } } diff --git a/host/commands/secure_env/rust/kmr_ta.h b/host/commands/secure_env/rust/kmr_ta.h index ce70873a1..efa9f2da0 100644 --- a/host/commands/secure_env/rust/kmr_ta.h +++ b/host/commands/secure_env/rust/kmr_ta.h @@ -26,7 +26,10 @@ extern "C" { // values from SecurityLevel.aidl. // - trm: pointer to a valid `TpmResourceManager`, which must remain valid // for the entire duration of the function execution. -void kmr_ta_main(int fd_in, int fd_out, int security_level, void* trm); +// - snapshot_socket_fd: file descriptor for a socket used to communicate with +// the secure_env suspend-resume handler thread. +void kmr_ta_main(int fd_in, int fd_out, int security_level, void* trm, + int snapshot_socket_fd); #ifdef __cplusplus } diff --git a/host/commands/secure_env/rust/lib.rs b/host/commands/secure_env/rust/lib.rs index 49508b92f..eb2536b7f 100644 --- a/host/commands/secure_env/rust/lib.rs +++ b/host/commands/secure_env/rust/lib.rs @@ -32,6 +32,7 @@ use libc::c_int; use log::{error, info, trace}; use std::ffi::CString; use std::io::{Read, Write}; +use std::os::fd::AsRawFd; use std::os::unix::{ffi::OsStrExt, io::FromRawFd}; pub mod attest; @@ -44,16 +45,23 @@ mod tpm; #[cfg(test)] mod tests; +// See `SnapshotSocketMessage` in suspend_resume_handler.h for docs. +const SNAPSHOT_SOCKET_MESSAGE_SUSPEND: u8 = 1; +const SNAPSHOT_SOCKET_MESSAGE_SUSPEND_ACK: u8 = 2; +const SNAPSHOT_SOCKET_MESSAGE_RESUME: u8 = 3; + /// Main routine for the KeyMint TA. Only returns if there is a fatal error. /// /// # Safety /// -/// `fd_in` and `fd_out` must be valid and open file descriptors. +/// `fd_in` and `fd_out` must be valid and open file descriptors and the caller must not use or +/// close them after the call. pub unsafe fn ta_main( fd_in: c_int, fd_out: c_int, security_level: SecurityLevel, trm: *mut libc::c_void, + mut snapshot_socket: std::os::unix::net::UnixStream, ) { log::set_logger(&AndroidCppLogger).unwrap(); log::set_max_level(log::LevelFilter::Debug); // Filtering happens elsewhere @@ -62,9 +70,9 @@ pub unsafe fn ta_main( fd_in, fd_out, security_level, ); - // SAFETY: The caller guarantees that `fd_in` is valid and open. + // SAFETY: The caller guarantees that `fd_in` is valid and open and exclusive. let mut infile = unsafe { std::fs::File::from_raw_fd(fd_in) }; - // SAFETY: The caller guarantees that `fd_out` is valid and open. + // SAFETY: The caller guarantees that `fd_out` is valid and open and exclusive. let mut outfile = unsafe { std::fs::File::from_raw_fd(fd_out) }; let hw_info = HardwareInfo { @@ -147,52 +155,107 @@ pub unsafe fn ta_main( let mut buf = [0; kmr_wire::DEFAULT_MAX_SIZE]; loop { - // Read a request message from the pipe, as a 4-byte BE length followed by the message. - let mut req_len_data = [0u8; 4]; - if let Err(e) = infile.read_exact(&mut req_len_data) { - error!("FATAL: Failed to read request length from connection: {:?}", e); - return; - } - let req_len = u32::from_be_bytes(req_len_data) as usize; - if req_len > kmr_wire::DEFAULT_MAX_SIZE { - error!("FATAL: Request too long ({})", req_len); - return; - } - let req_data = &mut buf[..req_len]; - if let Err(e) = infile.read_exact(req_data) { - error!( - "FATAL: Failed to read request data of length {} from connection: {:?}", - req_len, e - ); + // Wait for data from either `infile` or `snapshot_socket`. If both have data, we prioritize + // processing only `infile` until it is empty so that there is no pending state when we + // suspend the loop. + let mut fd_set = nix::sys::select::FdSet::new(); + fd_set.insert(infile.as_raw_fd()); + fd_set.insert(snapshot_socket.as_raw_fd()); + if let Err(e) = nix::sys::select::select( + None, + /*readfds=*/ Some(&mut fd_set), + None, + None, + /*timeout=*/ None, + ) { + error!("FATAL: Failed to select on input FDs: {:?}", e); return; } - // Pass to the TA to process. - trace!("-> TA: received data: (len={})", req_data.len()); - let rsp = ta.process(req_data); - trace!("<- TA: send data: (len={})", rsp.len()); + if fd_set.contains(infile.as_raw_fd()) { + // Read a request message from the pipe, as a 4-byte BE length followed by the message. + let mut req_len_data = [0u8; 4]; + if let Err(e) = infile.read_exact(&mut req_len_data) { + error!("FATAL: Failed to read request length from connection: {:?}", e); + return; + } + let req_len = u32::from_be_bytes(req_len_data) as usize; + if req_len > kmr_wire::DEFAULT_MAX_SIZE { + error!("FATAL: Request too long ({})", req_len); + return; + } + let req_data = &mut buf[..req_len]; + if let Err(e) = infile.read_exact(req_data) { + error!( + "FATAL: Failed to read request data of length {} from connection: {:?}", + req_len, e + ); + return; + } + + // Pass to the TA to process. + trace!("-> TA: received data: (len={})", req_data.len()); + let rsp = ta.process(req_data); + trace!("<- TA: send data: (len={})", rsp.len()); - // Send the response message down the pipe, as a 4-byte BE length followed by the message. - let rsp_len: u32 = match rsp.len().try_into() { - Ok(l) => l, - Err(_e) => { - error!("FATAL: Response too long (len={})", rsp.len()); + // Send the response message down the pipe, as a 4-byte BE length followed by the message. + let rsp_len: u32 = match rsp.len().try_into() { + Ok(l) => l, + Err(_e) => { + error!("FATAL: Response too long (len={})", rsp.len()); + return; + } + }; + let rsp_len_data = rsp_len.to_be_bytes(); + if let Err(e) = outfile.write_all(&rsp_len_data[..]) { + error!("FATAL: Failed to write response length to connection: {:?}", e); return; } - }; - let rsp_len_data = rsp_len.to_be_bytes(); - if let Err(e) = outfile.write_all(&rsp_len_data[..]) { - error!("FATAL: Failed to write response length to connection: {:?}", e); - return; + if let Err(e) = outfile.write_all(&rsp) { + error!( + "FATAL: Failed to write response data of length {} to connection: {:?}", + rsp_len, e + ); + return; + } + let _ = outfile.flush(); + + continue; } - if let Err(e) = outfile.write_all(&rsp) { - error!( - "FATAL: Failed to write response data of length {} to connection: {:?}", - rsp_len, e - ); - return; + + if fd_set.contains(snapshot_socket.as_raw_fd()) { + // Read suspend request. + let mut suspend_request = 0u8; + if let Err(e) = snapshot_socket.read_exact(std::slice::from_mut(&mut suspend_request)) { + error!("FATAL: Failed to read suspend request: {:?}", e); + return; + } + if suspend_request != SNAPSHOT_SOCKET_MESSAGE_SUSPEND { + error!( + "FATAL: Unexpected value from snapshot socket: got {}, expected {}", + suspend_request, SNAPSHOT_SOCKET_MESSAGE_SUSPEND + ); + return; + } + // Write ACK. + if let Err(e) = snapshot_socket.write_all(&[SNAPSHOT_SOCKET_MESSAGE_SUSPEND_ACK]) { + error!("FATAL: Failed to write suspend ACK request: {:?}", e); + return; + } + // Block until we get a resume request. + let mut resume_request = 0u8; + if let Err(e) = snapshot_socket.read_exact(std::slice::from_mut(&mut resume_request)) { + error!("FATAL: Failed to read resume request: {:?}", e); + return; + } + if resume_request != SNAPSHOT_SOCKET_MESSAGE_RESUME { + error!( + "FATAL: Unexpected value from snapshot socket: got {}, expected {}", + resume_request, SNAPSHOT_SOCKET_MESSAGE_RESUME + ); + return; + } } - let _ = outfile.flush(); } } diff --git a/host/commands/secure_env/secure_env_not_windows_main.cpp b/host/commands/secure_env/secure_env_not_windows_main.cpp index d9122df2e..b7a617a8a 100644 --- a/host/commands/secure_env/secure_env_not_windows_main.cpp +++ b/host/commands/secure_env/secure_env_not_windows_main.cpp @@ -259,13 +259,16 @@ Result SecureEnvMain(int argc, char** argv) { } // go/cf-secure-env-snapshot + auto [rust_snapshot_socket1, rust_snapshot_socket2] = + CF_EXPECT(SharedFD::SocketPair(AF_UNIX, SOCK_STREAM, 0)); SnapshotRunningFlag running; SharedFD channel_to_run_cvd = DupFdFlag(FLAGS_snapshot_control_fd); EventFdsManager event_fds_manager = CF_EXPECT(EventFdsManager::Create()); EventNotifiers suspended_notifiers; SnapshotCommandHandler suspend_resume_handler( - channel_to_run_cvd, event_fds_manager, suspended_notifiers, running); + channel_to_run_cvd, event_fds_manager, suspended_notifiers, running, + std::move(rust_snapshot_socket1)); // The guest image may have either the C++ implementation of // KeyMint/Keymaster, xor the Rust implementation of KeyMint. Those different @@ -281,8 +284,12 @@ Result SecureEnvMain(int argc, char** argv) { int keymint_in = FLAGS_keymint_fd_in; int keymint_out = FLAGS_keymint_fd_out; TpmResourceManager* rm = resource_manager; - threads.emplace_back([rm, keymint_in, keymint_out, security_level]() { - kmr_ta_main(keymint_in, keymint_out, security_level, rm); + threads.emplace_back([rm, keymint_in, keymint_out, security_level, + rust_snapshot_socket2 = + std::move(rust_snapshot_socket2)]() { + int snapshot_socket_fd = std::move(rust_snapshot_socket2)->UNMANAGED_Dup(); + kmr_ta_main(keymint_in, keymint_out, security_level, rm, + snapshot_socket_fd); }); #endif diff --git a/host/commands/secure_env/suspend_resume_handler.cpp b/host/commands/secure_env/suspend_resume_handler.cpp index a2b55aedc..0b471349a 100644 --- a/host/commands/secure_env/suspend_resume_handler.cpp +++ b/host/commands/secure_env/suspend_resume_handler.cpp @@ -21,6 +21,34 @@ #include "host/libs/config/cuttlefish_config.h" namespace cuttlefish { +namespace { + +Result WriteSuspendRequest(const SharedFD& socket) { + const SnapshotSocketMessage suspend_request = SnapshotSocketMessage::kSuspend; + CF_EXPECT_EQ(sizeof(suspend_request), + socket->Write(&suspend_request, sizeof(suspend_request)), + "socket write failed: " << socket->StrError()); + return {}; +} + +Result ReadSuspendAck(const SharedFD& socket) { + SnapshotSocketMessage ack_response; + CF_EXPECT_EQ(sizeof(ack_response), + socket->Read(&ack_response, sizeof(ack_response)), + "socket read failed: " << socket->StrError()); + CF_EXPECT_EQ(SnapshotSocketMessage::kSuspendAck, ack_response); + return {}; +} + +Result WriteResumeRequest(const SharedFD& socket) { + const SnapshotSocketMessage resume_request = SnapshotSocketMessage::kResume; + CF_EXPECT_EQ(sizeof(resume_request), + socket->Write(&resume_request, sizeof(resume_request)), + "socket write failed: " << socket->StrError()); + return {}; +} + +} // namespace SnapshotCommandHandler::~SnapshotCommandHandler() { Join(); } @@ -32,11 +60,13 @@ void SnapshotCommandHandler::Join() { SnapshotCommandHandler::SnapshotCommandHandler( SharedFD channel_to_run_cvd, EventFdsManager& event_fds_manager, - EventNotifiers& suspended_notifiers, SnapshotRunningFlag& running) + EventNotifiers& suspended_notifiers, SnapshotRunningFlag& running, + SharedFD rust_snapshot_socket) : channel_to_run_cvd_(channel_to_run_cvd), event_fds_manager_(event_fds_manager), suspended_notifiers_(suspended_notifiers), - shared_running_(running) { + shared_running_(running), + rust_snapshot_socket_(std::move(rust_snapshot_socket)) { handler_thread_ = std::thread([this]() { while (true) { auto result = SuspendResumeHandler(); @@ -67,13 +97,18 @@ Result SnapshotCommandHandler::SuspendResumeHandler() { switch (snapshot_cmd) { case ExtendedActionType::kSuspend: { LOG(DEBUG) << "Handling suspended..."; + // Request all worker threads to suspend. shared_running_.UnsetRunning(); // running := false CF_EXPECT(event_fds_manager_.SuspendKeymasterResponder()); CF_EXPECT(event_fds_manager_.SuspendGatekeeperResponder()); CF_EXPECT(event_fds_manager_.SuspendOemlockResponder()); + CF_EXPECT(WriteSuspendRequest(rust_snapshot_socket_)); + // Wait for ACKs from worker threads. suspended_notifiers_.keymaster_suspended_.WaitAndReset(); suspended_notifiers_.gatekeeper_suspended_.WaitAndReset(); suspended_notifiers_.oemlock_suspended_.WaitAndReset(); + CF_EXPECT(ReadSuspendAck(rust_snapshot_socket_)); + // Write response to run_cvd. auto response = LauncherResponse::kSuccess; const auto n_written = channel_to_run_cvd_->Write(&response, sizeof(response)); @@ -82,7 +117,10 @@ Result SnapshotCommandHandler::SuspendResumeHandler() { }; case ExtendedActionType::kResume: { LOG(DEBUG) << "Handling resume..."; + // Request all worker threads to resume. shared_running_.SetRunning(); // running := true, and notifies all + CF_EXPECT(WriteResumeRequest(rust_snapshot_socket_)); + // Write response to run_cvd. auto response = LauncherResponse::kSuccess; const auto n_written = channel_to_run_cvd_->Write(&response, sizeof(response)); diff --git a/host/commands/secure_env/suspend_resume_handler.h b/host/commands/secure_env/suspend_resume_handler.h index b36f3cc65..e2e8c20c2 100644 --- a/host/commands/secure_env/suspend_resume_handler.h +++ b/host/commands/secure_env/suspend_resume_handler.h @@ -26,13 +26,43 @@ namespace cuttlefish { +// `SnapshotCommandHandler` can request threads to suspend and resume using the +// following protocol. Each message on the socket is 1 byte. +// +// Suspend flow: +// +// 1. `SnapshotCommandHandler` writes `kSuspend` to the socket. +// 2. When the worker thread sees the socket is readable, it should assume the +// incoming message is `kSuspend`, finish all non-blocking work, read the +// `kSuspend` message, write a `kSuspendAck` message back into the socket, +// and then, finally, block until it receives another message from the +// socket (which will always be `kResume`). +// 3. `SnapshotCommandHandler` waits for the `kSuspendAck` to ensure the +// worker thread is actually suspended and then proceeds. +// +// Resume flow: +// +// 1. The worker thread is already blocked waiting for a `kResume` from the +// socket. +// 2. `SnapshotCommandHandler` sends a `kResume`. +// 3. The worker thread sees it and goes back to normal operation. +// +// WARNING: Keep in sync with the `SNAPSHOT_SOCKET_MESSAGE_*` constants in +// secure_env/rust/lib.rs. +enum SnapshotSocketMessage : uint8_t { + kSuspend = 1, + kSuspendAck = 2, + kResume = 3, +}; + class SnapshotCommandHandler { public: ~SnapshotCommandHandler(); SnapshotCommandHandler(SharedFD channel_to_run_cvd, EventFdsManager& event_fds, EventNotifiers& suspended_notifiers, - SnapshotRunningFlag& running); + SnapshotRunningFlag& running, + SharedFD rust_snapshot_socket); private: Result SuspendResumeHandler(); @@ -43,6 +73,7 @@ class SnapshotCommandHandler { EventFdsManager& event_fds_manager_; EventNotifiers& suspended_notifiers_; SnapshotRunningFlag& shared_running_; // shared by other components outside + SharedFD rust_snapshot_socket_; std::thread handler_thread_; }; -- cgit v1.2.3 From deac5bf0f1f1b0914e45f958e8832a62f189e9a8 Mon Sep 17 00:00:00 2001 From: Hayward Chan Date: Tue, 7 Nov 2023 11:00:50 +0000 Subject: Fix config_defualtListenerAccessPackages for cuttlefish wear overlay. This value was clobbered by GoogleConfigOverlay and needs to be fixed in the cuttlefish wear overlay. Test: Manually run the cuttlefish with locally built instance and verify that local notifications work as expected. Bug: 309525046 Change-Id: I340e524e5604dbefc80b6019629f610f8e43e83e --- shared/wear/overlays/core/res/values/config.xml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/shared/wear/overlays/core/res/values/config.xml b/shared/wear/overlays/core/res/values/config.xml index 13e8a049e..4a20b3a3f 100644 --- a/shared/wear/overlays/core/res/values/config.xml +++ b/shared/wear/overlays/core/res/values/config.xml @@ -127,4 +127,8 @@ com.google.android.wearable.assistant + + + com.google.android.wearable.media.sessions:com.google.wear.services + -- cgit v1.2.3 From 396b37849b6f8afe8277e43a5639ffab6fda0752 Mon Sep 17 00:00:00 2001 From: Frederick Mayle Date: Wed, 1 Nov 2023 14:09:17 -0700 Subject: secure_env: add suspend-resume support to rust impl This mimics the logic of the C++ suspend-resume code, but to reduce FFI surface area, instead of using a few different primitives (two event_fds and a condition variable), it uses one socket pair and a simple protocol. (cherry picked from https://android-review.googlesource.com/q/commit:ef6ee5db70574d3cb711366c2c4d1f246bf3d04b) Bug: 295028759 Test: cvd suspend; cvd resume Change-Id: I55628436e9236efa08d85f101b8684a6d2093547 (cherry picked from commit 467dfbb5a886fcfee94f171a343ca907e195406d) Merged-In: I55628436e9236efa08d85f101b8684a6d2093547 --- host/commands/secure_env/rust/Android.bp | 2 + host/commands/secure_env/rust/ffi.rs | 11 +- host/commands/secure_env/rust/kmr_ta.h | 5 +- host/commands/secure_env/rust/lib.rs | 145 +++++++++++++++------ .../secure_env/secure_env_not_windows_main.cpp | 13 +- .../commands/secure_env/suspend_resume_handler.cpp | 42 +++++- host/commands/secure_env/suspend_resume_handler.h | 33 ++++- 7 files changed, 201 insertions(+), 50 deletions(-) diff --git a/host/commands/secure_env/rust/Android.bp b/host/commands/secure_env/rust/Android.bp index 0d7df9a77..2902997d4 100644 --- a/host/commands/secure_env/rust/Android.bp +++ b/host/commands/secure_env/rust/Android.bp @@ -39,6 +39,7 @@ rust_library_host { "libkmr_wire", "liblibc", "liblog_rust", + "libnix", "libprotobuf", "libsecure_env_tpm", ], @@ -72,6 +73,7 @@ rust_test_host { "libkmr_wire", "liblibc", "liblog_rust", + "libnix", "libprotobuf", "libsecure_env_tpm", ], diff --git a/host/commands/secure_env/rust/ffi.rs b/host/commands/secure_env/rust/ffi.rs index e6360cdd4..9ffed7b7c 100644 --- a/host/commands/secure_env/rust/ffi.rs +++ b/host/commands/secure_env/rust/ffi.rs @@ -20,18 +20,21 @@ extern crate alloc; use kmr_wire::keymint::SecurityLevel; use libc::c_int; use log::error; +use std::os::fd::FromRawFd; /// FFI wrapper around [`kmr_cf::ta_main`]. /// /// # Safety /// -/// `fd_in` and `fd_out` must be valid and open file descriptors. +/// `fd_in`, `fd_out`, and `snapshot_socket_fd` must be valid and open file descriptors and the +/// caller must not use or close them after the call. #[no_mangle] pub unsafe extern "C" fn kmr_ta_main( fd_in: c_int, fd_out: c_int, security_level: c_int, trm: *mut libc::c_void, + snapshot_socket_fd: c_int, ) { let security_level = match security_level { x if x == SecurityLevel::TrustedEnvironment as i32 => SecurityLevel::TrustedEnvironment, @@ -42,6 +45,10 @@ pub unsafe extern "C" fn kmr_ta_main( SecurityLevel::Software } }; + let snapshot_socket = + // SAFETY: fd being valid and open and exclusive is asserted in the unsafe function's + // preconditions, so this is pushed up to the caller. + unsafe { std::os::unix::net::UnixStream::from_raw_fd(snapshot_socket_fd) }; // SAFETY: The caller guarantees that `fd_in` and `fd_out` are valid and open. - unsafe { kmr_cf::ta_main(fd_in, fd_out, security_level, trm) } + unsafe { kmr_cf::ta_main(fd_in, fd_out, security_level, trm, snapshot_socket) } } diff --git a/host/commands/secure_env/rust/kmr_ta.h b/host/commands/secure_env/rust/kmr_ta.h index ce70873a1..efa9f2da0 100644 --- a/host/commands/secure_env/rust/kmr_ta.h +++ b/host/commands/secure_env/rust/kmr_ta.h @@ -26,7 +26,10 @@ extern "C" { // values from SecurityLevel.aidl. // - trm: pointer to a valid `TpmResourceManager`, which must remain valid // for the entire duration of the function execution. -void kmr_ta_main(int fd_in, int fd_out, int security_level, void* trm); +// - snapshot_socket_fd: file descriptor for a socket used to communicate with +// the secure_env suspend-resume handler thread. +void kmr_ta_main(int fd_in, int fd_out, int security_level, void* trm, + int snapshot_socket_fd); #ifdef __cplusplus } diff --git a/host/commands/secure_env/rust/lib.rs b/host/commands/secure_env/rust/lib.rs index 49508b92f..eb2536b7f 100644 --- a/host/commands/secure_env/rust/lib.rs +++ b/host/commands/secure_env/rust/lib.rs @@ -32,6 +32,7 @@ use libc::c_int; use log::{error, info, trace}; use std::ffi::CString; use std::io::{Read, Write}; +use std::os::fd::AsRawFd; use std::os::unix::{ffi::OsStrExt, io::FromRawFd}; pub mod attest; @@ -44,16 +45,23 @@ mod tpm; #[cfg(test)] mod tests; +// See `SnapshotSocketMessage` in suspend_resume_handler.h for docs. +const SNAPSHOT_SOCKET_MESSAGE_SUSPEND: u8 = 1; +const SNAPSHOT_SOCKET_MESSAGE_SUSPEND_ACK: u8 = 2; +const SNAPSHOT_SOCKET_MESSAGE_RESUME: u8 = 3; + /// Main routine for the KeyMint TA. Only returns if there is a fatal error. /// /// # Safety /// -/// `fd_in` and `fd_out` must be valid and open file descriptors. +/// `fd_in` and `fd_out` must be valid and open file descriptors and the caller must not use or +/// close them after the call. pub unsafe fn ta_main( fd_in: c_int, fd_out: c_int, security_level: SecurityLevel, trm: *mut libc::c_void, + mut snapshot_socket: std::os::unix::net::UnixStream, ) { log::set_logger(&AndroidCppLogger).unwrap(); log::set_max_level(log::LevelFilter::Debug); // Filtering happens elsewhere @@ -62,9 +70,9 @@ pub unsafe fn ta_main( fd_in, fd_out, security_level, ); - // SAFETY: The caller guarantees that `fd_in` is valid and open. + // SAFETY: The caller guarantees that `fd_in` is valid and open and exclusive. let mut infile = unsafe { std::fs::File::from_raw_fd(fd_in) }; - // SAFETY: The caller guarantees that `fd_out` is valid and open. + // SAFETY: The caller guarantees that `fd_out` is valid and open and exclusive. let mut outfile = unsafe { std::fs::File::from_raw_fd(fd_out) }; let hw_info = HardwareInfo { @@ -147,52 +155,107 @@ pub unsafe fn ta_main( let mut buf = [0; kmr_wire::DEFAULT_MAX_SIZE]; loop { - // Read a request message from the pipe, as a 4-byte BE length followed by the message. - let mut req_len_data = [0u8; 4]; - if let Err(e) = infile.read_exact(&mut req_len_data) { - error!("FATAL: Failed to read request length from connection: {:?}", e); - return; - } - let req_len = u32::from_be_bytes(req_len_data) as usize; - if req_len > kmr_wire::DEFAULT_MAX_SIZE { - error!("FATAL: Request too long ({})", req_len); - return; - } - let req_data = &mut buf[..req_len]; - if let Err(e) = infile.read_exact(req_data) { - error!( - "FATAL: Failed to read request data of length {} from connection: {:?}", - req_len, e - ); + // Wait for data from either `infile` or `snapshot_socket`. If both have data, we prioritize + // processing only `infile` until it is empty so that there is no pending state when we + // suspend the loop. + let mut fd_set = nix::sys::select::FdSet::new(); + fd_set.insert(infile.as_raw_fd()); + fd_set.insert(snapshot_socket.as_raw_fd()); + if let Err(e) = nix::sys::select::select( + None, + /*readfds=*/ Some(&mut fd_set), + None, + None, + /*timeout=*/ None, + ) { + error!("FATAL: Failed to select on input FDs: {:?}", e); return; } - // Pass to the TA to process. - trace!("-> TA: received data: (len={})", req_data.len()); - let rsp = ta.process(req_data); - trace!("<- TA: send data: (len={})", rsp.len()); + if fd_set.contains(infile.as_raw_fd()) { + // Read a request message from the pipe, as a 4-byte BE length followed by the message. + let mut req_len_data = [0u8; 4]; + if let Err(e) = infile.read_exact(&mut req_len_data) { + error!("FATAL: Failed to read request length from connection: {:?}", e); + return; + } + let req_len = u32::from_be_bytes(req_len_data) as usize; + if req_len > kmr_wire::DEFAULT_MAX_SIZE { + error!("FATAL: Request too long ({})", req_len); + return; + } + let req_data = &mut buf[..req_len]; + if let Err(e) = infile.read_exact(req_data) { + error!( + "FATAL: Failed to read request data of length {} from connection: {:?}", + req_len, e + ); + return; + } + + // Pass to the TA to process. + trace!("-> TA: received data: (len={})", req_data.len()); + let rsp = ta.process(req_data); + trace!("<- TA: send data: (len={})", rsp.len()); - // Send the response message down the pipe, as a 4-byte BE length followed by the message. - let rsp_len: u32 = match rsp.len().try_into() { - Ok(l) => l, - Err(_e) => { - error!("FATAL: Response too long (len={})", rsp.len()); + // Send the response message down the pipe, as a 4-byte BE length followed by the message. + let rsp_len: u32 = match rsp.len().try_into() { + Ok(l) => l, + Err(_e) => { + error!("FATAL: Response too long (len={})", rsp.len()); + return; + } + }; + let rsp_len_data = rsp_len.to_be_bytes(); + if let Err(e) = outfile.write_all(&rsp_len_data[..]) { + error!("FATAL: Failed to write response length to connection: {:?}", e); return; } - }; - let rsp_len_data = rsp_len.to_be_bytes(); - if let Err(e) = outfile.write_all(&rsp_len_data[..]) { - error!("FATAL: Failed to write response length to connection: {:?}", e); - return; + if let Err(e) = outfile.write_all(&rsp) { + error!( + "FATAL: Failed to write response data of length {} to connection: {:?}", + rsp_len, e + ); + return; + } + let _ = outfile.flush(); + + continue; } - if let Err(e) = outfile.write_all(&rsp) { - error!( - "FATAL: Failed to write response data of length {} to connection: {:?}", - rsp_len, e - ); - return; + + if fd_set.contains(snapshot_socket.as_raw_fd()) { + // Read suspend request. + let mut suspend_request = 0u8; + if let Err(e) = snapshot_socket.read_exact(std::slice::from_mut(&mut suspend_request)) { + error!("FATAL: Failed to read suspend request: {:?}", e); + return; + } + if suspend_request != SNAPSHOT_SOCKET_MESSAGE_SUSPEND { + error!( + "FATAL: Unexpected value from snapshot socket: got {}, expected {}", + suspend_request, SNAPSHOT_SOCKET_MESSAGE_SUSPEND + ); + return; + } + // Write ACK. + if let Err(e) = snapshot_socket.write_all(&[SNAPSHOT_SOCKET_MESSAGE_SUSPEND_ACK]) { + error!("FATAL: Failed to write suspend ACK request: {:?}", e); + return; + } + // Block until we get a resume request. + let mut resume_request = 0u8; + if let Err(e) = snapshot_socket.read_exact(std::slice::from_mut(&mut resume_request)) { + error!("FATAL: Failed to read resume request: {:?}", e); + return; + } + if resume_request != SNAPSHOT_SOCKET_MESSAGE_RESUME { + error!( + "FATAL: Unexpected value from snapshot socket: got {}, expected {}", + resume_request, SNAPSHOT_SOCKET_MESSAGE_RESUME + ); + return; + } } - let _ = outfile.flush(); } } diff --git a/host/commands/secure_env/secure_env_not_windows_main.cpp b/host/commands/secure_env/secure_env_not_windows_main.cpp index d9122df2e..b7a617a8a 100644 --- a/host/commands/secure_env/secure_env_not_windows_main.cpp +++ b/host/commands/secure_env/secure_env_not_windows_main.cpp @@ -259,13 +259,16 @@ Result SecureEnvMain(int argc, char** argv) { } // go/cf-secure-env-snapshot + auto [rust_snapshot_socket1, rust_snapshot_socket2] = + CF_EXPECT(SharedFD::SocketPair(AF_UNIX, SOCK_STREAM, 0)); SnapshotRunningFlag running; SharedFD channel_to_run_cvd = DupFdFlag(FLAGS_snapshot_control_fd); EventFdsManager event_fds_manager = CF_EXPECT(EventFdsManager::Create()); EventNotifiers suspended_notifiers; SnapshotCommandHandler suspend_resume_handler( - channel_to_run_cvd, event_fds_manager, suspended_notifiers, running); + channel_to_run_cvd, event_fds_manager, suspended_notifiers, running, + std::move(rust_snapshot_socket1)); // The guest image may have either the C++ implementation of // KeyMint/Keymaster, xor the Rust implementation of KeyMint. Those different @@ -281,8 +284,12 @@ Result SecureEnvMain(int argc, char** argv) { int keymint_in = FLAGS_keymint_fd_in; int keymint_out = FLAGS_keymint_fd_out; TpmResourceManager* rm = resource_manager; - threads.emplace_back([rm, keymint_in, keymint_out, security_level]() { - kmr_ta_main(keymint_in, keymint_out, security_level, rm); + threads.emplace_back([rm, keymint_in, keymint_out, security_level, + rust_snapshot_socket2 = + std::move(rust_snapshot_socket2)]() { + int snapshot_socket_fd = std::move(rust_snapshot_socket2)->UNMANAGED_Dup(); + kmr_ta_main(keymint_in, keymint_out, security_level, rm, + snapshot_socket_fd); }); #endif diff --git a/host/commands/secure_env/suspend_resume_handler.cpp b/host/commands/secure_env/suspend_resume_handler.cpp index a2b55aedc..0b471349a 100644 --- a/host/commands/secure_env/suspend_resume_handler.cpp +++ b/host/commands/secure_env/suspend_resume_handler.cpp @@ -21,6 +21,34 @@ #include "host/libs/config/cuttlefish_config.h" namespace cuttlefish { +namespace { + +Result WriteSuspendRequest(const SharedFD& socket) { + const SnapshotSocketMessage suspend_request = SnapshotSocketMessage::kSuspend; + CF_EXPECT_EQ(sizeof(suspend_request), + socket->Write(&suspend_request, sizeof(suspend_request)), + "socket write failed: " << socket->StrError()); + return {}; +} + +Result ReadSuspendAck(const SharedFD& socket) { + SnapshotSocketMessage ack_response; + CF_EXPECT_EQ(sizeof(ack_response), + socket->Read(&ack_response, sizeof(ack_response)), + "socket read failed: " << socket->StrError()); + CF_EXPECT_EQ(SnapshotSocketMessage::kSuspendAck, ack_response); + return {}; +} + +Result WriteResumeRequest(const SharedFD& socket) { + const SnapshotSocketMessage resume_request = SnapshotSocketMessage::kResume; + CF_EXPECT_EQ(sizeof(resume_request), + socket->Write(&resume_request, sizeof(resume_request)), + "socket write failed: " << socket->StrError()); + return {}; +} + +} // namespace SnapshotCommandHandler::~SnapshotCommandHandler() { Join(); } @@ -32,11 +60,13 @@ void SnapshotCommandHandler::Join() { SnapshotCommandHandler::SnapshotCommandHandler( SharedFD channel_to_run_cvd, EventFdsManager& event_fds_manager, - EventNotifiers& suspended_notifiers, SnapshotRunningFlag& running) + EventNotifiers& suspended_notifiers, SnapshotRunningFlag& running, + SharedFD rust_snapshot_socket) : channel_to_run_cvd_(channel_to_run_cvd), event_fds_manager_(event_fds_manager), suspended_notifiers_(suspended_notifiers), - shared_running_(running) { + shared_running_(running), + rust_snapshot_socket_(std::move(rust_snapshot_socket)) { handler_thread_ = std::thread([this]() { while (true) { auto result = SuspendResumeHandler(); @@ -67,13 +97,18 @@ Result SnapshotCommandHandler::SuspendResumeHandler() { switch (snapshot_cmd) { case ExtendedActionType::kSuspend: { LOG(DEBUG) << "Handling suspended..."; + // Request all worker threads to suspend. shared_running_.UnsetRunning(); // running := false CF_EXPECT(event_fds_manager_.SuspendKeymasterResponder()); CF_EXPECT(event_fds_manager_.SuspendGatekeeperResponder()); CF_EXPECT(event_fds_manager_.SuspendOemlockResponder()); + CF_EXPECT(WriteSuspendRequest(rust_snapshot_socket_)); + // Wait for ACKs from worker threads. suspended_notifiers_.keymaster_suspended_.WaitAndReset(); suspended_notifiers_.gatekeeper_suspended_.WaitAndReset(); suspended_notifiers_.oemlock_suspended_.WaitAndReset(); + CF_EXPECT(ReadSuspendAck(rust_snapshot_socket_)); + // Write response to run_cvd. auto response = LauncherResponse::kSuccess; const auto n_written = channel_to_run_cvd_->Write(&response, sizeof(response)); @@ -82,7 +117,10 @@ Result SnapshotCommandHandler::SuspendResumeHandler() { }; case ExtendedActionType::kResume: { LOG(DEBUG) << "Handling resume..."; + // Request all worker threads to resume. shared_running_.SetRunning(); // running := true, and notifies all + CF_EXPECT(WriteResumeRequest(rust_snapshot_socket_)); + // Write response to run_cvd. auto response = LauncherResponse::kSuccess; const auto n_written = channel_to_run_cvd_->Write(&response, sizeof(response)); diff --git a/host/commands/secure_env/suspend_resume_handler.h b/host/commands/secure_env/suspend_resume_handler.h index b36f3cc65..e2e8c20c2 100644 --- a/host/commands/secure_env/suspend_resume_handler.h +++ b/host/commands/secure_env/suspend_resume_handler.h @@ -26,13 +26,43 @@ namespace cuttlefish { +// `SnapshotCommandHandler` can request threads to suspend and resume using the +// following protocol. Each message on the socket is 1 byte. +// +// Suspend flow: +// +// 1. `SnapshotCommandHandler` writes `kSuspend` to the socket. +// 2. When the worker thread sees the socket is readable, it should assume the +// incoming message is `kSuspend`, finish all non-blocking work, read the +// `kSuspend` message, write a `kSuspendAck` message back into the socket, +// and then, finally, block until it receives another message from the +// socket (which will always be `kResume`). +// 3. `SnapshotCommandHandler` waits for the `kSuspendAck` to ensure the +// worker thread is actually suspended and then proceeds. +// +// Resume flow: +// +// 1. The worker thread is already blocked waiting for a `kResume` from the +// socket. +// 2. `SnapshotCommandHandler` sends a `kResume`. +// 3. The worker thread sees it and goes back to normal operation. +// +// WARNING: Keep in sync with the `SNAPSHOT_SOCKET_MESSAGE_*` constants in +// secure_env/rust/lib.rs. +enum SnapshotSocketMessage : uint8_t { + kSuspend = 1, + kSuspendAck = 2, + kResume = 3, +}; + class SnapshotCommandHandler { public: ~SnapshotCommandHandler(); SnapshotCommandHandler(SharedFD channel_to_run_cvd, EventFdsManager& event_fds, EventNotifiers& suspended_notifiers, - SnapshotRunningFlag& running); + SnapshotRunningFlag& running, + SharedFD rust_snapshot_socket); private: Result SuspendResumeHandler(); @@ -43,6 +73,7 @@ class SnapshotCommandHandler { EventFdsManager& event_fds_manager_; EventNotifiers& suspended_notifiers_; SnapshotRunningFlag& shared_running_; // shared by other components outside + SharedFD rust_snapshot_socket_; std::thread handler_thread_; }; -- cgit v1.2.3 From 48cb79f1d90f84dc41b1aceaf52a6063604d4fc3 Mon Sep 17 00:00:00 2001 From: Gil Cukierman Date: Thu, 9 Nov 2023 16:05:12 +0000 Subject: Implement Cellular Identifier Transparency In Cuttlefish Bug: 276752426 Change-Id: I8a7b8715e5491ed345449f2291832acea746c675 Test: mm --- guest/hals/ril/reference-libril/RefRadioNetwork.cpp | 12 ++++++++++++ guest/hals/ril/reference-libril/RefRadioNetwork.h | 6 ++++++ 2 files changed, 18 insertions(+) diff --git a/guest/hals/ril/reference-libril/RefRadioNetwork.cpp b/guest/hals/ril/reference-libril/RefRadioNetwork.cpp index 407efaa5e..8fac33261 100644 --- a/guest/hals/ril/reference-libril/RefRadioNetwork.cpp +++ b/guest/hals/ril/reference-libril/RefRadioNetwork.cpp @@ -89,4 +89,16 @@ ScopedAStatus RefRadioNetwork::isNullCipherAndIntegrityEnabled(int32_t serial) { respond()->isNullCipherAndIntegrityEnabledResponse(responseInfo(serial), true); return ok(); } + +ScopedAStatus RefRadioNetwork::setCellularIdentifierTransparencyEnabled(int32_t serial, bool enabled) { + mIsCellualIdentifierTransparencyEnabled = enabled; + respond()->setCellularIdentifierTransparencyEnabledResponse(responseInfo(serial)); + return ok(); +} + +ScopedAStatus RefRadioNetwork::isCellularIdentifierTransparencyEnabled(int32_t serial) { + respond()->isCellularIdentifierTransparencyEnabledResponse( + responseInfo(serial), mIsCellualIdentifierTransparencyEnabled); + return ok(); +} } // namespace cf::ril diff --git a/guest/hals/ril/reference-libril/RefRadioNetwork.h b/guest/hals/ril/reference-libril/RefRadioNetwork.h index 3b6ad5ea9..a6fee003d 100644 --- a/guest/hals/ril/reference-libril/RefRadioNetwork.h +++ b/guest/hals/ril/reference-libril/RefRadioNetwork.h @@ -22,6 +22,8 @@ namespace cf::ril { class RefRadioNetwork : public android::hardware::radio::compat::RadioNetwork { ::aidl::android::hardware::radio::network::UsageSetting mUsageSetting = ::aidl::android::hardware::radio::network::UsageSetting::VOICE_CENTRIC; + // As per the specs, the default is true. + bool mIsCellualIdentifierTransparencyEnabled = true; public: using android::hardware::radio::compat::RadioNetwork::RadioNetwork; @@ -51,6 +53,10 @@ class RefRadioNetwork : public android::hardware::radio::compat::RadioNetwork { ::ndk::ScopedAStatus setNullCipherAndIntegrityEnabled(int32_t serial, bool enabled) override; ::ndk::ScopedAStatus isNullCipherAndIntegrityEnabled(int32_t serial) override; + + ::ndk::ScopedAStatus setCellularIdentifierTransparencyEnabled(int32_t serial, bool enabled) override; + + ::ndk::ScopedAStatus isCellularIdentifierTransparencyEnabled(int32_t serial) override; }; } // namespace cf::ril -- cgit v1.2.3 From 3c0ec29bcfa9d08e64e42776d50ba6b279505548 Mon Sep 17 00:00:00 2001 From: Emilian Peev Date: Tue, 14 Nov 2023 23:37:57 +0000 Subject: Cuttlefish: Enable eyes free videography service Bug: 297083874 Test: Camera CTS Change-Id: I96ba6de559ff1e5eb9cd35275a4cf7f6153b2f9f --- shared/camera/device_vendor.mk | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/shared/camera/device_vendor.mk b/shared/camera/device_vendor.mk index f116fa146..870f45ecb 100644 --- a/shared/camera/device_vendor.mk +++ b/shared/camera/device_vendor.mk @@ -22,6 +22,15 @@ ifeq ($(TARGET_USE_CAMERA_ADVANCED_EXTENSION_SAMPLE),true) PRODUCT_PACKAGES += \ androidx.camera.extensions.impl.advanced advancedSample_camera_extensions.xml \ libencoderjpeg_jni + +PRODUCT_ARTIFACT_PATH_REQUIREMENT_ALLOWED_LIST += \ + system/app/EyesFreeVidService/EyesFreeVidService.apk + +PRODUCT_PACKAGES += EyesFreeVidService + +PRODUCT_VENDOR_PROPERTIES += \ + ro.vendor.camera.extensions.package=android.camera.extensions.impl.service \ + ro.vendor.camera.extensions.service=android.camera.extensions.impl.service.EyesFreeVidService else PRODUCT_PACKAGES += androidx.camera.extensions.impl sample_camera_extensions.xml endif -- cgit v1.2.3 From 75a6fbbe8a188f9c8453e8e30162b9cc709cd14f Mon Sep 17 00:00:00 2001 From: yomna Date: Thu, 9 Nov 2023 07:32:52 +0000 Subject: Implement cellular ciphering transparency in cuttlefish Bug: b/283336425 Test: m Change-Id: Ib0970c4429651810c409c79ec883bfe42fd3bd41 --- guest/hals/ril/reference-libril/RefRadioNetwork.cpp | 10 ++++++++++ guest/hals/ril/reference-libril/RefRadioNetwork.h | 4 ++++ 2 files changed, 14 insertions(+) diff --git a/guest/hals/ril/reference-libril/RefRadioNetwork.cpp b/guest/hals/ril/reference-libril/RefRadioNetwork.cpp index 8fac33261..7f2442d2e 100644 --- a/guest/hals/ril/reference-libril/RefRadioNetwork.cpp +++ b/guest/hals/ril/reference-libril/RefRadioNetwork.cpp @@ -101,4 +101,14 @@ ScopedAStatus RefRadioNetwork::isCellularIdentifierTransparencyEnabled(int32_t s responseInfo(serial), mIsCellualIdentifierTransparencyEnabled); return ok(); } + +ScopedAStatus RefRadioNetwork::setSecurityAlgorithmsUpdatedEnabled(int32_t serial, bool enabled) { + respond()->setSecurityAlgorithmsUpdatedEnabledResponse(responseInfo(serial)); + return ok(); +} + +ScopedAStatus RefRadioNetwork::isSecurityAlgorithmsUpdatedEnabled(int32_t serial) { + respond()->isSecurityAlgorithmsUpdatedEnabledResponse(responseInfo(serial), true); + return ok(); +} } // namespace cf::ril diff --git a/guest/hals/ril/reference-libril/RefRadioNetwork.h b/guest/hals/ril/reference-libril/RefRadioNetwork.h index a6fee003d..ce6b47475 100644 --- a/guest/hals/ril/reference-libril/RefRadioNetwork.h +++ b/guest/hals/ril/reference-libril/RefRadioNetwork.h @@ -57,6 +57,10 @@ class RefRadioNetwork : public android::hardware::radio::compat::RadioNetwork { ::ndk::ScopedAStatus setCellularIdentifierTransparencyEnabled(int32_t serial, bool enabled) override; ::ndk::ScopedAStatus isCellularIdentifierTransparencyEnabled(int32_t serial) override; + + ::ndk::ScopedAStatus setSecurityAlgorithmsUpdatedEnabled(int32_t serial, bool enabled) override; + + ::ndk::ScopedAStatus isSecurityAlgorithmsUpdatedEnabled(int32_t serial) override; }; } // namespace cf::ril -- cgit v1.2.3 From 06c92e76bb666154c77d0d8d6a59963eecaa1391 Mon Sep 17 00:00:00 2001 From: yomna Date: Fri, 17 Nov 2023 02:38:28 +0000 Subject: Persist enablement in setSecurityAlgorithmsUpdatedEnabled Persist enablement in setSecurityAlgorithmsUpdatedEnabled to save state in cuttlefish. Bug: b/311219831 Test: m Change-Id: Ia8ea1067281ba71b49c8d5899cd9b118e57d71db --- .../hals/ril/reference-libril/RefRadioNetwork.cpp | 22 ++++++++++++---------- guest/hals/ril/reference-libril/RefRadioNetwork.h | 3 ++- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/guest/hals/ril/reference-libril/RefRadioNetwork.cpp b/guest/hals/ril/reference-libril/RefRadioNetwork.cpp index 7f2442d2e..941cd2470 100644 --- a/guest/hals/ril/reference-libril/RefRadioNetwork.cpp +++ b/guest/hals/ril/reference-libril/RefRadioNetwork.cpp @@ -91,24 +91,26 @@ ScopedAStatus RefRadioNetwork::isNullCipherAndIntegrityEnabled(int32_t serial) { } ScopedAStatus RefRadioNetwork::setCellularIdentifierTransparencyEnabled(int32_t serial, bool enabled) { - mIsCellualIdentifierTransparencyEnabled = enabled; - respond()->setCellularIdentifierTransparencyEnabledResponse(responseInfo(serial)); - return ok(); + mIsCellularIdentifierTransparencyEnabled = enabled; + respond()->setCellularIdentifierTransparencyEnabledResponse(responseInfo(serial)); + return ok(); } ScopedAStatus RefRadioNetwork::isCellularIdentifierTransparencyEnabled(int32_t serial) { - respond()->isCellularIdentifierTransparencyEnabledResponse( - responseInfo(serial), mIsCellualIdentifierTransparencyEnabled); - return ok(); + respond()->isCellularIdentifierTransparencyEnabledResponse( + responseInfo(serial), mIsCellularIdentifierTransparencyEnabled); + return ok(); } ScopedAStatus RefRadioNetwork::setSecurityAlgorithmsUpdatedEnabled(int32_t serial, bool enabled) { - respond()->setSecurityAlgorithmsUpdatedEnabledResponse(responseInfo(serial)); - return ok(); + mIsCipheringTransparencyEnabled = enabled; + respond()->setSecurityAlgorithmsUpdatedEnabledResponse(responseInfo(serial)); + return ok(); } ScopedAStatus RefRadioNetwork::isSecurityAlgorithmsUpdatedEnabled(int32_t serial) { - respond()->isSecurityAlgorithmsUpdatedEnabledResponse(responseInfo(serial), true); - return ok(); + respond()->isSecurityAlgorithmsUpdatedEnabledResponse(responseInfo(serial), + mIsCipheringTransparencyEnabled); + return ok(); } } // namespace cf::ril diff --git a/guest/hals/ril/reference-libril/RefRadioNetwork.h b/guest/hals/ril/reference-libril/RefRadioNetwork.h index ce6b47475..caf4e5e95 100644 --- a/guest/hals/ril/reference-libril/RefRadioNetwork.h +++ b/guest/hals/ril/reference-libril/RefRadioNetwork.h @@ -23,7 +23,8 @@ class RefRadioNetwork : public android::hardware::radio::compat::RadioNetwork { ::aidl::android::hardware::radio::network::UsageSetting mUsageSetting = ::aidl::android::hardware::radio::network::UsageSetting::VOICE_CENTRIC; // As per the specs, the default is true. - bool mIsCellualIdentifierTransparencyEnabled = true; + bool mIsCellularIdentifierTransparencyEnabled = true; + bool mIsCipheringTransparencyEnabled = true; public: using android::hardware::radio::compat::RadioNetwork::RadioNetwork; -- cgit v1.2.3 From 0ee58f6a285606e5d7698b61d2d9c57209b64391 Mon Sep 17 00:00:00 2001 From: Keith Mok Date: Wed, 12 Apr 2023 20:33:54 +0000 Subject: Add macsec support for cuttlefish AAOS Add macsec support for Android Automotive OS cuttlefish Bug: 254108688 Test: launch_cvd # in guest set macsec0 ip address ifconfig macsec0 10.10.10.2/24 # in host create macsec interface to talk to guest wpa_supplicant -dd -K -i cvd-ebr -Dmacsec_linux -c /tmp/a.conf # content of a.conf eapol_version=3 ap_scan=0 fast_reauth=1 network={ key_mgmt=NONE eapol_flags=0 macsec_policy=1 macsec_replay_protect=1 macsec_replay_window=0 mka_cak=0123456789ABCDEF0123456789ABCDEF mka_ckn=31323334 mka_priority=128 } # end of a.conf # enable LLDP frame to passthrough between cuttlefish and host network bridge echo 8 > /sys/devices/virtual/net/cvd-ebr/bridge/group_fwd_mask ifconfig macsec0 10.10.10.1/24 # on cutlefish ping -I macsec0 10.10.10.1 # ping from cuttlefish to host via macsec interface Change-Id: I7d92ceb98854b3101f424d4732e45d5607d3c20b --- shared/auto/device_vendor.mk | 10 +++++++ shared/auto/macsec/init.wpa_supplicant_macsec.rc | 22 ++++++++++++++ shared/auto/macsec/wpa_supplicant_macsec.conf | 15 ++++++++++ .../rro_overlay/ConnectivityOverlay/Android.bp | 35 ++++++++++++++++++++++ .../ConnectivityOverlay/AndroidManifest.xml | 25 ++++++++++++++++ .../ConnectivityOverlay/res/values/config.xml | 32 ++++++++++++++++++++ tests/hal/hal_implementation_test.cpp | 1 + 7 files changed, 140 insertions(+) create mode 100644 shared/auto/macsec/init.wpa_supplicant_macsec.rc create mode 100644 shared/auto/macsec/wpa_supplicant_macsec.conf create mode 100644 shared/auto/rro_overlay/ConnectivityOverlay/Android.bp create mode 100644 shared/auto/rro_overlay/ConnectivityOverlay/AndroidManifest.xml create mode 100644 shared/auto/rro_overlay/ConnectivityOverlay/res/values/config.xml diff --git a/shared/auto/device_vendor.mk b/shared/auto/device_vendor.mk index 207c06604..23f3ba443 100644 --- a/shared/auto/device_vendor.mk +++ b/shared/auto/device_vendor.mk @@ -94,6 +94,13 @@ PRODUCT_PACKAGES += $(LOCAL_AUDIOCONTROL_HAL_PRODUCT_PACKAGE) # CAN bus HAL PRODUCT_PACKAGES += android.hardware.automotive.can-service +# MACSEC HAL +PRODUCT_PACKAGES += android.hardware.macsec-service +PRODUCT_PACKAGES += wpa_supplicant_macsec +PRODUCT_COPY_FILES += \ + $(LOCAL_PATH)/macsec/wpa_supplicant_macsec.conf:$(TARGET_COPY_OUT_VENDOR)/etc/wpa_supplicant_macsec.conf \ + $(LOCAL_PATH)/macsec/init.wpa_supplicant_macsec.rc:$(TARGET_COPY_OUT_VENDOR)/etc/init/init.wpa_supplicant_macsec.rc + # Occupant Awareness HAL PRODUCT_PACKAGES += android.hardware.automotive.occupant_awareness@1.0-service include packages/services/Car/car_product/occupant_awareness/OccupantAwareness.mk @@ -133,4 +140,7 @@ DEVICE_PACKAGE_OVERLAYS += device/google/cuttlefish/shared/auto/overlay PRODUCT_PACKAGES += CarServiceOverlayCuttleFish GOOGLE_CAR_SERVICE_OVERLAY += CarServiceOverlayCuttleFishGoogle +PRODUCT_PACKAGES += ConnectivityOverlayCuttleFish +GOOGLE_CAR_SERVICE_OVERLAY += ConnectivityOverlayCuttleFishGoogle + TARGET_BOARD_INFO_FILE ?= device/google/cuttlefish/shared/auto/android-info.txt diff --git a/shared/auto/macsec/init.wpa_supplicant_macsec.rc b/shared/auto/macsec/init.wpa_supplicant_macsec.rc new file mode 100644 index 000000000..c5b30f676 --- /dev/null +++ b/shared/auto/macsec/init.wpa_supplicant_macsec.rc @@ -0,0 +1,22 @@ +# Copyright (C) 2023 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. + +on late-fs + wait /sys/class/net/eth1 + start wpa_supplicant_macsec + +service wpa_supplicant_macsec /vendor/bin/hw/wpa_supplicant_macsec \ + -i eth1 -Dmacsec_linux -c /vendor/etc/wpa_supplicant_macsec.conf + user root + oneshot diff --git a/shared/auto/macsec/wpa_supplicant_macsec.conf b/shared/auto/macsec/wpa_supplicant_macsec.conf new file mode 100644 index 000000000..2f4cb0410 --- /dev/null +++ b/shared/auto/macsec/wpa_supplicant_macsec.conf @@ -0,0 +1,15 @@ +eapol_version=3 +ap_scan=0 +fast_reauth=1 +# Example configuration for MACsec with preshared key +# mka_cak is not actual key but index for HAL +network={ + key_mgmt=NONE + eapol_flags=0 + macsec_policy=1 + macsec_replay_protect=1 + macsec_replay_window=0 + mka_cak=00000000000000000000000000000001 + mka_ckn=31323334 + mka_priority=128 +} diff --git a/shared/auto/rro_overlay/ConnectivityOverlay/Android.bp b/shared/auto/rro_overlay/ConnectivityOverlay/Android.bp new file mode 100644 index 000000000..218d4438b --- /dev/null +++ b/shared/auto/rro_overlay/ConnectivityOverlay/Android.bp @@ -0,0 +1,35 @@ +// Copyright (C) 2023 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 { + default_applicable_licenses: ["Android-Apache-2.0"], +} + +runtime_resource_overlay { + name: "ConnectivityOverlayCuttleFish", + resource_dirs: ["res"], + manifest: "AndroidManifest.xml", + sdk_version: "current", + product_specific: true +} + +override_runtime_resource_overlay { + name: "ConnectivityOverlayCuttleFishGoogle", + base: "ConnectivityOverlayCuttleFish", + package_name: "com.google.android.connectivity.resources.cuttlefish", + target_package_name: "com.google.android.connectivity.resources", +} + diff --git a/shared/auto/rro_overlay/ConnectivityOverlay/AndroidManifest.xml b/shared/auto/rro_overlay/ConnectivityOverlay/AndroidManifest.xml new file mode 100644 index 000000000..340fbb368 --- /dev/null +++ b/shared/auto/rro_overlay/ConnectivityOverlay/AndroidManifest.xml @@ -0,0 +1,25 @@ + + + + + + diff --git a/shared/auto/rro_overlay/ConnectivityOverlay/res/values/config.xml b/shared/auto/rro_overlay/ConnectivityOverlay/res/values/config.xml new file mode 100644 index 000000000..7033e83dc --- /dev/null +++ b/shared/auto/rro_overlay/ConnectivityOverlay/res/values/config.xml @@ -0,0 +1,32 @@ + + + + + + + + true + + + macsec0;11,14,15,27,28; + eth1;11,14,15,27,28; + + (eth|macsec)\\d+ + diff --git a/tests/hal/hal_implementation_test.cpp b/tests/hal/hal_implementation_test.cpp index 6a8e4a591..6e6d05efe 100644 --- a/tests/hal/hal_implementation_test.cpp +++ b/tests/hal/hal_implementation_test.cpp @@ -176,6 +176,7 @@ static const std::set kAutomotiveOnlyAidl = { "android.hardware.automotive.remoteaccess", "android.hardware.automotive.vehicle", "android.hardware.automotive.ivn", + "android.hardware.macsec", }; static const std::set kTvOnlyAidl = { -- cgit v1.2.3 From d24eb75beb4c1ab42c03cb1e7ab3b0cf66322095 Mon Sep 17 00:00:00 2001 From: Ram Muthiah Date: Sat, 11 Nov 2023 06:56:53 -0800 Subject: Adding multiconfig support in android-info To enable android-info.txt to have multiple guest config options, remove the requirement that config be at the front of android_info. Bug: 310326103 Test: local boot of tablet and other targets Change-Id: Ic9714f3038a5737277cea41589ad350efff9b0b4 Merged-In: Ic9714f3038a5737277cea41589ad350efff9b0b4 --- host/libs/config/config_flag.cpp | 35 ++++++++++++++++++++++++++--------- 1 file changed, 26 insertions(+), 9 deletions(-) diff --git a/host/libs/config/config_flag.cpp b/host/libs/config/config_flag.cpp index d4d515766..63afd2315 100644 --- a/host/libs/config/config_flag.cpp +++ b/host/libs/config/config_flag.cpp @@ -16,6 +16,7 @@ #include "host/libs/config/config_flag.h" +#include #include #include #include @@ -34,6 +35,8 @@ DEFINE_string(system_image_dir, CF_DEFAULTS_SYSTEM_IMAGE_DIR, ""); using gflags::FlagSettingMode::SET_FLAGS_DEFAULT; +using android::base::ReadFileToString; +using android::base::Split; namespace cuttlefish { @@ -192,22 +195,36 @@ class ConfigFlagImpl : public ConfigFlag { if (!FileExists(info_path)) { return {}; } - std::ifstream ifs{info_path}; - if (!ifs.is_open()) { + std::string android_info; + if(!ReadFileToString(info_path, &android_info)) { return {}; } - std::string android_info; - ifs >> android_info; - std::string_view local_android_info(android_info); - if (!android::base::ConsumePrefix(&local_android_info, "config=")) { + // grab the last value of config in android-info.txt, + // it's the setting that's respected. + // TODO (rammuthiah) Replace this logic with ParseMiscInfo + // from host/commands/assemble_cvd/misc_info.h + // Currently blocked on linking error for misc_info which is part of + // assemble_cvd and this bit of code which is in run_cvd. + size_t config_idx = android_info.rfind("config="); + if (config_idx == std::string::npos) { + return {}; + } + std::string config_value = android_info.substr(config_idx); + std::string_view local_config_value(config_value); + if (!android::base::ConsumePrefix(&local_config_value, "config=")) { + return {}; + } + auto split_config = Split(std::string{local_config_value},"\n"); + if (split_config.empty()) { return {}; } - if (!config_reader_.HasConfig(std::string{local_android_info})) { + config_value = split_config[0]; + if (!config_reader_.HasConfig(config_value)) { LOG(WARNING) << info_path << " contains invalid config preset: '" - << local_android_info << "'."; + << config_value << "'."; return {}; } - return std::string{local_android_info}; + return config_value; } ConfigReader& config_reader_; -- cgit v1.2.3 From f84bc3dba0ee211fac047b8d149e4f63d37c51e2 Mon Sep 17 00:00:00 2001 From: Ram Muthiah Date: Mon, 13 Nov 2023 16:12:51 -0800 Subject: Add gfxstream to android-info indicate to main launcher it's supported Bug: 310326103 Change-Id: I9d5ec1f663b151c2ccf8da2ae700943f929102a1 Merged-In: I9d5ec1f663b151c2ccf8da2ae700943f929102a1 --- shared/auto/android-info.txt | 1 + shared/auto_md/android-info.txt | 1 + shared/auto_portrait/android-info.txt | 1 + shared/foldable/android-info.txt | 1 + shared/go/android-info.txt | 1 + shared/minidroid/android-info.txt | 1 + shared/phone/android-info.txt | 1 + shared/slim/android-info.txt | 1 + shared/tv/android-info.txt | 1 + shared/wear/android-info.txt | 1 + 10 files changed, 10 insertions(+) diff --git a/shared/auto/android-info.txt b/shared/auto/android-info.txt index cc15c01a7..74c0e2ebc 100644 --- a/shared/auto/android-info.txt +++ b/shared/auto/android-info.txt @@ -1 +1,2 @@ config=auto +gfxstream=supported diff --git a/shared/auto_md/android-info.txt b/shared/auto_md/android-info.txt index ac7c0e796..1a130ffe4 100644 --- a/shared/auto_md/android-info.txt +++ b/shared/auto_md/android-info.txt @@ -1 +1,2 @@ config=auto_md +gfxstream=supported diff --git a/shared/auto_portrait/android-info.txt b/shared/auto_portrait/android-info.txt index 60b759e8c..ea15130d8 100644 --- a/shared/auto_portrait/android-info.txt +++ b/shared/auto_portrait/android-info.txt @@ -1 +1,2 @@ config=auto_portrait +gfxstream=supported diff --git a/shared/foldable/android-info.txt b/shared/foldable/android-info.txt index 855268558..53cfa1129 100644 --- a/shared/foldable/android-info.txt +++ b/shared/foldable/android-info.txt @@ -1 +1,2 @@ config=foldable +gfxstream=supported diff --git a/shared/go/android-info.txt b/shared/go/android-info.txt index 68f482634..ae9578c4e 100644 --- a/shared/go/android-info.txt +++ b/shared/go/android-info.txt @@ -1 +1,2 @@ config=go +gfxstream=supported diff --git a/shared/minidroid/android-info.txt b/shared/minidroid/android-info.txt index fc7981352..50453d60c 100644 --- a/shared/minidroid/android-info.txt +++ b/shared/minidroid/android-info.txt @@ -1 +1,2 @@ config=minidroid +gfxstream=supported diff --git a/shared/phone/android-info.txt b/shared/phone/android-info.txt index 2286c3d30..169f04d21 100644 --- a/shared/phone/android-info.txt +++ b/shared/phone/android-info.txt @@ -1 +1,2 @@ config=phone +gfxstream=supported diff --git a/shared/slim/android-info.txt b/shared/slim/android-info.txt index b0bf39b52..e7e5bf0ce 100644 --- a/shared/slim/android-info.txt +++ b/shared/slim/android-info.txt @@ -1 +1,2 @@ config=slim +gfxstream=supported diff --git a/shared/tv/android-info.txt b/shared/tv/android-info.txt index 8eae9029d..c4386094f 100644 --- a/shared/tv/android-info.txt +++ b/shared/tv/android-info.txt @@ -1 +1,2 @@ config=tv +gfxstream=supported diff --git a/shared/wear/android-info.txt b/shared/wear/android-info.txt index 22a5b5e7d..02e029bdc 100644 --- a/shared/wear/android-info.txt +++ b/shared/wear/android-info.txt @@ -1 +1,2 @@ config=wear +gfxstream=supported -- cgit v1.2.3 From 3b29d2bd0b34d93fd889b4a5544132ba7a829437 Mon Sep 17 00:00:00 2001 From: Roshan Pius Date: Fri, 1 Dec 2023 19:19:56 +0000 Subject: Revert^2 "cuttlefish: Replace NFC app with NFC apex" e99e7fb1d2cefd2fe631920a11ef7e354d64d201 Bug: 303286040 Test: Compiles Change-Id: Ic2d32b7341e37c8b79f42c1fbc2bc57e762e1184 --- shared/wear/aosp_system.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shared/wear/aosp_system.mk b/shared/wear/aosp_system.mk index e1b076822..cbeaacdc7 100644 --- a/shared/wear/aosp_system.mk +++ b/shared/wear/aosp_system.mk @@ -36,7 +36,7 @@ PRODUCT_PACKAGES += \ librs_jni \ ManagedProvisioning \ MmsService \ - NfcNci \ + $(RELEASE_PACKAGE_NFC_STACK) \ netutils-wrapper-1.0 \ screenrecord \ StatementService \ -- cgit v1.2.3 From 105b22f5085373b83a1a16add74301b1a47261ea Mon Sep 17 00:00:00 2001 From: "Jorge E. Moreira" Date: Mon, 12 Feb 2024 11:28:19 -0800 Subject: Advertise multitouch support to Android apps Bug: 324958449 Test: locally Change-Id: Icac595b8b36bc17ada1109f7d03cedeafb114ec3 (cherry picked from commit 74a55772bbb28d6be54359a4bfd2409d40546346) --- shared/auto/device_vendor.mk | 2 +- shared/phone/device_vendor.mk | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/shared/auto/device_vendor.mk b/shared/auto/device_vendor.mk index aa6c2d62c..3a34769c6 100644 --- a/shared/auto/device_vendor.mk +++ b/shared/auto/device_vendor.mk @@ -52,7 +52,7 @@ PRODUCT_PRODUCT_PROPERTIES += \ PRODUCT_COPY_FILES += \ frameworks/native/data/etc/car_core_hardware.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/car_core_hardware.xml \ frameworks/native/data/etc/android.hardware.broadcastradio.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.broadcastradio.xml \ - frameworks/native/data/etc/android.hardware.faketouch.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.faketouch.xml \ + frameworks/native/data/etc/android.hardware.touchscreen.multitouch.distinct.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.touchscreen.multitouch.distinct.xml \ frameworks/native/data/etc/android.hardware.screen.landscape.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.screen.landscape.xml \ frameworks/native/data/etc/android.software.activities_on_secondary_displays.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.software.activities_on_secondary_displays.xml \ diff --git a/shared/phone/device_vendor.mk b/shared/phone/device_vendor.mk index 3c08d388b..678c640f8 100644 --- a/shared/phone/device_vendor.mk +++ b/shared/phone/device_vendor.mk @@ -51,7 +51,7 @@ TARGET_PRODUCT_PROP := $(LOCAL_PATH)/product.prop TARGET_VENDOR_PROP := $(LOCAL_PATH)/vendor.prop PRODUCT_COPY_FILES += \ - frameworks/native/data/etc/android.hardware.faketouch.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.faketouch.xml \ + frameworks/native/data/etc/android.hardware.touchscreen.multitouch.distinct.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.touchscreen.multitouch.distinct.xml \ ifneq ($(TARGET_DISABLE_BIOMETRICS_FACE),true) PRODUCT_COPY_FILES += \ -- cgit v1.2.3 From 87daf55f9175fcea34ffc8150dab7d5a4fb11098 Mon Sep 17 00:00:00 2001 From: Daniel Zheng Date: Mon, 26 Feb 2024 17:12:41 -0800 Subject: Cuttlefish: inherit from vabc_features android_t_baseline.mk is a file kept for backwards compatibility. Newer devices should just inherit straight from vabc_features.mk With makefile having some complicated include logic, this intermediate include (vabc_features.mk -> android_t_baseline.mk -> device.mk) makes it so PRODUCT_SHIPPING_API_LEVEL isn't defined by the time vabc_features.mk is processed. Removing this intermediate include fixes that Test: m Change-Id: I44362ac9ebd95dca602895d761a1663b390a8fff --- shared/device.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shared/device.mk b/shared/device.mk index 4dd1de652..4e9ea97ac 100644 --- a/shared/device.mk +++ b/shared/device.mk @@ -55,7 +55,7 @@ TARGET_USERDATAIMAGE_PARTITION_SIZE ?= 8589934592 TARGET_VULKAN_SUPPORT ?= true # Enable Virtual A/B -$(call inherit-product, $(SRC_TARGET_DIR)/product/virtual_ab_ota/android_t_baseline.mk) +$(call inherit-product, $(SRC_TARGET_DIR)/product/virtual_ab_ota/vabc_features.mk) PRODUCT_VIRTUAL_AB_COMPRESSION_METHOD := lz4 PRODUCT_VIRTUAL_AB_COW_VERSION := 3 -- cgit v1.2.3 From d84b9022e584774ac79d9390126054cb5a2a680b Mon Sep 17 00:00:00 2001 From: "A. Cody Schuffelen" Date: Mon, 26 Feb 2024 21:31:05 -0800 Subject: Use AutoSetup for InitBootloaderEnvPartition Bug: b/303674154 Test: launch_cvd Change-Id: If883f96cecf08fe742e7f8c779ce15d1363edf48 --- host/commands/assemble_cvd/boot_config.cc | 226 ++++++++++----------- host/commands/assemble_cvd/boot_config.h | 10 +- host/commands/assemble_cvd/disk/disk.h | 8 +- .../disk/generate_persistent_vbmeta.cpp | 12 +- host/commands/assemble_cvd/disk_flags.cc | 4 +- 5 files changed, 118 insertions(+), 142 deletions(-) diff --git a/host/commands/assemble_cvd/boot_config.cc b/host/commands/assemble_cvd/boot_config.cc index b1215173c..9604653df 100644 --- a/host/commands/assemble_cvd/boot_config.cc +++ b/host/commands/assemble_cvd/boot_config.cc @@ -133,138 +133,118 @@ size_t WriteEnvironment(const CuttlefishConfig::InstanceSpecific& instance, return env_str.length(); } -} // namespace +std::unordered_map ReplaceKernelBootArgs( + const std::unordered_map& args) { + std::unordered_map ret; + std::transform(std::begin(args), std::end(args), + std::inserter(ret, ret.end()), [](const auto& kv) { + const auto& k = kv.first; + const auto& v = kv.second; + return std::make_pair( + android::base::StringReplace(k, " kernel.", " ", true), + v); + }); + return ret; +} -class InitBootloaderEnvPartitionImpl : public InitBootloaderEnvPartition { - public: - INJECT(InitBootloaderEnvPartitionImpl( - const CuttlefishConfig& config, - const CuttlefishConfig::InstanceSpecific& instance)) - : config_(config), instance_(instance) {} - - // SetupFeature - std::string Name() const override { return "InitBootloaderEnvPartitionImpl"; } - bool Enabled() const override { return !instance_.protected_vm(); } - - private: - std::unordered_set Dependencies() const override { return {}; } - Result ResultSetup() override { - if (instance_.ap_boot_flow() == CuttlefishConfig::InstanceSpecific::APBootFlow::Grub) { - CF_EXPECT(PrepareBootEnvImage( - instance_.ap_uboot_env_image_path(), - CuttlefishConfig::InstanceSpecific::BootFlow::Linux)); - } - CF_EXPECT(PrepareBootEnvImage(instance_.uboot_env_image_path(), - instance_.boot_flow())); +Result PrepareBootEnvImage( + const CuttlefishConfig& config, + const CuttlefishConfig::InstanceSpecific& instance, + const std::string& image_path, + const CuttlefishConfig::InstanceSpecific::BootFlow& flow) { + if (instance.protected_vm()) { return {}; } + auto tmp_boot_env_image_path = image_path + ".tmp"; + auto uboot_env_path = instance.PerInstancePath("mkenvimg_input"); + auto kernel_cmdline = + android::base::Join(KernelCommandLineFromConfig(config, instance), " "); + // If the bootconfig isn't supported in the guest kernel, the bootconfig + // args need to be passed in via the uboot env. This won't be an issue for + // protect kvm which is running a kernel with bootconfig support. + if (!instance.bootconfig_supported()) { + auto bootconfig_args = + CF_EXPECT(BootconfigArgsFromConfig(config, instance)); + + // "androidboot.hardware" kernel parameter has changed to "hardware" in + // bootconfig and needs to be replaced before being used in the kernel + // cmdline. + auto bootconfig_hardware_it = bootconfig_args.find("hardware"); + if (bootconfig_hardware_it != bootconfig_args.end()) { + bootconfig_args["androidboot.hardware"] = bootconfig_hardware_it->second; + bootconfig_args.erase(bootconfig_hardware_it); + } - std::unordered_map ReplaceKernelBootArgs( - const std::unordered_map& args) { - std::unordered_map ret; - std::transform(std::begin(args), std::end(args), - std::inserter(ret, ret.end()), [](const auto& kv) { - const auto& k = kv.first; - const auto& v = kv.second; - return std::make_pair( - android::base::StringReplace(k, " kernel.", " ", true), - v); - }); - return ret; + // TODO(b/182417593): Until we pass the module parameters through + // modules.options, we pass them through bootconfig using + // 'kernel.=' But if we don't support bootconfig, we need to + // rename them back to the old cmdline version + bootconfig_args = ReplaceKernelBootArgs(bootconfig_args); + + kernel_cmdline += + " " + CF_EXPECT(BootconfigArgsString(bootconfig_args, " ")); } - Result PrepareBootEnvImage( - const std::string& image_path, - const CuttlefishConfig::InstanceSpecific::BootFlow& flow) { - auto tmp_boot_env_image_path = image_path + ".tmp"; - auto uboot_env_path = instance_.PerInstancePath("mkenvimg_input"); - auto kernel_cmdline = android::base::Join( - KernelCommandLineFromConfig(config_, instance_), " "); - // If the bootconfig isn't supported in the guest kernel, the bootconfig - // args need to be passed in via the uboot env. This won't be an issue for - // protect kvm which is running a kernel with bootconfig support. - if (!instance_.bootconfig_supported()) { - auto bootconfig_args = - CF_EXPECT(BootconfigArgsFromConfig(config_, instance_)); - - // "androidboot.hardware" kernel parameter has changed to "hardware" in - // bootconfig and needs to be replaced before being used in the kernel - // cmdline. - auto bootconfig_hardware_it = bootconfig_args.find("hardware"); - if (bootconfig_hardware_it != bootconfig_args.end()) { - bootconfig_args["androidboot.hardware"] = - bootconfig_hardware_it->second; - bootconfig_args.erase(bootconfig_hardware_it); - } - - // TODO(b/182417593): Until we pass the module parameters through - // modules.options, we pass them through bootconfig using - // 'kernel.=' But if we don't support bootconfig, we need to - // rename them back to the old cmdline version - bootconfig_args = ReplaceKernelBootArgs(bootconfig_args); - - kernel_cmdline += - " " + CF_EXPECT(BootconfigArgsString(bootconfig_args, " ")); - } + CF_EXPECTF(WriteEnvironment(instance, flow, kernel_cmdline, uboot_env_path), + "Unable to write out plaintext env '{}'", uboot_env_path); + + auto mkimage_path = HostBinaryPath("mkenvimage_slim"); + Command cmd(mkimage_path); + cmd.AddParameter("-output_path"); + cmd.AddParameter(tmp_boot_env_image_path); + cmd.AddParameter("-input_path"); + cmd.AddParameter(uboot_env_path); + int success = cmd.Start().Wait(); + CF_EXPECTF(success == 0, + "Unable to run mkenvimage_slim. Exited with status {}", success); + + const off_t boot_env_size_bytes = + AlignToPowerOf2(MAX_AVB_METADATA_SIZE + 4096, PARTITION_SIZE_SHIFT); + + auto avbtool_path = HostBinaryPath("avbtool"); + Command boot_env_hash_footer_cmd(avbtool_path); + boot_env_hash_footer_cmd.AddParameter("add_hash_footer"); + boot_env_hash_footer_cmd.AddParameter("--image"); + boot_env_hash_footer_cmd.AddParameter(tmp_boot_env_image_path); + boot_env_hash_footer_cmd.AddParameter("--partition_size"); + boot_env_hash_footer_cmd.AddParameter(boot_env_size_bytes); + boot_env_hash_footer_cmd.AddParameter("--partition_name"); + boot_env_hash_footer_cmd.AddParameter("uboot_env"); + boot_env_hash_footer_cmd.AddParameter("--key"); + boot_env_hash_footer_cmd.AddParameter( + DefaultHostArtifactsPath("etc/cvd_avb_testkey.pem")); + boot_env_hash_footer_cmd.AddParameter("--algorithm"); + boot_env_hash_footer_cmd.AddParameter("SHA256_RSA4096"); + success = boot_env_hash_footer_cmd.Start().Wait(); + CF_EXPECTF(success == 0, + "Unable to append hash footer. Exited with status {}", success); + + if (!FileExists(image_path) || + ReadFile(image_path) != ReadFile(tmp_boot_env_image_path)) { + CF_EXPECT(RenameFile(tmp_boot_env_image_path, image_path), + "Unable to delete the old env image"); + LOG(DEBUG) << "Updated bootloader environment image."; + } else { + RemoveFile(tmp_boot_env_image_path); + } - CF_EXPECTF( - WriteEnvironment(instance_, flow, kernel_cmdline, uboot_env_path), - "Unable to write out plaintext env '{}'", uboot_env_path); - - auto mkimage_path = HostBinaryPath("mkenvimage_slim"); - Command cmd(mkimage_path); - cmd.AddParameter("-output_path"); - cmd.AddParameter(tmp_boot_env_image_path); - cmd.AddParameter("-input_path"); - cmd.AddParameter(uboot_env_path); - int success = cmd.Start().Wait(); - CF_EXPECTF(success == 0, - "Unable to run mkenvimage_slim. Exited with status {}", success); - - const off_t boot_env_size_bytes = AlignToPowerOf2( - MAX_AVB_METADATA_SIZE + 4096, PARTITION_SIZE_SHIFT); - - auto avbtool_path = HostBinaryPath("avbtool"); - Command boot_env_hash_footer_cmd(avbtool_path); - boot_env_hash_footer_cmd.AddParameter("add_hash_footer"); - boot_env_hash_footer_cmd.AddParameter("--image"); - boot_env_hash_footer_cmd.AddParameter(tmp_boot_env_image_path); - boot_env_hash_footer_cmd.AddParameter("--partition_size"); - boot_env_hash_footer_cmd.AddParameter(boot_env_size_bytes); - boot_env_hash_footer_cmd.AddParameter("--partition_name"); - boot_env_hash_footer_cmd.AddParameter("uboot_env"); - boot_env_hash_footer_cmd.AddParameter("--key"); - boot_env_hash_footer_cmd.AddParameter( - DefaultHostArtifactsPath("etc/cvd_avb_testkey.pem")); - boot_env_hash_footer_cmd.AddParameter("--algorithm"); - boot_env_hash_footer_cmd.AddParameter("SHA256_RSA4096"); - success = boot_env_hash_footer_cmd.Start().Wait(); - CF_EXPECTF(success == 0, - "Unable to append hash footer. Exited with status {}", success); - - if (!FileExists(image_path) || - ReadFile(image_path) != ReadFile(tmp_boot_env_image_path)) { - CF_EXPECT(RenameFile(tmp_boot_env_image_path, image_path), - "Unable to delete the old env image"); - LOG(DEBUG) << "Updated bootloader environment image."; - } else { - RemoveFile(tmp_boot_env_image_path); - } + return {}; +} - return {}; - } +} // namespace - const CuttlefishConfig& config_; - const CuttlefishConfig::InstanceSpecific& instance_; -}; - -fruit::Component, - InitBootloaderEnvPartition> -InitBootloaderEnvPartitionComponent() { - return fruit::createComponent() - .bind() - .addMultibinding(); +Result InitBootloaderEnvPartition( + const CuttlefishConfig& config, + const CuttlefishConfig::InstanceSpecific& instance) { + if (instance.ap_boot_flow() == + CuttlefishConfig::InstanceSpecific::APBootFlow::Grub) { + CF_EXPECT(PrepareBootEnvImage( + config, instance, instance.ap_uboot_env_image_path(), + CuttlefishConfig::InstanceSpecific::BootFlow::Linux)); + } + CF_EXPECT(PrepareBootEnvImage( + config, instance, instance.uboot_env_image_path(), instance.boot_flow())); + return {}; } } // namespace cuttlefish diff --git a/host/commands/assemble_cvd/boot_config.h b/host/commands/assemble_cvd/boot_config.h index 87318495e..dc5328ff2 100644 --- a/host/commands/assemble_cvd/boot_config.h +++ b/host/commands/assemble_cvd/boot_config.h @@ -17,16 +17,12 @@ #include +#include "common/libs/utils/result.h" #include "host/libs/config/cuttlefish_config.h" -#include "host/libs/config/feature.h" namespace cuttlefish { -class InitBootloaderEnvPartition : public SetupFeature {}; - -fruit::Component, - InitBootloaderEnvPartition> -InitBootloaderEnvPartitionComponent(); +Result InitBootloaderEnvPartition( + const CuttlefishConfig&, const CuttlefishConfig::InstanceSpecific&); } // namespace cuttlefish diff --git a/host/commands/assemble_cvd/disk/disk.h b/host/commands/assemble_cvd/disk/disk.h index 1265d8121..8a94bc2da 100644 --- a/host/commands/assemble_cvd/disk/disk.h +++ b/host/commands/assemble_cvd/disk/disk.h @@ -45,10 +45,10 @@ Gem5ImageUnpackerComponent(); class GeneratePersistentVbmeta : public SetupFeature {}; -fruit::Component< - fruit::Required, - GeneratePersistentVbmeta> +fruit::Component::Type, + GeneratePersistentBootconfig>, + GeneratePersistentVbmeta> GeneratePersistentVbmetaComponent(); class InitializeFactoryResetProtected : public SetupFeature {}; diff --git a/host/commands/assemble_cvd/disk/generate_persistent_vbmeta.cpp b/host/commands/assemble_cvd/disk/generate_persistent_vbmeta.cpp index 1f95b9b1c..a1c4cf2b3 100644 --- a/host/commands/assemble_cvd/disk/generate_persistent_vbmeta.cpp +++ b/host/commands/assemble_cvd/disk/generate_persistent_vbmeta.cpp @@ -34,7 +34,7 @@ class GeneratePersistentVbmetaImpl : public GeneratePersistentVbmeta { public: INJECT(GeneratePersistentVbmetaImpl( const CuttlefishConfig::InstanceSpecific& instance, - InitBootloaderEnvPartition& bootloader_env, + AutoSetup::Type& bootloader_env, GeneratePersistentBootconfig& bootconfig)) : instance_(instance), bootloader_env_(bootloader_env), @@ -111,14 +111,14 @@ class GeneratePersistentVbmetaImpl : public GeneratePersistentVbmeta { } const CuttlefishConfig::InstanceSpecific& instance_; - InitBootloaderEnvPartition& bootloader_env_; + AutoSetup::Type& bootloader_env_; GeneratePersistentBootconfig& bootconfig_; }; -fruit::Component< - fruit::Required, - GeneratePersistentVbmeta> +fruit::Component::Type, + GeneratePersistentBootconfig>, + GeneratePersistentVbmeta> GeneratePersistentVbmetaComponent() { return fruit::createComponent() .addMultibinding() diff --git a/host/commands/assemble_cvd/disk_flags.cc b/host/commands/assemble_cvd/disk_flags.cc index f321def87..3c5c0b151 100644 --- a/host/commands/assemble_cvd/disk_flags.cc +++ b/host/commands/assemble_cvd/disk_flags.cc @@ -684,6 +684,7 @@ static fruit::Component<> DiskChangesPerInstanceComponent( .bindInstance(*config) .bindInstance(*instance) .install(AutoSetup::Component) + .install(AutoSetup::Component) .install(AutoSetup::Component) .install(AutoSetup::Component) .install(AutoSetup::Component) @@ -691,8 +692,7 @@ static fruit::Component<> DiskChangesPerInstanceComponent( .install(GeneratePersistentBootconfigComponent) .install(GeneratePersistentVbmetaComponent) .install(AutoSetup::Component) - .install(InitializeDataImageComponent) - .install(InitBootloaderEnvPartitionComponent); + .install(InitializeDataImageComponent); } Result DiskImageFlagsVectorization(CuttlefishConfig& config, const FetcherConfig& fetcher_config) { -- cgit v1.2.3 From f26f005e1d3e0e16e43a318477ad1ac53d7ce9a6 Mon Sep 17 00:00:00 2001 From: "A. Cody Schuffelen" Date: Mon, 26 Feb 2024 21:36:54 -0800 Subject: Use AutoSetup for InitializeFactoryResetProtected Bug: b/303674154 Test: launch_cvd Change-Id: I93124374ff7f49d395aca4aee1ed38b3f1abe914 --- host/commands/assemble_cvd/disk/disk.h | 10 +++--- .../assemble_cvd/disk/factory_reset_protected.cc | 41 +++++----------------- .../disk/initialize_instance_composite_disk.cc | 2 +- host/commands/assemble_cvd/disk_flags.cc | 2 +- 4 files changed, 15 insertions(+), 40 deletions(-) diff --git a/host/commands/assemble_cvd/disk/disk.h b/host/commands/assemble_cvd/disk/disk.h index 8a94bc2da..a32ab0377 100644 --- a/host/commands/assemble_cvd/disk/disk.h +++ b/host/commands/assemble_cvd/disk/disk.h @@ -51,14 +51,12 @@ fruit::Component GeneratePersistentVbmetaComponent(); -class InitializeFactoryResetProtected : public SetupFeature {}; - -fruit::Component, - InitializeFactoryResetProtected> -InitializeFactoryResetProtectedComponent(); +Result InitializeFactoryResetProtected( + const CuttlefishConfig::InstanceSpecific&); Result InitializeInstanceCompositeDisk( const CuttlefishConfig&, const CuttlefishConfig::InstanceSpecific&, - InitializeFactoryResetProtected&, GeneratePersistentVbmeta&); + AutoSetup::Type&, + GeneratePersistentVbmeta&); } // namespace cuttlefish diff --git a/host/commands/assemble_cvd/disk/factory_reset_protected.cc b/host/commands/assemble_cvd/disk/factory_reset_protected.cc index a20cb58bc..3a2cd2976 100644 --- a/host/commands/assemble_cvd/disk/factory_reset_protected.cc +++ b/host/commands/assemble_cvd/disk/factory_reset_protected.cc @@ -24,41 +24,18 @@ namespace cuttlefish { -class InitializeFactoryResetProtectedImpl - : public InitializeFactoryResetProtected { - public: - INJECT(InitializeFactoryResetProtectedImpl( - const CuttlefishConfig::InstanceSpecific& instance)) - : instance_(instance) {} - - // SetupFeature - std::string Name() const override { - return "InitializeFactoryResetProtected"; +Result InitializeFactoryResetProtected( + const CuttlefishConfig::InstanceSpecific& instance) { + if (instance.protected_vm()) { + return {}; } - bool Enabled() const override { return !instance_.protected_vm(); } - - private: - std::unordered_set Dependencies() const override { return {}; } - Result ResultSetup() override { - auto frp = instance_.factory_reset_protected_path(); - if (FileExists(frp)) { - return {}; - } - CF_EXPECT(CreateBlankImage(frp, 1 /* mb */, "none"), - "Failed to create \"" << frp << "\""); + auto frp = instance.factory_reset_protected_path(); + if (FileExists(frp)) { return {}; } - - const CuttlefishConfig::InstanceSpecific& instance_; -}; - -fruit::Component, - InitializeFactoryResetProtected> -InitializeFactoryResetProtectedComponent() { - return fruit::createComponent() - .bind() - .addMultibinding(); + CF_EXPECT(CreateBlankImage(frp, 1 /* mb */, "none"), + "Failed to create \"" << frp << "\""); + return {}; } } // namespace cuttlefish diff --git a/host/commands/assemble_cvd/disk/initialize_instance_composite_disk.cc b/host/commands/assemble_cvd/disk/initialize_instance_composite_disk.cc index e1567b6b1..f71d8e718 100644 --- a/host/commands/assemble_cvd/disk/initialize_instance_composite_disk.cc +++ b/host/commands/assemble_cvd/disk/initialize_instance_composite_disk.cc @@ -89,7 +89,7 @@ bool IsVmManagerQemu(const CuttlefishConfig& config) { Result InitializeInstanceCompositeDisk( const CuttlefishConfig& config, const CuttlefishConfig::InstanceSpecific& instance, - InitializeFactoryResetProtected& /* dependency */, + AutoSetup::Type& /* dependency */, GeneratePersistentVbmeta& /* dependency */) { const auto ipath = [&instance](const std::string& path) -> std::string { return instance.PerInstancePath(path.c_str()); diff --git a/host/commands/assemble_cvd/disk_flags.cc b/host/commands/assemble_cvd/disk_flags.cc index 3c5c0b151..57bfa555d 100644 --- a/host/commands/assemble_cvd/disk_flags.cc +++ b/host/commands/assemble_cvd/disk_flags.cc @@ -685,10 +685,10 @@ static fruit::Component<> DiskChangesPerInstanceComponent( .bindInstance(*instance) .install(AutoSetup::Component) .install(AutoSetup::Component) + .install(AutoSetup::Component) .install(AutoSetup::Component) .install(AutoSetup::Component) .install(AutoSetup::Component) - .install(InitializeFactoryResetProtectedComponent) .install(GeneratePersistentBootconfigComponent) .install(GeneratePersistentVbmetaComponent) .install(AutoSetup::Component) -- cgit v1.2.3 From e7ad1b40d1521b3662325be7b9d7bbff5042982f Mon Sep 17 00:00:00 2001 From: "A. Cody Schuffelen" Date: Mon, 26 Feb 2024 21:42:19 -0800 Subject: Use AutoSetup for GeneratePersistentBootconfig Bug: b/303674154 Test: launch_cvd --noresume Change-Id: I279c811e390ad4c2ac0da7778627eea98d818e3a --- host/commands/assemble_cvd/disk/disk.h | 10 +- .../disk/generate_persistent_bootconfig.cpp | 157 +++++++++------------ .../disk/generate_persistent_vbmeta.cpp | 6 +- host/commands/assemble_cvd/disk_flags.cc | 2 +- 4 files changed, 75 insertions(+), 100 deletions(-) diff --git a/host/commands/assemble_cvd/disk/disk.h b/host/commands/assemble_cvd/disk/disk.h index a32ab0377..548ab71b2 100644 --- a/host/commands/assemble_cvd/disk/disk.h +++ b/host/commands/assemble_cvd/disk/disk.h @@ -33,12 +33,8 @@ fruit::Component KernelRamdiskRepackerComponent(); -class GeneratePersistentBootconfig : public SetupFeature {}; - -fruit::Component, - GeneratePersistentBootconfig> -GeneratePersistentBootconfigComponent(); +Result GeneratePersistentBootconfig( + const CuttlefishConfig&, const CuttlefishConfig::InstanceSpecific&); fruit::Component> Gem5ImageUnpackerComponent(); @@ -47,7 +43,7 @@ class GeneratePersistentVbmeta : public SetupFeature {}; fruit::Component::Type, - GeneratePersistentBootconfig>, + AutoSetup::Type>, GeneratePersistentVbmeta> GeneratePersistentVbmetaComponent(); diff --git a/host/commands/assemble_cvd/disk/generate_persistent_bootconfig.cpp b/host/commands/assemble_cvd/disk/generate_persistent_bootconfig.cpp index 568220594..d0a841fec 100644 --- a/host/commands/assemble_cvd/disk/generate_persistent_bootconfig.cpp +++ b/host/commands/assemble_cvd/disk/generate_persistent_bootconfig.cpp @@ -37,98 +37,77 @@ namespace cuttlefish { -class GeneratePersistentBootconfigImpl : public GeneratePersistentBootconfig { - public: - INJECT(GeneratePersistentBootconfigImpl( - const CuttlefishConfig& config, - const CuttlefishConfig::InstanceSpecific& instance)) - : config_(config), instance_(instance) {} - - // SetupFeature - std::string Name() const override { return "GeneratePersistentBootconfig"; } - bool Enabled() const override { return (!instance_.protected_vm()); } - - private: - std::unordered_set Dependencies() const override { return {}; } - Result ResultSetup() override { - // Cuttlefish for the time being won't be able to support OTA from a - // non-bootconfig kernel to a bootconfig-kernel (or vice versa) IF the - // device is stopped (via stop_cvd). This is rarely an issue since OTA - // testing run on cuttlefish is done within one launch cycle of the device. - // If this ever becomes an issue, this code will have to be rewritten. - if (!instance_.bootconfig_supported()) { - return {}; - } - const auto bootconfig_path = instance_.persistent_bootconfig_path(); - if (!FileExists(bootconfig_path)) { - CF_EXPECT(CreateBlankImage(bootconfig_path, 1 /* mb */, "none"), - "Failed to create image at " << bootconfig_path); - } - - auto bootconfig_fd = SharedFD::Open(bootconfig_path, O_RDWR); - CF_EXPECT(bootconfig_fd->IsOpen(), - "Unable to open bootconfig file: " << bootconfig_fd->StrError()); - - const auto bootconfig_args = - CF_EXPECT(BootconfigArgsFromConfig(config_, instance_)); - const auto bootconfig = - CF_EXPECT(BootconfigArgsString(bootconfig_args, "\n")) + "\n"; - - LOG(DEBUG) << "bootconfig size is " << bootconfig.size(); - ssize_t bytesWritten = WriteAll(bootconfig_fd, bootconfig); - CF_EXPECT(WriteAll(bootconfig_fd, bootconfig) == bootconfig.size(), - "Failed to write bootconfig to \"" << bootconfig_path << "\""); - LOG(DEBUG) << "Bootconfig parameters from vendor boot image and config are " - << ReadFile(bootconfig_path); - - CF_EXPECT(bootconfig_fd->Truncate(bootconfig.size()) == 0, - "`truncate --size=" << bootconfig.size() << " bytes " - << bootconfig_path - << "` failed:" << bootconfig_fd->StrError()); - - if (config_.vm_manager() == vm_manager::Gem5Manager::name()) { - const off_t bootconfig_size_bytes_gem5 = - AlignToPowerOf2(bytesWritten, PARTITION_SIZE_SHIFT); - CF_EXPECT(bootconfig_fd->Truncate(bootconfig_size_bytes_gem5) == 0); - bootconfig_fd->Close(); - } else { - bootconfig_fd->Close(); - const off_t bootconfig_size_bytes = AlignToPowerOf2( - MAX_AVB_METADATA_SIZE + bootconfig.size(), PARTITION_SIZE_SHIFT); - - auto avbtool_path = HostBinaryPath("avbtool"); - Command bootconfig_hash_footer_cmd(avbtool_path); - bootconfig_hash_footer_cmd.AddParameter("add_hash_footer"); - bootconfig_hash_footer_cmd.AddParameter("--image"); - bootconfig_hash_footer_cmd.AddParameter(bootconfig_path); - bootconfig_hash_footer_cmd.AddParameter("--partition_size"); - bootconfig_hash_footer_cmd.AddParameter(bootconfig_size_bytes); - bootconfig_hash_footer_cmd.AddParameter("--partition_name"); - bootconfig_hash_footer_cmd.AddParameter("bootconfig"); - bootconfig_hash_footer_cmd.AddParameter("--key"); - bootconfig_hash_footer_cmd.AddParameter( - DefaultHostArtifactsPath("etc/cvd_avb_testkey.pem")); - bootconfig_hash_footer_cmd.AddParameter("--algorithm"); - bootconfig_hash_footer_cmd.AddParameter("SHA256_RSA4096"); - int success = bootconfig_hash_footer_cmd.Start().Wait(); - CF_EXPECT( - success == 0, - "Unable to run append hash footer. Exited with status " << success); - } +Result GeneratePersistentBootconfig( + const CuttlefishConfig& config, + const CuttlefishConfig::InstanceSpecific& instance) { + if (instance.protected_vm()) { return {}; } + // Cuttlefish for the time being won't be able to support OTA from a + // non-bootconfig kernel to a bootconfig-kernel (or vice versa) IF the + // device is stopped (via stop_cvd). This is rarely an issue since OTA + // testing run on cuttlefish is done within one launch cycle of the device. + // If this ever becomes an issue, this code will have to be rewritten. + if (!instance.bootconfig_supported()) { + return {}; + } + const auto bootconfig_path = instance.persistent_bootconfig_path(); + if (!FileExists(bootconfig_path)) { + CF_EXPECT(CreateBlankImage(bootconfig_path, 1 /* mb */, "none"), + "Failed to create image at " << bootconfig_path); + } - const CuttlefishConfig& config_; - const CuttlefishConfig::InstanceSpecific& instance_; -}; - -fruit::Component, - GeneratePersistentBootconfig> -GeneratePersistentBootconfigComponent() { - return fruit::createComponent() - .addMultibinding() - .bind(); + auto bootconfig_fd = SharedFD::Open(bootconfig_path, O_RDWR); + CF_EXPECT(bootconfig_fd->IsOpen(), + "Unable to open bootconfig file: " << bootconfig_fd->StrError()); + + const auto bootconfig_args = + CF_EXPECT(BootconfigArgsFromConfig(config, instance)); + const auto bootconfig = + CF_EXPECT(BootconfigArgsString(bootconfig_args, "\n")) + "\n"; + + LOG(DEBUG) << "bootconfig size is " << bootconfig.size(); + ssize_t bytesWritten = WriteAll(bootconfig_fd, bootconfig); + CF_EXPECT(WriteAll(bootconfig_fd, bootconfig) == bootconfig.size(), + "Failed to write bootconfig to \"" << bootconfig_path << "\""); + LOG(DEBUG) << "Bootconfig parameters from vendor boot image and config are " + << ReadFile(bootconfig_path); + + CF_EXPECT(bootconfig_fd->Truncate(bootconfig.size()) == 0, + "`truncate --size=" << bootconfig.size() << " bytes " + << bootconfig_path + << "` failed:" << bootconfig_fd->StrError()); + + if (config.vm_manager() == vm_manager::Gem5Manager::name()) { + const off_t bootconfig_size_bytes_gem5 = + AlignToPowerOf2(bytesWritten, PARTITION_SIZE_SHIFT); + CF_EXPECT(bootconfig_fd->Truncate(bootconfig_size_bytes_gem5) == 0); + bootconfig_fd->Close(); + } else { + bootconfig_fd->Close(); + const off_t bootconfig_size_bytes = AlignToPowerOf2( + MAX_AVB_METADATA_SIZE + bootconfig.size(), PARTITION_SIZE_SHIFT); + + auto avbtool_path = HostBinaryPath("avbtool"); + Command bootconfig_hash_footer_cmd(avbtool_path); + bootconfig_hash_footer_cmd.AddParameter("add_hash_footer"); + bootconfig_hash_footer_cmd.AddParameter("--image"); + bootconfig_hash_footer_cmd.AddParameter(bootconfig_path); + bootconfig_hash_footer_cmd.AddParameter("--partition_size"); + bootconfig_hash_footer_cmd.AddParameter(bootconfig_size_bytes); + bootconfig_hash_footer_cmd.AddParameter("--partition_name"); + bootconfig_hash_footer_cmd.AddParameter("bootconfig"); + bootconfig_hash_footer_cmd.AddParameter("--key"); + bootconfig_hash_footer_cmd.AddParameter( + DefaultHostArtifactsPath("etc/cvd_avb_testkey.pem")); + bootconfig_hash_footer_cmd.AddParameter("--algorithm"); + bootconfig_hash_footer_cmd.AddParameter("SHA256_RSA4096"); + int success = bootconfig_hash_footer_cmd.Start().Wait(); + CF_EXPECT( + success == 0, + "Unable to run append hash footer. Exited with status " << success); + } + return {}; } } // namespace cuttlefish diff --git a/host/commands/assemble_cvd/disk/generate_persistent_vbmeta.cpp b/host/commands/assemble_cvd/disk/generate_persistent_vbmeta.cpp index a1c4cf2b3..6c3560c00 100644 --- a/host/commands/assemble_cvd/disk/generate_persistent_vbmeta.cpp +++ b/host/commands/assemble_cvd/disk/generate_persistent_vbmeta.cpp @@ -35,7 +35,7 @@ class GeneratePersistentVbmetaImpl : public GeneratePersistentVbmeta { INJECT(GeneratePersistentVbmetaImpl( const CuttlefishConfig::InstanceSpecific& instance, AutoSetup::Type& bootloader_env, - GeneratePersistentBootconfig& bootconfig)) + AutoSetup::Type& bootconfig)) : instance_(instance), bootloader_env_(bootloader_env), bootconfig_(bootconfig) {} @@ -112,12 +112,12 @@ class GeneratePersistentVbmetaImpl : public GeneratePersistentVbmeta { const CuttlefishConfig::InstanceSpecific& instance_; AutoSetup::Type& bootloader_env_; - GeneratePersistentBootconfig& bootconfig_; + AutoSetup::Type& bootconfig_; }; fruit::Component::Type, - GeneratePersistentBootconfig>, + AutoSetup::Type>, GeneratePersistentVbmeta> GeneratePersistentVbmetaComponent() { return fruit::createComponent() diff --git a/host/commands/assemble_cvd/disk_flags.cc b/host/commands/assemble_cvd/disk_flags.cc index 57bfa555d..07b17be2e 100644 --- a/host/commands/assemble_cvd/disk_flags.cc +++ b/host/commands/assemble_cvd/disk_flags.cc @@ -689,7 +689,7 @@ static fruit::Component<> DiskChangesPerInstanceComponent( .install(AutoSetup::Component) .install(AutoSetup::Component) .install(AutoSetup::Component) - .install(GeneratePersistentBootconfigComponent) + .install(AutoSetup::Component) .install(GeneratePersistentVbmetaComponent) .install(AutoSetup::Component) .install(InitializeDataImageComponent); -- cgit v1.2.3 From 59b2bd90b36c3c3e94a5324dff8f52f9a4f56786 Mon Sep 17 00:00:00 2001 From: Jooyung Han Date: Thu, 8 Feb 2024 01:01:30 +0000 Subject: Do not install android.hardware.bluetooth.audio-impl This is now an explicit dependency of android.hardware.audio.service-aidl.example (cc_binary). Do not install it separately on trunk_staging. Besides, since android.hardware.audio.service-aidl.example is now a part of com.android.hardware.audio apex, /vendor/lib32/android.hardware.bluetooth.audio-impl.so is not used by any processes. We can remove the following files from /vendor/lib: - android.hardware.audio.common-V3-ndk.so - android.hardware.audio.common@5.0.so - android.hardware.bluetooth.audio-V4-ndk.so - android.hardware.bluetooth.audio-impl.so - android.hardware.bluetooth.audio@2.0.so - android.hardware.bluetooth.audio@2.1.so - android.hidl.safe_union@1.0.so - android.media.audio.common.types-V3-ndk.so - libbluetooth_audio_session_aidl.so - libflatbuffers-cpp.so - libfmq.so - libxml2.so - server_configurable_flags.so Bug: 312265159 Test: atest VtsHalBluetoothAudioTargetTest Change-Id: I9eab27c08e3ceb3c4cd951172af3fc69d412f759 --- shared/bluetooth/device_vendor.mk | 6 ------ 1 file changed, 6 deletions(-) diff --git a/shared/bluetooth/device_vendor.mk b/shared/bluetooth/device_vendor.mk index 451f30063..60c090adb 100644 --- a/shared/bluetooth/device_vendor.mk +++ b/shared/bluetooth/device_vendor.mk @@ -32,12 +32,6 @@ PRODUCT_COPY_FILES += \ PRODUCT_PACKAGES += com.google.cf.bt -# -# Bluetooth Audio AIDL HAL -# -PRODUCT_PACKAGES += \ - android.hardware.bluetooth.audio-impl \ - else # BOARD_HAVE_BLUETOOTH == true PRODUCT_COPY_FILES += \ -- cgit v1.2.3 From 14883185a4d54d4a1224075f5672cbafab675d4b Mon Sep 17 00:00:00 2001 From: Octavian Purdila Date: Fri, 23 Feb 2024 16:05:55 -0800 Subject: Allow target specific binaries in the cvd host package Add support for customizing the cvd host package with target specific binaries. To add a target specific binary to the cvd host package add the following in one of the target .mk files: $(call soong_config_append,cvd,binary, test-binary) Bug: 318734012 Test: m dist and check the cvd host tarball Change-Id: I6c10ead8b1caefe903521cb712c678e12b95f358 --- build/cvd-host-package.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/build/cvd-host-package.go b/build/cvd-host-package.go index cf66c0e99..596ce41d0 100644 --- a/build/cvd-host-package.go +++ b/build/cvd-host-package.go @@ -68,6 +68,13 @@ func (c *cvdHostPackage) DepsMutator(ctx android.BottomUpMutatorContext) { } } + for _, dep := range strings.Split( + ctx.Config().VendorConfig("cvd").String("binary"), " ") { + if ctx.OtherModuleExists(dep) { + ctx.AddVariationDependencies(ctx.Target().Variations(), cvdHostPackageDependencyTag, dep) + } + } + // If cvd_custom_action_config is set, include custom action servers in the // host package as specified by cvd_custom_action_servers. customActionConfig := ctx.Config().VendorConfig("cvd").String("custom_action_config") -- cgit v1.2.3 From e2562b2702b39c0778bd73076c129a55898be914 Mon Sep 17 00:00:00 2001 From: Gurchetan Singh Date: Wed, 28 Feb 2024 11:26:20 -0800 Subject: cuttlefish: enable gfxstream + QEMU by default We can't enable gfxstream when: - we have QEMU + ARM64 host (since we don't build QEMU8 for arm64) - an QEMU + arm64 guest (I don't know why, but that was prior behavior) Otherwise, on x86 hosts, QEMU8 is available and we should use it. BUG=327408955 TEST=compile Change-Id: I12180c8048922cdc855fd9b1431f590b28ca7979 --- host/commands/assemble_cvd/graphics_flags.cc | 12 +++++++++--- host/commands/assemble_cvd/graphics_flags.h | 3 ++- host/libs/config/config_utils.cpp | 10 +++++++++- host/libs/config/config_utils.h | 2 ++ 4 files changed, 22 insertions(+), 5 deletions(-) diff --git a/host/commands/assemble_cvd/graphics_flags.cc b/host/commands/assemble_cvd/graphics_flags.cc index 19aebc519..c56e3da5c 100644 --- a/host/commands/assemble_cvd/graphics_flags.cc +++ b/host/commands/assemble_cvd/graphics_flags.cc @@ -255,9 +255,10 @@ Result SelectGpuMode( LOG(INFO) << "GPU auto mode: detected prerequisites for accelerated " << "rendering support."; - if (vm_manager == vm_manager::QemuManager::name()) { - LOG(INFO) << "Enabling --gpu_mode=drm_virgl."; - return kGpuModeDrmVirgl; + + if (vm_manager == vm_manager::QemuManager::name() && !UseQemu8()) { + LOG(INFO) << "Not using QEMU8: selecting guest swiftshader"; + return kGpuModeGuestSwiftshader; } else if (!guest_config.gfxstream_supported) { LOG(INFO) << "GPU auto mode: guest does not support gfxstream, " "enabling --gpu_mode=guest_swiftshader"; @@ -284,6 +285,11 @@ Result SelectGpuMode( "function correctly. Please consider switching to " "--gpu_mode=auto or --gpu_mode=guest_swiftshader."; } + + if (vm_manager == vm_manager::QemuManager::name() && !UseQemu8()) { + LOG(INFO) << "Not using QEMU8: selecting guest swiftshader"; + return kGpuModeGuestSwiftshader; + } } return gpu_mode_arg; diff --git a/host/commands/assemble_cvd/graphics_flags.h b/host/commands/assemble_cvd/graphics_flags.h index 69b1d7485..6a96dccb3 100644 --- a/host/commands/assemble_cvd/graphics_flags.h +++ b/host/commands/assemble_cvd/graphics_flags.h @@ -19,6 +19,7 @@ #include "common/libs/utils/result.h" #include "host/commands/assemble_cvd/flags.h" +#include "host/libs/config/config_utils.h" #include "host/libs/config/cuttlefish_config.h" namespace cuttlefish { @@ -28,4 +29,4 @@ Result ConfigureGpuSettings( const std::string& vm_manager, const GuestConfig& guest_config, CuttlefishConfig::MutableInstanceSpecific& instance); -} // namespace cuttlefish \ No newline at end of file +} // namespace cuttlefish diff --git a/host/libs/config/config_utils.cpp b/host/libs/config/config_utils.cpp index 0ee99118f..9197877dc 100644 --- a/host/libs/config/config_utils.cpp +++ b/host/libs/config/config_utils.cpp @@ -111,10 +111,18 @@ std::string HostBinaryDir() { return DefaultHostArtifactsPath("bin"); } -std::string DefaultQemuBinaryDir() { +bool UseQemu8() { const std::string target_prod_str = StringFromEnv("TARGET_PRODUCT", ""); if (HostArch() == Arch::X86_64 && target_prod_str.find("arm") == std::string::npos) { + return true; + } + + return false; +} + +std::string DefaultQemuBinaryDir() { + if (UseQemu8()) { return HostBinaryDir(); } return "/usr/bin"; diff --git a/host/libs/config/config_utils.h b/host/libs/config/config_utils.h index 1f9ca2843..8107f5e9b 100644 --- a/host/libs/config/config_utils.h +++ b/host/libs/config/config_utils.h @@ -59,4 +59,6 @@ std::string DefaultEnvironmentPath(const char* environment_key, // Whether the host supports qemu bool HostSupportsQemuCli(); +// Whether to use QEMU8 +bool UseQemu8(); } -- cgit v1.2.3 From f6f15819057262698ab00eaa884822e0700e2676 Mon Sep 17 00:00:00 2001 From: Sergio Andres Rodriguez Orama Date: Wed, 28 Feb 2024 19:26:42 -0500 Subject: Setup logging earlier in assemble_cvd. - Early log messages were missing in assemble_cvd.log. Test: cvd start Bug: 327494440 Change-Id: I134a8bab5d1a31998ae12eee60455d9f0a20e832 --- host/commands/assemble_cvd/assemble_cvd.cc | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/host/commands/assemble_cvd/assemble_cvd.cc b/host/commands/assemble_cvd/assemble_cvd.cc index 4bc558818..0dcb8eb50 100644 --- a/host/commands/assemble_cvd/assemble_cvd.cc +++ b/host/commands/assemble_cvd/assemble_cvd.cc @@ -253,10 +253,7 @@ Result> PreservingOnResume( return preserving; } -Result InitFilesystemAndCreateConfig( - FetcherConfig fetcher_config, const std::vector& guest_configs, - fruit::Injector<>& injector) { - std::string runtime_dir_parent = AbsolutePath(FLAGS_instance_dir); +Result SetLogger(std::string runtime_dir_parent) { while (runtime_dir_parent[runtime_dir_parent.size() - 1] == '/') { runtime_dir_parent = runtime_dir_parent.substr(0, FLAGS_instance_dir.rfind('/')); @@ -274,7 +271,12 @@ Result InitFilesystemAndCreateConfig( {LogFileSeverity(), log, MetadataLevel::FULL}, })); } + return log; +} +Result InitFilesystemAndCreateConfig( + FetcherConfig fetcher_config, const std::vector& guest_configs, + fruit::Injector<>& injector, SharedFD log) { { // The config object is created here, but only exists in memory until the // SaveConfig line below. Don't launch cuttlefish subprocesses between these @@ -482,6 +484,8 @@ Result AssembleCvdMain(int argc, char** argv) { setenv("ANDROID_LOG_TAGS", "*:v", /* overwrite */ 0); ::android::base::InitLogging(argv, android::base::StderrLogger); + auto log = CF_EXPECT(SetLogger(AbsolutePath(FLAGS_instance_dir))); + int tty = isatty(0); int error_num = errno; CF_EXPECT(tty == 0, @@ -557,7 +561,7 @@ Result AssembleCvdMain(int argc, char** argv) { auto config = CF_EXPECT(InitFilesystemAndCreateConfig(std::move(fetcher_config), - guest_configs, injector), + guest_configs, injector, log), "Failed to create config"); std::cout << GetConfigFilePath(*config) << "\n"; -- cgit v1.2.3 From a65c39c57db8054a8bc7312f106bcf2c30b80d1e Mon Sep 17 00:00:00 2001 From: David Drysdale Date: Sun, 3 Dec 2023 07:40:37 +0000 Subject: KeyMint: drop code moved to common libraries Code here was moved into common libkmr_{hal,ta}_nonsecure libraries in aosp/2852598, so drop the original version and use the library. Test: VtsAidlKeyMintTargetTest Bug: 314513765 Change-Id: Ib893c5c2d8df087de0aae28fc69bf92e532b03ad --- guest/hals/keymint/rust/Android.bp | 1 + guest/hals/keymint/rust/src/keymint_hal_main.rs | 76 +---- host/commands/secure_env/rust/Android.bp | 6 +- host/commands/secure_env/rust/attest.rs | 423 ------------------------ host/commands/secure_env/rust/lib.rs | 4 +- host/commands/secure_env/rust/rpc.rs | 218 ------------ host/commands/secure_env/rust/soft.rs | 66 ---- 7 files changed, 7 insertions(+), 787 deletions(-) delete mode 100644 host/commands/secure_env/rust/attest.rs delete mode 100644 host/commands/secure_env/rust/rpc.rs delete mode 100644 host/commands/secure_env/rust/soft.rs diff --git a/guest/hals/keymint/rust/Android.bp b/guest/hals/keymint/rust/Android.bp index 780d10ca5..524aeb8be 100644 --- a/guest/hals/keymint/rust/Android.bp +++ b/guest/hals/keymint/rust/Android.bp @@ -28,6 +28,7 @@ rust_binary { "libhex", "libkmr_wire", "libkmr_hal", + "libkmr_hal_nonsecure", "liblibc", "liblog_rust", ], diff --git a/guest/hals/keymint/rust/src/keymint_hal_main.rs b/guest/hals/keymint/rust/src/keymint_hal_main.rs index 5441c6e48..958a2da52 100644 --- a/guest/hals/keymint/rust/src/keymint_hal_main.rs +++ b/guest/hals/keymint/rust/src/keymint_hal_main.rs @@ -15,7 +15,7 @@ //! This crate implements the KeyMint HAL service in Rust, communicating with a Rust //! trusted application (TA) running on the Cuttlefish host. -use kmr_hal::env::get_property; +use kmr_hal_nonsecure::{attestation_id_info, get_boot_info}; use log::{debug, error, info}; use std::ops::DerefMut; use std::os::unix::io::FromRawFd; @@ -174,77 +174,3 @@ fn inner_main() -> Result<(), HalServiceError> { info!("KeyMint HAL service is terminating."); Ok(()) } - -/// Populate attestation ID information based on properties (where available). -fn attestation_id_info() -> kmr_wire::AttestationIdInfo { - let prop = |name| { - get_property(name).unwrap_or_else(|_| format!("{} unavailable", name)).as_bytes().to_vec() - }; - kmr_wire::AttestationIdInfo { - brand: prop("ro.product.brand"), - device: prop("ro.product.device"), - product: prop("ro.product.name"), - serial: prop("ro.serialno"), - manufacturer: prop("ro.product.manufacturer"), - model: prop("ro.product.model"), - // Currently modem_simulator always returns one fixed value. See `handleGetIMEI` in - // device/google/cuttlefish/host/commands/modem_simulator/misc_service.cpp for more details. - // TODO(b/263188546): Use device-specific IMEI values when available. - imei: b"867400022047199".to_vec(), - imei2: b"867400022047199".to_vec(), - meid: vec![], - } -} - -/// Get boot information based on system properties. -fn get_boot_info() -> kmr_wire::SetBootInfoRequest { - // No access to a verified boot key. - let verified_boot_key = vec![0; 32]; - let vbmeta_digest = get_property("ro.boot.vbmeta.digest").unwrap_or_else(|_| "00".repeat(32)); - let verified_boot_hash = hex::decode(&vbmeta_digest).unwrap_or_else(|_e| { - error!("failed to parse hex data in '{}'", vbmeta_digest); - vec![0; 32] - }); - let device_boot_locked = match get_property("ro.boot.vbmeta.device_state") - .unwrap_or_else(|_| "no-prop".to_string()) - .as_str() - { - "locked" => true, - "unlocked" => false, - v => { - error!("Unknown device_state '{}', treating as unlocked", v); - false - } - }; - let verified_boot_state = match get_property("ro.boot.verifiedbootstate") - .unwrap_or_else(|_| "no-prop".to_string()) - .as_str() - { - "green" => 0, // Verified - "yellow" => 1, // SelfSigned - "orange" => 2, // Unverified, - "red" => 3, // Failed, - v => { - error!("Unknown boot state '{}', treating as Unverified", v); - 2 - } - }; - - // Attempt to get the boot patchlevel from a system property. This requires an SELinux - // permission, so fall back to re-using the OS patchlevel if this can't be done. - let boot_patchlevel_prop = get_property("ro.vendor.boot_security_patch").unwrap_or_else(|e| { - error!("Failed to retrieve boot patchlevel: {:?}", e); - get_property(kmr_hal::env::OS_PATCHLEVEL_PROPERTY) - .unwrap_or_else(|_| "1970-09-19".to_string()) - }); - let boot_patchlevel = - kmr_hal::env::extract_patchlevel(&boot_patchlevel_prop).unwrap_or(19700919); - - kmr_wire::SetBootInfoRequest { - verified_boot_key, - device_boot_locked, - verified_boot_state, - verified_boot_hash, - boot_patchlevel, - } -} diff --git a/host/commands/secure_env/rust/Android.bp b/host/commands/secure_env/rust/Android.bp index 6b04e7b12..57e8f7741 100644 --- a/host/commands/secure_env/rust/Android.bp +++ b/host/commands/secure_env/rust/Android.bp @@ -27,7 +27,7 @@ rust_protobuf { rust_library_host { name: "libkmr_cf", - srcs: [ "lib.rs" ], + srcs: ["lib.rs"], crate_name: "kmr_cf", rustlibs: [ "libhex", @@ -35,6 +35,7 @@ rust_library_host { "libkmr_crypto_boring", "libkmr_proto_rust", "libkmr_ta", + "libkmr_ta_nonsecure", "libkmr_wire", "liblibc", "liblog_rust", @@ -48,7 +49,7 @@ rust_library_host { rust_ffi_host { name: "libkmr_cf_ffi", compile_multilib: "64", - srcs: [ "ffi.rs" ], + srcs: ["ffi.rs"], crate_name: "kmr_cf_ffi", rustlibs: [ "libkmr_cf", @@ -68,6 +69,7 @@ rust_test_host { "libkmr_crypto_boring", "libkmr_proto_rust", "libkmr_ta", + "libkmr_ta_nonsecure", "libkmr_tests", "libkmr_wire", "liblibc", diff --git a/host/commands/secure_env/rust/attest.rs b/host/commands/secure_env/rust/attest.rs deleted file mode 100644 index b8410d68c..000000000 --- a/host/commands/secure_env/rust/attest.rs +++ /dev/null @@ -1,423 +0,0 @@ -// -// Copyright (C) 2022 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. - -//! Attestation keys and certificates. -//! -//! Hard-coded keys and certs copied from system/keymaster/context/soft_attestation_cert.cpp - -use kmr_common::{ - crypto::ec, crypto::rsa, crypto::CurveType, crypto::KeyMaterial, wire::keymint, - wire::keymint::EcCurve, Error, -}; -use kmr_ta::device::{RetrieveCertSigningInfo, SigningAlgorithm, SigningKeyType}; - -/// RSA attestation private key in PKCS#1 format. -/// -/// Decoded contents (using [der2ascii](https://github.com/google/der-ascii)): -/// -/// ``` -/// SEQUENCE { -/// INTEGER { 0 } -/// INTEGER { `00c08323dc56881bb8302069f5b08561c6eebe7f05e2f5a842048abe8b47be76feaef25cf29b2afa3200141601429989a15fcfc6815eb363583c2fd2f20be4983283dd814b16d7e185417ae54abc296a3a6db5c004083b68c556c1f02339916419864d50b74d40aeca484c77356c895a0c275abfac499d5d7d2362f29c5e02e871` } -/// INTEGER { 65537 } -/// INTEGER { `00be860b0b99a802a6fb1a59438a7bb715065b09a36dc6e9cacc6bf3c02c34d7d79e94c6606428d88c7b7f6577c1cdea64074abe8e7286df1f0811dc9728260868de95d32efc96b6d084ff271a5f60defcc703e7a38e6e29ba9a3c5fc2c28076b6a896af1d34d78828ce9bddb1f34f9c9404430781298e201316725bbdbc993a41` } -/// INTEGER { `00e1c6d927646c0916ec36826d594983740c21f1b074c4a1a59867c669795c85d3dc464c5b929e94bfb34e0dcc5014b10f13341ab7fdd5f60414d2a326cad41cc5` } -/// INTEGER { `00da485997785cd5630fb0fd8c5254f98e538e18983aae9e6b7e6a5a7b5d343755b9218ebd40320d28387d789f76fa218bcc2d8b68a5f6418fbbeca5179ab3afbd` } -/// INTEGER { `50fefc32649559616ed6534e154509329d93a3d810dbe5bdb982292cf78bd8badb8020ae8d57f4b71d05386ffe9e9db271ca3477a34999db76f8e5ece9c0d49d` } -/// INTEGER { `15b74cf27cceff8bb36bf04d9d8346b09a2f70d2f4439b0f26ac7e03f7e9d1f77d4b915fd29b2823f03acb5d5200e0857ff2a803e93eee96d6235ce95442bc21` } -/// INTEGER { `0090a745da8970b2cd649660324228c5f82856ffd665ba9a85c8d60f1b8bee717ecd2c72eae01dad86ba7654d4cf45adb5f1f2b31d9f8122cfa5f1a5570f9b2d25` } -/// } -/// ``` -const RSA_ATTEST_KEY: &str = concat!( - "3082025d02010002818100c08323dc56881bb8302069f5b08561c6eebe7f05e2", - "f5a842048abe8b47be76feaef25cf29b2afa3200141601429989a15fcfc6815e", - "b363583c2fd2f20be4983283dd814b16d7e185417ae54abc296a3a6db5c00408", - "3b68c556c1f02339916419864d50b74d40aeca484c77356c895a0c275abfac49", - "9d5d7d2362f29c5e02e871020301000102818100be860b0b99a802a6fb1a5943", - "8a7bb715065b09a36dc6e9cacc6bf3c02c34d7d79e94c6606428d88c7b7f6577", - "c1cdea64074abe8e7286df1f0811dc9728260868de95d32efc96b6d084ff271a", - "5f60defcc703e7a38e6e29ba9a3c5fc2c28076b6a896af1d34d78828ce9bddb1", - "f34f9c9404430781298e201316725bbdbc993a41024100e1c6d927646c0916ec", - "36826d594983740c21f1b074c4a1a59867c669795c85d3dc464c5b929e94bfb3", - "4e0dcc5014b10f13341ab7fdd5f60414d2a326cad41cc5024100da485997785c", - "d5630fb0fd8c5254f98e538e18983aae9e6b7e6a5a7b5d343755b9218ebd4032", - "0d28387d789f76fa218bcc2d8b68a5f6418fbbeca5179ab3afbd024050fefc32", - "649559616ed6534e154509329d93a3d810dbe5bdb982292cf78bd8badb8020ae", - "8d57f4b71d05386ffe9e9db271ca3477a34999db76f8e5ece9c0d49d024015b7", - "4cf27cceff8bb36bf04d9d8346b09a2f70d2f4439b0f26ac7e03f7e9d1f77d4b", - "915fd29b2823f03acb5d5200e0857ff2a803e93eee96d6235ce95442bc210241", - "0090a745da8970b2cd649660324228c5f82856ffd665ba9a85c8d60f1b8bee71", - "7ecd2c72eae01dad86ba7654d4cf45adb5f1f2b31d9f8122cfa5f1a5570f9b2d", - "25", -); - -/// Attestation certificate corresponding to [`RSA_ATTEST_KEY`], signed by the key in -/// [`RSA_ATTEST_ROOT_CERT`]. -/// -/// Decoded contents: -/// -/// ``` -/// Certificate: -/// Data: -/// Version: 3 (0x2) -/// Serial Number: 4096 (0x1000) -/// Signature Algorithm: SHA256-RSA -/// Issuer: C=US, O=Google, Inc., OU=Android, L=Mountain View, ST=California -/// Validity: -/// Not Before: 2016-01-04 12:40:53 +0000 UTC -/// Not After : 2035-12-30 12:40:53 +0000 UTC -/// Subject: C=US, O=Google, Inc., OU=Android, ST=California, CN=Android Software Attestation Key -/// Subject Public Key Info: -/// Public Key Algorithm: rsaEncryption -/// Public Key: (1024 bit) -/// Modulus: -/// c0:83:23:dc:56:88:1b:b8:30:20:69:f5:b0:85:61: -/// c6:ee:be:7f:05:e2:f5:a8:42:04:8a:be:8b:47:be: -/// 76:fe:ae:f2:5c:f2:9b:2a:fa:32:00:14:16:01:42: -/// 99:89:a1:5f:cf:c6:81:5e:b3:63:58:3c:2f:d2:f2: -/// 0b:e4:98:32:83:dd:81:4b:16:d7:e1:85:41:7a:e5: -/// 4a:bc:29:6a:3a:6d:b5:c0:04:08:3b:68:c5:56:c1: -/// f0:23:39:91:64:19:86:4d:50:b7:4d:40:ae:ca:48: -/// 4c:77:35:6c:89:5a:0c:27:5a:bf:ac:49:9d:5d:7d: -/// 23:62:f2:9c:5e:02:e8:71: -/// Exponent: 65537 (0x10001) -/// X509v3 extensions: -/// X509v3 Authority Key Identifier: -/// keyid:29faf1accc4dd24c96402775b6b0e932e507fe2e -/// X509v3 Subject Key Identifier: -/// keyid:d40c101bf8cd63b9f73952b50e135ca6d7999386 -/// X509v3 Key Usage: critical -/// Digital Signature, Certificate Signing -/// X509v3 Basic Constraints: critical -/// CA:true, pathlen:0 -/// Signature Algorithm: SHA256-RSA -/// 9e:2d:48:5f:8c:67:33:dc:1a:85:ad:99:d7:50:23:ea:14:ec: -/// 43:b0:e1:9d:ea:c2:23:46:1e:72:b5:19:dc:60:22:e4:a5:68: -/// 31:6c:0b:55:c4:e6:9c:a2:2d:9f:3a:4f:93:6b:31:8b:16:78: -/// 16:0d:88:cb:d9:8b:cc:80:9d:84:f0:c2:27:e3:6b:38:f1:fd: -/// d1:e7:17:72:31:59:35:7d:96:f3:c5:7f:ab:9d:8f:96:61:26: -/// 4f:b2:be:81:bb:0d:49:04:22:8a:ce:9f:f7:f5:42:2e:25:44: -/// fa:21:07:12:5a:83:b5:55:ad:18:82:f8:40:14:9b:9c:20:63: -/// 04:7f: -/// ``` -const RSA_ATTEST_CERT: &str = concat!( - "308202b63082021fa00302010202021000300d06092a864886f70d01010b0500", - "3063310b30090603550406130255533113301106035504080c0a43616c69666f", - "726e69613116301406035504070c0d4d6f756e7461696e205669657731153013", - "060355040a0c0c476f6f676c652c20496e632e3110300e060355040b0c07416e", - "64726f6964301e170d3136303130343132343035335a170d3335313233303132", - "343035335a3076310b30090603550406130255533113301106035504080c0a43", - "616c69666f726e696131153013060355040a0c0c476f6f676c652c20496e632e", - "3110300e060355040b0c07416e64726f69643129302706035504030c20416e64", - "726f696420536f667477617265204174746573746174696f6e204b657930819f", - "300d06092a864886f70d010101050003818d0030818902818100c08323dc5688", - "1bb8302069f5b08561c6eebe7f05e2f5a842048abe8b47be76feaef25cf29b2a", - "fa3200141601429989a15fcfc6815eb363583c2fd2f20be4983283dd814b16d7", - "e185417ae54abc296a3a6db5c004083b68c556c1f02339916419864d50b74d40", - "aeca484c77356c895a0c275abfac499d5d7d2362f29c5e02e8710203010001a3", - "663064301d0603551d0e04160414d40c101bf8cd63b9f73952b50e135ca6d799", - "9386301f0603551d2304183016801429faf1accc4dd24c96402775b6b0e932e5", - "07fe2e30120603551d130101ff040830060101ff020100300e0603551d0f0101", - "ff040403020284300d06092a864886f70d01010b0500038181009e2d485f8c67", - "33dc1a85ad99d75023ea14ec43b0e19deac223461e72b519dc6022e4a568316c", - "0b55c4e69ca22d9f3a4f936b318b1678160d88cbd98bcc809d84f0c227e36b38", - "f1fdd1e717723159357d96f3c57fab9d8f9661264fb2be81bb0d4904228ace9f", - "f7f5422e2544fa2107125a83b555ad1882f840149b9c2063047f", -); - -/// Attestation self-signed root certificate holding the key that signed [`RSA_ATTEST_CERT`]. -/// -/// Decoded contents: -/// -/// ``` -/// Certificate: -/// Data: -/// Version: 3 (0x2) -/// Serial Number: 18416584322103887884 (0xff94d9dd9f07c80c) -/// Signature Algorithm: SHA256-RSA -/// Issuer: C=US, O=Google, Inc., OU=Android, L=Mountain View, ST=California -/// Validity: -/// Not Before: 2016-01-04 12:31:08 +0000 UTC -/// Not After : 2035-12-30 12:31:08 +0000 UTC -/// Subject: C=US, O=Google, Inc., OU=Android, L=Mountain View, ST=California -/// Subject Public Key Info: -/// Public Key Algorithm: rsaEncryption -/// Public Key: (1024 bit) -/// Modulus: -/// a2:6b:ad:eb:6e:2e:44:61:ef:d5:0e:82:e6:b7:94: -/// d1:75:23:1f:77:9b:63:91:63:ff:f7:aa:ff:0b:72: -/// 47:4e:c0:2c:43:ec:33:7c:d7:ac:ed:40:3e:8c:28: -/// a0:66:d5:f7:87:0b:33:97:de:0e:b8:4e:13:40:ab: -/// af:a5:27:bf:95:69:a0:31:db:06:52:65:f8:44:59: -/// 57:61:f0:bb:f2:17:4b:b7:41:80:64:c0:28:0e:8f: -/// 52:77:8e:db:d2:47:b6:45:e9:19:c8:e9:8b:c3:db: -/// c2:91:3f:d7:d7:50:c4:1d:35:66:f9:57:e4:97:96: -/// 0b:09:ac:ce:92:35:85:9b: -/// Exponent: 65537 (0x10001) -/// X509v3 extensions: -/// X509v3 Authority Key Identifier: -/// keyid:29faf1accc4dd24c96402775b6b0e932e507fe2e -/// X509v3 Subject Key Identifier: -/// keyid:29faf1accc4dd24c96402775b6b0e932e507fe2e -/// X509v3 Key Usage: critical -/// Digital Signature, Certificate Signing -/// X509v3 Basic Constraints: critical -/// CA:true -/// Signature Algorithm: SHA256-RSA -/// 4f:72:f3:36:59:8d:0e:c1:b9:74:5b:31:59:f6:f0:8d:25:49: -/// 30:9e:a3:1c:1c:29:d2:45:2d:20:b9:4d:5f:64:b4:e8:80:c7: -/// 78:7a:9c:39:de:a8:b3:f5:bf:2f:70:5f:47:10:5c:c5:e6:eb: -/// 4d:06:99:61:d2:ae:9a:07:ff:f7:7c:b8:ab:eb:9c:0f:24:07: -/// 5e:b1:7f:ba:79:71:fd:4d:5b:9e:df:14:a9:fe:df:ed:7c:c0: -/// 88:5d:f8:dd:9b:64:32:56:d5:35:9a:e2:13:f9:8f:ce:c1:7c: -/// dc:ef:a4:aa:b2:55:c3:83:a9:2e:fb:5c:f6:62:f5:27:52:17: -/// be:63: -/// ``` -const RSA_ATTEST_ROOT_CERT: &str = concat!( - "308202a730820210a003020102020900ff94d9dd9f07c80c300d06092a864886", - "f70d01010b05003063310b30090603550406130255533113301106035504080c", - "0a43616c69666f726e69613116301406035504070c0d4d6f756e7461696e2056", - "69657731153013060355040a0c0c476f6f676c652c20496e632e3110300e0603", - "55040b0c07416e64726f6964301e170d3136303130343132333130385a170d33", - "35313233303132333130385a3063310b30090603550406130255533113301106", - "035504080c0a43616c69666f726e69613116301406035504070c0d4d6f756e74", - "61696e205669657731153013060355040a0c0c476f6f676c652c20496e632e31", - "10300e060355040b0c07416e64726f696430819f300d06092a864886f70d0101", - "01050003818d0030818902818100a26badeb6e2e4461efd50e82e6b794d17523", - "1f779b639163fff7aaff0b72474ec02c43ec337cd7aced403e8c28a066d5f787", - "0b3397de0eb84e1340abafa527bf9569a031db065265f844595761f0bbf2174b", - "b7418064c0280e8f52778edbd247b645e919c8e98bc3dbc2913fd7d750c41d35", - "66f957e497960b09acce9235859b0203010001a3633061301d0603551d0e0416", - "041429faf1accc4dd24c96402775b6b0e932e507fe2e301f0603551d23041830", - "16801429faf1accc4dd24c96402775b6b0e932e507fe2e300f0603551d130101", - "ff040530030101ff300e0603551d0f0101ff040403020284300d06092a864886", - "f70d01010b0500038181004f72f336598d0ec1b9745b3159f6f08d2549309ea3", - "1c1c29d2452d20b94d5f64b4e880c7787a9c39dea8b3f5bf2f705f47105cc5e6", - "eb4d069961d2ae9a07fff77cb8abeb9c0f24075eb17fba7971fd4d5b9edf14a9", - "fedfed7cc0885df8dd9b643256d5359ae213f98fcec17cdcefa4aab255c383a9", - "2efb5cf662f5275217be63", -); - -/// EC attestation private key in `ECPrivateKey` format. -/// -/// Decoded contents (using [der2ascii](https://github.com/google/der-ascii)): -/// -/// ``` -/// SEQUENCE { -/// INTEGER { 1 } -/// OCTET_STRING { `21e086432a15198459cf363a50fc14c9daadf935f527c2dfd71e4d6dbc42e544` } -/// [0] { -/// # secp256r1 -/// OBJECT_IDENTIFIER { 1.2.840.10045.3.1.7 } -/// } -/// [1] { -/// BIT_STRING { `00` `04eb9e79f8426359accb2a914c8986cc70ad90669382a9732613feaccbf821274c2174974a2afea5b94d7f66d4e065106635bc53b7a0a3a671583edb3e11ae1014` } -/// } -/// } -/// ``` -const EC_ATTEST_KEY: &str = concat!( - "3077020101042021e086432a15198459cf363a50fc14c9daadf935f527c2dfd7", - "1e4d6dbc42e544a00a06082a8648ce3d030107a14403420004eb9e79f8426359", - "accb2a914c8986cc70ad90669382a9732613feaccbf821274c2174974a2afea5", - "b94d7f66d4e065106635bc53b7a0a3a671583edb3e11ae1014", -); - -/// Attestation certificate corresponding to [`EC_ATTEST_KEY`], signed by the key in -/// [`EC_ATTEST_ROOT_CERT`]. -/// -/// Decoded contents: -/// -/// ``` -/// Certificate: -/// Data: -/// Version: 3 (0x2) -/// Serial Number: 4097 (0x1001) -/// Signature Algorithm: ECDSA-SHA256 -/// Issuer: C=US, O=Google, Inc., OU=Android, L=Mountain View, ST=California, CN=Android Keystore Software Attestation Root -/// Validity: -/// Not Before: 2016-01-11 00:46:09 +0000 UTC -/// Not After : 2026-01-08 00:46:09 +0000 UTC -/// Subject: C=US, O=Google, Inc., OU=Android, ST=California, CN=Android Keystore Software Attestation Intermediate -/// Subject Public Key Info: -/// Public Key Algorithm: id-ecPublicKey -/// Public Key: (256 bit) -/// pub: -/// 04:eb:9e:79:f8:42:63:59:ac:cb:2a:91:4c:89:86: -/// cc:70:ad:90:66:93:82:a9:73:26:13:fe:ac:cb:f8: -/// 21:27:4c:21:74:97:4a:2a:fe:a5:b9:4d:7f:66:d4: -/// e0:65:10:66:35:bc:53:b7:a0:a3:a6:71:58:3e:db: -/// 3e:11:ae:10:14: -/// ASN1 OID: prime256v1 -/// X509v3 extensions: -/// X509v3 Authority Key Identifier: -/// keyid:c8ade9774c45c3a3cf0d1610e479433a215a30cf -/// X509v3 Subject Key Identifier: -/// keyid:3ffcacd61ab13a9e8120b8d5251cc565bb1e91a9 -/// X509v3 Key Usage: critical -/// Digital Signature, Certificate Signing -/// X509v3 Basic Constraints: critical -/// CA:true, pathlen:0 -/// Signature Algorithm: ECDSA-SHA256 -/// 30:45:02:20:4b:8a:9b:7b:ee:82:bc:c0:33:87:ae:2f:c0:89: -/// 98:b4:dd:c3:8d:ab:27:2a:45:9f:69:0c:c7:c3:92:d4:0f:8e: -/// 02:21:00:ee:da:01:5d:b6:f4:32:e9:d4:84:3b:62:4c:94:04: -/// ef:3a:7c:cc:bd:5e:fb:22:bb:e7:fe:b9:77:3f:59:3f:fb: -/// ``` -const EC_ATTEST_CERT: &str = concat!( - "308202783082021ea00302010202021001300a06082a8648ce3d040302308198", - "310b30090603550406130255533113301106035504080c0a43616c69666f726e", - "69613116301406035504070c0d4d6f756e7461696e2056696577311530130603", - "55040a0c0c476f6f676c652c20496e632e3110300e060355040b0c07416e6472", - "6f69643133303106035504030c2a416e64726f6964204b657973746f72652053", - "6f667477617265204174746573746174696f6e20526f6f74301e170d31363031", - "31313030343630395a170d3236303130383030343630395a308188310b300906", - "03550406130255533113301106035504080c0a43616c69666f726e6961311530", - "13060355040a0c0c476f6f676c652c20496e632e3110300e060355040b0c0741", - "6e64726f6964313b303906035504030c32416e64726f6964204b657973746f72", - "6520536f667477617265204174746573746174696f6e20496e7465726d656469", - "6174653059301306072a8648ce3d020106082a8648ce3d03010703420004eb9e", - "79f8426359accb2a914c8986cc70ad90669382a9732613feaccbf821274c2174", - "974a2afea5b94d7f66d4e065106635bc53b7a0a3a671583edb3e11ae1014a366", - "3064301d0603551d0e041604143ffcacd61ab13a9e8120b8d5251cc565bb1e91", - "a9301f0603551d23041830168014c8ade9774c45c3a3cf0d1610e479433a215a", - "30cf30120603551d130101ff040830060101ff020100300e0603551d0f0101ff", - "040403020284300a06082a8648ce3d040302034800304502204b8a9b7bee82bc", - "c03387ae2fc08998b4ddc38dab272a459f690cc7c392d40f8e022100eeda015d", - "b6f432e9d4843b624c9404ef3a7cccbd5efb22bbe7feb9773f593ffb", -); - -/// Attestation self-signed root certificate holding the key that signed [`EC_ATTEST_CERT`]. -/// -/// Decoded contents: -/// -/// ``` -/// Certificate: -/// Data: -/// Version: 3 (0x2) -/// Serial Number: 11674912229752527703 (0xa2059ed10e435b57) -/// Signature Algorithm: ECDSA-SHA256 -/// Issuer: C=US, O=Google, Inc., OU=Android, L=Mountain View, ST=California, CN=Android Keystore Software Attestation Root -/// Validity: -/// Not Before: 2016-01-11 00:43:50 +0000 UTC -/// Not After : 2036-01-06 00:43:50 +0000 UTC -/// Subject: C=US, O=Google, Inc., OU=Android, L=Mountain View, ST=California, CN=Android Keystore Software Attestation Root -/// Subject Public Key Info: -/// Public Key Algorithm: id-ecPublicKey -/// Public Key: (256 bit) -/// pub: -/// 04:ee:5d:5e:c7:e1:c0:db:6d:03:a6:7e:e6:b6:1b: -/// ec:4d:6a:5d:6a:68:2e:0f:ff:7f:49:0e:7d:77:1f: -/// 44:22:6d:bd:b1:af:fa:16:cb:c7:ad:c5:77:d2:56: -/// 9c:aa:b7:b0:2d:54:01:5d:3e:43:2b:2a:8e:d7:4e: -/// ec:48:75:41:a4: -/// ASN1 OID: prime256v1 -/// X509v3 extensions: -/// X509v3 Authority Key Identifier: -/// keyid:c8ade9774c45c3a3cf0d1610e479433a215a30cf -/// X509v3 Subject Key Identifier: -/// keyid:c8ade9774c45c3a3cf0d1610e479433a215a30cf -/// X509v3 Key Usage: critical -/// Digital Signature, Certificate Signing -/// X509v3 Basic Constraints: critical -/// CA:true -/// Signature Algorithm: ECDSA-SHA256 -/// 30:44:02:20:35:21:a3:ef:8b:34:46:1e:9c:d5:60:f3:1d:58: -/// 89:20:6a:dc:a3:65:41:f6:0d:9e:ce:8a:19:8c:66:48:60:7b: -/// 02:20:4d:0b:f3:51:d9:30:7c:7d:5b:da:35:34:1d:a8:47:1b: -/// 63:a5:85:65:3c:ad:4f:24:a7:e7:4d:af:41:7d:f1:bf: -/// ``` -const EC_ATTEST_ROOT_CERT: &str = concat!( - "3082028b30820232a003020102020900a2059ed10e435b57300a06082a8648ce", - "3d040302308198310b30090603550406130255533113301106035504080c0a43", - "616c69666f726e69613116301406035504070c0d4d6f756e7461696e20566965", - "7731153013060355040a0c0c476f6f676c652c20496e632e3110300e06035504", - "0b0c07416e64726f69643133303106035504030c2a416e64726f6964204b6579", - "73746f726520536f667477617265204174746573746174696f6e20526f6f7430", - "1e170d3136303131313030343335305a170d3336303130363030343335305a30", - "8198310b30090603550406130255533113301106035504080c0a43616c69666f", - "726e69613116301406035504070c0d4d6f756e7461696e205669657731153013", - "060355040a0c0c476f6f676c652c20496e632e3110300e060355040b0c07416e", - "64726f69643133303106035504030c2a416e64726f6964204b657973746f7265", - "20536f667477617265204174746573746174696f6e20526f6f74305930130607", - "2a8648ce3d020106082a8648ce3d03010703420004ee5d5ec7e1c0db6d03a67e", - "e6b61bec4d6a5d6a682e0fff7f490e7d771f44226dbdb1affa16cbc7adc577d2", - "569caab7b02d54015d3e432b2a8ed74eec487541a4a3633061301d0603551d0e", - "04160414c8ade9774c45c3a3cf0d1610e479433a215a30cf301f0603551d2304", - "1830168014c8ade9774c45c3a3cf0d1610e479433a215a30cf300f0603551d13", - "0101ff040530030101ff300e0603551d0f0101ff040403020284300a06082a86", - "48ce3d040302034700304402203521a3ef8b34461e9cd560f31d5889206adca3", - "6541f60d9ece8a198c6648607b02204d0bf351d9307c7d5bda35341da8471b63", - "a585653cad4f24a7e74daf417df1bf", -); - -/// Per-algorithm attestation certificate signing information. -pub(crate) struct CertSignAlgoInfo { - key: KeyMaterial, - chain: Vec, -} - -pub(crate) struct CertSignInfo { - rsa_info: CertSignAlgoInfo, - ec_info: CertSignAlgoInfo, -} - -impl CertSignInfo { - pub(crate) fn new() -> Self { - CertSignInfo { - rsa_info: CertSignAlgoInfo { - key: KeyMaterial::Rsa(rsa::Key(hex::decode(RSA_ATTEST_KEY).unwrap()).into()), - chain: vec![ - keymint::Certificate { - encoded_certificate: hex::decode(RSA_ATTEST_CERT).unwrap(), - }, - keymint::Certificate { - encoded_certificate: hex::decode(RSA_ATTEST_ROOT_CERT).unwrap(), - }, - ], - }, - ec_info: CertSignAlgoInfo { - key: KeyMaterial::Ec( - EcCurve::P256, - CurveType::Nist, - ec::Key::P256(ec::NistKey(hex::decode(EC_ATTEST_KEY).unwrap())).into(), - ), - chain: vec![ - keymint::Certificate { - encoded_certificate: hex::decode(EC_ATTEST_CERT).unwrap(), - }, - keymint::Certificate { - encoded_certificate: hex::decode(EC_ATTEST_ROOT_CERT).unwrap(), - }, - ], - }, - } - } -} - -impl RetrieveCertSigningInfo for CertSignInfo { - fn signing_key(&self, key_type: SigningKeyType) -> Result { - Ok(match key_type.algo_hint { - SigningAlgorithm::Rsa => self.rsa_info.key.clone(), - SigningAlgorithm::Ec => self.ec_info.key.clone(), - }) - } - - fn cert_chain(&self, key_type: SigningKeyType) -> Result, Error> { - Ok(match key_type.algo_hint { - SigningAlgorithm::Rsa => self.rsa_info.chain.clone(), - SigningAlgorithm::Ec => self.ec_info.chain.clone(), - }) - } -} diff --git a/host/commands/secure_env/rust/lib.rs b/host/commands/secure_env/rust/lib.rs index e1f4e6930..ca510dc62 100644 --- a/host/commands/secure_env/rust/lib.rs +++ b/host/commands/secure_env/rust/lib.rs @@ -26,6 +26,7 @@ use kmr_ta::device::{ BootloaderDone, CsrSigningAlgorithm, Implementation, TrustedPresenceUnsupported, }; use kmr_ta::{HardwareInfo, KeyMintTa, RpcInfo, RpcInfoV3}; +use kmr_ta_nonsecure::{attest, rpc, soft}; use kmr_wire::keymint::SecurityLevel; use kmr_wire::rpc::MINIMUM_SUPPORTED_KEYS_IN_CSR; use log::{error, info, trace}; @@ -34,11 +35,8 @@ use std::io::{Read, Write}; use std::os::fd::AsRawFd; use std::os::unix::ffi::OsStrExt; -pub mod attest; mod clock; -pub mod rpc; mod sdd; -mod soft; mod tpm; #[cfg(test)] diff --git a/host/commands/secure_env/rust/rpc.rs b/host/commands/secure_env/rust/rpc.rs deleted file mode 100644 index 1e5c3ee5f..000000000 --- a/host/commands/secure_env/rust/rpc.rs +++ /dev/null @@ -1,218 +0,0 @@ -// -// Copyright (C) 2022 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. - -//! Emulated implementation of device traits for `IRemotelyProvisionedComponent`. - -use core::cell::RefCell; -use kmr_common::crypto::{ec, ec::CoseKeyPurpose, Ec, KeyMaterial}; -use kmr_common::{crypto, explicit, rpc_err, vec_try, Error}; -use kmr_crypto_boring::{ec::BoringEc, hmac::BoringHmac, rng::BoringRng}; -use kmr_ta::device::{ - CsrSigningAlgorithm, DiceInfo, PubDiceArtifacts, RetrieveRpcArtifacts, RpcV2Req, -}; -use kmr_wire::coset::{iana, CoseSign1Builder, HeaderBuilder}; -use kmr_wire::keymint::{Digest, EcCurve}; -use kmr_wire::{cbor::value::Value, coset::AsCborValue, rpc, CborError}; - -/// Trait to encapsulate deterministic derivation of secret data. -pub trait DeriveBytes { - /// Derive `output_len` bytes of data from `context`, deterministically. - fn derive_bytes(&self, context: &[u8], output_len: usize) -> Result, Error>; -} - -/// Common emulated implementation of RPC artifact retrieval. -pub struct Artifacts { - derive: T, - sign_algo: CsrSigningAlgorithm, - // Invariant once populated: `self.dice_info.signing_algorithm` == `self.sign_algo` - dice_info: RefCell>, - // Invariant once populated: `self.bcc_signing_key` is a variant that matches `self.sign_algo` - bcc_signing_key: RefCell>, -} - -impl RetrieveRpcArtifacts for Artifacts { - fn derive_bytes_from_hbk( - &self, - _hkdf: &dyn crypto::Hkdf, - context: &[u8], - output_len: usize, - ) -> Result, Error> { - self.derive.derive_bytes(context, output_len) - } - - fn get_dice_info<'a>(&self, _test_mode: rpc::TestMode) -> Result { - if self.dice_info.borrow().is_none() { - let (dice_info, priv_key) = self.generate_dice_artifacts(rpc::TestMode(false))?; - *self.dice_info.borrow_mut() = Some(dice_info); - *self.bcc_signing_key.borrow_mut() = Some(priv_key); - } - - Ok(self - .dice_info - .borrow() - .as_ref() - .ok_or_else(|| rpc_err!(Failed, "DICE artifacts are not initialized."))? - .clone()) - } - - fn sign_data( - &self, - ec: &dyn crypto::Ec, - data: &[u8], - _rpc_v2: Option, - ) -> Result, Error> { - // DICE artifacts should have been initialized via `get_dice_info()` by the time this - // method is called. - let private_key = self - .bcc_signing_key - .borrow() - .as_ref() - .ok_or_else(|| rpc_err!(Failed, "DICE artifacts are not initialized."))? - .clone(); - - let mut op = ec.begin_sign(private_key.into(), self.signing_digest())?; - op.update(data)?; - let sig = op.finish()?; - crypto::ec::to_cose_signature(self.signing_curve(), sig) - } -} - -impl Artifacts { - /// Constructor. - pub fn new(derive: T, sign_algo: CsrSigningAlgorithm) -> Self { - Self { - derive, - sign_algo, - dice_info: RefCell::new(None), - bcc_signing_key: RefCell::new(None), - } - } - - /// Indicate the curve used in signing. - fn signing_curve(&self) -> EcCurve { - match self.sign_algo { - CsrSigningAlgorithm::ES256 => EcCurve::P256, - CsrSigningAlgorithm::ES384 => EcCurve::P384, - CsrSigningAlgorithm::EdDSA => EcCurve::Curve25519, - } - } - - /// Indicate the digest used in signing. - fn signing_digest(&self) -> Digest { - match self.sign_algo { - CsrSigningAlgorithm::ES256 => Digest::Sha256, - CsrSigningAlgorithm::ES384 => Digest::Sha384, - CsrSigningAlgorithm::EdDSA => Digest::None, - } - } - - /// Indicate the COSE algorithm value associated with signing. - fn signing_cose_algo(&self) -> iana::Algorithm { - match self.sign_algo { - CsrSigningAlgorithm::ES256 => iana::Algorithm::ES256, - CsrSigningAlgorithm::ES384 => iana::Algorithm::ES384, - CsrSigningAlgorithm::EdDSA => iana::Algorithm::EdDSA, - } - } - - fn generate_dice_artifacts( - &self, - _test_mode: rpc::TestMode, - ) -> Result<(DiceInfo, ec::Key), Error> { - let ec = BoringEc::default(); - - let key_material = match self.sign_algo { - CsrSigningAlgorithm::EdDSA => { - let secret = self.derive_bytes_from_hbk(&BoringHmac, b"Device Key Seed", 32)?; - ec::import_raw_ed25519_key(&secret) - } - // TODO: generate the *same* key after reboot, by use of the TPM. - CsrSigningAlgorithm::ES256 => { - ec.generate_nist_key(&mut BoringRng, ec::NistCurve::P256, &[]) - } - CsrSigningAlgorithm::ES384 => { - ec.generate_nist_key(&mut BoringRng, ec::NistCurve::P384, &[]) - } - }?; - let (pub_cose_key, private_key) = match key_material { - KeyMaterial::Ec(curve, curve_type, key) => ( - key.public_cose_key( - &ec, - curve, - curve_type, - CoseKeyPurpose::Sign, - None, /* no key ID */ - rpc::TestMode(false), - )?, - key, - ), - _ => { - return Err(rpc_err!( - Failed, - "expected the Ec variant of KeyMaterial for the cdi leaf key." - )) - } - }; - - let cose_key_cbor = pub_cose_key.to_cbor_value().map_err(CborError::from)?; - let cose_key_cbor_data = kmr_ta::rkp::serialize_cbor(&cose_key_cbor)?; - - // Construct `DiceChainEntryPayload` - let dice_chain_entry_payload = Value::Map(vec_try![ - // Issuer - (Value::Integer(1.into()), Value::Text(String::from("Issuer"))), - // Subject - (Value::Integer(2.into()), Value::Text(String::from("Subject"))), - // Subject public key - (Value::Integer((-4670552).into()), Value::Bytes(cose_key_cbor_data)), - // Key Usage field contains a CBOR byte string of the bits which correspond - // to `keyCertSign` as per RFC 5280 Section 4.2.1.3 (in little-endian byte order) - (Value::Integer((-4670553).into()), Value::Bytes(vec_try![0x20]?)), - ]?); - let dice_chain_entry_payload_data = kmr_ta::rkp::serialize_cbor(&dice_chain_entry_payload)?; - - // Construct `DiceChainEntry` - let protected = HeaderBuilder::new().algorithm(self.signing_cose_algo()).build(); - let dice_chain_entry = CoseSign1Builder::new() - .protected(protected) - .payload(dice_chain_entry_payload_data) - .try_create_signature(&[], |input| { - let mut op = ec.begin_sign(private_key.clone(), self.signing_digest())?; - op.update(input)?; - let sig = op.finish()?; - crypto::ec::to_cose_signature(self.signing_curve(), sig) - })? - .build(); - let dice_chain_entry_cbor = dice_chain_entry.to_cbor_value().map_err(CborError::from)?; - - // Construct `DiceCertChain` - let dice_cert_chain = Value::Array(vec_try![cose_key_cbor, dice_chain_entry_cbor]?); - let dice_cert_chain_data = kmr_ta::rkp::serialize_cbor(&dice_cert_chain)?; - - // Construct `UdsCerts` as an empty CBOR map - let uds_certs_data = kmr_ta::rkp::serialize_cbor(&Value::Map(Vec::new()))?; - - let pub_dice_artifacts = - PubDiceArtifacts { dice_cert_chain: dice_cert_chain_data, uds_certs: uds_certs_data }; - - let dice_info = DiceInfo { - pub_dice_artifacts, - signing_algorithm: self.sign_algo, - rpc_v2_test_cdi_priv: None, - }; - - Ok((dice_info, explicit!(private_key)?)) - } -} diff --git a/host/commands/secure_env/rust/soft.rs b/host/commands/secure_env/rust/soft.rs deleted file mode 100644 index 3f031bbf7..000000000 --- a/host/commands/secure_env/rust/soft.rs +++ /dev/null @@ -1,66 +0,0 @@ -// -// Copyright (C) 2022 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. - -//! Software-only trait implementations using fake keys. - -use kmr_common::{ - crypto, - crypto::{Hkdf, Rng}, - Error, -}; -use kmr_crypto_boring::{hmac::BoringHmac, rng::BoringRng}; -use kmr_ta::device::RetrieveKeyMaterial; - -/// Root key retrieval using hard-coded fake keys. -pub struct Keys; - -impl RetrieveKeyMaterial for Keys { - fn root_kek(&self, _context: &[u8]) -> Result, Error> { - // Matches `MASTER_KEY` in system/keymaster/key_blob_utils/software_keyblobs.cpp - Ok(crypto::hmac::Key::new([0; 16].to_vec()).into()) - } - fn kak(&self) -> Result, Error> { - // Matches `kFakeKeyAgreementKey` in - // system/keymaster/km_openssl/soft_keymaster_enforcement.cpp. - Ok(crypto::aes::Key::Aes256([0; 32]).into()) - } - fn unique_id_hbk(&self, _ckdf: &dyn crypto::Ckdf) -> Result { - // Matches value used in system/keymaster/contexts/pure_soft_keymaster_context.cpp. - crypto::hmac::Key::new_from(b"MustBeRandomBits") - } -} - -pub struct Derive { - hbk: Vec, -} - -impl Default for Derive { - fn default() -> Self { - // Use random data as an emulation of a hardware-backed key. - let mut hbk = vec![0; 32]; - let mut rng = BoringRng; - rng.fill_bytes(&mut hbk); - Self { hbk } - } -} - -impl crate::rpc::DeriveBytes for Derive { - fn derive_bytes(&self, context: &[u8], output_len: usize) -> Result, Error> { - BoringHmac.hkdf(&[], &self.hbk, context, output_len) - } -} - -/// RPC artifact retrieval using software fake key. -pub type RpcArtifacts = crate::rpc::Artifacts; -- cgit v1.2.3 From bdcf0a7997277f158fd95ea14b4139067be616f7 Mon Sep 17 00:00:00 2001 From: Dennis Song Date: Mon, 4 Mar 2024 08:30:13 +0000 Subject: Support launching arm64 CF with a debug ramdisk image Add an optional parameter which specifies the path to a vendor boot debug image. The cuttlefish instance can be launched using this image to load a debug ramdisk image. Bug: 317942272 Test: ./launch_cvd_arm64_server.sh \ @ \ ./vendor_boot-chd_debug.img Change-Id: I016238a4105b084d45afc0c0ac2f8ef41a364012 --- tools/launch_cvd_arm64_server.sh | 28 +++++++++++++++++++++------- tools/launch_cvd_arm64_server_docker.sh | 1 + 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/tools/launch_cvd_arm64_server.sh b/tools/launch_cvd_arm64_server.sh index 60c7a4966..8bfea1fd3 100755 --- a/tools/launch_cvd_arm64_server.sh +++ b/tools/launch_cvd_arm64_server.sh @@ -17,19 +17,29 @@ color_cyan="\033[0;36m" color_plain="\033[0m" color_yellow="\033[0;33m" -# validate number of arguments to equal 3 -if [ "$#" -lt 2 ] || [ "$#" -gt 3 ]; then - echo "This script requires 2 mandatory and 1 optional parameters, server address, base instance number and optionally number of instances to invoke" +# validate number of arguments to between 2 and 4 +if [ "$#" -lt 2 ] || [ "$#" -gt 4 ]; then + echo "This script requires 2 mandatory and 2 optional parameters:" + echo "Mandatory: server address, base instance number." + echo "Optional: the number of instances to invoke, the path to a vendor debug ramdisk image." + echo "For example: ./launch_cvd_arm64_server.sh user@ 10 1 ./vendor_boot-debug.img" exit 1 fi # map arguments to variables server=$1 base_instance_num=$2 -if [ "$#" -eq 3 ]; then - num_instances=$3 +if [ "$#" -gt 2 ]; then + num_instances=$3 else - num_instances=1 + num_instances=1 +fi +if [ "$#" -eq 4 ]; then + vendor_boot_debug_image=$4 + vendor_boot_debug_flag="--vendor_boot_image=$(basename $4)" +else + vendor_boot_debug_image="" + vendor_boot_debug_flag="" fi # set img_dir and cvd_host_tool_dir @@ -50,6 +60,10 @@ if [ -f $img_dir/required_images ]; then else rsync -aSvch --recursive $img_dir/bootloader $img_dir/*.img $server:~/$cvd_home_dir --info=progress2 fi +if [ ! -z "$vendor_boot_debug_image" ]; then + echo "use the debug ramdisk image: $vendor_boot_debug_image" + rsync -Svch $vendor_boot_debug_image $server:~/$cvd_home_dir --info=progress2 +fi # copy the cvd host package if [ -d $cvd_host_tool_dir/cvd-host_package ]; then @@ -79,7 +93,7 @@ instance_ids_flag="--base_instance_num=$base_instance_num \ --num_instances=$num_instances" echo -e "${color_cyan}Booting the cuttlefish instances${color_plain}" ssh $server \ - -t "cd ~/$cvd_home_dir && HOME=~/$cvd_home_dir bin/launch_cvd $instance_ids_flag $daemon_flag" + -t "cd ~/$cvd_home_dir && HOME=~/$cvd_home_dir bin/launch_cvd $instance_ids_flag $daemon_flag $vendor_boot_debug_flag" # Web UI port is 2443 instead 1443 because there could be a running operator in this machine as well. web_ui_port=2443 diff --git a/tools/launch_cvd_arm64_server_docker.sh b/tools/launch_cvd_arm64_server_docker.sh index 81354f20b..7bd520c85 100755 --- a/tools/launch_cvd_arm64_server_docker.sh +++ b/tools/launch_cvd_arm64_server_docker.sh @@ -123,6 +123,7 @@ ssh $server \ echo -e "Done" # start Cuttlefish instance on top of docker instance +# TODO(b/317942272): support starting the instance with an optional vendor boot debug image. echo -e "Starting Cuttlefish" ssh $server "curl -s -k -X POST $host_orchestrator_url/cvds \ -H 'Content-Type: application/json' \ -- cgit v1.2.3 From 87ac3dd68b682d267c54ab98776864b746bd1fcb Mon Sep 17 00:00:00 2001 From: Myles Watson Date: Tue, 5 Mar 2024 19:44:06 +0000 Subject: Revert "Do not install android.hardware.bluetooth.audio-impl" Revert submission 2955648-revert-2951228-revert-2949647-bt-audio-vintf-YPBVCQSFLC-BREVZAFNCH Reason for revert: b/328267880 Reverted changes: /q/submissionid:2955648-revert-2951228-revert-2949647-bt-audio-vintf-YPBVCQSFLC-BREVZAFNCH Change-Id: I48d10bf7e962bd545809a6969851050d760c0366 --- shared/bluetooth/device_vendor.mk | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/shared/bluetooth/device_vendor.mk b/shared/bluetooth/device_vendor.mk index 60c090adb..451f30063 100644 --- a/shared/bluetooth/device_vendor.mk +++ b/shared/bluetooth/device_vendor.mk @@ -32,6 +32,12 @@ PRODUCT_COPY_FILES += \ PRODUCT_PACKAGES += com.google.cf.bt +# +# Bluetooth Audio AIDL HAL +# +PRODUCT_PACKAGES += \ + android.hardware.bluetooth.audio-impl \ + else # BOARD_HAVE_BLUETOOTH == true PRODUCT_COPY_FILES += \ -- cgit v1.2.3 From daa930be0ce849bd78c53ea2094ca9b3e5a040a2 Mon Sep 17 00:00:00 2001 From: "Jorge E. Moreira" Date: Wed, 28 Feb 2024 15:49:05 -0800 Subject: Protect volatile memory accesses with memory fence Some reads and writes performed by the webrtc library require removing the volatile qualifier from the pointers. A memory fence is used instead to ensure these accesses are visible to the other side by the time the buffers are released. Bug: 327300141 Test: m Change-Id: I5a72152606037678ed73ea37adf18bfc6f27d172 --- host/libs/audio_connector/buffers.cpp | 24 ++++++++++++++++---- host/libs/audio_connector/buffers.h | 39 +++++++++++---------------------- host/libs/audio_connector/server.cpp | 41 +++++++++++++++-------------------- host/libs/audio_connector/server.h | 4 +--- 4 files changed, 51 insertions(+), 57 deletions(-) diff --git a/host/libs/audio_connector/buffers.cpp b/host/libs/audio_connector/buffers.cpp index 29804cadf..100599acd 100644 --- a/host/libs/audio_connector/buffers.cpp +++ b/host/libs/audio_connector/buffers.cpp @@ -19,11 +19,23 @@ namespace cuttlefish { +ShmBuffer::ShmBuffer(const virtio_snd_pcm_xfer& header, + volatile uint8_t* buffer, uint32_t len, + OnConsumedCb on_consumed) + : header_(header), + len_(len), + on_consumed_(on_consumed), + // Cast away the volatile qualifier: No one else will touch this buffer + // until SendStatus is called, at which point a memory fence will be used + // to ensure reads and writes are completed before the status is sent. + buffer_(const_cast(buffer)) {} + ShmBuffer::ShmBuffer(ShmBuffer&& other) : header_(std::move(other.header_)), len_(std::move(other.len_)), on_consumed_(std::move(other.on_consumed_)), - status_sent_(other.status_sent_) { + status_sent_(other.status_sent_.load()), + buffer_(other.buffer_) { // It's now this buffer's responsibility to send the status. other.status_sent_ = true; } @@ -32,12 +44,16 @@ ShmBuffer::~ShmBuffer() { CHECK(status_sent_) << "Disposing of ShmBuffer before setting status"; } -uint32_t ShmBuffer::stream_id() const { return header_.stream_id.as_uint32_t(); } +uint32_t ShmBuffer::stream_id() const { + return header_.stream_id.as_uint32_t(); +} void ShmBuffer::SendStatus(AudioStatus status, uint32_t latency_bytes, - uint32_t consumed_len) { + uint32_t consumed_len) { + // Memory order is seq_cst to provide memory fence. It ensures all accesses + // are completed before the status is sent and the buffer is released. + CHECK(!status_sent_.exchange(true)) << "Status should only be sent once"; on_consumed_(status, latency_bytes, consumed_len); - status_sent_ = true; } } // namespace cuttlefish diff --git a/host/libs/audio_connector/buffers.h b/host/libs/audio_connector/buffers.h index a92fd83f9..5dd589e2c 100644 --- a/host/libs/audio_connector/buffers.h +++ b/host/libs/audio_connector/buffers.h @@ -14,6 +14,7 @@ // limitations under the License. #pragma once +#include #include #include @@ -35,11 +36,11 @@ using OnConsumedCb = std::function status_sent_ = false; - const volatile uint8_t* get() const { return buffer_; } - - private: - const volatile uint8_t* const buffer_; + protected: + uint8_t* buffer_; }; +using TxBuffer = ShmBuffer; +// Only RxBuffer can be written to class RxBuffer : public ShmBuffer { public: RxBuffer(const virtio_snd_pcm_xfer& header, volatile uint8_t* buffer, uint32_t len, OnConsumedCb on_consumed) - : ShmBuffer(header, len, on_consumed), buffer_(buffer) {} - RxBuffer(const RxBuffer& other) = delete; - RxBuffer(RxBuffer&& other) = default; - RxBuffer& operator=(const RxBuffer& other) = delete; + : ShmBuffer(header, buffer, len, on_consumed) {} - volatile uint8_t* get() const { return buffer_; } - - private: - volatile uint8_t* const buffer_; + uint8_t* get() { return buffer_; } }; } // namespace cuttlefish diff --git a/host/libs/audio_connector/server.cpp b/host/libs/audio_connector/server.cpp index ab74daa02..f98621c3b 100644 --- a/host/libs/audio_connector/server.cpp +++ b/host/libs/audio_connector/server.cpp @@ -55,6 +55,13 @@ ScopedMMap AllocateShm(size_t size, const std::string& name, SharedFD* shm_fd) { return mmap_res; } +volatile uint8_t* BufferAt(ScopedMMap& shm, size_t offset, size_t len) { + CHECK(shm.WithinBounds(offset, len)) + << "Tx buffer bounds outside the buffer area: " << offset << " " << len; + void* ptr = shm.get(); + return &reinterpret_cast(ptr)[offset]; +} + bool CreateSocketPair(SharedFD* local, SharedFD* remote) { auto ret = SharedFD::SocketPair(AF_UNIX, SOCK_SEQPACKET, 0, local, remote); if (!ret) { @@ -301,10 +308,11 @@ bool AudioClientConnection::ReceivePlayback(AudioServerExecutor& executor) { LOG(ERROR) << "Received PCM_XFER message is too small: " << recv_size; return false; } - TxBuffer buffer(msg_hdr->io_xfer, - TxBufferAt(msg_hdr->buffer_offset, msg_hdr->buffer_len), - msg_hdr->buffer_len, - SendStatusCallback(msg_hdr->buffer_offset, tx_socket_)); + TxBuffer buffer( + msg_hdr->io_xfer, + BufferAt(tx_shm_, msg_hdr->buffer_offset, msg_hdr->buffer_len), + msg_hdr->buffer_len, + SendStatusCallback(msg_hdr->buffer_offset, tx_socket_)); executor.OnPlaybackBuffer(std::move(buffer)); return true; } @@ -320,10 +328,11 @@ bool AudioClientConnection::ReceiveCapture(AudioServerExecutor& executor) { LOG(ERROR) << "Received PCM_XFER message is too small: " << recv_size; return false; } - RxBuffer buffer(msg_hdr->io_xfer, - RxBufferAt(msg_hdr->buffer_offset, msg_hdr->buffer_len), - msg_hdr->buffer_len, - SendStatusCallback(msg_hdr->buffer_offset, rx_socket_)); + RxBuffer buffer( + msg_hdr->io_xfer, + BufferAt(rx_shm_, msg_hdr->buffer_offset, msg_hdr->buffer_len), + msg_hdr->buffer_len, + SendStatusCallback(msg_hdr->buffer_offset, rx_socket_)); executor.OnCaptureBuffer(std::move(buffer)); return true; } @@ -347,22 +356,6 @@ bool AudioClientConnection::CmdReply(AudioStatus status, const void* data, return true; } -const volatile uint8_t* AudioClientConnection::TxBufferAt(size_t offset, - size_t len) const { - CHECK(tx_shm_.WithinBounds(offset, len)) - << "Tx buffer bounds outside the buffer area: " << offset << " " << len; - const void* ptr = tx_shm_.get(); - return &reinterpret_cast(ptr)[offset]; -} - -volatile uint8_t* AudioClientConnection::RxBufferAt(size_t offset, - size_t len) { - CHECK(rx_shm_.WithinBounds(offset, len)) - << "Rx buffer bounds outside the buffer area: " << offset << " " << len; - void* ptr = rx_shm_.get(); - return &reinterpret_cast(ptr)[offset]; -} - bool AudioClientConnection::SendEvent(/*TODO*/) { return false; } ssize_t AudioClientConnection::ReceiveMsg(SharedFD socket, void* buffer, diff --git a/host/libs/audio_connector/server.h b/host/libs/audio_connector/server.h index 6fa14d936..fec36dcb2 100644 --- a/host/libs/audio_connector/server.h +++ b/host/libs/audio_connector/server.h @@ -87,10 +87,8 @@ class AudioClientConnection { AudioServerExecutor& executor); ssize_t ReceiveMsg(SharedFD socket, void* buffer, size_t size); - const volatile uint8_t* TxBufferAt(size_t offset, size_t len) const; - volatile uint8_t* RxBufferAt(size_t offset, size_t len); - const ScopedMMap tx_shm_; + ScopedMMap tx_shm_; ScopedMMap rx_shm_; SharedFD control_socket_; SharedFD event_socket_; -- cgit v1.2.3 From 5f26f6de8d078f05f3b563fa956a771dea773ca0 Mon Sep 17 00:00:00 2001 From: Myles Watson Date: Tue, 5 Mar 2024 22:06:38 +0000 Subject: Revert "Revert "Do not install android.hardware.bluetooth.audio-..." Revert submission 2989176-revert-2955648-revert-2951228-revert-2949647-bt-audio-vintf-YPBVCQSFLC-BREVZAFNCH-BBSPBQKSDU Reason for revert: b/312265159 Reverted changes: /q/submissionid:2989176-revert-2955648-revert-2951228-revert-2949647-bt-audio-vintf-YPBVCQSFLC-BREVZAFNCH-BBSPBQKSDU Change-Id: I57badce29db0044868dba9aed1708148cf1aebcf --- shared/bluetooth/device_vendor.mk | 6 ------ 1 file changed, 6 deletions(-) diff --git a/shared/bluetooth/device_vendor.mk b/shared/bluetooth/device_vendor.mk index 451f30063..60c090adb 100644 --- a/shared/bluetooth/device_vendor.mk +++ b/shared/bluetooth/device_vendor.mk @@ -32,12 +32,6 @@ PRODUCT_COPY_FILES += \ PRODUCT_PACKAGES += com.google.cf.bt -# -# Bluetooth Audio AIDL HAL -# -PRODUCT_PACKAGES += \ - android.hardware.bluetooth.audio-impl \ - else # BOARD_HAVE_BLUETOOTH == true PRODUCT_COPY_FILES += \ -- cgit v1.2.3 From 69ff43531b03b97efb031e26f812a6c1daa7b5ec Mon Sep 17 00:00:00 2001 From: Octavian Purdila Date: Mon, 4 Mar 2024 14:11:33 -0800 Subject: mcu: substitute ${bin} config entries to Android host binary path The Android host binary path is not added automatically to the the PATH environment variable) in all environments, specifically when running in Android CI. This CL adds support for substituting the ${bin} keyword from the start command string to the current Android host binary path. Bug: 318734012 Change-Id: Ie656b9386ec7ef04014c2613e02dc7331315f4b1 --- host/commands/run_cvd/launch/mcu.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/host/commands/run_cvd/launch/mcu.cpp b/host/commands/run_cvd/launch/mcu.cpp index 96e426e7d..8076abebd 100644 --- a/host/commands/run_cvd/launch/mcu.cpp +++ b/host/commands/run_cvd/launch/mcu.cpp @@ -62,12 +62,14 @@ class Mcu : public vm_manager::VmmDependencyCommand { CF_EXPECT(start.type() == Json::arrayValue, "mcu: config: start-cmd: array expected"); CF_EXPECT(start.size() > 0, "mcu: config: empty start-cmd"); - Command command(start[0].asString()); + Command command(android::base::StringReplace(start[0].asString(), "${bin}", + HostBinaryPath(""), true)); - std::string wdir = "${wdir}"; for (unsigned int i = 1; i < start.size(); i++) { auto param = start[i].asString(); param = android::base::StringReplace(param, "${wdir}", mcu_dir_, true); + param = android::base::StringReplace(param, "${bin}", HostBinaryPath(""), + true); command.AddParameter(param); } -- cgit v1.2.3