Skip to content

Instantly share code, notes, and snippets.

@pgaskin
Last active November 16, 2023 18:59
Show Gist options
  • Save pgaskin/0d4d3550cbb944161dd109c21b9a7332 to your computer and use it in GitHub Desktop.
Save pgaskin/0d4d3550cbb944161dd109c21b9a7332 to your computer and use it in GitHub Desktop.
#!/bin/sh
set -eu
encode_integer() {
local value=$1
printf "0x10 0x%08X" $((value&0xFFFFFFFF))
}
encode_dimen() {
# https://android.googlesource.com/platform/frameworks/base/+/master/core/java/android/util/TypedValue.java
local unit=$1
local mantissa=$2 # -0x800000 to 0x7FFFFF
local radix=${3:-0} # default to integral (COMPLEX_RADIX_0p23)
case $unit in
0|px) unit=0 ;;
1|dp|dip) unit=1 ;;
2|sp) unit=2 ;;
3|pt) unit=3 ;;
4|in) unit=4 ;;
5|mm) unit=5 ;;
*)
echo "invalid unit"
return 1
esac
mantissa=$((mantissa&0xFFFFFF))
mantissa=$((mantissa<<8))
radix=$((radix<<4))
printf "0x5 0x%08X" $((mantissa|radix|unit))
}
overlay() {
local name=$1
local package=$2
local type=$3
local resource=$4
shift 4
local value=$(encode_$type $*)
echo cmd overlay fabricate --name $name --target $package $package:$type/$resource $value
}
device() {
if [ -z "${ANDROID_ROOT:-}" ]
then echo adb shell
fi
}
n=0
n=$((n+1)); $(device) $(overlay pg_$n com.android.systemui dimen navigation_home_handle_width dip 108) # gesture navigation pill width (needs systemui restart)
n=$((n+1)); $(device) $(overlay pg_$n com.android.systemui dimen navigation_handle_radius dip 1 ) # gesture navigation pill thickness (needs systemui restart)
n=$((n+1)); $(device) $(overlay pg_$n com.android.systemui dimen navigation_handle_bottom dip 6 ) # gesture navigation pill bottom padding (needs systemui restart)
n=$((n+1)); $(device) $(overlay pg_$n com.android.systemui dimen qs_quick_tile_size dip 50 ) # qs tile height (collapsed)
n=$((n+1)); $(device) $(overlay pg_$n com.android.systemui dimen qs_tile_height dip 80 ) # qs tile height (expanded)
n=$((n+1)); $(device) $(overlay pg_$n com.android.systemui integer quick_qs_panel_max_rows 4 ) # qs rows
n=$((n+1)); $(device) $(overlay pg_$n com.android.systemui integer quick_settings_num_columns 3 ) # qs columns
n=$((n+1)); $(device) $(overlay pg_$n com.android.systemui integer quick_qs_panel_max_tiles 6 ) # qs tile count (collapsed)
n=$((n+1)); $(device) $(overlay pg_$n com.android.systemui integer quick_settings_min_num_tiles 12 ) # qs tile count (expanded)
n=$((n+1)); $(device) $(overlay pg_$n me.zhanghai.android.files dimen two_line_list_item_height dip 56 ) # material files - file list item height
for i in $(seq 1 $n)
do $(device) cmd overlay enable com.android.shell:pg_$i
done
$(device) killall com.android.systemui
$(device) service call activity 42 s16 com.android.systemui
$(device) am startservice -n com.android.systemui/.SystemUIService
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment