move brcm gps solution to gs-common

Bug: 254758553
Test: google map can locate on pixel
Change-Id: I466a7d3a45f37a7de5aaed55c2df7f06ba97268d
This commit is contained in:
Adam Shih 2022-10-21 12:06:36 +08:00
parent b23da02382
commit 82e09f8597
18 changed files with 7370 additions and 0 deletions

215
gps/brcm/Android.bp Normal file
View File

@ -0,0 +1,215 @@
// Copyright (C) 2020 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.
cc_prebuilt_library_shared {
name: "android.hardware.gnss@2.1-impl-google",
arch: {
arm64: {
srcs: ["bin/android.hardware.gnss@2.1-impl-google.so"],
shared_libs: [
"liblog",
"libhidlbase",
// "libhidltransport",
"libutils",
"android.hardware.gnss@1.0",
"android.hardware.gnss@1.1",
"android.hardware.gnss@2.0",
"android.hardware.gnss@2.1",
"android.hardware.gnss.measurement_corrections@1.0",
"android.hardware.gnss.visibility_control@1.0",
"android.hardware.gnss-V2-ndk",
"libhardware",
"libc++",
"libc",
"libm",
"libdl",
],
},
},
compile_multilib: "64",
vendor: true,
relative_install_path: "hw",
strip: {
none: true,
},
// Bypass because libhidltransport is deprecated
check_elf_files: false,
}
cc_prebuilt_binary {
name: "android.hardware.gnss@2.1-service-brcm",
arch: {
arm64: {
srcs: ["bin/android.hardware.gnss@2.1-service-brcm"],
shared_libs: [
"liblog",
"libutils",
"libhardware",
"android.hardware.gnss@1.0",
"libhidlbase",
"android.hardware.gnss@1.1",
"android.hardware.gnss@2.0",
"android.hardware.gnss@2.1",
"android.hardware.gnss-V2-ndk",
"libc++",
"libc",
"libm",
"libdl",
],
},
},
compile_multilib: "64",
vendor: true,
relative_install_path: "hw",
strip: {
none: true,
},
// Bypass because libhidltransport is deprecated
// Bypass because libhwbinder is deprecated
check_elf_files: false,
vintf_fragments: ["android.hardware.gnss@2.1-service-brcm.xml"]
}
cc_prebuilt_library_shared {
name: "flp.default",
arch: {
arm64: {
srcs: ["bin/flp.default.so"],
shared_libs: [
"liblog",
"libcutils",
"libutils",
"libc++",
"libc",
"libm",
"libdl",
],
},
},
compile_multilib: "64",
vendor: true,
relative_install_path: "hw",
strip: {
none: true,
},
// Bypass because soname mismatch
check_elf_files: false,
}
cc_prebuilt_binary {
name: "gpsd",
arch: {
arm64: {
srcs: ["bin/gpsd"],
shared_libs: [
"liblog",
"libutils",
"libhardware_legacy",
"libcutils",
"libssl",
"libcrypto",
"android.frameworks.sensorservice@1.0",
"libhidlbase",
"libandroid_net",
"libc++",
"libc",
"libm",
"libdl",
],
},
},
compile_multilib: "64",
vendor: true,
relative_install_path: "hw",
strip: {
none: true,
},
// Bypass because libsitril-gps is Android.mk module
check_elf_files: false,
}
cc_prebuilt_library_shared {
name: "gps.default",
arch: {
arm64: {
srcs: ["bin/gps.default.so"],
shared_libs: [
"liblog",
"libcutils",
"libutils",
"libc++",
"libc",
"libm",
"libdl",
],
},
},
compile_multilib: "64",
vendor: true,
relative_install_path: "hw",
strip: {
none: true,
},
// Bypass because soname mismatch
check_elf_files: false,
}
cc_prebuilt_binary {
name: "lhd",
arch: {
arm64: {
srcs: ["bin/lhd"],
shared_libs: [
"liblog",
"libutils",
"libhardware_legacy",
"libc++",
"libc",
"libm",
"libz",
"android.hardware.contexthub@1.0",
"libhidlbase",
"libdl",
],
},
},
compile_multilib: "64",
vendor: true,
relative_install_path: "hw",
strip: {
none: true,
},
}
cc_prebuilt_binary {
name: "scd",
arch: {
arm64: {
srcs: ["bin/scd"],
shared_libs: [
"liblog",
"libutils",
"libssl",
"libcrypto",
"libandroid_net",
],
},
},
compile_multilib: "64",
vendor: true,
relative_install_path: "hw",
strip: {
none: true,
},
}

View File

@ -0,0 +1,7 @@
<manifest version="1.0" type="device">
<hal format="aidl">
<name>android.hardware.gnss</name>
<version>2</version>
<fqname>IGnss/default</fqname>
</hal>
</manifest>

Binary file not shown.

Binary file not shown.

BIN
gps/brcm/bin/flp.default.so Executable file

Binary file not shown.

BIN
gps/brcm/bin/gps.default.so Executable file

Binary file not shown.

BIN
gps/brcm/bin/gpsd Executable file

Binary file not shown.

BIN
gps/brcm/bin/lhd Executable file

Binary file not shown.

BIN
gps/brcm/bin/scd Executable file

Binary file not shown.

16
gps/brcm/device.mk Normal file
View File

@ -0,0 +1,16 @@
BOARD_VENDOR_SEPOLICY_DIRS += device/google/gs-common/gps/brcm/sepolicy
PRODUCT_COPY_FILES += \
device/google/gs-common/gps/brcm/firmware/SensorHub.patch:$(TARGET_COPY_OUT_VENDOR)/firmware/SensorHub.patch
PRODUCT_PACKAGES += \
android.hardware.gnss@2.1-impl-google \
gps.default \
flp.default \
gpsd \
lhd \
scd \
android.hardware.gnss@2.1-service-brcm \
android.hardware.location.gps.prebuilt.xml
PRODUCT_PACKAGES_DEBUG += \
init.gps_log.rc

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,2 @@
type sysfs_gps, sysfs_type, fs_type;
type sysfs_gps_assert, sysfs_type, fs_type;

View File

@ -0,0 +1,12 @@
# gnss/gps data/log files
/data/vendor/gps(/.*)? u:object_r:vendor_gps_file:s0
# devices
/dev/bbd_control u:object_r:vendor_gnss_device:s0
/dev/ttyBCM u:object_r:vendor_gnss_device:s0
# vendor binaries
/vendor/bin/hw/scd u:object_r:scd_exec:s0
/vendor/bin/hw/lhd u:object_r:lhd_exec:s0
/vendor/bin/hw/gpsd u:object_r:gpsd_exec:s0
/vendor/bin/hw/android\.hardware\.gnss@[0-9]\.[0-9]-service-brcm u:object_r:hal_gnss_default_exec:s0

View File

@ -0,0 +1,4 @@
# GPS
genfscon sysfs /devices/platform/10940000.spi/spi_master/spi5/spi5.0/nstandby u:object_r:sysfs_gps:s0
genfscon sysfs /devices/virtual/pps/pps0/assert_elapsed u:object_r:sysfs_gps_assert:s0

20
gps/brcm/sepolicy/gpsd.te Normal file
View File

@ -0,0 +1,20 @@
init_daemon_domain(gpsd)
# Allow gpsd to obtain wakelock
wakelock_use(gpsd)
# Allow gpsd access data vendor gps files
allow gpsd vendor_gps_file:dir create_dir_perms;
allow gpsd vendor_gps_file:file create_file_perms;
allow gpsd vendor_gps_file:fifo_file create_file_perms;
# Allow gpsd to access rild
binder_call(gpsd, rild);
allow gpsd hal_exynos_rild_hwservice:hwservice_manager find;
# Allow gpsd to access sensor service
binder_call(gpsd, system_server);
allow gpsd fwk_sensor_hwservice:hwservice_manager find;
# Allow gpsd to access pps gpio
allow gpsd sysfs_gps_assert:file r_file_perms;

View File

@ -0,0 +1,4 @@
# Allow hal_gnss_default access data vendor gps files
allow hal_gnss_default vendor_gps_file:dir create_dir_perms;
allow hal_gnss_default vendor_gps_file:file create_file_perms;
allow hal_gnss_default vendor_gps_file:fifo_file create_file_perms;

23
gps/brcm/sepolicy/lhd.te Normal file
View File

@ -0,0 +1,23 @@
type lhd, domain;
type lhd_exec, vendor_file_type, exec_type, file_type;
init_daemon_domain(lhd)
# Allow lhd access PixelLogger unix socket in debug build only
userdebug_or_eng(`
typeattribute lhd mlstrustedsubject;
allow lhd logger_app:unix_stream_socket connectto;
')
# Allow lhd access data vendor gps files
allow lhd vendor_gps_file:dir create_dir_perms;
allow lhd vendor_gps_file:file create_file_perms;
allow lhd vendor_gps_file:fifo_file create_file_perms;
# Allow lhd to obtain wakelock
wakelock_use(lhd)
# Allow lhd access /dev/bbd_control file
allow lhd vendor_gnss_device:chr_file rw_file_perms;
# Allow lhd access nstandby gpio
allow lhd sysfs_gps:file rw_file_perms;

17
gps/brcm/sepolicy/scd.te Normal file
View File

@ -0,0 +1,17 @@
type scd, domain;
type scd_exec, vendor_file_type, exec_type, file_type;
init_daemon_domain(scd)
# Allow scd access PixelLogger unix socket in debug build only
userdebug_or_eng(`
typeattribute scd mlstrustedsubject;
allow scd logger_app:unix_stream_socket connectto;
')
# Allow a base set of permissions required for network access.
net_domain(scd);
# Allow scd access data vendor gps files
allow scd vendor_gps_file:dir create_dir_perms;
allow scd vendor_gps_file:file create_file_perms;
allow scd vendor_gps_file:fifo_file create_file_perms;