So, i manage to replace resource by creating Drawable from sdcard through DrawableLoader
but the Drawable not load. and also there is no error in xposed log. please any help?
here is my code
Code:
resparam.res.setReplacement("com.android.systemui","drawable","some_icon",new XResources.DrawableLoader() {
@Override
public Drawable newDrawable(XResources res, int id) throws Throwable {
return Drawable.createFromPath(myAwesomeIconInSdcard);
}
});
PROBLEM SOLVED... file permission issues.. sorry
thanks in advance
dcsms said:
So, i manage to replace resource by creating Drawable from sdcard through DrawableLoader
but the Drawable not load. and also there is no error in xposed log. please any help?
here is my code
Code:
resparam.res.setReplacement("com.android.systemui","drawable","some_icon",new XResources.DrawableLoader() {
@Override
public Drawable newDrawable(XResources res, int id) throws Throwable {
return Drawable.createFromPath(myAwesomeIconInSdcard);
}
});
PROBLEM SOLVED... file permission issues.. sorry
thanks in advance
Click to expand...
Click to collapse
can u plz explain how u exactly solved the issue?? I'm also stuck on this issue for a few days now.. I didn't understand what u meant by file permissions issue..
thanks
prithvee said:
can u plz explain how u exactly solved the issue?? I'm also stuck on this issue for a few days now.. I didn't understand what u meant by file permissions issue..
thanks
Click to expand...
Click to collapse
the file that i copied to sdcard is corrupted.. i dunno why.. then i used this class to copying file http://stackoverflow.com/questions/4447477/android-how-to-copy-files-in-assets-to-sdcard .. then my probs solved
Related
Hi all,
I need to set an hook to a method whose signature is
public ArrayList<Object> populateList(Map<String, Object> paramMap, boolean paramBoolean1, boolean paramBoolean2)
I do not seem able to retrieve the class for the first parameter (ie: Map<String, Object>). What sintax am I supposed to use when invoking the hook method?
findAndHookMethod(classString, lpparam.classloader, "populateList", ?????, boolean.class, boolean.class, new XC_MethodHook() {...}
Thanks in advance
Silver.
slvrbllt said:
Hi all,
I need to set an hook to a method whose signature is
public ArrayList<Object> populateList(Map<String, Object> paramMap, boolean paramBoolean1, boolean paramBoolean2)
I do not seem able to retrieve the class for the first parameter (ie: Map<String, Object>). What sintax am I supposed to use when invoking the hook method?
findAndHookMethod(classString, lpparam.classloader, "populateList", ?????, boolean.class, boolean.class, new XC_MethodHook() {...}
Thanks in advance
Silver.
Click to expand...
Click to collapse
Try "Map.class".
Off the top of my head, I think generics are not part of the method signatures with regards to uniqueness; they only serve to aid the compiler in checking types during compilation.
Tungstwenty said:
Try "Map.class".
Click to expand...
Click to collapse
Duh!! It worked...
Thanks mate!
I'm trying to create a Xposed Module which will replace some internal strings, but I can't find any way to do it.
The strings I want to replace are "com.android.internal.R.string.am" and "com.android.internal.R.string.pm".
Can somebody give me any advice?
Code:
XResources.setSystemWideReplacement("android", "string", "am", "AM");
Above code doesn't have any effect
Code:
XResources.setSystemWideReplacement(com.android.internal.R.string.am, "AM");
Above code doesn't even compile
Code:
Resources.getSystem().getIdentifier("am", "string", "android")
Above code always returns 0 (zero).
Did you try "com.android.internal" (quotes included – as a string)?
GermainZ said:
Did you try "com.android.internal" (quotes included – as a string)?
Click to expand...
Click to collapse
Yes, I did
Code:
XResources.setSystemWideReplacement("com.android.internal", "string", "am", "AM");
Code:
NotFoundException: com.android.internal:string/am
"android" works for me. I'm not sure how/where you're using that code, though. Could you please paste all of it?
GermainZ said:
"android" works for me. I'm not sure how/where you're using that code, though. Could you please paste all of it?
Click to expand...
Click to collapse
Code:
public class AmPmFixer implements IXposedHookZygoteInit{
@Override
public void initZygote(IXposedHookZygoteInit.StartupParam startupParam) throws Throwable {
XResources.setSystemWideReplacement("com.android.internal", "string", "am", "AM");
XResources.setSystemWideReplacement("com.android.internal", "string", "pm", "PM");
}
}
change com.android.internal to android
pyler said:
change com.android.internal to android
Click to expand...
Click to collapse
Anyway...
Code:
NotFoundException: android:string/am
to the point How to findAndHookMethod this method:
Code:
public static ujiCoba(String[] string) {
}
i've tried with code bellow, but didnt work
Code:
findAndHookMethod(findClass, classLoader, String.class, hook);
You're not passing the method's name to findAndHookMethod. Also, the argument's class should be String[].class.
GermainZ said:
You're not passing the method's name to findAndHookMethod. Also, the argument's class should be String[].class.
Click to expand...
Click to collapse
i'm typo.
its work
hi @GermainZ. last qustion..
Code:
private static void getDetail(Context context, long l1, Info info, int i, long l2) {
Cursor cursor = SqliteWrapper.query(context, context.getContentResolver(), Uri.parser(Prefs.PARSER), new String[] {"status","sent","date"}, "group_id=", l1, null, null);
}
method like that make me confuse. i want change sent to received, how can i do this?
riskey95 said:
hi @GermainZ. last qustion..
Code:
private static void getDetail(Context context, long l1, Info info, int i, long l2) {
Cursor cursor = SqliteWrapper.query(context, context.getContentResolver(), Uri.parser(Prefs.PARSER), new String[] {"status","sent","date"}, "group_id=", l1, null, null);
}
method like that make me confuse. i want change sent to received, how can i do this?
Click to expand...
Click to collapse
You can replace the method and replicate these two lines, doing whatever modifications you want.
See:
XC_MethodReplacement to replace the method,
findClass to get the SqliteWrapper class,
callStaticMethod to call SqliteWrapper.query.
The rest should be covered in the development tutorial/wiki.
GermainZ said:
You can replace the method and replicate these two lines, doing whatever modifications you want.
See:
XC_MethodReplacement to replace the method,
findClass to get the SqliteWrapper class,
callStaticMethod to call SqliteWrapper.query.
The rest should be covered in the development tutorial/wiki.
Click to expand...
Click to collapse
that method very long and i dont have full of source code. so i can't replace method.
riskey95 said:
that method very long and i dont have full of source code. so i can't replace method.
Click to expand...
Click to collapse
Next best thing I can think of:
in beforeHookedMethod for getDetail, hook SqliteWrapper.query.
In that hook, check if the third argument is equal to the string array you want. If so, change it.
In afterHookedMethod for getDetail, unhook SqliteWrapper.query.
My code
Code:
XposedHelpers.findAndHookMethod("com.android.packageinstaller.InstallAppProgress$mHandler",
lpparam.classLoader, "handleMessage", Message.class, new XC_MethodHook(){
@Override
protected void afterHookedMethod(MethodHookParam param)
throws Throwable {...
https://github.com/android/platform...roid/packageinstaller/InstallAppProgress.java
I want hook method "handleMessage". But it doesnt work. Method not found.
pyler said:
My code
Code:
XposedHelpers.findAndHookMethod("com.android.packageinstaller.InstallAppProgress$mHandler",
lpparam.classLoader, "handleMessage", Message.class, new XC_MethodHook(){
@Override
protected void afterHookedMethod(MethodHookParam param)
throws Throwable {...
https://github.com/android/platform...roid/packageinstaller/InstallAppProgress.java
I want hook method "handleMessage". But it doesnt work. Method not found.
Click to expand...
Click to collapse
are you sure InstallAppProgress$mHandler was exist? i've try to decompile Packageinstaller.apk of my phone and InstallAppProgress$mHandler doesn't exist, method handleMessage on my phone belong to InstallAppProgress$1.class
riskey95 said:
are you sure InstallAppProgress$mHandler was exist? i've try to decompile Packageinstaller.apk of my phone and InstallAppProgress$mHandler doesn't exist, method handleMessage on my phone belong to InstallAppProgress$1.class
Click to expand...
Click to collapse
I tried to remove $mHandler but still it isnt working.
Maybe @GermainZ can help?
That's an anonymous class, it'll be called InstallAppProgress$number. "number" is a counter (starts at 1, ends at n, where n is the number if anonymous classes in the enclosing class) chosen by the compiler at compile time. It's not guaranteed to stay the same.
You can hook it as riskey95 said, but it might not be InstallAppProgress$1 everywhere (could be e.g. InstallAppProgress$2). TIAS, and maybe blindly try hooking $1 to $3 if necessary (use a try/catch statement).
$1 worked. Now I need to get access to mDoneButton. But I cant since I am in InstallAppDetails$1.
Code:
@Override
protected void afterHookedMethod(MethodHookParam param)
throws Throwable {
//prefs.reload();
test = true;
if (test) {
Button mDone = (Button) XposedHelpers.getObjectField(
param.thisObject, "mDoneButton");
// todo
}
}
You can get the outer class using, for example:
Code:
XposedHelpers.getObjectField(param.thisObject, "this$0");
(There might be an Xposed helper or an alternate method to do that, I can't remember and I can't check right now.)
GermainZ said:
You can get the outer class using, for example:
Code:
XposedHelpers.getObjectField(param.thisObject, "this$0");
(There might be an Xposed helper or an alternate method to do that, I can't remember and I can't check right now.)
Click to expand...
Click to collapse
Fanstastic. All work now. I have to put your nick in XInstaller OP
Thank you.
p.s: found. getSurroundingThis
Hi,
can you please share the final code that worked for you in this case:
XposedHelpers.findAndHookMethod("com.android.packageinstaller.InstallAppProgress$mHandler",
lpparam.classLoader, "handleMessage", Message.class, new XC_MethodHook(){
@override
protected void afterHookedMethod(MethodHookParam param)
throws Throwable {...
Thanks!
I finding a correct way to start some app when started Android or restared
I have something like
Code:
public void startSomeApp() {
Intent launchIntent = context.getPackageManager().getLaunchIntentForPackage("xxx.xxx.xxx");
if (launchIntent != null) {
context.startActivity(launchIntent);
}
}
But was wonder a correct way where should I put?
I try to push to
Code:
public void initZygote(StartupParam startupParam) throws Throwable {
startSomeApp();
}
But problem with context, any trick please?
1001z said:
I finding a correct way to start some app when started Android or restared
I have something like
But was wonder a correct way where should I put?
I try to push to
But problem with context, any trick please?
Click to expand...
Click to collapse
The correct way is without Xposed! Use the Android BOOT_COMPLETED broadcast.