diff options
| author | Hashbang173 <hashbang173@gmail.com> | 2018-04-07 11:54:16 -0400 |
|---|---|---|
| committer | Hashbang173 <hashbang173@gmail.com> | 2018-04-07 11:54:16 -0400 |
| commit | 695e1bd83a89a08ab966bc465ebfdea428e5425f (patch) | |
| tree | 72fca51d55a3969969c0a390640043809f7b4ab9 | |
| parent | 43613d803aa70bae6848e862c1969c959ab007cc (diff) | |
| parent | 7d6fa12bc7b48bf5cbb30846659eb3cee33a0cf8 (diff) | |
Change-Id: Ia1c37971b7ab91220b418ef72599aaabc76f5f8b
31 files changed, 522 insertions, 383 deletions
diff --git a/Android.bp b/Android.bp new file mode 100644 index 0000000..c3ac2c1 --- /dev/null +++ b/Android.bp @@ -0,0 +1,4 @@ +subdirs = [ + "light", + "usb", +] diff --git a/AndroidProducts.mk b/AndroidProducts.mk index b58d0a7..69a9405 100644 --- a/AndroidProducts.mk +++ b/AndroidProducts.mk @@ -15,7 +15,4 @@ # PRODUCT_MAKEFILES := \ - $(LOCAL_DIR)/aosp_flounder.mk \ - $(LOCAL_DIR)/aosp_flounder64.mk \ - $(LOCAL_DIR)/aosp_flounder32.mk \ - $(LOCAL_DIR)/aosp_flounder_64_only.mk + $(LOCAL_DIR)/aosp_flounder.mk diff --git a/BoardConfig.mk b/BoardConfig.mk index bf84804..00cedae 100644 --- a/BoardConfig.mk +++ b/BoardConfig.mk @@ -48,12 +48,15 @@ USE_OPENGL_RENDERER := true NUM_FRAMEBUFFER_SURFACE_BUFFERS := 2 BOARD_DISABLE_TRIPLE_BUFFERED_DISPLAY_SURFACES := true -TARGET_RECOVERY_FSTAB := device/htc/flounder/fstab.full +TARGET_RECOVERY_FSTAB := device/htc/flounder/fstab.flounder TARGET_RECOVERY_PIXEL_FORMAT := RGBX_8888 TARGET_USERIMAGES_USE_EXT4 := true +TARGET_USERIMAGES_USE_F2FS := true + BOARD_SYSTEMIMAGE_PARTITION_SIZE := 2782920704 # BOARD_USERDATAIMAGE_PARTITION_SIZE := 13287555072 +BOARD_USERDATAIMAGE_FILE_SYSTEM_TYPE := f2fs BOARD_CACHEIMAGE_PARTITION_SIZE := 268435456 BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE := ext4 BOARD_VENDORIMAGE_PARTITION_SIZE := 268435456 @@ -106,13 +109,6 @@ TARGET_USES_64_BIT_BINDER := true BOARD_WIDEVINE_OEMCRYPTO_LEVEL := 1 -# HACK: Build apps as 64b for volantis_64_only -ifneq (,$(filter ro.zygote=zygote64, $(PRODUCT_DEFAULT_PROPERTY_OVERRIDES))) -TARGET_PREFER_32_BIT_APPS := -TARGET_SUPPORTS_32_BIT_APPS := -TARGET_SUPPORTS_64_BIT_APPS := true -endif - # Don't dex preopt apps to avoid I/O congestion due to paging larger sized # pre-compiled .odex files as opposed to background generated interpret-only # odex files. diff --git a/aosp_flounder32.mk b/aosp_flounder32.mk deleted file mode 100644 index 28e228e..0000000 --- a/aosp_flounder32.mk +++ /dev/null @@ -1,19 +0,0 @@ -# Copyright (C) 2013 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. - -$(call inherit-product, $(LOCAL_PATH)/aosp_flounder.mk) - -PRODUCT_NAME := aosp_flounder32 -PRODUCT_DEVICE := flounder32 -PRODUCT_MODEL := 32-bit AOSP on Flounder diff --git a/aosp_flounder64.mk b/aosp_flounder64.mk deleted file mode 100644 index 5e0564c..0000000 --- a/aosp_flounder64.mk +++ /dev/null @@ -1,17 +0,0 @@ -# Copyright (C) 2013 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. - -$(call inherit-product, $(LOCAL_PATH)/aosp_flounder.mk) - -PRODUCT_NAME := aosp_flounder64 diff --git a/aosp_flounder_64_only.mk b/aosp_flounder_64_only.mk deleted file mode 100644 index 0de057f..0000000 --- a/aosp_flounder_64_only.mk +++ /dev/null @@ -1,33 +0,0 @@ -# Copyright (C) 2014 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. - -# -# This file is the build configuration for an aosp Android -# build for flounder hardware. This cleanly combines a set of -# device-specific aspects (drivers) with a device-agnostic -# product configuration (apps). Except for a few implementation -# details, it only fundamentally contains two inherit-product -# lines, aosp and flounder, hence its name. -# - -# Inherit from those products. Most specific first. -$(call inherit-product, device/htc/flounder/product_64_only.mk) -$(call inherit-product, $(SRC_TARGET_DIR)/product/aosp_base.mk) - -PRODUCT_NAME := aosp_flounder_64_only -PRODUCT_DEVICE := flounder -PRODUCT_BRAND := Android -PRODUCT_MODEL := AOSP on Flounder (64-bit only) -PRODUCT_MANUFACTURER := HTC -PRODUCT_RESTRICT_VENDOR_FILES := owner path @@ -19,34 +19,16 @@ PRODUCT_PACKAGES := \ android.hardware.wifi@1.0-service \ libwpa_client \ hostapd \ - wificond \ wpa_supplicant \ wpa_supplicant.conf -BOARD_USERDATAIMAGE_FILE_SYSTEM_TYPE := f2fs - -# This ensures the needed build tools are available. -# TODO: make non-linux builds happy with external/f2fs-tool; system/extras/f2fs_utils -ifeq ($(HOST_OS),linux) -TARGET_USERIMAGES_USE_F2FS := true -endif - -LOCAL_FSTAB := $(LOCAL_PATH)/fstab.flounder - -TARGET_RECOVERY_FSTAB = $(LOCAL_FSTAB) - PRODUCT_COPY_FILES := \ $(LOCAL_PATH)/init.flounder.rc:$(TARGET_COPY_OUT_VENDOR)/etc/init/init.rc \ $(LOCAL_PATH)/init.flounder.usb.rc:$(TARGET_COPY_OUT_VENDOR)/etc/init/init.usb.rc \ $(LOCAL_PATH)/init.recovery.flounder.rc:root/init.recovery.flounder.rc \ - $(LOCAL_FSTAB):$(TARGET_COPY_OUT_VENDOR)/etc/fstab.flounder \ + $(LOCAL_PATH)/fstab.flounder:$(TARGET_COPY_OUT_VENDOR)/etc/fstab.flounder \ $(LOCAL_PATH)/ueventd.flounder.rc:$(TARGET_COPY_OUT_VENDOR)/ueventd.rc -# Copy flounder files as flounder64 so that ${ro.hardware} can find them -PRODUCT_COPY_FILES += \ - $(LOCAL_FSTAB):$(TARGET_COPY_OUT_VENDOR)/etc/fstab.flounder64 \ - $(LOCAL_PATH)/init.recovery.flounder.rc:root/init.recovery.flounder64.rc - PRODUCT_COPY_FILES += \ $(LOCAL_PATH)/touch/touch_fusion.cfg:$(TARGET_COPY_OUT_VENDOR)/firmware/touch_fusion.cfg \ $(LOCAL_PATH)/touch/maxim_fp35.bin:$(TARGET_COPY_OUT_VENDOR)/firmware/maxim_fp35.bin \ @@ -164,6 +146,7 @@ endif # NFC packages PRODUCT_PACKAGES += \ android.hardware.nfc@1.0-impl-bcm \ + android.hardware.nfc@1.0-service \ nfc_nci.bcm2079x.default \ NfcNci \ Tag @@ -173,8 +156,7 @@ PRODUCT_PACKAGES += \ android.hardware.audio@2.0-impl \ android.hardware.audio@2.0-service \ android.hardware.audio.effect@2.0-impl \ - android.hardware.soundtrigger@2.0-impl \ - android.hardware.soundtrigger@2.0-service + android.hardware.soundtrigger@2.0-impl # Bluetooth HAL PRODUCT_PACKAGES += \ @@ -212,13 +194,13 @@ PRODUCT_PACKAGES += \ PRODUCT_PACKAGES += \ android.hardware.graphics.allocator@2.0-impl \ android.hardware.graphics.allocator@2.0-service \ - android.hardware.graphics.composer@2.1-impl \ android.hardware.graphics.mapper@2.0-impl \ hwcomposer.flounder # Health HAL PRODUCT_PACKAGES += \ - android.hardware.health@1.0-impl + android.hardware.health@1.0-impl \ + android.hardware.health@1.0-service # Keymaster HAL PRODUCT_PACKAGES += \ @@ -227,8 +209,7 @@ PRODUCT_PACKAGES += \ # Light HAL PRODUCT_PACKAGES += \ - android.hardware.light@2.0-impl \ - lights.flounder + android.hardware.light@2.0-service.flounder # Memtrack HAL PRODUCT_PACKAGES += \ @@ -255,7 +236,7 @@ PRODUCT_PACKAGES += \ # USB HAL PRODUCT_PACKAGES += \ - android.hardware.usb@1.0-service + android.hardware.usb@1.0-service.flounder # Vibrator PRODUCT_PACKAGES += \ @@ -358,9 +339,9 @@ PRODUCT_PACKAGES += \ verity_warning_images endif -# In userdebug, add minidebug info the the boot image and the system server to support -# diagnosing native crashes. -ifneq (,$(filter userdebug, $(TARGET_BUILD_VARIANT))) +# Add minidebug info the the boot image and the system server to support +# diagnosing native crashes, only on eng builds. +ifeq ($(TARGET_BUILD_VARIANT),eng) # Boot image. PRODUCT_DEX_PREOPT_BOOT_FLAGS += --generate-mini-debug-info # System server and some of its services. diff --git a/flounder32/BoardConfig.mk b/flounder32/BoardConfig.mk deleted file mode 100644 index ee733ad..0000000 --- a/flounder32/BoardConfig.mk +++ /dev/null @@ -1,16 +0,0 @@ -include device/htc/flounder/BoardConfig.mk - -TARGET_CPU_ABI := armeabi-v7a -TARGET_CPU_ABI2 := armeabi -TARGET_ARCH := arm -TARGET_ARCH_VARIANT := armv7-a-neon -TARGET_CPU_VARIANT := cortex-a15 - -TARGET_2ND_ARCH := -TARGET_2ND_ARCH_VARIANT := -TARGET_2ND_CPU_ABI := -TARGET_2ND_CPU_ABI2 := -TARGET_2ND_CPU_VARIANT := - -# Re-enable emulator for 32-bit -BUILD_EMULATOR := true diff --git a/flounder64/BoardConfig.mk b/flounder64/BoardConfig.mk deleted file mode 100644 index ef80b9b..0000000 --- a/flounder64/BoardConfig.mk +++ /dev/null @@ -1 +0,0 @@ -include device/htc/flounder/BoardConfig.mk diff --git a/flounder_lte/BoardConfig.mk b/flounder_lte/BoardConfig.mk index ef80b9b..f07483f 100644 --- a/flounder_lte/BoardConfig.mk +++ b/flounder_lte/BoardConfig.mk @@ -1 +1,4 @@ include device/htc/flounder/BoardConfig.mk + +# HIDL +DEVICE_MANIFEST_FILE += device/htc/flounder/manifest_lte.xml diff --git a/fstab.flounder b/fstab.flounder index b6fab8b..1793bb8 100644 --- a/fstab.flounder +++ b/fstab.flounder @@ -2,11 +2,13 @@ # The filesystem that contains the filesystem e2fsck binary (typically /system) cannot # specify 'check', and must come before any filesystems that do specify 'check' -# NOTE: /system and /vendor partitions are now early-mounted and the fstab entries are specified in device tree: +# NOTE: /system and /vendor partitions are now early-mounted and the fstab entries are specified in device tree (duplicated below for recovery image purposes only): # /proc/device-tree/firmware/android/fstab/system # /proc/device-tree/firmware/android/fstab/vendor #<src> <mnt_point> <type> <mnt_flags and options> <fs_mgr_flags> +/dev/block/platform/sdhci-tegra.3/by-name/APP /system ext4 ro wait,recoveryonly +/dev/block/platform/sdhci-tegra.3/by-name/VNR /vendor ext4 ro wait,recoveryonly /dev/block/platform/sdhci-tegra.3/by-name/CAC /cache f2fs noatime,nosuid,nodev,errors=panic wait,check /dev/block/platform/sdhci-tegra.3/by-name/CAC /cache ext4 noatime,nosuid,nodev,nomblk_io_submit,errors=panic wait,check /dev/block/platform/sdhci-tegra.3/by-name/UDA /data f2fs noatime,nosuid,nodev,errors=panic wait,check,latemount,forceencrypt=/dev/block/platform/sdhci-tegra.3/by-name/MD1 diff --git a/fstab.full b/fstab.full deleted file mode 100644 index 88cc8b6..0000000 --- a/fstab.full +++ /dev/null @@ -1,18 +0,0 @@ -# Android fstab file. -# The filesystem that contains the filesystem e2fsck binary (typically /system) cannot -# specify 'check', and must come before any filesystems that do specify 'check' - -#<src> <mnt_point> <type> <mnt_flags and options> <fs_mgr_flags> -/dev/block/platform/sdhci-tegra.3/by-name/APP /system ext4 ro wait -/dev/block/platform/sdhci-tegra.3/by-name/VNR /vendor ext4 ro wait -/dev/block/platform/sdhci-tegra.3/by-name/CAC /cache f2fs noatime,nosuid,nodev,errors=panic wait,check -/dev/block/platform/sdhci-tegra.3/by-name/CAC /cache ext4 noatime,nosuid,nodev,nomblk_io_submit,errors=panic wait,check -/dev/block/platform/sdhci-tegra.3/by-name/UDA /data f2fs noatime,nosuid,nodev,errors=panic wait,check,latemount,forceencrypt=/dev/block/platform/sdhci-tegra.3/by-name/MD1 -/dev/block/platform/sdhci-tegra.3/by-name/UDA /data ext4 noatime,nosuid,nodev,nomblk_io_submit,errors=panic wait,check,latemount,forceencrypt=/dev/block/platform/sdhci-tegra.3/by-name/MD1 -/dev/block/platform/sdhci-tegra.3/by-name/LNX /boot emmc defaults defaults -/dev/block/platform/sdhci-tegra.3/by-name/SOS /recovery emmc defaults defaults -/dev/block/platform/sdhci-tegra.3/by-name/MSC /misc emmc defaults defaults -/dev/block/platform/sdhci-tegra.3/by-name/EBT /bootloader emmc defaults defaults -/dev/block/platform/sdhci-tegra.3/by-name/PST /persistent emmc defaults defaults -/dev/block/zram0 none swap defaults zramsize=533413200,notrim -/devices/platform/tegra-ehci.0/usb* auto auto defaults voldmanaged=usb:auto diff --git a/gps/qct/gps.conf b/gps/qct/gps.conf index 129e239..3c7c7df 100644 --- a/gps/qct/gps.conf +++ b/gps/qct/gps.conf @@ -1,8 +1,8 @@ NTP_SERVER=north-america.pool.ntp.org -XTRA_SERVER_1=https://xtra1.gpsonextra.net/xtra2.bin -XTRA_SERVER_2=https://xtra2.gpsonextra.net/xtra2.bin -XTRA_SERVER_3=https://xtra3.gpsonextra.net/xtra2.bin +XTRA_SERVER_1=https://xtrapath1.izatcloud.net/xtra2.bin +XTRA_SERVER_2=https://xtrapath2.izatcloud.net/xtra2.bin +XTRA_SERVER_3=https://xtrapath3.izatcloud.net/xtra2.bin SUPL_HOST=supl.google.com SUPL_PORT=7275 diff --git a/init.flounder.rc b/init.flounder.rc index ed3542e..9db2ff9 100644 --- a/init.flounder.rc +++ b/init.flounder.rc @@ -19,7 +19,6 @@ on late-fs # Start services for bootanim start surfaceflinger start bootanim - start hwcomposer-2-1 start configstore-hal-1-0 start gralloc-2-0 @@ -106,6 +105,7 @@ on boot chown system system /sys/devices/system/cpu/cpufreq/interactive/boost chmod 0660 /sys/devices/system/cpu/cpufreq/interactive/boost chown system system /sys/devices/system/cpu/cpufreq/interactive/boostpulse + chmod 0660 /sys/devices/system/cpu/cpufreq/interactive/boostpulse chown system system /sys/devices/system/cpu/cpufreq/interactive/input_boost chmod 0660 /sys/devices/system/cpu/cpufreq/interactive/input_boost chown system system /sys/devices/system/cpu/cpufreq/interactive/boostpulse_duration @@ -113,10 +113,6 @@ on boot chown system system /sys/devices/system/cpu/cpufreq/interactive/io_is_busy chmod 0660 /sys/devices/system/cpu/cpufreq/interactive/io_is_busy - # white notification LED - chown system system /sys/class/htc_sensorhub/sensor_hub/led_en - chmod 664 /sys/class/htc_sensorhub/sensor_hub/led_en - # Enable CC4 write /sys/devices/system/cpu/cpu0/cpuidle/state1/disabled 0 write /sys/devices/system/cpu/cpu1/cpuidle/state1/disabled 0 @@ -157,8 +153,8 @@ service watchdogd /sbin/watchdogd 10 20 disabled seclabel u:r:watchdogd:s0 -# on userdebug and eng builds, enable kgdb on the serial console -on property:ro.debuggable=1 +# on eng builds, enable kgdb on the serial console +on property:ro.build.type=eng write /sys/module/kgdboc/parameters/kgdboc ttyFIQ0 write /sys/module/fiq_debugger/parameters/kgdb_enable 1 diff --git a/light/Android.bp b/light/Android.bp new file mode 100644 index 0000000..1cf843a --- /dev/null +++ b/light/Android.bp @@ -0,0 +1,17 @@ +cc_binary { + name: "android.hardware.light@2.0-service.flounder", + relative_install_path: "hw", + init_rc: ["android.hardware.light@2.0-service.flounder.rc"], + srcs: ["service.cpp", "Light.cpp"], + shared_libs: [ + "libbase", + "libcutils", + "libhardware", + "libhidlbase", + "libhidltransport", + "libhwbinder", + "libutils", + "android.hardware.light@2.0", + ], + proprietary: true, +} diff --git a/light/Light.cpp b/light/Light.cpp new file mode 100644 index 0000000..41d49e3 --- /dev/null +++ b/light/Light.cpp @@ -0,0 +1,98 @@ +/* + * Copyright 2018 The LineageOS 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. + */ + +#define LOG_TAG "Light" + +#include "Light.h" + +#include <android-base/logging.h> + +namespace { +using android::hardware::light::V2_0::LightState; + +static uint32_t rgbToBrightness(const LightState& state) { + uint32_t color = state.color & 0x00ffffff; + return ((77 * ((color >> 16) & 0xff)) + (150 * ((color >> 8) & 0xff)) + + (29 * (color & 0xff))) >> 8; +} + +static bool isLit(const LightState& state) { + return (state.color & 0x00ffffff); +} +} // anonymous namespace + +namespace android { +namespace hardware { +namespace light { +namespace V2_0 { +namespace implementation { + +Light::Light(std::ofstream&& backlight, std::ofstream&& led) + : mBacklight(std::move(backlight)), mLed(std::move(led)) { + auto backlightFn(std::bind(&Light::setBacklight, this, std::placeholders::_1)); + auto notifFn(std::bind(&Light::setNotificationLight, this, std::placeholders::_1)); + mLights.emplace(std::make_pair(Type::BACKLIGHT, backlightFn)); + mLights.emplace(std::make_pair(Type::NOTIFICATIONS, notifFn)); +} + +// Methods from ::android::hardware::light::V2_0::ILight follow. +Return<Status> Light::setLight(Type type, const LightState& state) { + auto it = mLights.find(type); + + if (it == mLights.end()) { + return Status::LIGHT_NOT_SUPPORTED; + } + + it->second(state); + + return Status::SUCCESS; +} + +Return<void> Light::getSupportedTypes(getSupportedTypes_cb _hidl_cb) { + std::vector<Type> types; + + for (auto const& light : mLights) { + types.push_back(light.first); + } + + _hidl_cb(types); + + return Void(); +} + +void Light::setBacklight(const LightState& state) { + std::lock_guard<std::mutex> lock(mLock); + uint32_t brightness = rgbToBrightness(state); + + mBacklight << brightness << std::endl; +} + +void Light::setNotificationLight(const LightState& state) { + std::lock_guard<std::mutex> lock(mLock); + uint32_t color = state.color & 0x00ffffff; + + if (isLit(state)) { + mLed << color << std::endl; + } else { + mLed << 0 << std::endl; + } +} + +} // namespace implementation +} // namespace V2_0 +} // namespace light +} // namespace hardware +} // namespace android diff --git a/light/Light.h b/light/Light.h new file mode 100644 index 0000000..eac99bc --- /dev/null +++ b/light/Light.h @@ -0,0 +1,40 @@ +#ifndef ANDROID_HARDWARE_LIGHT_V2_0_LIGHT_H +#define ANDROID_HARDWARE_LIGHT_V2_0_LIGHT_H + +#include <android/hardware/light/2.0/ILight.h> +#include <hidl/Status.h> + +#include <fstream> +#include <mutex> +#include <unordered_map> + +namespace android { +namespace hardware { +namespace light { +namespace V2_0 { +namespace implementation { + +struct Light : public ILight { + Light(std::ofstream&& backlight, std::ofstream&& led); + + // Methods from ::android::hardware::light::V2_0::ILight follow. + Return<Status> setLight(Type type, const LightState& state) override; + Return<void> getSupportedTypes(getSupportedTypes_cb _hidl_cb) override; + +private: + void setBacklight(const LightState& state); + void setNotificationLight(const LightState& state); + + std::ofstream mBacklight; + std::ofstream mLed; + + std::unordered_map<Type, std::function<void(const LightState&)>> mLights; + std::mutex mLock; +}; +} // namespace implementation +} // namespace V2_0 +} // namespace light +} // namespace hardware +} // namespace android + +#endif // ANDROID_HARDWARE_LIGHT_V2_0_LIGHT_H diff --git a/light/android.hardware.light@2.0-service.flounder.rc b/light/android.hardware.light@2.0-service.flounder.rc new file mode 100644 index 0000000..604ad80 --- /dev/null +++ b/light/android.hardware.light@2.0-service.flounder.rc @@ -0,0 +1,9 @@ +on early-boot + # White notification LED + chown system system /sys/class/htc_sensorhub/sensor_hub/led_en + chmod 664 /sys/class/htc_sensorhub/sensor_hub/led_en + +service light-hal-2-0 /vendor/bin/hw/android.hardware.light@2.0-service.flounder + class hal + user system + group system diff --git a/light/service.cpp b/light/service.cpp new file mode 100644 index 0000000..0e025e5 --- /dev/null +++ b/light/service.cpp @@ -0,0 +1,83 @@ +/* + * Copyright 2018 The LineageOS 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. + */ + +#define LOG_TAG "android.hardware.light@2.0-service.flounder" + +#include <android-base/logging.h> +#include <hidl/HidlTransportSupport.h> +#include <utils/Errors.h> + +#include "Light.h" + +using android::sp; +using android::status_t; +using android::OK; + +// libhwbinder: +using android::hardware::configureRpcThreadpool; +using android::hardware::joinRpcThreadpool; + +// Generated HIDL files +using android::hardware::light::V2_0::ILight; +using android::hardware::light::V2_0::implementation::Light; + +const static std::string kBacklightPath = "/sys/class/backlight/tegra-dsi-backlight.0/brightness"; +const static std::string kLedPath = "/sys/class/htc_sensorhub/sensor_hub/led_en"; + +int main() { + status_t status; + android::sp<ILight> service = nullptr; + + LOG(INFO) << "Light HAL Service 2.0 is starting."; + + std::ofstream backlight(kBacklightPath); + if (!backlight) { + int error = errno; + LOG(ERROR) << "Failed to open " << kBacklightPath << ", error=" << errno + << " (" << strerror(errno) << ")"; + return -error; + } + + std::ofstream led(kLedPath); + if (!led) { + int error = errno; + LOG(ERROR) << "Failed to open " << kLedPath << ", error=" << errno + << " (" << strerror(errno) << ")"; + return -error; + } + + service = new Light(std::move(backlight), std::move(led)); + if (service == nullptr) { + LOG(ERROR) << "Can not create an instance of Light HAL Iface, exiting."; + goto shutdown; + } + + configureRpcThreadpool(1, true); + + status = service->registerAsService(); + if (status != OK) { + LOG(ERROR) << "Could not register service for Light HAL Iface (" << status << ")"; + goto shutdown; + } + + LOG(INFO) << "Light HAL Service is ready."; + joinRpcThreadpool(); + +shutdown: + // Under normal cases, execution will not reach this line. + LOG(ERROR) << "Light HAL Service is shutting down."; + return 1; +} diff --git a/lights/Android.mk b/lights/Android.mk deleted file mode 100644 index 6132b01..0000000 --- a/lights/Android.mk +++ /dev/null @@ -1,34 +0,0 @@ -# Copyright (C) 2008 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. - -LOCAL_PATH:= $(call my-dir) - -include $(CLEAR_VARS) - -# HAL module implemenation, not prelinked and stored in -# hw/<COPYPIX_HARDWARE_MODULE_ID>.<ro.board.platform>.so - -LOCAL_SRC_FILES := lights.c - -LOCAL_MODULE_RELATIVE_PATH := hw - -LOCAL_MODULE_TAGS := optional -LOCAL_MODULE_OWNER := htc -LOCAL_PROPRIETARY_MODULE := true - -LOCAL_SHARED_LIBRARIES := liblog - -LOCAL_MODULE := lights.flounder - -include $(BUILD_SHARED_LIBRARY) diff --git a/lights/lights.c b/lights/lights.c deleted file mode 100644 index ddaf0fb..0000000 --- a/lights/lights.c +++ /dev/null @@ -1,159 +0,0 @@ -/* - * Copyright (C) 2008 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. - */ - -#define LOG_TAG "lights" - -#include <cutils/log.h> - -#include <malloc.h> -#include <stdint.h> -#include <string.h> -#include <unistd.h> -#include <errno.h> -#include <fcntl.h> -#include <stdlib.h> -#include <sys/ioctl.h> -#include <sys/types.h> - -#include <hardware/lights.h> -#include <hardware/hardware.h> - -static pthread_mutex_t g_lock = PTHREAD_MUTEX_INITIALIZER; -char const* const LED_FILE = "/sys/class/htc_sensorhub/sensor_hub/led_en"; -char const* const BACKLIGHT_FILE = "/sys/class/backlight/tegra-dsi-backlight.0/brightness"; - -static int write_int(char const *path, int value) -{ - int fd; - static int already_warned = -1; - fd = open(path, O_RDWR); - if (fd >= 0) { - char buffer[20]; - int bytes = snprintf(buffer, 20, "%d\n", value); - int amt = write(fd, buffer, bytes); - close(fd); - return amt == -1 ? -errno : 0; - } else { - if (already_warned == -1) { - ALOGE("write_int failed to open %s\n", path); - already_warned = 1; - } - return -errno; - } -} - -static int rgb_to_brightness(struct light_state_t const *state) -{ - int color = state->color & 0x00ffffff; - return ((77 * ((color >> 16) & 0x00ff)) - + (150 * ((color >> 8) & 0x00ff)) + - (29 * (color & 0x00ff))) >> 8; -} - -static int set_light_notifications(struct light_device_t* dev, - struct light_state_t const* state) -{ - int err; - - int on = state->color & 0x00ffffff; - ALOGV("set_light_notifications, on:%d (color:%x, flashMode:%x)", on ? 1 : 0, state->flashMode, state->color); - - pthread_mutex_lock(&g_lock); - - if (on) - err = write_int(LED_FILE, 1); - else - err = write_int(LED_FILE, 0); - - pthread_mutex_unlock(&g_lock); - - return err; -} - -static int set_light_backlight(struct light_device_t *dev, - struct light_state_t const *state) -{ - int err; - int brightness = rgb_to_brightness(state); - - pthread_mutex_lock(&g_lock); - err = write_int(BACKLIGHT_FILE, brightness); - pthread_mutex_unlock(&g_lock); - - return err; -} - -/** Close the lights device */ -static int close_lights(struct light_device_t *dev) -{ - if (dev) - free(dev); - return 0; -} - -/** Open a new instance of a lights device using name */ -static int open_lights(const struct hw_module_t *module, char const *name, - struct hw_device_t **device) -{ - struct light_device_t *dev = malloc(sizeof(struct light_device_t)); - int (*set_light) (struct light_device_t *dev, - struct light_state_t const *state); - pthread_t lighting_poll_thread; - ALOGV("open lights"); - if (dev == NULL) { - ALOGE("failed to allocate memory"); - return -1; - } - memset(dev, 0, sizeof(*dev)); - - if (0 == strcmp(LIGHT_ID_BACKLIGHT, name)) - set_light = set_light_backlight; - else if (0 == strcmp(LIGHT_ID_NOTIFICATIONS, name)) - set_light = set_light_notifications; - else - return -EINVAL; - - pthread_mutex_init(&g_lock, NULL); - - dev->common.tag = HARDWARE_DEVICE_TAG; - dev->common.version = 0; - dev->common.module = (struct hw_module_t *)module; - dev->common.close = (int (*)(struct hw_device_t *))close_lights; - dev->set_light = set_light; - - *device = (struct hw_device_t *)dev; - - return 0; -} - -static struct hw_module_methods_t lights_methods = -{ - .open = open_lights, -}; - -/* - * The backlight Module - */ -struct hw_module_t HAL_MODULE_INFO_SYM = -{ - .tag = HARDWARE_MODULE_TAG, - .version_major = 1, - .version_minor = 0, - .id = LIGHTS_HARDWARE_MODULE_ID, - .name = "Flounder lights module", - .author = "NVIDIA", - .methods = &lights_methods, -}; diff --git a/manifest.xml b/manifest.xml index 0fae0f2..515c4eb 100644 --- a/manifest.xml +++ b/manifest.xml @@ -115,7 +115,7 @@ </hal> <hal format="hidl"> <name>android.hardware.health</name> - <transport arch="32+64">passthrough</transport> + <transport>hwbinder</transport> <version>1.0</version> <interface> <name>IHealth</name> @@ -133,7 +133,7 @@ </hal> <hal format="hidl"> <name>android.hardware.light</name> - <transport arch="32+64">passthrough</transport> + <transport>hwbinder</transport> <version>2.0</version> <interface> <name>ILight</name> @@ -164,7 +164,7 @@ </hal> <hal format="hidl"> <name>android.hardware.nfc</name> - <transport arch="32+64">passthrough</transport> + <transport>hwbinder</transport> <version>1.0</version> <interface> <name>INfc</name> diff --git a/manifest_lte.xml b/manifest_lte.xml new file mode 100644 index 0000000..557eb5d --- /dev/null +++ b/manifest_lte.xml @@ -0,0 +1,20 @@ +<manifest version="1.0" type="device"> + <hal format="hidl"> + <name>android.hardware.radio</name> + <transport>hwbinder</transport> + <version>1.1</version> + <interface> + <name>IRadio</name> + <instance>slot1</instance> + </interface> + </hal> + <hal format="hidl"> + <name>android.hardware.radio.deprecated</name> + <transport>hwbinder</transport> + <version>1.0</version> + <interface> + <name>IOemHook</name> + <instance>slot1</instance> + </interface> + </hal> +</manifest> diff --git a/product_64_only.mk b/product_64_only.mk deleted file mode 100644 index f9273fe..0000000 --- a/product_64_only.mk +++ /dev/null @@ -1,30 +0,0 @@ -# Copyright (C) 2014 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. - -# -# This file is the build configuration that is shared by all products -# based on the flounder device that want only a 64-bit zygote (no -# 32-bit app support) -# - -# Make sure we have the 64b zygote service -PRODUCT_COPY_FILES += system/core/rootdir/init.zygote64.rc:root/init.zygote64.rc - -# Use 64b single zygote -PRODUCT_DEFAULT_PROPERTY_OVERRIDES += ro.zygote=zygote64 - -# Disable bluetooth because of continuous driver crashes -PRODUCT_DEFAULT_PROPERTY_OVERRIDES += config.disable_bluetooth=true - -$(call inherit-product, device/htc/flounder/product.mk) diff --git a/sepolicy/file_contexts b/sepolicy/file_contexts index e8d9ab2..700d560 100644 --- a/sepolicy/file_contexts +++ b/sepolicy/file_contexts @@ -103,6 +103,9 @@ /sys/module/tegra_fuse(/.*)? u:object_r:sysfs_tegra_fuse:s0 +/sys/devices/platform/tegra-dsi-backlight\.0/backlight/tegra-dsi-backlight\.0/brightness u:object_r:sysfs_leds:s0 +/sys/devices/virtual/htc_sensorhub/sensor_hub/led_en u:object_r:sysfs_leds:s0 + # mmc rpmb /dev/block/mmcblk0rpmb u:object_r:mmc_rpmb_block_device:s0 @@ -127,5 +130,7 @@ # label the wifi MAC address /sys/devices/platform/sdhci-tegra\.0/mmc_host/mmc1/mmc1:0001/mmc1:0001:2/net/wlan0/address u:object_r:sysfs_mac_address:s0 -# dumpstate +# HALs /vendor/bin/hw/android\.hardware\.dumpstate@1\.0-service.flounder u:object_r:hal_dumpstate_impl_exec:s0 +/vendor/bin/hw/android\.hardware\.light@2\.0-service\.flounder u:object_r:hal_light_default_exec:s0 +/vendor/bin/hw/android\.hardware\.usb@1\.0-service\.flounder u:object_r:hal_usb_default_exec:s0 diff --git a/usb/Android.bp b/usb/Android.bp new file mode 100644 index 0000000..10294a2 --- /dev/null +++ b/usb/Android.bp @@ -0,0 +1,17 @@ +cc_binary { + name: "android.hardware.usb@1.0-service.flounder", + relative_install_path: "hw", + init_rc: ["android.hardware.usb@1.0-service.flounder.rc"], + srcs: ["service.cpp", "Usb.cpp"], + shared_libs: [ + "libcutils", + "libhidlbase", + "libhidltransport", + "liblog", + "libhwbinder", + "libutils", + "libhardware", + "android.hardware.usb@1.0", + ], + proprietary: true, +} diff --git a/usb/Usb.cpp b/usb/Usb.cpp new file mode 100644 index 0000000..a7756c1 --- /dev/null +++ b/usb/Usb.cpp @@ -0,0 +1,83 @@ +/* + * Copyright (C) 2017 The LineageOS 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 <pthread.h> +#include <stdio.h> +#include <sys/types.h> +#include <unistd.h> + +#include <utils/Errors.h> +#include <utils/StrongPointer.h> + +#include "Usb.h" + +namespace android { +namespace hardware { +namespace usb { +namespace V1_0 { +namespace implementation { + +Return<void> Usb::switchRole(const hidl_string &portName, + const PortRole &newRole) { + (void)portName; + (void)newRole; + ALOGE("%s: Not supported", __func__); + return Void(); +} + +Return<void> Usb::queryPortStatus() { + hidl_vec<PortStatus> currentPortStatus; + currentPortStatus.resize(1); + + /* this device is not type C and can only be a sink */ + currentPortStatus[0].portName = "otg_default"; + currentPortStatus[0].currentDataRole = PortDataRole::DEVICE; + currentPortStatus[0].currentPowerRole = PortPowerRole::SINK; + currentPortStatus[0].currentMode = PortMode::UFP; + currentPortStatus[0].canChangeMode = false; + currentPortStatus[0].canChangeDataRole = false; + currentPortStatus[0].canChangePowerRole = false; + currentPortStatus[0].supportedModes = PortMode::UFP; + + pthread_mutex_lock(&mLock); + if (mCallback != NULL) { + Return<void> ret = + mCallback->notifyPortStatusChange(currentPortStatus, Status::SUCCESS); + if (!ret.isOk()) + ALOGE("queryPortStatus error %s", ret.description().c_str()); + } else { + ALOGI("Notifying userspace skipped. Callback is NULL"); + } + pthread_mutex_unlock(&mLock); + + return Void(); +} + +Return<void> Usb::setCallback(const sp<IUsbCallback> &callback) { + pthread_mutex_lock(&mLock); + + mCallback = callback; + ALOGI("registering callback"); + + pthread_mutex_unlock(&mLock); + return Void(); +} + +} // namespace implementation +} // namespace V1_0 +} // namespace usb +} // namespace hardware +} // namespace android diff --git a/usb/Usb.h b/usb/Usb.h new file mode 100644 index 0000000..257bd2d --- /dev/null +++ b/usb/Usb.h @@ -0,0 +1,52 @@ +#ifndef ANDROID_HARDWARE_USB_V1_0_USB_H +#define ANDROID_HARDWARE_USB_V1_0_USB_H + +#include <android/hardware/usb/1.0/IUsb.h> +#include <hidl/MQDescriptor.h> +#include <hidl/Status.h> +#include <utils/Log.h> + +#ifdef LOG_TAG +#undef LOG_TAG +#endif + +#define LOG_TAG "android.hardware.usb@1.0-service.flounder" +#define UEVENT_MSG_LEN 2048 + +namespace android { +namespace hardware { +namespace usb { +namespace V1_0 { +namespace implementation { + +using ::android::hardware::usb::V1_0::IUsb; +using ::android::hardware::usb::V1_0::IUsbCallback; +using ::android::hardware::usb::V1_0::PortRole; +using ::android::hidl::base::V1_0::IBase; +using ::android::hardware::hidl_array; +using ::android::hardware::hidl_memory; +using ::android::hardware::hidl_string; +using ::android::hardware::hidl_vec; +using ::android::hardware::Return; +using ::android::hardware::Void; +using ::android::sp; + +struct Usb : public IUsb { + Return<void> switchRole(const hidl_string& portName, const PortRole& role) override; + Return<void> setCallback(const sp<IUsbCallback>& callback) override; + Return<void> queryPortStatus() override; + + sp<IUsbCallback> mCallback; + pthread_mutex_t mLock = PTHREAD_MUTEX_INITIALIZER; + + private: + pthread_t mPoll; +}; + +} // namespace implementation +} // namespace V1_0 +} // namespace usb +} // namespace hardware +} // namespace android + +#endif // ANDROID_HARDWARE_USB_V1_0_USB_H diff --git a/usb/android.hardware.usb@1.0-service.flounder.rc b/usb/android.hardware.usb@1.0-service.flounder.rc new file mode 100644 index 0000000..296a89a --- /dev/null +++ b/usb/android.hardware.usb@1.0-service.flounder.rc @@ -0,0 +1,4 @@ +service usb-hal-1-0 /vendor/bin/hw/android.hardware.usb@1.0-service.flounder + class hal + user system + group system diff --git a/usb/service.cpp b/usb/service.cpp new file mode 100644 index 0000000..4128097 --- /dev/null +++ b/usb/service.cpp @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2017 The LineageOS jProject + * + * 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 <hidl/HidlTransportSupport.h> +#include "Usb.h" + +using android::sp; + +// libhwbinder: +using android::hardware::configureRpcThreadpool; +using android::hardware::joinRpcThreadpool; + +// Generated HIDL files +using android::hardware::usb::V1_0::IUsb; +using android::hardware::usb::V1_0::implementation::Usb; + +using android::status_t; +using android::OK; + +int main() { + android::sp<IUsb> service = new Usb(); + + configureRpcThreadpool(1, true /*callerWillJoin*/); + status_t status = service->registerAsService(); + + if (status != OK) { + ALOGE("Cannot register USB HAL service"); + return 1; + } + + ALOGI("USB HAL Ready."); + joinRpcThreadpool(); + // Under noraml cases, execution will not reach this line. + ALOGI("USB HAL failed to join thread pool."); + return 1; +} diff --git a/wifi_only_overlay/frameworks/base/core/res/res/values/config.xml b/wifi_only_overlay/frameworks/base/core/res/res/values/config.xml index c1a6f1f..c571af3 100644 --- a/wifi_only_overlay/frameworks/base/core/res/res/values/config.xml +++ b/wifi_only_overlay/frameworks/base/core/res/res/values/config.xml @@ -67,4 +67,14 @@ <item>"7,1"</item> <item>"9,1"</item> </string-array> + + <!-- Flag indicating whether the current device allows sms service. + If true, this means that the device supports both sending and + receiving sms via the telephony network. + This can be overridden to false for "data only" devices + which can't send and receive sms message. + + Note: Disable SMS also disable voicemail waiting sms, + cell broadcasting sms, and MMS. --> + <bool name="config_sms_capable">false</bool> </resources> |
