From 621461b26e338d29e1ace5ad79668e00f1a2c568 Mon Sep 17 00:00:00 2001 From: Jooyung Han Date: Mon, 11 Dec 2023 13:38:14 +0900 Subject: [PATCH] Clean up sensors hal apex - move apex definition near to the binary - make the binary use static linking (for smaller size of apex) - remove unused keys Bug: n/a Test: cvd start Test: dumpsys sensorservice # available sensors Change-Id: I07734c5a5b1ade542c669155dd96176f912629ac --- sensors/aidl/default/Android.bp | 69 +++++++++++++----- sensors/aidl/default/apex/Android.bp | 41 ----------- .../com.android.hardware.sensors.avbpubkey | Bin 1032 -> 0 bytes .../apex/com.android.hardware.sensors.pem | 51 ------------- .../apex/com.android.hardware.sensors.pk8 | Bin 2375 -> 0 bytes .../com.android.hardware.sensors.x509.pem | 34 --------- .../default/{apex => }/apex_manifest.json | 0 sensors/aidl/default/{apex => }/file_contexts | 0 sensors/aidl/default/sensors-default.rc | 2 +- 9 files changed, 50 insertions(+), 147 deletions(-) delete mode 100644 sensors/aidl/default/apex/Android.bp delete mode 100644 sensors/aidl/default/apex/com.android.hardware.sensors.avbpubkey delete mode 100644 sensors/aidl/default/apex/com.android.hardware.sensors.pem delete mode 100644 sensors/aidl/default/apex/com.android.hardware.sensors.pk8 delete mode 100644 sensors/aidl/default/apex/com.android.hardware.sensors.x509.pem rename sensors/aidl/default/{apex => }/apex_manifest.json (100%) rename sensors/aidl/default/{apex => }/file_contexts (100%) diff --git a/sensors/aidl/default/Android.bp b/sensors/aidl/default/Android.bp index 384ee97f3a..08ee773801 100644 --- a/sensors/aidl/default/Android.bp +++ b/sensors/aidl/default/Android.bp @@ -23,18 +23,6 @@ package { default_applicable_licenses: ["hardware_interfaces_license"], } -filegroup { - name: "sensors-default.rc", - srcs: ["sensors-default.rc"], -} - -prebuilt_etc { - name: "sensors-default.xml", - src: "sensors-default.xml", - sub_dir: "vintf", - installable: false, -} - cc_library_static { name: "libsensorsexampleimpl", vendor: true, @@ -59,21 +47,62 @@ cc_library_static { cc_binary { name: "android.hardware.sensors-service.example", relative_install_path: "hw", - init_rc: [":sensors-default.rc"], - vintf_fragments: [":sensors-default.xml"], + installable: false, // install APEX below + vendor: true, shared_libs: [ - "libbase", "libbinder_ndk", - "libfmq", - "libpower", - "libcutils", "liblog", - "libutils", - "android.hardware.sensors-V2-ndk", ], static_libs: [ + "android.hardware.common-V2-ndk", + "android.hardware.common.fmq-V1-ndk", + "android.hardware.sensors-V2-ndk", + "android.system.suspend-V1-ndk", + "libbase", + "libcutils", + "libfmq", + "libpower", "libsensorsexampleimpl", + "libutils", ], srcs: ["main.cpp"], } + +prebuilt_etc { + name: "sensors-default.rc", + src: "sensors-default.rc", + installable: false, +} + +prebuilt_etc { + name: "sensors-default.xml", + src: "sensors-default.xml", + sub_dir: "vintf", + installable: false, +} + +// Default vendor APEX for android.hardware.sensors. +// Custom implementations may use override_apex based on this APEX. +apex { + name: "com.android.hardware.sensors", + manifest: "apex_manifest.json", + key: "com.android.hardware.key", + certificate: ":com.android.hardware.certificate", + file_contexts: "file_contexts", + updatable: false, + vendor: true, + + binaries: ["android.hardware.sensors-service.example"], + prebuilts: [ + "sensors-default.rc", // init rc + "sensors-default.xml", // vintf fragment + "android.hardware.sensor.ambient_temperature.prebuilt.xml", + "android.hardware.sensor.barometer.prebuilt.xml", + "android.hardware.sensor.gyroscope.prebuilt.xml", + "android.hardware.sensor.hinge_angle.prebuilt.xml", + "android.hardware.sensor.light.prebuilt.xml", + "android.hardware.sensor.proximity.prebuilt.xml", + "android.hardware.sensor.relative_humidity.prebuilt.xml", + ], +} diff --git a/sensors/aidl/default/apex/Android.bp b/sensors/aidl/default/apex/Android.bp deleted file mode 100644 index 54820863d1..0000000000 --- a/sensors/aidl/default/apex/Android.bp +++ /dev/null @@ -1,41 +0,0 @@ -package { - default_applicable_licenses: ["hardware_interfaces_license"], -} - -genrule { - name: "com.android.hardware.sensors.rc-gen", - srcs: [":sensors-default.rc"], - out: ["com.android.hardware.sensors.rc"], - cmd: "sed -E 's/\\/vendor/\\/apex\\/com.android.hardware.sensors/' $(in) > $(out)", -} - -prebuilt_etc { - name: "com.android.hardware.sensors.rc", - src: ":com.android.hardware.sensors.rc-gen", - installable: false, -} - -// Default vendor APEX for android.hardware.sensors. -// Custom implementations may use override_apex based on this APEX. -apex { - name: "com.android.hardware.sensors", - manifest: "apex_manifest.json", - key: "com.android.hardware.key", - certificate: ":com.android.hardware.certificate", - file_contexts: "file_contexts", - updatable: false, - vendor: true, - - binaries: ["android.hardware.sensors-service.example"], - prebuilts: [ - "com.android.hardware.sensors.rc", // init rc - "sensors-default.xml", // vintf fragment - "android.hardware.sensor.ambient_temperature.prebuilt.xml", - "android.hardware.sensor.barometer.prebuilt.xml", - "android.hardware.sensor.gyroscope.prebuilt.xml", - "android.hardware.sensor.hinge_angle.prebuilt.xml", - "android.hardware.sensor.light.prebuilt.xml", - "android.hardware.sensor.proximity.prebuilt.xml", - "android.hardware.sensor.relative_humidity.prebuilt.xml", - ], -} diff --git a/sensors/aidl/default/apex/com.android.hardware.sensors.avbpubkey b/sensors/aidl/default/apex/com.android.hardware.sensors.avbpubkey deleted file mode 100644 index 98dfb71b81f9673617a676222a554c46996c4601..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1032 zcmV+j1o!&@01yCp!~7|&OeOZX*R(!6w* zD|)A+KPxH%LbcpaJUw@BAT{0QJ*(ke!M%sLd`7!in3Wt<13GQJzNsKU|G(1=!}vGI z!emF!RvYR;EwvXON;)4(j#bE5t=|GV*9N1pfdux+nm<_?kk{^>SOq6jX3rn@1*#@x z6rW)2BJeb1#k@@`WM00U0spy8-X^E%m2-hq)*dQ@-)_3pG3`v=k(jTLCuP z-ap=8OklCOSDw%ZX)~p9_vH0u6kDdNXo3zQv1{+`# zK~i29cHqi!TlfUT$4mz;+}D?F^9?cX!nv>{wu<;mMz>J0&0QYBi6i~cBK&@B$%97P z!#T?-2}DdaHN4J)R7c37cuDtgeZ)n}GM%ZUk}3mogJ^r{PoTv18>N~ueQ<==I31sp zx_V_a<&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3tit$t|R1U!UO<)aBqQ<@I*R@@=!-*X}cy z@d;w2#q~f_hHSMMuvZ20Wq)c(5_cGfsB9oRYJ>?j!9p9k$53#~f zD4*qG)A?kGEmXg+m}2Xi{2B@>*Oz7%|h< zDvf9T&s`g7=$!`uaM+d`ystY@Uu{@m%*UM$rN^gA1y_4xuk6n;_?4}Etesyl#r<>0aTRON z5uFNhc4$V6NNQ-SNMP3yal__4x{#~~*c(%+I*nG6>$Vt#t@tj7Tq1Ha{#mw+UySaH z_0lSiE^+kUeseZ`Zl)=NME9OWdzHJ1+A9|;AJia1 z#GqlFWOJSc2vSlXJN%f5lxq~_uex)6Q%_d1Nm4C!5Fo;6u}k;!VuV3p6yZM#Qbslq z`(%rb=LIE(o^jh#h0)hbmSV1Kd1_4vitKHwzP+&+(058j=c5vd@<`s2Whd&&f*677P^R2EM;oV|PxBHCB_JqdhP*;oM;?ElND+AAcL00)hbn0Jg%~YHI5wnVRvq7IqL4J0KDzzU4b7}#rV&lH zrQ5W%GpY;cO}fkfaH+!>ZsaQO9+ZpA^BS27*MM`&3MBwD*p^hL8590|hV-2BHVm6{ zY%aAOW_)9PYKPPHntyd18DqD#0+7Tz_hbLax2l%_{~mN70VOC)DUY`$;oD?U9Od3^yBhF=clH}BV%rz-XF!H5J%I-JTy55PdN6mpUR)Vu|a0;(%-WmCNcnOG;c zU#-ysTT?!0i`Y`6F1^3RQ@8+rD!(8Z^UiCB6mS8iwrz?1dBgw! diff --git a/sensors/aidl/default/apex/com.android.hardware.sensors.x509.pem b/sensors/aidl/default/apex/com.android.hardware.sensors.x509.pem deleted file mode 100644 index 20a06f942e..0000000000 --- a/sensors/aidl/default/apex/com.android.hardware.sensors.x509.pem +++ /dev/null @@ -1,34 +0,0 @@ ------BEGIN CERTIFICATE----- -MIIF3TCCA8UCFAbIl4RS714WSLo4k64MHsINz4VEMA0GCSqGSIb3DQEBCwUAMIGp -MQswCQYDVQQGEwJVUzETMBEGA1UECAwKQ2FsaWZvcm5pYTE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EL63nQsQXO44GiQmqBptuB+ehcAC6uRCKkY9tQ95EQ7laGQ3C85d3gPj -NcGjT7SSuUir7n+LI9pZsotedd9+rGhiiyT8CM4sVWiYJFnA2UX/bsnkZyAOq9Po -jz1aMdHc4wUCAwEAATANBgkqhkiG9w0BAQsFAAOCAgEATEPN2SZk8pJc4DaWmhyR -MUklzVeuN0J0Mij1mHuVmID7Q5IhBBXxtVmwRIo208rHSvFLAo7Z4FnuZCV3A/c9 -TlXT3S2t+iYG5eOyXSsoSc/uerJ7kIBcOe27qIrO9GwcK5CQlTaXP+CG1gbLp1nl -IaqKAT+eb/ji5wmFxMI77wo3uKLPTCfpaptFNaYlRqvxiXdJsCZwCPgmCtXJUeeZ -R/HKOA4PcS2QB+HwhYePY5kUJPwt6MwJEyno72oenfl49FrGHj0BzVmQ7KMfiYjZ -eRSB2Wbo50xfiICkPlUcvWD8rRNg7N9CM/Q5O0MW3ivAe42aGap/8qfXUa+L5vu4 -9vaxgQvBVcPXE/pyeCYM8beB84Us+FOYPC7gIUhcctBqGYAQmHzp3sXvIg0DVxz7 -0aqolFGpjRFqbgheS9WRkDHFpYrhR1XMVOQjussHqWEyRcvliqeFlZr8+JNkJNi+ -lmGMdnEAWZs8PL0/AEf+8y0Nr/w0k3Y6IZCDcwpxbpJQOU5pAbkfUzEJHkxMfuvW -ZshvqIMOaLWCGxZaxlbLRxWGuarWYzfmDY3n9TwJmAIUdMLiswv3UsCmLBJO1XGX -SUWfgi4fyG1/phfzhdU3efMvmN+XT16/ykMrY8P5S+ghwK12IZ3DgTl0ooLFABUj -zYeQ8LLz3SP9LNgeLnPP/po= ------END CERTIFICATE----- diff --git a/sensors/aidl/default/apex/apex_manifest.json b/sensors/aidl/default/apex_manifest.json similarity index 100% rename from sensors/aidl/default/apex/apex_manifest.json rename to sensors/aidl/default/apex_manifest.json diff --git a/sensors/aidl/default/apex/file_contexts b/sensors/aidl/default/file_contexts similarity index 100% rename from sensors/aidl/default/apex/file_contexts rename to sensors/aidl/default/file_contexts diff --git a/sensors/aidl/default/sensors-default.rc b/sensors/aidl/default/sensors-default.rc index 96da85dc29..e0b0ef06d0 100644 --- a/sensors/aidl/default/sensors-default.rc +++ b/sensors/aidl/default/sensors-default.rc @@ -1,4 +1,4 @@ -service vendor.sensors-default /vendor/bin/hw/android.hardware.sensors-service.example +service vendor.sensors-default /apex/com.android.hardware.sensors/bin/hw/android.hardware.sensors-service.example class hal user system group system