blocker icon indicating copy to clipboard operation
blocker copied to clipboard

Possibility of using Blocker as system app and don't require root?

Open ixearth opened this issue 5 years ago • 7 comments

Is it possible to make Blocker as system app and use it without root?

maybe put the blocker apk to /system/priv-app/ and whitelist required permissions to a file under /system/etc/permissions/ ? https://source.android.com/devices/tech/config/perms-whitelist could it call pm, cmd package or read/write to /data/system/ifw/ then?

https://developer.android.com/reference/android/Manifest.permission#CHANGE_COMPONENT_ENABLED_STATE

Allows an application to change whether an application component (other than its own) is enabled or not. Not for use by third-party applications. Constant Value: "android.permission.CHANGE_COMPONENT_ENABLED_STATE"

Is it possible to use this to enable/disable app components?

if this could work, we can package Blocker as a Magisk module, or make it TWRP flashable. Since google seems don't want this kind of app on Play Store, Magisk repo probably could be a better place if Blocker could works this way. :thinking:

ixearth avatar Apr 16 '19 10:04 ixearth

Yes, it is possible. I did research a year ago. If we run blocker as system app we could use system API to change component state directly. It is fast and easy to implement, and IFW folder is readable / writable. But it is not easy to put blocker into /system/priv-app/ so I did not implement it.

lihenggui avatar Apr 16 '19 14:04 lihenggui

I could make an extra selection in the controller settings. But recently I'm quite busy, I will add it into my checklist.

lihenggui avatar Apr 16 '19 14:04 lihenggui

But it is not easy to put blocker into /system/priv-app/ so I did not implement it.

making Magisk module is pretty simple, magisk modules are just replace files to system partition. and it's TWRP flashable, flash it again can uninstall it.

ixearth avatar Apr 17 '19 10:04 ixearth

making an extra selection for this feature in the controller settings is good, but it's better to have a separate version for being installed as system app.

since RootTools, RootShell and Shizuku stuff will be useless when Blocker was installed as system app, I think we could have a clean, more lightweight and FOSS version as Magisk module. maybe you can create a new branch for this and release Magisk module there in the further.

ixearth avatar Apr 17 '19 11:04 ixearth

write your app as a in-system whitelist is not recommended and dangerous, you should use Root permission directly and disable the Root authority as soon as possible.

NewBugger avatar May 22 '20 08:05 NewBugger

this is not a good idea, so it shouldn't be uploaded to F-droid.

NewBugger avatar May 22 '20 08:05 NewBugger

write your app as a in-system whitelist is not recommended and dangerous

No I don't think so, I think it's a good idea to use open source Apps as system-app to make use of Android hidden APIs (such like ifw and appops). Those are just features that custom ROMs are supposed to provide, we just make it a (magisk) module or use TWRP to flash these additional files. This is especially useful for people who don't want root.

My suggestion is having two apks for the one require root and the one only works as system app, and release the first one on F-Droid, pack the second one into a magisk module or TWRP flashable zip.

ixearth avatar May 22 '20 15:05 ixearth