From cb8fdaf3f52fec7f818f167c07cf96ef3ee4541d Mon Sep 17 00:00:00 2001 From: Tad Date: Wed, 11 Jul 2018 11:22:22 -0400 Subject: [PATCH] Low RAM tweaks --- Misc/Features/Low_RAM.txt | 21 ++++++++++ .../android_build/lowram.mk | 11 +++--- .../0002-Perf_Tweaks.patch | 38 +++++-------------- Scripts/LineageOS-14.1/Patch.sh | 3 +- Scripts/LineageOS-15.1/Functions.sh | 3 +- Scripts/LineageOS-15.1/Patch.sh | 1 + Scripts/init.sh | 2 +- 7 files changed, 42 insertions(+), 37 deletions(-) create mode 100644 Misc/Features/Low_RAM.txt rename Patches/{LineageOS-14.1 => Common}/android_build/lowram.mk (79%) diff --git a/Misc/Features/Low_RAM.txt b/Misc/Features/Low_RAM.txt new file mode 100644 index 00000000..c502eeb2 --- /dev/null +++ b/Misc/Features/Low_RAM.txt @@ -0,0 +1,21 @@ +What changes does low_ram make? + +- Multiple users support is disabled +- Split screen is disabled +- Some smaller animations are disabled +- SystemUI: In Recents, apps do not overlay and have lower resolution previews +- SystemUI: In Recents, the 'Clear all' button is at the very bottom and always visible + +- Launcher3/Trebuchet: Some extra accents are disabled +- Contacts/Dialer/Email: Icon cache is altered +- Documents: +- Settings: Many settings are hidden + +- Signal/Silence: Max resolution for MMS image size reduction is lower +- Muzei: Blur isn't as aggressive by default + + +How much RAM is saved? + - Under 15.1 after boot settles + - mako: ~370MB -> ~310MB used by system + - d852: ~850MB -> ~680MB diff --git a/Patches/LineageOS-14.1/android_build/lowram.mk b/Patches/Common/android_build/lowram.mk similarity index 79% rename from Patches/LineageOS-14.1/android_build/lowram.mk rename to Patches/Common/android_build/lowram.mk index 7c7dc9ed..94341baa 100644 --- a/Patches/LineageOS-14.1/android_build/lowram.mk +++ b/Patches/Common/android_build/lowram.mk @@ -14,7 +14,7 @@ # limitations under the License. # -# Sets Android Go recommended default values for propreties. +# Changes various properties to reduce memory usage even on devices with 1GB+ RAM # Set lowram options PRODUCT_PROPERTY_OVERRIDES += \ @@ -24,14 +24,13 @@ PRODUCT_PROPERTY_OVERRIDES += \ config.disable_atlas=true \ persist.sys.use_16bpp_alpha=1 +# set threshold to filter unused apps +PRODUCT_PROPERTY_OVERRIDES += \ + pm.dexopt.downgrade_after_inactive_days=14 + # Speed profile services and wifi-service to reduce RAM and storage. PRODUCT_SYSTEM_SERVER_COMPILER_FILTER := speed-profile # Always preopt extracted APKs to prevent extracting out of the APK for gms # modules. PRODUCT_ALWAYS_PREOPT_EXTRACTED_APK := true - -# Default heap sizes. Allow up to 256m for large heaps to make sure a single app -# doesn't take all of the RAM. -PRODUCT_PROPERTY_OVERRIDES += dalvik.vm.heapgrowthlimit=128m -PRODUCT_PROPERTY_OVERRIDES += dalvik.vm.heapsize=256m diff --git a/Patches/LineageOS-14.1/android_device_asus_grouper/0002-Perf_Tweaks.patch b/Patches/LineageOS-14.1/android_device_asus_grouper/0002-Perf_Tweaks.patch index 067f3f68..bfaad15b 100644 --- a/Patches/LineageOS-14.1/android_device_asus_grouper/0002-Perf_Tweaks.patch +++ b/Patches/LineageOS-14.1/android_device_asus_grouper/0002-Perf_Tweaks.patch @@ -1,18 +1,18 @@ -From 08c7e33d75eb9c8546db621e6ca28bd9ca922402 Mon Sep 17 00:00:00 2001 +From 74a903c4ee34bb0ab058a749789805f765479a1e Mon Sep 17 00:00:00 2001 From: Tad -Date: Tue, 10 Jul 2018 19:38:55 -0400 +Date: Wed, 11 Jul 2018 13:54:10 -0400 Subject: [PATCH] Performance tweaks from @AndDiSa -Change-Id: I481bd5ac610247cdcae1af42620a36ca5943505e +Change-Id: I87e7b700b3caf713e98bcfdc74613da23139db70 --- - BoardConfigCommon.mk | 4 ++ + BoardConfigCommon.mk | 3 ++ device.mk | 3 +- - .../base/core/res/res/values/config.xml | 7 ++++ - system.prop | 39 +++++++++++++++++-- - 4 files changed, 49 insertions(+), 4 deletions(-) + .../base/core/res/res/values/config.xml | 7 +++++ + system.prop | 29 +++++++++++++++++-- + 4 files changed, 38 insertions(+), 4 deletions(-) diff --git a/BoardConfigCommon.mk b/BoardConfigCommon.mk -index f402c86..2ea1317 100644 +index f402c86..c84be43 100644 --- a/BoardConfigCommon.mk +++ b/BoardConfigCommon.mk @@ -20,6 +20,9 @@ TARGET_ARCH := arm @@ -25,14 +25,6 @@ index f402c86..2ea1317 100644 TARGET_BOOTLOADER_BOARD_NAME := grouper # Filesystem -@@ -52,6 +55,7 @@ BOARD_SYSTEMIMAGE_JOURNAL_SIZE := 0 - - # Only pre-optimize the boot image - WITH_DEXPREOPT_BOOT_IMG_ONLY := true -+PRODUCT_SYSTEM_SERVER_COMPILER_FILTER := speed-profile - - # Configure jemalloc for low-memory - MALLOC_SVELTE := true diff --git a/device.mk b/device.mk index 33c1fc9..8d8c65a 100644 --- a/device.mk @@ -64,10 +56,10 @@ index d28e4fb..c9ec73a 100644 + diff --git a/system.prop b/system.prop -index b1d9807..7f540b5 100644 +index b1d9807..1f31c09 100644 --- a/system.prop +++ b/system.prop -@@ -12,6 +12,39 @@ ro.sf.lcd_density=213 +@@ -12,6 +12,29 @@ ro.sf.lcd_density=213 # Wi-Fi wifi.interface=wlan0 @@ -83,7 +75,6 @@ index b1d9807..7f540b5 100644 +ro.zygote.disable_gl_preload=true + +#perf tweaks -+config.disable_atlas=true +dalvik.vm.dex2oat-flags=--no-watch-dog +dalvik.vm.dex2oat-swap=true +debug.hwui.render_dirty_regions=false @@ -100,16 +91,7 @@ index b1d9807..7f540b5 100644 +ro.sys.fw.trim_cache_percent=70 +ro.sys.fw.trim_empty_percent=70 +ro.sys.fw.use_trim_settings=true -+ -+#go -+dalvik.vm.heapgrowthlimit=128m -+dalvik.vm.heapsize=256m +dalvik.vm.madvise-random=true -+pm.dexopt.downgrade_after_inactive_days=10 -+pm.dexopt.shared=quicken -+ro.config.low_ram=true -+ro.lmk.critical_upgrade=true -+ro.lmk.upgrade_pressure=40 -- 2.18.0 diff --git a/Scripts/LineageOS-14.1/Patch.sh b/Scripts/LineageOS-14.1/Patch.sh index d845d404..723db6d9 100755 --- a/Scripts/LineageOS-14.1/Patch.sh +++ b/Scripts/LineageOS-14.1/Patch.sh @@ -68,7 +68,7 @@ patch -p1 < "$DOS_PATCHES/android_build/0001-Automated_Build_Signing.patch"; #Au sed -i 's/messaging/Silence/' target/product/*.mk; #Replace AOSP Messaging app with Silence sed -i 's/ro.secure=0/ro.secure=1/' core/main.mk; #sed -i 's/ro.adb.secure=0/ro.adb.secure=1/' core/main.mk; -cp "$DOS_PATCHES/android_build/lowram.mk" target/product/lowram.mk; +cp "$DOS_PATCHES_COMMON/android_build/lowram.mk" target/product/lowram.mk; enterAndClear "device/qcom/sepolicy"; patch -p1 < "$DOS_PATCHES/android_device_qcom_sepolicy/0001-Camera_Fix.patch"; #Fix camera on user builds XXX: REMOVE THIS TRASH @@ -233,6 +233,7 @@ sed -i 's/,encryptable=footer//' rootdir/etc/fstab.qcom; #Using footer will brea #XXX: If not used with a supported recovery, it'll be thrown into a bootloop, don't worry just 'fastboot erase misc' and reboot #echo "/dev/block/platform/msm_sdcc.1/by-name/misc /misc emmc defaults defaults" >> rootdir/etc/fstab.qcom; #Add the misc (mmcblk0p5) partition for recovery flags +enableLowRam "device/asus/grouper"; enterAndClear "device/asus/grouper"; patch -p1 < "$DOS_PATCHES/android_device_asus_grouper/0001-Update_Blobs.patch"; patch -p1 < "$DOS_PATCHES/android_device_asus_grouper/0002-Perf_Tweaks.patch"; diff --git a/Scripts/LineageOS-15.1/Functions.sh b/Scripts/LineageOS-15.1/Functions.sh index c025d85a..7473dd17 100644 --- a/Scripts/LineageOS-15.1/Functions.sh +++ b/Scripts/LineageOS-15.1/Functions.sh @@ -124,7 +124,8 @@ export -f enableDexPreOptFull; enableLowRam() { cd "$DOS_BUILD_BASE$1"; - if [ -f lineage.mk ]; then echo '$(call inherit-product, $(SRC_TARGET_DIR)/product/go_defaults.mk)' >> lineage.mk; fi; + #if [ -f lineage.mk ]; then echo '$(call inherit-product, $(SRC_TARGET_DIR)/product/go_defaults.mk)' >> lineage.mk; fi; + if [ -f lineage.mk ]; then echo '$(call inherit-product, $(SRC_TARGET_DIR)/product/lowram.mk)' >> lineage.mk; fi; if [ -f BoardConfig.mk ]; then echo 'MALLOC_SVELTE := true' >> BoardConfig.mk; fi; if [ -f BoardConfigCommon.mk ]; then echo 'MALLOC_SVELTE := true' >> BoardConfigCommon.mk; fi; echo "Enabled lowram for $1"; diff --git a/Scripts/LineageOS-15.1/Patch.sh b/Scripts/LineageOS-15.1/Patch.sh index 04aa5c79..9b0a0b94 100755 --- a/Scripts/LineageOS-15.1/Patch.sh +++ b/Scripts/LineageOS-15.1/Patch.sh @@ -67,6 +67,7 @@ awk -i inplace '!/PRODUCT_EXTRA_RECOVERY_KEYS/' core/product.mk; sed -i 's/messaging/Silence/' target/product/*.mk; #Replace AOSP Messaging app with Silence sed -i 's/ro.secure=0/ro.secure=1/' core/main.mk; #sed -i 's/ro.adb.secure=0/ro.adb.secure=1/' core/main.mk; +cp "$DOS_PATCHES_COMMON/android_build/lowram.mk" target/product/lowram.mk; enterAndClear "device/lineage/sepolicy"; git revert c9b0d95630b82cd0ad1a0fc633c6d59c2cb8aad7 37422f7df389f3ae5a34ee3d6dd9354217f9c536; #neverallow violation diff --git a/Scripts/init.sh b/Scripts/init.sh index 8934862f..8155a8fa 100644 --- a/Scripts/init.sh +++ b/Scripts/init.sh @@ -37,7 +37,7 @@ export DOS_MICROG_INCLUDED="NLP"; #Determines inclusion of microG. Options: NONE export DOS_HOSTS_BLOCKING=true; #Switch to false to prevent inclusion of our HOSTS file export DOS_HOSTS_BLOCKING_LIST="https://divestos.xyz/hosts"; #Must be in the format "127.0.0.1 bad.domain.tld" export DOS_OVERCLOCKS_ENABLED=true; #Switch to false to disable overclocks -export DOS_LOWRAM_ENABLED=false; #Switch to true to enable lowram/Go configuration on all devices +export DOS_LOWRAM_ENABLED=false; #Switch to true to enable low_ram on all devices export DOS_STRONG_ENCRYPTION_ENABLED=false; #Switch to true to enable AES-256bit encryption XXX: THIS WILL **DESTROY** EXISTING INSTALLS! export DOS_NON_COMMERCIAL_USE_PATCHES=false; #Switch to false to prevent inclusion of non-commercial use patches