[Q] Replace int in method - Xposed General

Hi
I want to remove a limitation from an app.
I found how the limitation is set:
Code:
for(int i = 1 ; i < 20 ; i++){
}
So I want to change the 20 to 50 or something.
Could someone help me with this

You can't replace a local variable. Instead, you can hook the method to do something before or after it's called or to completely replace it.

GermainZ said:
You can't replace a local variable. Instead, you can hook the method to do something before or after it's called or to completely replace it.
Click to expand...
Click to collapse
Okey. Could you tell me how to do that because I don't really understand.
I know how to hook a methode but then the problem that I have is i don't know how to acces the variables.
I mean if I hook onCreateOptionsmenu
Then I can replace that with some code I want right? But how do I access the variables from that app. For examlle check if a boolean is true?
Sent from my SM-N9005 using XDA Premium 4 mobile app

Rick Clephas said:
Okey. Could you tell me how to do that because I don't really understand.
I know how to hook a methode but then the problem that I have is i don't know how to acces the variables.
I mean if I hook onCreateOptionsmenu
Then I can replace that with some code I want right? But how do I access the variables from that app. For examlle check if a boolean is true?
Sent from my SM-N9005 using XDA Premium 4 mobile app
Click to expand...
Click to collapse
Check the Development tutorial if you haven't already, as well as the Helpers page.
I'd also advise you to check some open source modules' source code to get a better grasp.
I'm not sure of what exactly you want to do, but here's a general example:
The class you're hooking:
Code:
class SomeClass {
final int mInt;
public Object someMethod(int param1) {
return SomeStaticClass.someOtherMethod(param1, mInt);
}
}
static class SomeStaticClass {
public static someOtherMethod(int param1, int param2) {
// Do something
}
}
Let's say you want to hook someMethod to replace it, but instead of using "param1" and "mInt" when calling someOtherMethod, you want to use "1" and "2". Your code would look something like this:
Code:
…
findAndHookMethod("com.package.SomeClass", lpparam.classLoader, int.class, new XC_MethodReplacement() {
@Override
protected Object replaceHookedMethod(MethodHookParam param) throws Throwable {
SomeStaticClass = XposedHelpers.findClass("com.package.SomeStaticClass", lpparam.classLoader);
int mInt = (Integer) XposedHelpers.getObjectField(param.thisObject, "mInt"); // This is the actual value of mInt — ignored
int param1 = (Integer) param.args[0]; // This is the actual value of param1 — ignored
// we ignore the actual values of mInt and param1 since we don't care about them, and use "1" and "2" instead.
return XposedHelpers.callStaticMethod(SomeStaticClass, "someOtherMethod", 1, 2);
}
)

GermainZ said:
Check the Development tutorial if you haven't already, as well as the Helpers page.
I'd also advise you to check some open source modules' source code to get a better grasp.
I'm not sure of what exactly you want to do, but here's a general example:
The class you're hooking:
Code:
class SomeClass {
final int mInt;
public Object someMethod(int param1) {
return SomeStaticClass.someOtherMethod(param1, mInt);
}
}
static class SomeStaticClass {
public static someOtherMethod(int param1, int param2) {
// Do something
}
}
Let's say you want to hook someMethod to replace it, but instead of using "param1" and "mInt" when calling someOtherMethod, you want to use "1" and "2". Your code would look something like this:
Code:
…
findAndHookMethod("com.package.SomeClass", lpparam.classLoader, int.class, new XC_MethodReplacement() {
@Override
protected Object replaceHookedMethod(MethodHookParam param) throws Throwable {
SomeStaticClass = XposedHelpers.findClass("com.package.SomeStaticClass", lpparam.classLoader);
int mInt = (Integer) XposedHelpers.getObjectField(param.thisObject, "mInt"); // This is the actual value of mInt — ignored
int param1 = (Integer) param.args[0]; // This is the actual value of param1 — ignored
// we ignore the actual values of mInt and param1 since we don't care about them, and use "1" and "2" instead.
return XposedHelpers.callStaticMethod(SomeStaticClass, "someOtherMethod", 1, 2);
}
)
Click to expand...
Click to collapse
Thank you so much this is what I needed. I got lost on the mInt part
Thanks
Sent from my SM-N9005 using XDA Premium 4 mobile app

Related

[For All HD2 Owners] [ HD2 Keypad/Keyboard] [WOW!!] [EBAY LINKS !!!] [GRAB NOW]

Hello guys,
I just came across this awesome keyboard/keypad that is compatible with HD2/Iphone/Pc. Right now this keyboard is sold out and i dont have any clue when it will be available. It is called the Mini Bluetooth Keyboard and is available for chinavision.com .
Product Description:
* Primary Function: Mini Bluetooth Keyboard
* Chipset: Broadcom 2042 Chipset
* Systems Supported:
- Supported Smart Mobile System:
1. Nokia Symbian S60 V3 and above
2. Android 1.6 and above
3. Windows Mobile 6.0 and above
- Supports all PC and Mac operating systems
- Supports Sony PS3
- Supports iPad
* Frequency band: 2.4 - 2.4835GHz unlicensed ISM band
* Receiving sensitivity : -75dbm (standard)
* RF output power: 4dbm maximum
* Operating Distance: 0 - 10 m
* Bluetooth Version: 2.0
* Keyboard Format: 49 keys, QWERTY layout
* Battery: Built-in Rechargeable Li-ion Battery
* Battery Duration:
Constant Use: ~50 hours
Standby: ~400 hours
* Power: Charges by USB
* Charging Time: ~2.5 hours
* Dimensions: 115 x 60 x 6 mm
* Manufacturer Ref: R0HT43UGJO11
Product Notes
* Pocket sized, sleek & slim design
* Ideal for typing emails and chatting, and gaming
* Convenient pocket size gadget
* 49 key QWERTY keyboard layout
UPDATE
I just had a word with one of their customer respresenative named Mandy, she sounded very pleasant and nice. After going through the whole dealing process she insisted that the minimum order to modify an item is 500 units. So if any of the manufacturers or businessman can order 500 HD2 then it might be possible that we can have a custom built Qwerty Keypads for our HD2.
By the way she also assured that the item is bieng checked by one of the quality checking teams and it will be available on the website pretty soon. So enjoy the beautiful keyboard since then.
Just found another website which is selling the same product. Have a look here : http://www.chinajiaho.com/mini-bluetooth-keyboard-for-ipad-and-smartphones_p1361.html
The Big Deal
Now while going through the product description i noticed quite interesting details:
It is almost simlar to the length / breadth height with our hd2.
HTC HD2 :120.5mm x 67mm x 11mm KEYBOARD:115mm x 60mm x 6 mm
What More !!
As specified on the website, they also have custom made keypads available if the product is bought on lots or wholesale of 500 and above number.
Now this is interesting as i am going to contact them and ask them strictly to this option whether they can make custom keypads with a hinge or a hook for an hd2, i would happily place an order of 500+ keyboards.
Dont you all think this would be a great addon for our HD2. If anyone interested please add your comments here, and lets make this idea into reality.
Imagine HD2 with a Qwerty Keypad .. This sounds to good to be true.
Price/Cost
And my last surprise to you, this is worth only only only USD 20
For more details you can go directly to the production description website : THE CHINAVASION WEBSITE HAS BEEN DELETED FOR NOT MEETING CUSTOMER NEEDS.
DO NOT BUY ANYTHING FROM CHINAVASION. BAD REP, BAD CUSTOMER SERVICE.
See post #2 for pictures .
NEW: VIDEO
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
LINK: http://www.dealextreme.com/details.dx/sku.37864
UPDATE #2
Just found another keypad/keyboard of the same price ie. $26.99.
Anyone interested can have a look at this website:
Link:
http://www.dealextreme.com/details.dx/sku.37863
Vote Now.
Which one would you buy: #1 or #2
NEW UPDATED LINKS:
Hey guys,
I was surfing through ebay to check whether we have any new links provided the price to be low. And yes there are a couple i've found these:
Any one who is interested can step in to these links
Source 1: BLACK VERSION http://cgi.ebay.com/Mini-Bluetooth-...t=Video_Games_Accessories&hash=item335df1d105
For 20 bucks, that doesn't look too bad.
wow....really nice i think i will buy one if i found on uk teritorry.
Nice Keyborad, very very nice!
Are you sure it's not made in Kazikstan ...
lol. of course not.
I'll have 1 or 2
Put my name down please if you deal with them. I asked about a Keyboard the other day for the HD2 here and just come back to see if there was an answer or suggestion. yours is a good find.
it doesnt have arrows to navigate ;(
D4rkSoRRoW said:
it doesnt have arrows to navigate ;(
Click to expand...
Click to collapse
Look closely it has red arrows so press the red FN key and you can use the arrows
BlazinAsian said:
Look closely it has red arrows so press the red FN key and you can use the arrows
Click to expand...
Click to collapse
:O i didnt see this, very nice =D
looks awesome!
ready to buy NOW!
tooo bad ...
Sold out .....
lol, check the word "Keyborad" on the images, wrong spelling. Typical "made in China" !
The keyboard itself looks interesting and will be very handy though. Really excited to try
I don't get why the OP is going on about bulk orders for modifying them. First of all we need to order 500+ to get them modified, then we only need 25+ to get them modified.
Why on earth do they need modifying in the first place? I'm lost.
i think he means 500+ to get them modified to an easier design to use with the hd2, and 25+ to buy now as they are.
How would it fit onto the hd2? or wont it at all. If it cant clip on, or you just hold it, what the point? lol you might as well have just got a phone with a keyboard...
otherwise ur gonna have to carrry around a huge keyboard with you everywhere.
silly idea im afraid, you wont get 500 people to buy them i can tell you that now..
johncmolyneux said:
I don't get why the OP is going on about bulk orders for modifying them. First of all we need to order 500+ to get them modified, then we only need 25+ to get them modified.
Why on earth do they need modifying in the first place? I'm lost.
Click to expand...
Click to collapse
hey mate thanks for correcting here, i actually didnt remove the other comments after updating, doing it now. thanks. the keypad can be modified only if we order above 500+ units. i am not a businessman so cannot ask them for such order. anyways when it will be available i will update my post. thanks though bringing it to my attention.
visually it reminds me of the rhodium keyboard.
I have to admit for occassional use it would be great, I don't tend to write articles and stuff on my pda any more, whereas I used to on my advantage all the time. I may be tempted if it felt good to use, which is the risk with some of these, they feel awful to actually type with
looks a very cheap price, most other sellers are charging twice that price.
fards said:
visually it reminds me of the rhodium keyboard.
I have to admit for occassional use it would be great, I don't tend to write articles and stuff on my pda any more, whereas I used to on my advantage all the time. I may be tempted if it felt good to use, which is the risk with some of these, they feel awful to actually type with
looks a very cheap price, most other sellers are charging twice that price.
Click to expand...
Click to collapse
hows your health now
I want one. For $20 you can't go wrong. Could be very handy for remote controlling many apps and may allow control of lots of games, etc I can't otherwise control because of lack of hard keys. When can we order??
For those in the UK have you seen this?
http://www.mobilefun.co.uk/mini-bluetooth-keyboard-p18753.htm

What VPN service should I use?

I'm looking for a good VPN service which is cheap and secure, what do you all use and recommend?
These are cheap VPNs: NordVPN, SurfShark, CyberGhost, Trust.Zone.
when choosing a VPN, buy that does not save logs
ProtonVPN, NodrVPN, ExpressVPN
I use private internet access (PIA). No problems for now.
Try the ones which you find suitable for you then judge yourself which one is the best for you
esparkinfo said:
These are cheap VPNs: NordVPN, SurfShark, CyberGhost, Trust.Zone.
Click to expand...
Click to collapse
I think, you are right )
Hexgore said:
I'm looking for a good VPN service which is cheap and secure, what do you all use and recommend?
Click to expand...
Click to collapse
Don't. Just host one yourself on a Raspberry Pi.
$cronos_ said:
Don't. Just host one yourself on a Raspberry Pi.
Click to expand...
Click to collapse
That's what I do for nearly 4 years now. Working excellent.
[GUIDE] My Pi-hole and PiVPN powered by our Raspberry Pi 3 Model B+
ATTENTION (update on 2018-04-09): The procedures described in this thread are only working if you own an internet account with a public IPv4 address or dual stack i.e. both, public IPv4 and public IPv6 addresses. For account with only a public...
forum.xda-developers.com
Nord is Best

Atrix + (Xoom kernel + Libs)

Both are Tegra2 devices
Both are using the same Wifi chips
Both are GSM/HSPA devices
Plan of action:
Get Xoom kernel for 2.6.32 (same level as the kernel we've got for Atrix)
Diff the two for platform specific changes
Get Xoom kernel for 4.1.2 release (http://www.xda-developers.com/android/motorola-xoom-gets-stock-rooted-android-4-1-2/)
Put in platform specific changes learned from diff
Then you should have a binary compatible Atrix-fied Xoom kernel, running on the Atrix. Which enables you to
Use Xoom hardware acceleration
Have a propper Project Butter experience
Have a kernel that doesn't run on the compatibility mode of bionic libraries
A more modern and mature Linux kernel (and libs)
Xoom Device specifics
git clone https://android.googlesource.com/device/moto/stingray
Xoom Kernel
git clone https://android.googlesource.com/kernel/tegra
Xoom Sourceforge page
http://sourceforge.net/projects/xoom.motorola/files/
Wiki entry for the SOC
http://en.wikipedia.org/wiki/Tegra (note the difference, we're using Ventana, Xoom is using Harmony => we are using different chips - surprise...)
Click to expand...
Click to collapse
board-*.c differences
ATRIX STARTUP (tegra_olympus_init)
Tegra common init
Programming jig on GPIO PV6 disable
Pin multiplexing
Clock init
Setup debug UART on UART B
Start DSI clock
Start 3D clock, make sure it is at correct speed
Register platform devices
Keypad
I2C
LCD Panel
SDHCI/MMC
WLAN
Nothing weird here.
XOOM STARTUP
Tegra common init
Tegra init suspend
EMC
Setup Tap delay on wifi chip to 6
Programming jig on GPIO PV4 disable
USB OTG setup
Setup GPIO for charging circuitry on GPIO PV5
Enable charge LEDS
Dynamic voltage and frequency scaling disabling on P1 hardware
Enable power rail on Wifi/BT chip BCM4329
Pin mux edit
Clock init
Setup debug through UART B (! same as Atrix)
Init Digital->Audio converter 1
Init Digital->Audio converter 2
Setup device structs on platform struct
Audio init
RAM Console start
Weird memory carve outs (for what, firmware later on?)
Register platform devices with kernel
I2C
Power off (?) init
Keypad
Touch
Power
W1
WLAN
GPS
USB
Marked are things that are different and / or weird in the init phase.
Click to expand...
Click to collapse
Its a good plan, but woudnt the architecture be slightly different?
I really don't know what it means, but it was said very often in the forums:
Xoom = SoC T20
Atrix = SoC AP20h
But I hope that you can do some magic :silly:
Have you actually started this process or is it just a plan you hope will work?
Sent from my MB860 using xda premium
it's not only the cpu and antenna...there is also the camera,fingerprint and imo the resolution of the screen is also important...
so this kernel cannot be used...only some parts of it mabe
If is works, It will be a great dev but
is it possible?
Sent from my MB860 using xda app-developers app
Also, code names for these units:
Xoom = Stingray
Atrix = Olympus
https://android.googlesource.com/kernel/tegra/
Found the kernel source... Seems as though we are capped at 2.6.39, for now.
mateusdalpi said:
I really don't know what it means, but it was said very often in the forums:
Xoom = SoC T20
Atrix = SoC AP20h
But I hope that you can do some magic :silly:
Click to expand...
Click to collapse
Can you point me up on what does that mean?
Sent from my MB860 using xda app-developers app
Finally someone that's thinking in the long term. Barring a kernel source leak from Motorola, this would be a way to go. Sounds like massive coding process though. Are you up to it? Do you have a plan?
Kudos for the idea.
I have XOOM MZ601, because of that I buy Atrix, it's the same machine...this will be great, and also tu put webtop ( I know I am boring, but I have lapdock and I desperately need webtop ):good:
Newbleeto said:
Finally someone that's thinking in the long term. Barring a kernel source leak from Motorola, this would be a way to go. Sounds like massive coding process though. Are you up to it? Do you have a plan?
Kudos for the idea.
Click to expand...
Click to collapse
Ok - some history:
I've worked at a mining communications/safety company Becker Mining Systems, for their R&D firm Becker R&D in South Africa.
We've developed an Android VOIP phone for to be used in mining (hazardous, please-don't-make-a-spark) environments. We've succeded, but then Germany practically canned their colleries (hug-a-tree-don't-kill-johnny-polar-bear) - resulting us to stop development 2 months before manufacturing (literally only had to make the moulds). Sigh - the collery overseers DSK was the contracting client.
My job was to get Android running on this Freescale iMX31 based platform. I did the kernel + Wifi + Android + VOIP and a bit of the UI.
Plan of action:
/arch/arm/ is the first point to go looking for things in the kernel. In this case, we'll be looking for /arch/arm/mach-tegra/, this is where all the platform specifics will hide away.
Compare board-olympus.c and board-stingray.c (+ board-olympus.h and board-stingray.h). Look for similarities, look for differences. These are the glue points - in this .c files the startup / fixup / powerup of the platform starts off. See it as the void main(void) file for the platforms.
Adapt the board-stingray.c in such a way that it starts up on the Atrix
After kernel start up, get the peripherals running. This includes UARTS (USB the most common, and debug), SPI (chats to other peripherals), MMC (chats to the WiFi/BT module) and also the screen.
Merge in libraries - we'll probably using the Atrix radio driver file, but the rest (Wifi, OpenGL libs) from the Xoom
If all of this doesn't make sense to you, please press the thank you button and refrain from commenting on this feed
Hmmm... yeah you are the right person for this job :laugh::good: :highfive:
I wish you to succeed, you would make lot of people to be really happy !
If you need testers, i'll be right there.
Jokersax already said its possible, in fact, he was using some Xoom binaries that he ported, but he also said that it required a MASSIVE amount of coding, time and skills to get it done.
Hope you can accomplish this dude! Good luck!
balintmaci said:
yeah well those didn't really make a difference... and we have the libs, only need a supporting kernel.
Click to expand...
Click to collapse
Indeed, he showed that it was possible.
It might help when nVidia goes opensource with the Tegra drivers, but so far I haven't seen enough details on that to be encouraged yet. I suspect that what we'll see will be either code dropped into nouveau or a separate driver set rather than nVidia opening up their proprietary drivers.
mvniekerk, please join Atrix Re-Birth Project.
We already have libs for Atrix, two leaked rom, closed kernel, useful CM 10 (I'm using it right now), great developers (Epinter, MMontuori, TPoint75...)
With your knowledge and enthusiasm we could go even further and faster.
This can be tested, it's very simple, dd the xoom boot partition to a file, then flash out back to the Atrix. If it passes the boot logo, there is hope...
Sent from my MB860 using xda app-developers app
mvniekerk: If you're serious about this undertaking, I'm sure there would be quite a few willing to donate, including myself.
In fact, I suggested something similar, but using the Galaxy R kernel as base ( http://forum.xda-developers.com/showthread.php?p=32274673, last post on that page). That is a 3.x kernel.
Sent from my MB860 using xda app-developers app

[Q] Watch ESPN App Recognizes HD+ as Phone

I have a Nook HD+ running SlimKat 4.4.4. The WatchESPN app has been running well for the most part. However, the app has a restriction that only allows Monday Night Football to be watched on desktops or tablets - not on phones. The app is recognizing my Nook HD+ as a phone and therefore is not allowing me to watch these certain broadcasts.
Does anyone know how to have my device actually be recognized as the tablet that it is? I have limited knowledge on where to look, but what I found so far that I thought may be relevant is that in the build.prop are the following properties:
ro.build.characteristics = tablet
ro.product.device = ovation
ro.product.brand = Android
ro.product.manufacturer = Barnes & Noble
ro.product.model = BN NookHD+
ro.product.name = slim_ovation
Thanks for the help.
You must backup original build.prop.
And change only model and brand.
Try this.
Galaxy tab 8.4 (wifi)
ro.product.model=SM-T320
ro.product.brand=samsung
com35 said:
You must backup original build.prop.
And change only model and brand.
Try this.
Galaxy tab 8.4 (wifi)
ro.product.model=SM-T320
ro.product.brand=samsung
Click to expand...
Click to collapse
Thank you for the input, I will try this out.

Java calculation

I am making a unit converter app and at one point, I am converting grams to metric tons:
case "grams":
value *= 0.000001;
et.setText(Double.toString(value));
The output in the emulator is 0.0 instead of 0.000001 or 1E-6 .
Is there something wrong?
Thanks.
levimatheri said:
I am making a unit converter app and at one point, I am converting grams to metric tons:
case "grams":
value *= 0.000001;
et.setText(Double.toString(value));
The output in the emulator is 0.0 instead of 0.000001 or 1E-6 .
Is there something wrong?
Thanks.
Click to expand...
Click to collapse
First declaration of "value"?
Ciuffy's SM-G900F CM 12.1 spirit hath marked this way. Thank if helped your soul.

Categories

Resources