-
Notifications
You must be signed in to change notification settings - Fork 112
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor(ADB): improve internal API #757
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
3db771e
to
0f48489
Compare
Also forgot to revert another `phone`->`device` rename
This comment was marked as duplicate.
This comment was marked as duplicate.
This comment was marked as resolved.
This comment was marked as resolved.
After adding an unconditional
This implies universal-android-debloater-next-generation/src/core/utils.rs Lines 39 to 59 in 0238982
This also seems to happen on the universal-android-debloater-next-generation/src/gui/views/list.rs Lines 854 to 856 in bfda7d0
universal-android-debloater-next-generation/src/gui/views/list.rs Lines 159 to 177 in bfda7d0
|
// status | ||
dev_stat[(tab_idx + 1)..].to_string(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've found info on adb help
:
scripting:
wait-for[-TRANSPORT]-STATE...
wait for device to be in a given state
STATE: device, recovery, rescue, sideload, bootloader, or disconnect
TRANSPORT: usb, local, or any [default=any]
So now we know the full list of states, which we can turn into a (non_exhaustive
) enum!
As a bonus, wait-for-device
allows UAD-NG to stop polling adb devices
(no need for retry
!)
I've just realized a minor performance oversight: It's possible to "batch" multiple So instead of: // Imagine this is an unrolled loop,
// not actual code written manually
// adb shell pm uninstall --user 0 a.a
ACommand::new()
.shell("")
.pm()
.uninstall(0, PackageId::new("a.a").unwrap());
// adb shell pm uninstall --user 0 b.b
ACommand::new()
.shell("")
.pm()
.uninstall(0, PackageId::new("b.b").unwrap()); It would be: // adb shell 'pm uninstall --user 0 a.a; pm uninstall --user 0 b.b'
ACommand::new()
.shell("")
.pm()
.uninstall(0, PackageId::new("a.a").unwrap())
.pm()
.uninstall(0, PackageId::new("b.b").unwrap())
.run(); This guarantees The biggest obstacle to this, are commands whose output must be parsed: Batching # ambiguity!
adb shell 'pm list packages -e; pm list packages -d' A hacky solution is to insert a delimiter between outputs: adb shell '\
pm list packages -e;\
echo;\
pm list packages -d\
' Now we simply find "\n\n", and we've efficiently resolved the ambiguity! This would work for the "raw" IMO, we shouldn't worry too much about this. It's needlessly complicated just to "improve" performance. Also, too many args (or long args) are more likely to cause crashes |
This comment was marked as resolved.
This comment was marked as resolved.
Suggestions have been applied
I forgot to emphasize this, but we have to test the multi-user handling before release. I'm not confident that |
Hey @Rudxain, just wanted to thank you for your tremendous work on this PR, it was probably a lot of work. Feel free to convert one of your comments into an issue that are deemed important enough. Could someone test this? I don't have multiple users either. Perhaps create an issue and add it to the 1.1.1 milestone. |
sync
): removeset_var
in favor ofadb_id
#653sync
): removeset_var
in favor ofadb_id
#653 (comment)The goal is to make ADB commands:
stdout
I am sorry to whoever is going to review this 😅. I didn't want the diff to be so big 💀