能否通过启动三星BatteryActivity并借助Extras聚焦「Unmonitored apps」按钮?
Great question! Let's dive into whether you can use Intent Extras to directly focus on the Unmonitored apps section in Samsung's com.samsung.android.sm.ui.battery.BatteryActivity:
First: Samsung's system app Intents are often undocumented
Samsung doesn't publicly document the Intent Extras for most of their preloaded system apps, including the Battery Activity. That said, many of these apps do support hidden Extras to jump directly to specific subpages—we just need to find them.How to test for working Extras
The easiest way to experiment is using adb shell commands to launch the Activity with different parameters. For example, try variations like:# Try common string-based key-value pairs adb shell am start -n com.samsung.android.sm/.ui.battery.BatteryActivity --es "target_section" "unmonitored_apps" # Try integer-based destination indices adb shell am start -n com.samsung.android.sm/.ui.battery.BatteryActivity --ei "destination" 3Common keys to test include
section,destination,target, orpage; values might be strings like"unmonitored"or integers corresponding to the subpage index.If Extras don't exist: Use Accessibility Service as a fallback
If no hidden Extras support this navigation, you can use Android's Accessibility API to automate the click. Here's the gist:- Launch the
BatteryActivitynormally. - Use an Accessibility Service to scan the UI hierarchy for the Unmonitored apps button (look for its text or resource ID).
- Trigger a programmatic click on that UI element.
Note: This requires the user to grant your app Accessibility permissions, which is a standard system prompt.
- Launch the
Pro trick to find hidden Extras
To confirm if any Extras exist, decompile the Samsung Smart Manager APK (com.samsung.android.sm) using a tool like Apktool. Then, check theBatteryActivityclass'sonCreate()oronNewIntent()methods for code that reads Intent Extras (e.g.,getIntent().getStringExtra("some_key")) and uses them to navigate to a specific fragment or section. This will tell you exactly which parameters (if any) are supported.
内容的提问来源于stack exchange,提问作者Lucas Dias

