FORUMS
Remove All Ads from XDA

[APP][XPOSED][6.0+] Use Xposed without developing a module

12,559 posts
Thanks Meter: 24,476
 
By M66B, Recognized Developer on 28th January 2018, 02:16 PM
Post Reply Email Thread
XPrivacyLua
XPrivacyLua custom hook definitions

By using XPrivacyLua you can define Xposed hooks and apply them to any app at run time (so, rebooting your device is not necessary). You can write hook code on your device in Lua, which is quite easy to learn.

See the documentation about how to define hooks.

Although XPrivacyLua has 'privacy' in its name, new hooks don't need to be privacy related at all. Disabling the built in privacy related hooks is a matter of selecting another collection of hooks.

This XDA thread is meant to discuss defining hooks, with the restriction that hook definitions must serve a legally allowed purpose. This XDA thread is not meant to make you a developer, so at least some development experience is expected, which means that you'll need to be able to figure out where to hook yourself and that you'll need to be able to write Lua scripts yourself.


XDA:DevDB Information
XPrivacyLua hook definitions, Xposed for all devices (see above for details)

Contributors
M66B
Xposed Package Name:

Version Information
Status: Beta

Created 2018-01-28
Last Updated 2018-04-01
The Following 27 Users Say Thank You to M66B For This Useful Post: [ View ]
 
 
29th January 2018, 06:32 AM |#2  
jawz101's Avatar
Senior Member
Thanks Meter: 669
 
More
Could there be a generic "always return true" lua script?

And when building a definition, what does it mean to be in a group and collection? Do I just put anything there or do I have to call them something particular?


Well, I'm trying but I'm lost. Just trying to setAnalyticsCollectionEnabled

https://firebase.google.com/support/...able-analytics

Code:
 public void setAnalyticsCollectionEnabled (boolean enabled) = false
supposedly disables Firebase Analytics (which apparently 67% of the top 200 apps use).


My definition looks like
Collection: privacy
Group: firebase
Name: firebase.analytics
author: whatever
class: com.google.firebase.analytics
method:setAnalyticsCollectionEnabled
parameter type: void
return type: boolean
min/max sdk: 1/999
lua script: @generic_false_value I suppose I can use this?

Even if this looks valid, it feels like maybe this wouldn't fire unless certain other things happen first? Looking at your hooks.json for google analytics it looks like you had to maybe set a chain of events to occur to get to the point of controlling the method you intend to make changes?
29th January 2018, 07:50 AM |#3  
M66B's Avatar
OP Recognized Developer
Thanks Meter: 24,476
 
More
Quote:
Originally Posted by jawz101

Could there be a generic "always return true" lua script?

And when building a definition, what does it mean to be in a group and collection? Do I just put anything there or do I have to call them something particular?


Well, I'm trying but I'm lost. Just trying to setAnalyticsCollectionEnabled

https://firebase.google.com/support/...able-analytics

Code:
 public void setAnalyticsCollectionEnabled (boolean enabled) = false
supposedly disables Firebase Analytics (which apparently 67% of the top 200 apps use).


My definition looks like
Collection: privacy
Group: firebase
Name: firebase.analytics
author: whatever
class: com.google.firebase.analytics
method:setAnalyticsCollectionEnabled
parameter type: void
return type: boolean
min/max sdk: 1/999
lua script: @generic_false_value I suppose I can use this?

Even if this looks valid, it feels like maybe this wouldn't fire unless certain other things happen first? Looking at your hooks.json for google analytics it looks like you had to maybe set a chain of events to occur to get to the point of controlling the method you intend to make changes?

The built-in scripts are not meant for general use because they might change over time breaking stuff that depends on them. Therefore imported definitions are not linked against the built-in scripts. If needed, you can simply copy and paste the Lua script from another (built in) definition. Copying guarantees your definition will keep working, even when the built-in scripts are changed or even removed.

Calling setAnalyticsCollectionEnabled requires access to an instance of FirebaseAnalytics, which apps needs to get by calling getInstance. So, hook getInstance to call setAnalyticsCollectionEnabled(false) and hook setAnalyticsCollectionEnabled to prevent an app from turning analytics on again.

Restricting Google Analytics (available in the next release of XPrivacyLua) works similar:
https://github.com/M66B/XPrivacyLua/...etinstance.lua
https://github.com/M66B/XPrivacyLua/..._setdryrun.lua

You can also wait until I have added this ...
The Following User Says Thank You to M66B For This Useful Post: [ View ]
29th January 2018, 08:08 AM |#4  
jawz101's Avatar
Senior Member
Thanks Meter: 669
 
More
But firebase isn't necessarily the same thing, right?
29th January 2018, 08:17 AM |#5  
M66B's Avatar
OP Recognized Developer
Thanks Meter: 24,476
 
More
Quote:
Originally Posted by jawz101

But firebase isn't necessarily the same thing, right?

No, Google Analytics and Firebase Analytics are not the same and need different definitions.
29th January 2018, 08:46 AM |#6  
M66B's Avatar
OP Recognized Developer
Thanks Meter: 24,476
 
More
Restricting Firebase Analytics works properly with these hook definitions:
https://github.com/M66B/XPrivacyLua/...8286d90d3ca806
29th January 2018, 09:41 AM |#7  
M66B's Avatar
OP Recognized Developer
Thanks Meter: 24,476
 
More
Quote:
Originally Posted by jawz101

And when building a definition, what does it mean to be in a group and collection? Do I just put anything there or do I have to call them something particular?

With the latest version of XPrivacyLua / companion app you can change the collection of hooks to use in XPrivacyLua. The default is to use the collection 'Privacy'. You can define your own collection by definition hooks with a new collection name. There can only be one collection active at one time, so if you want to add your own definitions to the built-in privacy collection you'll have to use the collection 'Privacy'. Basically collections exists to allow using XPrivacyLua for things other than privacy.

Groups are listed in the XPrivacyLua app and make it easy to apply a group of hooks to one or more apps. XPrivacyLua cannot and will not handle applying individual hooks to keep things simple, but I might add this to the pro companion app in the near feature. For now you can rename a group of an existing hook definition to be able to apply it separately in XPrivacyLua.

Edit: this has been clarified in the documentation too now: https://github.com/M66B/XPrivacyLua/...ster/DEFINE.md
29th January 2018, 04:11 PM |#8  
mnjm9b's Avatar
Senior Member
Thanks Meter: 222
 
More
I still have some questions on when,where,how etc.... but I will wait until I can dedicate more time to playing with this.

I do have a feature request.

could there be a sort of drop down box that queries all valid entries for each item when creating a custom definition.

for example...
when creating a custom definition, when taping on the line for group, you would just type a new group (as it is now) but if there was a drop down arrow at the end of the line that could give a list of currently used groups and then the user could just click the listed group instead of typing and it would auto-fill that field.

maybe even more useful would be for the other items like Name,Class, Method etc...
where it could show possible entries. That would help a lot.
29th January 2018, 04:50 PM |#9  
jawz101's Avatar
Senior Member
Thanks Meter: 669
 
More
... I turned on notifications for your new Firebase rules. I would think a bunch of apps I have use Firebase Analytics. @M66B Have you seen any apps trigger it yet?
Even if the app imported Firebase Analytics library and gathers Firebase Analytics but never uses the setAnalyticsCollectionEnabled() method in its own code would it mean this hook will never trigger?
Quote:

With the latest version of XPrivacyLua / companion app you can change the collection of hooks to use in XPrivacyLua. The default is to use the collection 'Privacy'. You can define your own collection by definition hooks with a new collection name. There can only be one collection active at one time, so if you want to add your own definitions to the built-in privacy collection you'll have to use the collection 'Privacy'. Basically collections exists to allow using XPrivacyLua for things other than privacy.

Thanks.
This is just a suggestion but if this was my app I would break these 2 elements out to separate screens from the definition builder. You would define collections and groups in a separate spot, and then when building rules the collections and groups would pull in as a selectable dropdown. Avoids typos and helps to explain how there can be only one active collection for XPrivacyLua.
29th January 2018, 05:07 PM |#10  
M66B's Avatar
OP Recognized Developer
Thanks Meter: 24,476
 
More
Quote:
Originally Posted by mnjm9b

I still have some questions on when,where,how etc.... but I will wait until I can dedicate more time to playing with this.

I do have a feature request.

could there be a sort of drop down box that queries all valid entries for each item when creating a custom definition.

for example...
when creating a custom definition, when taping on the line for group, you would just type a new group (as it is now) but if there was a drop down arrow at the end of the line that could give a list of currently used groups and then the user could just click the listed group instead of typing and it would auto-fill that field.

maybe even more useful would be for the other items like Name,Class, Method etc...
where it could show possible entries. That would help a lot.

I will see what I can do for collection and group, but all the other fields are flexible and depend on the hook.
29th January 2018, 05:10 PM |#11  
M66B's Avatar
OP Recognized Developer
Thanks Meter: 24,476
 
More
Quote:
Originally Posted by jawz101

... I turned on notifications for your new Firebase rules. I would think a bunch of apps I have use Firebase Analytics. @M66B Have you seen any apps trigger it yet?
Even if the app imported Firebase Analytics library and gathers Firebase Analytics but never uses the setAnalyticsCollectionEnabled() method in its own code would it mean this hook will never trigger?

An app will normally not disable/enable analytics given the default is enabled and the user has mostly no choice in this. So see this hook as a safeguard to prevent an app enabling analytics again after we disabled it in another hook
Post Reply Subscribe to Thread

Guest Quick Reply (no urls or BBcode)
Message:
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes