Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sunfish: Build LiveDisplay 2.0 HAL #1

Open
wants to merge 17 commits into
base: eleven
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions AndroidProducts.mk
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
#

PRODUCT_MAKEFILES := \
$(LOCAL_DIR)/superior_sunfish.mk
$(LOCAL_DIR)/descendant_sunfish.mk

#COMMON_LUNCH_CHOICES := \
superior_sunfish-userdebug
descendant_sunfish-userdebug \
descendant_sunfish-user

8 changes: 5 additions & 3 deletions BoardConfig-common.mk
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,11 @@ BOARD_KERNEL_PAGESIZE := 4096
BOARD_KERNEL_TAGS_OFFSET := 0x01E00000
BOARD_RAMDISK_OFFSET := 0x02000000

TARGET_KERNEL_CROSS_COMPILE_PREFIX := aarch64-linux-android-
TARGET_KERNEL_CLANG_COMPILE := true
TARGET_KERNEL_SOURCE := kernel/google/sunfish
TARGET_KERNEL_CONFIG := sunfish_defconfig
BOARD_KERNEL_IMAGE_NAME := Image.lz4
TARGET_KERNEL_CROSS_COMPILE_PREFIX := aarch64-linux-gnu-
TARGET_KERNEL_CLANG_VERSION := proton
KERNEL_TOOLCHAIN := $(shell pwd)/prebuilts/clang/host/linux-x86/clang-proton/bin

BOARD_INCLUDE_DTB_IN_BOOTIMG := true
BOARD_BOOT_HEADER_VERSION := 2
Expand Down Expand Up @@ -216,6 +214,10 @@ TARGET_USES_DISPLAY_RENDER_INTENTS := true
TARGET_USES_COLOR_METADATA := true
TARGET_USES_DRM_PP := true

# SELinux
BOARD_SEPOLICY_DIRS += device/google/sunfish/sepolicy-descendant/dynamic
BOARD_SEPOLICY_DIRS += device/google/sunfish/sepolicy-descendant/vendor

# Vendor Interface Manifest
DEVICE_MANIFEST_FILE := device/google/sunfish/manifest.xml
DEVICE_MATRIX_FILE := device/google/sunfish/compatibility_matrix.xml
Expand Down
5 changes: 4 additions & 1 deletion component-overrides.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,7 @@
<component-override package="com.android.bluetooth" >
<component class=".sap.SapService" enabled="true" />
</component-override>
</config>
<component-override package="com.google.android.apps.tips" >
<component class=".TipsMain" enabled="true" />
</component-override>
</config>
3 changes: 0 additions & 3 deletions default-permissions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,6 @@
</exception>

<exception package="com.google.android.apps.scone">
<!-- NLP Location access to determine proximity to country border -->
<permission name="android.permission.ACCESS_COARSE_LOCATION" fixed="false"/>
<permission name="android.permission.ACCESS_BACKGROUND_LOCATION" fixed="false"/>
<!-- Used to call ActivityTransition API for Smart OOS & Smart PNO -->
<permission name="android.permission.ACTIVITY_RECOGNITION" fixed="false"/>
</exception>
Expand Down
32 changes: 32 additions & 0 deletions descendant.dependencies
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
[
{
"remote": "github",
"repository": "Descendant-Devices/android_device_google_sunfish",
"target_path": "device/google/sunfish",
"branch": "eleven"
},
{
"remote": "github",
"repository": "DirtyUnicorns/android_vendor_google",
"target_path": "vendor/google",
"branch": "r11x"
},
{
"remote": "github",
"repository": "DirtyUnicorns/android_device_google_sunfish-sepolicy",
"target_path": "device/google/sunfish-sepolicy",
"branch": "r11x"
}
{
"remote": "github",
"repository": "DirtyUnicorns/android_kernel_google_sunfish",
"target_path": "kernel/google/sunfish",
"branch": "r11x"
}
{
"remote": "github",
"repository": "koen01/android_bootable_recovery",
"target_path": "bootable/recovery",
"branch": "eleven"
}
]
20 changes: 14 additions & 6 deletions superior_sunfish.mk → descendant_sunfish.mk
Original file line number Diff line number Diff line change
Expand Up @@ -22,31 +22,39 @@
#

# Include Superior common configuration
include vendor/superior/config/common.mk
$(call inherit-product, vendor/descendant/config/common_full_phone.mk)

# Inherit from those products. Most specific first.
$(call inherit-product, device/google/sunfish/aosp_sunfish.mk)

# Boot amimation
TARGET_BOOT_ANIMATION_RES := 1080

# Descendant
TARGET_SUPPORTS_BLUR := true
TARGET_FACE_UNLOCK_SUPPORTED := true

# Inherit from the common Open Source product configuration
$(call inherit-product, $(SRC_TARGET_DIR)/product/aosp_base_telephony.mk)
$(call inherit-product, $(SRC_TARGET_DIR)/product/core_64_bit.mk)

PRODUCT_NAME := superior_sunfish
PRODUCT_NAME := descendant_sunfish
PRODUCT_DEVICE := sunfish
PRODUCT_BRAND := google
PRODUCT_MODEL := Pixel 4a

PRODUCT_BUILD_PROP_OVERRIDES += \
PRODUCT_NAME="sunfish" \
PRIVATE_BUILD_DESC="sunfish-user 11 RQ1A.210105.002 6985033 release-keys"
PRIVATE_BUILD_DESC="sunfish-user 11 RQ2A.210505.002 7246365 release-keys"

BUILD_FINGERPRINT := "google/sunfish/sunfish:11/RQ1A.210105.002/6985033:user/release-keys"
BUILD_FINGERPRINT := "google/sunfish/sunfish:11/RQ2A.210505.002/7246365:user/release-keys"

PRODUCT_PROPERTY_OVERRIDES += \
ro.build.fingerprint=google/sunfish/sunfish:11/RQ1A.210105.002/6985033:user/release-keys
ro.build.fingerprint=google/sunfish/sunfish:11/RQ2A.210505.002/7246365:user/release-keys

$(call inherit-product-if-exists, vendor/google/sunfish/sunfish-vendor.mk)
$(call inherit-product-if-exists, vendor/pixelgapps/pixel-gapps.mk)
#$(call inherit-product-if-exists, vendor/gapps/pixel-gapps.mk)

# Clearwater vendor for my own extras
#$(call inherit-product-if-exists, vendor/clearwater/clearwater.mk)

14 changes: 7 additions & 7 deletions device.mk
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,12 @@ else
$(LOCAL_PATH)/init.hardware.mpssrfs.rc.user:$(TARGET_COPY_OUT_VENDOR)/etc/init/hw/init.$(PRODUCT_PLATFORM).mpssrfs.rc
endif

# Enable DIAG issue debug
ifneq (,$(filter userdebug eng, $(TARGET_BUILD_VARIANT)))
PRODUCT_COPY_FILES += \
$(LOCAL_PATH)/init.diagdebug.rc.userdebug:$(TARGET_COPY_OUT_VENDOR)/etc/init/init.diagdebug.rc
endif

# A/B support
PRODUCT_PACKAGES += \
otapreopt_script \
Expand Down Expand Up @@ -875,13 +881,7 @@ PRODUCT_PACKAGES += $(HIDL_WRAPPER)

# Increment the SVN for any official public releases
PRODUCT_PROPERTY_OVERRIDES += \
ro.vendor.build.svn=17

# ZRAM writeback
PRODUCT_PROPERTY_OVERRIDES += \
ro.zram.mark_idle_delay_mins=60 \
ro.zram.first_wb_delay_mins=180 \
ro.zram.periodic_wb_delay_hours=24
ro.vendor.build.svn=22

PRODUCT_COPY_FILES += \
$(LOCAL_PATH)/powerhint.json:$(TARGET_COPY_OUT_VENDOR)/etc/powerhint.json
Expand Down
15 changes: 14 additions & 1 deletion device_framework_matrix.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,19 @@
<instance>com.qualcomm.qti.uceservice</instance>
</interface>
</hal>
<hal format="hidl" optional="true">
<name>vendor.lineage.livedisplay</name>
<transport>hwbinder</transport>
<version>2.0</version>
<interface>
<name>IPictureAdjustment</name>
<instance>default</instance>
</interface>
<interface>
<name>IAdaptiveBacklight</name>
<instance>default</instance>
</interface>
</hal>
<hal format="hidl">
<name>vendor.qti.data.factory</name>
<transport>hwbinder</transport>
Expand Down Expand Up @@ -65,7 +78,7 @@
</hal>
<hal format="hidl" optional="true">
<name>vendor.google.google_battery</name>
<version>1.0</version>
<version>1.1</version>
<interface>
<name>IGoogleBattery</name>
<instance>default</instance>
Expand Down
3 changes: 3 additions & 0 deletions dumpstate/DumpstateDevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -573,6 +573,9 @@ Return<DumpstateStatus> DumpstateDevice::dumpstateBoard_1_1(const hidl_handle& h
DumpFileToFd(fd, "TCPM logs", "/d/tcpm/usbpd0");
DumpFileToFd(fd, "PD Engine", "/d/logbuffer/usbpd");
DumpFileToFd(fd, "ipc-local-ports", "/d/msm_ipc_router/dump_local_ports");
RunCommandToFd(fd, "TRICKLE-DEFEND Config", {"/vendor/bin/sh", "-c", " cd /sys/devices/platform/soc/soc:google,battery/power_supply/battery/; echo \"bd_trickle_enable: `cat bd_trickle_enable`\"; echo \"bd_trickle_cnt: `cat bd_trickle_cnt`\"; echo \"bd_trickle_recharge_soc: `cat bd_trickle_recharge_soc`\"; echo \"bd_trickle_dry_run: `cat bd_trickle_dry_run`\"; echo \"bd_trickle_reset_sec: `cat bd_trickle_reset_sec`\""});
RunCommandToFd(fd, "DWELL-DEFEND Config", {"/vendor/bin/sh", "-c", " cd /sys/devices/platform/soc/soc:google,charger/; for f in `ls charge_s*` ; do echo \"$f: `cat $f`\" ; done"});
RunCommandToFd(fd, "TEMP-DEFEND Config", {"/vendor/bin/sh", "-c", " cd /sys/devices/platform/soc/soc:google,charger/; for f in `ls bd_*` ; do echo \"$f: `cat $f`\" ; done"});
RunCommandToFd(fd, "USB Device Descriptors", {"/vendor/bin/sh", "-c", "cd /sys/bus/usb/devices/1-1 && cat product && cat bcdDevice; cat descriptors | od -t x1 -w16 -N96"});
RunCommandToFd(fd, "Power supply properties", {"/vendor/bin/sh", "-c", "for f in `ls /sys/class/power_supply/*/uevent` ; do echo \"------ $f\\n`cat $f`\\n\" ; done"});
RunCommandToFd(fd, "PMIC Votables", {"/vendor/bin/sh", "-c", "cat /sys/kernel/debug/pmic-votable/*/status"});
Expand Down
13 changes: 10 additions & 3 deletions gpt-utils/gpt-utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -156,11 +156,18 @@ static int blk_rw(int fd, int rw, int64_t offset, uint8_t *buf, unsigned len)
else
r = read(fd, buf, len);

if (r < 0)
if (r < 0) {
fprintf(stderr, "block dev %s failed: %s\n", rw ? "write" : "read",
strerror(errno));
else
r = 0;
} else {
if (rw) {
r = fsync(fd);
if (r < 0)
fprintf(stderr, "fsync failed: %s\n", strerror(errno));
} else {
r = 0;
}
}

return r;
}
Expand Down
3 changes: 1 addition & 2 deletions health/Health.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,14 +103,13 @@ void fill_ufs_storage_attribute(StorageAttribute *attr) {

void private_healthd_board_init(struct healthd_config *hc) {
hc->ignorePowerSupplyNames.push_back(android::String8(kTCPMPSYName));
battDefender.update();
}

int private_healthd_board_battery_update(struct android::BatteryProperties *props) {
deviceHealth.update(props);
battMetricsLogger.logBatteryProperties(props);
shutdownMetrics.logShutdownVoltage(props);
battDefender.update();
battDefender.update(props);
return 0;
}

Expand Down
20 changes: 20 additions & 0 deletions init.diagdebug.rc.userdebug
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#
# 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.
#

# Trigger ramdump when property on
on property:vendor.radio.diag_debug=true
write /dev/kmsg "RIL Diag Issue Detected!"
write /proc/sysrq-trigger "c"
22 changes: 22 additions & 0 deletions init.hardware.rc
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,23 @@ on init && property:vendor.skip.init=0
# Battery Defender
chown system system /sys/devices/platform/soc/soc:google,charger/charge_stop_level
chown system system /sys/devices/platform/soc/soc:google,charger/charge_start_level
chown system system /sys/devices/platform/soc/soc:google,charger/bd_drainto_soc
chown system system /sys/devices/platform/soc/soc:google,charger/bd_recharge_soc
chown system system /sys/devices/platform/soc/soc:google,charger/bd_recharge_voltage
chown system system /sys/devices/platform/soc/soc:google,charger/bd_resume_abs_temp
chown system system /sys/devices/platform/soc/soc:google,charger/bd_resume_soc
chown system system /sys/devices/platform/soc/soc:google,charger/bd_resume_temp
chown system system /sys/devices/platform/soc/soc:google,charger/bd_resume_time
chown system system /sys/devices/platform/soc/soc:google,charger/bd_trigger_temp
chown system system /sys/devices/platform/soc/soc:google,charger/bd_trigger_time
chown system system /sys/devices/platform/soc/soc:google,charger/bd_trigger_voltage
chown system system /sys/devices/platform/soc/soc:google,charger/bd_temp_enable
chown system system /sys/devices/platform/soc/soc:google,charger/bd_temp_dry_run
chown system system /sys/devices/platform/soc/soc:google,battery/power_supply/battery/bd_trickle_enable
chown system system /sys/devices/platform/soc/soc:google,battery/power_supply/battery/bd_trickle_recharge_soc
chown system system /sys/devices/platform/soc/soc:google,battery/power_supply/battery/bd_trickle_cnt
chown system system /sys/devices/platform/soc/soc:google,battery/power_supply/battery/bd_trickle_dry_run
chown system system /sys/devices/platform/soc/soc:google,battery/power_supply/battery/bd_trickle_reset_sec

# Charge stats (write 0)
chown system system /sys/class/power_supply/battery/charge_stats
Expand All @@ -129,6 +146,9 @@ on init && property:vendor.skip.init=0
write /proc/sys/kernel/sched_lib_name "UnityMain,libunity.so"
write /proc/sys/kernel/sched_lib_mask_force 255

# Nfc streset tool name
setprop persist.vendor.nfc.streset libstreset

on late-init
chown system system /sys/devices/virtual/thermal/tz-by-name/skin-therm-monitor/trip_point_0_temp
chown system system /sys/devices/virtual/thermal/tz-by-name/skin-therm-monitor/trip_point_0_hyst
Expand Down Expand Up @@ -387,6 +407,8 @@ on early-boot
# Permission for battery eeprom
chown system system /sys/devices/platform/soc/a8c000.i2c/i2c-2/2-0050/2-00500/nvmem
chmod 0640 /sys/devices/platform/soc/a8c000.i2c/i2c-2/2-0050/2-00500/nvmem
chown system system /dev/battery_history
chmod 0644 /dev/battery_history

# Permission for Pixelstats
chown system system /sys/class/misc/msm_cirrus_playback/resistance_left_right
Expand Down
12 changes: 11 additions & 1 deletion manifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
<hal format="hidl">
<name>vendor.google.google_battery</name>
<transport>hwbinder</transport>
<version>1.0</version>
<version>1.1</version>
<interface>
<name>IGoogleBattery</name>
<instance>default</instance>
Expand Down Expand Up @@ -281,6 +281,16 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
<fqname>@1.1::IGnss/default</fqname>
<fqname>@2.0::IGnss/default</fqname>
</hal>
<!-- livedisplay -->
<hal format="hidl">
<name>vendor.lineage.livedisplay</name>
<transport>hwbinder</transport>
<version>2.0</version>
<interface>
<name>IPictureAdjustment</name>
<instance>default</instance>
</interface>
</hal>
<!-- qcrilhook -->
<hal format="hidl">
<name>vendor.qti.hardware.radio.qcrilhook</name>
Expand Down
1 change: 1 addition & 0 deletions pixelstats/service.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ const struct SysfsCollector::SysfsPaths sysfs_paths = {
.UFSLifetimeB = UFSHC_PATH(health/lifetimeB),
.UFSLifetimeC = UFSHC_PATH(health/lifetimeC),
.F2fsStatsPath = "/sys/fs/f2fs/",
.EEPROMPath = "/dev/battery_history",
};

const char *const kAudioUevent = "/kernel/q6audio/q6voice_uevent";
Expand Down
1 change: 0 additions & 1 deletion product.prop
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ persist.timed.enable=true

# system props for perfetto
persist.traced.enable=1
persist.heapprofd.enable=1

# System prop to turn on CdmaLTEPhone always
telephony.lteOnCdmaDevice=1
Expand Down
10 changes: 10 additions & 0 deletions sepolicy-descendant/dynamic/hal_lineage_livedisplay_qti.te
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Do not use add_service() as hal_graphics_composer_default may be the provider as well
allow hal_lineage_livedisplay_qti qdisplay_service:service_manager find;

binder_call(hal_lineage_livedisplay_qti, hal_graphics_composer_default)

# Allow LiveDisplay to access vendor display property
get_prop(hal_lineage_livedisplay_qti, vendor_display_prop)

allow hal_lineage_livedisplay_qti pps_socket:sock_file rw_file_perms;
allow hal_lineage_livedisplay_qti hal_graphics_composer_default:unix_stream_socket { connectto };
2 changes: 2 additions & 0 deletions sepolicy-descendant/vendor/file_contexts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# LiveDisplay HAL
/(vendor|system/vendor)/bin/hw/vendor\.lineage\.livedisplay@2\.0-service-sdm u:object_r:hal_lineage_livedisplay_qti_exec:s0
12 changes: 12 additions & 0 deletions sepolicy-descendant/vendor/hal_lineage_livedisplay.te
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
type hal_lineage_livedisplay_qti, domain;
hal_server_domain(hal_lineage_livedisplay_qti, hal_lineage_livedisplay)

type hal_lineage_livedisplay_qti_exec, exec_type, vendor_file_type, file_type;
init_daemon_domain(hal_lineage_livedisplay_qti)

# Allow LiveDisplay HAL's default implementation to use vendor-binder service
vndbinder_use(hal_lineage_livedisplay_qti)

# Allow LiveDisplay to store files under /data/vendor/display and access them
allow hal_lineage_livedisplay_qti display_vendor_data_file:dir rw_dir_perms;
allow hal_lineage_livedisplay_qti display_vendor_data_file:file create_file_perms;
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,4 @@

<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">

<!-- Height of area above QQS where battery/time go (equal to status bar) -->
<dimen name="quick_qs_offset_height">28dp</dimen>
<!-- Total height of QQS (quick_qs_offset_height + 128) -->
<dimen name="quick_qs_total_height">156dp</dimen>

</resources>
Original file line number Diff line number Diff line change
Expand Up @@ -196,11 +196,7 @@

<!-- Height of the status bar in portrait. The height should be
Max((status bar content height + waterfall top size), top cutout size) -->
<dimen name="status_bar_height_portrait">136px</dimen>
<dimen name="status_bar_height_portrait">141px</dimen>
<dimen name="status_bar_height_landscape">28dp</dimen>
<!-- Height of area above QQS where battery/time go (equal to status bar) -->
<dimen name="quick_qs_offset_height">136px</dimen>
<!-- Total height of QQS (quick_qs_offset_height + 128) -->
<dimen name="quick_qs_total_height">488px</dimen>

</resources>
Loading