• Introducing XDA Computing: Discussion zones for Hardware, Software, and more!    Check it out!
  • Fill out your device list and let everyone know which phones you have!    Edit Your Device Inventory

[REQUEST] Magisk Module to Disable Flags Secure

Search This thread

edzamber

Senior Member
Feb 21, 2012
3,887
3,685
Hello,
After look at the repo, i have difficulties to understand at wich level the modifications take effect, at runtime memory or in a specifiq system file(s) ?
Hi,

First thanks for your reply[emoji2]

It seems that modifications by xposed module are in framework.jar, especially into WindowManager.LayoutParams.smali and into SurfaceView.smali

Thoses are define by setFlag methods

Here are some links about how it working

https://commonsware.com/blog/2016/06/06/psa-flag-secure-window-leaks.html

https://commonsware.com/blog/2012/01/16/secure-against-screenshots.html

https://developer.android.com/reference/android/view/WindowManager.LayoutParams.html

https://github.com/appium/android-a...um/android/apis/app/SecureWindowActivity.java
 

Rom

Senior Member
Jul 1, 2013
2,527
1,045
Lyon
Hi,

First thanks for your reply[emoji2]

It seems that modifications by xposed module are in framework.jar, especially into WindowManager.LayoutParams.smali and into SurfaceView.smali

Thoses are define by setFlag methods

Here are some links about how it working

https://commonsware.com/blog/2016/06/06/psa-flag-secure-window-leaks.html

https://commonsware.com/blog/2012/01/16/secure-against-screenshots.html

https://developer.android.com/reference/android/view/WindowManager.LayoutParams.html

https://github.com/appium/android-a...um/android/apis/app/SecureWindowActivity.java
Ok, so its call an special function in framework.jar file system so it could be possible but the problem is that we must import all possible framework apks in the Magisk Module zip, without taking the fact that if anyone want to make it works with any other stuff that modded the frameworkres.apk, we will must add again all the apks..

One more time, we can see again the big differencies between Magisk and XPosed..
With Magiks, we can say to the Magiks framework to create several symbolics links to everywhere u want without edit any files.
With XPosed, we can say to the Magisk Framework to add and/or replace and/or deleting one or several JAVA method(s)/function(s) into the android core system without having to decompiling, editing and compiling again the apk(s).

In absolute, we could make this Magisk Module, but we will must try all possible frameworkres apk file(s) with all possible other MODs stuff that could working fine on all phones and ROMs versions, so finally the Magisk zip could make less than 1Mb if u have a great chance, or it will make more than 100Mb.
 
Last edited:

fOmey

Recognized Developer
Mar 7, 2009
4,123
5,482
Sydney, AUS
You could take a look at the work by @fOmey with his Mock locations patcher (patches services.jar) and see if there's anything there that might inspire you...
https://forum.xda-developers.com/apps/magisk/module-mock-mock-locations-magisk-t3638275

If you guys can figure out what is being patched by xposed, I'll have a poke around and convert the xposed to a smali solution..

I have the patcher already coded, so it wouldn't be overly difficult to adapt it to this module idea.. just be sure to tag me in the post.


EDIT: Bit bored at work so I had a poke around..

Pretty sure I found the function you want to patch, won't know till you test: function

The fun part is finding it in smali and making sure its consistent between different device manufactures ...
 
Last edited:

edzamber

Senior Member
Feb 21, 2012
3,887
3,685
If you guys can figure out what is being patched by xposed, I'll have a poke around and convert the xposed to a smali solution..

I have the patcher already coded, so it wouldn't be overly difficult to adapt it to this module idea.. just be sure to tag me in the post.


EDIT: Bit bored at work so I had a poke around..

Pretty sure I found the function you want to patch, won't know till you test: function

The fun part is finding it in smali and making sure its consistent between different device manufactures ...
Waouu !!! Working [emoji2] [emoji2] [emoji2] [emoji2] [emoji2]


I mod directly my services.jar like this :


Services.jar/smali/com/android/server/wm/WindowManagerService.smali

.method isSecureLocked(Lcom/android/server/wm/WindowState;)Z

Replace complet method by this :

.method isSecureLocked(Lcom/android/server/wm/WindowState;)Z
.locals 4

const/4 v0, 0x0


return v0
.end method

Now just need to apply this with Magisk module, but i don't know how to [emoji2]
 

Attachments

  • Screenshot_20170913-100616.png
    Screenshot_20170913-100616.png
    50.9 KB · Views: 1,321

fOmey

Recognized Developer
Mar 7, 2009
4,123
5,482
Sydney, AUS
Waouu !!! Working [emoji2] [emoji2] [emoji2] [emoji2] [emoji2]


I mod directly my services.jar like this :


Services.jar/smali/com/android/server/wm/WindowManagerService.smali

.method isSecureLocked(Lcom/android/server/wm/WindowState;)Z

Replace complet method by this :

.method isSecureLocked(Lcom/android/server/wm/WindowState;)Z
.locals 4

const/4 v0, 0x0


return v0
.end method

Now just need to apply this with Magisk module, but i don't know how to [emoji2]

Good to hear! The tricky part also is most devices have unique services.jar's... this is why I created my patching tool..

If I get some time over the weekend I will look into creating a patcher for this module.
 

petermg

Senior Member
Aug 7, 2008
502
143
Good to hear! The tricky part also is most devices have unique services.jar's... this is why I created my patching tool..

If I get some time over the weekend I will look into creating a patcher for this module.

Can you help me to understand if this is possible to do to an APK? I'm using an Oculus Go, and they made it so we cannot screen cast in the Oculus TV app, so I am trying to see if it's possible to remove the FLAG_SECURE from the Oculus TV app. Any help is greatly appreciated!
 

Top Liked Posts

  • There are no posts matching your filters.
  • 12
    Hi,

    I wonder if someone can do a module to enable Screenshot in protected apps as Disable Flags secure Xposed module can do...

    https://github.com/veeti/DisableFlagSecure

    Many thanks [emoji4]
    6
    You could take a look at the work by @fOmey with his Mock locations patcher (patches services.jar) and see if there's anything there that might inspire you...
    https://forum.xda-developers.com/apps/magisk/module-mock-mock-locations-magisk-t3638275
    5
    Waouu !!! Working [emoji2] [emoji2] [emoji2] [emoji2] [emoji2]


    I mod directly my services.jar like this :


    Services.jar/smali/com/android/server/wm/WindowManagerService.smali

    .method isSecureLocked(Lcom/android/server/wm/WindowState;)Z

    Replace complet method by this :

    .method isSecureLocked(Lcom/android/server/wm/WindowState;)Z
    .locals 4

    const/4 v0, 0x0


    return v0
    .end method

    Now just need to apply this with Magisk module, but i don't know how to [emoji2]

    Good to hear! The tricky part also is most devices have unique services.jar's... this is why I created my patching tool..

    If I get some time over the weekend I will look into creating a patcher for this module.
    5
    You could take a look at the work by @fOmey with his Mock locations patcher (patches services.jar) and see if there's anything there that might inspire you...
    https://forum.xda-developers.com/apps/magisk/module-mock-mock-locations-magisk-t3638275

    If you guys can figure out what is being patched by xposed, I'll have a poke around and convert the xposed to a smali solution..

    I have the patcher already coded, so it wouldn't be overly difficult to adapt it to this module idea.. just be sure to tag me in the post.


    EDIT: Bit bored at work so I had a poke around..

    Pretty sure I found the function you want to patch, won't know till you test: function

    The fun part is finding it in smali and making sure its consistent between different device manufactures ...
    3
    If you guys can figure out what is being patched by xposed, I'll have a poke around and convert the xposed to a smali solution..

    I have the patcher already coded, so it wouldn't be overly difficult to adapt it to this module idea.. just be sure to tag me in the post.


    EDIT: Bit bored at work so I had a poke around..

    Pretty sure I found the function you want to patch, won't know till you test: function

    The fun part is finding it in smali and making sure its consistent between different device manufactures ...
    Waouu !!! Working [emoji2] [emoji2] [emoji2] [emoji2] [emoji2]


    I mod directly my services.jar like this :


    Services.jar/smali/com/android/server/wm/WindowManagerService.smali

    .method isSecureLocked(Lcom/android/server/wm/WindowState;)Z

    Replace complet method by this :

    .method isSecureLocked(Lcom/android/server/wm/WindowState;)Z
    .locals 4

    const/4 v0, 0x0


    return v0
    .end method

    Now just need to apply this with Magisk module, but i don't know how to [emoji2]