Merge changes I6bf48ebd,I9842c1c3,I97815db2,I311b5aee,I68c2b939 into main
* changes:
Add TODO for set_metrics_binary since it is not handled in the code
Cleanup the host_receiver.cc component
Cleanup the metrics.cc file for unnecessary includes
Add initial unit test cases for metrics feature to extend in the future.
Add TODOs for initial code review for metrics feature protos
diff --git a/build/Android.bp b/build/Android.bp
index cc6a3f7..7bb0a25 100644
--- a/build/Android.bp
+++ b/build/Android.bp
@@ -194,7 +194,6 @@
"battery.policy_x86_64",
"block_device.policy_x86_64",
"block_device_vhost_user.policy_x86_64",
- "block_device_vvu.policy_x86_64",
"coiommu_device.policy_x86_64",
"cras_audio_device.policy_x86_64",
"fs_device.policy_x86_64",
@@ -211,7 +210,6 @@
"rng_device.policy_x86_64",
"serial_device.policy_x86_64",
"serial_device_vhost_user.policy_x86_64",
- "serial_device_vvu.policy_x86_64",
"snd_cras_device.policy_x86_64",
"snd_null_device.policy_x86_64",
"swap_monitor.policy_x86_64",
@@ -220,11 +218,9 @@
"vhost_net_device.policy_x86_64",
"vhost_vsock_device.policy_x86_64",
"vhost_vsock_device_vhost_user.policy_x86_64",
- "vhost_vsock_device_vvu.policy_x86_64",
"video_device.policy_x86_64",
"vios_audio_device.policy_x86_64",
"vtpm_proxy_device.policy_x86_64",
- "vvu_proxy_device.policy_x86_64",
"wl_device.policy_x86_64",
"xhci_device.policy_x86_64",
]
diff --git a/common/libs/security/channel.cpp b/common/libs/security/channel.cpp
index e2891aa..18345a7 100644
--- a/common/libs/security/channel.cpp
+++ b/common/libs/security/channel.cpp
@@ -16,15 +16,11 @@
#include "common/libs/security/channel.h"
-#include "keymaster/android_keymaster_utils.h"
-
namespace cuttlefish {
namespace secure_env {
void MessageDestroyer::operator()(RawMessage* ptr) {
- {
- keymaster::Eraser(ptr, sizeof(RawMessage) + ptr->payload_size);
- }
+ std::memset(ptr, 0, sizeof(RawMessage) + ptr->payload_size);
std::free(ptr);
}
diff --git a/guest/hals/health/Android.bp b/guest/hals/health/Android.bp
index e43d605..009f910 100644
--- a/guest/hals/health/Android.bp
+++ b/guest/hals/health/Android.bp
@@ -20,7 +20,6 @@
cc_defaults {
name: "android.hardware.health-service.cuttlefish-defaults",
relative_install_path: "hw",
- vintf_fragments: ["android.hardware.health-service.cuttlefish.xml"],
srcs: [
"health-aidl.cpp",
@@ -32,20 +31,20 @@
],
static_libs: [
- "android.hardware.health-translate-ndk",
+ "android.hardware.health-V2-ndk",
+ "libbase",
"libbatterymonitor",
- "libhealthloop",
+ "libcutils",
"libhealth_aidl_impl",
+ "libhealthloop",
+ "libutils",
],
+ stl: "c++_static",
+
shared_libs: [
- "libbase",
"libbinder_ndk",
- "libcutils",
- "libhidlbase",
"liblog",
- "libutils",
- "android.hardware.health-V2-ndk",
],
}
@@ -53,8 +52,7 @@
name: "android.hardware.health-service.cuttlefish",
defaults: ["android.hardware.health-service.cuttlefish-defaults"],
proprietary: true,
- init_rc: ["android.hardware.health-service.cuttlefish.rc"],
- overrides: ["charger"],
+ installable: false, // installed in APEX
}
cc_binary {
@@ -62,9 +60,40 @@
defaults: ["android.hardware.health-service.cuttlefish-defaults"],
recovery: true,
init_rc: ["android.hardware.health-service.cuttlefish_recovery.rc"],
+ vintf_fragments: ["android.hardware.health-service.cuttlefish.xml"],
overrides: ["charger.recovery"],
}
+prebuilt_etc {
+ name: "android.hardware.health-service.cuttlefish.rc",
+ src: "android.hardware.health-service.cuttlefish.rc",
+ installable: false,
+}
+
+prebuilt_etc {
+ name: "android.hardware.health-service.cuttlefish.xml",
+ src: "android.hardware.health-service.cuttlefish.xml",
+ sub_dir: "vintf",
+ installable: false,
+}
+
+apex {
+ name: "com.google.cf.health",
+ manifest: "apex_manifest.json",
+ file_contexts: "apex_file_contexts",
+ key: "com.google.cf.apex.key",
+ certificate: ":com.google.cf.apex.certificate",
+ updatable: false,
+ vendor: true,
+
+ binaries: ["android.hardware.health-service.cuttlefish"],
+ overrides: ["charger"],
+ prebuilts: [
+ "android.hardware.health-service.cuttlefish.rc",
+ "android.hardware.health-service.cuttlefish.xml",
+ ],
+}
+
// Deprecated. Retained to be used on other devices. It is not installed on cuttlefish.
// TODO(b/210183170): Delete once other devices transition to the AIDL HAL.
cc_library_shared {
diff --git a/guest/hals/health/android.hardware.health-service.cuttlefish.rc b/guest/hals/health/android.hardware.health-service.cuttlefish.rc
index 8c2f153..d9fa74d 100644
--- a/guest/hals/health/android.hardware.health-service.cuttlefish.rc
+++ b/guest/hals/health/android.hardware.health-service.cuttlefish.rc
@@ -1,4 +1,4 @@
-service vendor.health-cuttlefish /vendor/bin/hw/android.hardware.health-service.cuttlefish
+service vendor.health-cuttlefish /apex/com.google.cf.health/bin/hw/android.hardware.health-service.cuttlefish
class hal
user system
group system
diff --git a/guest/hals/health/apex_file_contexts b/guest/hals/health/apex_file_contexts
new file mode 100644
index 0000000..4436e30
--- /dev/null
+++ b/guest/hals/health/apex_file_contexts
@@ -0,0 +1,3 @@
+(/.*)? u:object_r:vendor_file:s0
+/etc(/.*)? u:object_r:vendor_configs_file:s0
+/bin/hw/android\.hardware\.health-service\.cuttlefish u:object_r:hal_health_default_exec:s0
diff --git a/guest/hals/health/apex_manifest.json b/guest/hals/health/apex_manifest.json
new file mode 100644
index 0000000..fd531d5
--- /dev/null
+++ b/guest/hals/health/apex_manifest.json
@@ -0,0 +1,4 @@
+{
+ "name": "com.google.cf.health",
+ "version": 1
+}
diff --git a/guest/hals/health/storage/Android.bp b/guest/hals/health/storage/Android.bp
index 6f26661..352ab26 100644
--- a/guest/hals/health/storage/Android.bp
+++ b/guest/hals/health/storage/Android.bp
@@ -23,10 +23,7 @@
vendor: true,
defaults: ["hidl_defaults"],
relative_install_path: "hw",
- init_rc: ["android.hardware.health.storage-service.cuttlefish.rc"],
- vintf_fragments: [
- "manifest_android.hardware.health.storage.cuttlefish.xml",
- ],
+
srcs: [
"Storage.cpp",
"service.cpp",
@@ -37,10 +34,47 @@
"-Werror",
],
- shared_libs: [
+ static_libs: [
"android.hardware.health.storage-V1-ndk",
"libbase",
- "libbinder_ndk",
"libutils",
],
+
+ stl: "c++_static",
+
+ shared_libs: [
+ "libbinder_ndk",
+ "liblog",
+ ],
+
+ installable: false, // installed in APEX
+}
+
+apex {
+ name: "com.google.cf.health.storage",
+ manifest: "apex_manifest.json",
+ file_contexts: "apex_file_contexts",
+ key: "com.google.cf.apex.key",
+ certificate: ":com.google.cf.apex.certificate",
+ updatable: false,
+ vendor: true,
+
+ binaries: ["android.hardware.health.storage-service.cuttlefish"],
+ prebuilts: [
+ "android.hardware.health.storage-service.cuttlefish.rc",
+ "android.hardware.health.storage-service.cuttlefish.xml",
+ ],
+}
+
+prebuilt_etc {
+ name: "android.hardware.health.storage-service.cuttlefish.rc",
+ src: "android.hardware.health.storage-service.cuttlefish.rc",
+ installable: false,
+}
+
+prebuilt_etc {
+ name: "android.hardware.health.storage-service.cuttlefish.xml",
+ src: "android.hardware.health.storage-service.cuttlefish.xml",
+ sub_dir: "vintf",
+ installable: false,
}
diff --git a/guest/hals/health/storage/android.hardware.health.storage-service.cuttlefish.rc b/guest/hals/health/storage/android.hardware.health.storage-service.cuttlefish.rc
index a94d265..3f22dd4 100644
--- a/guest/hals/health/storage/android.hardware.health.storage-service.cuttlefish.rc
+++ b/guest/hals/health/storage/android.hardware.health.storage-service.cuttlefish.rc
@@ -14,7 +14,7 @@
# limitations under the License.
#
-service vendor.health-storage-default /vendor/bin/hw/android.hardware.health.storage-service.cuttlefish
+service vendor.health-storage-default /apex/com.google.cf.health.storage/bin/hw/android.hardware.health.storage-service.cuttlefish
interface aidl android.hardware.health.storage.IStorage/default
oneshot
disabled
diff --git a/guest/hals/health/storage/manifest_android.hardware.health.storage.cuttlefish.xml b/guest/hals/health/storage/android.hardware.health.storage-service.cuttlefish.xml
similarity index 100%
rename from guest/hals/health/storage/manifest_android.hardware.health.storage.cuttlefish.xml
rename to guest/hals/health/storage/android.hardware.health.storage-service.cuttlefish.xml
diff --git a/guest/hals/health/storage/apex_file_contexts b/guest/hals/health/storage/apex_file_contexts
new file mode 100644
index 0000000..0f66bc0
--- /dev/null
+++ b/guest/hals/health/storage/apex_file_contexts
@@ -0,0 +1,3 @@
+(/.*)? u:object_r:vendor_file:s0
+/etc(/.*)? u:object_r:vendor_configs_file:s0
+/bin/hw/android\.hardware\.health\.storage-service\.cuttlefish u:object_r:hal_health_storage_default_exec:s0
diff --git a/guest/hals/health/storage/apex_manifest.json b/guest/hals/health/storage/apex_manifest.json
new file mode 100644
index 0000000..a4a3796
--- /dev/null
+++ b/guest/hals/health/storage/apex_manifest.json
@@ -0,0 +1,4 @@
+{
+ "name": "com.google.cf.health.storage",
+ "version": 1
+}
diff --git a/guest/hals/oemlock/remote/Android.bp b/guest/hals/oemlock/remote/Android.bp
index 6c2f3b9..73fcb17 100644
--- a/guest/hals/oemlock/remote/Android.bp
+++ b/guest/hals/oemlock/remote/Android.bp
@@ -23,20 +23,54 @@
defaults: ["cuttlefish_guest_only"],
vendor: true,
relative_install_path: "hw",
- init_rc: ["android.hardware.oemlock-service.remote.rc"],
srcs: [
"remote_oemlock.cpp",
"service.cpp",
],
- shared_libs: [
+ static_libs: [
"android.hardware.oemlock-V1-ndk",
"libbase",
- "libbinder_ndk",
"libcuttlefish_fs",
"libcuttlefish_security",
],
- vintf_fragments: ["android.hardware.oemlock-service.remote.xml"],
+ stl: "c++_static",
+
+ shared_libs: [
+ "libbinder_ndk",
+ "liblog",
+ ],
+
+ installable: false, // install in APEX
}
+
+apex {
+ name: "com.google.cf.oemlock",
+ manifest: "apex_manifest.json",
+ file_contexts: "apex_file_contexts",
+ key: "com.google.cf.apex.key",
+ certificate: ":com.google.cf.apex.certificate",
+ updatable: false,
+ vendor: true,
+
+ binaries: ["android.hardware.oemlock-service.remote"],
+ prebuilts: [
+ "android.hardware.oemlock-service.remote.rc",
+ "android.hardware.oemlock-service.remote.xml",
+ ],
+}
+
+prebuilt_etc {
+ name: "android.hardware.oemlock-service.remote.rc",
+ src: "android.hardware.oemlock-service.remote.rc",
+ installable: false,
+}
+
+prebuilt_etc {
+ name: "android.hardware.oemlock-service.remote.xml",
+ src: "android.hardware.oemlock-service.remote.xml",
+ sub_dir: "vintf",
+ installable: false,
+}
\ No newline at end of file
diff --git a/guest/hals/oemlock/remote/android.hardware.oemlock-service.remote.rc b/guest/hals/oemlock/remote/android.hardware.oemlock-service.remote.rc
index 15963aa..91cabbd 100644
--- a/guest/hals/oemlock/remote/android.hardware.oemlock-service.remote.rc
+++ b/guest/hals/oemlock/remote/android.hardware.oemlock-service.remote.rc
@@ -1,4 +1,4 @@
-service vendor.oemlock_default /vendor/bin/hw/android.hardware.oemlock-service.remote /dev/hvc10
+service vendor.oemlock_default /apex/com.google.cf.oemlock/bin/hw/android.hardware.oemlock-service.remote /dev/hvc10
class hal
user hsm
group hsm
diff --git a/guest/hals/oemlock/remote/apex_file_contexts b/guest/hals/oemlock/remote/apex_file_contexts
new file mode 100644
index 0000000..e77307f
--- /dev/null
+++ b/guest/hals/oemlock/remote/apex_file_contexts
@@ -0,0 +1,3 @@
+(/.*)? u:object_r:vendor_file:s0
+/etc(/.*)? u:object_r:vendor_configs_file:s0
+/bin/hw/android\.hardware\.oemlock-service\.remote u:object_r:hal_oemlock_remote_exec:s0
diff --git a/guest/hals/oemlock/remote/apex_manifest.json b/guest/hals/oemlock/remote/apex_manifest.json
new file mode 100644
index 0000000..a5e9821
--- /dev/null
+++ b/guest/hals/oemlock/remote/apex_manifest.json
@@ -0,0 +1,4 @@
+{
+ "name": "com.google.cf.oemlock",
+ "version": 1
+}
diff --git a/shared/device.mk b/shared/device.mk
index ba69fc3..f17d9f0 100644
--- a/shared/device.mk
+++ b/shared/device.mk
@@ -376,7 +376,7 @@
LOCAL_ENABLE_OEMLOCK ?= true
ifeq ($(LOCAL_ENABLE_OEMLOCK),true)
ifeq ($(LOCAL_OEMLOCK_PRODUCT_PACKAGE),)
- LOCAL_OEMLOCK_PRODUCT_PACKAGE := android.hardware.oemlock-service.remote
+ LOCAL_OEMLOCK_PRODUCT_PACKAGE := com.google.cf.oemlock
endif
PRODUCT_PACKAGES += \
$(LOCAL_OEMLOCK_PRODUCT_PACKAGE)
@@ -387,7 +387,7 @@
# Health
ifeq ($(LOCAL_HEALTH_PRODUCT_PACKAGE),)
LOCAL_HEALTH_PRODUCT_PACKAGE := \
- android.hardware.health-service.cuttlefish \
+ com.google.cf.health \
android.hardware.health-service.cuttlefish_recovery \
endif
@@ -395,7 +395,7 @@
# Health Storage
PRODUCT_PACKAGES += \
- android.hardware.health.storage-service.cuttlefish
+ com.google.cf.health.storage
PRODUCT_PACKAGES += \
android.hardware.input.processor-service.example
diff --git a/tests/powerwash/src/com/android/cuttlefish/tests/PowerwashTest.java b/tests/powerwash/src/com/android/cuttlefish/tests/PowerwashTest.java
index 50993da..9730c1a 100644
--- a/tests/powerwash/src/com/android/cuttlefish/tests/PowerwashTest.java
+++ b/tests/powerwash/src/com/android/cuttlefish/tests/PowerwashTest.java
@@ -19,7 +19,6 @@
import com.android.tradefed.config.Option;
import com.android.tradefed.device.DeviceNotAvailableException;
-import com.android.tradefed.device.RemoteAndroidDevice;
import com.android.tradefed.device.cloud.RemoteAndroidVirtualDevice;
import com.android.tradefed.device.internal.DeviceResetHandler;
import com.android.tradefed.log.LogUtil.CLog;
@@ -83,27 +82,13 @@
CLog.d("Powerwash attempt #%d", i);
long start = System.currentTimeMillis();
boolean success = false;
- if (getDevice() instanceof RemoteAndroidVirtualDevice) {
- mCuttlefishHostUser = ((RemoteAndroidVirtualDevice) getDevice()).getInitialUser();
- mCuttlefishDeviceNumOffset = ((RemoteAndroidVirtualDevice) getDevice())
- .getInitialDeviceNumOffset();
- if (mCuttlefishDeviceNumOffset != null && mCuttlefishHostUser != null) {
- success = ((RemoteAndroidVirtualDevice) getDevice())
- .powerwashGce(mCuttlefishHostUser, mCuttlefishDeviceNumOffset)
- .getStatus().equals(CommandStatus.SUCCESS);
- } else {
- success = ((RemoteAndroidVirtualDevice) getDevice())
- .powerwash().getStatus().equals(CommandStatus.SUCCESS);
- }
- } else {
- // We don't usually expect tests to use our feature server, but in this case we are
- // validating the feature itself so it's fine
- DeviceResetHandler handler = new DeviceResetHandler(getInvocationContext());
- try {
- success = handler.resetDevice(getDevice());
- } catch (DeviceNotAvailableException e) {
- CLog.e(e);
- }
+ // We don't usually expect tests to use our feature server, but in this case we are
+ // validating the feature itself so it's fine
+ DeviceResetHandler handler = new DeviceResetHandler(getInvocationContext());
+ try {
+ success = handler.resetDevice(getDevice());
+ } catch (DeviceNotAvailableException e) {
+ CLog.e(e);
}
assertTrue(String.format("Powerwash reset failed during attemt #%d", i), success);
long duration = System.currentTimeMillis() - start;