[Android Q&A, Help & Troubleshooting] Jerry911:
(Sorry, I just realized this should be in Q&A and not General)

Hi there fellow Android enthusiasts.

Recently I bought a Bebop 2 drone, which is quite fun to play around with. After a couple of flights I noticed that

the max altitude of this device is 150m (492.12ft). I dug through a couple of threads on the Parrot forum about increasing

past this limit and somewhere I've read that the limitation is build into the piloting app.

So I decompiled the app with an app called ShowJava, I searched through the generated sources for strings like "MAX_ALTITUDE" and "150.0".

After some digging I found the following interesting file.

com.parrot.freeflight3/java/com/parrot/freeflight/piloting/model/bebop/BebopPreset.java which has a static final:

MAX_ALTITUDE_STATE = DoubleBoundedState.createFromValue(ExponentialBackOffPolicy.DEFAULT_RANDOMIZATION_FACTOR, 30.0d, 150.0d);

DoubleBoundedState is a class found in com.parrot.freeflight3/java/com/parrot/freeflight/util/DoubleBoundedState.java and it looks like a wrapper class that has 3 fields of the type Double, mCurrentValue; mMaxBound; and mMinBound; (thank "God" for proper named of fields). The wrapper class has a "constructor" createFromValue which takes 3 arguments: double minBound, double currentValue, double maxBound. After digging through some more code I found out that DEFAULT_RANDOMIZATION_FACTOR has the value of 0.5, so this is the lowest altitude value that can be set in the UI and it can be found in /sources/com.parrot.freeflight3/java/com/google/api/client/http/ExponentialBackOffPolicy.java.

So.... we could conclude that the 150.0d is 100% certain the max altitude value, which is hardcoded into the piloting. As far as I can see it's only in that 1 file (BebopPreset.java).

This is the point where I could use some help, what I did after all that was decompile the apk file with apktools and looked at the smali file (I have no experience with smali files):

.line 14
const-wide v8, 0x4062c00000000000L # 150.0
move-wide v4, v12
move-wide v6, v2
invoke-static/range {v4 .. v9}, Lcom/parrot/freeflight/util/DoubleBoundedState;->createFromValue(DDD)Lcom/parrot/freeflight/util/DoubleBoundedState;

move-result-object v0

sput-object v0, Lcom/parrot/freeflight/piloting/model/bebop/BebopPreset;->MAX_ALTITUDE_STATE:Lcom/parrot/freeflight/util/DoubleBoundedState;

So I think const-wide v8, 0x4062c00000000000L # 150.0 is the line I would want to edit?

Luckely in that same settings screen in the app is a maximum distance which is 2km (2000.0d)

[IMG="screenshot"]https://lh6.googleusercontent.com/3aq_j3hfwo9oGfnAAx6rEIcT2qekQdaF0S3DzM79P2ME9PLeHQCb0AXAocxvK9yUztIJlDd_os9JMaT6cViuWs4NAANlNClFkLLE=w1535-h737-rw[/IMG]

and in the smali file that's the entry right underneath the one I want to edit. It looks like this.

.line 15
const-wide v4, 0x409f400000000000L # 2000.0
const-wide v6, 0x409f400000000000L # 2000.0
move-wide v2, v14
invoke-static/range {v2 .. v7}, Lcom/parrot/freeflight/util/DoubleBoundedState;->createFromValue(DDD)Lcom/parrot/freeflight/util/DoubleBoundedState;

move-result-object v0

sput-object v0, Lcom/parrot/freeflight/piloting/model/bebop/BebopPreset;->MAX_DISTANCE_STATE:Lcom/parrot/freeflight/util/DoubleBoundedState;

So I tried to change the value 0x4062c00000000000L for the value 0x409f400000000000L in the hope I would see 2000 in the UI instead of 150. But after rebuilding the apk and signing it I still see 150 as a max. Who can and wants to help me change this smali file in the correct manner?

Also, you might have noticed I have the java classes so you might ask "why don't you build them?", believe me, I tried. But android studio makes a mess out of the project and refuses to build it. Many thanks in advance for any input.

UPDATE:

Looks like overwriting that value was enough, the drone keeps the 150 somewhere as well, as soon as I connect with the drone the max altitude changes to 150 again so I guess I will have to patch the drone to.