[Q] android.app.DownloadManager.Request.enqueue callbacks not invoked in Kitkat - Xposed General

Hi,
I am developing a module for which I have hooked android.app.DownloadManager.enqueue callback. The code is like this -
Code:
Unhook hook = findAndHookMethod(android.app.DownloadManager.class,
"enqueue",
"android.app.DownloadManager.Request",
new XC_MethodHook() {
@Override
protected void afterHookedMethod(MethodHookParam param) throws Throwable {
log("After enqueue.");
}
});
This code is invoked from initZygote. It was working perfectly fine in Jellybean 4.1.2 on my older Xperia J. However, the callback is not invoked in Xperia Z running Kitkat 4.4.2 ROM. The callback does get attached successfully since the "hook" value is not null. I have tried moving the invoke into handlePackageLoad when the "android" package is loaded, but still no luck.
Any suggestions?

Anyone?

Have you made sure that the enque() method is actually called? You can easily test this with the Xposed Installer, just download any module. It also uses this method. Make sure you place the hook in initZygote(), otherwise it won't be active in the installer process.

rovo89 said:
Have you made sure that the enque() method is actually called? You can easily test this with the Xposed Installer, just download any module. It also uses this method. Make sure you place the hook in initZygote(), otherwise it won't be active in the installer process.
Click to expand...
Click to collapse
Hi @rovo89, yes I did put this call in initZygote. I took the clue from XposedBridge code which hooks up android.app package methods in there. Also, I found this issue when I installed my app on Xperia Z Kitkat ROM and found it not working when the various ways to invoke enqueue did not call the hooks. I typically use Chrome/AOSP browsers to download an image to SD card to test this. In Jellybean (on my earlier Xperia J), the hooks get invoked as expected. Its just that in Kitkat, even though the "hookMethod" returns a Unhook reference, the hooks are never called.
Interestingly, this is only affecting the DownloadManager class method hooks. I have also hooked methods in downloadprovider class and it gets called alright. This is really a very confusing situation .
Is it possible for you to give this a try please? The code snippet I pasted should be good enough, otherwise I can rig up a sample. Thanks!

You're hooking the wrong method, then. Look for the method that actually gets called for DownloadManager (check its source, make a test app, possibly use Xposed Method Finder, etc).

GermainZ said:
You're hooking the wrong method, then. Look for the method that actually gets called for DownloadManager (check its source, make a test app, possibly use Xposed Method Finder, etc).
Click to expand...
Click to collapse
Thanks for pointing me to the tool. Although based on the source code from KK/JB trunks, I am pretty confident that any app using DM must use enqueue, its still worth to be sure. I will upload a sample app here to help understand and debug this issue.

ie5x said:
Thanks for pointing me to the tool. Although based on the source code from KK/JB trunks, I am pretty confident that any app using DM must use enqueue, its still worth to be sure. I will upload a sample app here to help understand and debug this issue.
Click to expand...
Click to collapse
Turned out both Chrome and AOSP browser on Kitkat weren't using DownloadManager enqueue :silly:. They natively handle downloads and only use DM for reporting downloaded files in its queue. This was unexpected because these apps used DM in Jellybean. A custom test app calling enqueue successfully invoked the callbacks. Thanks for your help!
This thread can be closed.

ie5x said:
Turned out both Chrome and AOSP browser on Kitkat weren't using DownloadManager enqueue :silly:. They natively handle downloads and only use DM for reporting downloaded files in its queue. This was unexpected because these apps used DM in Jellybean. A custom test app calling enqueue successfully invoked the callbacks. Thanks for your help!
This thread can be closed.
Click to expand...
Click to collapse
That's why I suggested trying it with Xposed Installer, because I know for sure that it uses DM.enqueue(). Just tried it and it worked fine.

rovo89 said:
That's why I suggested trying it with Xposed Installer, because I know for sure that it uses DM.enqueue(). Just tried it and it worked fine.
Click to expand...
Click to collapse
I was being too sure for my own good. Went through a lot of code for Chrome and AOSP browsers and up to Jelly Bean my hooks were working damn fine. Couldn't doubt that the behavior would be different for Kitkat. Well, lessons learned the hard way are the hardest to forget .
Thanks again @rovo89 for helping me out.

Related

Xposed can not work with the Lollipop SDK

After upgrade to Lollipop sdk, I found the project can not build, will cause the aapt.exe stop working.(ADT-boundle , win7-64bit)
after a long day debuging, I found the problem is the Assert/xposed_init file, delete this file and everything is ok.
I don't known why ? Anyone have same problems?
I want to try 5.0 SDK too but now as I know this.. I will wait. I hope rovo89 has fix for library.
Deleting any file or anything other won't make it work. Android 5.0 Lollipop is running ART as its official runtime and does therefore not work with xposed.
But at least bring material theme to app for older devices for now.
pyler said:
But at least bring material theme to app for older devices for now.
Click to expand...
Click to collapse
It already exists, right here on xda: http://bit.ly/1vO3hnU
TheHawk002 said:
It already exists, right here on xda: http://bit.ly/1vO3hnU
Click to expand...
Click to collapse
I ment bring material theme to our xposed module apps
pyler said:
I ment bring material theme to our xposed module apps
Click to expand...
Click to collapse
Oh okey, sorry, that does exist too though Google launched a way to update old app to material design, running 4.x>=, perhaps I'm right this time
https://chris.banes.me/2014/10/17/appcompat-v21/
goodevh said:
After upgrade to Lollipop sdk, I found the project can not build, will cause the aapt.exe stop working.(ADT-boundle , win7-64bit)
after a long day debuging, I found the problem is the Assert/xposed_init file, delete this file and everything is ok.
I don't known why ? Anyone have same problems?
Click to expand...
Click to collapse
I had this issue too after updating the SDK to 21. For most (except 1!?!) project i could "fix" it by deleting bin and gen folders.
In my experience, Google updates contain everytime errors preventing compiling...
The early bird catches the bug
FYI, I had similar issues. It's not related to Xposed, it's a bug in aapt on Windows: https://code.google.com/p/android/issues/detail?id=77629
They say it's fixed with version 21.0.2 of the build tools. I restarted Eclipse and removed my "bin" and "gen" folders, then it worked indeed.
Great, the last project could now also be built [emoji7]

Xposed problems with Android Studio's instant run

I'm using Xposed-v81-arm, which made instant-run not work. What's more, even I make some changes in the source code and rebuild my project, the app just stay the same as the old one, it won't keep up with the latest code. But when I uninstall the Xposed, everything works fine. Has anyone met this problem?
----------------------Updated---------------------------------
It seems that this has nothing to do with Xposed.....Sorry.
luxlwj said:
I'm using Xposed-v81-arm, which made instant-run not work. What's more, even I make some changes in the source code and rebuild my project, the app just stay the same as the old one, it won't keep up with the latest code. But when I uninstall the Xposed, everything works fine. Has anyone met this problem?
Click to expand...
Click to collapse
The instant mode uses some special technique, it won't compile your java code into their original name, which will cause xposed bridge unable to find your class listed in xposed_init.
Thank you so much! I just started developing Xposed modules and have been getting the ClassNotFoundException for the past day. Disabled Instant Run and it works perfectly!

[Request] No album art on the lockscreen (link to code and needed edit inside)

A way to block album art from the lockscreen.
To meet you half way, this can be accomplished by applying the following edit, before building the systemui.apk:
https://github.com/LineageOS/androi.../systemui/statusbar/phone/PhoneStatusBar.java ---------> public static final boolean SHOW_LOCKSCREEN_MEDIA_ARTWORK = false;
Any way to turn this into a module?
Also a module to enable LineageOS call recording would be awesome... It is a matter of hooking the dialer.apk to allow call recording: https://github.com/pylerSM/EnableCM...yler/enablecmcallrec/EnableCallRecording.java
Although this would be super nice (I have a severe dislike for album art on the lock screen as well. Lol), I'm pretty sure this is not how Magisk works. If you had taken the SystemUI and modded it and needed a way to install it without touching /system than Magisk is your friend. This is something more for Xposed... I'm not a developer though so I'm not 100% sure I'm right but this is how I've always understood how Magisk and Xposed works.
If you use Xposed with Magisk then use the module "Lockscreen Album Art Remover" which works for me.
leepea said:
If you use Xposed with Magisk then use the module "Lockscreen Album Art Remover" which works for me.
Click to expand...
Click to collapse
In Android 7.1? I doesnt work for me.
superior888 said:
In Android 7.1? I doesnt work for me.
Click to expand...
Click to collapse
That's probably because Xposed for 7.1 is a very unstable work in progress.

VirtualXposed: Use Xposed without root, unlock the bootloader or modify system image.

As we all know, Xposed needs modify system image because we need to replace the app_process and ART runtime.
In some case, This is a bit troublesome. So i wrote an App named VirtualXposed to use xposed without modify system, you can install it like a normal APP, no need root or system privilege.
VirtualXposed is like a virtual environment, in this virtual world, all app are running with the same UID, so all app running in it are under control. then we can load xposed module for any process within it. The only thing we need to do is to Implement a Java Method hook module to support Xposed runtime.
To be honest, VirtualXposed is forked from VirtualApp, just likes docker on Android platform. And the Java method hook module——epic, is a dynamic java aop method hook framework, just like dexposed.
You can refer the code on github: https://github.com/android-hacker/VirtualXposed
It's my first time here. All the things I need to learn from you
I'm not entirely sure why no one has replied to this yet. This is pretty huge, ainnit? This would allow Xposed to pass SafetyNet.
rnadomuc said:
I'm not entirely sure why no one has replied to this yet. This is pretty huge, ainnit? This would allow Xposed to pass SafetyNet.
Click to expand...
Click to collapse
Not just that but it can also run on unrooted phones which is even more of a break through.
Virustotal picks up malware
https://www.virustotal.com/fr/file/...8f04f8531ac8d2ea9e601e2e/analysis/1520829060/
I was about to try it but I'm reconsidering after seen the previous post...
I am sure that VirtualXposed is harmless, it is open source, the source code won't deceive you, you can refer the source code at: https://github.com/android-hacker/VirtualXposed (I am sorry that i can not post outside links now, xda's rule says that i must post 10 posts)
I don't know why it was misjudged as a virus, may be it is too powerful ? or it can inject code to other process without root?
Anyway, I am investiging this problem.
i hope it can bypass all those detection by other program like games. let's see what it will it become when it matures. tnx
This is very intriguing. I pinged GermainZ to see what he thinks.
ssvdude said:
Virustotal picks up malware
https://www.virustotal.com/fr/file/...8f04f8531ac8d2ea9e601e2e/analysis/1520829060/
Click to expand...
Click to collapse
Have you checked every file on xda and what are the results?
It does require a ton of permissions tho, so smart to be cautious.
---
plisskenn said:
Have you checked every file on xda and what are the results?
It does require a ton of permissions tho, so smart to be cautious.
Click to expand...
Click to collapse
it would need those permissions for the cloned apps to work properly
plisskenn said:
Have you checked every file on xda and what are the results?
It does require a ton of permissions tho, so smart to be cautious.
Click to expand...
Click to collapse
I don't quite understand you're trying to imply. Of course I haven't. I'm sure there are false positive for other applications on xda. That doesn't mean this is one. This an unknown developer (no offense), with sparse any info in the first post, not alot of testimonials Further more this almost seems to good to be true, hence why I'm wary. That said if this works great, that's fantastic and I'm impressed. I'm glad it's open source too. No need to get snarky about it.
weishu said:
As we all know, Xposed needs modify system image because we need to replace the app_process and ART runtime.
In some case, This is a bit troublesome. So i wrote an App named VirtualXposed to use xposed without modify system, you can install it like a normal APP, no need root or system privilege.
VirtualXposed is like a virtual environment, in this virtual world, all app are running with the same UID, so all app running in it are under control. then we can load xposed module for any process within it. The only thing we need to do is to Implement a Java Method hook module to support Xposed runtime.
To be honest, VirtualXposed is forked from VirtualApp, just likes docker on Android platform. And the Java method hook module——epic, is a dynamic java aop method hook framework, just like dexposed.
You can refer the code on github: https://github.com/android-hacker/VirtualXposed
It's my first time here. All the things I need to learn from you
Click to expand...
Click to collapse
Hi all,
Is anyone testing VirtualXposed with the Xposed module XPrivacyLua ?
Thanks in advance for your answers.
iwanttoknow said:
Hi all,
Is anyone testing VirtualXposed with the Xposed module XPrivacyLua ?
Thanks in advance for your answers.
Click to expand...
Click to collapse
Apparently not there was an issue raised on the Github about it (under issues section)
link below
https://github.com/android-hacker/VirtualXposed
( sorry can not post direct links at the moment)
This could be a breakthrough and stumbling onto it today, being able to hide the system modifications for other apps to work such as banking or snapchat.. anyway as far as this hook having a virus such as McAffe , ive read :
"inherit from VirtualApp asLody/VirtualApp string #460, the code has some hardcode string such as "base-1.apk", "base.odex"; i simply use base64 to encode these thrings and it was resolved."
Guys, XPL will not work on VirtualXposed because it stores auf with the settings app which can not be accessed by VX. The only way around this would be a fork of XPL that changes this behavior specifically for VX. But nobody is doing that as of now.
as I see in Github where it is downloaded virtualxpose has little module support
Sent from my ZTE K88 using XDA Labs
---------- Post added at 10:54 PM ---------- Previous post was at 10:51 PM ----------
We hope that over time they will add more modules
Sent from my ZTE K88 using XDA Labs
Have you tested it on Oreo? Apps won't open on my s9+
gpgorbosjr said:
Have you tested it on Oreo? Apps won't open on my s9+
Click to expand...
Click to collapse
Yeah, I have s8+ and I'm only getting "Opening (App name).." message endlessly.
vAlcatraz said:
Yeah, I have s8+ and I'm only getting "Opening (App name).." message endlessly.
Click to expand...
Click to collapse
On Oreo right? I was looking at the Virtual App GitHub and I think something has to be changed in the way it works for Oreo support but I don't know how to inpliment it I hope the dev does.
Android 8.0 fix
Edit: that may not be a fix for our issue lol. I'm not a dev so I'm just guessing but I really think it's an Oreo caused issue.

[Module] NFC Screen Off

NFC Screen Off
Read NFC tags when screen is off.
Disable NFC tagging sound.
Tap to pay when screen is off.
ALWAYS include Magisk installation logs when posting an issue.
Useful integrations: NFC Card Emulator Pro - Tasker
Installation metrics: Grafana dashboard
How does it work?
The NFC app is patched during installation into a `modded` version. This `modded` version is injected at boot time by service.sh so that the phone thinks the screen is always on and unlocked.
This patch only applies to NFC Service so it does not impact any other functionality of the phone that involves screen state detection.
The `modded` app was generated using this method.
Help section
MY NFC IS NOT DETECTED ANYMORE
If you did not unlock your device since last boot, unlock it and wait 30 seconds for the module to be loaded.
After that time, if NFC does not start automatically or manually, it means that the patch does not work for your device. You can uninstall the module and create an issue.
I AM STUCK IN A BOOTLOOP
Remove the module manually.
1. Boot into TWRP
1. Advanced -> File Manager
1. Delete /adb/modules/NFCScreenOff
1. Reboot
THE MODULE IS NOT WORKING SINCE LAST UPDATE
Perform a clean reinstallation.
1. Uninstall the module
1. Reboot
1. Install the module
1. Reboot
If it does not solve your problem, you can create an issue.
I LIKE THE MODULE
Only for rooted devices ok?
lapwat said:
NFCScreenOff
Enable NFC pooling while phone is locked and screen is off for Android 9 and above.
Make it work for host card emulator to pay in stores
Ask me
Click to expand...
Click to collapse
It broke my nfc payments. Any fixes ?
Should it work normally with Google pay ?
maujogue said:
It broke my nfc payments. Any fixes ?
Should it work normally with Google pay ?
Click to expand...
Click to collapse
Not yet. It's on the To-Do list.
Thanks for enabling this option.
It may not necessarily be a bad thing that it breaks safety net.
Enabling mobile payments while phone is locked is NOT a good idea. Your phone will be vulnerable to money theft with some special NFC devices. They can get close to your phone while it is in your pocket or purse and that is enough for them to steal your money.
crime_of_heart said:
Thanks for enabling this option.
It may not necessarily be a bad thing that it breaks safety net.
Enabling mobile payments while phone is locked is NOT a good idea. Your phone will be vulnerable to money theft with some special NFC devices. They can get close to your phone while it is in your pocket or purse and that is enough for them to steal your money.
Click to expand...
Click to collapse
Yes, that's a bad idea. I just want it to not brake payments, as I couldnt use Google pay even if I unlocked with this module
@lapwat Hi, awesome module. It is not working for me since the path (and app name) for nfc app is system/app/NxpNfcNci/NxpNfcNci.apk
Android 10.3.0
Oneplus 6
Stock ROM
Edit:attach log
maujogue said:
It broke my nfc payments. Any fixes ?
Should it work normally with Google pay ?
Click to expand...
Click to collapse
Yes it should continue to work normally with Google Pay.
What I meant in the description of the module is:
For now, it only works for reading NFC tags. For payments in stores, the phone still needs to be at least on. If the module is working for tags but breaks your payments, leave a comment.
Is it the case for you? The module works for NFC tags but the payments are broken?
What are your specs (device, rom, android version)?
marcozpaulo said:
Only for rooted devices ok?
Click to expand...
Click to collapse
Yes, only for devices rooted with Magisk.
lapwat said:
Yes it should continue to work normally with Google Pay.
What I meant in the description of the module is:
For now, it only works for reading NFC tags. For payments in stores, the phone still needs to be at least on. If the module is working for tags but breaks your payments, leave a comment.
Is it the case for you? The module works for NFC tags but the payments are broken?
What are your specs (device, rom, android version)?
Click to expand...
Click to collapse
Now I get it regarding Google Pay.
lapwat said:
Yes it should continue to work normally with Google Pay.
What I meant in the description of the module is:
For now, it only works for reading NFC tags. For payments in stores, the phone still needs to be at least on. If the module is working for tags but breaks your payments, leave a comment.
Is it the case for you? The module works for NFC tags but the payments are broken?
What are your specs (device, rom, android version)?
Click to expand...
Click to collapse
Exactly. I tried paying but nothing happens, like if nfc didn't exists on my phone. I desinstalled the module and I could pay again. Paying is more important than reading nfc tags for me !
maujogue said:
Exactly. I tried paying but nothing happens, like if nfc didn't exists on my phone. I desinstalled the module and I could pay again. Paying is more important than reading nfc tags for me !
Click to expand...
Click to collapse
That's good to know. Will wait for further development.
SatanicShanker666 said:
@lapwat Hi, awesome module. It is not working for me since the path (and app name) for nfc app is system/app/NxpNfcNci/NxpNfcNci.apk
Android 10.3.0
Oneplus 6
Stock ROM
Edit:attach log
Click to expand...
Click to collapse
Thanks for the logs. Can you send those files to me:
/system/app/NxpNfcNci/NxpNfcNci.apk
/system/framework/framework-res.apk
I will do a version for people with NxpNfcNci app (I guess it is OnePlus customized NfcService).
My stock Xiaomi ROM had a NQNfcNci app.
lapwat said:
Thanks for the logs. Can you send those files to me:
/system/app/NxpNfcNci/NxpNfcNci.apk
/system/framework/framework-res.apk
I will do a version for people with NxpNfcNci app (I guess it is OnePlus customized NfcService).
My stock Xiaomi ROM had a NQNfcNci app.
Click to expand...
Click to collapse
Ok nice, thanks! Here you go:
http://www.mediafire.com/file/2zcmud0i2z8y0vy/framework-res.apk/file
http://www.mediafire.com/file/fys9ee6s308qmy9/NxpNfcNci.apk/file
SatanicShanker666 said:
Ok nice, thanks! Here you go:
http://www.mediafire.com/file/2zcmud0i2z8y0vy/framework-res.apk/file
http://www.mediafire.com/file/fys9ee6s308qmy9/NxpNfcNci.apk/file
Click to expand...
Click to collapse
I've done it! Try installing the module and tell me if it works!
lapwat said:
I've done it! Try installing the module and tell me if it works!
Click to expand...
Click to collapse
Not the same guy, but also using Oneplus. It installed successfully but doesn't seem to be working.
Is it possible to modify the installation script to account for ncinfc with other names? For instance on the Razer phone 2 it is named NQNFCnci so the script can't find it
virseph said:
Not the same guy, but also using Oneplus. It installed successfully but doesn't seem to be working.
Click to expand...
Click to collapse
2me3 said:
Is it possible to modify the installation script to account for ncinfc with other names? For instance on the Razer phone 2 it is named NQNFCnci so the script can't find it
Click to expand...
Click to collapse
From what I understand from feedbacks, the apk app can have several names:
NfcNci
NQNfcNci
NpxNfcNci
Those names do not depend of the device but depend of the ROM.
Two apk with the same name will in fact be different. They are very related to the framework of the ROM.
Loading an APK from another ROM even if it is the same Android version will have little chance to work.
I cannot detect all the specs of the device. Magisk only gives me the Android SDK Version that's all.
I could make an apk for every ROM.
2 possibilities:
- Zip framework.apk + (NQ/Npx)NfcNci.apk, send it to a server. The server will return a custom apk just for your ROM. This is the one that Magisk will use.
- Build the custom APK directly on the phone, but I cannot find how to run apktools, jarsigner, etc on Android (because there is no JAVA env on Android)
Hi, on my first try a few days ago it didn't install i think it was because the path too, but now it works perfect. Thanks dev:good:
oneplus 6
Android 10 OB 33
xXx magisk on stock rom
Blu spark kernel
Sent from my OnePlus6 using XDA Labs
lapwat said:
From what I understand from feedbacks, the apk app can have several names:
NfcNci
NQNfcNci
NpxNfcNci
Those names do not depend of the device but depend of the ROM.
Two apk with the same name will in fact be different. They are very related to the framework of the ROM.
Loading an APK from another ROM even if it is the same Android version will have little chance to work.
I cannot detect all the specs of the device. Magisk only gives me the Android SDK Version that's all.
I could make an apk for every ROM.
2 possibilities:
- Zip framework.apk + (NQ/Npx)NfcNci.apk, send it to a server. The server will return a custom apk just for your ROM. This is the one that Magisk will use.
- Build the custom APK directly on the phone, but I cannot find how to run apktools, jarsigner, etc on Android (because there is no JAVA env on Android)
Click to expand...
Click to collapse
Yes I extracted the zip and modified the customize/service.sh scripts to properly work with my rom and as you stated it did not work. as soon as the script killed the nfc service it triggered a reboot to recovery.
I PM'd you a gdrive link to the stock apk's from the razer phone 2 Pi stock rom. If you have some time would please build it for me? I tried to do it myself a while ago but ran out of steam before i even got all the dependencies running on my computer lol. I can modify your magisk package to work with it myself.
I like your idea of a server that automatically runs the process to patch the apk. Would every use need to upload both the framework.apk and nfcnci or just the nfc? The only concern I would have is bandwithd as the framework apk is 30+ MB's. If you could build the server into a docker container I think it would be easy enough for others to host you could probably find some people willing to host it for free. Another option could be using a google drive account to allow people to upload the apk's for their phone then batch process them all and sort them by model/build # or something to cover most phones/roms . I have a gapps for business account with unlimited storage I could probably lend for this purpose
Once again thanks for all your work! If you have a bitcoin address i'd like to buy you a beer

Categories

Resources