mirror of
https://github.com/priyanshujain/sanderling.git
synced 2026-10-02 19:17:10 +00:00
feat(android): harden physical-device runs in device prep
Device prep now disables the AOSP cached-app freezer, phantom-process killer, and Doze (and exempts the driver) so OEM background management stops suspending the driver mid-run. Adds ReinstallApp for clear-state on ROMs that deny pm clear, and teaches focus detection to report the notification shade as systemui so the scope guard can dismiss it.
This commit is contained in:
1 parent
da7557ac0b
commit
300af1305e
2 files changed
+111
-4
No files matched your search
@@ -2,6 +2,7 @@ package android
|
||||
|
||||
import (
|
||||
"reflect"
|
||||
"strings"
|
||||
"testing"
|
||||
)
|
||||
|
||||
@@ -185,6 +186,11 @@ func TestParseFocusedWindowPackage(t *testing.T) {
|
||||
dumpsys: " some unrelated dumpsys window output\n",
|
||||
want: "",
|
||||
},
|
||||
{
|
||||
name: "notification shade focused",
|
||||
dumpsys: " mCurrentFocus=Window{885e289 u0 NotificationShade}",
|
||||
want: "com.android.systemui",
|
||||
},
|
||||
}
|
||||
for _, tc := range cases {
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
@@ -194,3 +200,32 @@ func TestParseFocusedWindowPackage(t *testing.T) {
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestAntiFreezeCommands_DisablesFreezersAndExemptsDriver(t *testing.T) {
|
||||
commands := antiFreezeCommands()
|
||||
joined := make([]string, len(commands))
|
||||
for i, c := range commands {
|
||||
joined[i] = strings.Join(c, " ")
|
||||
}
|
||||
all := strings.Join(joined, "\n")
|
||||
|
||||
wantContains := []string{
|
||||
"device_config set_sync_disabled_for_tests persistent",
|
||||
"device_config put activity_manager_native_boot use_freezer false",
|
||||
"settings put global settings_enable_monitor_phantom_procs false",
|
||||
"dumpsys deviceidle disable",
|
||||
}
|
||||
for _, want := range wantContains {
|
||||
if !strings.Contains(all, want) {
|
||||
t.Errorf("anti-freeze commands missing %q\ngot:\n%s", want, all)
|
||||
}
|
||||
}
|
||||
for _, pkg := range driverPackages {
|
||||
if !strings.Contains(all, "freeze_exempt_inst_pkg") || !strings.Contains(all, pkg) {
|
||||
t.Errorf("driver package %q not exempted from freezer\ngot:\n%s", pkg, all)
|
||||
}
|
||||
if !strings.Contains(all, "deviceidle whitelist +"+pkg) {
|
||||
t.Errorf("driver package %q not whitelisted from doze\ngot:\n%s", pkg, all)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user