Skip to content

FEAT: Added ROOT user features: AutoOpening, Slient Installing#511

Merged
j-px merged 8 commits intoSketchware-Pro:mainfrom
Maks-gaming:main
Sep 9, 2022
Merged

FEAT: Added ROOT user features: AutoOpening, Slient Installing#511
j-px merged 8 commits intoSketchware-Pro:mainfrom
Maks-gaming:main

Conversation

@Maks-gaming
Copy link
Contributor

@Maks-gaming Maks-gaming commented Jul 24, 2022

  • Auto-opening the application after installation
  • Silent installation without dialog boxes

- Auto-opening the application after installation
- Silent installation without dialog boxes
@Maks-gaming
Copy link
Contributor Author

If anything, I have placed the settings for enabling these options in the Mod menu

Copy link
Contributor

@j-px j-px left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your contribution! Some changes would be good, but this feature in general seems great.

Comment on lines +215 to +216
DataOutputStream os = new DataOutputStream(p.getOutputStream());
os.writeBytes("echo \"Do I have root?\" >/system/sd/temporary.txt\n");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you test this out? Writing to a process' output stream seems suspicious. Also, what if /system was mounted read-only? That'd false-positively assume that root isn't available. Just checking if executing su works is enough imo.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe a library for checking for root access is better. I'm pretty sure there are some, maybe even by Magisk's developer. I'll check.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This solution was found on StackOverflow, however I have tested it on 3 smartphones and it works

This comment was marked as spam.

true);
addTextInputPreference("Grant ROOT access",
"Brings app-autoinstallation", v -> {
//TODO
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what's to do here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what's to do here?

There should be a dialog here in case of an error, for example, if a person simply does not have a ROOT device

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay. I just noticed though, why is it a text input preference?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay. I just noticed though, why is it a text input preference?

So, are there other options to open a dialog box with a ROOT request?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far as I know, the app managing root access opens a dialog asking the user if the app should be granted root access. Also, why make it a setting? The user could just allow root access when it's asked for, after building a project and trying to install the APK automatically.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I hoped that it would be possible to turn this feature on or off, suddenly it would not work correctly for someone, or simply it would be unusual for a person to use it

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then I think the setting should be changed to be a simple setting whether Sketchware Pro should (try to) auto-install APKs with root or not. If it fails after having built the APK, e.g. a Toast could be shown, and the installation be done with Package installer.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand what you mean, I'll do it later, then I'll redo it in the draft for now

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's fine! Thank you for your efforts.

@j-px j-px self-assigned this Jul 24, 2022
@j-px j-px added the feature A new feature label Jul 24, 2022
@j-px
Copy link
Contributor

j-px commented Jul 24, 2022

I think John Wu's libsu should instead be used, its API looks clean and abstracts root access nicely: https://github.com/topjohnwu/libsu

@Maks-gaming
Copy link
Contributor Author

I think John Wu's libsu should instead be used, its API looks clean and abstracts root access nicely:

I think for the first time, while root is not much needed, the library is not needed

@Maks-gaming Maks-gaming marked this pull request as draft July 24, 2022 10:08
@j-px
Copy link
Contributor

j-px commented Jul 24, 2022

I think John Wu's libsu should instead be used, its API looks clean and abstracts root access nicely:

I think for the first time, while root is not much needed, the library is not needed

I'd love to start seeing clean code in Sketchware Pro's codebase instead of hack-ish ways. Since it's also a Gradle project, adding a library's not hard anymore, and pretty easily manageable.

@Maks-gaming
Copy link
Contributor Author

I think John Wu's libsu should instead be used, its API looks clean and abstracts root access nicely:

I think for the first time, while root is not much needed, the library is not needed

I'd love to start seeing clean code in Sketchware Pro's codebase instead of hack-ish ways. Since it's also a Gradle project, adding a library's not hard anymore, and pretty easily manageable.

Okay, I heard it, I'll redo it

Maks-gaming and others added 2 commits July 25, 2022 10:32
Added turn off script
Added 2,5 sec sleeping before app auto-open
@Maks-gaming Maks-gaming marked this pull request as ready for review July 25, 2022 07:33
@Maks-gaming Maks-gaming requested a review from j-px July 25, 2022 07:33
Copy link
Contributor

@j-px j-px left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems good!

@j-px
Copy link
Contributor

j-px commented Jul 25, 2022

I'm working on decompiling com.besome.sketch.editor.manage.ManageCollectionActivity right now, so I'll merge it when I'm done.

@Maks-gaming Maks-gaming changed the title Added ROOT user features: AutoOpening, Slient Installing FEAT: Added ROOT user features: AutoOpening, Slient Installing Sep 8, 2022
@Maks-gaming
Copy link
Contributor Author

Hi, when is the merge?

@j-px
Copy link
Contributor

j-px commented Sep 8, 2022

I'll get to this soon!

@j-px j-px merged commit 7ff8a59 into Sketchware-Pro:main Sep 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature A new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants