This tutorial gives you a general overview of the data structure inside the proprietary m10 files used by newer HTC Sense devices (Sense 3.0 and up).
The goal is not to cover specific mods for these m10 files but to explain how such mods are generally achieved. You are going to learn about the structure of m10 files and which parts are the most relevant for most modifications.
Within this article, Idlescreen_Base.apk and Rosie.apk from Sense 4.1 are used as a reference.
The list of things you can do with m10 data is pretty endless, however, most mofications are based on a simple set of actions:
- Resize images and text
- Reposition images and text
- Remove images and text
- Add new data (mostly properties)
Step 1: Start your project
- Click the “File” tab in the top left corner of VTS.
- Click “M10-Project” from the “Create new project” window. Enter your project name in the field.
Now you should see 4 subjects on the left side of the window. “Project“, “M10-Engine“, “Import“, “Build“.
Note: you can use the “Apk-Project” as well if you intend to modify other things like smali or images in /res/.
- Click “M10-Engine“. Then choose your version of the apk you are using from the dropdown menu (i.e. Sense 4.1).
- Click “Import“. Where it says file you can type the location of your apk or click the button with the 3 dots on it and navigate through your folders to your apk and then select “Import“.
- Let it decompile and your apk will be ready for modification, as a side note, you can rename your solution or project name as desired.
Step 2: Finding and understanding the code
- Your decompiled apk in the “Solution Explorer” under the project name you gave it. Expand it to see the files.
- Your m10 code is always in the assets folder, keep in mind there is usually land (for landscape orientation) and port (for portrait orientation), so you may need to modify both, but your edits may be different.
- The general breakdown of specific data in an “x10” file is like any other xml, meaning the beginning line is the parent of the proceeding child lines.
- Using /assets/port/lockscreen_time.x10 as an example, here is the general layout of m10 data (items safe to modify are in bold):
- Name – this cannot be modified
- Visible – the editable value is true or false, false would render this property invisible in the OS (i.e. no lockscreen time).
- ID – this value cannot be modified.
- Position – this value will change the screen position of the property based on the three values “left/right:up/down:ignore” these values are affected by (and accomplish the same goal in repositioning) as the “offset” property below these values help you to understand how they work in relation to the “size” property.
- CenterScale – this is the scale of the property and usually default is “1:1:1” (where 1=100% of the first value in “size”). These values are as follows: “width scale:height scale:ignore”. be careful which property you edit here, if you edit the main parent, you may have undesired results in the OS. for example if you edit this scale which affects the size, and you are in the first parent, it will change the size of the field.
- Offset – essentially the same as “position”. It is advised to only modify one of the two when repositioning so it’s easier to track and correct your edits.
- Size – technically you can edit this, but in most cases it is not advised.
- Hidden – this should not be modified (use the “visible” edit to achieve a hidden object).
- The above info should translate into almost any m10 data in almost any apk.
Step 3: Modifying the code, adding code, and doing math – basic tips
- When you change the “CenterScale” property to either shrink or enlarge it, it will change it’s position as well, so always do this first.
- Sometimes modifying something achieves the desired result visually but not functionally:
For instance, you can move the lockring in lockscreen_ring.x10 and it will move the ring position on your locksceen, but the ring’s functional position is still bottom center.
In a case like this you need to modify the “parent container” which for the ring is lockscreen_container.x10/”scenecontainer.Lockscreen_RingC”.
- You will sometimes find a property which seems logical to modify, like in lockscreen_shortcut.x10, under “timeline.shortcutpanel1(-4)” – you’ll see Position 90:774:0.
They do not move if you change them there, it only moves them if you modify “drag.shortcuticon01“.
This logic may apply to other code as well, so be sure to search for similar logical properties if your first attempts do nothing.
- In the above example, when moving shortcuts, and knowing what we know now, you can use math to equate your desired result, saving yourself lots of ADB pushes.
For example if the “Size” of the shortcut field or container is 720:1280, and your 4th icon is at 500:1000, it means the icon position starts at exactly the 500th pixel from the left, out of 720, and 1000th from the top, out of 1280.
The icon size (as shown in m10) is 96×96, so, if it starts at 500 and it’s 96 wide, then it ends at 596. I want the icon at a 10 pixel margin from the right of the screen, so I want it to end at 710, meaning I just subtract 96 from that, my first number should like this > 614:1000.
- If you have a container you want to add something to that’s missing, but seen in other similar containers, it may be possible, so try it. For instance in rosie.apk/assets/port/rosie_navbar.x10 the center all apps icon does not have a Scale property, but let’s say we want it smaller.
You can add a line to it where it matches the rest of that property, only it will say “CenterScale” and the editable value will be complete integers (stock no resize would be 1:1:1).
So simply change it, if you want it to be slightly smaller you could do “0.85:0.85:1” – keep in mind m10 will not recognize “.85:.85:1“, it needs the 0 first.
- For the visual removal of almost anything, which is controlled by m10, it’s as simple as a one word edit. Almost every m10 container in a x10 file will have the “Visible” property set to “true“. Simply change it to “false“.
This applies to text (like lockscreen shortcut names or time/date/carrier, the “all apps” label, widget labels, etc.)
This applies to images (like the lockring, clock tiles, widget backgrounds, etc.)
This even applies to some visual effects like the lockring bounce, lockring zoom, dock icons movement when pressed, etc.)
- Opacity can be edited in many containers as well. Simply modify the value of the Opacity property.
As an example you can change the lock widget panel background png to be 50%. This is much easier to do in code than in images, since you only have to type in a complete value like 0.5, versus opening the png in an editor and modifying it there.
The other huge benefit to this would be if you wanted that same png to be at 50% in music, but 75% on an alarm, 25% on a calendar event, etc. You cannot do this by modifying the single png in fusion, but you can with m10 code.
This logic applies to any m10 container with an Opacity property.
Step 4: Test your modified apk
Remember that your output apk will be named as is it was imported (i.e. “cool_Idlescreen_Base.apk” will come out that way again).
- Save all modified files
- Right click on the apk project name in the solution explorer
- Click “Build Project“
- Right click the apk project name again
- Click “Push to device“
- Reboot (clear cache if necessary) to apply your changes