mirror of
https://github.com/topjohnwu/Magisk.git
synced 2025-10-27 05:29:22 +00:00
Support API level as floating point
This commit is contained in:
@@ -86,7 +86,7 @@ resolve_vars() {
|
|||||||
# Determine API level
|
# Determine API level
|
||||||
local api
|
local api
|
||||||
case $ver in
|
case $ver in
|
||||||
+([0-9])) api=$ver ;;
|
+([0-9\.])) api=$ver ;;
|
||||||
TiramisuPrivacySandbox) api=33 ;;
|
TiramisuPrivacySandbox) api=33 ;;
|
||||||
UpsideDownCakePrivacySandbox) api=34 ;;
|
UpsideDownCakePrivacySandbox) api=34 ;;
|
||||||
VanillaIceCream) api=35 ;;
|
VanillaIceCream) api=35 ;;
|
||||||
@@ -100,10 +100,10 @@ resolve_vars() {
|
|||||||
|
|
||||||
# Determine default image type
|
# Determine default image type
|
||||||
if [ -z $type ]; then
|
if [ -z $type ]; then
|
||||||
if [ $api -ge $atd_min_api -a $api -le $atd_max_api ]; then
|
if [ $(bc <<< "$api >= $atd_min_api && $api <= $atd_max_api") = 1 ]; then
|
||||||
# Use the lightweight ATD images if possible
|
# Use the lightweight ATD images if possible
|
||||||
type='aosp_atd'
|
type='aosp_atd'
|
||||||
elif [ $api -gt $atd_max_api ]; then
|
elif [ $(bc <<< "$api > $atd_max_api") = 1 ]; then
|
||||||
# Preview/beta release, no AOSP version available
|
# Preview/beta release, no AOSP version available
|
||||||
type='google_apis'
|
type='google_apis'
|
||||||
else
|
else
|
||||||
@@ -113,7 +113,7 @@ resolve_vars() {
|
|||||||
|
|
||||||
# Old Linux kernels will not boot with memory larger than 3GB
|
# Old Linux kernels will not boot with memory larger than 3GB
|
||||||
local memory
|
local memory
|
||||||
if [ $api -lt $huge_ram_min_api ]; then
|
if [ $(bc <<< "$api < $huge_ram_min_api") = 1 ]; then
|
||||||
memory=3072
|
memory=3072
|
||||||
else
|
else
|
||||||
memory=8192
|
memory=8192
|
||||||
@@ -169,8 +169,9 @@ test_emu() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
test_main() {
|
test_main() {
|
||||||
local avd_pkg ramdisk
|
local avd_pkg ramdisk vars
|
||||||
eval $(resolve_vars "emu_args avd_pkg ramdisk" $1 $2)
|
vars=$(resolve_vars "emu_args avd_pkg ramdisk" $1 $2)
|
||||||
|
eval $vars
|
||||||
|
|
||||||
# Specify an explicit port so that tests can run with other emulators running at the same time
|
# Specify an explicit port so that tests can run with other emulators running at the same time
|
||||||
local emu_port=5682
|
local emu_port=5682
|
||||||
@@ -216,16 +217,18 @@ test_main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
run_main() {
|
run_main() {
|
||||||
local avd_pkg
|
local avd_pkg vars
|
||||||
eval $(resolve_vars "emu_args avd_pkg" $1 $2)
|
vars=$(resolve_vars "emu_args avd_pkg" $1 $2)
|
||||||
|
eval $vars
|
||||||
setup_emu "$avd_pkg"
|
setup_emu "$avd_pkg"
|
||||||
print_title "* Launching $avd_pkg"
|
print_title "* Launching $avd_pkg"
|
||||||
"$emu" @test $emu_args 2>/dev/null
|
"$emu" @test $emu_args 2>/dev/null
|
||||||
}
|
}
|
||||||
|
|
||||||
dl_main() {
|
dl_main() {
|
||||||
local avd_pkg
|
local avd_pkg vars
|
||||||
eval $(resolve_vars "avd_pkg" $1 $2)
|
vars=$(resolve_vars "avd_pkg" $1 $2)
|
||||||
|
eval $vars
|
||||||
print_title "* Downloading $avd_pkg"
|
print_title "* Downloading $avd_pkg"
|
||||||
dl_emu "$avd_pkg"
|
dl_emu "$avd_pkg"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ print_title() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
print_error() {
|
print_error() {
|
||||||
echo -e "\n\033[41;39m${1}\033[0m\n"
|
echo -e "\n\033[41;39m${1}\033[0m\n" >&2
|
||||||
}
|
}
|
||||||
|
|
||||||
# $1 = TestClass#method
|
# $1 = TestClass#method
|
||||||
|
|||||||
Reference in New Issue
Block a user