[Project] HuamiWatchfaces based custom watchfaces [Pace/Stratos] (APK not WFZ) v0.1 - Amazfit

Custom Watchfaces for the Amazfit Pace/Stratos
Spun off from this thread New watchface for the Amazfit watch
So I wanted to fix the custom watchfaces that were looking really cool and don't work with the WFZ system so here is how to do it.
Disclaimers:
I am not an Android or Java developer, so expect some rookie mistakes (I usually do C#)
If you do this it is at your own risk!
I do not provide the original Huami APK/odex files. You will have to source them your self.
I also do not have a Pace, only a Stratos so this is not tested on the Pace.
Credit where credit is due
I did not come up with any of this, I just fixed it to work with the latest HuamiWatchFaces code.
Most of the credit goes to Manual Alvarez (manvel7650) whose code is here.
And the original thread at XDA Developers here
The other watchfaces come from Fabio Barbon(DrBourbon) whose code is here
Known Issues
Fixed for now!!!
Prerequisites
Currently you will need to be able to build this code and have the original Huami code to build against.
Android Studio
Android SDK version 21 (Android Studio should prompt you)
ADB (should come with Android Studio)
The HuamiWatchFaces.odex or HuamiWatchFaces2.odex from you watch (read below)
An older HuamiWatchFaces.odex (read below)
oat2dex (here)
dex2jar (here
This repo
Getting the HuamiWatchFaces files
To get the odex files needed for your watch, connect it via USB.
Then use a terminal/console to:
For Pace
adb pull /system/app/HuamiWatchFaces/mips/HuamiWatchFaces.odex
To streamline the instructions further rename the downloaded file to HuamiWatchFaces2.odex
For Statos
adb pull /system/app/HuamiWatchFaces/mips/HuamiWatchFaces2.odex
Then you will need an older one, i suggest downloading the APK from here. The link is below the image.
Converting the files to jars
You will need to convert the odex and dex files in to JAR files so the code can build against it.
java -jar oat2dex.jar -a 22 odex HuamiWatchFaces2.odex
d2j-dex2jar.sh HuamiWatchFaces2.dex
You should see some GLITCH: zero-width instruction messages
One of them is HardwareList, this is a problem and we will fix it.
Make sure the result is named HuamiWatchFaces2.jar (rename if not)
Now get the older HuamiWatchFaces file. Open the APK with something like 7Zip and extract the classes.dex and then:
d2j-dex2jar.sh classes.dex
Now you should have 2 jar files, the HuamiWatchFaces2.jar and probably classes-dex2jar.jar.
Open both of them with something like 7Zip again don’t extract them, just open and go to com\ingenic\iwds in both.
In your target jar (HuamiWatchFaces2) delete the HardwareList.class, and in your donor (classes-dex2jar) extract the HardwareList.class.
NEW In your target jar (HuamiWatchFaces2) also delete com\huami\watch\watchface\slpt\Lock\LowPowerClock.class
Now place the HardwareList.class in your target jar so it looks the same as before but now with the HardwareList.class from your donor.
Great! You should now have a working HuamiWatchFaces2.jar.
Building the repo
If you haven’t already, clone the repo to your PC.
Now take your HuamiWatchFaces2.jar and place it in app\src\main\java\es\malvarez\mywatchfaces\libs.
Open the project with Android Studio and build the project with gradle (click the hammer icon in the top left bar).
This should complete with no errors.
You should now have the APK in app\build\outputs\apk.
Installing the APK
adb install app/build/outputs/apk/debug/app-debug.apk
Or you can take the release one.
After installing you should have these watchfaces
{
"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"
}

Reserved.

I don't mean to sound like a noob, but is there an easier method to doing this?
I have 0 knowledge of android studio and coding in general and I'm struggling with this a little bit. I got to converting the odex to dex file and gave up haha.
I really like your watchface though and I appreciate the effort

@x3malex
I completely understand and it is in the plans. The biggest issue is that I can only make it for Windows easily at the moment and it is a bit dependent on 7zip.
It would be a powershell script in the first version.
The reason it's not high on the priority list right now is the lockscreen issue. I want to fix that first.
Currently it is a bit one step forward, two steps backwards as it is a bit of a hassle to debug because the watch won't lock when connect via usb to logcat.
When that is fixed I will start working on a more automated solution.

So, I fixed the lockscreen issue finally (at least I think I did this time). It seems to work nicely now.
The bad news is I had to add a (slightly) modified file from the original assemblies, I don't like that and hopefully fix that soon. This also means you need to remove that from the JAR file, the same as with HardwareList.
The next step is automate most of the procedure, but the first version will be Windows only. Sorry about that.
Edit: My github readme.md is being difficult. The enters after most of the important text are not showing. Strange thing is that it works in my local text editors (including Android Studio) and dillinger.io... So if anyone knows how to fix that, please.

LOTG said:
So, I fixed the lockscreen issue finally (at least I think I did this time). It seems to work nicely now.
The bad news is I had to add a (slightly) modified file from the original assemblies, I don't like that and hopefully fix that soon. This also means you need to remove that from the JAR file, the same as with HardwareList.
The next step is automate most of the procedure, but the first version will be Windows only. Sorry about that.
Click to expand...
Click to collapse
Just to let you know, I've had no DMCA requests (or any complaints at all) for uploading reversed and repackaged JAR files for the launcher to create homescreen pages, so I doubt they'd do it for watchfaces either
You can also remove unused classes from the JAR file, which makes any watchfaces created with it smaller

And if you use powershell, it means you use dotnet.
Did you know that with dotnet core 2 you can write sw that runs on Windows,Linux and mac?
If you need help with that, just contact me

@Quinny899
I'l think about it, and I'll look into unneeded files. Any easy way to check? Android Studio was pretty sure that LowPowerClock was not needed, but it disagreed with that while trying to run it. The dependency chain is not great.
I think the best solution overall would be to ditch the whole Huami system and build a new watch face system on top of the low-level stuff. This also leaves the door open for a new XML based watch face system. However, that is quite time-consuming (and who has time nowadays) and to do that I would rather use a language and environment I'm more familiar with.
@fzelle
Yes, I've build some software in .net core 2.0, but the problem is you will need to install the runtime for it. Not a big issue for Windows (I think it get's pushed through Windows Update), but Mac/Linux users might not be as enthusiastic. So I'm thinking about trying to create a bash variant. I'll need to look into a test setup for that though.

@Quinny899
I'l think about it, and I'll look into unneeded files. Any easy way to check? Android Studio was pretty sure that LowPowerClock was not needed, but it disagreed with that while trying to run it. The dependency chain is not great.
I think the best solution overall would be to ditch the whole Huami system and build a new watch face system on top of the low-level stuff. This also leaves the door open for a new XML based watch face system. However, that is quite time-consuming (and who has time nowadays) and to do that I would rather use a language and environment I'm more familiar with.
@fzelle
Yes, I've build some software in .net core 2.0, but the problem is you will need to install the runtime for it. Not a big issue for Windows (I think it get's pushed through Windows Update), but Mac/Linux users might not be as enthusiastic. So I'm thinking about trying to create a bash variant. I'll need to look into a test setup for that though.

LOTG said:
@Quinny899
I'l think about it, and I'll look into unneeded files. Any easy way to check? Android Studio was pretty sure that LowPowerClock was not needed, but it disagreed with that while trying to run it. The dependency chain is not great.
I think the best solution overall would be to ditch the whole Huami system and build a new watch face system on top of the low-level stuff. This also leaves the door open for a new XML based watch face system. However, that is quite time-consuming (and who has time nowadays) and to do that I would rather use a language and environment I'm more familiar with.
@fzelle
Yes, I've build some software in .net core 2.0, but the problem is you will need to install the runtime for it. Not a big issue for Windows (I think it get's pushed through Windows Update), but Mac/Linux users might not be as enthusiastic. So I'm thinking about trying to create a bash variant. I'll need to look into a test setup for that though.
Click to expand...
Click to collapse
I checked manually but there aren't a huge amount of classes required for the pages. Use jd-gui to view the jar and note down which classes are used, delete those that aren't

@LOTG
I don't think that it's that hard to install on linux or mac, did the same for a modified AmazfitExporter ( the phone db, not the pace db ).
https://github.com/FZelle/Amazfit_CoreExporter

Could not find below step
unable to find the lowpowerclock.class in the step "NEW In your target jar (HuamiWatchFaces2) also delete com\huami\watch\watchface\slpt\Lock\LowPowerClock. class "
but i tried with the jar and the code base given. I am getting below error
Information:Gradle tasks [:app:assembleDebug]
Warning:The specified Android SDK Build Tools version (25.0.2) is ignored, as it is below the minimum supported version (26.0.2) for Android Gradle Plugin 3.0.1.
Android SDK Build Tools 26.0.2 will be used.
To suppress this warning, remove "buildToolsVersion '25.0.2'" from your build.gradle file, as each version of the Android Gradle Plugin now has a default version of the build tools.
C:\Users\DELL\Desktop\Build APK 15 march\amazfit-watchfaces-Development\app\src\main\java\com\ravenliquid\watchfaces\Utility.java
Error3, 39) error: package com.ingenic.iwds.slpt.view.core does not exist
Error4, 39) error: package com.ingenic.iwds.slpt.view.core does not exist
Error5, 39) error: package com.ingenic.iwds.slpt.view.core does not exist
Error6, 39) error: package com.ingenic.iwds.slpt.view.core does not exist
Error16, 52) error: cannot find symbol class SlptLayout
C:\Users\DELL\Desktop\Build APK 15 march\amazfit-watchfaces-Development\app\src\main\java\es\malvarez\mywatchfaces\widget\HasSlptViewComponent.java
C:\Users\DELL\Desktop\Build APK 15 march\amazfit-watchfaces-Development\app\src\main\java\es\malvarez\mywatchfaces\AbstractWatchFace.java
C:\Users\DELL\Desktop\Build APK 15 march\amazfit-watchfaces-Development\app\src\main\java\es\malvarez\mywatchfaces\AbstractWatchFaceSlpt.java
C:\Users\DELL\Desktop\Build APK 15 march\amazfit-watchfaces-Development\app\src\main\java\es\malvarez\mywatchfaces\data\MultipleWatchDataListenerAdapter.java
C:\Users\DELL\Desktop\Build APK 15 march\amazfit-watchfaces-Development\app\src\main\java\es\malvarez\mywatchfaces\MalvarezWatchFace.java
Error3, 33) error: package com.huami.watch.watchface does not exist
Error24, 31) error: cannot find symbol class AbstractSlptClock
C:\Users\DELL\Desktop\Build APK 15 march\amazfit-watchfaces-Development\app\src\main\java\es\malvarez\mywatchfaces\MalvarezWatchFaceSplt.java
Error3, 39) error: package com.ingenic.iwds.slpt.view.core does not exist
C:\Users\DELL\Desktop\Build APK 15 march\amazfit-watchfaces-Development\app\src\main\java\es\malvarez\mywatchfaces\widget\CirclesWidget.java
Error11, 38) error: package com.huami.watch.watchface.util does not exist
Error12, 38) error: package com.ingenic.iwds.slpt.view.arc does not exist
Error13, 38) error: package com.ingenic.iwds.slpt.view.arc does not exist
Error14, 38) error: package com.ingenic.iwds.slpt.view.arc does not exist
Error15, 39) error: package com.ingenic.iwds.slpt.view.core does not exist
Error16, 39) error: package com.ingenic.iwds.slpt.view.core does not exist
Error17, 40) error: package com.ingenic.iwds.slpt.view.sport does not exist
Error18, 40) error: package com.ingenic.iwds.slpt.view.sport does not exist
Error19, 40) error: package com.ingenic.iwds.slpt.view.sport does not exist
Error20, 40) error: package com.ingenic.iwds.slpt.view.utils does not exist
Error253, 17) error: cannot find symbol class SlptViewComponent
C:\Users\DELL\Desktop\Build APK 15 march\amazfit-watchfaces-Development\app\src\main\java\es\malvarez\mywatchfaces\widget\HeartRateWidget.java
Error9, 39) error: package com.ingenic.iwds.slpt.view.core does not exist
Error10, 39) error: package com.ingenic.iwds.slpt.view.core does not exist
Error11, 40) error: package com.ingenic.iwds.slpt.view.sport does not exist
Error67, 17) error: cannot find symbol class SlptViewComponent
C:\Users\DELL\Desktop\Build APK 15 march\amazfit-watchfaces-Development\app\src\main\java\es\malvarez\mywatchfaces\widget\MalvarezClock.java
Error9, 38) error: package com.huami.watch.watchface.util does not exist
Error10, 39) error: package com.ingenic.iwds.slpt.view.core does not exist
Error11, 39) error: package com.ingenic.iwds.slpt.view.core does not exist
Error12, 39) error: package com.ingenic.iwds.slpt.view.core does not exist
Error13, 39) error: package com.ingenic.iwds.slpt.view.core does not exist
Error14, 39) error: package com.ingenic.iwds.slpt.view.core does not exist
Error15, 39) error: package com.ingenic.iwds.slpt.view.core does not exist
Error16, 42) error: package com.ingenic.iwds.slpt.view.digital does not exist
Error17, 42) error: package com.ingenic.iwds.slpt.view.digital does not exist
Error18, 42) error: package com.ingenic.iwds.slpt.view.digital does not exist
Error19, 42) error: package com.ingenic.iwds.slpt.view.digital does not exist
Error20, 42) error: package com.ingenic.iwds.slpt.view.digital does not exist
Error21, 42) error: package com.ingenic.iwds.slpt.view.digital does not exist
Error22, 42) error: package com.ingenic.iwds.slpt.view.digital does not exist
Error23, 42) error: package com.ingenic.iwds.slpt.view.digital does not exist
Error24, 42) error: package com.ingenic.iwds.slpt.view.digital does not exist
Error25, 40) error: package com.ingenic.iwds.slpt.view.sport does not exist
Error26, 40) error: package com.ingenic.iwds.slpt.view.utils does not exist
Error109, 17) error: cannot find symbol class SlptViewComponent
........ deleted last few error lines .........

@suryateja8
Could you provide me with some info about the files you are using? ( Pace/Stratos, firmware version).

@LOTG to use both libraries is only for stratos? Or pace need too?

LOTG said:
@suryateja8
Could you provide me with some info about the files you are using? ( Pace/Stratos, firmware version).
Click to expand...
Click to collapse
@LOTG, Till the step of getting the Jar file i was able to do exactly as mentioned by you. But the step you mentioned to remove the com\huami\watch\watchface\slpt\Lock\LowPowerClock. class, i did not find the path.
So I ignored that and continued to build the APK file. Then i got the attached error.
I am using Pace with ROM Version 1.3.6d

@suryateja8 It seems like the later Pace versions are different from the one I have (I don't have a Pace watch, only a Stratos). I'll try to get the files and see what needs to change for the Pace.

You need the file huamiwatchfaces.odex for latest versions of pacefield versions. But stockfield remains in old file.

LOTG said:
@suryateja8 It seems like the later Pace versions are different from the one I have (I don't have a Pace watch, only a Stratos). I'll try to get the files and see what needs to change for the Pace.
Click to expand...
Click to collapse
I was able to manage the build and compiled the apk successfully( need to fix some errors in the code though).
I have also updated the Time Text watch face to display like how we read time.

suryateja8 said:
I was able to manage the build and compiled the apk successfully( need to fix some errors in the code though).
I have also updated the Time Text watch face to display like how we read time.
Click to expand...
Click to collapse
If you need me to include something just let me know.
I've had a shortage of free time this last week, and I found out that the CN files do not play nice with the US FW for Stratos.
I hope to get all that fixed this week.

suryateja8 said:
I was able to manage the build and compiled the apk successfully( need to fix some errors in the code though).
I have also updated the Time Text watch face to display like how we read time.
Click to expand...
Click to collapse
I've compiled my version of the APK a few days ago but there is a bug in the FuzzyText watchface. It displays the fuzzy text only when the watch is unlocked ("Four o'clock"), then reverts back to a Numbers Text ("Zero Four Zero Zero") when the watch is locked.
Did you fix this issue?

Related

[Q] [Noob] Having troubles importing a project

So I found this project online that lets me use the gyroscope of a phone. It has all the required files but when I import it into my workspace I get these three errors....
1) The project was not built since its build path is incomplete. Cannot find the class file for java.lang.Object. Fix the build path then try building this project
(java problem)
2) The type java.lang.Object cannot be resolved. It is indirectly referenced from required .class file
(java problem)
3) Unable to resolve target 'android-5' AccessGyroscope Unknown Android (Target Problem)
Thanks in advanced
EDIT: Actually I think i just fix the problem

[Q] Android Proguard ERROR: Unknown verificatification type[10]

I am trying to build an apk file for release. My application lib contains a jar (probably obfuscated) from a third party vendor of one of my company's hard-wares. When I build the apk in debug mode it is successful, but when I try to do it in release mode using "ant release" it throws the following error.
Code:
BUILD FAILED
C:\adt-bundle-windows-x86_64\sdk\tools\ant\build.xml:868: Can't read [D:\Workspace\MyProject\libs\ThirdPartyJarV3.1.jar] (Can't process class [g.class] (Unknown verification type [10] in stack map frame))
I have successfully built apks in release mode for other projects (which doesn't have this jar file.)
It seems to be an issue around proguard not being able to read this class in the jar. I have looked through ProGuard's trouble shooting manual and also on google and found no help with this particular error:
Code:
(Unknown verification type [10] in stack map frame)
I also updated proguard from V4.7 to 4.10, but it still encounters the same error.
To my little mind it seems to be a problem with the jar itself and if so how do I fix it? Any help would be appreciated. TIA!
[P.S: I'm new to android]

[Q] Seeking compiled LatinIME dicttool for use with a V401 Binary Dictionary

I’m trying to convert a version 401 binary dictionary -- a directory called PersonalizationDictionary.en_US.dict -- to human readable .xml.
The command line utility dicttool_aosp in packages/inputmethods/LatinIME/tools/dicttool can do it like so:
Code:
dicttool_aosp makedict -s sourcedict.dict -x output.xml
I’m unable to compile the Android Lollipop version of dicttool, since dicttool has native C++ dependencies that don’t play nice with my Mac. Note this line in the NativeLib.mk file of dictool:
Code:
# HACK: Temporarily disable host tool build on Mac until the build system is ready for C++11.
I am hoping someone with a compatible setup can compile this utility for me using “make dicttool_aosp” from the root of the AOSP source tree. I've spent the past few days looking for compiled versions of it, and while I’ve found many makedict.jar files online, they are too old to support my newer V401 binary dictionary. The main difference between the V401 and older versions is that a V401 is split up into multiple files with extensions like .bigrams, .freq, .header, whereas the older dicts are contained in a single file.
Thank you, please let me know if I can clarify anything!

[APKMULTITOOL] Error when signing (sign apk with android market 13 & 7 zip, sign, in)

[APKMULTITOOL] Error when signing (sign apk with android market 13 & 7 zip, sign, in)
Hello folks, I have stumbled upon a small problem using APKMultiTool ...
When I try to sign my apk (It's a unity apk meaning I only edited 1 of the dll files.) It fails.
The error it gives me, even in log (26) is useless.
Code:
--------------------------------------------------------------------------
|26-07-2018 -- 13:55:05,73|
--------------------------------------------------------------------------
java version "10.0.2" 2018-07-17
Java(TM) SE Runtime Environment 18.3 (build 10.0.2+13)
Java HotSpot(TM) 64-Bit Server VM 18.3 (build 10.0.2+13, mixed mode)
Press any key to continue . . .
I do have the environment path for system, directed to my JDK java path.
The APKMultiTool is opened with Administrator and it's at root(c:\APKMultiTool) <
Heres the code it gives me at the end of option 7: (zip, sign & install)
Code:
Compressing res\layout\com_facebook_placepickerfragment_list_row.xml
Compressing res\layout\com_facebook_search_bar_layout.xml
Compressing res\layout\com_facebook_tooltip_bubble.xml
Compressing res\layout\com_facebook_usersettingsfragment.xml
Everything is Ok
Signing Apk
Usage: signapk [-w] publickey.x509[.pem] privatekey.pk8 input.jar output.jar
"An Error Occurred, Please Check The Log (option 26)"
The error afterwards in the log file and when using 26, is still the same.
Now I'm going to just try to sign the unsigned apk. First the one that was just zipped.
I do this with option 13: Sign apk with android market
Code:
Please make your decision:13
*Notice this option requires you to have the Java JDK installed before this option will function*
*Notice you need to go into your Environment Variables and set the path to your JAVA_HOME*
*For example define it as C:\Program Files\Java\jdk1.6.0_43 as a system variables slot not the User Variables*
Press any key to continue . . .
Signing Apk
Only one alias can be specified
Please type jarsigner -help for usage
"An Error Occurred, Please Check The Log (option 26)"
I am unable to type jarsigner -help, in CMD it does not exist as a command, and in APKMT it closes the prompt. The log file and 26 gives me the same error text so far, meaning it was not even updated.
(Note: I open ALL prompts as Administator, also APKMT)
I am at a complete loss...
Would be really grateful for input :3 thanks a lot.
-EDIT-
Am unable to install unsigned apk on rooted bluestacks 3n device. :3
... I found out that if I used the new tool
https://forum.xda-developers.com/an...tool-apk-easy-tool-v1-02-windows-gui-t3333960
APK Easy Tool, everything became more organized and much easier to work with. I got it working and are happy to say that my first mod was succesful, yay.
Happy modding everyone
For reference, the apk I modded was Galactic Rush for Android

What should I do if the tool package fails to run when I integrate the HUAWEI AppGallery Connect SDK to Eclipse?

Background​I had recently planned on integrating the Crash SDK to my app. However, my app was developed through Eclipse and the integration process was different from that in Android Studio.
By referring to the official materials, I downloaded the tool package and used it to generate an Eclipse project package.
However, when the build.bat file in the aar2eclipse/aar directory was executed according to the procedures in the document, an error was reported in the command line. The error information was as follows:
FAILURE: Build failed with an exception.
* What went wrong:
Task ' assembleRelease ' not found in root project ' aar '.
Problem Reoccurring​1. I first thought that the problem might be caused by my company's intranet. But when I connected to the Internet, the problem remained unsolved.
2. Then I guessed that it might have something to do with the Android development environment.
I borrowed a colleague's PC to execute the build.bat file, and it that did the trick. Therefore, I was able to conclude that the problem was caused by incorrect configurations in the Android development environment. I compared the configurations on the two PCs and found that the environment variables were different. ANDROID_HOME was missing from the environment variables on my PC.
Cause​Huawei's Eclipse tool package is unable to run properly and reports an error without the ANDROID_HOME variable.
Solution: Right-click This PC and choose Properties from the shortcut menu. In the displayed dialog box, click the Advanced System Settings tab and then click Environment Variables. In the System Variables dialog box, create a new ANDROID_HOME parameter.
Set the value to the installation path of the local Android SDK, and the problem will be resolved, as shown below.
Reference:
https://developer.huawei.com/consumer/en/doc/development/AppGallery-connect-Guides/agc-get-started#h2-1587519820720

Categories

Resources