Autobrightness fix for all MIUI ROMs - Redmi Note 2 Android Development

Firstly I credit Urix2003 on 4pda forum for the explanation of what is wrong and how to fix it.
The problem may not be universal to all MIUI releases but the majority suffer from the same issue. I have personally proven the fix to work on 7550, 8030 and 61110.
The error is in services.jar whereby the light sensor values for autobrightness control are inadvertently reduced to just three values: 0 lux, 120 lux, 2000 lux hence, the lack of Auto Brightness Adjustment.
DEFINITELY NOT FOR NOOBS............ This thread is to provide the knowledge to skilled people to help themselves and maybe to then help others by providing their fixed files to others:fingers-crossed:
I ask that anyone providing edited files clearly states the exact version of MIUI (both date code and variant - SU, MR, EU, Stock, Global, China etc) and also provide the table values as code in their post.
To fix: Decompile Services.jar with something like TickleMyAndroid:good:
Edit services\com\android\server\display\AutomaticBrightnessController$1.smali to fix the restriction of light sensor values as follows:
find text:
Code:
iget-object v1, p1, Landroid/hardware/SensorEvent;->values:[F
const/4 v4, 0x0
aget v0, v1, v4
Add this line below the text:
Code:
goto :goto_0
Note: Label: goto_0 should lead a few lines down to: const-string v1, "AutomaticBrightnessController"
To fix the slow response time:
Edit services\com\android\server\display\AutomaticBrightnessController.smali to halve the response time to changes in brightness
find text 0xfa0, replaced by 0xfa0 (example reduces 4sec to 4sec)
iget v5, p0, Lcom/android/server/display/AutomaticBrightnessController;->mBrighteningLuxThreshold:F
cmpg-float v4, v4, v5
if-gtz v4, :cond_1
:cond_0
const-wide/16 v4, 0xfa0
find text 0x1f40, replaced by 0xfa0 (example reduces 8sec to 4sec)
iget v5, p0, Lcom/android/server/display/AutomaticBrightnessController;->mDarkeningLuxThreshold:F
cmpl-float v4, v4, v5
if-ltz v4, :cond_1
:cond_0
const-wide/16 v4, 0xfao
You can also play around with these settings with caution:
You can also mess around with these settings with caution:
# static fields
.field private static final BRIGHTENING_LIGHT_DEBOUNCE:J = 0xfa0L
.field private static final BRIGHTENING_LIGHT_HYSTERESIS:F = 0.1f
.field private static final DARKENING_LIGHT_DEBOUNCE:J = 0x1f40L (reduce to 0xfa0L 8sec --> 4sec)
.field private static final DARKENING_LIGHT_HYSTERESIS:F = 0.2f (reduce to 0.12f)
.field private static final LIGHT_SENSOR_RATE_MILLIS:I = 0xc8 (increase to 3f8 200ms --> 1sec)
To fix the brightness response to ambient light changes:
Decompile framework-res.apk then edit framework-res\res\values\arrays.xml
Edit the table to values below for a good starting point:
Code:
<integer-array name="config_autoBrightnessLevels">
<item>1</item>
<item>11</item>
<item>31</item>
<item>81</item>
<item>121</item>
<item>226</item>
<item>321</item>
<item>551</item>
<item>801</item>
<item>1251</item>
<item>2001</item>
<item>3001</item>
<item>5001</item>
<item>7501</item>
<item>13000</item>
</integer-array>
<integer-array name="config_autoBrightnessLcdBacklightValues">
<item>25</item>
<item>28</item>
<item>34</item>
<item>40</item>
<item>42</item>
<item>43</item>
<item>44</item>
<item>46</item>
<item>48</item>
<item>51</item>
<item>55</item>
<item>60</item>
<item>69</item>
<item>88</item>
<item>137</item>
<item>255</item>
</integer-array>
<integer name="config_screenBrightnessSettingMinimum">15</integer>
<integer name="config_screenBrightnessSettingDefault">50</integer>
Valid autoBrightnessLevels are: (add 1 for the transition to above the value)
0, 5, 10, 30, 80, 120, 225, 320, 550, 800, 1250, 2000, 3000, 5000, 5500, 7500, 13000, 24000
autoBrightnessLevels can be probed here (in hex): /sys/bus/platform/drivers/als_ps/als but it is much better to use an app that displays value in lux
LcdBacklightValues can be probed here: /sys/class/leds/lcd-backlight/brightness
WARNING: The 2 altered files are absolutely unique to every release version of MIUI so a single fix package cannot be offered.
Also, there are 3 different LCD panels used in the RN2 (but only 1 ALSPS sensor - the LTR559) which may have different brightness characteristics so values that work for 1 display, may not be ideal for another.
Thank me by all means but don't ask for help on how to decompile / recompile

O.K now you have replaced services.jar with a fixed version and maybe also a framework-res.apk with a modified brightness table.
What if you want some more adjustments?
1. Hassle the kind person who uploaded the files until they get really annoyed
or
2. Help yourself..... :good:
Here's how:
1. Create a zip file called framework-res.zip
2. Copy the attached file, theme_values.xml
3. Edit the file with your new values
4. Copy the file into framework-res.zip
5. Remove the .zip extension leaving the filename as just framework-res
6. Copy this file to /system/media/theme/default
7. Reboot
8. Re-edit theme_values.xml as many times as it takes until you have the perfect values for your phone:victory:
Attached a useful spreadsheet for planning out your values and revised values in theme_values.xml to be closer to ideal

Fix specifically for EU MIUI 8.1.30 attached. It is not a flashable zip and it contains instructions......
I have done a second version that has modified hysteresis and sampling timings as per the first post amendments to give a much more fluid feel.....

Updated with more info

jajk said:
Updated with more info
Click to expand...
Click to collapse
Hello friend it would be possible to do for the global MIUI 8.1 stable version 8.1.2.0 LHMMIDI I'm waiting for you now thanks :good:

@jackjt3 Can you post your services.jar file and I will post a dedicated 8120 version. Is this an EU or MR ROM or stock Xiaomi release?

jajk said:
@jackjt3 Can you post your services.jar file and I will post a dedicated 8120 version. Is this an EU or MR ROM or stock Xiaomi release?
Click to expand...
Click to collapse
Hello friend .... I just installed the ROM MIUI 8.1.3.0 LHMCNDI I will make the adjustments and I will run what you did ... anyway thank you very much:good:

Thank you. It works! Finally I can use Automatic brightness !

@vetriolo Yeah, it it a novelty to walk into bright sunlight and not panic trying to wind up the brightness by guesswork to see who is calling
The big question is why would Xiaomi never fix such an obvious error in more than just our phone and keep releasing version after version without ever fixing errors?

Hello @jajk, can you make this for MIUI EU?

@rafix96 If you tell me what version it is

Sorry, 6.12.15.
Wysłane z mojego Redmi Note 2 przy użyciu Tapatalka

@rafix96 See attached file. Only for EU version of 61215.
Enjoy

Thanks @jajk but framework-res file have too small size compare to original file, it's ok?
Edit:
Thanks, it's working ! Great work!

Before anybody asks, attached for EU 61222

jajk said:
Before anybody asks, attached for EU 61222
Click to expand...
Click to collapse
YEY Too Speed man :good:

O.P updated with better recommended values that are not as bright in darker conditions.
Modify the values yourself as per the instructions if you are wanting a different outcome - I don't have 3 phones with the different LCD panels to test
Fixes may not have latest values included.
EU 8020 autobrightness fix:
https://drive.google.com/open?id=0BwdRTuyj12_yNmFLZjk3NWlKY3c
EU61229 autobrightness fix:
https://drive.google.com/open?id=0BwdRTuyj12_yQ3B0MWdVLUVLdXM

is a solution akin to this one http://en.miui.com/thread-293853-1-1.html possible? I've tried out it out on my Redmi Note 4 and it seems to be working (autobrightness values working properly). Thanks in advance

@asusm930 That is only half of the fix and is included in the zip already. If the author actually tried the solution, they would find it doesn't work (on RN2 or RN3 at least). The net is full of "experts" that grab onto a small snippet of info, claim it as their own and try to increase hits to their complete loser blogs.
For autobrightness to function correctly, the services.jar file also has to be edited to make things work as they were meant to since it was beyond Xiaomi. That is the other half of the fix I provide and why it is specific for each ROM version.
Are you sure you have 16 steps of brightness control from pitch black to direct sunlight on RN4? All other Xiaomi phones only get 3 levels with the broken code in services.jar.

jajk said:
@asusm930 That is only half of the fix and is included in the zip already. If the author actually tried the solution, they would find it doesn't work (on RN2 or RN3 at least). The net is full of "experts" that grab onto a small snippet of info, claim it as their own and try to increase hits to their complete loser blogs.
For autobrightness to function correctly, the services.jar file also has to be edited to make things work as they were meant to since it was beyond Xiaomi. That is the other half of the fix I provide and why it is specific for each ROM version.
Are you sure you have 16 steps of brightness control from pitch black to direct sunlight on RN4? All other Xiaomi phones only get 3 levels with the broken code in services.jar.
Click to expand...
Click to collapse
For me the problem was auto brightness wouldn't work or workes erratically and this fixed it. What you say does make sense, though
Also happy to report that your modded camera works on my 6.12.22 rom

Related

[FIX] StartingAlertService Wakelock (TouchWizCalendar.apk)

Hi
This is the solution to fix the StartingAlertService Wakelock
To reproduce the problem (or the fix) modify calendar settings to notify events in status bar, create a an event and add a reminder inmediatly, so a notificantion is triggered and you can see it in status bar, open BetterBatteryStats and you can check in partial wakelocks if you have the StartingAlertService Wakelock. You will see that the wakelock is always working, you only need to refresh data and the wakelock time is increased, the wakelock is not released until you close to notification.
The problem is in TouchWizCalendar.apk not releasing the wakelock properly in class ServiceHandler inside class AlertService
The actual code is:
Code:
private final class ServiceHandler extends Handler {
public ServiceHandler(Looper looper) {
super(looper);
}
@Override
public void handleMessage(Message msg) {
processMessage(msg);
AlertService.this.stopSelf();
}
}
If you check the new android sources you can see the next code:
Code:
private final class ServiceHandler extends Handler {
public ServiceHandler(Looper looper) {
super(looper);
}
@Override
public void handleMessage(Message msg) {
processMessage(msg);
// NOTE: We MUST not call stopSelf() directly, since we need to
// make sure the wake lock acquired by AlertReceiver is released.
AlertReceiver.finishStartingService(AlertService.this, msg.arg1);
}
}
So the next change will fix the problem. You have to decompile TouchWizCalendar.apk locate com/android/calendar/AlertService$ServiceHandler.smali and search & replace next code.
Search (the last method):
Code:
# virtual methods
.method public handleMessage(Landroid/os/Message;)V
.registers 3
.parameter "msg"
.prologue
.line 594
iget-object v0, p0, Lcom/android/calendar/AlertService$ServiceHandler;->this$0:Lcom/android/calendar/AlertService;
invoke-virtual {v0, p1}, Lcom/android/calendar/AlertService;->processMessage(Landroid/os/Message;)V
.line 598
iget-object v0, p0, Lcom/android/calendar/AlertService$ServiceHandler;->this$0:Lcom/android/calendar/AlertService;
invoke-virtual {v0}, Lcom/android/calendar/AlertService;->stopSelf()V
.line 601
return-void
.end method
Replace by:
Code:
# virtual methods
.method public handleMessage(Landroid/os/Message;)V
.registers 4
.parameter "msg"
.prologue
iget-object v0, p0, Lcom/android/calendar/AlertService$ServiceHandler;->this$0:Lcom/android/calendar/AlertService;
invoke-virtual {v0, p1}, Lcom/android/calendar/AlertService;->processMessage(Landroid/os/Message;)V
iget-object v0, p0, Lcom/android/calendar/AlertService$ServiceHandler;->this$0:Lcom/android/calendar/AlertService;
iget v1, p1, Landroid/os/Message;->arg1:I
invoke-static {v0, v1}, Lcom/android/calendar/AlertReceiver;->finishStartingService(Landroid/app/Service;I)V
return-void
.end method
Now recompile TouchWizCalendar.apk and replace it.
I've attached a cwm zip file to create a backup (TouchWizCalendar.apk.bak), replace the apk, and clear battery stats to reset wakelocks counters (reset battery stats doesn't affect to SGS2 battery, the battery chip doesn't need that info). The apk is based on kk5 rom.
If you don't want to use the cwm file you can extract TouchWizCalendar.apk from the zip and use root explorer (or similar) to replace the file, don't forget to make a backup of your original apk.
Edit:
If you get:
Code:
# virtual methods
.method public handleMessage(Landroid/os/Message;)V
.locals 1
.parameter "msg"
...
...
...
when decompile then replace with
Code:
# virtual methods
.method public handleMessage(Landroid/os/Message;)V
.locals 2
.parameter "msg"
...
...
...
Edit2:
If you use odexed rom delete or rename the odex file (maybe com.android.calendar.odex or TouchWizCalendar.odex, I'm not sure) to be sure classes.dex is used from deodexed apk
Edit3:
I've updated the zip to be sure odex file is not used in odexed roms
hi
it will work on xwkk5 stock rom odexed?
Hi,
this works fine on CheckRom v4, StartingAlertService now 0,3%.
with friendly greet
starbase64
pissyhun said:
hi
it will work on xwkk5 stock rom odexed?
Click to expand...
Click to collapse
I think so, but I'm not sure. To be sure that you can revert the changes make a backup (or rename) of the apk(TouchWizCalendar.apk.bak) and the odex calendar files, then delete the odex (I think the odex will be com.android.calendar.odex) and install the zip.
You can always to reodex (http://forum.xda-developers.com/showthread.php?t=1208320)
hi
thx for the answer but i am not a developer or an expert in android commands. i read the post u link but gave me headache)))
i will save the file and use it with a deodexed rom.
pissyhun said:
hi
thx for the answer but i am not a developer or an expert in android commands. i read the post u link but gave me headache)))
i will save the file and use it with a deodexed rom.
Click to expand...
Click to collapse
Wise decision
Great. Will implement this in my Note ROM
Love your fix
Yesterday I've installed your fix, and my wake locks for startingalertservice are gone. For your information I'm running a rooted version of the standard i9100XWKK2. Thanks again for your work, my battery time increased quit a bit.
hugoxboss said:
Yesterday I've installed your fix, and my wake locks for startingalertservice are gone. For your information I'm running a rooted version of the standard i9100XWKK2. Thanks again for your work, my battery time increased quit a bit.
Click to expand...
Click to collapse
Glad to hear it
just to make sure, if my wakelocks are in seconds in betterbatterystats, i'm good right?
ATN24 said:
just to make sure, if my wakelocks are in seconds in betterbatterystats, i'm good right?
Click to expand...
Click to collapse
that's right
Thanks for the instructions!
However, my calendar apk file has a bit of a difference in the code.
For example, it starts with:
# virtual methods
.method public handleMessage(Landroid/os/MessageV
.locals 1
.parameter "msg"
Can I use the same instructions?
Excellent job,thanks very much for by apk
Does anyone know if this APK will work for UCKK6?
Thanks a bunch rodries, this is awesome. Instead of ".registers 3", my AlertService$ServiceHandler.smali had ".locals 1". So, I went ahead and changed that to ".registers 4" as well.
Just revised KK5 TouchWizCalendar.apk, working well.
itaykoren said:
Thanks for the instructions!
However, my calendar apk file has a bit of a difference in the code.
For example, it starts with:
# virtual methods
.method public handleMessage(Landroid/os/MessageV
.locals 1
.parameter "msg"
Can I use the same instructions?
Click to expand...
Click to collapse
I think it's safe use same instructions. I'm using last smali and kk5 apk.
Hello rodies,
i am sorry but i can`t get it to work with my GingerMod v0.7 Rom.
http://forum.xda-developers.com/showthread.php?t=1220283
Neither the cwm-file nor the copy direct option works.
I have the Wakelock also. I am not a programmer. So things like compile decompile are chinese to me.
Is it somehowe possible that you can contact the Developer of GingerMod that he can apply this patch for his Rom.
Many thanks in advanced.
Would this issue be fixed if I just deleted the apk entirely?
crossover37 said:
Would this issue be fixed if I just deleted the apk entirely?
Click to expand...
Click to collapse
Lol, did you think this through... are you serious? You do realize it's required to use your calendar, not to mention it might cause your phone to crash continuously given all the other items that call on the calendar.
TheMatrix2000 said:
Hello rodies,
i am sorry but i can`t get it to work with my GingerMod v0.7 Rom.
http://forum.xda-developers.com/showthread.php?t=1220283
Neither the cwm-file nor the copy direct option works.
I have the Wakelock also. I am not a programmer. So things like compile decompile are chinese to me.
Is it somehowe possible that you can contact the Developer of GingerMod that he can apply this patch for his Rom.
Many thanks in advanced.
Click to expand...
Click to collapse
Upload your original TouchWizCalendar.apk, I'll create a cwm file for you

[GUIDE] [15-11-12] [Sense 3.*/4.0 | Ultimate Rom Porting Guide | Desire Z]

Index
Edify or Updater-Script tutorial in 1st Post
Device specific fixes for vision in first post
Build.prop tweaks in 1st Post
MIUI Porting Guide In 1st Post
Sense 4.0/3.5 prting Guide in 2nd Post
Icecoldsandwich port | LewaOS Port | AOKP Port in 3rd Post
Hi,
First of all this thread is a compilation of all possible resources I am able to find from all possible sources.
Big credits to proxuser for his general MIUI rom porting guide, thanks to cjward for helping me out fix the Autorotation issue, Autobrightness Levels and for adding additional symbols to the "sym" key and big thanks to dekky to help me fix the "libandroid.runtime.so" error.
I've tried to cover all the basic aspects of ROM porting and modding including using smali/backsmali and modding apks with the help of apktool. I hope it will help those who are wiling to learn.
I request all the devs around there to take a look and suggest what else I can add there to make it more friendly.
Ok so there it is:
Here is the Updater-Script tutorial : Credits to Edify scripting from E. Pete Karelis and Free your android for original guides from where I learnt this.
Code:
[B]Function Name: mount[/B]
Function Syntax: mount(fs_type, partition_type, location, mount_point)
Parameter Details:
fs_type = "yaffs2" | "ext4"
partition_type="MTD" | "EMMC"
location = partition | device
mount_point = target folder to mount FS.
Action: Mounts a filesystem to the defined mount point
Returns: The mount point if successful, null if failed
[B]Function Name: is_mounted[/B]
Function Syntax: is_mounted(mount_point)
Parameter Details: mount_point = string, mount point to check if is mounted
Action: Checks if a filesystem is mounted.
Returns: The mount point if mounted, otherwise, returns null
[B]Function Name: unmount[/B]
Function Syntax: unmount(mount_point)
Parameter Details: mount_point = string, mount point to unmount
Action: Unmounts the filesystem
Returns: The mount point that was dismounted if successful, otherwise it returns null
[B]Function Name: format[/B]
Function Syntax: format(fs_type, partition_type, location)
Parameter Details:
fs_type = string,"yaffs2" | "ext4"
partition_type= string, "MTD" | "EMMC"
location = string, partition | device
Action: Formats a filesystem as specified
[B]Function Name: delete[/B]
Function Syntax: delete(file1, file2, ..., fileN)
Parameter Details: string, file to delete
Action: Deletes a file. Must specify at least one file; multiple files can be specified as multiple arguments
[B]Function Name: delete_recursive[/B]
Function Syntax: delete_recursive(dir1, dir2,...,dirN)
Parameter Details: string, directory to recursively delete
Action: Deletes a folder and all of its contents. At least 1 directory must be specified; multiple directories can be specified as additional arguments.
[B]Function Name: show_progress[/B]
Function Syntax: show_progress(frac, sec)
Parameter Details:
frac = fraction of progress completed
sec = total seconds
Action: Displays flashing progress in the recovery system
[B]Function Name: set_progress[/B]
Function Syntax: set_prograss(frac)
Parameter Details: frac=fraction of progress
[B]Function Name: package_extract_dir[/B]
Function Syntax: package_extract_dir(package_path, destination_path)
Parameter Details:
package_path = string, directory in package to extract
destination_path = string, target point to extract files to
Action: Extract the all of the files in a directory in the package to the target specified.
[B]Function Name: package_extract_file[/B]
Function Syntax:
package_extract_file(package_path)
or
package_extract_file(package_path, destination_path)
Parameter Details:
package_path = string, file in the package you want to extract
destination_path, target folder to extract the file to.
Action: Extracts a single file from your update package to the target specified
[B]
Function Name: file_getprop[/B]
Function Syntax: file_getprop(file, key)
Parameter Details:
file = string, filename to check
key = string, key in file to return the value of
Action: Checks for a value in a file?
[B]Function Name: symlink[/B]
Function Syntax: symlink(target, src1, src2, ..., srcN)
Parameter Details:
target = string, the target of the symbolic link
srcX = the symbolic link to create that points to the target
Action: Unlinks any existing symbolic links before creating the new symbolic links.
[B]
Function Name: set_perm[/B]
Function Syntax: set_perm(uid, gid, mode, file1, file2, ..., fileN)
Parameter Details:
uid = user id
gid = group id
mode = permission mode
fileX = file to set permission on
Action: Sets permissions of a file or set of files specified. At least one file must be specified (the first four parameters are required)
[B]Function Name: set_perm_recursive[/B]
Function Syntax: set_perm_recursive(uid, gid, dirmode, filemode, dir1, dir2, ...dirN)
Parameter Details:
uid = user id
gid = group id
dirmode = permission to set to directories contained within the specified directory
filemode = permission to set to files contained within the specified directory
dirX = directory to set permission on
Action: Set permissions of a directory or set of directories and all files and folders within them. At least one directory must be specified (The first 5 parameters are required)
[B]Function Name: getprop[/B]
Function Syntax: getprop(key)
Parameter Details: key = string, the property you want the system to return
Action: This function returns the value of the property specified. This is used to query platform information from the build.props file.
[B]Function Name: write_raw_image[/B]
Function Syntax: write_raw_image(file, partition)
Parameter Details:
file - string, the source .img file to be read from
partition - string, the destination partition to write the .img file to
Description: This function writes an img file to a partition.
[B]Function Name: apply_patch[/B]
Function Syntax: apply_patch(srcfile, tgtfile, tgtsha1, tgtsize, sha1_1, patch_1, ..., sha1_x, patch1_x)
Parameter Details:
srcfile - string, source file to be patched (file to read in)
tgtfile - string, destination file to write the patched file to
tgtsha1 - string, sha1 hash of the target file as it should hash out after the patches apply properly
sha1_x - string, sha1 hash of the patch data that's to be written to the target file
patch1_x- string, actual patch to apply to the target file
Action: This function is used to apply patches to a file.
[B]Function Name: apply_patch_check[/B]
Function Syntax: apply_patch_check(file, sha1_1, ..., sha1_x)
Parameter Details:
file - string, file to check
sha1_x - hash to check for?
Action: Either checks if a file has been properly patched, or checks if a file can be patched. Need to check the source code of the "applypatch_check" function that is called from here.
[B]Function Name: apply_patch_space[/B]
Function Syntax: apply_patch_space(bytes)
Parameter Details: bytes = number of bytes to check for
Action: Checks the cache to verify that there is enough space to write the patched files to it and returns something. Need to test this function to verify.
[B]Function Name: read_file[/B]
Function Syntax: read_file(filename)
Parameter Details: filename - string, the filename to read the contents of
Action: This function returns the contents of a file.
[B]Function Name: sha1_check[/B]
Function Syntax:
sha1_check(data)
or
sha1_check(data, sha1_hex, ..., sha1_hexN)
Parameter Details:
data - the contents of file to calculate the sha1 hash of - must be in the read_file format
sha1_hexN - A particular sha1_hex string that you want the file data to match
Action: If only data is specified, then the function returns the sha1_hex string of the data. The optional parameters are used if you want to verify that the file you are checking for is one of a list of hashes. It reutrns the hash it matches, or returns nothing if it doesn't match any of the mentioned hashses.
[B]Function Name: ui_print[/B]
Function Syntax: ui_print(msg1, ..., msgN)
Example : ui_print("===============================================");
to print ===============================================
Parameter Details: msg - String, message to be outputted to the user during the patch process
Action: This function prints/echos a message to the console while the script is running. At least 1 parameter needs to be specified, you can specify additional msg parameters and they will be concatenated to the output.
Function Name: run_program
Function Syntax: run_program(prog, arg1, .., argN)
Parameter Details:
prog - string, program to execute
argN - string, arguments for the program that is being executed
Description: Executes a program with the arguments specified. Returns a string, I assume it is the buffer of the stdout of the program executed, need to test.
[B]Function Name: ifelse[/B]
Function Syntax: ifelse(condition, truecondition, falsecondition)
Parameter Details:
condition - an expression to evaluate
truecondition - Edify script block to execute if true
falsecodnition - Edify script block to execute if false
Description: This is the if-then construct of the Edify scripting language. The truecondition or falsecondition arguments can be a single edify command or a script block. Script blocks can be formed by enclosing the parameter with parenthesis, and seperating the commands with semicolons\
[B]Function Name: abort[/B]
Function Syntax: abort()
Parameter Details: no paremeters
Description: Aborts script execution.
[B]Function Name: assert[/B]
Function Syntax: assert(condition)
Parameter Details: condition - boolean
Description: If condition evaluates to false, stops script execution, otherwise continues processing.
Here is some device specific instructions :
mmcblk0p25 refers to system partition of the device
mmcblk0p26 refers to data partition of the device
mmcblk0p27 refers to cache partition of the device
Refer to following if you get error during flashing in recovery :
Error 6 : The updater-script is not in proper unix format (Happens when you edit file in windows)
More to come
Keyboard Fix:
Since Desire Z has a keyboard, we need to modify the android.policy.jar to tell it the lid open state.
Here's what you need to do (thanks cjward):
FIX KEYBOARD ROTATION AND AUTO ROTATE :
Go into android.policy.jar\smali\com\android\internal\poli cy\impl\PhoneWindowManager.smali
Code:
ORIGINAL
.line 1094
const/4 v1, 0x1
CHANGE TO
.line 1094
const/4 v1, 0x0
ORIGINAL
.line 1096
const/4 v1, 0x0
CHANGE TO
.line 1096
const/4 v1, 0x1
These line number need not be same, but what you need to notice is that these states will differ with a value of 2 and it should have a comment :
<------------ mLidOpen .....
To search this line, hit "ctrl + f" and type "const/4 v1, 0x1", probably in one or two hits, you will get to this.
If it doesn't gets fixed by this then you need to make one more modification:
(thanks NeverGone\RU for pointing this out)
Change the following line in framework-res/res/values/bools.xml:
<bool name="config_forceDisableHardwareKeyboard">true</bool>
Setting this value to false fixed the keyboard issue completely.
Trackpad Wake : (big thanks to lms24 for pointing this out):
Open libinput.so with a hex editor and search for these 4 numbers: A1 F5 88 72. Change the 88 to 89 and save it.
Decompile android.policy.jar. open keyguardviewmediator.smali and fo down to method "isWakeKeyWhenKeyguardShowing(IZ)Z"
You need to modify the 0x18 and 0x19 values to enable tp wake.
If you want volume rocker wake also then just delete the lines of 0x18 and 0x19.
I haven't been able to figure out exactly what you need to do to enable only tp wake and not the volume rocker, so for time being just swap the above listed method from a rom which has got working tp-wake, like Sabsa bliss by lms24 for sense 3.6 and Gen.Y R3 for Sense 4 roms.
The method should look like this:
Code:
.method public isWakeKeyWhenKeyguardShowing(IZ)Z
.locals 3
.parameter "keyCode"
.parameter "isDocked"
.prologue
const/4 v2, 0x0
iget-object v0, p0, Lcom/android/internal/policy/impl/KeyguardViewMediator;->mContext:Landroid/content/Context;
invoke-virtual {v0}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;
move-result-object v0
const-string v1, "tweaks_lockscreen_volumekey"
invoke-static {v0, v1, v2}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I
move-result v0
if-nez v0, :cond_0
.line 1242
sparse-switch p1, :sswitch_data_0
goto :goto_0
.line 1273
:cond_0
sparse-switch p1, :sswitch_data_1
:goto_0
const/4 v0, 0x1
move p2, v0
.line 1269
.end local p2
:goto_1
:sswitch_0
return p2
.line 1265
.restart local p2
:sswitch_1
sget-short v1, Lcom/htc/htcjavaflag/HtcBuildFlag;->Htc_DEVICE_flag:S
const/16 v2, 0x1c
if-eq v1, v2, :cond_1
sget-short v1, Lcom/htc/htcjavaflag/HtcBuildFlag;->Htc_DEVICE_flag:S
const/16 v2, 0x89
if-ne v1, v2, :cond_2
.line 1269
:cond_1
move p2, v0
.line 1263
goto :goto_1
.line 1265
:cond_2
const/4 p2, 0x0
goto :goto_1
.line 1238
nop
.line 1242
:sswitch_data_0
.sparse-switch
0x18 -> :sswitch_0
0x19 -> :sswitch_0
0x1b -> :sswitch_1
0x4f -> :sswitch_1
0x55 -> :sswitch_1
0x56 -> :sswitch_1
0x57 -> :sswitch_1
0x58 -> :sswitch_1
0x59 -> :sswitch_1
0x5a -> :sswitch_1
0x5b -> :sswitch_1
0x7e -> :sswitch_1
0x7f -> :sswitch_1
0x82 -> :sswitch_1
0xa4 -> :sswitch_0
0xe4 -> :sswitch_1
.end sparse-switch
.end method
Build.prop Common Tweaks : Credits blindnumb
Code:
# Fast Reboot
persist.sys.purgeable_assets=1
# Increasing The Video Recording Quality
ro.media.enc.hprof.vid.bps=8000000
# Screen Rotate To 270 degree
windowsmgr.support_rotation_270=true;
# Increase VM Heap Size(resolve some fc's)
dalvik.vm.heapsize=64m
# Render UI With GPU
debug.sf.hw=1
# Increasing It Will Make Mobile Smoother
windowsmgr.max_events_per_sec=150
# Video Acceleration Enabled
video.accelerate.hw=1
# Increase Performance
debug.performance.tuning=1
# Disable Sending Usage Data
ro.config.nocheckin=1
# Deeper Sleep/Better battery life
ro.ril.disable.power.collapse=1
pm.sleep_mode=1
# Ringing Will Start Immediately
ro.telephony.call_ring.delay=0
# Disable Error Checking
ro.kernel.android.checkjni=0
# Increase Quality Of MediaStreaming
media.stagefright.enable-meta=true
media.stagefright.enable-scan=true
media.stagefright.enable-http=true
media.stagefright.enable-record=false
# Disable BootAnimation
debug.sf.nobootanimation=1
#Force To Remain Launcher In Memory
ro.HOME_APP_ADJ=1
# Disable Waking Up Of Phone By Volume Buttons
ro.config.hwfeature_wakeupkey=0
# Off The Proximity Quiclky After Call
mot.proximity.delay=25
# Signal Tweaks
ro.ril.hsxpa=2
ro.ril.gprsclass=10
ro.ril.hep=1
ro.ril.enable.dtm=1
ro.ril.hsdpa.category=10
ro.ril.enable.a53=1
ro.ril.enable.3g.prefix=1
ro.ril.htcmaskw1.bitmask=4294967295
ro.ril.htcmaskw1=14449
ro.ril.hsupa.category=5
# NetSpeed Tweaks
net.tcp.buffersize.default=4096,87380,256960,4096, 16384,256960
net.tcp.buffersize.wifi=4096,87380,256960,4096,163 84,256960
net.tcp.buffersize.umts=4096,87380,256960,4096,163 84,256960
net.tcp.buffersize.gprs=4096,87380,256960,4096,163 84,256960
net.tcp.buffersize.edge=4096,87380,256960,4096,163 84,256960
# Google DNS Tweak
net.rmnet0.dns1=8.8.8.8
net.rmnet0.dns2=8.8.4.4
net.dns1=8.8.8.8
net.dns2=8.8.4.4
# Photo And Video Quality
ro.media.dec.jpeg.memcap=8000000
ro.media.enc.hprof.vid.bps=8000000
ro.media.enc.jpeg.quality=100
# Touch Responsiveness
debug.performance.tuning=1
video.accelerate.hw=1
# Scrolling Responsiveness
windowsmgr.max_events_per_sec=500
# Power Save Tweaks
ro.ril.disable.power.collapse=1
pm.sleep_mode=1
# Disables Debug Icon On Status Bar
persist.adb.notify=0
For a more complete list, Visit his website, click here.
Its a huge collection of resources and tutorials so do visit it.
Step 1:
You need to choose you base and the rom you want to port. Prefer to choose a rom which shares the same brand or if possible shares the same chipset as HTC Vision. So, choose any MIUI v4 rom from "Desire HD" if possible and If you are not able to get one, Choose one from "Desire S" or "Nexus One" or "Desire".
I would recommend MIUI-Au, since I found their english translations are best but it is not getting updated regularly, so you are free to choose your base rom.
Here is the link to some MIUI ICS roms which you could port:
MIUI-Au for HTC Desire
Dekky's MIUI ICS for Desire HD
MIUI-us ICS for Desire HD
MIUI-us ICS for Nexus One
Choose any cm9 or ics AOSP or AOKP rom as your base for the port here are a few roms you could use as your base are :
Andromadus Audacity Beta 2
Virtuous Quattro RC3
Virtuous Quattro RC4 leak
So, you grabbed some or all of these roms, lets get to the next step.
Step 2 :
Replace complete folders (those noted below) of your base rom with the MIUI one :
system/app
system/framework
Step 3:
Go to /system/lib :
copy "libandroid_runtime.so" lib from miui 4 (rom you port). without this file rom will not boot. if you get bootloop, try with base "libandroid_runtime.so" file.
If it still doesn't boot, then look at the end of the post, you need to add some modifications to your framework.jar which i'll take at the end of the post.
copy "liblbesec.so" from miui 4 to /system/lib and open the updater-script of your base rom with "notepad++" on windows or with "gedit" on linux and add the following line to it :
set_perm(0, 0, 0755, "/system/lib/liblbesec.so");
(for superuser app from miui work)
copy "content-types.properties" file to /system/lib
Step 4:
replace /system/media folder with base rom (that themes, wallpaper, audio from miui work)
Step 5:
copy "telocation.db" and "yellowpage.db" to /system/etc folder.
Step 6:
copy "invoke-as" from miui4 rom to /system/xbin and give it permissions on updater-script
set_perm(0, 0, 06755, "/system/xbin/invoke-as");
(for backup & themes app work)
Step 7:
change values from build.prop (edit with notepad ++)
ro.build.id=MIUI
ro.build.display.id=MIUI
ro.build.version.incremental=2.x.x (version number)
ro.config.ringtone=MI.ogg
ro.config.notification_sound=FadeIn.ogg
ro.config.alarm_alert=GoodMorning.ogg
ro.config.sms_received_sound=FadeIn.ogg
ro.config.sms_delivered_sound=MessageComplete.ogg
Step 8 :
SInce Desire Z has a keyboard, we need to modify the android.policy.jar to tell it the lid open state.
Here's what you need to do (thanks cjward):
FIX KEYBOARD ROTATION AND AUTO ROTATE :
Go into android.policy.jar\smali\com\android\internal\poli cy\impl\PhoneWindowManager.smali
Code:
ORIGINAL
.line 1094
const/4 v1, 0x1
CHANGE TO
.line 1094
const/4 v1, 0x0
ORIGINAL
.line 1096
const/4 v1, 0x0
CHANGE TO
.line 1096
const/4 v1, 0x1
These line number need not be same, but what you need to notice is that these states will differ with a value of 2 and it should have a comment :
<------------ mLidOpen .....
To search this line, hit "ctrl + f" and type "const/4 v1, 0x1", probably in one or two hits, you will get to this.
If you have no idea what I'm talking about then read carefully.
You need to extract android.policy.jar from MIUI rom and decompile it using backsmali.
Go here and download "smali-1.3.2.jar" and "backsmali-1.3.2.jar".
Put them in the same folder you put your extracted android.policy.jar. Then open cmd.exe and browse to that folder and hit the command:
Code:
java -jar baksmali.jar -a 15 -x android.policy.jar -o classout
It'll give you a folder named "classout" once it has finished decompiling. Now open that folder and browse to the file mentioned above.
Edit the values and then return back to your command windows and hit the command:
Code:
java -Xmx512M -jar smali.jar -a 15 classout -o classes.dex
It'll give you a file named classes.dex.
Now open "android.policy.jar" with 7zip:
Right click on the file --> hit 7zip --> Open archive.
Then drag the classes.dex you created into the window which appeared.
It'll replace the old classes.dex in android.policy.jar
Now use this file for your port.
Step 9:
Now we need to add some modifications to "framework.jar" to add more symbols to the "sym" key and to get the rom boot in case it gets into bootloop with all the available "libandroid.runtime.so" from both MIUI roms and the base rom.
EXTRA SYMBOLS ON "SYM" KEY
Again as explained above, decompile framework.jar and browse to the file mentioned below:
framework.jar\smali\android\text\method\QwertyKeyListener.smali
Code:
ORIGINAL
const-string/jumbo v2, "\u2026\u00a5\u2022\u00ae\u00a9\u00b1[]{}\\|"
CHANGE TO
const-string/jumbo v2, "$\u00a5\u2022\u00ae\u00a9\u00b1[]{}<>`^\\|"
This will add some extra symbols on the "sym" key.
Now to get the rom boot in case it is not booting with available "libandroid.runtime.so".
Use the "libandroid.runtime.so" from the base rom and do the following modifications:
decompile you base rom "framework.jar" and MIUI "framework.jar" and do the following:
swap Power.smali, Paint.smali, MediaRecorder.smali, GLES20Canvas.smali, PowerManager*.smali... from base framework.jar to MIUI framework.jar
Then recompile it as mentioned above how to recompile jar files and use it in your port. (If it's still not booting then get a logcat to know the error)
Step 10 :
Now to fix the autobrightness values to the correct level, you need to do the following:
Obtain framework-res.apk from the MIUI rom and decompile it using apktool. If you don't know how to do that then read below or skip to next section.
Here is the link to different apktools:
apktool used by cjward : Click here
apktool used by lyapota : Click here
I use a different technique to get things done (thanks to galaxynexusforums):
Download the package of different apktools from here.
Extract these files and the apk you want to mod in the same folder.
Open cmd.exe and browse to that folder.
Install the latest android sdk and grab the latest "aapt.exe" from it. For me, the folder is : C:\Android\android-sdk\platform-tools
Now hit the follow command :
Code:
java -jar apktool_1_4_2.jar if framework-res.apk
(you need to rename apktool.jar.1.4.2 to apktool_1_4_2.jar and similarily apktool.jar.1.4.3 to apktool_1_4_3.jar)
Code:
java -jar apktool_1_4_2.jar d framework-res.apk
Now do the modding as stated below:
AUTO BRIGHTNES AND KEYBOARD LIGHTS FIX:
browse to the file "framework-res.apk\res\values\arrays.xml"
Code:
ORIGINAL
<integer-array name="config_autoBrightnessLevels">
<item>200</item>
<item>400</item>
<item>1000</item>
<item>3000</item>
CHANGE TO
<integer-array name="config_autoBrightnessLevels">
<item>11</item>
<item>41</item>
<item>91</item>
<item>161</item>
<item>226</item>
<item>321</item>
<item>641</item>
<item>1281</item>
<item>2601</item>
ORIGINAL
<integer-array name="config_autoBrightnessLcdBacklightValues">
<item>35</item>
<item>55</item>
<item>70</item>
<item>70</item>
<item>250</item>
CHANGE TO
<integer-array name="config_autoBrightnessLcdBacklightValues">
<item>89</item>
<item>89</item>
<item>126</item>
<item>164</item>
<item>164</item>
<item>164</item>
<item>187</item>
<item>210</item>
<item>233</item>
<item>255</item>
ORIGINAL
<integer-array name="config_autoBrightnessButtonBacklightValues">
<item>255</item>
<item>255</item>
CHANGE TO
<integer-array name="config_autoBrightnessButtonBacklightValues">
<item>30</item>
<item>30</item>
<item>30</item>
<item>30</item>
<item>0</item>
<item>0</item>
<item>0</item>
ORIGINAL
<integer-array name="config_autoBrightnessKeyboardBacklightValues ">
<item>0</item>
<item>0</item>
<item>0</item>
<item>0</item>
<item>0</item>
CHANGE TO
<integer-array name="config_autoBrightnessKeyboardBacklightValues ">
<item>255</item>
<item>255</item>
<item>255</item>
<item>255</item>
<item>0</item>
<item>0</item>
<item>0</item>
<item>0</item>
<item>0</item>
<item>0</item>
After changing these values, hit the following command in the command window:
Code:
java -jar apktool_1_4_3.jar b framework-res
It'll take a while to complete. If it gives you error, try with different versions of apktool.
Once you are done:
Go to "framework-res\dist" and right click on the framework-res.apk you find there.
Now ---> 7zip ---- > Open archive
Now copy the resource.arsc from there to your desktop.
Open you original framework-res.apk via 7zip in the same manner as stated above and replace the default resource.arsc file with the once from your desktop.
Use this modded framework-res.apk in your port.
Step 11:
Now you have completed you port. Now zip the file and sign it with the help of dsixda kitchen.
If you don't know how to do so, go there.
If you don't want to get you hands dirty with dsixda kitchen, then just open your base rom with "winrar" or "7zip" and swap the files and mods stated above.
Your ROM is now ready to be flashed.
Credits :
proxuser
cjward
dekkyy
galaxynexusforums
lyapota for his apktool
Sense 4.0 and 3.5 Porting Guide
Use this guide written by proxuser to Port Sense 4.0 roms :
http://forum.xda-developers.com/showpost.php?p=24021776&postcount=3
and this guide for porting Sense 3.5 roms :
http://forum.xda-developers.com/showpost.php?p=24021769&postcount=2
If you are porting a rom from Desire HD, all the files which need to be swapped can be found at:
http://elektro-instal.com/napior/3.5 port tools.zip
This will give you unity kernel.
Use IceZSense or IceSenseWich for device files.
The following device specific changes are needed:
Use android.policy.jar from IceZSense or IceSenseWich for now as a base for Sense 4.0. I'll add directions on how to mod it manually later.
Instead of choosing gps.saga.so use gps.vision.so
lights.saga.so --> lights.vision.so
sensors.saga.so ----> sensors.vision.so
Swap modules folder from IceZSense or IceSenseWich.
Follow the guide and instead of saga files, copy vision files from IceZSense or IceSenseWich.
I'll add any further device specific changes if needed later.
Till then If you get stuck, ask in the thread and I'll try to answer it.
Similar steps are needed for porting Sense 3.5 too.
I recommend following roms to port, since they look good to me but you are free to choose yours.
CoolDroid 3.0
Primo-S 3.4
Credits :
proxuser
cjward
blk_jack for keymap fix (Will soon add my own fix for sense roms as soon as my exams get over)
Icecoldsandwich port | LewaOS Port | AOKP Port
First of all use cyanogenmod 9 RC 0 as base because andromadus is cause bootloops.
IceColdSandwich Port:
Take CM9 as base..
Remove app , media and framework folder from base rom..
Copy above folders from IceColdSnadwich to base ROM
Now Tough Thing !!
Sit Patiently and see what lib modules(*****.so) files are missing from base rom..
Copy all missing libraries to base ROM from IceColdSnadwich.
You need to make similar changes to android.policy.jar as suggested above for MIUI rom to fix autorotation.
If you can't get it to work. Then first get the rom booting then post the android.policy.jar you are using in your port, I'll make the required changes for you.
Similar steps are needed for LewaOS and AOKP project.
You can use the following roms to port:
IceColdSandwich
BlindLewa
AOKP (BlindIce)
If the above process doesn't works for you, try the following :
Code:
extract icecold sandwich content with kitchen.
Now swap these files :
Overwrite /system/etc with that from cm9 one
now look for files which are not in cm9 and add them manually from Icecold sandwich.
Swap /system/bin from cm9 one
Swap /system/lib
swap boot.img
swap /system/usr
chnage the following lines in build.prop:
ro.product.model=
ro.product.brand=
ro.product.name=
ro.product.device=
ro.product.board=
ro.product.cpu.abi=
ro.product.cpu.abi2=
ro.product.manufacturer=
ro.product.locale.language=
wifi.interface=
debug.sf.hw=1 (ALWAYS =1)
windowsmgr.max_events_per_sec=
with vision one.
In init.d folder delete all files except sysctl and 00banner...
Credits :
Blindnumb for helping port BlindIce
vampire36 for helping port IcecoldSandwich
Is this to port audacity as well?
Sent from my HTC Vision using XDA
jspina said:
Is this to port audacity as well?
Sent from my HTC Vision using XDA
Click to expand...
Click to collapse
I've tested till audacity beta 1, don't know about beta 2. Test and see, if you get stuck in bootloop, try to get a logcat.
ajhavery said:
I've tested till audacity beta 1, don't know about beta 2. Test and see, if you get stuck in bootloop, try to get a logcat.
Click to expand...
Click to collapse
Ok. Thanks I tried it with proxusers guide which is basically this without getting into any jar files or anything like that. I will try tonight and let you know but I wouldn't post the Rom if it works because I think you are working on it.
Sent from my HTC Vision using XDA
studying ,thank you. ^_^
YESYESYESYESYESYESYESYESYESYESYESYESYESYESYESYESYESYESYESYESYESYESYESYESYESYESYESYESYESYESYESYESYESYESYESYESYESYESYESYESYESYESYESYESYESYESYESYESYESYESYESYESYESYESYESYESYESYESYESYESYESYESYESYESYESYESYESYESYESYESYESYESYESYES!!
<3 ajhavery
Wow. Thank you for the guide! This is more what I imagine XDA being like: a public forum for sharing knowledge, not keeping arcane secrets. Not pointing any fingers, of course. Our device has always had great and helpful devs.
This will not only help many aspiring devs to learn much about porting, but it also gives the users great perspective on the work involved in getting stuff working.
Awesome.
Sent from my HTC Vision using XDA
jspina said:
Ok. Thanks I tried it with proxusers guide which is basically this without getting into any jar files or anything like that. I will try tonight and let you know but I wouldn't post the Rom if it works because I think you are working on it.
Sent from my HTC Vision using XDA
Click to expand...
Click to collapse
I have written this guide to let someone take the development for the time being because I'm having my exams from monday till may 1st, after that I'm going on vacation for a week with my friends and after that I've to go for my summer internship. So, due to extremely busy schedule of mine, I would love to see any work from you.
I have got the rom booting with audacity beta 1, my last port is based on that, so I would recommend working on audacity beta 2 and If it is very hard then you can use files from my last release of MIUI-Au port, to get the rom booting.
It you get stuck, try to get a logcat so that I could help you.
Soon, when I find time, I'll try to add a sense rom porting guide for those who want to learn.
A suggestion : Look into development forums to learn more about porting.
Those who seriously want to learn should go through this link and read everything at least twice:
http://www.kandroid.org/online-pdk/guide/index.html
ajhavery said:
I have written this guide to let someone take the development for the time being because I'm having my exams from monday till may 1st, after that I'm going on vacation for a week with my friends and after that I've to go for my summer internship. So, due to extremely busy schedule of mine, I would love to see any work from you.
I have got the rom booting with audacity beta 1, my last port is based on that, so I would recommend working on audacity beta 2 and If it is very hard then you can use files from my last release of MIUI-Au port, to get the rom booting.
It you get stuck, try to get a logcat so that I could help you.
Click to expand...
Click to collapse
OK Thanks! I may look into it but I forgot I have to draw a card for my brothers 7th birthday tomorrow(It is a tradition in my family of 5 kids to draw birthday cards), so I wont be able to look into it until way late tonight or night time tomorrow.
I really appreciate that and would love any help as I am not that great with all of this. But I will try my best
Thanks for the great guide. I already started porting MIUIv4 with proxusers guide and figured out that I need to modify the jars to get it to work. Now this will save me a lot of time to fix some bugs that I still had. This guide comes perfectly timed for the weekend.
I would really appreciate a guide to port a sense rom as I'd like to learn more about this whole thing. Thanks again and good luck for your exam.
So long
Ciddy
i hope one of u guys gets a rom ported for us soon. i miss miui and my attempt at porting it failed
Once we get a more stable ICS base, me and a friend of mine will try porting MIUI. I'm not sure which MIUI v4 port to choose from though.
magic_android said:
Once we get a more stable ICS base, me and a friend of mine will try porting MIUI. I'm not sure which MIUI v4 port to choose from though.
Click to expand...
Click to collapse
I'm in for porting but i've exams too .... can't wait till my summer vactions start on may 15th
strawmetal said:
I'm in for porting but i've exams too .... can't wait till my summer vactions start on may 15th
Click to expand...
Click to collapse
Well, i'm going to have to try and make the port before my exams in june/july. It'll be my first port but i'm pretty interested in trying it out. If i think it's daily driver material and is worth releasing, i'm gonna go for it.
---------- Post added at 04:41 PM ---------- Previous post was at 03:45 PM ----------
Well, i realised i had some free time today, so i started trying to port thishttp://forum.xda-developers.com/showthread.php?t=1512565 to our phones.
I got up to step 8 and then ended up with a whole bunch of values that i couldn't find or match in the way that the guide instructed. I have no prior experience in porting or developing, but i am willing to learn. So if anyone knows how to help me, feel free to PM me. Btw, i managed to decompile the android.policy.jar file but from that point, when i went to edit PhoneWindowManager.smali, i couldn't find any matching values between what was listed in the guide and what i was seeing on my screen in notepad++, so i didn't know what to change in there.
magic_android said:
Well, i'm going to have to try and make the port before my exams in june/july. It'll be my first port but i'm pretty interested in trying it out. If i think it's daily driver material and is worth releasing, i'm gonna go for it.
---------- Post added at 04:41 PM ---------- Previous post was at 03:45 PM ----------
Well, i realised i had some free time today, so i started trying to port thishttp://forum.xda-developers.com/showthread.php?t=1512565 to our phones.
I got up to step 8 and then ended up with a whole bunch of values that i couldn't find or match in the way that the guide instructed. I have no prior experience in porting or developing, but i am willing to learn. So if anyone knows how to help me, feel free to PM me. Btw, i managed to decompile the android.policy.jar file but from that point, when i went to edit PhoneWindowManager.smali, i couldn't find any matching values between what was listed in the guide and what i was seeing on my screen in notepad++, so i didn't know what to change in there.
Click to expand...
Click to collapse
That is what I have been porting unsuccessfully. Did you get it booting?
magic_android said:
Well, i'm going to have to try and make the port before my exams in june/july. It'll be my first port but i'm pretty interested in trying it out. If i think it's daily driver material and is worth releasing, i'm gonna go for it.
---------- Post added at 04:41 PM ---------- Previous post was at 03:45 PM ----------
Well, i realised i had some free time today, so i started trying to port thishttp://forum.xda-developers.com/showthread.php?t=1512565 to our phones.
I got up to step 8 and then ended up with a whole bunch of values that i couldn't find or match in the way that the guide instructed. I have no prior experience in porting or developing, but i am willing to learn. So if anyone knows how to help me, feel free to PM me. Btw, i managed to decompile the android.policy.jar file but from that point, when i went to edit PhoneWindowManager.smali, i couldn't find any matching values between what was listed in the guide and what i was seeing on my screen in notepad++, so i didn't know what to change in there.
Click to expand...
Click to collapse
Editing android.policy.jar is not responsible to get the rom booting though. In PhoneWindowManager.smali search for the term I've told you : const v.....
and look at the results you get.
The one you need has its counterpart after 2 line number what I mean is that, if you find const/4 v1, 0x1 at .line 1097, then you should look for its counterpart const/4 v1, 0x0 after two line numbers, i.e. at .line 1099.
If you have found it, the it is the value you need to change.
Also it should have a comment including work mLidOpen.
It's easy if you look thoroughly 2-3 line above and below it. It'll let you know if you are at correct position or not.
@jspina: Just a thought, try using the base framework.jar smali instead of MIUI one, I've never tried it but might be worth a try to get the rom booting. I mean first try using base framework.jar file in your port, if you don't find success, If you don't find success, use search in classout directory of MIUI and swap everything with media or power in its filename by their base rom framework.jar counterparts.
Post if you get stuck.
ajhavery said:
Editing android.policy.jar is not responsible to get the rom booting though. In PhoneWindowManager.smali search for the term I've told you : const v.....
and look at the results you get.
The one you need has its counterpart after 2 line number what I mean is that, if you find const/4 v1, 0x1 at .line 1097, then you should look for its counterpart const/4 v1, 0x0 after two line numbers, i.e. at .line 1099.
If you have found it, the it is the value you need to change.
Also it should have a comment including work mLidOpen.
It's easy if you look thoroughly 2-3 line above and below it. It'll let you know if you are at correct position or not.
@jspina: Just a thought, try using the base framework.jar smali instead of MIUI one, I've never tried it but might be worth a try to get the rom booting. I mean first try using base framework.jar file in your port, if you don't find success, If you don't find success, use search in classout directory of MIUI and swap everything with media or power in its filename by their base rom framework.jar counterparts.
Post if you get stuck.
Click to expand...
Click to collapse
got stuck.
should I post a log? Although I think that it just wont work. I dont really know what they did or what I am doing wrong but I dont think audacity b2 will work as a base unless I were to actually update each file individually...

[MODS][HOW-TO] Random SGS3 Mods

This thread started out as my attempt to give back to the community by sharing some of my mods. But I think it would be nice if we could turn this in to a community effort. Kind of a one stop shopping for simple mods. Mods that would generate tons of discussion, like loserskater's AOSP MMS or lockscreen music controls, would probably be best served with their own threads (of course they would be welcome here).
Anyway, the choice is yours. Feel free to post your mods here if you want.
Be sure to limit your contributions to editing smali or xml. Nothing to do with device settings.
_______
Devs and Cooks: Feel free to use the mods in your ROMs.
Be sure to click thanks give credit to the dev that posted the mod.
_______
These mods are geared toward devs, cooks, and advanced users.
It is assumed you already know how to compile/decompile apks and jars. If not, there is tons of info available elsewhere.
If you need help with any of these mods go here.
_______
Index (by post #):
2) Add more wallpapers to SecWallpaperChooser
3) Disable page looping in launcher
4) Rendering Colors Properly in Aroma
14) TouchWiz Group Messaging and Backup / Restore SMS
15) Easy CSC feature edits
23) Remove AT&T Subscriber popup when opening contacts
39) Status bar Transparency
45) Disable Browser EdgeZoom
46) Disable Browser EdgeZoom with Toggle
50) Adding Custom Boot Animation Support (ICS/JB)
53) Adding more languages
*****
Add More Wallpapers
First you need to gather the wallpapers you want to use.
You will need two copies of each wallpaper. Resize to the following dimensions (I use Paint) and save as .jpg.
Code:
1280x1280 pixels
213x189 pixels
Name the wallpapers as you see in res/drawable-xhdpi. If you keep the original stock wallpapers (you can replace them too), start naming the wallpapers as:
Code:
hd_06.jpg
hd_06_small.jpg
hd_07.jpg
hd_07_small.jpg
hd_08.jpg
hd_08_small.jpg
etc.
Decompile SecWallpaperChooser.apk
Place the wallpapers in res/drawable-xhdpi
Go to res/values-xhdpi/arrays.xml.
You will see this:
Code:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string-array name="wallpapers">
<item>hd_01</item>
<item>hd_02</item>
<item>hd_03</item>
<item>hd_04</item>
<item>hd_05</item>
</string-array>
</resources>
Add an item for each wallpaper you added. This a recent example when I added 20 more wallpapers:
Code:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string-array name="wallpapers">
<item>hd_01</item>
<item>hd_02</item>
<item>hd_03</item>
<item>hd_04</item>
<item>hd_05</item>
<item>hd_06</item>
<item>hd_07</item>
<item>hd_08</item>
<item>hd_09</item>
<item>hd_10</item>
<item>hd_11</item>
<item>hd_12</item>
<item>hd_13</item>
<item>hd_14</item>
<item>hd_15</item>
<item>hd_16</item>
<item>hd_17</item>
<item>hd_18</item>
<item>hd_19</item>
<item>hd_20</item>
<item>hd_21</item>
<item>hd_22</item>
<item>hd_23</item>
<item>hd_24</item>
<item>hd_25</item>
</string-array>
</resources>
Recompile and push to your device.
Disable Page Looping in Launcher
Decompile SecLauncher2.apk
Go to smali/com/android/launcher2/PagedView.smali
Find this line of code:
Code:
.method protected isLoopingEnabled()Z
A few lines below it change this:
Code:
const/4 v0, [COLOR="Red"]0x1[/COLOR]
To this:
Code:
const/4 v0, [COLOR="red"]0x0[/COLOR]
Recompile and push to your device.
That's it!
"Really?"
I said that's it fool!
Rendering Colors Properly in Aroma
Our device does not render colors properly in Aroma. Normally you would just force a colorspace at the very beginning of the aroma-config then the problem is solved. But on this device forcing a colorspace will often cause the Aroma installer to hang. This is how I solved the problem.
1) You have two choices for this step:
a) Deal with the (hideous) default color rendering until a theme has been chosen.
b) Create a theme that works with the default colorspace. Unfortunately, you don't have many color choices here. And figuring out which colors will work is just trial and error. None of the colors render properly. For example, green PNG images render as blue on the display. Orange (or maybe pink - can't remember) renders as neon yellow.
I created a theme called "start" which is my start up theme which works with the default colorspace.
2) Force the rgba colorspace before each theme in aroma-config. This gives true color rendering. Below are the relevant lines from my aroma-config.
Code:
### LICENSE:
#
# Copyright (C) 2011 Ahmad Amarullah ( http://amarullz.com/ )
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
#CSROM SGS3
#upndwn4par
#
theme("start");
fontresload( "0", "ttf/Roboto-Regular.ttf;ttf/DroidSansArabic.ttf;ttf/DroidSansFallback.ttf;", "12" );
loadlang("langs/en.lang");
fontresload( "0", "ttf/Roboto-Regular.ttf", "12" );
fontresload( "1", "ttf/Roboto-Regular.ttf", "18" );
ini_set("rom_name","CSROM SGS3");
ini_set("rom_version","v1.3");
ini_set("rom_author","upndwn4par");
ini_set("rom_device","Multi-Carrier");
ini_set("rom_date","21 Jan 2013");
#
selectbox(
"Aroma Installer Setup",
"Aroma Theme Options",
"@theme",
"theme.prop",
"Please Select a Theme","",2,
"<#selectbg_g>CSROM</#>",
"",1,
"<#selectbg_g>ICS</#>",
"",0,
"<#selectbg_g>MIUI</#>",
"",0,
"<#selectbg_g>Sense</#>",
"",0
);
#
if
file_getprop("/tmp/aroma-data/theme.prop","selected.1") == "1"
then
ini_set("force_colorspace","rgba");
theme("csrom");
endif;
if
file_getprop("/tmp/aroma-data/theme.prop","selected.1") == "2"
then
ini_set("force_colorspace","rgba");
theme("ics");
endif;
if
file_getprop("/tmp/aroma-data/theme.prop","selected.1") == "3"
then
ini_set("force_colorspace","rgba");
theme("miui");
endif;
if
file_getprop("/tmp/aroma-data/theme.prop","selected.1") == "4"
then
ini_set("force_colorspace","rgba");
theme("sense");
endif;
#
Mine 4
Mine 5
Mine 6
Mine 7
Mine 8
Mine 9
Done
Got some stuff coming...
...just grabbing another.
TouchWiz Group Messaging and Backup / Restore SMS
This is how to enable the Group Messaging and Backup / Restore SMS features found in the stock TouchWiz Messaging app
First decompile SecMms.apk
Now navigate to smali/com/android/mms/MmsConfig.smali
To enable the Group Messaging feature
Fnd:
Code:
.method public static getEnableGroupMessage()Z
.locals 1
.prologue
.line 766
const/4 v0, 0x0
Change to:
.
Code:
method public static getEnableGroupMessage()Z
.locals 1
.prologue
.line 766
const/4 v0, 0x1
To enable backup / restore SMS messages
Find:
Code:
.method public static getEnableSaveRestoreSDCardMessage()Z
.locals 1
.prologue
.line 774
const/4 v0, 0x0
Change to:
Code:
.method public static getEnableSaveRestoreSDCardMessage()Z
.locals 1
.prologue
.line 774
const/4 v0, 0x1
Now compile with changes.... Easy Pezy
Enjoy Group Messaging...
enewman17
CSC / Feature.xml edits
Easy CSC freature edits.
Editing the csc/feature.xml can unlock certain features
Enter as new line in Messaging
Code:
<CscFeature_Message_ReplaceCRToNewLine>true</CscFeature_Message_ReplaceCRToNewLine>
Increase Image Sizes... This is pushing the limits of the network as is...
Code:
<CscFeature_Message_MaxMessageSize>5242880</CscFeature_Message_MaxMessageSize>
<CscFeature_Message_MaxImageWidth>1280</CscFeature_Message_MaxImageWidth>
<CscFeature_Message_MaxImageHeight>720</CscFeature_Message_MaxImageHeight>
Increase Recipients limit
Code:
<CscFeature_Message_RecipientLimit>50</CscFeature_Message_RecipientLimit> Increase Recipients limit
Increas MMS video recording size and quality.... This is pushing the limits of the network as is...
Code:
<CscFeature_Message_MaxMmsSize>5242880</CscFeature_Message_MaxMmsSize> <!-- 5242880 for 5.0MB -->
<CscFeature_Message_MmsModeCaptureVideoMaxSize>5033164</CscFeature_Message_MmsModeCaptureVideoMaxSize> <!-- 5033164 for 4.8MB -->
<CscFeature_Message_MmsModeCaptureVideoBitRate>128000</CscFeature_Message_MmsModeCaptureVideoBitRate> <!-- 256000 for 256Kbps -->
<CscFeature_Message_MmsModeCaptureVideoMaxDuration>60</CscFeature_Message_MmsModeCaptureVideoMaxDuration> <!-- 60sec -->
<CscFeature_Message_MmsModeCaptureVideoResolution>320x240</CscFeature_Message_MmsModeCaptureVideoResolution> <!-- "" = use camcorder default value-->
Other MMS tweaks, Single view MMS (no slideshow) blocking, alias, Call back#, Text Template Button, MultiLock, Re-combine SMS
Code:
<CscFeature_Message_EnableSegmentedSMS>true</CscFeature_Message_EnableSegmentedSMS>
<CscFeature_Message_DisableMenuSMSC>false</CscFeature_Message_DisableMenuSMSC>
<CscFeature_Message_EnableBlackList>true</CscFeature_Message_EnableBlackList>
<CscFeature_Message_EnableAlias>true</CscFeature_Message_EnableAlias>
<CscFeature_Message_EnableSmsCallbackNumber>true</CscFeature_Message_EnableSmsCallbackNumber>
<CscFeature_Message_ImageResizeQualityFactorWhenAttach>high</CscFeature_Message_ImageResizeQualityFactorWhenAttach>
<CscFeature_Message_EnableTextTemplateButton>true</CscFeature_Message_EnableTextTemplateButton>
<CscFeature_Message_EnableMmsOnePageViewer>true</CscFeature_Message_EnableMmsOnePageViewer>
<CscFeature_Message_DisableSaveRingtoneMenu>false</CscFeature_Message_DisableSaveRingtoneMenu>
<CscFeature_Message_EnableMultiLockMenu>true</CscFeature_Message_EnableMultiLockMenu>
<CscFeature_Message_UseAddrWithinMMSWhenSendACK>true</CscFeature_Message_UseAddrWithinMMSWhenSendACK>
Disable the FOTA / Carrier Updates setting under about phone.
Code:
<CscFeature_Settings_FOTA>false</CscFeature_Settings_FOTA>
Enable Find My Mobile in security settings
Code:
<CscFeature_Settings_FindMyMobile>true</CscFeature_Settings_FindMyMobile>
<CscFeature_Setting_DisableMenuFindMyMobile>false</CscFeature_Setting_DisableMenuFindMyMobile>
Set the Default Homepage to anything you want
Code:
<CscFeature_Web_SetHomepageURL>http://www.google.com</CscFeature_Web_SetHomepageURL>
Add exit button to stock web browser
Code:
<CscFeature_Web_AddOptionToTerminate>true</CscFeature_Web_AddOptionToTerminate>
TW E-mail -Dark-
Code:
<CscFeature_Email_UseFixedBgColorAsWhite>false</CscFeature_Email_UseFixedBgColorAsWhite>
Enable Call/Message block in settings menu
Code:
<CscFeature_Setting_EnableMenuBlockCallMsg>true</CscFeature_Setting_EnableMenuBlockCallMsg>
There are more that could be edited...
How about disabling the TW Downloads app without having the "download complete" notification re-apparing after every reboot. Only way to get rid of the notification is to open Downloads app and manually clear the list. I've tried every thing to disable this, removing app, disabling downloads notification under app manager, etc.
Even possible on TouchWiz, or is it to intergreated in the framework???
Sent from my SGS III
Swiftks said:
How about disabling the TW Downloads app without having the "download complete" notification re-apparing after every reboot. Only way to get rid of the notification is to open Downloads app and manually clear the list. I've tried every thing to disable this, removing app, disabling downloads notification under app manager, etc.
Even possible on TouchWiz, or is it to intergreated in the framework???
Sent from my SGS III
Click to expand...
Click to collapse
Should be doable. Do you mean the notification drawer or status bar notification?
What ROM are you running? My notification goes away after I clear it once.
upndwn4par said:
Should be doable. Do you mean the notification drawer or status bar notification?
What ROM are you running? My notification goes away after I clear it once.
Click to expand...
Click to collapse
Notification drawer.
Yeah, the message will disappear after I hit clear, but on a reboot, its back... Until I clear it in Downloads. This is only downloads from Chrome.
Ruining a modded version of 4.1.1 at the moment with custom theme & lean kernel.
Sent from my SGS III
Is there any chance you guys want to work with me to get CRT-off working on our device? I've been trying to crack at it for 2 days now. I have decompiled, made changes, recompiled, and flashed more times than I want to share but I can't get it. I've been following the i9300 thread here because the smali files are quite similar to ours, but something (I believe changes in SystemUI.apk) is causing a ruckus where the boot animation keeps looping (properly albeit) and won't boot into the OS further than that. Take a look at this thread. Maybe it's a lost cause for now, but I was pulling my hair out. And yes I manually made the changes in the smali files. http://forum.xda-developers.com/showthread.php?t=1935588
Swiftks said:
Notification drawer.
Yeah, the message will disappear after I hit clear, but on a reboot, its back... Until I clear it in Downloads. This is only downloads from Chrome.
Ruining a modded version of 4.1.1 at the moment with custom theme & lean kernel.
Sent from my SGS III
Click to expand...
Click to collapse
I just tried it with chrome and mine still cleared fine even after reboot. Do you have Chrome synched to your Google account (I don't)? I wonder if that could be part of the problem.
Still shouldn't be a tough mod.
stratatak7 said:
Is there any chance you guys want to work with me to get CRT-off working on our device? I've been trying to crack at it for 2 days now. I have made changes, decompiled, recompiled and flashed more times than I want to share but I can't get it. I've been following the i9300 thread here because the smali files are quite similar to ours, but something (I believe changes in SystemUI.apk) is causing a ruckus where the boot animation keeps looping (properly albeit) and won't boot into the OS further than that. Take a look at this thread. Maybe it's a lost cause for now, but I was pulling my hair out. And yes I manually made the changes in the smali files. http://forum.xda-developers.com/showthread.php?t=1935588
Click to expand...
Click to collapse
Sure. I've had that on my list of things to do.

[INFO][REF][MON 18 FEB '13] Jelly Bean Porting thread | Vision Keyboard Fixes

I'm starting this thread as a result of trying to port Paranoid Android 2.51 from the saga. Long story short, turns out previous known ways to fix keyboard problems in ICS ports no longer work for Jelly Bean.
Please PM me and post useful info in this thread.... I absolutely do not want this to turn into a "how do I do this" thread.... This is for exchanging knowledges and discussion.
Progress so far: Thanks to strapped365, who has successfully ported PA 2.xx WITH working keyboard for the myTouch 4G Slide, We now know how to enable the soft keyboard. strapped365's instructions were off the top of his head, so here I have written a revised version with detailed instructions.
If you want to help out but are a n00b at editing .apk files, please follow this simple guide for de/ recompiling with APKTool.
SOFT KEYBOARD FIX
Using apktool, decompile framework-res.apk, then open res/values/bools.XML . Look for
Code:
<bool name="config_forceDisableHardwareKeyboard">[COLOR="Red"]false[/COLOR]</bool>
Change it to
Code:
<bool name="config_forceDisableHardwareKeyboard">[COLOR="Red"]true[/COLOR]</bool>
Before I go any further, I'm not convinced this is the best way to fix the problem because this boolean suggests we are saying that we should force the hardware keyboard to not be used just to get the soft keyboard up instead, although at least the hardware keyboard is still recognised. We need to look more into android.policy.jar stuff.
Anyway, now go into res/values/integers.XML and find
Code:
<integer name="config_lidOpenRotation">[COLOR="red"]-1[/COLOR]</integer>
Change it to
Code:
<integer name="config_lidOpenRotation">[COLOR="red"]90[/COLOR]</integer>
Still in integers.XML, look for
Code:
<integer name="config_lidNavigationAccessibility">[COLOR="red"]0[/COLOR]</integer>
and change it to
Code:
<integer name="config_lidNavigationAccessibility">[COLOR="Red"]1[/COLOR]</integer>
DO NOT change
Code:
<integer name="config_lidKeyboardAccessibility">[COLOR="red"]0[/COLOR]</integer>
When I did, I got bootloops.
Click to expand...
Click to collapse
PHYSICAL KEYBOARD BUTTON BACKLIGHT
I've tried lms24's fix for ICS (scroll down to the bottom of the post) but unfortunately this does not work, which I'm slightly surprised at being as other framework tweaks (for soft keyboard) work, and comparing JB's values for this stuff to ICS's does not show much difference.
Click to expand...
Click to collapse
PHYSICAL KEYBOARD OPEN / LID OPEN STATE (SCREEN ROTATION UPON OPENING KEYBOARD)
I've had a look in android.policy.jar and in PhoneWindowManager.smali there is an interesting method, it is in the original Jelly Belly ROM (which is what, if you're porting, you should be using because the other JB ROMs are test builds) but is not in the PA ROM I'm porting (nor will it be in any other non-Vision ROM, I guess). Take a look. Simply putting the method into the ported ROM's PhineWindowManager.smali file doesn't work, there must be something deeper at work here.
Code:
.method private applyLidSwitchState()V
.registers 4
.prologue
.line 5042
iget-object v0, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mPowerManager:Landroid/os/LocalPowerManager;
invoke-direct {p0}, Lcom/android/internal/policy/impl/PhoneWindowManager;->isBuiltInKeyboardVisible()Z
move-result v1
invoke-interface {v0, v1}, Landroid/os/LocalPowerManager;->setKeyboardVisibility(Z)V
.line 5044
iget v0, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mLidState:I
if-nez v0, :cond_1a
iget-boolean v0, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mLidControlsSleep:Z
if-eqz v0, :cond_1a
.line 5045
iget-object v0, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mPowerManager:Landroid/os/LocalPowerManager;
invoke-static {}, Landroid/os/SystemClock;->uptimeMillis()J
move-result-wide v1
invoke-interface {v0, v1, v2}, Landroid/os/LocalPowerManager;->goToSleep(J)V
.line 5047
:cond_1a
return-void
.end method
Click to expand...
Click to collapse
TO FINISH OFF
Here's how strapped365 told me to finish it off (I used Ubuntu's built in archive manager to do this, it should work fine, if you're not using 7zip just extract the right files from the original, delete the respective files in the new one and pack the old stuff):
Once the apk is compiled open the newly compiled apk with 7zip on one window and then open the original untouched apk in another 7zip window and drag the META_inf and manifest XML from the original apk into the new apk ( the new apk NEEDS these ) once that's done your good to go. Just note that this still leaves an onscreen keyboard in landscape when then keyboard is open, but its better than what your dealing with.
Click to expand...
Click to collapse
Obviously make sure the new file is renamed to to framework-res.apk.
THANKS TO...
ajhavery
lms24
strapped365
For helping me out with all this... so far this is not spawned in any way from my own knowledge (although I have been doing my own investigating) but has been from help and advice from the above.
Click to expand...
Click to collapse
RESERVED
RESERVED
AW: [INFO][REF][MON 18 FEB '13] Jelly Bean Porting thread | Vision Keyboard Fixes
Good job man! This will be appreciated by many g2 devs, when it comes to in porting. Thanks for sharing.
Sent from my HTC One X using xda app-developers app

[MOD] [GUIDE] SplitWindow for G2 stock KK roms

Sorry it took so long for me to write this up.
Following these steps will allow you to add the full split window implementation from the GPro2 and G3 KK roms that for whatever reason LG decided to leave (mostly) out of the stock G2 4.4.x roms. This guide is geared more towards rom devs or people that are familiar with using smali/baksmali and doing minor dalvik/smali edits.
Prerequisites:
Get smali/baksmali v2.0.3
Get a copy of the framework directory for the rom you're implementing this on
Download the source files/zip linked below
Quick notes on smali/baksmali usage:
If you're running baksmali on an odex your basic command to use for this guide is baksmali -a 19 -b -d <path/to/framework/dir> -o <path/to/baksmali/outdir> - x filename.odex
If you're working with an extracted classes.dex (i.e. from from roms that support art) it's just baksmali -a 19 -b -o <path/to/baksmali/outdir> classes.dex
The basic smali command to use for these purposes is smali -a 19 -o classes.dex <path/to/baksmali/outdir>
Step 1:
Baksmali telephony-common (from your framework dir) and find the following line in generated/ConfigBuildBase.smali:
Code:
sput-boolean v0, Lgenerated/ConfigBuildBase;->CAPP_SPLITWINDOW:Z
and change the boolean to true like so:
Code:
sput-boolean v1, Lgenerated/ConfigBuildBase;->CAPP_SPLITWINDOW:Z
Step 2:
Smali that file back to a new classes.dex and zip it back into telephony-common.jar
Step 3:
Baksmali com.lge.frameworks and find the same line in generated/ConfigBuildBase.smali:
Code:
sput-boolean v0, Lgenerated/ConfigBuildBase;->CAPP_SPLITWINDOW:Z
and change the boolean to true like so:
Code:
sput-boolean v1, Lgenerated/ConfigBuildBase;->CAPP_SPLITWINDOW:Z
Step 4:
Open up com/lge/loader/splitwindow/SplitWindowCreatorHelper.smali and add the following to your static fields declarations:
Code:
.field private static TAG:Ljava/lang/String;
so that it will now appear as:
Code:
# static fields
.field private static SPLITWINDOW_INSTANCE:Lcom/lge/loader/splitwindow/ISplitWindow;
.field private static TAG:Ljava/lang/String;
Step 5:
In the same smali file a few lines down, you'll need to add the following to your direct methods:
Code:
const-string v0, "SplitWindowCreatorHelper"
sput-object v0, Lcom/lge/loader/splitwindow/SplitWindowCreatorHelper;->TAG:Ljava/lang/String;
so that it will now apprear as:
Code:
sput-object v0, Lcom/lge/loader/splitwindow/SplitWindowCreatorHelper;->SPLITWINDOW_INSTANCE:Lcom/lge/loader/splitwindow/ISplitWindow;
const-string v0, "SplitWindowCreatorHelper"
sput-object v0, Lcom/lge/loader/splitwindow/SplitWindowCreatorHelper;->TAG:Ljava/lang/String;
return-void
.end method
Step 6:
Again, in the same smali scroll all the way down as you'll need to add the following public method at the end of the file:
* keep in mind you'll need to keep a blank line between the .end method above and this new method below
Code:
.method public static recoverService()Lcom/lge/loader/splitwindow/ISplitWindow$ISplitWindowPolicy;
.registers 4
const/4 v3, 0x0
sget-object v1, Lcom/lge/loader/splitwindow/SplitWindowCreatorHelper;->TAG:Ljava/lang/String;
const-string v2, "recoverService"
invoke-static {v1, v2}, Landroid/util/Slog;->w(Ljava/lang/String;Ljava/lang/String;)I
sget-object v1, Lcom/lge/loader/splitwindow/SplitWindowCreatorHelper;->SPLITWINDOW_INSTANCE:Lcom/lge/loader/splitwindow/ISplitWindow;
if-eqz v1, :cond_20
sget-object v1, Lcom/lge/loader/RuntimeLibraryLoader;->SPLIT_WINDOW:Ljava/lang/String;
invoke-static {v1}, Lcom/lge/loader/RuntimeLibraryLoader;->getCreator(Ljava/lang/String;)Lcom/lge/loader/InstanceCreator;
move-result-object v0
if-eqz v0, :cond_1e
invoke-virtual {v0, v3}, Lcom/lge/loader/InstanceCreator;->setDefaultInstance(Ljava/lang/Object;)V
sget-object v1, Lcom/lge/loader/splitwindow/SplitWindowCreatorHelper;->TAG:Ljava/lang/String;
const-string v2, "Set default InstanceCreator as null to make NEW instance"
invoke-static {v1, v2}, Landroid/util/Slog;->v(Ljava/lang/String;Ljava/lang/String;)I
:cond_1e
sput-object v3, Lcom/lge/loader/splitwindow/SplitWindowCreatorHelper;->SPLITWINDOW_INSTANCE:Lcom/lge/loader/splitwindow/ISplitWindow;
:cond_20
invoke-static {}, Lcom/lge/loader/splitwindow/SplitWindowCreatorHelper;->getPolicyService()Lcom/lge/loader/splitwindow/ISplitWindow$ISplitWindowPolicy;
move-result-object v1
return-object v1
.end method
Step 7:
Open up com/lge/loader/splitwindow/ISplitWindow$ISplitWindowPolicy.smali and add the following public method after the getMinimumScreenSize public method (again, minding your blank lines)
Code:
.method public abstract getRecentStackBoxes()Ljava/util/List;
.annotation system Ldalvik/annotation/Signature;
value = {
"()",
"Ljava/util/List",
"<",
"Landroid/app/ActivityManager$StackBoxInfo;",
">;"
}
.end annotation
.end method
Step 8:
Smali all of that to a new classes.dex and zip it back into com.lge.frameworks.jar
Step 9:
Put your newly modified com.lge.frameworks.jar and telephony-common.jar into place (I also re-odex them and copy the original signatures over)
Step 10:
Put all of the files contained in the download provided below into their respective directories with the proper permissions (644 all around)
Step 11:
Add the following two lines to your build.prop
Code:
ro.lge.capp_splitwindow=true
persist.splitwindow.support_all=true
* if you don't want all apps showing up in the selection window, change support_all to false
That's it...you should be good to go. There's always the possibility that your framework will be slightly different, but that's the general idea and you should be able to make small changes to adjust to your particular variant
Feel free to include this in your roms (that's why I posted it). Just give credit in your OP.
Downloads:
SplitWindow Files - G Pro 2
SplitWindow Files - G3
The only real difference between them is the color of the outline box
wow. definitely not for noobs.
thanks for sharing though. I'll try messing with it soon.
good job. thanks
if i will modify my installed pardus rom in my phone with that guide,
is it will work after xposed installer or it will cause trouble to use them both..
xposed and your guide..
should i disable xposed, modify by your guide and ten install xposed again or no need for that?
+If you could, post here a 1 or 2 screenshots..
Hope someone will make an apk installer ( like your camera) to make it working easily on stock roms!
Good job m8
Thanks mate ?
Sent from my LG-D802 using Tapatalk
Awesome sauce man, going to learn some smali now
@xdabbeb and @bender_007 brothers, please help us with either a flashable version or an apk please
Press thanks button if I was of any help / assistance to you
Apk and i make a statue in your honor
I got still stock recovery on 20b.. only rooted
rastigo said:
@xdabbeb and @bender_007 brothers, please help us with either a flashable version or an apk please
Press thanks button if I was of any help / assistance to you
Click to expand...
Click to collapse
will look into it. - but getting "your" framework directory is hard
Can't create installer for all versions. It's possible to provide for most common or these I do own. CloudyG3 for example.
bender_007 said:
will look into it. - but getting "your" framework directory is hard
Can't create installer for all versions. It's possible to provide for most common or these I do own. CloudyG3 for example.
Click to expand...
Click to collapse
Apk for stock rom 80220d and/or for cloudystock, please ? thank you
Inviato dal mio LG-D802 utilizzando Tapatalk
Dont work for me, and MagixRom
https://www.dropbox.com/s/28zrjwr1gj3ci8r/MagixWindon.zip
Enviado desde mi LG-D802 mediante Tapatalk
There would not be a feasible way to make this mod work via an apk installer without serious risk as it requires direct replacement of core framework files. This is a pretty low-level mod so if you want it, you'll have to be rooted with a custom recovery. I do not want people to put their phones into an unusable state by attempting to do this without a recovery. It's just too risky.
As for making flashable zips: this requires modification of framework that is variant/firmware specific and would need to be odexed in most situations (as there are few if any deodexed stock LG roms). This means one would need to create a large number of zips to cover every possible variant/firmware combination. A few devs had asked me to write up a guide detailing how I accomplished this so that they could incorporate it into their own roms. I had already responded to one of rastigo's PMs regarding making flashable zips. I may consider making a couple for the more popular bases (F320K21p & D80220D), but this really should be handled by your individual variant/rom devs. If they run into problems they can get in touch with me and I will help them as soon as I am able to.
I realize that this is a fairly involved guide/mod with multiple chances to make small mistakes, but when followed exactly it does work. There has even been an individual with a LG GPad who followed the guide and got it working.
xdabbeb said:
There would not be a feasible way to make this mod work via an apk installer without serious risk as it requires direct replacement of core framework files. This is a pretty low-level mod so if you want it, you'll have to be rooted with a custom recovery. I do not want people to put their phones into an unusable state by attempting to do this without a recovery. It's just too risky.
As for making flashable zips: this requires modification of framework that is variant/firmware specific and would need to be odexed in most situations (as there are few if any deodexed stock LG roms). This means one would need to create a large number of zips to cover every possible variant/firmware combination. A few devs had asked me to write up a guide detailing how I accomplished this so that they could incorporate it into their own roms. I had already responded to one of rastigo's PMs regarding making flashable zips. I may consider making a couple for the more popular bases (F320K21p & D80220D), but this really should be handled by your individual variant/rom devs. If they run into problems they can get in touch with me and I will help them as soon as I am able to.
I realize that this is a fairly involved guide/mod with multiple chances to make small mistakes, but when followed exactly it does work. There has even been an individual with a LG GPad who followed the guide and got it working.
Click to expand...
Click to collapse
Totally agree.
I will help in any way on that....
Thank you for your efforts..
how can i open the splitwindow by lmt or tasker, can you @xdabbeb make us an launcher apk for open the splitwindow and not only from the recent activity..
like that one for jb:
3rd party navigation bar support (Provided BY BlackDino) Simply point to this app
SplitViewLauncher.apk
Click to expand...
Click to collapse
source @bigfau http://forum.xda-developers.com/showthread.php?t=2544206
xdabbeb said:
There would not be a feasible way to make this mod work via an apk installer without serious risk as it requires direct replacement of core framework files. This is a pretty low-level mod so if you want it, you'll have to be rooted with a custom recovery. I do not want people to put their phones into an unusable state by attempting to do this without a recovery. It's just too risky.
As for making flashable zips: this requires modification of framework that is variant/firmware specific and would need to be odexed in most situations (as there are few if any deodexed stock LG roms). This means one would need to create a large number of zips to cover every possible variant/firmware combination. A few devs had asked me to write up a guide detailing how I accomplished this so that they could incorporate it into their own roms. I had already responded to one of rastigo's PMs regarding making flashable zips. I may consider making a couple for the more popular bases (F320K21p & D80220D), but this really should be handled by your individual variant/rom devs. If they run into problems they can get in touch with me and I will help them as soon as I am able to.
I realize that this is a fairly involved guide/mod with multiple chances to make small mistakes, but when followed exactly it does work. There has even been an individual with a LG GPad who followed the guide and got it working.
Click to expand...
Click to collapse
When I try to launch splitview I see dualwindows fc ?
Inviato dal mio LG-D802 utilizzando Tapatalk
Matt927 said:
When I try to launch splitview I see dualwindows fc ?
Inviato dal mio LG-D802 utilizzando Tapatalk
Click to expand...
Click to collapse
provide a logcat ..
can someone make an apk shortcut for the dualwindows operation, i have LMT launcher and i want to open dualwindows from the lmt..
thanks!
As said above.
Without framework core files no.
Its not so dangerous mod after all.
Just 2 jars to modify and one more to add.
If i find some time i will make a flashable zip for it tonight and a flashable revert if anything goes wrong
) ) ) G2 On Air ( ( (

Categories

Resources