Attend XDA's Second Annual Developer Conference, XDA:DevCon 2014!
5,809,137 Members 49,630 Now Online
XDA Developers Android and Mobile Development Forum

Work with files in hook

Tip us?
 
pyler
Old
(Last edited by pyler; 1st September 2014 at 05:48 PM.)
#1  
Senior Member - OP
Thanks Meter 441
Posts: 358
Join Date: Jan 2013
Default Work with files in hook

Hi, I have hook
Code:
findAndHookMethod(packageManagerService, null,
					"installPackageWithVerificationAndEncryption", Uri.class,
					"android.content.pm.IPackageInstallObserver", int.class,
					String.class, "android.content.pm.VerificationParams",
					"android.content.pm.ContainerEncryptionParams",
					installPackageHook);
I want to create files while I am in hook.
Code:
installPackageHook = new XC_MethodHook() {
			@Override
			protected void beforeHookedMethod(MethodHookParam param)
					throws Throwable {
                                        File backupApkFile = new File(APP_DIR + File.separator + "App.apk");
					backupApkFile.createNewFile();
I get EACCESS permission denied. Framework has all permissions, no?
 
GermainZ
Old
#2  
GermainZ's Avatar
Forum Moderator / Recognized Developer
Thanks Meter 6,397
Posts: 5,476
Join Date: Aug 2012
Quote:
Originally Posted by pyler View Post
I get EACCESS permission denied. Framework has all permissions, no?
Your code runs in the hooked process, so you only have that process' permissions.

You can try hooking the PermissionGranter class to give the hooked package additional permissions, or e.g. send a broadcast to/directly start your own activity/service to write the file (from your own app's process, without Xposed).
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes