[Q] Changing value of int within method - Xposed General

@rovo89 or anyone could you please help me with this
Say we have method A
public void A(){
//random stuff
int i = 0;
//more stuff
doing stuff with int i
}
Now how would i change i?
It has never been defined outside the method
Is it possible?
Thanks

That's an exact duplicate of this thread from yesterday: http://forum.xda-developers.com/xposed/field-inner-class-t2788380
--> Not possible.

rovo89 said:
That's an exact duplicate of this thread from yesterday: http://forum.xda-developers.com/xposed/field-inner-class-t2788380
--> Not possible.
Click to expand...
Click to collapse
In the other thread @GermainZ mentions doing it with another process by replicating it
Could this be done for changing the int?
Thans for your help

hamzahrmalik said:
In the other thread @GermainZ mentions doing it with another process by replicating it
Could this be done for changing the int?
Thans for your help
Click to expand...
Click to collapse
To be honest, I don't understand what he meant with that, but it seems to have helped. I see two possibilities here:
1. Replace and reimplement the method completely. There might be cases where this is fine, but usually I wouldn't recommend it. Often, you can't just copy & paste the method, but you have to use a lot of reflection to replicate it. And if the original method changes, your implementation becomes outdated.
2. Find a different way to achieve your goal. Maybe hook a method that sets the initial value of that variable or somehow has an influence on it. Or maybe choose a completely different approach. There is no standard recipe for this.

rovo89 said:
To be honest, I don't understand what he meant with that, but it seems to have helped. I see two possibilities here:
1. Replace and reimplement the method completely. There might be cases where this is fine, but usually I wouldn't recommend it. Often, you can't just copy & paste the method, but you have to use a lot of reflection to replicate it. And if the original method changes, your implementation becomes outdated.
2. Find a different way to achieve your goal. Maybe hook a method that sets the initial value of that variable or somehow has an influence on it. Or maybe choose a completely different approach. There is no standard recipe for this.
Click to expand...
Click to collapse
Ok thanks for your help
Option 2 won't work because the variable is never used outside the method
Option one is possible but hard because my method is very complicated

hamzahrmalik said:
Ok thanks for your help
Option 2 won't work because the variable is never used outside the method
Option one is possible but hard because my method is very complicated
Click to expand...
Click to collapse
Especially for complicated methods, I strongly advise not to rebuild them.
Can you show the full concrete example and what you're trying to achieve? You seem to be focused on "i", but there are often many ways to achieve something.

rovo89 said:
To be honest, I don't understand what he meant with that, but it seems to have helped. I see two possibilities here:
1. Replace and reimplement the method completely. There might be cases where this is fine, but usually I wouldn't recommend it. Often, you can't just copy & paste the method, but you have to use a lot of reflection to replicate it. And if the original method changes, your implementation becomes outdated.
2. Find a different way to achieve your goal. Maybe hook a method that sets the initial value of that variable or somehow has an influence on it. Or maybe choose a completely different approach. There is no standard recipe for this.
Click to expand...
Click to collapse
Right, "replicate the process to get the int" = reimplement part of the method to get the int.

rovo89 said:
Especially for complicated methods, I strongly advise not to rebuild them.
Can you show the full concrete example and what you're trying to achieve? You seem to be focused on "i", but there are often many ways to achieve something.
Click to expand...
Click to collapse
http://grepcode.com/file/repository...oader.java#RecentTasksLoader.getRecentTasks()
trying to change int first, line 232

hamzahrmalik said:
http://grepcode.com/file/repository...oader.java#RecentTasksLoader.getRecentTasks()
trying to change int first, line 232
Click to expand...
Click to collapse
Can't you just add the first task back, or remove the numbers you don't want? Instead of modifying the int directly (which you can't do), modify the result to either add or remove whatever tasks you want…

GermainZ said:
Can't you just add the first task back, or remove the numbers you don't want? Instead of modifying the int directly (which you can't do), modify the result to either add or remove whatever tasks you want…
Click to expand...
Click to collapse
Ok. I was hoping it would be possible to change the int because it would be easier
But thanks for your help

Related

Help with Phone.apk mod please

I want to edit the background of the dialer from black to white, but I cannot seem to find where it is, I've went through the source and can't find it. Can anyone help with this mod?
Thanks
Ima make a judgement call on this one and say if you can't find it, most likely you shouldn't be messing around with it
stefan.buddle said:
Ima make a judgement call on this one and say if you can't find it, most likely you shouldn't be messing around with it
Click to expand...
Click to collapse
If you do not recognize the name, perhaps you should not make such assumptions.
Let me see if I can find the file name, give me a few.
Edit: As far as I can tell, there is no image file for the background. From the small bit of android programming I have attempted, I do seem to recall the default background color being black. I think you probably need to edit an xml file, but I could be completely wrong. I could not read the xml files with my phone, so I could not narrow it down at all. If you agree this is the way to go, and need to know how to decrypt xml send me a pm.
I know it is not an image, I've edited all the images. I have done an abundant amount of themes. I posted the question because I have spent a long time looking though the source. It is not an xml in the drawable, it is in the source somewhere. After looking though the source though, I am starting to think it is something at a higher level than the phone.apk of contacts.apk and maye be something from the system itself, since all the apps have a black background as the default.
Since I think it does default to black, have you thought about including a new background file into drawable, and writing it into the xml somewhere.
cloverdale said:
Since I think it does default to black, have you thought about including a new background file into drawable, and writing it into the xml somewhere.
Click to expand...
Click to collapse
Haven't thought that far but that may be the best solution. There are a few white themes, and it could be a nice addition to them, or even to those without. I'll look into it more when I have some more time, unless there are some people that have time to help on this project
I need help please. I have the latest source from Cyanogen. I am trying to add something to the dialpad.xml but without even doing anything yet, when I start a new project from the code, I get a lot of errors, most I can just delete files and be ok with but I get
Description Resource Path Location Type
ERROR No resource identifier found for attribute 'contentDescription' in package 'android' dialpad.xml /DialtactsActivity/res/layout-finger line 126 Android AAPT Problem
Click to expand...
Click to collapse
Its from the part of the code android:contentDescription="@string/description_image_button_pound"
I have spent days trying to figure out what the issue is.
Can anyone help?

not been hacked??

i have heard someone that wp8 has still not been hacked?? is it true??
TarunDham said:
i have heard someone that wp8 has still not been hacked?? is it true??
Click to expand...
Click to collapse
That is true. Microsoft has made it even more difficult for us to find working exploits in order to do things such as modify the registry and modify look & feel. It will be quite some time before real progress is made. I wouldn't expect for anything to happen soon, but please keep checking at these forums to see if anything has been done.
snickler said:
That is true. Microsoft has made it even more difficult for us to find working exploits in order to do things such as modify the registry and modify look & feel. It will be quite some time before real progress is made. I wouldn't expect for anything to happen soon, but please keep checking at these forums to see if anything has been done.
Click to expand...
Click to collapse
@snickler: stupid little question to that: shouldn't it be possible to edit the keys in the HKEY_CURRENT_USER hive?
as far as I know from Windows 7 and 8, editing this hive doesn't need administrative privileges. Am I wrong?
sp4rt4n-i17 said:
@snickler: stupid little question to that: shouldn't it be possible to edit the keys in the HKEY_CURRENT_USER hive?
as far as I know from Windows 7 and 8, editing this hive doesn't need administrative privileges. Am I wrong?
Click to expand...
Click to collapse
With WP8, policies are enforced to limit modification to just about ALL parts of the registry. With what I've seen, certain apps (Nokia apps for instance) have specific certificates installed that gives them a specific right to a registry key. Basically Microsoft really didn't want us touching ANYTHING.
snickler said:
With WP8, policies are enforced to limit modification to just about ALL parts of the registry. With what I've seen, certain apps (Nokia apps for instance) have specific certificates installed that gives them a specific right to a registry key. Basically Microsoft really didn't want us touching ANYTHING.
Click to expand...
Click to collapse
another silly question is windows phone 8 ever gonna get hacked? I mean did you find anything so far? it seems that you cannot touch the registery in no way ... in other way you cannot send fake xml to phone that it can accepted as developers? (can't we make a fake webservice?!)
well then how can we access this?! did you get any attention for that? how long do you think it will take to get this windows hacked? (even an approximate time will do help much )
thanks
To be fair, that's the same as it was on WP7; apps couldn't even modify HKCU directly (short of being elevated by WP7 Root Tools). The early registry editors used high-privilege OEM drivers, not their own permissions. I'm hopeful there will be *something* we can tweak, but it won't be much until we find some EoP exploit.
EDIT: Asking "how long" is a ridiculous question. It's like asking how long until the current iOS version is jailbroken, or something like that. Nobody knows. Nobody can know. If we had the answers, it wouldn't be research. There could be a breakthrough this afternoon; hell, there could have been one last night. We could keep pounding on it for years. There's no point in even attempting a guess. This isn't something iterative, something where progress can be measured.
the fact that some of the guys have been able to find a way to read (but not write) to the registry is a start, but there's still a long ways to go. Considering Windows Phone 8 has been out since what, oct or nov of last year? There's even HeathCliff that has taken a glimpse in the .cabs. There's a way to run programs out of the sandbox, but even that is limited. Snickler wrote a registry reader, but doesn't allow editing of dword . And we've got GoodDayToDie's Webserver that *JUST* recieved the ability to read the registries, but its very picky. Slowly things are coming together and eventually with everyone looking, someone will stumble upon something. It's taken months to get this far.
Working on
TarunDham said:
i have heard someone that wp8 has still not been hacked?? is it true??
Click to expand...
Click to collapse
All Windows Phone Comunity are trying to hack the OS, but for a lot of problems (secure boot, ecc), it's so hard.
Essentially the current roadblocks for flashing custom roms are Secure Boot and BitLocker, not to mention knowing how to write back to the new ROM files. For accessing internal apps and stuff, we are having trouble finding how to set/change permissions. There's a ton listed in the registry, but its not fun finding out the how atm.

Watchmaker faces settings reset

I use watchmaker and love it. One issue I am having is certain faces have color settings (color for the hands, color for the text, color for the markets, etc). It seems that after setting the colors just the way I like it, within a few hours the colors reset to the default settings.
Does anybody else have this issue and does anybody know how to get the colors to stick?
Any help is appreciated.
Cheers,
B.D.
It depend on how that specific watchface is being build. You better start building your own face, with the desired colours and that will not reset itself .
ro_explorer said:
It depend on how that specific watchface is being build. You better start building your own face, with the desired colours and that will not reset itself .
Click to expand...
Click to collapse
Not really helpful in answering my question, ro_explorer. I know building my own would allow the watchface to be styled more to my personal tastes without requiring my question be answered, but I do like faces others have created with their personal scripting and sometimes these faces are locked and I do not have the time to recreate them. As such I'm asking a specific question about watchmaker and how it operates. I would ask that you please do not act condescending and pedantic in answering a specific question about a specific program in the future.
Sincerely,
B.D.
BostonDan said:
I use watchmaker and love it. One issue I am having is certain faces have color settings (color for the hands, color for the text, color for the markets, etc). It seems that after setting the colors just the way I like it, within a few hours the colors reset to the default settings.
Does anybody else have this issue and does anybody know how to get the colors to stick?
Any help is appreciated.
Cheers,
B.D.
Click to expand...
Click to collapse
I had the same issue with one watch face I have been using. I ended up solving it when I found a file that configures the defaults for the watch face. I edited the file and changed the variables for the colors and other settings to the way I wanted them to be so when it resets, it goes back to how I want it.
I assume that you could maybe do something similar. On my phone the location of the file was:
/sdcard/BeautifulWatches/scripts
It was just a matter of opening the text file and then changing the values for the variables. Then going on the watch and removing the watch face and resending it to the watch from watchmaker on my phone.
Nx248, thank you. I will explorer the scripts used to try to track down the colors I want. This is helpful. Wish the watch/program would remember the colors though and save me the time in tracking down the script implementation.
Thanks again.
Cheers,
B.D.
BostonDan said:
As such I'm asking a specific question about watchmaker and how it operates. I would ask that you please do not act condescending and pedantic in answering a specific question about a specific program in the future.
Click to expand...
Click to collapse
Please don't be an ass. My advice was a real one and I'm sticking to it. If you want to have something that suits your specific needs, with the specific look, the ONLY WAY to achieve it is to build it yourself. Do not expect others to deliver the perfection for you.
BostonDan said:
Wish the watch/program would remember the colours though and save me the time in tracking down the script implementation.
Click to expand...
Click to collapse
And I'm convinced 100% that you sent that wish to the developer as well ...
If you really want to find out more about the inner workings of a certain software/platform, or to add useful things to it, the easiest way is to contact the developer.
My recommendation is to stop complaining and actually do something to fix your issue. Do not bash on the ones who are trying to share with you their ideas.
ro_explorer,
If there were an option you would like to see on your car would you build a car yourself, or reach out to see if anybody else had implemented the solution. Your responses ARE condescending and rude in the way you come across expecting people to have infinite time to do this. Maybe you have the time to explorer building this yourself but I have other more important things to do which is why I posed the original question.
To quote you, 'don't be an ass. '
I have found a number of people who have offered useful help on these forums and still contend your 'advice' does not address the original question. I would contend that you need to read the questions people post and not write out an answer just to up your post count or 'prove' what a smart ass you can be.
This is the last post I will make on this subject.
B.D.
BostonDan said:
ro_explorer,
If there were an option you would like to see on your car would you build a car yourself, or reach out to see if anybody else had implemented the solution.
Click to expand...
Click to collapse
I'm an engineer and a tinkerer .... I'm ALWAYS implementing my own solutions in ALL technical fields that I understand. I also help others and try to put seeds of creation in everyone else ....
If I ever had to ask for stuff I always asked the producer.
I hope this is answering your concerns.
Other than this I'm really sorry you are sensitive to a level to consider my comments as rude ...
Good luck in your endeavour ... If I can help you again, I will ...
nx248 said:
I had the same issue with one watch face I have been using. I ended up solving it when I found a file that configures the defaults for the watch face. I edited the file and changed the variables for the colors and other settings to the way I wanted them to be so when it resets, it goes back to how I want it.
I assume that you could maybe do something similar. On my phone the location of the file was:
/sdcard/BeautifulWatches/scripts
It was just a matter of opening the text file and then changing the values for the variables. Then going on the watch and removing the watch face and resending it to the watch from watchmaker on my phone.
Click to expand...
Click to collapse
Hi nx248,
I tried changing the script on the phone and resending the watchface to the watch but found that since the script had already been transferred to the watch previously I had to edit the script on the watch.
I accomplished this by adb into the watch and pulling the script to my computer, editing it, and then pushing the script back on the watch to the /sdcard/BeautifulWatches/scripts directory. Alternatively, I think I could have pulled the script from my phone, edited it, and pushed it to the same location.
In any case, I edited the watchface variables so that the default position in the array corresponded to the colors I wanted, which is working.
Thanks for your help. :good:
EDIT: Just saw that you had stated I should delete the watchface from the watch. I don't know how to do this, so I will have to educate myself.
I read the Watchmaker forum and found that if you enter the "change faces" screen on the watch under Watchmaker (usually press at one of the main watch positions - default to 3 o'clock, but can be set to 6,9,12 o'clock) and swipe up on the face you wish to remove, it is removed from the watch.
Cheers,
B.D.

Creating an Xposed module, modifying google maps, not sure how to continue

I am trying to make a simple Xposed module where the screen that says "You have made it to %s" will be black if you were navigating in night mode. Currently it is bright white, which is quite blinding.
I have successfully created a simple Xposed module to turn the clock red via a very useful tutorial. I have also successfully decompiled google maps, but I am not entirely sure how to continue now. I looked for the string "you have made it to", which I then did find in an xml file, but I can't find it being referenced anywhere. The other strings ("earlier than predicted" and "walk the rest of the way") gave me the same result.
I had assumed it would be relatively easy to find where in the code the arrival screen is rendered, but apparently not. Can anyone here give me any tips on how I can find it?
I'm quite sure it's not easy, because google apps are not open source and I suppose they're taking measures against full decompilation.
Gesendet von meinem Moto G 2014 LTE mit Tapatalk
I have decompiled obfuscated java code before(although not an app), and it wasn't super easy, but looking for strings made it quite doable. I guess it might just be harder for apps?
inasm said:
I have decompiled obfuscated java code before(although not an app), and it wasn't super easy, but looking for strings made it quite doable. I guess it might just be harder for apps?
Click to expand...
Click to collapse
You probably have to locate where the string resource is being used. If you're able to decompile the APK, you should be able to find the resource ID for this string and then search through the code for a reference to it.
Then maybe hook that function to change the TextView color after it's being called.
itandy said:
You probably have to locate where the string resource is being used. If you're able to decompile the APK, you should be able to find the resource ID for this string and then search through the code for a reference to it.
Then maybe hook that function to change the TextView color after it's being called.
Click to expand...
Click to collapse
Thanks for the response! I already tried doing that, and I only found these kind of id's by doing that: 0x7f110460. This is an extremely large number, so I'm assuming it's some kind of memory location, and I have no clue how to continue from here
inasm said:
Thanks for the response! I already tried doing that, and I only found these kind of id's by doing that: 0x7f110460. This is an extremely large number, so I'm assuming it's some kind of memory location, and I have no clue how to continue from here
Click to expand...
Click to collapse
Your ID 0x7f110460 is actually 6C7F3C in hex. Next thing you can do is search this hex number in the decompiled smali or jar file to locate the referencing methods.
itandy said:
Your ID 0x7f110460 is actually 6C7F3C in hex. Next thing you can do is search this hex number in the decompiled smali or jar file to locate the referencing methods.
Click to expand...
Click to collapse
Thanks for your help, but the id 0x7f110460 is already in hex (I think you have missed the f in there). I tried searching for it, but it turns up nothing.
inasm said:
Thanks for your help, but the id 0x7f110460 is already in hex (I think you have missed the f in there). I tried searching for it, but it turns up nothing.
Click to expand...
Click to collapse
Oh yes like you said I misread the number. Anyway you need to translate the hex back to decimal. Then search again.
Wrong post
itandy said:
Oh yes like you said I misread the number. Anyway you need to translate the hex back to decimal. Then search again.
Click to expand...
Click to collapse
I had already tried that, and found nothing .
Thanks a lot for your help though, but google just updated its app to include this! Maybe it's because of the feature request I made, or maybe it's just a coincidence, but I'm super happy!

task when appointment in calendar starts/ends - how to find / with pattern matching

Hi,
I wanted to have a notification that always shows me the task that has me marked as busy in my calendars.
so I need a task that refreshs that notification whenever something changes. To achieve that I made 2 profiles:
-one profile is used to trigger the update task whenever the next appointment ends
-the other triggers whenever a new appointment starts
the update task not only creates the string for the notification but also refreshs the appoinment that ends next and also a string with all known appoinments. The second profile is triggered with a pattern match that always excludes all known appointments.
This way the second profile turns off itsself whenever a new appointment starts.
This way the whole thing works even if there are appointments that:
*start at the same time but do not end at the same time
*start at different times and end at different times
(if you don't have that: good for you ... no need to discuss it - I explained in the link below why this is not avoidable)
Now I still have one problem:
I do have appointments in my calendar that have slashes "/" (and many people might have when being invited by others). The list with the known appointments that is used as trigger for the second profile looks like this: "!appoinment1/appointment2" (the slash means "or"). If one of the titles contains a "/" that will keep the second profile on all the time and it will not trigger new appointments ...
unfortunately it seems like tasker cannot us other characters in that place (like regex) and it seems like I cannot even escpe the / slashes ("\/")
Any solution to that would be appreciated. And - maybe the code is usefull to others (there is a variable in the adjust_notif task in the very beginning that can be filled with the calendars that shall be shown in the notification - format "*cal1*/*cal2*/*cal3*" and so on)
Also for testing purposes I mad a variable %now to be able to change when the task is checking the calendar (of course this won't help when testing the profiles ...)
I started the discussion here but I think google groups is too unflexible (no file upload) and also ... too few people there ... and - I love XDA ...
best regards
Daniel
hmmm - testing if replacing the / with a + or * will help - would make the whole thing slightly unreliable but I actually don't think that would cause a problem ...
seems to work my perfectionism would prefer a better solution
However: how come the profile does not automatically update its status when I am in tasker? still shows green and only when I click it and go back it changes ...
good that I asked ... motivated me so that the thing is improved now. Still no real solution for finding / but a newer version with some bugs removed (callist did not really work with the old version)
I also made an additional profile with which it is possible to use "restore settings" so that now only one task "silent" is necessary to adjust to your personal needs.
Hi
I wonder where the palace is to discuss tasker projects ...
Here .... obviously not
Regards
daniu said:
Hi
I wonder where the palace is to discuss tasker projects ...
Here .... obviously not
Regards
Click to expand...
Click to collapse
interesting idea...
Have you tried putting all known appointments into a variable (appending, separated with a new line)? Then you can call on this variable to see if the current appointment has a match (with *%CurrentAppointVar*).
That way, there should be no slash in the match function.
alienyd said:
interesting idea...
Have you tried putting all known appointments into a variable (appending, separated with a new line)? Then you can call on this variable to see if the current appointment has a match (with *%CurrentAppointVar*).
That way, there should be no slash in the match function.
Click to expand...
Click to collapse
Hi
I don't get how that would remove the / from the text besides that I do check against a variable already if I understood your point correctly ...
Regards
daniu said:
Hi
I don't get how that would remove the / from the text besides that I do check against a variable already if I understood your point correctly ...
Regards
Click to expand...
Click to collapse
if I understood correctly, you have something like this:
current events: meeting/task1, meeting2, meeting3
new event: meeting4
if %new != meeting/task1/meeting2/meeting3
do something
which returns wrong results.
So I would try:
set %curr to
meeting/task1
meeting2
meeting3
(append, with new line after each event)
and then
if %new !match %curr
do.....
probably the appending part could be done with a FOR loop.
Hope this helps.
alienyd said:
if I understood correctly, you have something like this:
current events: meeting/task1, meeting2, meeting3
new event: meeting4
if %new != meeting/task1/meeting2/meeting3
do something
which returns wrong results.
So I would try:
set %curr to
meeting/task1
meeting2
meeting3
(append, with new line after each event)
and then
if %new !match %curr
do.....
probably the appending part could be done with a FOR loop.
Hope this helps.
Click to expand...
Click to collapse
Hmmm ... well - the problem is that I check against that string in a profile not in a task ... I ckeck if a new task starts that does not have a name within that string (of currently running appointments). In your example:
!meeting/task1/meeting2/meeting3
My way now is to change the check variable to:
!meeting*task1/meeting2/meeting3
which does jot work that bad after all ...
I am just generally a bit disappointed by this forum because I would love to have a place were there are enough ppl so that someone would be interested enough to actually install the project which even you obviously did not do.
Regards
daniu said:
Hmmm ... well - the problem is that I check against that string in a profile not in a task ... I ckeck if a new task starts that does not have a name within that string (of currently running appointments). In your example:
!meeting/task1/meeting2/meeting3
My way now is to change the check variable to:
!meeting*task1/meeting2/meeting3
which does jot work that bad after all ...
I am just generally a bit disappointed by this forum because I would love to have a place were there are enough ppl so that someone would be interested enough to actually install the project which even you obviously did not do.
Regards
Click to expand...
Click to collapse
sorry to say this, but obviously your project didn't raise enough interest, at least not for me. I guess people try to help where and how they can, without obligations. You should not expect much, especially when the project is complex...
just my 2 cents

Categories

Resources