[Dev/App/Framework] PDroid 2.0 Touchwiz port for JB OTA

Search This thread

TrevE

Retired Recognized Developer
Apr 27, 2007
2,031
3,659
androidsecuritytest.com
Thanks
Thanks always have to go out first - Many thanks to Eschelon for the many hours of wiping/testing for me along with the rest of the Synergy team. I still don't have a gs3 so most of this was done blind and let me say that was a very difficult task. Of course thanks to all the original PDroid developers that made the base code available.

If you want to use this prebuilt into a rom - starting tonight (01Jan13 r147) Synergy builds will have this framework already ported in. You will just need to load on an APK to start blocking perms. Other rom devs I have included just the framework in post 2 - just make sure to give credit back to me/this thread- this took awhile to port over :)

What is it?
PDroid is a (awesome) security framework similar to superuser but allows selective blocking of app permissions. It creates a "proxy" between the actual permissions and the PDroid framework which allow passing of different return data.
Because of the proxy created this method is better than apps which just remove permissions from manifests because it should not cause any fcs- Apps will never know the difference. It also allows patching permissions such as location/android id/camera to return spoofed data.

PDroid is a very complex mod across many parts of framework. I have not seen a proper port of this done as of yet - We have spent much time verifying that this port of PDroid 2.0 successfully works with various permissions. See below screenshots for proof.

Framework Mods:
The framework portion of this mod is a port of the 20121017 patch of pdroid2.0 for cyanogenmod rewritten by me to work on TW.
The main patches are located here: https://github.com/mateor/auto-patcher/tree/master/patches/pd2.0/jellybean/cm/ I believe it is based off of CollegeDev's source from
http://forum.xda-developers.com/showthread.php?t=1923576

Downloads section below contain the modded services.jar/core.jar/framework.jar from the JellyBean OTA.

PDroid Application:
The app I preferred and what most of our testing was done on is called PDroid Manager - This is one of the only GPL licensed PDroid apps I have seen. The original thread is up here - http://forum.xda-developers.com/showthread.php?t=1994860
I needed to make some changes to deal with exception errors the original source was throwing. The original code is GPL'ed, my source is up in the Downloads section

If you do not want to use Pdroid Manager you can switch to the PDroid 2.0 App by installing it from original thread http://forum.xda-developers.com/showthread.php?t=1923576
**when switching apps you probably want to uninstall old one, delete /data/system/privacy.db reboot then install new app. I do not believe 2 can coexist**

Verifying PDroid Works:
A good test app is "Network Info II" from market. You can also use my Logging Test App to test some values such as android id. Other valid tests are items such as blocking Phone from Calls and verifying you get a call error or blocking maps from location.
The one thing we did notice was the stock camera app was not able to be blocked, but any 3rd party app that uses camera blocking will work (probably due to samsung's app using some hidden calls in framework via reflection)
 
Last edited:

TrevE

Retired Recognized Developer
Apr 27, 2007
2,031
3,659
androidsecuritytest.com
Last edited:

im_on_fire

Senior Member
Oct 25, 2010
309
83
so I'm on the newest synergy and trying to get the hang of pdroid.

if I deny facebook access to anything it won't open and force closes. when i reallow it to access everything it still FCs until I purge pdroid settings. Not really sure what's happening.
 

eschelon

Retired Recognized Developer
Jun 20, 2009
1,388
8,954
so I'm on the newest synergy and trying to get the hang of pdroid.

if I deny facebook access to anything it won't open and force closes. when i reallow it to access everything it still FCs until I purge pdroid settings. Not really sure what's happening.

Hmm, it's working properly on my end. It really shouldn't ever FC since PDroid just spoofs fake data, and it doesn't allow you to block full internet access since that would arguably cause most apps to FC, which would defeat PDroid's purpose.

Try deleting facebook and reinstalling fresh from the market. If it still FCs, post a logcat for us so we can take a look and maybe see what's going on.
 
  • Like
Reactions: TrevE

im_on_fire

Senior Member
Oct 25, 2010
309
83
Hmm, it's working properly on my end. It really shouldn't ever FC since PDroid just spoofs fake data, and it doesn't allow you to block full internet access since that would arguably cause most apps to FC, which would defeat PDroid's purpose.

Try deleting facebook and reinstalling fresh from the market. If it still FCs, post a logcat for us so we can take a look and maybe see what's going on.

so this is me opening facebook successfully then opening pdroid and denying facebook gps location. then i try opening facebook again and it force closes:

Code:
--------- beginning of /dev/log/main
I/Adreno200-EGLSUB(24989): <ConfigWindowMatch:2087>: Format RGBA_8888.
I/Adreno200-EGLSUB(24989): <ConfigWindowMatch:2087>: Format RGBA_8888.
W/IInputConnectionWrapper(24989): getExtractedText on inactive InputConnection
W/IInputConnectionWrapper(24989): beginBatchEdit on inactive InputConnection
W/IInputConnectionWrapper(24989): endBatchEdit on inactive InputConnection
W/IInputConnectionWrapper(24989): beginBatchEdit on inactive InputConnection
W/IInputConnectionWrapper(24989): endBatchEdit on inactive InputConnection
W/IInputConnectionWrapper(24989): beginBatchEdit on inactive InputConnection
W/IInputConnectionWrapper(24989): endBatchEdit on inactive InputConnection
W/IInputConnectionWrapper(24989): beginBatchEdit on inactive InputConnection
W/IInputConnectionWrapper(24989): endBatchEdit on inactive InputConnection
I/Term    (24989): Subprocess exited: 129
W/IInputConnectionWrapper(24989): showStatusIcon on inactive InputConnection
E/Term    (24989): onCreate
D/Term    (24989): TermService started
I/TermService(24989): Activity called onBind()
I/Adreno200-EGLSUB(24989): <ConfigWindowMatch:2087>: Format RGBA_8888.
I/Term    (24989): Bound to TermService
I/TermService(24989): Activity binding to service
I/Term    (24989): waiting for: 28326
I/Adreno200-EGLSUB(24989): <ConfigWindowMatch:2087>: Format RGBA_8888.
I/Adreno200-EGLSUB(24989): <ConfigWindowMatch:2087>: Format RGBA_8888.
W/IInputConnectionWrapper(24989): showStatusIcon on inactive InputConnection
E/Term    (24989): onCreate
I/Term    (24989): Bound to TermService
I/TermService(24989): Activity binding to service
I/Adreno200-EGLSUB(24989): <ConfigWindowMatch:2087>: Format RGBA_8888.
I/Adreno200-EGLSUB(24989): <ConfigWindowMatch:2087>: Format RGBA_8888.

let me know if this is incorrect. i used my phone to make the logcat. if not ill make one from my computer tonight. (also, i can't access pastebin from work)

I should also add that this happens with any app, not just facebook.
 
Last edited:

eschelon

Retired Recognized Developer
Jun 20, 2009
1,388
8,954
so this is me opening facebook successfully then opening pdroid and denying facebook gps location. then i try opening facebook again and it force closes:

Code:
--------- beginning of /dev/log/main
I/Adreno200-EGLSUB(24989): <ConfigWindowMatch:2087>: Format RGBA_8888.
I/Adreno200-EGLSUB(24989): <ConfigWindowMatch:2087>: Format RGBA_8888.
W/IInputConnectionWrapper(24989): getExtractedText on inactive InputConnection
W/IInputConnectionWrapper(24989): beginBatchEdit on inactive InputConnection
W/IInputConnectionWrapper(24989): endBatchEdit on inactive InputConnection
W/IInputConnectionWrapper(24989): beginBatchEdit on inactive InputConnection
W/IInputConnectionWrapper(24989): endBatchEdit on inactive InputConnection
W/IInputConnectionWrapper(24989): beginBatchEdit on inactive InputConnection
W/IInputConnectionWrapper(24989): endBatchEdit on inactive InputConnection
W/IInputConnectionWrapper(24989): beginBatchEdit on inactive InputConnection
W/IInputConnectionWrapper(24989): endBatchEdit on inactive InputConnection
I/Term    (24989): Subprocess exited: 129
W/IInputConnectionWrapper(24989): showStatusIcon on inactive InputConnection
E/Term    (24989): onCreate
D/Term    (24989): TermService started
I/TermService(24989): Activity called onBind()
I/Adreno200-EGLSUB(24989): <ConfigWindowMatch:2087>: Format RGBA_8888.
I/Term    (24989): Bound to TermService
I/TermService(24989): Activity binding to service
I/Term    (24989): waiting for: 28326
I/Adreno200-EGLSUB(24989): <ConfigWindowMatch:2087>: Format RGBA_8888.
I/Adreno200-EGLSUB(24989): <ConfigWindowMatch:2087>: Format RGBA_8888.
W/IInputConnectionWrapper(24989): showStatusIcon on inactive InputConnection
E/Term    (24989): onCreate
I/Term    (24989): Bound to TermService
I/TermService(24989): Activity binding to service
I/Adreno200-EGLSUB(24989): <ConfigWindowMatch:2087>: Format RGBA_8888.
I/Adreno200-EGLSUB(24989): <ConfigWindowMatch:2087>: Format RGBA_8888.

let me know if this is incorrect. i used my phone to make the logcat. if not ill make one from my computer tonight. (also, i can't access pastebin from work)

I should also add that this happens with any app, not just facebook.

Do this: Plug you phone into a computer via USB and wait for your mass storage to open up, then in a command prompt type:

adb remount
adb logcat >log.txt
then hit enter and it will create that log.txt file in whatever filepath your command prompt is showing at will start logging (nothing will show up in that command prompt, but it will be actively logging in that file you just made). Then while that's running open facebook, let it crash, then go back to command prompt and hit ctrl+C

Throw that log.txt file on dropbox or something and send me or Trev a PM with a link to it
 
  • Like
Reactions: im_on_fire

im_on_fire

Senior Member
Oct 25, 2010
309
83
Do this: Plug you phone into a computer via USB and wait for your mass storage to open up, then in a command prompt type:

adb remount
adb logcat >log.txt
then hit enter and it will create that log.txt file in whatever filepath your command prompt is showing at will start logging (nothing will show up in that command prompt, but it will be actively logging in that file you just made). Then while that's running open facebook, let it crash, then go back to command prompt and hit ctrl+C

Throw that log.txt file on dropbox or something and send me or Trev a PM with a link to it

i tried sending it to you last night but im not sure if it sent. it's not in my outbox
 

mateorod

Inactive Recognized Developer
Nov 16, 2011
1,982
3,503
New Orleans
www.gigmasters.com
Always good to see another port. Great post!

If anyone is looking to use Pdroid Manager on other roms or devices you can use my tool the auto-patcher . Works on Cyanogen, PA, AOKP, Evervolv and AOSP along with many others. Touchwiz , Sense and smaller device specific roms usually fail to patch. We support CM7 to Android 4.1.2 for now.

Those source patches you got from my github are based off svyat's source. Additions were made by me, pastime1971 and CollegeDev.
 
  • Like
Reactions: WhoWhere and fsi09

slycog

Senior Member
Apr 28, 2011
64
26
i wonder if this can work on other gs3 variants such as tmobile version

This is for stock touchwiz roms.. based on your signature you're running a CM kang, under the assumption that the developer of your kang hasnt drastically modified any of the core components (unlikely) there are already instructions on how to patch pdroid into your rom.

Taken from the first post of this thread:
http://forum.xda-developers.com/showthread.php?t=1923576
http://forum.xda-developers.com/showthread.php?t=1719408
 

brashmadcap

Senior Member
May 22, 2010
467
160
Texas
PDROID!!!

I saw this and said WHOA! out loud to myself. My main problem with Android has been and remains it's excessively permissive permissions (lol). Lack of PDroid was literally the number one reason I was hesitant to move from my Galaxy Nexus with AOSP to a Galaxy Note II with TouchWiz. Now that this is looking like it has legs, is there anything I can do to get this into the G Note II version of TouchWiz? Don't mind running an international ROM on my T-Mobile version in order to do this. I'm going to try and patch it at as is at a normal hour when I get up tomorrow, and I will report back! THANK YOU SO MUCH!

Edit: Got too excited and didn't the original posts thoroughly. Realistically I need to decompile and diff the core.jar, framework.jar and services.jar and see how difficult it would be to merge the changes into the GN2 JB builds. I thought originally this was a patch that would function like the autopatcher and do all the work for me :p. I may need guidance here when I inevitably bork this :-/

Tomorrow(ish)!
 
Last edited:

nitric13

Member
Jul 13, 2011
31
2
so I'm on the newest synergy and trying to get the hang of pdroid.

if I deny facebook access to anything it won't open and force closes. when i reallow it to access everything it still FCs until I purge pdroid settings. Not really sure what's happening.


Exact same issue for me....same rom
 

Top Liked Posts

  • There are no posts matching your filters.
  • 29
    Thanks
    Thanks always have to go out first - Many thanks to Eschelon for the many hours of wiping/testing for me along with the rest of the Synergy team. I still don't have a gs3 so most of this was done blind and let me say that was a very difficult task. Of course thanks to all the original PDroid developers that made the base code available.

    If you want to use this prebuilt into a rom - starting tonight (01Jan13 r147) Synergy builds will have this framework already ported in. You will just need to load on an APK to start blocking perms. Other rom devs I have included just the framework in post 2 - just make sure to give credit back to me/this thread- this took awhile to port over :)

    What is it?
    PDroid is a (awesome) security framework similar to superuser but allows selective blocking of app permissions. It creates a "proxy" between the actual permissions and the PDroid framework which allow passing of different return data.
    Because of the proxy created this method is better than apps which just remove permissions from manifests because it should not cause any fcs- Apps will never know the difference. It also allows patching permissions such as location/android id/camera to return spoofed data.

    PDroid is a very complex mod across many parts of framework. I have not seen a proper port of this done as of yet - We have spent much time verifying that this port of PDroid 2.0 successfully works with various permissions. See below screenshots for proof.

    Framework Mods:
    The framework portion of this mod is a port of the 20121017 patch of pdroid2.0 for cyanogenmod rewritten by me to work on TW.
    The main patches are located here: https://github.com/mateor/auto-patcher/tree/master/patches/pd2.0/jellybean/cm/ I believe it is based off of CollegeDev's source from
    http://forum.xda-developers.com/showthread.php?t=1923576

    Downloads section below contain the modded services.jar/core.jar/framework.jar from the JellyBean OTA.

    PDroid Application:
    The app I preferred and what most of our testing was done on is called PDroid Manager - This is one of the only GPL licensed PDroid apps I have seen. The original thread is up here - http://forum.xda-developers.com/showthread.php?t=1994860
    I needed to make some changes to deal with exception errors the original source was throwing. The original code is GPL'ed, my source is up in the Downloads section

    If you do not want to use Pdroid Manager you can switch to the PDroid 2.0 App by installing it from original thread http://forum.xda-developers.com/showthread.php?t=1923576
    **when switching apps you probably want to uninstall old one, delete /data/system/privacy.db reboot then install new app. I do not believe 2 can coexist**

    Verifying PDroid Works:
    A good test app is "Network Info II" from market. You can also use my Logging Test App to test some values such as android id. Other valid tests are items such as blocking Phone from Calls and verifying you get a call error or blocking maps from location.
    The one thing we did notice was the stock camera app was not able to be blocked, but any 3rd party app that uses camera blocking will work (probably due to samsung's app using some hidden calls in framework via reflection)
    14
    Downloads:
    PDroid 2.0 Framework + Application Zip (Its flashable, but untested. Really meant for rom devs) - http://www.androidfilehost.com/?fid=9390248398092763894
    PDroid Manager - TrevE Mod APK Only (you must have framework installed aleady to use) - http://www.androidfilehost.com/?fid=9390248398092763896
    PDroid Manager - TrevE Mod Source - http://www.androidfilehost.com/?fid=9390248398092763895

    Screenshots:
    Screenshots of PDroid 2.0 using PDroid Manager Application (Thanks Esch)




    10
    3
    I probably shouldn't have, but I flashed the patch in my new Samsung Galaxy Note II. US Cellular CDMA. Odin rooted.

    The flash said successful and then I installed the apk.

    Open it and it says there is no patch and gives link to XDA thread. (screenshot attached.)

    Oh well, seems like no harm done. It didn't break anything as far as I can tell.

    8e9e7a9e.jpg




    I'd love to have Pdroid working on this phone.

    Just a side note. I extracted the Permissions Manager .apk from a MIUI rom (evo 3d) and it installs and works just fine. (don't use the root manager leave that up to superSU)
    Its not as extensive as Pdroid but it does let you lock down all your installed apps.
    2
    Guess this means my GTalk will finally quiet down some. ;)

    Great work guys.


    Z