APK Mod Help

Search This thread

liamstears

Senior Member
Nov 8, 2007
2,287
1,739
Kent
Hope a dev or someone can help me with modding an APK

I'm attempting to mod the APK that displays the heating control elements

I've managed to do most of what I wanted and changed the layout etc to suit my vehicle but at the moment I don't get a "HI" or "LO" message when I am suppose to and instead just get numbers, I hope someone can take a look at the code and help change it to show these?

I know the code is already there for HI and LO settings I think they are just set at the wrong temp for my vehicle, I need "LO" to display at/instead of 15.5C and "HI" at/instead of 28.5C

I have decompiled already and established this is done in smali\com\tw\service\f.1.smali

By standard the APK is set out to display separate temps for each side of the vehicle, left/passenger and right/driver but I have only 1 temp in my vehicle, looking into the files it's defined as android:id="@id/air_lt" which in turn gives us "0x7f09003e" so I only need the correct temp/HI/LO settings for this

Can someone take a look for me? I have attached the APK and the specific smali file (in a zip) in the hopes someone can help...
 

Attachments

  • f.1.smali.zip
    11.5 KB · Views: 9
  • com.tw.service_a5a4.apk
    870.9 KB · Views: 12
Last edited:

surfer63

Senior Member
May 4, 2010
6,473
3,836
Zwolle
github.com
I decompiled the VehicleSettings.apk but there is no smali\com\tw\service folder, let alone smali\com\tw\service\f.1.smali
After decompilation I can't find a f.1.smali either in another location.
Did you load the framework-res.apk for your firmware in apktool?
On a Joying I don't have that specific one for your firmware.
 

liamstears

Senior Member
Nov 8, 2007
2,287
1,739
Kent
I decompiled the VehicleSettings.apk but there is no smali\com\tw\service folder, let alone smali\com\tw\service\f.1.smali
After decompilation I can't find a f.1.smali either in another location.
Did you load the framework-res.apk for your firmware in apktool?
On a Joying I don't have that specific one for your firmware.

Thanks for such a quick reply and apologies for taking so long to reply to you

Like a complete idiot I uploaded the wrong apk! So sorry!

I have corrected the op with the correct APK, also here is the framework as I believe it may be needed to decompile: https://www.androidfilehost.com/?fid=4349826312261790804

Thank you for looking at this for me, I hope that if you can do it I can then look at your work and hopefully learn more about smali coding :D
 

surfer63

Senior Member
May 4, 2010
6,473
3,836
Zwolle
github.com
I decompiled it using apktool 2.4.1. I do find a f.smali and an F.smali. Not an f.1.smali
f.smali is the same (unmodified) as your f.1.smali

Inside air.xml (and 2 others), I do find an air_lt and an air_rt (left and right I assume) for air_rt the id is "0x7f090047".
Maybe you were chasing the wrong id for your single-zone airco (instead of dual-zone aircos).

When I use jadx-gui on the apk, I find several loops inside com.tw.service.f (deobfuscation might give other file names) where the LO/HI values are checked. I do get the idea that it is not related to the temperature as such, but more to the min/max values of the stepper values of the airco knob/slider that are forwarded from the CANbus (by CANbus id from the several brands). Like that some steppers have full degree steps and others have half degree steps or even more precise. But I could be wrong.
I also find methods (functions) for R.id.air_lt and R.id.air_rt

At this moment I can't say more. It's not FYT (Joying) but MTC. Did you check in the MTCD forums? Or download one of the HAL9K or Malaysk roms to check if they made modifications to the apk?
 
Last edited:

liamstears

Senior Member
Nov 8, 2007
2,287
1,739
Kent
Thanks for taking a look, it's not MTC unfortunately the APK is from an Ownice K6 which is an SC9853i based unit with android 8.1 and unfortunately there is not a lot of development that has been done for this unit/rom

Overall it's an amazing unit but was really hoping to sort this minor niggle out

Not 100% sure whats going on in the code and I'm sure you know a lot more than I do but all I could see is that there were "HI" and "LO" text values in the smali that indicated these were text values printed to the device so assumed this was what I was looking at and this could be fixed, I'm not great with this though so if you can't do no more I will just say thanks for taking the time and effort to try and will most likely have to give up with this one. Cheers
 

liamstears

Senior Member
Nov 8, 2007
2,287
1,739
Kent
Had a look at this jadx-gui as I've never used it before it comes back with some interesting results

Code:
    private void bX(int i, int i2) {
        TextView textView = (TextView) this.cw.findViewById(i);
        if (a.av == 2) {
            if (a.ay == 67) {
                if (i2 == 0) {
                    textView.setText("LO");
                } else if (i2 == 63) {
                    textView.setText("HI");
                } else if (i2 >= 12 && i2 <= 40) {
                    float f = (((float) (i2 - 12)) * 0.5f) + 15.5f;
                    if (this.cv != 1) {
                        textView.setText(String.format(Locale.US, "%.1f", Float.valueOf(f)) + this.cq.getString(2131034128));
                        return;
                    }
                    textView.setText(String.format(Locale.US, "%.1f", Float.valueOf(((f * 9.0f) / 5.0f) + 32.0f)) + this.cq.getString(2131034129));
                }
            } else if (a.ay == 147) {
                if (i2 == 0) {
                    textView.setText("LO");
                } else if (i2 == 30) {
                    textView.setText("HI");
                } else if (i2 >= 1 && i2 <= 29) {
                    float f2 = (((float) (i2 - 1)) * 0.5f) + 16.0f;
                    if (this.cv != 1) {
                        textView.setText(String.format(Locale.US, "%.1f", Float.valueOf(f2)) + this.cq.getString(2131034128));
                        return;
                    }
                    textView.setText(String.format(Locale.US, "%.1f", Float.valueOf(((f2 * 9.0f) / 5.0f) + 32.0f)) + this.cq.getString(2131034129));
                }
            } else if (a.ay == -1) {
            } else {
                if (i2 == 0) {
                    textView.setText("LO");
                } else if (i2 == 30) {
                    textView.setText("HI");
                } else if (i2 >= 1 && i2 <= 29) {
                    float f3 = (((float) (i2 - 1)) * 0.5f) + 14.0f;
                    if (this.cv != 1) {
                        textView.setText(String.format(Locale.US, "%.1f", Float.valueOf(f3)) + this.cq.getString(2131034128));
                        return;
                    }
                    textView.setText(String.format(Locale.US, "%.1f", Float.valueOf(((f3 * 9.0f) / 5.0f) + 32.0f)) + this.cq.getString(2131034129));
                }
            }
        } else if (a.ay == 17 || a.ay == 22) {
            if (i2 == 0) {
                textView.setText("LO");
            } else if (i2 == 31) {
                textView.setText("HI");
            } else if (i2 >= 1 && i2 <= 28) {
                float f4 = (((float) (i2 - 1)) * 0.5f) + 16.0f;
                if (this.cv != 1) {
                    textView.setText(String.format(Locale.US, "%.1f", Float.valueOf(f4)) + this.cq.getString(2131034128));
                    return;
                }
                textView.setText(String.format(Locale.US, "%.1f", Float.valueOf(((f4 * 9.0f) / 5.0f) + 32.0f)) + this.cq.getString(2131034129));
            }
        } else if (a.ay == 33 || a.ay == 34 || a.ay == 38) {
            if (i2 == 0) {
                textView.setText("LO");
            } else if (i2 == 255) {
                textView.setText("HI");
            } else {
                float f5 = ((float) i2) * 0.5f;
                if (this.cv != 1) {
                    textView.setText(String.format(Locale.US, "%.1f", Float.valueOf(f5)) + this.cq.getString(2131034128));
                    return;
                }
                textView.setText(String.format(Locale.US, "%.1f", Float.valueOf(((f5 * 9.0f) / 5.0f) + 32.0f)) + this.cq.getString(2131034129));
            }
        } else if (a.ay == 65) {
            if (i2 == 0) {
                textView.setText("LO");
            } else if (i2 == 127) {
                textView.setText("HI");
            } else if (i2 >= 31 && i2 <= 59) {
                float f6 = (((float) (i2 - 31)) * 0.5f) + 15.5f;
                if (this.cv != 1) {
                    textView.setText(String.format(Locale.US, "%.1f", Float.valueOf(f6)) + this.cq.getString(2131034128));
                    return;
                }
                textView.setText(String.format(Locale.US, "%.1f", Float.valueOf(((f6 * 9.0f) / 5.0f) + 32.0f)) + this.cq.getString(2131034129));
            }
        } else if (a.ay == 128 || a.ay == 134 || a.ay == 137) {
            if (i2 == 0) {
                textView.setText("LO");
            } else if (i2 == 30) {
                textView.setText("HI");
            } else if (i2 == 29) {
                if (this.cv != 1) {
                    textView.setText(String.format(Locale.US, "%.1f", Float.valueOf(16.0f)) + this.cq.getString(2131034128));
                    return;
                }
                textView.setText(String.format(Locale.US, "%.1f", Float.valueOf(60.8f)) + this.cq.getString(2131034129));
            } else if (i2 >= 1 && i2 <= 28) {
                float f7 = (((float) (i2 - 1)) * 0.5f) + 17.0f;
                if (this.cv != 1) {
                    textView.setText(String.format(Locale.US, "%.1f", Float.valueOf(f7)) + this.cq.getString(2131034128));
                    return;
                }
                textView.setText(String.format(Locale.US, "%.1f", Float.valueOf(((f7 * 9.0f) / 5.0f) + 32.0f)) + this.cq.getString(2131034129));
            }
        } else if (a.ay == -1) {
        } else {
            if (i2 == 0) {
                textView.setText("LO");
            } else if (i2 == 31) {
                textView.setText("HI");
            } else if (i2 >= 1 && i2 <= 29) {
                float f8 = (((float) (i2 - 1)) * 0.5f) + 18.0f;
                if (this.cv != 1) {
                    textView.setText(String.format(Locale.US, "%.1f", Float.valueOf(f8)) + this.cq.getString(2131034128));
                    return;
                }
                textView.setText(String.format(Locale.US, "%.1f", Float.valueOf(((f8 * 9.0f) / 5.0f) + 32.0f)) + this.cq.getString(2131034129));
            } else if (i2 >= 32 && i2 <= 35) {
                float f9 = (((float) (i2 - 32)) * 0.5f) + 16.0f;
                if (this.cv != 1) {
                    textView.setText(String.format(Locale.US, "%.1f", Float.valueOf(f9)) + this.cq.getString(2131034128));
                    return;
                }
                textView.setText(String.format(Locale.US, "%.1f", Float.valueOf(((f9 * 9.0f) / 5.0f) + 32.0f)) + this.cq.getString(2131034129));
            }
        }
    }

    private void bY(int i, int i2) {
        TextView textView = (TextView) this.cw.findViewById(i);
        if (i2 == 0) {
            textView.setText("LO");
        } else if (i2 == 47) {
            textView.setText("HI");
        } else if (i2 >= 1 && i2 <= 46) {
            float f = (((float) (i2 - 1)) * 0.5f) + 14.0f;
            if (this.cv != 1) {
                textView.setText(String.format(Locale.US, "%.1f", Float.valueOf(f)) + this.cq.getString(2131034128));
                return;
            }
            textView.setText(String.format(Locale.US, "%.1f", Float.valueOf(((f * 9.0f) / 5.0f) + 32.0f)) + this.cq.getString(2131034129));
        }
    }

Looks to me that "private void bX" is setting the text for HI and LO, for example you can see

Code:
                if (i2 == 0) {
                    textView.setText("LO");
                } else if (i2 == 63) {
                    textView.setText("HI");

So it seems to me these strings are setting the HI and LO value but no idea what would need to be changed to get this set to the values I need, I mean in this example is uses the values 0 and 63 to set HI and LO but what do those values mean? Could they be actual temperature values or more likely some sort of code....
 

surfer63

Senior Member
May 4, 2010
6,473
3,836
Zwolle
github.com
Yes, that is what I meant with the loop.
But also bY, bU and bT do set these values.
note that bX and BY require 2 INT values. for left and right?
bU only requires 1 float value, which is converted to INT, and that one is indeed written to the air_lt (or HI/LO). So my guess is that that is the method/function you need.

And there is also a string "LEFT_RIGHT_SEAT". Is that for single-zone aircos displaying only one value?
Note also that jadx-gui in the newer versions shows the file with 2 tabs at the bottom: a code tab and a smali tab.

I am not a smali programmer. I am just guessing about a lot of things and (previously) did quite some things just by trial & error. (In the land of the blind, the one-eyed man is king)
 
  • Like
Reactions: marchnz

liamstears

Senior Member
Nov 8, 2007
2,287
1,739
Kent
Yes, that is what I meant with the loop.
But also bY, bU and bT do set these values.
note that bX and BY require 2 INT values. for left and right?
bU only requires 1 float value, which is converted to INT, and that one is indeed written to the air_lt (or HI/LO). So my guess is that that is the method/function you need.

And there is also a string "LEFT_RIGHT_SEAT". Is that for single-zone aircos displaying only one value?
Note also that jadx-gui in the newer versions shows the file with 2 tabs at the bottom: a code tab and a smali tab.

I am not a smali programmer. I am just guessing about a lot of things and (previously) did quite some things just by trial & error. (In the land of the blind, the one-eyed man is king)

I think you could be right that it could be bU that is setting the HI and LO for me and that is what needs to be changed, have no idea what the values mean though, it looks as though maybe it uses a scale between 0 and 255 but how that would convert to degrees C I have no idea lol

Hopefully someone else can chime in and help...
 

surfer63

Senior Member
May 4, 2010
6,473
3,836
Zwolle
github.com
I think you could be right that it could be bU that is setting the HI and LO for me and that is what needs to be changed, have no idea what the values mean though, it looks as though maybe it uses a scale between 0 and 255 but how that would convert to degrees C I have no idea lol
Again: I think that 0 to 255 (or 1 to 126) is binary stepper for perhaps 15-29 C, or LO/18-26/HI C (in my Skoda). So it might not be a temperature, but a rounded calculation for range-values for the several airco units/CANbus outputs/inputs.
Also: Do you simply have a knob going from low (cold) to high (hot), so from blue to red? Or do you have a full-automatic temperature-set "climatronic" (Volkswagen name) with an electrical thermostat circuit really stepping from 15-29 C, instead of simply going from cold to hot?
In the first "simple" option there might not be a LO/HI value for your vehicle, which would mean you need to program yourself an if-then-else loop
 

liamstears

Senior Member
Nov 8, 2007
2,287
1,739
Kent
Again: I think that 0 to 255 (or 1 to 126) is binary stepper for perhaps 15-29 C, or LO/18-26/HI C (in my Skoda). So it might not be a temperature, but a rounded calculation for range-values for the several airco units/CANbus outputs/inputs.
Also: Do you simply have a knob going from low (cold) to high (hot), so from blue to red? Or do you have a full-automatic temperature-set "climatronic" (Volkswagen name) with an electrical thermostat circuit really stepping from 15-29 C, instead of simply going from cold to hot?
In the first "simple" option there might not be a LO/HI value for your vehicle, which would mean you need to program yourself an if-then-else loop

I do have a full temperature set climate control, on my heater panel itself it shows "HI" then temperature in 0.5C increments from 16 to 28C then displays "HI"

I might pop a post up in the thread for my unit and find out if others have HI and LO working and if so what temperatures the units they have set HI and LO and if they have dual climate or single like me
 

Top Liked Posts

  • There are no posts matching your filters.
  • 1
    Yes, that is what I meant with the loop.
    But also bY, bU and bT do set these values.
    note that bX and BY require 2 INT values. for left and right?
    bU only requires 1 float value, which is converted to INT, and that one is indeed written to the air_lt (or HI/LO). So my guess is that that is the method/function you need.

    And there is also a string "LEFT_RIGHT_SEAT". Is that for single-zone aircos displaying only one value?
    Note also that jadx-gui in the newer versions shows the file with 2 tabs at the bottom: a code tab and a smali tab.

    I am not a smali programmer. I am just guessing about a lot of things and (previously) did quite some things just by trial & error. (In the land of the blind, the one-eyed man is king)