diff --git a/Android.mk b/Android.mk new file mode 100644 index 0000000..dc7b31a --- /dev/null +++ b/Android.mk @@ -0,0 +1,12 @@ +# +# Copyright (C) 2020 The LineageOS Project +# +# SPDX-License-Identifier: Apache-2.0 +# + +LOCAL_PATH := $(call my-dir) + +ifneq ($(filter Atom_L Atom_XL ,$(TARGET_DEVICE)),) +subdir_makefiles=$(call first-makefiles-under,$(LOCAL_PATH)) +$(foreach mk,$(subdir_makefiles),$(info including $(mk) ...)$(eval include $(mk))) +endif diff --git a/BoardConfigCommon.mk b/BoardConfigCommon.mk new file mode 100644 index 0000000..e409900 --- /dev/null +++ b/BoardConfigCommon.mk @@ -0,0 +1,116 @@ +# Copyright (C) 2020 The LineageOS Project +# +# SPDX-License-Identifier: Apache-2.0 +# + +COMMON_DEVICE_PATH := device/Unihertz/Atom_LXL + +# Architecture +TARGET_ARCH := arm64 +TARGET_ARCH_VARIANT := armv8-a +TARGET_CPU_ABI := arm64-v8a +TARGET_CPU_ABI2 := +TARGET_CPU_VARIANT := generic + +TARGET_2ND_ARCH := arm +TARGET_2ND_ARCH_VARIANT := armv8-a +TARGET_2ND_CPU_ABI := armeabi-v7a +TARGET_2ND_CPU_ABI2 := armeabi +TARGET_2ND_CPU_VARIANT := generic + +TARGET_USES_64_BIT_BINDER := true + +# Avb +BOARD_AVB_ENABLE := true +BOARD_AVB_MAKE_VBMETA_IMAGE_ARGS += --set_hashtree_disabled_flag +BOARD_AVB_MAKE_VBMETA_IMAGE_ARGS += --flags 2 + +# Audio +USE_XML_AUDIO_POLICY_CONF := 1 +USE_CUSTOM_AUDIO_POLICY := 1 + +# Bluetooth +BOARD_BLUETOOTH_BDROID_BUILDCFG_INCLUDE_DIR := $(DEVICE_PATH)/bluetooth/include + +# Bootloader +TARGET_BOARD_PLATFORM := mt6771 +TARGET_BOOTLOADER_BOARD_NAME := mt6771 +TARGET_NO_BOOTLOADER := true + +# These two are for MTK Chipsets only +BOARD_USES_MTK_HARDWARE := true +BOARD_HAS_MTK_HARDWARE := true + +# Kernel +BOARD_KERNEL_CMDLINE := bootopt=64S3,32N2,64N2 buildvariant=$(TARGET_BUILD_VARIANT) androidboot.selinux=enforcing +BOARD_KERNEL_BASE := 0x40078000 +BOARD_KERNEL_PAGESIZE := 2048 +BOARD_KERNEL_OFFSET := 0x00008000 +BOARD_RAMDISK_OFFSET := 0x14f88000 +BOARD_KERNEL_SECOND_OFFSET := 0x00e88000 +BOARD_DTB_OFFSET := 0x13f88000 +BOARD_BOOT_HEADER_VERSION := 2 +BOARD_KERNEL_TAGS_OFFSET := 0x13f88000 +BOARD_KERNEL_IMAGE_NAME := Image.gz +TARGET_PREBUILT_KERNEL := $(DEVICE_PATH)/prebuilt/Image.gz +BOARD_PREBUILT_DTBOIMAGE := $(DEVICE_PATH)/prebuilt/dtbo.img +BOARD_PREBUILT_DTBIMAGE_DIR := $(DEVICE_PATH)/prebuilt/dtb +BOARD_INCLUDE_DTB_IN_BOOTIMG := true +BOARD_MKBOOTIMG_ARGS += --base $(BOARD_KERNEL_BASE) +BOARD_MKBOOTIMG_ARGS += --pagesize $(BOARD_KERNEL_PAGESIZE) +BOARD_MKBOOTIMG_ARGS += --ramdisk_offset $(BOARD_RAMDISK_OFFSET) +BOARD_MKBOOTIMG_ARGS += --tags_offset $(BOARD_KERNEL_TAGS_OFFSET) +BOARD_MKBOOTIMG_ARGS += --kernel_offset $(BOARD_KERNEL_OFFSET) +BOARD_MKBOOTIMG_ARGS += --second_offset $(BOARD_KERNEL_SECOND_OFFSET) +BOARD_MKBOOTIMG_ARGS += --dtb_offset $(BOARD_DTB_OFFSET) +BOARD_MKBOOTIMG_ARGS += --header_version $(BOARD_BOOT_HEADER_VERSION) + +# Partitions +BOARD_FLASH_BLOCK_SIZE := 131072 +BOARD_BOOTIMAGE_PARTITION_SIZE := 33554432 +BOARD_RECOVERYIMAGE_PARTITION_SIZE := 33554432 +BOARD_DTBOIMG_PARTITION_SIZE := 8388608 +BOARD_CACHEIMAGE_PARTITION_SIZE := 452984832 +BOARD_USERDATAIMAGE_PARTITION_SIZE := 121978716160 +BOARD_SYSTEMIMAGE_PARTITION_RESERVED_SIZE := 536870912 +BOARD_PRODUCTIMAGE_PARTITION_RESERVED_SIZE := 536870912 +BOARD_SUPER_PARTITION_SIZE := 4831838208 +BOARD_SUPER_PARTITION_GROUPS := main +BOARD_MAIN_SIZE := 4829741056 +BOARD_MAIN_PARTITION_LIST := \ + system \ + product +# Non-SAR on Android 10 means the presence of stage-1 ramdisk +BOARD_BUILD_SYSTEM_ROOT_IMAGE := false +BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE := ext4 +BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE := ext4 +TARGET_COPY_OUT_VENDOR := vendor +TARGET_COPY_OUT_PRODUCT := product +BUILD_WITHOUT_VENDOR := true +BOARD_ROOT_EXTRA_FOLDERS += metadata + +# Recovery +BOARD_INCLUDE_RECOVERY_DTBO := true +BOARD_USES_RECOVERY_AS_BOOT := false +TARGET_NO_RECOVERY := false +TARGET_RECOVERY_FSTAB := $(COMMON_DEVICE_PATH)/rootdir/etc/fstab.mt6771 +TARGET_RECOVERY_PIXEL_FORMAT := "BGRA_8888" +TARGET_USERIMAGES_USE_EXT4 := true +TARGET_USES_MKE2FS := true + +# Sepolicy +TARGET_USES_PREBUILT_VENDOR_SEPOLICY := true +TARGET_HAS_FUSEBLK_SEPOLICY_ON_VENDOR := true +BOARD_PLAT_PRIVATE_SEPOLICY_DIR := $(DEVICE_PATH)/sepolicy/private +BOARD_PLAT_PUBLIC_SEPOLICY_DIR := $(COMMON_DEVICE_PATH)/sepolicy/public +BOARD_VENDOR_SEPOLICY_DIRS += $(COMMON_DEVICE_PATH)/sepolicy/vendor + +# Treble +BOARD_VNDK_VERSION := current + +# Properties +TARGET_PRODUCT_PROP += $(COMMON_DEVICE_PATH)/product.prop + +# We need this for apns-conf +# We would like to override instead of merge +BUILD_BROKEN_DUP_RULES := true diff --git a/ImsInit/Android.mk b/ImsInit/Android.mk new file mode 100644 index 0000000..90bf150 --- /dev/null +++ b/ImsInit/Android.mk @@ -0,0 +1,18 @@ +LOCAL_PATH := $(call my-dir) +include $(CLEAR_VARS) + +LOCAL_MODULE_TAGS := optional + +LOCAL_SRC_FILES := $(call all-java-files-under, src) +LOCAL_PACKAGE_NAME := ImsInit +LOCAL_PRIVATE_PLATFORM_APIS := true +LOCAL_CERTIFICATE := platform +LOCAL_PRIVILEGED_MODULE := true +LOCAL_VENDOR_MODULE := false + +LOCAL_USE_AAPT2 := true + +LOCAL_JAVA_LIBRARIES := \ + ims-common + +include $(BUILD_PACKAGE) diff --git a/ImsInit/AndroidManifest.xml b/ImsInit/AndroidManifest.xml new file mode 100644 index 0000000..dd8ff62 --- /dev/null +++ b/ImsInit/AndroidManifest.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + diff --git a/ImsInit/src/org/lineageos/unihertz/imsinit/BootCompletedReceiver.java b/ImsInit/src/org/lineageos/unihertz/imsinit/BootCompletedReceiver.java new file mode 100644 index 0000000..c78e526 --- /dev/null +++ b/ImsInit/src/org/lineageos/unihertz/imsinit/BootCompletedReceiver.java @@ -0,0 +1,33 @@ +package org.lineageos.unihertz.imsinit; + +import android.content.BroadcastReceiver; +import android.content.Context; +import android.content.Intent; +import android.content.SharedPreferences; +import android.util.Log; + +import com.android.ims.ImsManager; + +/* + * WARNING: DIRTY HACK AHEAD + * I have no idea why MTK's IMS does not work after a reboot on + * SELinux enforcing. I have literally tried to put every service + * with denial messages to permissive and the bug was still present. + * But a global permissive environment fixes that magically. + * Re-enabling Enhanced 4G manually also fixes the issue. + * This is a dirty hack to toggle IMS off and back on again + * on every boot other than the first boot. I figured this is + * at least better than having to put the entire system on permissive. + * But it is very dirty and can't be guaranteed to work. + * We still need to figure out at some point why this happens. + */ +public class BootCompletedReceiver extends BroadcastReceiver { + private static final String LOG_TAG = "ImsInit"; + + @Override + public void onReceive(final Context context, Intent intent) { + Log.i(LOG_TAG, "onBoot"); + + context.startService(new Intent(context, PhoneStateService.class)); + } +} diff --git a/ImsInit/src/org/lineageos/unihertz/imsinit/PhoneStateService.java b/ImsInit/src/org/lineageos/unihertz/imsinit/PhoneStateService.java new file mode 100644 index 0000000..ebf520d --- /dev/null +++ b/ImsInit/src/org/lineageos/unihertz/imsinit/PhoneStateService.java @@ -0,0 +1,76 @@ +package org.lineageos.unihertz.imsinit; + +import android.app.Service; +import android.content.Context; +import android.content.Intent; +import android.content.SharedPreferences; +import android.os.IBinder; +import android.telephony.PhoneStateListener; +import android.telephony.ServiceState; +import android.telephony.TelephonyManager; +import android.util.Log; + +import com.android.ims.ImsManager; + +public class PhoneStateService extends Service { + private static final String LOG_TAG = "ImsInit"; + private static ServiceState sLastState = null; + + private void handleServiceStateChanged(ServiceState serviceState) { + Log.i(LOG_TAG, "handleServiceStateChanged"); + if ((sLastState == null || sLastState.getDataRegState() != ServiceState.STATE_IN_SERVICE) + && serviceState.getDataRegState() == ServiceState.STATE_IN_SERVICE) { + SharedPreferences prefs = getSharedPreferences("prefs", Context.MODE_PRIVATE); + + if (prefs.getBoolean("first_time", true)) { + Log.i(LOG_TAG, "Skipping first boot"); + prefs.edit().putBoolean("first_time", false).commit(); + return; + } + + if (ImsManager.isEnhanced4gLteModeSettingEnabledByUser(this)) { + Log.i(LOG_TAG, "VoLTE enabled, trying to toggle it off and back on"); + ImsManager.setEnhanced4gLteModeSetting(this, false); + new Thread(() -> { + try { + Thread.sleep(1000); + } catch (Exception e) { + // Ignore + } + ImsManager.setEnhanced4gLteModeSetting(this, true); + }).start(); + } + } + + sLastState = serviceState; + } + + @Override + public void onCreate() { + + } + + @Override + public int onStartCommand(Intent intent, int flags, int startId) { + TelephonyManager tm = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE); + // Handle latest state at start + handleServiceStateChanged(tm.getServiceState()); + tm.listen(new PhoneStateListener() { + @Override + public void onServiceStateChanged(ServiceState serviceState) { + handleServiceStateChanged(serviceState); + } + }, PhoneStateListener.LISTEN_SERVICE_STATE); + return START_STICKY; + } + + @Override + public IBinder onBind(Intent intent) { + return null; + } + + @Override + public void onDestroy() { + + } +} diff --git a/README.md b/README.md new file mode 100644 index 0000000..7c1071e --- /dev/null +++ b/README.md @@ -0,0 +1,25 @@ +Common device configuration for the Unihertz Atom L and XL +================================================= +This Common device tree is intended for the usage in a LineageOS or similar building environment. + +The Unihertz Atom L (codenamed simply _"Atom_L"_) and the Atom XL (codenamed simply _"Atom_XL"_) are two rugged small smartphones from Unihertz, released in July 2020. They are both almost identical only the Atom XL offers an integrated amateur radio. + +## Releases + +For the actual releases head on over to the device tree of the individual devices: +- [Atom L Releases](https://github.com/ADeadTrousers/android_device_Unihertz_Atom_L/releases) +- [Atom XL Releases](https://github.com/ADeadTrousers/android_device_Unihertz_Atom_XL/releases) + +## Documentations + +- [HOW-TO-BUILD.md](docs/HOW-TO-BUILD.md) - Building instructions for LineageOS 17.1. +- [HOW-TO-INSTALL.md](docs/HOW-TO-INSTALL.md) - Installation instructions for the Atom L/XL. +- [HOW-TO-UPDATE.md](docs/HOW-TO-UPDATE.md) - Update instructions for the Atom L/XL. +- [HOW-TO-EXTRACT_FILES.md](docs/HOW-TO-EXTRACT_FILES.md) - Instructions to extract files directly from the Atom L/XL stock rom files. +- [HOW-TO-EXTRACT_SEPOLICY.md](docs/HOW-TO-EXTRACT_SEPOLICY.md) - A little guide to extract sepolicy rules from stock or phone. +- [HOW-TO-FLASH-STOCK.md](docs/HOW-TO-FLASH-STOCK.md) - Instructions on how to use the SP Flash Tool for MTK based devices. +- [HOW-TO-FLASH-SUPER.md](docs/HOW-TO-FLASH-SUPER.md) - Instructions on how to modify super.img and flashing it onto the device. + +## Special Thanks To + +- [PeterCxy from the XDA forum](https://forum.xda-developers.com/member.php?u=5351691) for helping me and providing the initial device tree for Atom L. diff --git a/deviceCommon.mk b/deviceCommon.mk new file mode 100644 index 0000000..1d3bf1f --- /dev/null +++ b/deviceCommon.mk @@ -0,0 +1,154 @@ +# Copyright (C) 2020 The LineageOS Project +# +# SPDX-License-Identifier: Apache-2.0 +# + +COMMON_DEVICE_PATH := device/Unihertz/Atom_LXL + +#Include GAPPS if applicable +-include $(COMMON_DEVICE_PATH)/gapps_prop.mk + +$(call inherit-product, $(SRC_TARGET_DIR)/product/gsi_keys.mk) + +# Enable updating of APEXes +$(call inherit-product, $(SRC_TARGET_DIR)/product/updatable_apex.mk) + +# Define Dynamic Partition support +PRODUCT_TARGET_VNDK_VERSION := 29 +PRODUCT_SHIPPING_API_LEVEL := 29 +PRODUCT_USE_DYNAMIC_PARTITIONS := true +PRODUCT_BUILD_SUPER_PARTITION := false +PRODUCT_BUILD_PRODUCT_IMAGE := true + +# Properties +PRODUCT_COMPATIBLE_PROPERTY_OVERRIDE := true + +# A/B +AB_OTA_UPDATER := false + +# Audio +PRODUCT_PACKAGES += \ + audio.a2dp.default \ + libaacwrapper + +# Camera +PRODUCT_PACKAGES += \ + Snap + +# FMRadio +PRODUCT_PACKAGES += \ + FMRadio \ + libfmcust + +# fastbootd +PRODUCT_PACKAGES += \ + fastbootd + +# fstab +PRODUCT_COPY_FILES += \ + $(COMMON_DEVICE_PATH)/rootdir/etc/fstab.mt6771:$(TARGET_COPY_OUT_RAMDISK)/fstab.mt6771 + +# NFC stack (AOSP) +PRODUCT_PACKAGES += \ + NfcNci + +# ImsInit hack +PRODUCT_PACKAGES += \ + ImsInit + +# Init +PRODUCT_PACKAGES += \ + init.mt6771.rc \ + fstab.mt6771 + +# Magisk +PRODUCT_PACKAGES += \ + MagiskManager + +PRODUCT_COPY_FILES += \ + frameworks/av/services/audiopolicy/config/audio_policy_configuration.xml:$(TARGET_COPY_OUT_SYSTEM)/etc/audio_policy_configuration.xml \ + frameworks/av/services/audiopolicy/config/audio_policy_configuration_bluetooth_legacy_hal.xml:$(TARGET_COPY_OUT_SYSTEM)/etc/audio_policy_configuration_bluetooth_legacy_hal.xml \ + frameworks/av/services/audiopolicy/config/audio_policy_volumes.xml:$(TARGET_COPY_OUT_SYSTEM)/etc/audio_policy_volumes.xml \ + frameworks/av/services/audiopolicy/config/a2dp_audio_policy_configuration.xml:$(TARGET_COPY_OUT_SYSTEM)/etc/a2dp_audio_policy_configuration.xml \ + frameworks/av/services/audiopolicy/config/audio_policy_configuration_stub.xml:$(TARGET_COPY_OUT_SYSTEM)/etc/audio_policy_configuration_stub.xml \ + frameworks/av/services/audiopolicy/config/bluetooth_audio_policy_configuration.xml:$(TARGET_COPY_OUT_SYSTEM)/etc/bluetooth_audio_policy_configuration.xml \ + frameworks/av/services/audiopolicy/config/usb_audio_policy_configuration.xml:$(TARGET_COPY_OUT_SYSTEM)/etc/usb_audio_policy_configuration.xml \ + frameworks/av/services/audiopolicy/config/hearing_aid_audio_policy_configuration.xml:$(TARGET_COPY_OUT_SYSTEM)/etc/hearing_aid_audio_policy_configuration.xml \ + frameworks/av/services/audiopolicy/config/r_submix_audio_policy_configuration.xml:$(TARGET_COPY_OUT_SYSTEM)/etc/r_submix_audio_policy_configuration.xml \ + frameworks/av/services/audiopolicy/config/default_volume_tables.xml:$(TARGET_COPY_OUT_SYSTEM)/etc/default_volume_tables.xml + +PRODUCT_PACKAGES += \ + libGLES_android \ + libaudioprocessing \ + libaudioflinger \ + libaudio-resampler \ + libcameraservice \ + libsuspend \ + libstatssocket \ + libsparse \ + libdrm \ + libpcap \ + libprotobuf-cpp-full \ + libbrotli \ + libext2_blkid \ + libext2_com_err \ + libext2_e2p \ + libext2_profile \ + libext2_uuid \ + libext2fs \ + libmetricslogger \ + com.android.nfc_extras \ + android.frameworks.sensorservice@1.0 \ + android.hardware.audio.common-util \ + android.hardware.audio.common@2.0-util \ + android.hardware.audio.common@4.0 \ + android.hardware.audio.common@4.0-util \ + android.hardware.audio.common@5.0-util \ + android.hardware.audio.effect@2.0 \ + android.hardware.audio.effect@4.0 \ + android.hardware.audio.effect@5.0 \ + android.hardware.audio@2.0 \ + android.hardware.audio@4.0 \ + android.hardware.audio@5.0 \ + android.hardware.biometrics.fingerprint@2.1 \ + android.hardware.health@1.0 \ + android.hardware.health@2.0 \ + android.hardware.nfc@1.0 \ + android.hardware.nfc@1.1 \ + android.hardware.nfc@1.2 \ + android.hardware.thermal@1.0 \ + android.hardware.radio@1.1 \ + android.hardware.radio@1.2 \ + android.hardware.radio@1.3 \ + android.hardware.radio@1.4 \ + android.hardware.vibrator@1.0 \ + android.hardware.vibrator@1.3 + +# Keylayouts +PRODUCT_COPY_FILES += \ + $(COMMON_DEVICE_PATH)/idc/mtk-kpd.idc:$(TARGET_COPY_OUT_SYSTEM)/usr/idc/mtk-kpd.idc \ + $(COMMON_DEVICE_PATH)/keylayout/mtk-kpd.kl:$(TARGET_COPY_OUT_SYSTEM)/usr/keylayout/mtk-kpd.kl \ + $(COMMON_DEVICE_PATH)/keylayout/mtk-tpd-kpd.kl:$(TARGET_COPY_OUT_SYSTEM)/usr/keylayout/mtk-tpd-kpd.kl \ + $(COMMON_DEVICE_PATH)/keylayout/fingerprint_key.kl:$(TARGET_COPY_OUT_SYSTEM)/usr/keylayout/fingerprint_key.kl + +# Overlays +DEVICE_PACKAGE_OVERLAYS += \ + $(COMMON_DEVICE_PATH)/overlay \ + $(COMMON_DEVICE_PATH)/overlay-lineage + +# Overlays -- replace official +PRODUCT_PACKAGES += \ + FrameworkResOverlay + +# Telephony Jars +PRODUCT_BOOT_JARS += \ + mediatek-common \ + mediatek-framework \ + mediatek-ims-base \ + mediatek-ims-common \ + mediatek-telecom-common \ + mediatek-telephony-base \ + mediatek-telephony-common + +#Include GAPPS if applicable +$(call inherit-product-if-exists, vendor/opengapps/build/opengapps-packages.mk) diff --git a/docs/HOW-TO-BUILD.md b/docs/HOW-TO-BUILD.md new file mode 100644 index 0000000..4759024 --- /dev/null +++ b/docs/HOW-TO-BUILD.md @@ -0,0 +1,267 @@ +How to build LineageOS 17.1 for the Unihertz Atom L and XL +================================================= + +This guide is focused on building the ROM under a Linux host environment. + +## Setting up the build environment + +In general follow one of the many build instructions found at the LineageOS wiki. +For example the instructions for the [Google Nexus 5 aka hammerhead](https://wiki.lineageos.org/devices/hammerhead/build). +Here is a short summing up. + +### Install the build packages + +To successfully build LineageOS, you’ll need + +```bash +sudo apt-get install bc bison build-essential ccache curl flex g++-multilib gcc-multilib git gnupg gperf imagemagick lib32ncurses5-dev lib32readline-dev lib32z1-dev liblz4-tool libncurses5 libncurses5-dev libsdl1.2-dev libssl-dev libxml2 libxml2-utils lzop pngcrush rsync schedtool squashfs-tools xsltproc zip zlib1g-dev +``` + +For Ubuntu versions older than 16.04 (xenial), you’ll need + +```bash +sudo apt-get install libwxgtk2.8-dev +``` + +For Ubuntu versions older than 20.04 (focal), you’ll also need + +```bash +sudo apt-get install libwxgtk3.0-dev +``` + +### Install the platform-tools + +Only if you haven’t previously installed adb and fastboot + +```bash +wget https://dl.google.com/android/repository/platform-tools-latest-linux.zip +unzip platform-tools-latest-linux.zip -d ~ +``` + +Update your PATH variable for your environment + +```bash +gedit ~/.profile +``` + +Add the following + +```bash +# add Android SDK platform tools to path +if [ -d "$HOME/platform-tools" ] ; then + PATH="$HOME/platform-tools:$PATH" +fi +``` + +Then update your environment + +```bash +source ~/.profile +``` + +### Install the repo command + +Download the binary and make it executable + +```bash +mkdir -p ~/bin +curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo +chmod a+x ~/bin/repo +``` + +Update your PATH variable for your environment + +```bash +gedit ~/.profile +``` + +Add the following + +```bash +# set PATH so it includes user's private bin if it exists +if [ -d "$HOME/bin" ] ; then + PATH="$HOME/bin:$PATH" +fi +``` + +Then update your environment + +```bash +source ~/.profile +``` + +### (optional) Install git-lfs for GAPPS support during build + +If you want to include GAPPS in the build you need [git-lfs](https://git-lfs.github.com/) otherwise the apk's can't be downloaded. + +```bash +curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | sudo bash +sudo apt-get install git-lfs +``` + +### Configure git + +repo requires you to identify yourself to sync Android + +```bash +git config --global user.email "you@example.com" +git config --global user.name "Your Name" +``` + +### (optional) Turn on caching to speed up build + +Update your build environment + +```bash +gedit ~/.bashrc +``` + +Add the following + +```bash +export USE_CCACHE=1 +export CCACHE_EXEC=/usr/bin/ccache +export CCACHE_COMPRESS=1 +``` + +### Initialize the LineageOS source repository + +Create the project folder and download the source code + +```bash +mkdir -p ~/android/lineage +cd ~/android/lineage +repo init -u https://github.com/LineageOS/android.git -b lineage-17.1 +``` + +Now let's add this very device repo to the local_manifest + +```bash +gedit cd ~/android/lineage/.repo/local_manifests/roomservice.xml +``` + +Add the following + +```xml + + + + + + + + +``` + +If you want to build with GAPPS included add the following to the manifest-tag + +```xml + + + + + + + + + +``` + +If you want to build with Magisk included add the following to the manifest-tag + +```xml + +``` + +To finish everything up sync the repo + +```bash +cd ~/android/lineage +repo sync --force-sync +``` + +If you included GAPPS you also need to sync git-lfs + +```bash +cd vendor/opengapps/sources +for d in ./*/ ; do (cd "$d" && git lfs pull); done +``` + +## (optional) Configure GAPPS for the device + +If you don't want to include GAPPS at all or want to change the apps to be installed + +```bash + gedit ~/android/lineage/device/Unihertz/Atom_LXL/gapps_prop.mk +``` + +[Documentation of the possible settings](https://github.com/opengapps/aosp_build/blob/master/README.md) + +## Extracting the vendor blobs + +### Use imjtool (formerly known as imgtool) to extract from stock rom files + +First follow [the instructions to extract and mount the stock rom files](HOW-TO-EXTRACT_FILES.md) + +Then extract all the files we need + +```bash +# For the Atom L use +~/android/lineage/device/Unihertz/Atom_L/extract-files.sh ~/unihertz/extracted +# For the Atom XL use +~/android/lineage/device/Unihertz/Atom_XL/extract-files.sh ~/unihertz/extracted +``` + +### Use an allready rooted device + +If you were able to root your device this is just a small step. Plug in your device and do the follwing + +```bash +# For the Atom L use +~/android/lineage/device/Unihertz/Atom_L/extract-files.sh +# For the Atom XL use +~/android/lineage/device/Unihertz/Atom_XL/extract-files.sh +``` + +## Building the rom + +Prepare the build + +```bash +cd ~/android/lineage +source build/envsetup.sh +# For the Atom L use +breakfast Atom_L +# For the Atom XL use +breakfast Atom_XL +``` + +Do the actual build + +```bash +cd ~/android/lineage +ccache -M 50G +croot +# For the Atom L use +brunch Atom_L +# For the Atom XL use +brunch Atom_XL +``` + +## Updating the sorces (at a later time) + +Make sure everything is up-to-date + +```bash +cd ~/android/lineage +repo sync --force-sync +``` + +If you changed the settings of TWRP and GAPPS sadly you need to redo them now. + +Also don't forget to sync git-lfs if you included GAPPS + +```bash +cd vendor/opengapps/sources +for d in ./*/ ; do (cd "$d" && git lfs pull); done +``` diff --git a/docs/HOW-TO-EXTRACT_FILES.md b/docs/HOW-TO-EXTRACT_FILES.md new file mode 100644 index 0000000..89ad970 --- /dev/null +++ b/docs/HOW-TO-EXTRACT_FILES.md @@ -0,0 +1,70 @@ +How to extract informations from the Unihertz Atom L and XL +================================================= + +### How-To to extract boot.img and recovery.img + +Make sure unpack_bootimg is build + +```bash +cd ~/android/lineage +source build/envsetup.sh +# For the Atom L use +breakfast Atom_L +# For the atom XL use +breakfast Atom_XL +make unpack_bootimg +``` + +unpack_bootimg will be built in + + ~/android/lineage/out/host/linux-x86/bin/unpack_bootimg + +Use it to extract all required infos from boot.img and recovery.img of the stock rom + +```bash +~/android/lineage/out/host/linux-x86/bin/unpack_bootimg --boot_img boot.img --out boot +~/android/lineage/out/host/linux-x86/bin/unpack_bootimg --boot_img recovery.img --out recovery +``` + +You will get all informations required for BoardConfig.mk and a kernel, a dtb and a dtbo file (only from recovery). + +### How to extract files directly from the stock rom + +At first you need to download and install imjtool (formerly known as imgtool) + +```bash +mkdir -p ~/bin +wget http://newandroidbook.com/tools/imjtool.tgz +tar -xzf imjtool.tgz -C ~/bin +``` + +Then download the latest ROM from [Unihertz' Google Drive](https://drive.google.com/drive/folders/0By1nhWOmuw2KdDhTUlFOZHpXQjg?sort=13&direction=a). Because these archives are different from release to release I cannot tell you exactly where to find them and how the are structured. You just need to extract the file **super.img** and put it into a folder where you could easily find it. For this example I put it into **~/unihertz**. + +Now we need to extract the different images from the super.img + +```bash +cd ~/unihertz +rm -rf extracted/ +imjtool super.img extract +imjtool extracted/image.img extract +``` + +Next we need to mount them into the filesystem + +```bash +cd ~/unihertz/extracted +mkdir -p system/ +sudo mount -o loop system.img system/ +sudo mount -o loop vendor.img system/vendor/ +sudo mount -o loop product.img system/product +``` + +Now you can browse your phones filesystem and extract everything you need + +To cleanup just unmout the images + +```bash +sudo umount ~/unihertz/extracted/system/product +sudo umount ~/unihertz/extracted/system/vendor +sudo umount ~/unihertz/extracted/system +``` diff --git a/docs/HOW-TO-EXTRACT_SEPOLICY.md b/docs/HOW-TO-EXTRACT_SEPOLICY.md new file mode 100644 index 0000000..c3cf728 --- /dev/null +++ b/docs/HOW-TO-EXTRACT_SEPOLICY.md @@ -0,0 +1,75 @@ +How to extract sepolicies from the Unihertz Atom L and XL +================================================= + +### Why would you even do that? + +At first a little bit of warning: +I'm not sure if this is the right approach to get everything selinux-wise in order but at least at the time of me writing these lines it gave me a pretty good look into the depths of the system and how everything interconnects. + +### Where do I get the stock files from? + +First follow [the instructions to extract and mount the stock rom files](HOW-TO-EXTRACT_FILES.md). +The sepolicies are stored in two folders inside the extracted strock rom: `system/etc/sepolicy` and `system/vendor/etc/sepolicies`. + +### These files look okay to me. Why can't I directly use them? + +The files are in a combined and somewhat precompiled state. +Therefore one is forced to extract the parts needed and then convert it into a format that it can be reintegrated as a type enforcement (.te-file) into another build. + +### But... But these files are HUGE! How do I make sure that I find everything that I need? + +That's why I created a little python script to help with this tedious task. +You can find `extract_sepolicy.py`, `extract_sepolicy_plat.py` and `extract_sepolicy_vend.py` in my lineage repository in the folder `tools`. + +### At first you had my curiosity. Now you have my attention. What else do I need? + +First create a folder named `sepolicy` where you can find it easily. +Copy the files `extract_sepolicy.py`, `extract_sepolicy_plat.py` and `extract_sepolicy_vend.py` into this folder. +Next create another folder named `stock` inside this folder. +After that copy all files with the extension `cil` or without a file extension at all from the folders `system/etc/sepolicy` and `system/vendor/etc/sepolicies` of the extracted strock rom into the folder `stock`. +You should have the following files now: +- `plat_file_contexts` +- `plat_hwservice_contexts` +- `plat_property_contexts` +- `plat_pub_versioned.cil` +- `plat_sepolicy.cil` +- `plat_service_contexts` +- `vendor_file_contexts` +- `vendor_hwservice_contexts` +- `vendor_property_contexts` +- `vendor_sepolicy.cil` +- `vndservice_contexts` + +Now you are good to go. + +### But how ... ? + +Glad you asked. +You need to find out what parts of the stock rom policies your device really needs. +This is best achieved by running `adb -d logcat > logcat.txt` while you use the phone or reproducing some errors that should not happen. +Next look out for lines containing `avc: denied` in the logcat file. +In those lines you will also find a `scontext` which is the thing we are looking for. +Inbetween `u:r:` and `:s0` you will find the name of the program (or better say context) that's denied access to a ressource. + +Now run `python extract_sepolicy_plat.py ` an you get a file named `.te` which includes everything there is in the stock rom regarding this context. +Normally the vendor sepolicy should not be tempered with but you can use `python extract_sepolicy_vend.py ` to get the type enforcing informations from the vendor partition. + +### So I just need to include this file in my device tree and I'm goot to go? + +Not so fast my dear friend. +You still need to split the file and put the individual parts into the right files of the sepolicy folder in your device tree: +- `##### ATTRIBUTES #####` goes into the file `attributes`. +- `##### FILES #####` goes into the file `file_contexts`. +- `##### PROPERTIES #####` goes into the file `property_contexts`. +- `##### SERIVCES #####` goes into the file `service_contexts`. +- `##### HWSERVICES #####` goes into the file `hwservice_contexts`. +- `##### GENFS #####` goes into the file `genfs_contexts`. +- `##### POLICIES #####` goes into a file with the extension `te` (It's on you to decide how you want to manage these files). +- `##### REMAINING #####` should not be there except somethin is found, that could not be extracted in one of the other sections. +- `##### FOREIGNS #####` only shows others contexts that point to the current context and can be ignored for now. + +### Why so complicated? Why didn't you use one of the many apps to log avc:denied and then create the proper rules? + +Honestly then I wouldn't have learned a thing from it. +Also these tools that you mentioned often need more than one go to find everything needed and also do a little bit too much. +Not every denial should be fixed. diff --git a/docs/HOW-TO-FLASH-STOCK.md b/docs/HOW-TO-FLASH-STOCK.md new file mode 100644 index 0000000..4395866 --- /dev/null +++ b/docs/HOW-TO-FLASH-STOCK.md @@ -0,0 +1,40 @@ +How to use the SP Flash Tool for MTK based devices. +================================================= + +Let's say you don't want to use this awesome LineageOS ROM anymore or you just want to experince once more the bloated feeling of having so many apps you don't really use. Say no more. +In this guide I'll use Windows cause honestly that's the only way I know of and all other guides use it too but are not up-to-date. + +## Installing the MTK USB Drivers + +1. Download the [latest MTK USB Drivers](https://mtkusballdriver.com/). As of me writing this the latest version was v1.0.8. +2. Extracting the downloaded zip you should find an executable which you need to run. +3. Don't get startled because the installer is in chineese but it behaves like every other installer. Just click on the button that's normally entitled "Next" until the installer is finished. +4. What it does is simply extracting the real installer. By default it will create a folder on your desktop containing all necessary files. +5. Search for a folder starting with `Driver_Auto_Installer` and the highest number. As of me writing this it was `Driver_Auto_Installer_.1632`. +6. Exectue the installer inside this folder and follow the on screen instructions. Don't worry this time it's in english. +7. Maybe you need to restart and after that you are finished. + +## Preparing the SP Flash Tool + +1. Download the [latest SP Flash Tool](https://spflashtools.com/category/windows). As of me writing this the latest version was v5.2052. +2. Extract the downloaded zip to a folder of your choosing. + +## Downloading the Stock ROM + +1. Download the [latest Stock ROM](https://drive.google.com/drive/folders/1vdpRcZ2aGlpLCPVi3vh3EE6UjVZzSMq8?sort=13&direction=a). +2. Extract the downloaded zip to a folder of your choosing. + +## Flashing the Stock ROM + +![](images/spflash.png) + +Since the time Unihertz created their [instructions to flash a ROM](https://drive.google.com/drive/folders/0By1nhWOmuw2KdDhTUlFOZHpXQjg?sort=13&direction=a) and now a lot has changed in the SP Flash Tool. Gone are all those unnecessary port scans. + +1. Start `flash_tool.exe`. +2. Choose the scatter file from the directory you extracted the stock ROM into. +3. Select `Firmware Upgrade` from the dropdown menu. +4. Hit `Download`. +5. Power down your phone. +6. Connect your phone to your PC. +7. Turn on your phone. +8. The flashing should begin right away. diff --git a/docs/HOW-TO-FLASH-SUPER.md b/docs/HOW-TO-FLASH-SUPER.md new file mode 100644 index 0000000..789063a --- /dev/null +++ b/docs/HOW-TO-FLASH-SUPER.md @@ -0,0 +1,144 @@ +How to modify super.img and then flash it onto the device. +================================================= + +For some reason I don't know of yet the install script won't be able to change the partition size inside `super.img`. +When this happens the recovery will only schon an error 7 mentioning an "assert failure" with `dynamic_partitions_op_list`. +To overcome this problem you need to change the partiton layout manually on your computer and then flash the whole `super.img` back onto the device. + +## Installing needed utilities + +### Install brotli + +First of you need brotli to uncompress the image files + +```bash +sudo apt install brotli +``` + +### Install lpmake + +Make sure lpmake is build + +```bash +cd ~/android/lineage +source build/envsetup.sh +# For the Atom L use +breakfast Atom_L +# For the Atom XL use +breakfast Atom_XL +make lpmake +``` + +### Install sdat2img.py + +Download sdat2img.py + +```bash +mkdir -p ~/bin +cd ~/bin +wget https://raw.githubusercontent.com/xpirt/sdat2img/master/sdat2img.py +chmod 755 sdat2img.py +``` + +Update your PATH variable for your environment + +```bash +gedit ~/.profile +``` + +Add the following + +```bash +# set PATH so it includes user's private bin if it exists +if [ -d "$HOME/bin" ] ; then + PATH="$HOME/bin:$PATH" +fi +``` + +Then update your environment + +```bash +source ~/.profile +``` + +## Extracting image files from stock rom files + +Follow [the instructions to extract the stock rom files](HOW-TO-EXTRACT_FILES.md) to the point where you get `system.img`, `vendor.img` and `product.img`. +For this guide we only need `vendor.img` because the other two files are provided from the LineageOS rom. +Create the folder `~/super` and copy `vendor.img` into it. + +## Extracting image files from LineageOS rom files + +- [Atom L Releases](https://github.com/ADeadTrousers/android_device_Unihertz_Atom_L/releases) +- [Atom XL Releases](https://github.com/ADeadTrousers/android_device_Unihertz_Atom_XL/releases) + +Download `lineage-17.1-XXX-UNOFFICIAL-YYY-signed.zip` from the latest release page of your device. +Extract the files from the zip archive into `~/super`. + +Then we need to extract the brotli compressed files + +```bash +brotli --decompress system.new.dat.br -o system.new.dat +brotli --decompress product.new.dat.br -o product.new.dat +``` + +Finally we need to create real ext4 image files for further useage + +```bash +sdat2img.py system.transfer.list system.new.dat system.img +sdat2img.py product.transfer.list product.new.dat product.img +``` + +## (optional) Modifying system.new.dat and product.new.dat + +If you want to now is the time to add or remove things from the installation file. +You just need to mount the images and do your worst. + +## Creating super.img + +First we need to get the exact sizes of all the image files + +```bash +stat -c '%n %s' vendor.img +stat -c '%n %s' system.img +stat -c '%n %s' product.img +``` + +Alternativly you could also use the filesizes from the zip archive in `dynamic_partitions_op_list`. +Theses sizes are a bit bigger so you are able to add additional components like Gapps or Magisk later on. + +With these number we are now able to create the `super.img` + +```bash +~/android/lineage/out/host/linux-x86/bin/lpmake \ + --metadata-size 65536 \ + --super-name super \ + --metadata-slots 1 \ + --device super:4831838208 \ + --group main:4432629760 \ + --partition system:readonly:3384295424:main --image system=./system.img \ + --partition vendor:readonly:349093888:main --image vendor=./vendor.img \ + --partition product:readonly:699240448:main --image product=./product.img \ + --sparse \ + --output ./super.img +``` + +Beware that the numbers in this example are not universally valid. You need to adjust them to your needs. +- `-- metadata-size`: The maximum size that partition metadata may consume. A partition entry uses 64 bytes and an extent entry uses 16 bytes. I think 65536 should work in most cases. +- `-- metadata-slots`: The number of slots available for storing metadata. This should match the number of update slots on the device, 2 for A/B devices and 1 for non-A/B. +- `-- device super`: The size of the `super` partition on the device. It must match exactly, and it must be evenly divisible by the sector size (512 bytes). Best way to get this number is from the scatter file of the stock rom archive. +- `-- group main`: The sum of all partitions files sizes. +- `-- partition`: Every partition file size with permissions(readonly) and input img file. + +## Flashing super.img with TWRP recovery + +1. Connect your phone to your PC and open a terminal or a command line window. +2. Run `adb reboot recovery` on your PC or simply hold volume up while turning power on to boot your device into the recovery. +3. Wait for TWRP to boot. +4. Run `adb push super.img /external_sd`. +5. In TWRP select `Install`. +6. Use `Select Storage` to switch to your SD card. +7. Use `Install Image` to switch to image installation mode. +8. Select `super.img` from the list. +9. Select `Super` partition. +10. Swipe the slider on the bottom to the right to confirm. diff --git a/docs/HOW-TO-INSTALL.md b/docs/HOW-TO-INSTALL.md new file mode 100644 index 0000000..24783ee --- /dev/null +++ b/docs/HOW-TO-INSTALL.md @@ -0,0 +1,102 @@ +How to install LineageOS 17.1 for the Unihertz Atom L and XL +================================================= + +## Getting adb and fastboot + +### Linux or MacOS + +If you are using a Linux or a similar operating system on your PC or Mac chances are very high that you already have these two applications installed. +Open a terminal and exectute the following commands. + +```bash +adb version +fastboot --version +``` + +If one or both of these output an error you need to (re-)install adb and fastboot. + +```bash +wget https://dl.google.com/android/repository/platform-tools-latest-linux.zip +unzip platform-tools-latest-linux.zip -d ~ +``` + +Update your PATH variable for your environment + +```bash +gedit ~/.profile +``` + +Add the following + +```bash +# add Android SDK platform tools to path +if [ -d "$HOME/platform-tools" ] ; then + PATH="$HOME/platform-tools:$PATH" +fi +``` + +Then update your environment + +```bash +source ~/.profile +``` + +### Windows + +Download [the latest version of adb and fastboot](https://dl.google.com/android/repository/platform-tools-latest-windows.zip) to a directory of your choice and extract the archive. + +## Unlocking + +To be able to install anything on the Unihertz Atom L or XL we first need to unlock the bootloader. + +1. Boot your device into the official OS. +2. Go to `Settings > About phone`, tap the "build number" several times to enable developer settings. +3. Go to `Settings > System > Developer Settings`, enable OEM unlocking and ADB debugging. +4. Connect your phone to your PC and open a terminal or a command line window. +5. Run `adb reboot bootloader` on your PC (there is no way to enter bootloader directly, only possible through adb). +6. Once your device has finished booting run `fastboot flashing unlock` and comfirm unlock on device (**THIS WILL WIPE ALL DATA!**). +6. Run `fastboot reboot` to reboot your device and now you should see an unlocked warning during boot screen. + +## Disabling AVB (Android Verified Boot) + +To get LineageOS to boot proberly we also need to disable AV. Otherwise the bootloader will check the ROM with the wrong authorization keys and prevent the loading. + +- [Atom L Releases](https://github.com/ADeadTrousers/android_device_Unihertz_Atom_L/releases) +- [Atom XL Releases](https://github.com/ADeadTrousers/android_device_Unihertz_Atom_XL/releases) + +1. Download `vbmeta.img` from the latest release page of your device. +2. Connect your phone to your PC and open a terminal or a command line window. +3. Run `adb reboot bootloader` on your PC to put your device in bootloader mode. +4. Once your device has finished booting run `fastboot flash --disable-verification --disable-verity vbmeta vbmeta.img`. +5. Then run `fastboot flash --disable-verification --disable-verity vbmeta_system vbmeta.img`. +6. Also run `fastboot flash --disable-verification --disable-verity vbmeta_vendor vbmeta.img`. + +## Installing TWRP recovery + +- [Atom L Releases](https://github.com/ADeadTrousers/twrp_device_Unihertz_Atom_L/releases) +- [Atom XL Releases](https://github.com/ADeadTrousers/twrp_device_Unihertz_Atom_XL/releases) + +1. Download `recovery.img` from the latest release page of your device. +2. Connect your phone to your PC and open a terminal or a command line window. +3. Run `adb reboot bootloader` on your PC to put your device in bootloader mode. +4. Once your device has finished booting run `fastboot flash recovery recovery.img`. +5. Run `fastboot reboot` and after the screen goes dark press volume up until you see the TWRP logo. +6. Now you need to install a new ROM because booting into stock ROM will replace TWRP with the stock recovery. + +## Installing LineageOS ROM + +- [Atom L Releases](https://github.com/ADeadTrousers/android_device_Unihertz_Atom_L/releases) +- [Atom XL Releases](https://github.com/ADeadTrousers/android_device_Unihertz_Atom_XL/releases) + +1. Download `lineage-17.1-XXX-UNOFFICIAL-YYY-signed.zip` from the latest release page of your device. +2. Connect your phone to your PC and open a terminal or a command line window. +3. Run `adb reboot recovery` on your PC or simply hold volume up while turning power on to boot your device into the recovery. +4. In TWRP select `Wipe > Advanced Wipe`. +5. Tick `Dalvik / ART Cache`, `Cache`, `Data`, `Internal Storage`. +6. Swipe the slider on the bottom to the right to confirm. (**THIS WILL WIPE ALL DATA!**) +7. Go back to the home screen and select `Advanced > ADB Sideload`. +8. Swipe the slider on the bottom to the right to confirm. +9. Run `adb sideload lineage-17.1-XXX-UNOFFICIAL-YYY.zip` from your PC. +10. Wait for the process to finish. The recovery might prompt something about verification failure, just ignore it and continue anyway. +11. (Optional) At this point, you can then sideload the latest Magisk and/or OpenGAPPS Nano at your will. Note that the size of the system partition might only be enough for the "nano" variant of OpenGAPPS. If installing Magisk / OpenGAPPS fails, you can try rebooting into recovery again in advanced menus, then try installing them again. +12. Select `Reboot System` to reboot into LineageOS and enjoy. Note that Magisk might cause your device to boot loop once or twice but it will eventually boot. diff --git a/docs/HOW-TO-UPDATE.md b/docs/HOW-TO-UPDATE.md new file mode 100644 index 0000000..6f852a9 --- /dev/null +++ b/docs/HOW-TO-UPDATE.md @@ -0,0 +1,41 @@ +How to update LineageOS 17.1 for the Unihertz Atom L and XL +================================================= + +Every piece of software should allways kept up-to-date. Therefore even this ROM get updates from time to time and you should allways apply these to your device. + +## (optional) Updating TWRP recovery + +- [Atom L Releases](https://github.com/ADeadTrousers/twrp_device_Unihertz_Atom_L/releases) +- [Atom XL Releases](https://github.com/ADeadTrousers/twrp_device_Unihertz_Atom_XL/releases) + +1. Download `recovery.img` from the latest release page of your device. +2. Connect your phone to your PC and open a terminal or a command line window. +3. Run `adb reboot recovery` on your PC or simply hold volume up while turning power on to boot your device into the recovery. +4. Wait for TWRP to boot. +5. Run `adb push recovery.img /external_sd`. +6. In TWRP select `Install`. +7. Use `Select Storage` to switch to your SD card. +8. Use `Install Image` to switch to image installation mode. +9. Select `recovery.img` from the list. +10. Select `Recovery` partition. +11. Swipe the slider on the bottom to the right to confirm. + +## Updating LineageOS ROM + +- [Atom L Releases](https://github.com/ADeadTrousers/android_device_Unihertz_Atom_L/releases) +- [Atom XL Releases](https://github.com/ADeadTrousers/android_device_Unihertz_Atom_XL/releases) + +1. Download `lineage-17.1-XXX-UNOFFICIAL-YYY-signed.zip` from the latest release page of your device. +2. Connect your phone to your PC and open a terminal or a command line window. +3. Run `adb reboot recovery` on your PC or simply hold volume up while turning power on to boot your device into the recovery. +4. (Optional) In TWRP select `Wipe > Advanced Wipe`. +5. (Optional) Tick `Dalvik / ART Cache`, `Cache`, `Data`, `Internal Storage`. +6. (Optional) Swipe the slider on the bottom to the right to confirm. (**THIS WILL WIPE ALL DATA!**) +7. Go back to the home screen and select `Advanced > ADB Sideload`. +8. Swipe the slider on the bottom to the right to confirm. +9. Run `adb sideload lineage-17.1-XXX-UNOFFICIAL-YYY.zip` from your PC. +10. Wait for the process to finish. The recovery might prompt something about verification failure, just ignore it and continue anyway. +11. (Optional) You need to flash all the additional modules that you previously installed. +12. Select `Reboot System` to reboot into LineageOS and enjoy. Note that Magisk might cause your device to boot loop once or two but it will eventually boot. + +Steps 4 to 6 are optional but if you encounter any errors later on you are on your own. diff --git a/docs/README.md b/docs/README.md new file mode 100644 index 0000000..9ba372e --- /dev/null +++ b/docs/README.md @@ -0,0 +1,10 @@ +Documentations for the Unihertz Atom L and XL +================================================= + +- [HOW-TO-BUILD.md](HOW-TO-BUILD.md) - Building instructions for LineageOS 17.1. +- [HOW-TO-INSTALL.md](HOW-TO-INSTALL.md) - Installation instructions for the Atom L/XL. +- [HOW-TO-UPDATE.md](HOW-TO-UPDATE.md) - Update instructions for the Atom L/XL. +- [HOW-TO-EXTRACT_FILES.md](HOW-TO-EXTRACT_FILES.md) - Instructions to extract files directly from the Atom L/XL stock rom files. +- [HOW-TO-EXTRACT_SEPOLICY.md](HOW-TO-EXTRACT_SEPOLICY.md) - A little guide to extract sepolicy rules from stock or phone. +- [HOW-TO-FLASH-STOCK.md](docs/HOW-TO-FLASH-STOCK.md) - Instructions on how to use the SP Flash Tool for MTK based devices. +- [HOW-TO-FLASH-SUPER.md](docs/HOW-TO-FLASH-SUPER.md) - Instructions on how to modify super.img and flashing it onto the device. diff --git a/extract-files-common.sh b/extract-files-common.sh new file mode 100755 index 0000000..7535c80 --- /dev/null +++ b/extract-files-common.sh @@ -0,0 +1,75 @@ +#!/bin/bash +# +# Copyright (C) 2020 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. +# + +# Load extract_utils and do some sanity checks +MY_DIR="${BASH_SOURCE%/*}" +if [[ ! -d "${MY_DIR}" ]]; then MY_DIR="${PWD}"; fi + +LINEAGE_ROOT="${MY_DIR}"/../../.. + +HELPER="${LINEAGE_ROOT}/vendor/lineage/build/tools/extract_utils.sh" +if [ ! -f "${HELPER}" ]; then + echo "Unable to find helper script at ${HELPER}" + exit 1 +fi +source "${HELPER}" + +function blob_fixup() { + case "${1}" in + esac +} + +# Default to sanitizing the vendor folder before extraction +CLEAN_VENDOR=true + +SECTION= +KANG= + +while [ "${#}" -gt 0 ]; do + case "${1}" in + -n | --no-cleanup ) + CLEAN_VENDOR=false + ;; + -k | --kang ) + KANG="--kang" + ;; + -s | --section ) + SECTION="${2}"; shift + CLEAN_VENDOR=false + ;; + * ) + SRC="${1}" + ;; + esac + shift +done + +if [ -z "${SRC}" ]; then + SRC="adb" +fi + +# Initialize the helper for common device +setup_vendor "${DEVICE}" "${VENDOR}" "${LINEAGE_ROOT}" false "${CLEAN_VENDOR}" + +extract "${MY_DIR}/proprietary-files-common.txt" "${SRC}" \ + "${KANG}" --section "${SECTION}" +extract "${LINEAGE_ROOT}/device/${VENDOR}/${DEVICE}/proprietary-files.txt" "${SRC}" \ + "${KANG}" --section "${SECTION}" + +COMMON_BLOB_ROOT="${LINEAGE_ROOT}/vendor/${VENDOR}/${DEVICE}/proprietary" + +"${LINEAGE_ROOT}/device/${VENDOR}/${DEVICE}/setup-makefiles.sh" diff --git a/gapps_prop.mk b/gapps_prop.mk new file mode 100644 index 0000000..08beaac --- /dev/null +++ b/gapps_prop.mk @@ -0,0 +1,38 @@ +# +# Copyright (C) 2020 The LineageOS Project +# +# SPDX-License-Identifier: Apache-2.0 +# + +# GAPPS settings +# For examples see https://github.com/opengapps/aosp_build +# Here I only used the lowest set of apps including all overwrites according to "super" to save space +GAPPS_VARIANT := pico + +GAPPS_FORCE_PACKAGE_OVERRIDES := true +GAPPS_FORCE_PIXEL_LAUNCHER := true +# Workaround for now to get Velvet (Google QuickSearch) to work +DONT_UNCOMPRESS_PRIV_APPS_DEXS := true + +GAPPS_PRODUCT_PACKAGES += \ + CalculatorGoogle \ + CalendarGooglePrebuilt \ + GoogleCamera \ + CarrierServices \ + Chrome \ + PrebuiltDeskClockGoogle \ + GoogleContacts \ + GoogleDialer \ + PrebuiltExchange3Google \ + PrebuiltGmail \ + LatinImeGoogle \ + Maps \ + PrebuiltBugle \ + PixelLauncher \ + Photos \ + GooglePrintRecommendationService \ + Velvet \ + StorageManagerGoogle \ + TagGoogle \ + Wallpapers \ + WebViewGoogle diff --git a/idc/mtk-kpd.idc b/idc/mtk-kpd.idc new file mode 100644 index 0000000..6ba79f8 --- /dev/null +++ b/idc/mtk-kpd.idc @@ -0,0 +1,29 @@ +# Copyright (C) 2010 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. + +# +# Emulator keyboard configuration file #2. +# + +touch.deviceType = touchScreen +touch.orientationAware = 1 + +keyboard.layout = mtk-kpd +keyboard.characterMap = qwerty +keyboard.orientationAware = 1 +keyboard.builtIn = 1 + +cursor.mode = navigation +cursor.orientationAware = 1 + diff --git a/keylayout/fingerprint_key.kl b/keylayout/fingerprint_key.kl new file mode 100644 index 0000000..d0a1c16 --- /dev/null +++ b/keylayout/fingerprint_key.kl @@ -0,0 +1 @@ +key 172 HOME VIRTUAL diff --git a/keylayout/mtk-kpd.kl b/keylayout/mtk-kpd.kl new file mode 100644 index 0000000..931d395 --- /dev/null +++ b/keylayout/mtk-kpd.kl @@ -0,0 +1,101 @@ +key 399 GRAVE +key 2 1 +key 3 2 +key 4 3 +key 5 4 +key 6 5 +key 7 6 +key 8 7 +key 9 8 +key 10 9 +key 11 0 +key 158 BACK +key 230 SOFT_RIGHT +key 60 SOFT_RIGHT +key 107 ENDCALL +key 62 ENDCALL +key 229 MENU +key 139 MENU +key 59 MENU +key 127 SYM +key 217 SEARCH +key 228 POUND +key 227 STAR +key 231 CALL +key 61 CALL +key 232 DPAD_CENTER +key 108 DPAD_DOWN +key 103 DPAD_UP +key 102 HOME +key 105 DPAD_LEFT +key 106 DPAD_RIGHT +key 115 VOLUME_UP +key 114 VOLUME_DOWN +key 113 MUTE +key 116 POWER +key 212 CAMERA +key 211 FOCUS + +key 16 Q +key 17 W +key 18 E +key 19 R +key 20 T +key 21 Y +key 22 U +key 23 I +key 24 O +key 25 P +key 26 LEFT_BRACKET +key 27 RIGHT_BRACKET +key 43 BACKSLASH + +key 30 A +key 31 S +key 32 D +key 33 F +key 34 G +key 35 H +key 36 J +key 37 K +key 38 L +key 39 SEMICOLON +key 40 APOSTROPHE +key 14 DEL + +key 44 Z +key 45 X +key 46 C +key 47 V +key 48 B +key 49 N +key 50 M +key 51 COMMA +key 52 PERIOD +key 53 SLASH +key 28 ENTER + +key 56 ALT_LEFT +key 100 ALT_RIGHT +key 42 SHIFT_LEFT +key 54 SHIFT_RIGHT +key 15 TAB +key 57 SPACE +key 150 EXPLORER +key 155 ENVELOPE + +key 12 MINUS +key 13 EQUALS +key 215 AT + +key 164 MEDIA_PLAY_PAUSE +key 128 MEDIA_STOP +key 163 MEDIA_NEXT +key 165 MEDIA_PREVIOUS +key 168 MEDIA_REWIND +key 159 MEDIA_FAST_FORWARD + +# agold add +key 249 ASSIST +key 250 SEARCH + diff --git a/keylayout/mtk-tpd-kpd.kl b/keylayout/mtk-tpd-kpd.kl new file mode 100644 index 0000000..1bb6e14 --- /dev/null +++ b/keylayout/mtk-tpd-kpd.kl @@ -0,0 +1,2 @@ +key 158 BACK VIRTUAL +key 580 APP_SWITCH VIRTUAL diff --git a/overlay-lineage/lineage-sdk/lineage/res/res/values/config.xml b/overlay-lineage/lineage-sdk/lineage/res/res/values/config.xml new file mode 100644 index 0000000..67762fd --- /dev/null +++ b/overlay-lineage/lineage-sdk/lineage/res/res/values/config.xml @@ -0,0 +1,76 @@ + + + + + 91 + + + 64 + + 67 + diff --git a/overlay-remove/FrameworkResOverlay/Android.mk b/overlay-remove/FrameworkResOverlay/Android.mk new file mode 100644 index 0000000..eeb0ee3 --- /dev/null +++ b/overlay-remove/FrameworkResOverlay/Android.mk @@ -0,0 +1,14 @@ +LOCAL_PATH := $(call my-dir) + +include $(CLEAR_VARS) + +LOCAL_IS_RUNTIME_RESOURCE_OVERLAY := true + +LOCAL_CERTIFICATE := platform + +LOCAL_PACKAGE_NAME := FrameworkResOverlay +LOCAL_SDK_VERSION := current + +LOCAL_MODULE_PATH := $(TARGET_OUT_PRODUCT)/vendor_overlay/$(PRODUCT_TARGET_VNDK_VERSION)/overlay/FrameworkResOverlay/ + +include $(BUILD_PACKAGE) diff --git a/overlay-remove/FrameworkResOverlay/AndroidManifest.xml b/overlay-remove/FrameworkResOverlay/AndroidManifest.xml new file mode 100644 index 0000000..266271c --- /dev/null +++ b/overlay-remove/FrameworkResOverlay/AndroidManifest.xml @@ -0,0 +1,4 @@ + + + + diff --git a/overlay/frameworks/base/core/res/res/values/config.xml b/overlay/frameworks/base/core/res/res/values/config.xml new file mode 100644 index 0000000..54de25a --- /dev/null +++ b/overlay/frameworks/base/core/res/res/values/config.xml @@ -0,0 +1,173 @@ + + + + + + "usb\\d" + "rndis\\d" + + + + + "wlan0" + "softap.*" + "wifi_br0" + "wigig0" + + + + + bnep\\d + "bt-pan" + + + + + + + + wifi,1,1,1,-1,true + mobile,0,0,0,-1,true + mobile_mms,2,0,2,60000,true + mobile_supl,3,0,2,60000,true + mobile_dun,4,0,2,60000,true + mobile_hipri,5,0,3,60000,true + mobile_fota,10,0,2,60000,true + mobile_ims,11,0,-1,-1,true + mobile_cbs,12,0,2,60000,true + wifi_p2p,13,1,0,-1,true + mobile_ia,14,0,2,-1,true + mobile_emergency,15,0,2,-1,true + mobile_wap,21,0,3,60000,true + mobile_xcap,25,0,3,60000,true + mobile_rcs,26,0,3,60000,true + mobile_bip,27,0,3,60000,true + mobile_vsim,28,0,-1,60000,true + mobile_preempt,29,0,9,60000,true + + + + true + + + true + + + true + + + true + + false + + true + + true + + true + + true + + true + + true + + com.mediatek.ims + + 1 + 130 + + + 8 + 64 + 98 + 104 + 110 + 116 + 122 + 128 + 134 + 182 + 255 + 255 + 255 + 255 + 255 + 255 + 255 + 255 + + + + 128 + 256 + 384 + 512 + 640 + 768 + 896 + 1024 + 2048 + 4096 + 6144 + 8192 + 10240 + 12288 + 14336 + 16384 + 18432 + + diff --git a/overlay/frameworks/base/core/res/res/xml/power_profile.xml b/overlay/frameworks/base/core/res/res/xml/power_profile.xml new file mode 100644 index 0000000..c4b21a0 --- /dev/null +++ b/overlay/frameworks/base/core/res/res/xml/power_profile.xml @@ -0,0 +1,157 @@ + + + 0.1 + 70.2 + 145 + 30 + 0.7 + 0.3 + 200 + 38 + 24 + 35 + 200 + 600 + 45 + 662.5 + 5.5 + + 4.0 + 4.0 + + + 4 + 4 + + + 793000 + 910000 + 1014000 + 1131000 + 1248000 + 1326000 + 1417000 + 1508000 + 1586000 + 1625000 + 1677000 + 1716000 + 1781000 + 1846000 + 1924000 + 1989000 + + + 793000 + 910000 + 1014000 + 1131000 + 1248000 + 1326000 + 1417000 + 1508000 + 1586000 + 1625000 + 1677000 + 1716000 + 1781000 + 1846000 + 1924000 + 1989000 + + + 415 + 2012 + 1818 + 1709 + 1368 + 911 + 942 + 793 + 605 + 314 + 458 + 286 + 421 + 399 + 504 + 2664 + + + 2567 + 4192 + 2150 + 1494 + 892 + 631 + 1106 + 1586 + 1451 + 722 + 888 + 685 + 1398 + 1691 + 3088 + 9887 + + 4.5 + 15 + 9.55 + 2.11 + 2.22 + + 300000 + 1000000 + 2000000 + + + 300000 + 1000000 + 2500000 + 3000000 + + + 10 + 20 + 30 + + + 25 + 35 + 50 + 60 + + + 22.7 + + 4230 + 3 + 200 + 200 + + 3.3 + + .0002 + .002 + .02 + .2 + 2 + + 0 + 0 + 0 + + 0 + 0 + 0 + 0 + 0 + + 0 + + 0 + 0 + + 0 + \ No newline at end of file diff --git a/overlay/packages/apps/Settings/res/values/config.xml b/overlay/packages/apps/Settings/res/values/config.xml new file mode 100644 index 0000000..96fa375 --- /dev/null +++ b/overlay/packages/apps/Settings/res/values/config.xml @@ -0,0 +1,24 @@ + + + + + + + 1 + + diff --git a/patch/apply.sh b/patch/apply.sh new file mode 100755 index 0000000..b950316 --- /dev/null +++ b/patch/apply.sh @@ -0,0 +1,36 @@ +#!/bin/bash + +MYABSPATH=$(readlink -f "$0") +PATCHBASE=$(dirname "$MYABSPATH") +CMBASE=$(readlink -f "$PATCHBASE/../../../../") + +cd "$CMBASE/bootable/recovery" +if git remote -v | grep TeamWin; then + TWRP=true +else + TWRP=false +fi + +for i in $(find "$PATCHBASE"/* -type d); do + PATCHNAME=$(basename "$i") + PATCHTARGET=$PATCHNAME + for j in $(seq 4); do + PATCHTARGET=$(echo $PATCHTARGET | sed 's/_/\//') + if [ -d "$CMBASE/$PATCHTARGET" ]; then break; fi + done + + echo + echo applying $PATCHNAME to $PATCHTARGET + cd "$CMBASE/$PATCHTARGET" || exit 1 + + suffix=".patch" + if [ $PATCHNAME = "bootable_recovery" -a $TWRP = true ]; then suffix=".twrp.patch"; fi + if [ $PATCHNAME = "bootable_recovery" -a $TWRP = false ]; then suffix=".cm.patch"; fi + + if compgen -G "$PATCHBASE/$PATCHNAME/*${suffix}" > /dev/null; then + if ! git am --ignore-whitespace -3 "$PATCHBASE/$PATCHNAME"/*${suffix}; then + git am --abort + exit 1 + fi + fi +done diff --git a/patch/build_make/0001-releasetools-fix-Unicode-objects-must-be-encoded-bef.patch b/patch/build_make/0001-releasetools-fix-Unicode-objects-must-be-encoded-bef.patch new file mode 100644 index 0000000..4b617b0 --- /dev/null +++ b/patch/build_make/0001-releasetools-fix-Unicode-objects-must-be-encoded-bef.patch @@ -0,0 +1,35 @@ +From 1e54b3cf486cf942ecb32e294e8cde1c028e4f8b Mon Sep 17 00:00:00 2001 +From: gesangtome +Date: Tue, 24 Mar 2020 05:47:25 +0800 +Subject: [PATCH] releasetools: fix Unicode-objects must be encoded before + hashing + +This error occurs when using 'ota_from_target_files' to make an incremental package. +According to the prompt, first encode fp to resolve this error. + +build/make/tools/releasetools/common.py", line 448, in LoadInfoDict + d["avb_salt"] = sha256(fp).hexdigest() + +TypeError: Unicode-objects must be encoded before hashing + +Change-Id: I196b3ae37e1fb92be58c48aa8ab0928b6e6aec69 +--- + tools/releasetools/common.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/tools/releasetools/common.py b/tools/releasetools/common.py +index 9f57773ba..d54689bd2 100644 +--- a/tools/releasetools/common.py ++++ b/tools/releasetools/common.py +@@ -445,7 +445,7 @@ def LoadInfoDict(input_file, repacking=False): + elif "ro.build.thumbprint" in build_prop: + fp = build_prop["ro.build.thumbprint"] + if fp: +- d["avb_salt"] = sha256(fp).hexdigest() ++ d["avb_salt"] = sha256(fp.encode()).hexdigest() + + return d + +-- +2.25.1 + diff --git a/patch/frameworks_av/0001-restart-AudioServer-to-sync-with-AudioService.patch b/patch/frameworks_av/0001-restart-AudioServer-to-sync-with-AudioService.patch new file mode 100644 index 0000000..d476118 --- /dev/null +++ b/patch/frameworks_av/0001-restart-AudioServer-to-sync-with-AudioService.patch @@ -0,0 +1,39 @@ +From da764b2424192bdd99ff1e4e28e1daea7ebb75b7 Mon Sep 17 00:00:00 2001 +From: Matthias Leitl +Date: Sat, 28 Nov 2020 11:19:15 +0100 +Subject: [PATCH] restart AudioServer to sync with AudioService + +Change-Id: Ia6b68c4db4e94252cb0d8d39ed9745adeba069fd +--- + media/audioserver/audioserver.rc | 8 +++++--- + 1 file changed, 5 insertions(+), 3 deletions(-) + +diff --git a/media/audioserver/audioserver.rc b/media/audioserver/audioserver.rc +index dfb1a3fb9..7dba4b9a1 100644 +--- a/media/audioserver/audioserver.rc ++++ b/media/audioserver/audioserver.rc +@@ -2,16 +2,18 @@ service audioserver /system/bin/audioserver + class core + user audioserver + # media gid needed for /dev/fm (radio) and for /data/misc/media (tee) +- group audio camera drmrpc inet media mediadrm net_bt net_bt_admin net_bw_acct wakelock ++ group audio camera drmrpc inet media mediadrm net_bt net_bt_admin net_bw_acct wakelock system sdcard_rw + capabilities BLOCK_SUSPEND + ioprio rt 4 + writepid /dev/cpuset/foreground/tasks /dev/stune/foreground/tasks + onrestart restart vendor.audio-hal-2-0 +- onrestart restart vendor.audio-hal-4-0-msd ++ #onrestart restart vendor.audio-hal-4-0-msd + # Keep the original service name for backward compatibility when upgrading + # O-MR1 devices with framework-only. + onrestart restart audio-hal-2-0 +- ++#[ALPS04217601] restart AudioServer to sync with AudioService ++on property:vold.decrypt=trigger_reset_main ++ restart audioserver + on property:vts.native_server.on=1 + stop audioserver + on property:vts.native_server.on=0 +-- +2.25.1 + diff --git a/patch/frameworks_av/0002-Add-drmserver-access-sdcard-and-internal-storage-per.patch b/patch/frameworks_av/0002-Add-drmserver-access-sdcard-and-internal-storage-per.patch new file mode 100644 index 0000000..b6f977b --- /dev/null +++ b/patch/frameworks_av/0002-Add-drmserver-access-sdcard-and-internal-storage-per.patch @@ -0,0 +1,25 @@ +From e805786430c48841dc8a3ff98da165c79e24cac4 Mon Sep 17 00:00:00 2001 +From: Matthias Leitl +Date: Sat, 28 Nov 2020 11:22:06 +0100 +Subject: [PATCH] Add drmserver access sdcard and internal storage permission + +Change-Id: I7caf72d6f106b773c03fd16d891a59e026e4f022 +--- + drm/drmserver/drmserver.rc | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/drm/drmserver/drmserver.rc b/drm/drmserver/drmserver.rc +index de46fb92e..5d9442c4b 100644 +--- a/drm/drmserver/drmserver.rc ++++ b/drm/drmserver/drmserver.rc +@@ -1,5 +1,6 @@ + service drm /system/bin/drmserver + class main + user drm +- group drm system inet drmrpc readproc ++ # Add drmserver access sdcard and internal storage permission ++ group drm system inet drmrpc readproc sdcard_rw media_rw + writepid /dev/cpuset/foreground/tasks +-- +2.25.1 + diff --git a/patch/frameworks_av/0003-Add-mediaextractor-permission-to-read-properties.patch b/patch/frameworks_av/0003-Add-mediaextractor-permission-to-read-properties.patch new file mode 100644 index 0000000..ac4dcbd --- /dev/null +++ b/patch/frameworks_av/0003-Add-mediaextractor-permission-to-read-properties.patch @@ -0,0 +1,25 @@ +From 3b4353d9e456c6f63ae4c8396a4e4b1cece9066f Mon Sep 17 00:00:00 2001 +From: Matthias Leitl +Date: Sat, 28 Nov 2020 11:24:46 +0100 +Subject: [PATCH] Add mediaextractor permission to read properties + +Change-Id: I1c61e25c9a3201a2375cb4ceb1f61353a7a994e2 +--- + services/mediaextractor/mediaextractor.rc | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/services/mediaextractor/mediaextractor.rc b/services/mediaextractor/mediaextractor.rc +index 5fc294111..0f93f41c7 100644 +--- a/services/mediaextractor/mediaextractor.rc ++++ b/services/mediaextractor/mediaextractor.rc +@@ -1,6 +1,6 @@ + service mediaextractor /system/bin/mediaextractor + class main + user mediaex +- group drmrpc mediadrm ++ group drmrpc mediadrm readproc + ioprio rt 4 + writepid /dev/cpuset/foreground/tasks +-- +2.25.1 + diff --git a/patch/frameworks_av/0004-Add-mediaserver-permission-to-read-properties.patch b/patch/frameworks_av/0004-Add-mediaserver-permission-to-read-properties.patch new file mode 100644 index 0000000..c995689 --- /dev/null +++ b/patch/frameworks_av/0004-Add-mediaserver-permission-to-read-properties.patch @@ -0,0 +1,25 @@ +From d3c40dc5e167223fc5cd32a01570c4617e3c7932 Mon Sep 17 00:00:00 2001 +From: Matthias Leitl +Date: Sat, 28 Nov 2020 11:26:54 +0100 +Subject: [PATCH] Add mediaserver permission to read properties + +Change-Id: I31a8c8b83ee80703aba071f7f235997b071ac38d +--- + media/mediaserver/mediaserver.rc | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/media/mediaserver/mediaserver.rc b/media/mediaserver/mediaserver.rc +index f6c325c98..c7c7ce063 100644 +--- a/media/mediaserver/mediaserver.rc ++++ b/media/mediaserver/mediaserver.rc +@@ -1,6 +1,6 @@ + service media /system/bin/mediaserver + class main + user media +- group audio camera inet net_bt net_bt_admin net_bw_acct drmrpc mediadrm ++ group audio camera inet net_bt net_bt_admin net_bw_acct drmrpc mediadrm readproc + ioprio rt 4 + writepid /dev/cpuset/foreground/tasks /dev/stune/foreground/tasks +-- +2.25.1 + diff --git a/patch/packages_apps_FMRadio/0001-Deactivate-unused-error-messages.patch b/patch/packages_apps_FMRadio/0001-Deactivate-unused-error-messages.patch new file mode 100644 index 0000000..52b49cd --- /dev/null +++ b/patch/packages_apps_FMRadio/0001-Deactivate-unused-error-messages.patch @@ -0,0 +1,26 @@ +From 733ccd059ca157826aae4fbbae4550dd1a232f05 Mon Sep 17 00:00:00 2001 +From: Matthias Leitl +Date: Tue, 26 Jan 2021 20:58:37 +0100 +Subject: [PATCH] Deactivate unused error messages + +Change-Id: I544b709c49b983e0c02a0fbf9572ce7d0d6d3c68 +--- + jni/fmr/Android.mk | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/jni/fmr/Android.mk b/jni/fmr/Android.mk +index 90cf5c3..e7027a2 100644 +--- a/jni/fmr/Android.mk ++++ b/jni/fmr/Android.mk +@@ -34,6 +34,8 @@ LOCAL_SHARED_LIBRARIES := \ + libdl \ + libmedia \ + liblog ++ ++LOCAL_CFLAGS += -Wno-unused-parameter -Wno-unused-variable -Wno-unused-function + + LOCAL_MODULE := libfmjni + LOCAL_MODULE_TAGS := optional +-- +2.25.1 + diff --git a/patch/system_bt/0001-Change-vendor-in-bt_did.conf.patch b/patch/system_bt/0001-Change-vendor-in-bt_did.conf.patch new file mode 100644 index 0000000..89443e6 --- /dev/null +++ b/patch/system_bt/0001-Change-vendor-in-bt_did.conf.patch @@ -0,0 +1,27 @@ +From 926741ab6bba20f287714847bf977b3127797cbd Mon Sep 17 00:00:00 2001 +From: Matthias Leitl +Date: Sat, 28 Nov 2020 11:08:33 +0100 +Subject: [PATCH] Change vendor in bt_did.conf + +Change-Id: Ie1053c409766f3ec4935a88532b829dd34f3be57 +--- + conf/bt_did.conf | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/conf/bt_did.conf b/conf/bt_did.conf +index 631cc6df3..942a854f5 100644 +--- a/conf/bt_did.conf ++++ b/conf/bt_did.conf +@@ -9,6 +9,9 @@ primaryRecord = true + # 0x000F = Broadcom Corporation (default) + #vendorId = 0x000F + ++# Set right vendorId ++vendorId = 0x0046 ++ + # Vendor ID Source + # 0x0001 = Bluetooth SIG assigned Device ID Vendor ID value (default) + # 0x0002 = USB Implementer's Forum assigned Device ID Vendor ID value +-- +2.25.1 + diff --git a/patch/vendor_opengapps_build/0001-Allow-Google-Calendar-to-override-Etar.patch b/patch/vendor_opengapps_build/0001-Allow-Google-Calendar-to-override-Etar.patch new file mode 100644 index 0000000..7d766c7 --- /dev/null +++ b/patch/vendor_opengapps_build/0001-Allow-Google-Calendar-to-override-Etar.patch @@ -0,0 +1,26 @@ +From 43cab1c60bccc73bd75114bc9f20cabdfbef05d8 Mon Sep 17 00:00:00 2001 +From: David Trpchevski +Date: Mon, 22 Jun 2020 11:19:21 +0200 +Subject: [PATCH] Allow Google Calendar to override Etar + +Etar is used in LineageOS 17.1+ + +https://review.lineageos.org/c/LineageOS/cm_crowdin/+/276904 + +Signed-off-by: David Trpchevski +--- + modules/CalendarGooglePrebuilt/Android.mk | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/modules/CalendarGooglePrebuilt/Android.mk b/modules/CalendarGooglePrebuilt/Android.mk +index 4d05572..ad2c457 100644 +--- a/modules/CalendarGooglePrebuilt/Android.mk ++++ b/modules/CalendarGooglePrebuilt/Android.mk +@@ -7,6 +7,6 @@ LOCAL_PACKAGE_NAME := com.google.android.calendar + LOCAL_OVERRIDES_PACKAGES := GoogleCalendarSyncAdapter + + GAPPS_LOCAL_OVERRIDES_MIN_VARIANT := +-GAPPS_LOCAL_OVERRIDES_PACKAGES := Calendar ++GAPPS_LOCAL_OVERRIDES_PACKAGES := Calendar Etar + + include $(BUILD_GAPPS_PREBUILT_APK) diff --git a/patch/vendor_opengapps_build/0002-Additional-overrides.patch b/patch/vendor_opengapps_build/0002-Additional-overrides.patch new file mode 100644 index 0000000..07c670f --- /dev/null +++ b/patch/vendor_opengapps_build/0002-Additional-overrides.patch @@ -0,0 +1,38 @@ +From 65b673bf9bcbc6aea6af9de2d5a1f0f0ec318e74 Mon Sep 17 00:00:00 2001 +From: Matthias Leitl +Date: Sat, 7 Nov 2020 14:48:42 +0100 +Subject: [PATCH 1/1] Additional overrides + +Signed-off-by: Matthias Leitl +--- + modules/PrebuiltBugle/Android.mk | 2 +- + modules/PrebuiltExchange3Google/Android.mk | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/modules/PrebuiltBugle/Android.mk b/modules/PrebuiltBugle/Android.mk +index 0489fcf..14b4fa5 100644 +--- a/modules/PrebuiltBugle/Android.mk ++++ b/modules/PrebuiltBugle/Android.mk +@@ -5,6 +5,6 @@ LOCAL_MODULE := PrebuiltBugle + LOCAL_PACKAGE_NAME := com.google.android.apps.messaging + + GAPPS_LOCAL_OVERRIDES_MIN_VARIANT := +-GAPPS_LOCAL_OVERRIDES_PACKAGES := messaging Mms ++GAPPS_LOCAL_OVERRIDES_PACKAGES := messaging Mms Messaging + + include $(BUILD_GAPPS_PREBUILT_APK) +diff --git a/modules/PrebuiltExchange3Google/Android.mk b/modules/PrebuiltExchange3Google/Android.mk +index f493523..774eb53 100644 +--- a/modules/PrebuiltExchange3Google/Android.mk ++++ b/modules/PrebuiltExchange3Google/Android.mk +@@ -4,6 +4,6 @@ include $(GAPPS_CLEAR_VARS) + LOCAL_MODULE := PrebuiltExchange3Google + LOCAL_PACKAGE_NAME := com.google.android.gm.exchange + +-LOCAL_OVERRIDES_PACKAGES := Exchange2 ++LOCAL_OVERRIDES_PACKAGES := Exchange Exchange2 + + include $(BUILD_GAPPS_PREBUILT_APK) +-- +2.25.1 + diff --git a/patch/vendor_opengapps_build/0003-Temporary-workaround-for-failing-during-first-time-i.patch b/patch/vendor_opengapps_build/0003-Temporary-workaround-for-failing-during-first-time-i.patch new file mode 100644 index 0000000..29b9a76 --- /dev/null +++ b/patch/vendor_opengapps_build/0003-Temporary-workaround-for-failing-during-first-time-i.patch @@ -0,0 +1,51 @@ +From 189bbf5700ab455c2698e1a3da85ff3041e058dc Mon Sep 17 00:00:00 2001 +From: Matthias Leitl +Date: Sat, 7 Nov 2020 14:54:14 +0100 +Subject: [PATCH 1/1] Temporary workaround for failing during first time + installation + +Signed-off-by: Matthias Leitl +--- + modules/PixelLauncher/Android.mk | 1 + + modules/StorageManagerGoogle/Android.mk | 1 + + modules/Velvet/Android.mk | 1 + + 3 files changed, 3 insertions(+) + +diff --git a/modules/PixelLauncher/Android.mk b/modules/PixelLauncher/Android.mk +index bf624db..3af6f2e 100644 +--- a/modules/PixelLauncher/Android.mk ++++ b/modules/PixelLauncher/Android.mk +@@ -4,6 +4,7 @@ include $(GAPPS_CLEAR_VARS) + LOCAL_MODULE := PixelLauncher + LOCAL_PACKAGE_NAME := com.google.android.apps.nexuslauncher + LOCAL_PRIVILEGED_MODULE := true ++LOCAL_UNCOMPRESS_DEX := false + + GAPPS_LOCAL_OVERRIDES_PACKAGES := Home GoogleNow Launcher2 Launcher3 Launcher3Go Launcher3QuickStep Launcher3QuickStepGo Fluctuation Trebuchet TrebuchetQuickStep + +diff --git a/modules/StorageManagerGoogle/Android.mk b/modules/StorageManagerGoogle/Android.mk +index d4c7cad..4959d32 100644 +--- a/modules/StorageManagerGoogle/Android.mk ++++ b/modules/StorageManagerGoogle/Android.mk +@@ -4,5 +4,6 @@ include $(GAPPS_CLEAR_VARS) + LOCAL_MODULE := StorageManagerGoogle + LOCAL_PACKAGE_NAME := com.google.android.storagemanager + LOCAL_PRIVILEGED_MODULE := true ++LOCAL_UNCOMPRESS_DEX := false + + include $(BUILD_GAPPS_PREBUILT_APK) +diff --git a/modules/Velvet/Android.mk b/modules/Velvet/Android.mk +index ae7e06f..c27bbaf 100644 +--- a/modules/Velvet/Android.mk ++++ b/modules/Velvet/Android.mk +@@ -4,6 +4,7 @@ include $(GAPPS_CLEAR_VARS) + LOCAL_MODULE := Velvet + LOCAL_PACKAGE_NAME := com.google.android.googlequicksearchbox + LOCAL_PRIVILEGED_MODULE := true ++LOCAL_UNCOMPRESS_DEX := false + + LOCAL_OVERRIDES_PACKAGES := QuickSearchBox + +-- +2.25.1 + diff --git a/product.prop b/product.prop new file mode 100644 index 0000000..6393326 --- /dev/null +++ b/product.prop @@ -0,0 +1,17 @@ +persist.dbg.volte_avail_ovr=1 +persist.dbg.vt_avail_ovr=1 +persist.dbg.wfc_avail_ovr=1 +telephony.lteOnCdmaDevice=1 + +ro.LED_KEYLIGHT_TEST=yes + +ro.agui.single.mic=yes + +ro.LED_COLOR_TEST=yes +ro.low_battery_led=yes +ro.battery_charging_led=yes +ro.miss_call_ledcolor=Red +ro.other_notifi_ledcolor=Green +ro.unread_notifi_ledcolor=Red +ro.incoming_ledcolor=Blue +ro.scridle_ledcolor=None diff --git a/proprietary-files-common.txt b/proprietary-files-common.txt new file mode 100644 index 0000000..4fbf392 --- /dev/null +++ b/proprietary-files-common.txt @@ -0,0 +1,378 @@ +# APNs +etc/apns-conf.xml:product/etc/apns-conf.xml + +# MTK-IMS +-framework/mediatek-common.jar +-framework/mediatek-framework.jar +-framework/mediatek-ims-base.jar +-framework/mediatek-ims-common.jar +-framework/mediatek-telecom-common.jar +-framework/mediatek-telephony-base.jar +-framework/mediatek-telephony-common.jar +-priv-app/ImsService/ImsService.apk +bin/vtservice +etc/init/init.vtservice.rc +etc/permissions/privapp-permissions-mediatek.xml +-framework/mediatek-ims-extension-plugin.jar +-framework/mediatek-ims-legacy.jar +lib/libcomutils.so +lib/libimsma.so +lib/libimsma_adapt.so +lib/libimsma_rtp.so +lib/libimsma_socketwrapper.so +lib/libmtk_vt_service.so +lib/libmtk_vt_wrapper.so +lib/libmtkaudio_utils.so +lib/libmtkavenhancements.so +lib/libmtklimiter.so +lib/libmtkperf_client.so +lib/libmtkshifter.so +lib/libsignal.so +lib/libsink.so +lib/libsource.so +lib/libvcodec_cap.so +lib/libvcodec_capenc.so +lib/libvt_avsync.so +lib/vendor.mediatek.hardware.videotelephony@1.0.so +lib64/libmtk_vt_wrapper.so +lib64/libmtkaudio_utils.so +lib64/libmtkavenhancements.so +lib64/libmtklimiter.so +lib64/libmtkperf_client.so +lib64/libmtkshifter.so +lib64/libvcodec_cap.so +lib64/libvcodec_capenc.so +lib64/vendor.mediatek.hardware.videotelephony@1.0.so +-framework/OPCommonTelephony.jar +framework/arm/boot-OPCommonTelephony.art +framework/arm/boot-OPCommonTelephony.oat +framework/arm64/boot-OPCommonTelephony.art +framework/arm64/boot-OPCommonTelephony.oat + +bin/aee +bin/aee_aed +bin/aee_aed64 +bin/aee_core_forwarder +bin/aee_dumpstate +bin/aee_archive +etc/init/aee_aed.rc +etc/init/aee_aed64.rc +etc/init/hw/init.aee.rc +etc/aee-config + +lib/libaed.so +lib/libdirect-coredump.so +lib/vendor.mediatek.hardware.log@1.0.so +lib64/libaed.so +lib64/libdirect-coredump.so +lib64/vendor.mediatek.hardware.log@1.0.so + +bin/mdlogger +bin/emdlogger1 +bin/emdlogger2 +bin/emdlogger3 +bin/emdlogger5 +bin/sspm_log_writer +etc/init/mdlogger.rc +etc/init/emdlogger1.rc +etc/init/emdlogger2.rc +etc/init/emdlogger3.rc +etc/init/emdlogger5.rc +etc/emdlogger_usb_config.prop +etc/mtklog-config.prop +lib/libmdloggerrecycle.so +lib/libsysenv_system.so +lib64/libccci_util_sys.so +lib64/libmdloggerrecycle.so +lib64/libsysenv_system.so + +bin/loghidlsysservice +bin/AudioSetParam +bin/auto_update +bin/lbs_dbg +bin/lcdc_screen_cap +bin/memtester +bin/met-cmd +bin/move_widevine_data.sh +bin/notify_traceur.override.sh +bin/oem-iptables-init.sh +bin/rtt + +etc/init/hw/vendor_init_as_system.rc +etc/init/init.connectivity.rc + +bin/connsyslogger +etc/init/consyslogger.rc + +bin/batterywarning +etc/init/batterywarning.rc + +bin/kpoc_charger +etc/init/kpoc_charger.rc + +bin/mobile_log_d +etc/init/mobile_log_d.rc + +bin/modemdbfilter_client +etc/init/modemdbfilter_client.rc +lib64/vendor.mediatek.hardware.modemdbfilter@1.0.so + +bin/netdiag +etc/init/netdiag.rc +lib64/libpcap_bak.so + +bin/boot_logo_updater +etc/init/bootlogoupdater.rc +lib/libshowlogo.so + +bin/usp_service +etc/init/usp_service.rc + +bin/terservice +etc/init/terserver.rc +lib64/libterservice.so + +bin/thermald +etc/init/init.thermald.rc + +bin/camerapostalgo +etc/init/camerapostalgo.rc +lib/libcamalgo_sys.autorama.so +lib/libcamalgo_sys.cfb.so +lib/libcamalgo_sys.hdr.so +lib/libcampostalgo.so +lib/libcampostalgo_featurepipe.so +lib/libcampostalgo_interface.so +lib/libpostalgo.plugin.autorama.so +lib/libpostalgo.plugin.fb.so +lib/libpostalgo.plugin.hdr.so +lib/libpostalgo_3rdparty.core.so +lib/libpostalgo_3rdparty.customer.so +lib/libpostalgo_3rdparty.mtk.so +lib/libpostalgo_3rdparty.plugin.features.so +lib/libpostalgo_3rdparty.so +lib/libpostalgo_grallocutils.so +lib/libpostalgo_imgbuf.so +lib/libpostalgo_metadata.so +lib/libpostalgo_stdutils.so +lib64/libcamalgo_sys.autorama.so +lib64/libcamalgo_sys.cfb.so +lib64/libcamalgo_sys.hdr.so +lib64/libcampostalgo.so +lib64/libcampostalgo_featurepipe.so +lib64/libcampostalgo_interface.so +lib64/libpostalgo.plugin.autorama.so +lib64/libpostalgo.plugin.fb.so +lib64/libpostalgo.plugin.hdr.so +lib64/libpostalgo_3rdparty.core.so +lib64/libpostalgo_3rdparty.customer.so +lib64/libpostalgo_3rdparty.mtk.so +lib64/libpostalgo_3rdparty.plugin.features.so +lib64/libpostalgo_3rdparty.so +lib64/libpostalgo_grallocutils.so +lib64/libpostalgo_imgbuf.so +lib64/libpostalgo_metadata.so +lib64/libpostalgo_stdutils.so + +bin/met_log_d +usr/idc/mtk-pad.idc + +etc/ams_aal_config.xml +etc/custom.conf +etc/ixitdata.xml +etc/resolution_tuner_app_list.xml +etc/sysconfig/a-framework-sysconfig.xml +ro.prop +rw.prop + +etc/bluetooth/mtk_bt_fw.conf +etc/bluetooth/mtk_bt_stack.conf + +lib64/vendor.mediatek.hardware.agolddaemon@1.0.so +lib64/vendor.mediatek.hardware.audio@5.1.so +lib64/vendor.mediatek.hardware.dfps@1.0.so +lib64/vendor.mediatek.hardware.gpu@1.0.so +lib64/vendor.mediatek.hardware.lbs@1.0.so +lib64/vendor.mediatek.hardware.mms@1.0.so +lib64/vendor.mediatek.hardware.mms@1.1.so +lib64/vendor.mediatek.hardware.mms@1.2.so +lib64/vendor.mediatek.hardware.mms@1.3.so +lib64/vendor.mediatek.hardware.mtkpower@1.0.so +lib64/vendor.mediatek.hardware.mtkradioex@1.0.so +lib64/vendor.mediatek.hardware.nwk_opt@1.0.so +lib64/vendor.mediatek.hardware.power@2.0.so +lib64/vendor.mediatek.hardware.power@2.1.so +lib64/vendor.mediatek.hardware.pq@2.0.so +lib64/vendor.mediatek.hardware.pq@2.1.so +lib64/vendor.mediatek.hardware.pq@2.2.so +lib64/vendor.mediatek.hardware.pq@2.3.so +lib64/vendor.mediatek.hardware.camera.device@1.1.so +lib64/vendor.trustonic.teeregistry@1.0.so +lib/vendor.mediatek.hardware.agolddaemon@1.0.so +lib/vendor.mediatek.hardware.audio@5.1.so +lib/vendor.mediatek.hardware.dfps@1.0.so +lib/vendor.mediatek.hardware.gpu@1.0.so +lib/vendor.mediatek.hardware.mms@1.0.so +lib/vendor.mediatek.hardware.mms@1.1.so +lib/vendor.mediatek.hardware.mms@1.2.so +lib/vendor.mediatek.hardware.mms@1.3.so +lib/vendor.mediatek.hardware.mtkpower@1.0.so +lib/vendor.mediatek.hardware.mtkradioex@1.0.so +lib/vendor.mediatek.hardware.nwk_opt@1.0.so +lib/vendor.mediatek.hardware.power@2.0.so +lib/vendor.mediatek.hardware.power@2.1.so +lib/vendor.mediatek.hardware.pq@2.0.so +lib/vendor.mediatek.hardware.pq@2.1.so +lib/vendor.mediatek.hardware.pq@2.2.so +lib/vendor.mediatek.hardware.pq@2.3.so +lib/vendor.mediatek.hardware.camera.device@1.1.so +lib/vendor.trustonic.teeregistry@1.0.so + +-framework/mediatek-framework-net.jar +-framework/mediatek-services.jar +-framework/mediatek-wfo-legacy.jar +-framework/mtk-wifi-service.jar +lib/libaudioutilmtk.so +lib/libbessound_hd_mtk.so +lib/libdrmmtkutil.so +lib/libmediatek_exceptionlog.so +lib/libstagefright_wfd_mtk.so +lib/libaudio_param_parser-sys.so +lib/libaudiocompensationfilter.so +lib/libaudiocomponentengine.so +lib/libaudiotoolkit.so +lib64/libaudioutilmtk.so +lib64/libbessound_hd_mtk.so +lib64/libdrmmtkutil.so +lib64/libdrmmtkwhitelist.so +lib64/libmediatek_exceptionlog.so +lib64/libmtkbluetooth_jni.so +lib64/libaudio_param_parser-sys.so +lib64/libaudiocompensationfilter.so +lib64/libaudiocomponentengine.so +lib64/libaudiopolicycustomextensions.so +lib64/libaudiotoolkit.so +etc/permissions/com.mediatek.wfo.legacy.xml +etc/permissions/com.nxp.mifare.xml +etc/permissions/com.verizon.remoteSimlock.remotesimlockservicelibrary.xml +etc/permissions/verizon.net.sip.xml +framework/verizon.net.sip.jar +framework/via-plugin.jar +framework/log-handler.jar +framework/CapCtrlInterface.jar +framework/CustomPropInterface.jar +xbin/trace + +lib/libMcRegistry.so +lib/libPQDCjni.so +lib/libPQjni.so +lib/lib_remote_simlock.so +lib/libblisrc.so +lib/libc2kutils_sys.so +lib/libcompress.so +lib/libcustom_jni.so +lib/libcustom_prop.so +lib/libdcfdecoderjni.so +lib/libdisp_dejitter.so +lib/libdtaNfaProvider.so +lib/libeap-aka.so +lib/libem_audio_jni.so +lib/libem_support_jni.so +lib/libem_usb_jni.so +lib/libem_wifi_jni.so +lib/libfpspolicy_fw.so +lib/libged_kpi.so +lib/libged_sys.so +lib/libgpud_sys.so +lib/libgralloc_extra_sys.so +lib/libgraphics2d_ext.so +lib/libgui_debug.so +lib/libgui_ext.so +lib/libjni_pq.so +lib/libjpeg-alpha-oal.so +lib/libjpeg-alpha.so +lib/liblepton_module.so +lib/liblepton_module_aging.so +lib/libmemoryDumpEncoder.so +lib/libnativecheck-jni.so +lib/libneuropilot.so +lib/libneuropilot_hal_utils.so +lib/libnwk_opt_halwrap.so +lib/libperfctl.so +lib/libpowerhalwrap.so +lib/libpowerhalwrap_jni.so +lib/libsf_debug.so +lib/libteec.so +lib/libteeservice_client.trustonic.so +lib/libtouchfilter.so +lib/libudf.so +lib/libui_ext.so +lib/libvsync_enhance.so +lib/libvsync_hint.so +lib/libwapi_cert_jni.so +lib/libdrmmtkwhitelist.so +lib64/libMcRegistry.so +lib64/libPQDCjni.so +lib64/libPQjni.so +lib64/lib_remote_simlock.so +lib64/libblisrc.so +lib64/libc2kutils_sys.so +lib64/libcompress.so +lib64/libcustom_jni.so +lib64/libcustom_prop.so +lib64/libdcfdecoderjni.so +lib64/libdisp_dejitter.so +lib64/libdtaNfaProvider.so +lib64/libeap-aka.so +lib64/libem_audio_jni.so +lib64/libem_support_jni.so +lib64/libem_usb_jni.so +lib64/libem_wifi_jni.so +lib64/libfpspolicy_fw.so +lib64/libged_kpi.so +lib64/libged_sys.so +lib64/libgpud_sys.so +lib64/libgralloc_extra_sys.so +lib64/libgraphics2d_ext.so +lib64/libgui_debug.so +lib64/libgui_ext.so +lib64/libjni_pq.so +lib64/libjpeg-alpha-oal.so +lib64/libjpeg-alpha.so +lib64/liblepton_module.so +lib64/liblepton_module_aging.so +lib64/libmemoryDumpEncoder.so +lib64/libnativecheck-jni.so +lib64/libneuropilot.so +lib64/libneuropilot_hal_utils.so +lib64/libnwk_opt_halwrap.so +lib64/libperfctl.so +lib64/libpowerhalwrap.so +lib64/libpowerhalwrap_jni.so +lib64/libqcs-jni-100.100.103.so +lib64/libsf_debug.so +lib64/libteec.so +lib64/libteeservice_client.trustonic.so +lib64/libtouchfilter.so +lib64/libtsf-jni-103.100.101.so +lib64/libudf.so +lib64/libui_ext.so +lib64/libupdate-jni-1.0.1.2002.so +lib64/libvsync_enhance.so +lib64/libvsync_hint.so +lib64/libwapi_cert_jni.so + +-framework/com.st.android.nfc_extensions.jar +etc/init/hw/init.stnfc.rc +etc/nfcee_access.xml +etc/permissions/com.st.android.nfc_extensions.xml +bin/nfcstackp +bin/st_factorytests +lib/libnfc_st_dta.so +lib/libnfc_st_dta_jni.so +lib/libstnfc-nci.so +lib/libstnfc_nci_jni.so +lib64/libnfc_st_dta.so +lib64/libnfc_st_dta_jni.so +lib64/libstnfc-nci.so +lib64/libstnfc_nci_jni.so diff --git a/recovery/root/init.recovery.mt6771.rc b/recovery/root/init.recovery.mt6771.rc new file mode 100644 index 0000000..3c86127 --- /dev/null +++ b/recovery/root/init.recovery.mt6771.rc @@ -0,0 +1,23 @@ +on init + setprop sys.usb.configfs 1 + setprop sys.usb.ffs.aio_compat 1 + +on fs && property:ro.debuggable=0 + # distinguish USB shoulde connect or not, i.e. CDP vs SDP + write /sys/class/udc/musb-hdrc/device/cmode 2 + # set charging free due to it wait for USB activation + start adbd + +on post-fs + # Support A/B feature for EMMC and UFS boot region + symlink /dev/block/sda /dev/block/mmcblk0boot0 + symlink /dev/block/sdb /dev/block/mmcblk0boot1 + symlink /dev/block/mmcblk0boot0 /dev/block/platform/bootdevice/by-name/preloader_a + symlink /dev/block/mmcblk0boot1 /dev/block/platform/bootdevice/by-name/preloader_b + + + # Support A/B feature for combo emmc and ufs OTA update + symlink /dev/block/platform/bootdevice/by-name/preloader_a /dev/block/platform/bootdevice/by-name/preloader_emmc_a + symlink /dev/block/platform/bootdevice/by-name/preloader_b /dev/block/platform/bootdevice/by-name/preloader_emmc_b + symlink /dev/block/platform/bootdevice/by-name/preloader_a /dev/block/platform/bootdevice/by-name/preloader_ufs_a + symlink /dev/block/platform/bootdevice/by-name/preloader_b /dev/block/platform/bootdevice/by-name/preloader_ufs_b diff --git a/rootdir/Android.mk b/rootdir/Android.mk new file mode 100644 index 0000000..33b2611 --- /dev/null +++ b/rootdir/Android.mk @@ -0,0 +1,37 @@ +# Copyright (C) 2020 The LineageOS Project +# +# SPDX-License-Identifier: Apache-2.0 +# + +LOCAL_PATH := $(call my-dir) + +include $(CLEAR_VARS) +LOCAL_MODULE := init.mt6771.rc +LOCAL_MODULE_TAGS := optional +LOCAL_MODULE_CLASS := ETC +LOCAL_SRC_FILES := etc/init.mt6771.rc +LOCAL_MODULE_PATH := $(TARGET_OUT_ETC)/init +include $(BUILD_PREBUILT) + +include $(CLEAR_VARS) +LOCAL_MODULE := fstab.mt6771 +LOCAL_MODULE_TAGS := optional +LOCAL_MODULE_CLASS := ETC +LOCAL_SRC_FILES := etc/fstab.mt6771 +LOCAL_MODULE_PATH := $(TARGET_OUT_ETC) +include $(BUILD_PREBUILT) + +include $(CLEAR_VARS) +LOCAL_MODULE := libfmcust +LOCAL_MODULE_SUFFIX := .so +LOCAL_MODULE_CLASS := SHARED_LIBRARIES +LOCAL_MODULE_TAGS := optional +LOCAL_PRELINK_MODULE := false +ifdef TARGET_2ND_ARCH +LOCAL_MULTILIB := both +LOCAL_SRC_FILES_64 := lib64/libfmcust.so +LOCAL_SRC_FILES_32 := lib/libfmcust.so +else +LOCAL_SRC_FILES := lib/libfmcust.so +endif +include $(BUILD_PREBUILT) diff --git a/rootdir/etc/fstab.mt6771 b/rootdir/etc/fstab.mt6771 new file mode 100644 index 0000000..52938e4 --- /dev/null +++ b/rootdir/etc/fstab.mt6771 @@ -0,0 +1,106 @@ +# 1 "vendor/mediatek/proprietary/hardware/fstab/mt6771/fstab.in.mt6771" +# 1 "" 1 +# 1 "" 3 +# 350 "" 3 +# 1 "" 1 +# 1 "" 2 +# 1 "vendor/mediatek/proprietary/hardware/fstab/mt6771/fstab.in.mt6771" 2 +# 125 "vendor/mediatek/proprietary/hardware/fstab/mt6771/fstab.in.mt6771" +system /system ext4 ro wait,logical,first_stage_mount + +vendor /vendor ext4 ro wait,logical,first_stage_mount + + +product /product ext4 ro wait,logical,first_stage_mount + + + + + +/dev/block/platform/bootdevice/by-name/md_udc /metadata ext4 noatime,nosuid,nodev,discard wait,formattable,first_stage_mount + +/dev/block/platform/bootdevice/by-name/userdata /data ext4 noatime,nosuid,nodev,noauto_da_alloc,errors=panic wait,check,formattable,quota,resize,reservedsize=128m,checkpoint=block,fileencryption=aes-256-xts + +/dev/block/platform/bootdevice/by-name/cache /cache ext4 noatime,nosuid,nodev,noauto_da_alloc,discard wait,check,formattable + +/dev/block/platform/bootdevice/by-name/protect1 /mnt/vendor/protect_f ext4 noatime,nosuid,nodev,noauto_da_alloc,commit=1,nodelalloc wait,check,formattable +/dev/block/platform/bootdevice/by-name/protect2 /mnt/vendor/protect_s ext4 noatime,nosuid,nodev,noauto_da_alloc,commit=1,nodelalloc wait,check,formattable +/dev/block/platform/bootdevice/by-name/nvdata /mnt/vendor/nvdata ext4 noatime,nosuid,nodev,noauto_da_alloc,commit=1,nodelalloc wait,check,formattable +/dev/block/platform/bootdevice/by-name/nvcfg /mnt/vendor/nvcfg ext4 noatime,nosuid,nodev,noauto_da_alloc,commit=1,nodelalloc wait,check,formattable + + +/dev/block/platform/bootdevice/by-name/persist /mnt/vendor/persist ext4 noatime,nosuid,nodev,noauto_da_alloc,commit=1,nodelalloc wait,check,formattable + + + +/dev/block/platform/bootdevice/by-name/apd /mnt/vendor/apd ext4 noatime,nosuid,nodev,noauto_da_alloc,commit=1,nodelalloc wait,check,formattable + + +/devices/platform/externdevice* auto auto defaults voldmanaged=sdcard1:auto,encryptable=userdata +/devices/platform/11200000.usb3_xhci* auto vfat defaults voldmanaged=usbotg:auto + +/dev/block/platform/bootdevice/by-name/frp /persistent emmc defaults defaults + +/dev/block/platform/bootdevice/by-name/nvram /nvram emmc defaults defaults +/dev/block/platform/bootdevice/by-name/proinfo /proinfo emmc defaults defaults +/dev/block/platform/bootdevice/by-name/lk /bootloader emmc defaults defaults +/dev/block/platform/bootdevice/by-name/lk2 /bootloader2 emmc defaults defaults +/dev/block/platform/bootdevice/by-name/para /misc emmc defaults defaults + + +/dev/block/platform/bootdevice/by-name/recovery /recovery emmc defaults first_stage_mount,nofail, + +/dev/block/platform/bootdevice/by-name/boot /boot emmc defaults first_stage_mount,nofail, + + + + + +/dev/block/platform/bootdevice/by-name/vbmeta_vendor /vbmeta_vendor emmc defaults first_stage_mount,nofail, +/dev/block/platform/bootdevice/by-name/vbmeta_system /vbmeta_system emmc defaults first_stage_mount,nofail,,avb=vbmeta + +/dev/block/platform/bootdevice/by-name/logo /logo emmc defaults defaults +/dev/block/platform/bootdevice/by-name/expdb /expdb emmc defaults defaults +/dev/block/platform/bootdevice/by-name/seccfg /seccfg emmc defaults defaults + +/dev/block/platform/bootdevice/by-name/tee1 /tee1 emmc defaults defaults +/dev/block/platform/bootdevice/by-name/tee2 /tee2 emmc defaults defaults + + +/dev/block/platform/bootdevice/by-name/scp1 /scp1 emmc defaults defaults +/dev/block/platform/bootdevice/by-name/scp2 /scp2 emmc defaults defaults + + +/dev/block/platform/bootdevice/by-name/sspm_1 /sspm_1 emmc defaults defaults +/dev/block/platform/bootdevice/by-name/sspm_2 /sspm_2 emmc defaults defaults + + + + +/dev/block/platform/bootdevice/by-name/md1img /md1img emmc defaults defaults +/dev/block/platform/bootdevice/by-name/md1dsp /md1dsp emmc defaults defaults +/dev/block/platform/bootdevice/by-name/md1arm7 /md1arm7 emmc defaults defaults +/dev/block/platform/bootdevice/by-name/md3img /md3img emmc defaults defaults + +/dev/block/platform/bootdevice/by-name/cam_vpu1 /cam_vpu1 emmc defaults defaults +/dev/block/platform/bootdevice/by-name/cam_vpu2 /cam_vpu2 emmc defaults defaults +/dev/block/platform/bootdevice/by-name/cam_vpu3 /cam_vpu3 emmc defaults defaults + +/dev/block/platform/bootdevice/by-name/gz1 /gz1 emmc defaults defaults +/dev/block/platform/bootdevice/by-name/gz2 /gz2 emmc defaults defaults + +/dev/block/platform/bootdevice/by-name/spmfw /spmfw emmc defaults defaults + + + + +/dev/block/platform/bootdevice/by-name/boot_para /boot_para emmc defaults defaults + +/dev/block/platform/bootdevice/by-name/odmdtbo /odmdtbo emmc defaults defaults +/dev/block/platform/bootdevice/by-name/dtbo /dtbo emmc defaults defaults + + +/dev/block/platform/bootdevice/by-name/otp /otp emmc defaults defaults + + +/dev/block/platform/bootdevice/by-name/vbmeta /vbmeta emmc defaults defaults diff --git a/rootdir/etc/init.mt6771.rc b/rootdir/etc/init.mt6771.rc new file mode 100644 index 0000000..63b5523 --- /dev/null +++ b/rootdir/etc/init.mt6771.rc @@ -0,0 +1,14 @@ +on init + setprop sys.usb.ffs.aio_compat 1 + + # Custom overrides that need to happen right on boot + # Override vendor fstab + # We only need it to be overridden before things are mounted + mount none /system/etc/fstab.mt6771 /vendor/etc/fstab.mt6771 bind + +on post-fs + # Unmount the overridden fstab because the SELinux label is incorrect + # and some MTK daemons can crash because of that + # (at post-fs, the fstab has already been used to mount the partitions, + # so it is fine to just revert back) + umount /vendor/etc/fstab.mt6771 diff --git a/rootdir/lib/libfmcust.so b/rootdir/lib/libfmcust.so new file mode 100644 index 0000000..ce22d70 Binary files /dev/null and b/rootdir/lib/libfmcust.so differ diff --git a/rootdir/lib64/libfmcust.so b/rootdir/lib64/libfmcust.so new file mode 100644 index 0000000..7e86a46 Binary files /dev/null and b/rootdir/lib64/libfmcust.so differ diff --git a/sepolicy/public/GoogleOtaBinder.te b/sepolicy/public/GoogleOtaBinder.te new file mode 100644 index 0000000..ccbbff0 --- /dev/null +++ b/sepolicy/public/GoogleOtaBinder.te @@ -0,0 +1,2 @@ +type GoogleOtaBinder, domain, binderservicedomain, coredomain; +type ota_agent_service, service_manager_type; diff --git a/sepolicy/public/aee_aed.te b/sepolicy/public/aee_aed.te new file mode 100644 index 0000000..9f430e9 --- /dev/null +++ b/sepolicy/public/aee_aed.te @@ -0,0 +1 @@ +type aee_aed, domain, mlstrustedsubject, coredomain; diff --git a/sepolicy/public/aee_aedv.te b/sepolicy/public/aee_aedv.te new file mode 100644 index 0000000..a6e3326 --- /dev/null +++ b/sepolicy/public/aee_aedv.te @@ -0,0 +1 @@ +type init_svc_aee_aedv_prop, property_type; diff --git a/sepolicy/public/aee_core.te b/sepolicy/public/aee_core.te new file mode 100644 index 0000000..1a6936a --- /dev/null +++ b/sepolicy/public/aee_core.te @@ -0,0 +1 @@ +type aee_core_forwarder, domain, coredomain; diff --git a/sepolicy/public/atci.te b/sepolicy/public/atci.te new file mode 100644 index 0000000..64036af --- /dev/null +++ b/sepolicy/public/atci.te @@ -0,0 +1 @@ +type atci_service_sys, domain, coredomain; diff --git a/sepolicy/public/attributes b/sepolicy/public/attributes new file mode 100644 index 0000000..f3102d7 --- /dev/null +++ b/sepolicy/public/attributes @@ -0,0 +1,14 @@ +attribute mtk_hal_apm; +attribute mtk_hal_apm_client; +attribute mtk_hal_apm_server; +attribute mtk_hal_dmc; +attribute mtk_hal_dmc_client; +attribute mtk_hal_dmc_server; +attribute mtk_hal_lbs; +attribute mtk_hal_lbs_client; +attribute mtk_hal_lbs_server; +attribute mtk_hal_md_dbfilter; +attribute mtk_hal_md_dbfilter_client; +attribute hal_gpu; +attribute hal_gpu_client; +attribute hal_gpu_server; diff --git a/sepolicy/public/boot_logo_updater.te b/sepolicy/public/boot_logo_updater.te new file mode 100644 index 0000000..9fa04d1 --- /dev/null +++ b/sepolicy/public/boot_logo_updater.te @@ -0,0 +1 @@ +type boot_logo_updater, domain, coredomain; diff --git a/sepolicy/public/camerapostalgo.te b/sepolicy/public/camerapostalgo.te new file mode 100644 index 0000000..6135c74 --- /dev/null +++ b/sepolicy/public/camerapostalgo.te @@ -0,0 +1 @@ +type camerapostalgo, domain, binderservicedomain, coredomain; diff --git a/sepolicy/public/cmddumper.te b/sepolicy/public/cmddumper.te new file mode 100644 index 0000000..4ed1fd3 --- /dev/null +++ b/sepolicy/public/cmddumper.te @@ -0,0 +1 @@ +type cmddumper, domain, coredomain; diff --git a/sepolicy/public/connsyslogger.te b/sepolicy/public/connsyslogger.te new file mode 100644 index 0000000..c6d346c --- /dev/null +++ b/sepolicy/public/connsyslogger.te @@ -0,0 +1 @@ +type connsyslogger, domain, coredomain; diff --git a/sepolicy/public/dm_agent_binder.te b/sepolicy/public/dm_agent_binder.te new file mode 100644 index 0000000..649d5e6 --- /dev/null +++ b/sepolicy/public/dm_agent_binder.te @@ -0,0 +1 @@ +type dm_agent_binder_service, service_manager_type; diff --git a/sepolicy/public/dualmdlogger.te b/sepolicy/public/dualmdlogger.te new file mode 100644 index 0000000..591c0cd --- /dev/null +++ b/sepolicy/public/dualmdlogger.te @@ -0,0 +1 @@ +type ctl_dualmdlogger_prop, property_type; diff --git a/sepolicy/public/em_svr.te b/sepolicy/public/em_svr.te new file mode 100644 index 0000000..d4040af --- /dev/null +++ b/sepolicy/public/em_svr.te @@ -0,0 +1 @@ +type em_svr, domain, coredomain; diff --git a/sepolicy/public/emdlogger.te b/sepolicy/public/emdlogger.te new file mode 100644 index 0000000..5cfdbd6 --- /dev/null +++ b/sepolicy/public/emdlogger.te @@ -0,0 +1,5 @@ +type emdlogger, domain, binderservicedomain, coredomain; +type ctl_emdlogger1_prop, property_type; +type ctl_emdlogger2_prop, property_type; +type ctl_emdlogger3_prop, property_type; +type init_svc_emdlogger1_prop, property_type; diff --git a/sepolicy/public/fpspolicy.te b/sepolicy/public/fpspolicy.te new file mode 100644 index 0000000..b605696 --- /dev/null +++ b/sepolicy/public/fpspolicy.te @@ -0,0 +1 @@ +type fpspolicy-server_service, service_manager_type; diff --git a/sepolicy/public/gas_srv.te b/sepolicy/public/gas_srv.te new file mode 100644 index 0000000..83ecc00 --- /dev/null +++ b/sepolicy/public/gas_srv.te @@ -0,0 +1 @@ +type gas_srv_service, service_manager_type; diff --git a/sepolicy/public/kpoc_charger.te b/sepolicy/public/kpoc_charger.te new file mode 100644 index 0000000..9bed7c7 --- /dev/null +++ b/sepolicy/public/kpoc_charger.te @@ -0,0 +1 @@ +type kpoc_charger, domain, coredomain, halclientdomain, hal_health_client, hal_light_client; diff --git a/sepolicy/public/loghidlsysservice.te b/sepolicy/public/loghidlsysservice.te new file mode 100644 index 0000000..7dd304f --- /dev/null +++ b/sepolicy/public/loghidlsysservice.te @@ -0,0 +1 @@ +type loghidlsysservice, domain, coredomain; diff --git a/sepolicy/public/ls_dbg.te b/sepolicy/public/ls_dbg.te new file mode 100644 index 0000000..b1575f1 --- /dev/null +++ b/sepolicy/public/ls_dbg.te @@ -0,0 +1 @@ +type lbs_dbg_data_file, file_type, data_file_type, core_data_file_type; diff --git a/sepolicy/public/mcupm.te b/sepolicy/public/mcupm.te new file mode 100644 index 0000000..13ea1e1 --- /dev/null +++ b/sepolicy/public/mcupm.te @@ -0,0 +1 @@ +type mcupm_device, dev_type; diff --git a/sepolicy/public/md_monitor.te b/sepolicy/public/md_monitor.te new file mode 100644 index 0000000..0813d11 --- /dev/null +++ b/sepolicy/public/md_monitor.te @@ -0,0 +1 @@ +type init_svc_md_monitor_prop, property_type; diff --git a/sepolicy/public/mdlogger.te b/sepolicy/public/mdlogger.te new file mode 100644 index 0000000..9592df3 --- /dev/null +++ b/sepolicy/public/mdlogger.te @@ -0,0 +1,2 @@ +type mdlogger, domain, binderservicedomain, coredomain; +type ctl_mdlogger_prop, property_type; diff --git a/sepolicy/public/met_log_d.te b/sepolicy/public/met_log_d.te new file mode 100644 index 0000000..d1c1224 --- /dev/null +++ b/sepolicy/public/met_log_d.te @@ -0,0 +1 @@ +type met_log_d, domain, coredomain; diff --git a/sepolicy/public/mobile_log_d.te b/sepolicy/public/mobile_log_d.te new file mode 100644 index 0000000..bfb3f49 --- /dev/null +++ b/sepolicy/public/mobile_log_d.te @@ -0,0 +1 @@ +type mobile_log_d, domain, coredomain; diff --git a/sepolicy/public/modemdbfilter.te b/sepolicy/public/modemdbfilter.te new file mode 100644 index 0000000..06bbeed --- /dev/null +++ b/sepolicy/public/modemdbfilter.te @@ -0,0 +1 @@ +type modemdbfilter_client, domain, coredomain, halclientdomain, mtk_hal_md_dbfilter_client; diff --git a/sepolicy/public/mtd.te b/sepolicy/public/mtd.te new file mode 100644 index 0000000..c0932a4 --- /dev/null +++ b/sepolicy/public/mtd.te @@ -0,0 +1 @@ +type mtd_device, dev_type; diff --git a/sepolicy/public/mtk_advcamserver.te b/sepolicy/public/mtk_advcamserver.te new file mode 100644 index 0000000..3b31d30 --- /dev/null +++ b/sepolicy/public/mtk_advcamserver.te @@ -0,0 +1,2 @@ +type mtk_advcamserver, domain, binderservicedomain, coredomain; +type mtk_advcamserver_service, service_manager_type; diff --git a/sepolicy/public/mtk_bootanimation.te b/sepolicy/public/mtk_bootanimation.te new file mode 100644 index 0000000..e53559a --- /dev/null +++ b/sepolicy/public/mtk_bootanimation.te @@ -0,0 +1 @@ +type mtkbootanimation, domain, coredomain, halclientdomain, hal_configstore_client, hal_graphics_allocator_client, hal_graphics_composer_client; diff --git a/sepolicy/public/mtk_permrecords.te b/sepolicy/public/mtk_permrecords.te new file mode 100644 index 0000000..0070cc8 --- /dev/null +++ b/sepolicy/public/mtk_permrecords.te @@ -0,0 +1 @@ +type mtk_permrecords_service, system_server_service, app_api_service, service_manager_type; diff --git a/sepolicy/public/mtk_pkm.te b/sepolicy/public/mtk_pkm.te new file mode 100644 index 0000000..6b52151 --- /dev/null +++ b/sepolicy/public/mtk_pkm.te @@ -0,0 +1 @@ +type mtk_pkm_init_prop, property_type; diff --git a/sepolicy/public/mtk_prop.te b/sepolicy/public/mtk_prop.te new file mode 100644 index 0000000..f036025 --- /dev/null +++ b/sepolicy/public/mtk_prop.te @@ -0,0 +1 @@ +type mtk_dmc_prop, property_type; diff --git a/sepolicy/public/mtk_service.te b/sepolicy/public/mtk_service.te new file mode 100644 index 0000000..d24919b --- /dev/null +++ b/sepolicy/public/mtk_service.te @@ -0,0 +1,25 @@ +type mtk_anrmanager_service, system_server_service, app_api_service, service_manager_type; +type mtk_appdetection_service, system_server_service, app_api_service, service_manager_type; +type mtk_autoboot_service, system_server_service, app_api_service, service_manager_type; +type mtk_carrierexpress_service, app_api_service, service_manager_type; +type mtk_data_shaping_service, system_server_service, app_api_service, service_manager_type; +type mtk_duraspeed_service, system_server_service, app_api_service, service_manager_type; +type mtk_epdg_service, system_server_service, app_api_service, service_manager_type; +type mtk_fm_radio_service, system_server_service, app_api_service, service_manager_type; +type mtk_fullscreen_switch_service, system_server_service, app_api_service, service_manager_type; +type mtk_gwsd_service, service_manager_type; +type mtk_hdmi_service, service_manager_type; +type mtk_mobile_service, system_server_service, app_api_service, service_manager_type; +type mtk_msg_monitor_service, system_server_service, app_api_service, service_manager_type; +type mtk_omadm_service, system_server_service, app_api_service, service_manager_type; +type mtk_perf_service, system_server_service, app_api_service, service_manager_type; +type mtk_phonesubinfo_service, app_api_service, service_manager_type; +type mtk_power_hal_mgr_service, system_server_service, app_api_service, service_manager_type; +type mtk_presence_service, service_manager_type; +type mtk_radio_service, service_manager_type; +type mtk_registry_service, app_api_service, service_manager_type; +type mtk_rns_service, system_server_service, app_api_service, service_manager_type; +type mtk_search_engine_service, system_server_service, app_api_service, service_manager_type; +type mtk_simphonebook_service, app_api_service, service_manager_type; +type mtk_telecom_service, system_server_service, app_api_service, service_manager_type; +type mtk_vowbridge_service, system_server_service, app_api_service, service_manager_type; diff --git a/sepolicy/public/netdiag.te b/sepolicy/public/netdiag.te new file mode 100644 index 0000000..74e62b9 --- /dev/null +++ b/sepolicy/public/netdiag.te @@ -0,0 +1 @@ +type netdiag, domain, mlstrustedsubject, coredomain; diff --git a/sepolicy/public/nvram_agent.te b/sepolicy/public/nvram_agent.te new file mode 100644 index 0000000..9b03933 --- /dev/null +++ b/sepolicy/public/nvram_agent.te @@ -0,0 +1 @@ +type nvram_agent_service, service_manager_type; diff --git a/sepolicy/public/ppl_agent.te b/sepolicy/public/ppl_agent.te new file mode 100644 index 0000000..78ac147 --- /dev/null +++ b/sepolicy/public/ppl_agent.te @@ -0,0 +1 @@ +type ppl_agent_service, service_manager_type; diff --git a/sepolicy/public/tee.te b/sepolicy/public/tee.te new file mode 100644 index 0000000..b5579c2 --- /dev/null +++ b/sepolicy/public/tee.te @@ -0,0 +1,2 @@ +type tee_service, service_manager_type; +type teeregistry_service, service_manager_type; diff --git a/sepolicy/public/terservice.te b/sepolicy/public/terservice.te new file mode 100644 index 0000000..6bb9b5f --- /dev/null +++ b/sepolicy/public/terservice.te @@ -0,0 +1 @@ +type terservice, domain, binderservicedomain, coredomain; diff --git a/sepolicy/public/thermald.te b/sepolicy/public/thermald.te new file mode 100644 index 0000000..0e28ff3 --- /dev/null +++ b/sepolicy/public/thermald.te @@ -0,0 +1 @@ +type thermald, domain, coredomain; diff --git a/sepolicy/public/usp_service.te b/sepolicy/public/usp_service.te new file mode 100644 index 0000000..703093d --- /dev/null +++ b/sepolicy/public/usp_service.te @@ -0,0 +1 @@ +type usp_service, domain, coredomain; diff --git a/sepolicy/public/vtservice.te b/sepolicy/public/vtservice.te new file mode 100644 index 0000000..f9fcfe3 --- /dev/null +++ b/sepolicy/public/vtservice.te @@ -0,0 +1,2 @@ +type vtservice_service, service_manager_type; +type vtservice_hidl_service, service_manager_type; diff --git a/sepolicy/vendor/aee_aedv.te b/sepolicy/vendor/aee_aedv.te new file mode 100644 index 0000000..563be63 --- /dev/null +++ b/sepolicy/vendor/aee_aedv.te @@ -0,0 +1,6 @@ +type aee_aedv, domain, mlstrustedsubject, halclientdomain, hal_camera_client; +type aee_aedv_exec, file_type, exec_type, vendor_file_type; + +init_daemon_domain(aee_aedv); + +allow aee_aedv proc_ppm:dir {search}; diff --git a/sepolicy/vendor/agold.te b/sepolicy/vendor/agold.te new file mode 100644 index 0000000..a2fec38 --- /dev/null +++ b/sepolicy/vendor/agold.te @@ -0,0 +1,3 @@ +type proc_agold, fs_type, proc_type; +type sysfs_agold, fs_type, sysfs_type; +type agold_service, system_server_service, service_manager_type; diff --git a/sepolicy/vendor/attributes b/sepolicy/vendor/attributes new file mode 100644 index 0000000..d7bb247 --- /dev/null +++ b/sepolicy/vendor/attributes @@ -0,0 +1,5 @@ +attribute mtkimsapdomain; +attribute hal_pq_client; +attribute mtk_hal_bgs; +attribute mtk_hal_bgs_server; +attribute hal_mtkcodecservice_client; diff --git a/sepolicy/vendor/ccci_mdinit.te b/sepolicy/vendor/ccci_mdinit.te new file mode 100644 index 0000000..652c501 --- /dev/null +++ b/sepolicy/vendor/ccci_mdinit.te @@ -0,0 +1,10 @@ +type ccci_mdinit, domain, mtkimsapdomain, data_between_core_and_vendor_violators; +type ccci_mdinit_exec, file_type, exec_type, vendor_file_type; + +init_daemon_domain(ccci_mdinit); + +allow ccci_mdinit sysfs_dt_firmware_android:dir {read search open}; +allow ccci_mdinit sysfs_dt_firmware_android:file {read getattr open}; +allow ccci_mdinit mdlog_data_file:dir {ioctl read write create getattr setattr lock relabelto rename add_name remove_name reparent search rmdir open}; +allow ccci_mdinit mdlog_data_file:fifo_file {ioctl read write create getattr setattr lock append map unlink rename open}; +allow ccci_mdinit mdlog_data_file:file {ioctl read write create getattr setattr lock append map unlink rename open}; diff --git a/sepolicy/vendor/extmodule.te b/sepolicy/vendor/extmodule.te new file mode 100644 index 0000000..3353210 --- /dev/null +++ b/sepolicy/vendor/extmodule.te @@ -0,0 +1,44 @@ +type extmodule_device, dev_type; +type extmodule, domain, mlstrustedsubject, binderservicedomain, coredomain; +type extmodule_exec, file_type, exec_type, system_file_type; +type extmodule_service, service_manager_type; + +init_daemon_domain(extmodule); +add_service(extmodule,extmodule_service); +binder_use(extmodule); + +allow extmodule system_file:file {execute_no_trans}; +allow extmodule system_data_file:dir {write create add_name}; +allow extmodule system_data_file:file {read open}; +allow extmodule self:capability {chown fowner fsetid net_raw}; +allow extmodule self:capability2 {wake_alarm}; +allow extmodule property_socket:sock_file {write}; +allow extmodule init:unix_stream_socket {connectto}; +allow extmodule system_prop:property_service {set}; +allow extmodule system_prop:file {read getattr map open}; +allow extmodule extmodule:tcp_socket {read write create getattr bind connect listen accept getopt setopt}; +allow extmodule port:tcp_socket {name_bind}; +allow extmodule node:tcp_socket {node_bind}; +allow extmodule fwmarkd_socket:sock_file {write}; +allow extmodule netd:unix_stream_socket {connectto}; +allow extmodule sysfs_agold:file {read write getattr open}; +allow extmodule shell_exec:file {read getattr map execute execute_no_trans open}; +allow extmodule extmodule_device:dir {read write add_name open}; +allow extmodule extmodule_device:file {read write create open}; +allow extmodule extmodule_device:chr_file {read write open}; +allow extmodule audio_device:dir {search}; +allow extmodule audio_device:chr_file {ioctl read write getattr setattr map open}; +allow extmodule ttyACM_device:chr_file {ioctl read write getattr setattr open}; +allow extmodule storage_file:lnk_file {read}; +allow extmodule tmpfs:dir {search}; +allow extmodule sdcardfs:dir {search}; +allow extmodule sdcardfs:file {read write getattr open}; +allow extmodule mnt_user_file:dir {search}; +allow extmodule mnt_user_file:lnk_file {read write}; +allow extmodule media_rw_data_file:dir {read search open}; +allow extmodule media_rw_data_file:file {read write getattr open}; +allow extmodule usb_device:dir {read write search open}; +allow extmodule usb_device:chr_file {ioctl read write open}; +allow extmodule sysfs:dir {read open}; +allow extmodule toolbox_exec:file {read getattr map execute execute_no_trans open}; +allow extmodule extmodule_exec:file {getattr execute execute_no_trans}; diff --git a/sepolicy/vendor/file_contexts b/sepolicy/vendor/file_contexts new file mode 100644 index 0000000..12b7b70 --- /dev/null +++ b/sepolicy/vendor/file_contexts @@ -0,0 +1,35 @@ +/(system\/vendor|vendor)/bin/aee_aedv u:object_r:aee_aedv_exec:s0 +/(system\/vendor|vendor)/bin/aee_aedv64 u:object_r:aee_aedv_exec:s0 +/vendor/bin/aeev u:object_r:aee_aedv_exec:s0 +/(system\/vendor|vendor)/bin/mtk_agpsd u:object_r:mtk_agpsd_exec:s0 +/dev/socket/vendor.bip(/.*)? u:object_r:vendor_bip_socket:s0 +/(system\/vendor|vendor)/bin/ccci_mdinit u:object_r:ccci_mdinit_exec:s0 +/(system\/vendor|vendor)/bin/hw/vendor.chipsailing.fingerprint@1.0-service u:object_r:hal_fingerprint_default_exec:s0 +/(vendor|system/vendor)/bin/hw/vendor.sw.swfingerprint@1.0-service u:object_r:hal_fingerprint_default_exec:s0 +/(system\/vendor|vendor)/bin/fuelgauged_nvram u:object_r:fuelgauged_nvram_exec:s0 +/(system\/vendor|vendor)/bin/nvram_daemon u:object_r:nvram_daemon_exec:s0 +/vendor/bin/AguiNvramProximity u:object_r:nvram_daemon_exec:s0 +/(system\/vendor|vendor)/bin/hw/android\.hardware\.audio@5\.0-service-mediatek u:object_r:mtk_hal_audio_exec:s0 +/dev/socket/wfca(/.*)? u:object_r:wfca_socket:s0 +/dev/socket/volte_imsa2(/.*)? u:object_r:volte_imsa2_socket:s0 +/dev/socket/volte_ut(/.*)? u:object_r:volte_ut_socket:s0 +/data/mdl(/.*)? u:object_r:mdlog_data_file:s0 +/data/mdl3(/.*)? u:object_r:mdlog_data_file:s0 +/data/mdlog(/.*)? u:object_r:mdlog_data_file:s0 +/data/extmdl(/.*)? u:object_r:mdlog_data_file:s0 +/(system\/vendor|vendor)/bin/mnld u:object_r:mnld_exec:s0 +/(system\/vendor|vendor)/bin/hw/vtservice_hidl u:object_r:vtservice_hidl_exec:s0 +/system/bin/vtservice u:object_r:vtservice_exec:s0 +/vendor/bin/teed u:object_r:tkcore_exec:s0 +/vendor/app/t6(/.*)? u:object_r:tkcore_systa_file:s0 +/dev/stmcu u:object_r:extmodule_device:s0 +/dev/ttyTTCMD u:object_r:extmodule_device:s0 +/system/bin/dfu-util u:object_r:extmodule_exec:s0 +/system/bin/extmodule u:object_r:extmodule_exec:s0 +/dev/ttyACM0 u:object_r:ttyACM_device:s0 +/dev/lepton u:object_r:lepton_device:s0 +/dev/lepton_drv u:object_r:lepton_device:s0 +/dev/lepton_i2c u:object_r:lepton_device:s0 +/system/bin/apdServer u:object_r:lepton_exec:s0 +/system/bin/leptonServer u:object_r:lepton_exec:s0 +/(system\/vendor|vendor)/bin/hw/camerahalserver u:object_r:mtk_hal_camera_exec:s0 diff --git a/sepolicy/vendor/fuelgauged_nvram.te b/sepolicy/vendor/fuelgauged_nvram.te new file mode 100644 index 0000000..cfa2b92 --- /dev/null +++ b/sepolicy/vendor/fuelgauged_nvram.te @@ -0,0 +1,8 @@ +type fuelgauged_nvram, domain; +type fuelgauged_nvram_exec, file_type, exec_type, vendor_file_type; + +init_daemon_domain(fuelgauged_nvram); + +allow fuelgauged_nvram sysfs_dt_firmware_android:dir {read search open}; +allow fuelgauged_nvram sysfs_dt_firmware_android:file {read getattr open}; +allow fuelgauged_nvram metadata_file:dir {search}; diff --git a/sepolicy/vendor/genfs_contexts b/sepolicy/vendor/genfs_contexts new file mode 100644 index 0000000..74c2d79 --- /dev/null +++ b/sepolicy/vendor/genfs_contexts @@ -0,0 +1,47 @@ +genfscon proc /agold_battery_temperature u:object_r:proc_agold:s0 +genfscon proc /agold_camboard_id u:object_r:proc_agold:s0 +genfscon proc /agold_lcmcam_info u:object_r:proc_agold:s0 +genfscon proc /agold_otg_smt u:object_r:proc_agold:s0 +genfscon proc /agold_tpd_info u:object_r:proc_agold:s0 +genfscon proc /agold_typec_smt u:object_r:proc_agold:s0 +genfscon proc /agold_wireless_firmware u:object_r:proc_agold:s0 +genfscon proc /driver/agold_mem_info u:object_r:proc_agold:s0 +genfscon proc /driver/agold_tpd_info u:object_r:proc_agold:s0 +genfscon proc /driver/camera_lens u:object_r:proc_agold:s0 +genfscon proc /driver/camera_lens_driver u:object_r:proc_agold:s0 +genfscon proc /ppm u:object_r:proc_ppm:s0 +genfscon sysfs /devices/platform/battery/power_supply/battery/BatteryAverageCurrent u:object_r:sysfs_agold:s0 +genfscon sysfs /devices/platform/battery/power_supply/battery/PMICBATAverageCurrent u:object_r:sysfs_agold:s0 +genfscon sysfs /devices/platform/mt_usb/musb-hdrc/usb[0-9]+/bConfigurationValue u:object_r:sysfs_agold:s0 +genfscon sysfs /devices/platform/battery/power_supply/battery/ChargerVoltage u:object_r:sysfs_agold:s0 +genfscon sysfs /devices/platform/mt_usb/musb-hdrc/usb[0-9]+/descriptors u:object_r:sysfs_agold:s0 +genfscon sysfs /devices/platform/mt_usb/musb-hdrc/usb[0-9]+/1-1/busnum u:object_r:sysfs_agold:s0 +genfscon sysfs /devices/platform/11200000.usb3_xhci/usb[0-9]+/devnum u:object_r:sysfs_agold:s0 +genfscon sysfs /devices/platform/11200000.usb3_xhci/usb[0-9]+/busnum u:object_r:sysfs_agold:s0 +genfscon sysfs /bus/platform/drivers/flashlights-mt6370/ledtimeout u:object_r:sysfs_agold:s0 +genfscon sysfs /devices/platform/mt_usb/musb-hdrc/usb[0-9]+/busnum u:object_r:sysfs_agold:s0 +genfscon sysfs /devices/platform/mt_usb/musb-hdrc/usb[0-9]+/devnum u:object_r:sysfs_agold:s0 +genfscon sysfs /bus/platform/drivers/flashlights-mt6370/flashtest u:object_r:sysfs_agold:s0 +genfscon sysfs /devices/platform/mt_usb/musb-hdrc/usb[0-9]+/speed u:object_r:sysfs_agold:s0 +genfscon sysfs /bus/platform/drivers/flashlights-mt6370/agingtest u:object_r:sysfs_agold:s0 +genfscon sysfs /bus/platform/drivers/flashlights-mt6370/ledduty u:object_r:sysfs_agold:s0 +genfscon sysfs /bus/platform/drivers/agold_meta_card/agold_pad u:object_r:sysfs_agold:s0 +genfscon sysfs /bus/platform/drivers/agold_meta_card/agold_tpd u:object_r:sysfs_agold:s0 +genfscon sysfs /bus/platform/drivers/flashlights-mt6370/leden u:object_r:sysfs_agold:s0 +genfscon sysfs /module/pad_setting/parameters/pad_load_status u:object_r:sysfs_agold:s0 +genfscon sysfs /module/tpd_setting/parameters/tpd_load_status u:object_r:sysfs_agold:s0 +genfscon sysfs /sys/devices/virtual/misc/sunwave_fp/irq u:object_r:sysfs_agold:s0 +genfscon sysfs /devices/platform/mt_usb/musb-hdrc/mode u:object_r:sysfs_agold:s0 +genfscon sysfs /bus/platform/drivers/gsensor/chipinfo u:object_r:sysfs_agold:s0 +genfscon sysfs /agold_main2_yuv_value/main2_yuv_value u:object_r:sysfs_agold:s0 +genfscon sysfs /bus/platform/drivers/als_ps/chipinfo u:object_r:sysfs_agold:s0 +genfscon sysfs /bus/platform/drivers/mcu/handle_ptt u:object_r:sysfs_agold:s0 +genfscon sysfs /sys/bus/platform/devices/cs_spi/irq u:object_r:sysfs_agold:s0 +genfscon sysfs /bus/platform/drivers/mcu/mcu_power u:object_r:sysfs_agold:s0 +genfscon sysfs /bus/platform/drivers/mcu/usb_path u:object_r:sysfs_agold:s0 +genfscon sysfs /bus/platform/drivers/mcu/rstmcu u:object_r:sysfs_agold:s0 +genfscon sysfs /class/switch/otg_state/state u:object_r:sysfs_agold:s0 +genfscon sysfs /class/misc/pixart_ppg/enable u:object_r:sysfs_agold:s0 +genfscon sysfs /board_version/modem_version u:object_r:sysfs_agold:s0 +genfscon sysfs /hall_status/hall_status u:object_r:sysfs_agold:s0 +genfscon sysfs /charger_sys/charger_sys u:object_r:sysfs_agold:s0 diff --git a/sepolicy/vendor/init.te b/sepolicy/vendor/init.te new file mode 100644 index 0000000..352f525 --- /dev/null +++ b/sepolicy/vendor/init.te @@ -0,0 +1,4 @@ +allow init vendor_bip_socket:sock_file {write create unlink}; +allow init wfca_socket:sock_file {write create unlink}; +allow init volte_imsa2_socket:sock_file {write create unlink}; +allow init volte_ut_socket:sock_file {write create unlink}; diff --git a/sepolicy/vendor/lepton.te b/sepolicy/vendor/lepton.te new file mode 100644 index 0000000..dc112a1 --- /dev/null +++ b/sepolicy/vendor/lepton.te @@ -0,0 +1,26 @@ +type lepton_device, dev_type; +type lepton, domain, binderservicedomain, coredomain; +type lepton_exec, file_type, exec_type, system_file_type; +type lepton_service, service_manager_type; + +init_daemon_domain(lepton); +add_service(lepton,lepton_service); +binder_use(lepton); + +allow lepton init:unix_stream_socket {connectto}; +allow lepton lepton_device:chr_file {ioctl read write open}; +allow lepton lepton_device:dir {read write add_name open}; +allow lepton lepton_device:file {read write create open}; +allow lepton media_rw_data_file:dir {read write add_name search open}; +allow lepton media_rw_data_file:file {read write create getattr setattr open}; +allow lepton mnt_user_file:dir {search}; +allow lepton mnt_user_file:lnk_file {read write}; +allow lepton property_socket:sock_file {write}; +allow lepton sdcardfs:dir {write add_name search}; +allow lepton sdcardfs:file {read write create getattr open}; +allow lepton storage_file:lnk_file {read write}; +allow lepton sysfs_leds:dir {search}; +allow lepton system_data_file:dir {write create add_name}; +allow lepton system_data_file:file {read open}; +allow lepton system_file:file {execute_no_trans}; +allow lepton tmpfs:lnk_file {read}; diff --git a/sepolicy/vendor/mdlog.te b/sepolicy/vendor/mdlog.te new file mode 100644 index 0000000..2397cf1 --- /dev/null +++ b/sepolicy/vendor/mdlog.te @@ -0,0 +1 @@ +type mdlog_data_file, file_type, data_file_type, core_data_file_type; diff --git a/sepolicy/vendor/mnld.te b/sepolicy/vendor/mnld.te new file mode 100644 index 0000000..022c26f --- /dev/null +++ b/sepolicy/vendor/mnld.te @@ -0,0 +1,9 @@ +type mnld, domain, mlstrustedsubject, netdomain; +type mnld_exec, file_type, exec_type, vendor_file_type; + +init_daemon_domain(mnld); + +allow mnld sysfs_dt_firmware_android:dir {read search open}; +allow mnld sysfs_dt_firmware_android:file {read getattr open}; +allow mnld proc_cmdline:file {ioctl read getattr lock map open}; +allow mnld metadata_file:dir {search}; diff --git a/sepolicy/vendor/mtk_agpsd.te b/sepolicy/vendor/mtk_agpsd.te new file mode 100644 index 0000000..645ad20 --- /dev/null +++ b/sepolicy/vendor/mtk_agpsd.te @@ -0,0 +1,7 @@ +type mtk_agpsd, domain, netdomain, halclientdomain, mtk_hal_apm_client; +type mtk_agpsd_exec, file_type, exec_type, vendor_file_type; + +init_daemon_domain(mtk_agpsd); +binder_call(mtk_agpsd,system_suspend_server) + +allow mtk_agpsd system_suspend_hwservice:hwservice_manager {find}; diff --git a/sepolicy/vendor/mtk_hal_audio.te b/sepolicy/vendor/mtk_hal_audio.te new file mode 100644 index 0000000..d6773a2 --- /dev/null +++ b/sepolicy/vendor/mtk_hal_audio.te @@ -0,0 +1,8 @@ +type mtk_hal_audio, domain, halserverdomain, halclientdomain, hal_allocator_client, hal_audio, hal_audio_server; +type mtk_hal_audio_exec, file_type, exec_type, vendor_file_type; + +init_daemon_domain(mtk_hal_audio); + +allow mtk_hal_audio sysfs_dt_firmware_android:dir {read search open}; +allow mtk_hal_audio sysfs_dt_firmware_android:file {read getattr open}; +allow mtk_hal_audio metadata_file:dir {search}; diff --git a/sepolicy/vendor/mtk_hal_camera.te b/sepolicy/vendor/mtk_hal_camera.te new file mode 100644 index 0000000..92fc933 --- /dev/null +++ b/sepolicy/vendor/mtk_hal_camera.te @@ -0,0 +1,7 @@ +type mtk_hal_camera, domain, halserverdomain, halclientdomain, hal_allocator_client, hal_camera, hal_camera_server, hal_graphics_allocator_client, hal_pq_client, mtk_hal_bgs, mtk_hal_bgs_server; +type mtk_hal_camera_exec, file_type, exec_type, vendor_file_type; + +init_daemon_domain(mtk_hal_camera); +hwbinder_use(mtk_hal_camera); + +allow mtk_hal_camera proc_agold:file {read getattr open}; diff --git a/sepolicy/vendor/netd.te b/sepolicy/vendor/netd.te new file mode 100644 index 0000000..ad3ce3f --- /dev/null +++ b/sepolicy/vendor/netd.te @@ -0,0 +1,2 @@ +allow netd extmodule:fd {use}; +allow netd extmodule:tcp_socket {read write getopt setopt}; diff --git a/sepolicy/vendor/nvram_daemon.te b/sepolicy/vendor/nvram_daemon.te new file mode 100644 index 0000000..6980980 --- /dev/null +++ b/sepolicy/vendor/nvram_daemon.te @@ -0,0 +1,11 @@ +type nvram_daemon, domain; +type nvram_daemon_exec, file_type, exec_type, vendor_file_type; + +init_daemon_domain(nvram_daemon); + +allow nvram_daemon sysfs_dt_firmware_android:dir {read search open}; +allow nvram_daemon sysfs_dt_firmware_android:file {read getattr open}; +allow nvram_daemon proc_cmdline:file {ioctl read getattr lock map open}; +allow nvram_daemon metadata_file:dir {search}; +allow nvram_daemon sensorhub_support_prop:property_service {set}; +allow nvram_daemon sensorhub_support_prop:file {read getattr map open}; diff --git a/sepolicy/vendor/platform_app.te b/sepolicy/vendor/platform_app.te new file mode 100644 index 0000000..077f30c --- /dev/null +++ b/sepolicy/vendor/platform_app.te @@ -0,0 +1,4 @@ +allow platform_app agold_service:service_manager {find}; +allow platform_app proc_agold:file {read getattr open}; +allow platform_app sysfs_agold:file {read getattr open}; +allow platform_app lepton_service:service_manager {find}; diff --git a/sepolicy/vendor/priv_app.te b/sepolicy/vendor/priv_app.te new file mode 100644 index 0000000..00dcfed --- /dev/null +++ b/sepolicy/vendor/priv_app.te @@ -0,0 +1 @@ +allow priv_app agold_service:service_manager {find}; diff --git a/sepolicy/vendor/proc_ppm.te b/sepolicy/vendor/proc_ppm.te new file mode 100644 index 0000000..2c559d8 --- /dev/null +++ b/sepolicy/vendor/proc_ppm.te @@ -0,0 +1 @@ +type proc_ppm, fs_type, proc_type; diff --git a/sepolicy/vendor/property_contexts b/sepolicy/vendor/property_contexts new file mode 100644 index 0000000..4a902e1 --- /dev/null +++ b/sepolicy/vendor/property_contexts @@ -0,0 +1 @@ +ro.sensorhub_support u:object_r:sensorhub_support_prop:s0 diff --git a/sepolicy/vendor/radio.te b/sepolicy/vendor/radio.te new file mode 100644 index 0000000..4021ffe --- /dev/null +++ b/sepolicy/vendor/radio.te @@ -0,0 +1,2 @@ +allow radio agold_service:service_manager {find}; +allow radio proc_agold:file {read getattr open}; diff --git a/sepolicy/vendor/sensorhub_support.te b/sepolicy/vendor/sensorhub_support.te new file mode 100644 index 0000000..9989c0e --- /dev/null +++ b/sepolicy/vendor/sensorhub_support.te @@ -0,0 +1 @@ +type sensorhub_support_prop, property_type; diff --git a/sepolicy/vendor/shell.te b/sepolicy/vendor/shell.te new file mode 100644 index 0000000..0af03ef --- /dev/null +++ b/sepolicy/vendor/shell.te @@ -0,0 +1,2 @@ +allow shell extmodule_exec:file {ioctl read getattr lock map execute execute_no_trans open}; +allow shell proc_agold:file {read}; diff --git a/sepolicy/vendor/system_app.te b/sepolicy/vendor/system_app.te new file mode 100644 index 0000000..6a51610 --- /dev/null +++ b/sepolicy/vendor/system_app.te @@ -0,0 +1,3 @@ +allow system_app agold_service:service_manager {find}; +allow system_app proc_agold:file {ioctl read getattr open}; +allow system_app sysfs_agold:file {read getattr open}; diff --git a/sepolicy/vendor/system_server.te b/sepolicy/vendor/system_server.te new file mode 100644 index 0000000..46a760b --- /dev/null +++ b/sepolicy/vendor/system_server.te @@ -0,0 +1 @@ +allow system_server sysfs_agold:file {ioctl read write getattr open}; diff --git a/sepolicy/vendor/tkcore.te b/sepolicy/vendor/tkcore.te new file mode 100644 index 0000000..11a24b4 --- /dev/null +++ b/sepolicy/vendor/tkcore.te @@ -0,0 +1,8 @@ +type tkcore, domain; +type tkcore_exec, file_type, exec_type, vendor_file_type; +type tkcore_systa_file, file_type, vendor_file_type; + +init_daemon_domain(tkcore); + +allow tkcore tkcore_systa_file:dir {ioctl read getattr lock search open}; +allow tkcore tkcore_systa_file:file {ioctl read getattr lock map open}; diff --git a/sepolicy/vendor/ttyACM.te b/sepolicy/vendor/ttyACM.te new file mode 100644 index 0000000..a700018 --- /dev/null +++ b/sepolicy/vendor/ttyACM.te @@ -0,0 +1 @@ +type ttyACM_device, dev_type; diff --git a/sepolicy/vendor/untrusted_app.te b/sepolicy/vendor/untrusted_app.te new file mode 100644 index 0000000..d76a221 --- /dev/null +++ b/sepolicy/vendor/untrusted_app.te @@ -0,0 +1,3 @@ +allow untrusted_app agold_service:service_manager {find}; +allow untrusted_app lepton_service:service_manager {find}; +allow untrusted_app_all lepton_service:service_manager {find}; diff --git a/sepolicy/vendor/vendor_bip.te b/sepolicy/vendor/vendor_bip.te new file mode 100644 index 0000000..58c6978 --- /dev/null +++ b/sepolicy/vendor/vendor_bip.te @@ -0,0 +1 @@ +type vendor_bip_socket, file_type; diff --git a/sepolicy/vendor/volte.te b/sepolicy/vendor/volte.te new file mode 100644 index 0000000..b047a2b --- /dev/null +++ b/sepolicy/vendor/volte.te @@ -0,0 +1,2 @@ +type volte_imsa2_socket, file_type; +type volte_ut_socket, file_type; diff --git a/sepolicy/vendor/vtservice.te b/sepolicy/vendor/vtservice.te new file mode 100644 index 0000000..f251552 --- /dev/null +++ b/sepolicy/vendor/vtservice.te @@ -0,0 +1,7 @@ +type vtservice, domain, binderservicedomain, coredomain, halclientdomain, hal_allocator_client, hal_codec2_client, hal_graphics_allocator_client, hal_omx_client, hal_pq_client; +type vtservice_hidl, domain, netdomain, mtkimsapdomain; +type vtservice_exec, file_type, exec_type, system_file_type; +type vtservice_hidl_exec, file_type, exec_type, vendor_file_type; + +init_daemon_domain(vtservice); +init_daemon_domain(vtservice_hidl); diff --git a/sepolicy/vendor/wfca.te b/sepolicy/vendor/wfca.te new file mode 100644 index 0000000..10227c8 --- /dev/null +++ b/sepolicy/vendor/wfca.te @@ -0,0 +1 @@ +type wfca_socket, file_type; diff --git a/setup-makefiles-common.sh b/setup-makefiles-common.sh new file mode 100755 index 0000000..8b5dd24 --- /dev/null +++ b/setup-makefiles-common.sh @@ -0,0 +1,42 @@ +#!/bin/bash +# +# Copyright (C) 2020 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. +# + +# Load extract_utils and do some sanity checks +MY_DIR="${BASH_SOURCE%/*}" +if [[ ! -d "${MY_DIR}" ]]; then MY_DIR="${PWD}"; fi + +LINEAGE_ROOT="${MY_DIR}/../../.." + +HELPER="${LINEAGE_ROOT}/vendor/lineage/build/tools/extract_utils.sh" +if [ ! -f "${HELPER}" ]; then + echo "Unable to find helper script at ${HELPER}" + exit 1 +fi +source "${HELPER}" + +# Initialize the helper for common +setup_vendor "${DEVICE}" "${VENDOR}" "${LINEAGE_ROOT}" + +# Copyright headers and guards +write_headers + +# The standard common blobs +write_makefiles "${MY_DIR}/proprietary-files-common.txt" true +write_makefiles "${LINEAGE_ROOT}/device/${VENDOR}/${DEVICE}/proprietary-files.txt" true + +# Finish +write_footers diff --git a/tools/extract_sepolicy.py b/tools/extract_sepolicy.py new file mode 100755 index 0000000..cc73570 --- /dev/null +++ b/tools/extract_sepolicy.py @@ -0,0 +1,342 @@ +import re +import os +import glob + +# BEGIN CLASS SEPolicy +class SEPolicy: + def __init__(self,typename,strip): + self.__typename = typename + self.__strip = strip + self.__search = f"(?<=[(: ])(?:[^(: ]+[-_])?{typename}(?:[-_][^): ]+)?(?=[): ])" # Searching for the exact typename or with the underscore as the delimiter + self.__attributes = [] + self.__properties = [] + self.__services = [] + self.__hwservices = [] + self.__genfs = [] + self.__files = [] + self.__types = {} + self.__transitions = [] + self.__rules = [] + self.__foreigns = [] + self.__remainings = [] + self.__daemon = "" + self.__binder = "" + self.__hwbinder = "" + + def parseLine(self,line,context): + if line.startswith("#"): + return + if re.search(self.__search,line) == None: + return + cleanLine = line.strip() + if self.__strip: + cleanLine = re.sub("(?:_[0-9]{1,2})*(?=[)_ ])","",cleanLine) # Stripping the api version part if exists + if context == "file": # Parse the information according to the context (filename) + self.__fillFile(cleanLine) + elif context == "hwservice": + self.__fillHWService(cleanLine) + elif context == "property": + self.__fillProperty(cleanLine) + elif context == "sepolicy": + self.__fillSEPolicy(cleanLine) + elif context == "service": + self.__fillService(cleanLine) + else: + self.__remainings.append(cleanLine) + + def optimize(self): + self.__attributes = sorted(list(dict.fromkeys(self.__attributes))) # Optimize all lists and remove duplicates + self.__properties = sorted(list(dict.fromkeys(self.__properties))) + self.__services = sorted(list(dict.fromkeys(self.__services))) + self.__hwservices = sorted(list(dict.fromkeys(self.__hwservices))) + self.__genfs = sorted(list(dict.fromkeys(self.__genfs))) + self.__files = sorted(list(dict.fromkeys(self.__files))) + self.__transitions = sorted(list(dict.fromkeys(self.__transitions))) + self.__rules = sorted(list(dict.fromkeys(self.__rules))) + self.__remainings = sorted(list(dict.fromkeys(self.__remainings))) + self.__foreigns = sorted(list(dict.fromkeys(self.__foreigns))) + for key in self.__types: # Same goes for the typeattributes + self.__types[key] = sorted(list(dict.fromkeys(self.__types[key]))) + self.__optimize_domain(); + self.__optimize_binder(); + self.__optimize_hwbinder(); + + def __optimize_domain(self): + index_foreigns = [] + try: # Try to find all parts of the "init_daemon" macro ... + index_transition = self.__transitions.index(f"type_transition init {self.__typename}_exec:process {self.__typename};") + index_foreigns.append(self.__foreigns.index(f"allow init {self.__typename}_exec:file {{read getattr map execute open}};")) + index_foreigns.append(self.__foreigns.index(f"allow init {self.__typename}:process {{transition}};")) + index_rules = self.__rules.index(f"allow {self.__typename} {self.__typename}_exec:file {{read getattr map execute entrypoint open}};") + index_foreigns.append(self.__foreigns.index(f"dontaudit init {self.__typename}:process {{noatsecure}};")) + index_foreigns.append(self.__foreigns.index(f"allow init {self.__typename}:process {{siginh rlimitinh}};")) + self.__rules.pop(index_rules) # ... and combine them ... + self.__transitions.pop(index_transition) + index_foreigns = sorted(index_foreigns,reverse=True) + for index in index_foreigns: + self.__foreigns.pop(index) + self.__daemon = f"init_daemon_domain({self.__typename});" # ... into the macro itself + except ValueError: + self.__daemon = "" + + def __optimize_binder(self): + index_foreigns = [] + try: # Try to find all parts of the "binder_use" macro ... + index_rules = self.__rules.index(f"allow {self.__typename} servicemanager:binder {{call transfer}};") + try: + index_foreigns.append(self.__foreigns.index(f"allow servicemanager {self.__typename}:binder {{call transfer}};")) + except ValueError: + pass + index_foreigns.append(self.__foreigns.index(f"allow servicemanager {self.__typename}:dir {{search}};")) + index_foreigns.append(self.__foreigns.index(f"allow servicemanager {self.__typename}:file {{read open}};")) + index_foreigns.append(self.__foreigns.index(f"allow servicemanager {self.__typename}:process {{getattr}};")) + self.__rules.pop(index_rules) # ... and combine them ... + index_foreigns = sorted(index_foreigns,reverse=True) + for index in index_foreigns: + self.__foreigns.pop(index) + self.__binder = f"binder_use({self.__typename});" # ... into the macro itself + except ValueError: + self.__binder = "" + + def __optimize_hwbinder(self): + index_foreigns = [] + try: # Try to find all parts of the "hwbinder_use" macro ... + index_rules = self.__rules.index(f"allow {self.__typename} hwservicemanager:binder {{call transfer}};") + try: + index_foreigns.append(self.__foreigns.index(f"allow hwservicemanager {self.__typename}:binder {{call transfer}};")) + except ValueError: + pass + index_foreigns.append(self.__foreigns.index(f"allow hwservicemanager {self.__typename}:dir {{search}};")) + try: + index_foreigns.append(self.__foreigns.index(f"allow hwservicemanager {self.__typename}:file {{read open map}};")) + except ValueError: + index_foreigns.append(self.__foreigns.index(f"allow hwservicemanager {self.__typename}:file {{read map open}};")) + index_foreigns.append(self.__foreigns.index(f"allow hwservicemanager {self.__typename}:process {{getattr}};")) + self.__rules.pop(index_rules) # ... and combine them ... + index_foreigns = sorted(index_foreigns,reverse=True) + for index in index_foreigns: + self.__foreigns.pop(index) + self.__hwbinder = f"hwbinder_use({self.__typename});" # ... into the macro itself + except ValueError: + self.__hwbinder = "" + + def outputFile(self,path): + file = open(path+self.__typename+".te","wt") # Output everything into one big *.te file per type + self.__outputArrayTitled(file,self.__attributes,"ATTRIBUTES") + self.__outputArrayTitled(file,self.__files,"FILES") + self.__outputArrayTitled(file,self.__properties,"PROPERTIES") + self.__outputArrayTitled(file,self.__services,"SERIVCES") + self.__outputArrayTitled(file,self.__hwservices,"HWSERIVCES") + self.__outputArrayTitled(file,self.__genfs,"GENFS") + self.__outputPolicies(file,"POLICIES") + self.__outputArrayTitled(file,self.__remainings,"REMAININGS") + self.__outputArrayTitled(file,self.__foreigns,"FOREIGNS") + file.close() + + def __fillFile(self,line): + self.__files.append(self.__parseObject(line)) + + def __fillHWService(self,line): + self.__hwservices.append(self.__parseObject(line)) + + def __fillProperty(self,line): + self.__properties.append(self.__parseObject(line)) + + def __fillSEPolicy(self,line): + if line.startswith("(type "): # Decide the treatment according to the first command in the line + return + elif line.startswith("(roletype "): + return + elif line.startswith("(typeattributeset "): + self.__fillType(line) + elif line.startswith("(typeattribute "): + self.__attributes.append(self.__parseAttribute(line)) + elif line.startswith("(typetransition "): + self.__transitions.append(self.__parseTransition(line)) + elif line.startswith("(genfscon "): + self.__genfs.append(self.__parseGenFS(line)) + elif line.startswith("(allow "): + self.__fillRule(line) + elif line.startswith("(dontaudit "): + self.__fillRule(line) + elif line.startswith("(auditallow "): + self.__fillRule(line) + elif line.startswith("(neverallow "): + self.__fillRule(line) + elif line.startswith("(allowx "): + self.__fillRuleX(line) + else: + self.__remainings.append(line) + + def __fillService(self,line): + self.__services.append(self.__parseObject(line)) + + def __parseObject(self,line): + search = "u:object_r:" # Search for the secontext to split + result = line.split(search) + if len(result) != 2: + print("Line is in wrong format: "+line) + return line + return f"{result[0].strip().ljust(99)} {search}{result[1]}" # Indent the secontext at index 100 + + def __fillType(self,line): + result = line.split(" ",2) + if len(result) != 3: + print("Line is in wrong format: "+line) + return + if result[1].startswith("base_typeattr_"): # I don't know how to handle base_typeattr_ (for now) + return + types = re.findall(self.__search,result[2]) + i = 0 + while i < len(types): # We need to find the actual type inside the parameter list of the attribute + if types[i] in self.__types: + self.__types[types[i]].append(result[1]) # If the type already exists we can append the attribute + else: + self.__types[types[i]] = [result[1]]; # If the type doesn't exists we need to start a new list + i += 1 + + def __parseGenFS(self,line): + result = line.split() + if len(result) != 8: + print("Line is in wrong format: "+line) + return line + command = f"{result[0][1:]} {result[1].ljust(10)} {result[2]}" # Indent the output for proper readability + context = f"{result[3][1:]}:{result[4]}:{result[5]}:{result[6][2:-1]}" # Build the secontext + return f"{command.ljust(99)} {context}" # Indent the secontext at index 100 + + def __parseAttribute(self,line): + result = line.split() + if len(result) != 2: + print("Line is in wrong format: "+line) + return line + return f"{result[0][5:]} {result[1][:-1]};" # Use the proper keyword and remove the brackets + + def __parseTransition(self,line): + result = line.split() + if len(result) != 5: + print("Line is in wrong format: "+line) + return line + return f"{result[0][1:5]}_{result[0][5:]} {result[1]} {result[2]}:{result[3]} {result[4][:-1]};" # Format the type_transition + + def __fillRule(self,line): + result = line.split() + if len(result) < 5: + print("Line is in wrong format: "+line) + self.__rules.append(line) + return + command = f"{result[0][1:]} {result[1]} {result[2]}:{result[3][1:]} {{{result[4][1:]}" # Format the first part of the rule + i = 5 + while i < len(result): # Add all the remaining parameters + command = f"{command} {result[i]}" + i += 1 + command = f"{command[:-3]}}};" # Close up everything + if re.search(self.__search,f" {result[1]} ") == None: # Only add this ruls if it targets the current type enforcement + self.__foreigns.append(command) + else: + self.__rules.append(command) + + def __fillRuleX(self,line): + result = line.split() + if len(result) < 6: + print("Line is in wrong format: "+line) + self.__rules.append(line) + return + command = f"{result[0][1:]}perm {result[1]} {result[2]}:{result[4]} {result[3][1:]} {{" # Extended rules add a "perm" to their name + i = 5 + r = False + while i < len(result): # Add all the remaining parameters + if "range" in result[i]: # Special treatment for ranges + i += 1 # Move to the next parameter + r = True + if i == 5: + command = f"{command}{result[i][1:]} " # Remove the opening bracket at the first parameter + else: + command = f"{command}{result[i]} " + if r: + i += 1 # Immediately add the second part of the range + command = f"{command[:-1]}-{result[i][:-2]} " # Ranges are defined by a "-"-sign between the values + r = False + i += 1 + command = f"{command[:-4]}}};" # Close up everything + if re.search(self.__search,f" {result[1]} ") == None: # Only add this ruls if it targets the current type enforcement + self.__foreigns.append(command) + else: + self.__rules.append(command) + + def __outputArrayTitled(self,file,array,title): + if len(array) > 0: + file.write(f"##### {title} #####"+'\n') + self.__outputArray(file,array) + + def __outputArray(self,file,array): + if len(array) == 0: + return + for line in array: + file.write(line+'\n') + file.write('\n') + + def __outputDictionary(self,file,dictionary): + if len(dictionary) == 0: + return + texts = [] + for key in sorted(dictionary): + text = f"type {str(key)}" + for line in dictionary[key]: + text = f"{text}, {line}" + texts.append(f"{text};") + self.__outputArray(file,sorted(texts)) + + def __outputPolicies(self,file,title): + if len(self.__types) > 0 or len(self.__transitions) > 0 or len(self.__rules) > 0: # Output only if there is something to write + file.write(f"##### {title} #####"+'\n') + self.__outputDictionary(file,self.__types) + special = False + if len(self.__daemon) > 0: + file.write(self.__daemon+'\n') + special = True + if len(self.__binder) > 0: + file.write(self.__binder+'\n') + special = True + if len(self.__hwbinder) > 0: + file.write(self.__hwbinder+'\n') + special = True + if special: + file.write('\n') + self.__outputArray(file,self.__transitions) + self.__outputArray(file,self.__rules) + +# END CLASS SEPolicy + +# BEGIN CLASS SEFileParser +class SEFileParser: + def __init__(self,policy): + self.__policy = policy + + def parseFile(self,name): # Parse one file + if "versioned" in name: + return + context = self.__getContext(name) + file = open(name,"rt") + for line in file: + self.__policy.parseLine(line,context) + file.close(); + + def parseFolder(self,name): # Parse all files in the folder + files = glob.glob(name) + for file in files: + if os.path.isfile(file): + self.parseFile(file) + + def __getContext(self,name): # Decide the context according to the file + if "file" in name: + return "file" + elif "hwservice" in name: + return "hwservice" + elif "service" in name: + return "service" + elif "property" in name: + return "property" + else: + return "sepolicy" + +# END CLASS SEFileParser diff --git a/tools/extract_sepolicy_plat.py b/tools/extract_sepolicy_plat.py new file mode 100755 index 0000000..b30ad9e --- /dev/null +++ b/tools/extract_sepolicy_plat.py @@ -0,0 +1,31 @@ +import sys +import os +from extract_sepolicy import SEPolicy +from extract_sepolicy import SEFileParser + +# BEGIN CLASS SEPlatParser +class SEPlatParser: + def __init__(self,typename): + self.__typename = typename + + def parseFolder(self,folder): # Parse the whole folder + sepolicy = SEPolicy(self.__typename,False) + sefileparser = SEFileParser(sepolicy) + sefileparser.parseFolder(folder+"plat_*") + sepolicy.optimize() + if not os.path.exists(folder[:-1]+"_plat/"): + os.makedirs(folder[:-1]+"_plat/") + sepolicy.outputFile(folder[:-1]+"_plat/") + +# END CLASS SEPlatParser + +def main(): + if len(sys.argv) != 2: + print("Wrong parameter count") + return + setypeparser = SEPlatParser(sys.argv[1]) + setypeparser.parseFolder("./stock/") + setypeparser.parseFolder("./lineage/") + +if __name__ == '__main__': + main() diff --git a/tools/extract_sepolicy_plat_refresh.py b/tools/extract_sepolicy_plat_refresh.py new file mode 100755 index 0000000..371221e --- /dev/null +++ b/tools/extract_sepolicy_plat_refresh.py @@ -0,0 +1,14 @@ +import glob +from pathlib import Path +from extract_sepolicy_plat import SEPlatParser + +def main(): + files = glob.glob("./lineage_plat/*.te") + for file in files: + type = Path(file).stem + setypeparser = SEPlatParser(type) + setypeparser.parseFolder("./stock/") + setypeparser.parseFolder("./lineage/") + +if __name__ == '__main__': + main() diff --git a/tools/extract_sepolicy_vend.py b/tools/extract_sepolicy_vend.py new file mode 100755 index 0000000..c8aeeda --- /dev/null +++ b/tools/extract_sepolicy_vend.py @@ -0,0 +1,30 @@ +import sys +import os +from extract_sepolicy import SEPolicy +from extract_sepolicy import SEFileParser + +# BEGIN CLASS SEVendParser +class SEVendParser: + def __init__(self,typename): + self.__typename = typename + + def parseFolder(self,folder): # Parse the whole folder + sepolicy = SEPolicy(self.__typename,True) + sefileparser = SEFileParser(sepolicy) + sefileparser.parseFolder(folder+"v*") + sepolicy.optimize() + if not os.path.exists(folder[:-1]+"_vend/"): + os.makedirs(folder[:-1]+"_vend/") + sepolicy.outputFile(folder[:-1]+"_vend/") + +# END CLASS SEVendParser + +def main(): + if len(sys.argv) != 2: + print("Wrong parameter count") + return + setypeparser = SEVendParser(sys.argv[1]) + setypeparser.parseFolder("./stock/") + +if __name__ == '__main__': + main() diff --git a/tools/sign_apk.sh b/tools/sign_apk.sh new file mode 100755 index 0000000..b9a9e5d --- /dev/null +++ b/tools/sign_apk.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +APK_NAME=$(basename -- "$1") +FILE_PATH=$(dirname -- "$1") +SCRIPT_PATH=$(dirname -- "$0") + +java -Xmx2048m \ + -Djava.library.path="$SCRIPT_PATH/../../../../out/host/linux-x86/lib64" \ + -jar "$SCRIPT_PATH/../../../../out/host/linux-x86/framework/signapk.jar" \ + -w ~/.android-certs/platform.x509.pem ~/.android-certs/platform.pk8 \ + "$1" \ + "$FILE_PATH/signed_$APK_NAME" + +rm -f $1 +mv "$FILE_PATH/signed_$APK_NAME" "$1"