Related
[HOW TO] Extended Power Menu (reboot / download / recovery) with no header
This HOW TO is rewritten from a French tutorial (HERE) itself rewritten from a XDA tutorial (HERE, and modified using this other one : HERE
Thanks to :
Okarin
untermensch
PaoloM70
Click to expand...
Click to collapse
warnings :
- This tutorial is for people who know what they will do, a mistake can fit your phone unusable so ...
- A modification of system files is always a delicate operation, pay attention and do not rush
Click to expand...
Click to collapse
Prerequisites :
First and foremost, you must master the decompilation / recompilation of APK and JAR using APK_Manager and smali/baksmali.
Click to expand...
Click to collapse
Mod the power menu :
Here is the way to add the options "Reboot", "Recovery" and "Download" to the Power menu (long press the power button)
For this part, we will work on 2 files:
framework res.apk
android.policy.jar
Click to expand...
Click to collapse
You can decompile the first with APK Manager, and the second with baksmali.
1/ framework-res.apk :
Extract it with APK_Manager (extracted in /project folder)
a/ Then, before going any further, you will have to find three new .PNG images to be displayed in the power menu, and name them :
"ic_lock_reboot.png" for reboot menu
"ic_lock_recovery.png" to enter recovery
"ic_lock_download.png" for download Mode
Click to expand...
Click to collapse
Place these 3 images in the : APK_Manager/project/framework-res.apk/res/drawable-hdpi
where you will find the other pictures already in the menu concerned.
It is easier for beginners to add customised icons (like for power off, silent or plane modes icons )after recompilation, using 7zip for example. .
b/ With NotePad + +, edit the file " res/values/strings.xml "
Go to the end of the file, and add before the last line "</resources>", the three lines:
Code:
<string name="reboot_recovery">Recovery</string>
<string name="reboot_download">Download</string>
<string name="reboot">Reboot</string>
This should give you something like this:
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
c/ Save your file.
d/ Now you can recompile the file "framework-res.apk" with APK Manager.
Remember that this is an APK system and delete the "keep/resources.arsc", since we have modified an XML file.
You will have a your moded apk here : "place-apk-here-for-modding/unsignedframework-res.apk"
Warning: You should not have errors when you re-compil. don't forget to add 3 new icons;
e/ using APK-Manager, decompil "place-apk-here-for-modding/unsignedframework-res.apk".
*Go to res/values/public.xml and edit with Notepad ++
*public.xml is auto-generated from others modifications during APK_MANAGER re-compilation. 6 new lines have been added, with 6 new Hex numbers. You will need these numbers later ...
Look for :
Code:
<public type="string" name="reboot" id="[B]0x01040488[/B]" />
<public type="string" name="reboot_recovery" id="[B]0x01040489[/B]" />
<public type="string" name="reboot_download" id="[B]0x0104048a[/B]" />
and for :
Code:
<public type="drawable" name="ic_lock_reboot" id="[B]0x010803d2[/B]" />
<public type="drawable" name="ic_lock_recovery" id="[B]0x010803d3[/B]" />
<public type="drawable" name="ic_lock_download" id="[B]0x010803d4[/B]" />
f/ Now you just have to rename "place-apk-here-for-modding/unsignedframework-res.apk" to "framework-res.apk" and voila!
Edit : never sign a system File using APK_Manager.
Here is the first part ended.
A tip, try this file on your phone, if it restarts fine, then the mod is correct, otherwise you can start over
It is important to test step by step, because it lets you know exactly from witch file comes the error.
2/ Now, we attack the second file "android.policy.jar".
Once decompiled with baksmal, edit the "out/com/android/internal/policy/impl/GlobalActions.smali."
Caution: Do not confuse it with the file "GlobalActions$Action.Smali"
a/ Find the line ".method private createDialog()Landroid/app/AlertDialog;"
then a few lines below, replace "const/4 v9, 0x4" with "const/4 v9, 0x7".
This line indicates the number of menu entries of extinction, we move from 4 to 7 (3 mor entries). You should have this after the changes made:
b/ Then find the line "
Code:
invoke-static {v0}, Lcom/google/android/collect/Lists;->newArrayList([Ljava/lang/Object;)Ljava/util/ArrayList;
" and insert just above:
Code:
const/4 v1, 0x4
new-instance v2, Lcom/android/internal/policy/impl/GlobalActions$8;
const v3, 0x10803d2
const v4, 0x1040488
invoke-direct {v2, p0, v3, v4}, Lcom/android/internal/policy/impl/GlobalActions$8;-><init>(Lcom/android/internal/policy/impl/GlobalActions;II)V
aput-object v2, v0, v1
const/4 v1, 0x5
new-instance v2, Lcom/android/internal/policy/impl/GlobalActions$9;
const v3, 0x10803d3
const v4, 0x1040489
invoke-direct {v2, p0, v3, v4}, Lcom/android/internal/policy/impl/GlobalActions$9;-><init>(Lcom/android/internal/policy/impl/GlobalActions;II)V
aput-object v2, v0, v1
const/4 v1, 0x6
new-instance v2, Lcom/android/internal/policy/impl/GlobalActions$10;
const v3, 0x10803d4
const v4, 0x104048a
invoke-direct {v2, p0, v3, v4}, Lcom/android/internal/policy/impl/GlobalActions$10;-><init>(Lcom/android/internal/policy/impl/GlobalActions;II)V
aput-object v2, v0, v1
You will notice in the code, the previous hex numbers generated. You have to modify the hex numbers quoted with the hex numbers you found in step 2 after decompilation of unsignedframework-res.apk
Warning in this code, the hex numbers have a 0 in less after the "0x" like : 0x1234567... and not 0x011234567 like in string.xml[/COLOR]...
Please not in the code you just added the GlobalActions$8, GlobalActions$9, GlobalActions$10 : you will add files .smali with same name later. If in your firmware GlobalActions$8 is already existing, then modify the "$X" to follow last used number
To help, here's what you should have:
3/ If you want to remove the header of the extended power menu, not having to scroll,
a/ search for ".method private prepareDialog()",
then look a few lines below, you should find "const v4, 0x104014a"
where This hexadecimal digit corresponds to the entry "<public type="string"name="global_actions" id="0x0104014a" /> in the "public.xml" file, which itself refers to the text of the menu in" string.xml " :
b/ find the corresponding hexadecimal number 0xXXXXX to the entry "<string name="config_tether_apndata" />" in the "string.xml" file. This entry has no text.
Now replace in "const v4, 0x104014a" with "const v4, 0xXXXXX," so it will not show anything in the power menu.
Save the file.
c/ Come on, we're almost there ...
Now copy the "out/com/android/internal/policy/impl/GlobalActions$4.Smali" to "out/com/android/internal/policy/impl/GlobalActions$8.Smali".
We choose #4 because it is one that contains the shutdown of the phone. We will rename it 8 because it's 8 in the next free issue ...
Remember this if ever in a future version of the files they are change.
d/ Now open the new file "out/com/android/internal/policy/impl/GlobalActions$8.Smali" and replace in, all occurrences of "\GlobalActions$4" with "\GlobalActions$8"
Then, Replace :
Code:
const/4 v1, 0x1
invoke-static {v0, v1}, Lcom/android/internal/app/ShutdownThread;->shutdown(Landroid/content/Context;Z)V
With :
Code:
const/4 v1, 0x1
const-string v2, "now"
invoke-static {v0, v2, v1}, Lcom/android/internal/app/ShutdownThread;->reboot(Landroid/content/Context;Ljava/lang/String;Z)V
e/ Save the file and copy it to "out/com/android/internal/policy/impl/GlobalActions$9.Smali"
Open it and replace in, all occurrences of "\GlobalActions$8" with "\GlobalActions$9
and
const-string v2, "now" with const-string v2, "recovery"
f/ Save the file and copy it to "out/com/android/internal/policy/impl/GlobalActions$10.Smali"
Open it and replace in, all occurrences of "\GlobalActions$9" with "\GlobalActions$10
and
const-string v2, "recovery" with const-string v2, "download"
Save the file and then ... compile it all!
The result, you will see that I also forgot to replace an icon:
Thanks you! finally someone willing to write a tutorial on this.
great tutorial.
thanx, we all need help sometimes
Excellent. Now for a tutorial on how to get the mobile data toggle in the notification bar and we can all build custom roms.
Sent from my GT-I9100 using Tapatalk
Wow, u really went the whole 9 yards explaining this, thanks, as always grateful for ur sharing....
Seems like you put a lot of time and effort in this post.
Very good and clear instructions on something I wanted to add to my custom rom for a long time. (without just adding some files)
Thank you very much.
No credit for the how to you copied this from?
what a shame
http://forum.xda-developers.com/showthread.php?t=811532
Nice guide. Two things when using apkmanager:
1) Never ever edit the public.xml
2) When Recompiling: Never sign system files. Copy their signature!
Sent from my GT-I9100 using XDA Premium App
designgears said:
No credit for the how to you copied this from?
what a shame
http://forum.xda-developers.com/showthread.php?t=811532
Click to expand...
Click to collapse
as Cognition user i can only agree with "my" developer, that most of the statings above are simply coppied - Ctrl+a--->Ctrl+V ---> well done
_JKay_ said:
Nice guide. Two things when using apkmanager:
1) Never ever edit the public.xml
2) When Recompiling: Never sign system files. Copy their signature!
Sent from my GT-I9100 using XDA Premium App
Click to expand...
Click to collapse
If we don't edit Public.xml, how are going to achieve this? I keep getting errors while recompiling using apkmanager? They sometimes don't even extract the resources.arsc and throw a lot of errors.
I'm working on adding a few options in the settings apk and neither apkmanger nor apktool is letting me decompile settings apk. It always throws errors. I need to decompile to edit a few xml in values which i don't find if i unzip it with 7-zip or winrar! Editing smali files is not a prob for now!
Any solutions?
@ sicopat
All three options call the Shutdown thread and present the "Your phone will shutdown" dialog. How do we change this?
And i also want to add the subtext in all three options in the main options, where are those located?
Ghostbustersin said:
If we don't edit Public.xml, how are going to achieve this? I keep getting errors while recompiling using apkmanager? They sometimes don't even extract the resources.arsc and throw a lot of errors.
I'm working on adding a few options in the settings apk and neither apkmanger nor apktool is letting me decompile settings apk. It always throws errors. I need to decompile to edit a few xml in values which i don't find if i unzip it with 7-zip or winrar! Editing smali files is not a prob for now!
Any solutions?
Click to expand...
Click to collapse
public.xml is auto-generated! Try add a string or a png and compile then decompile again. You will see that the new resources has been added to the public.xml
The ids MUST be unique and increased by one! Its all done in the apktool!
designgears said:
No credit for the how to you copied this from?
what a shame
http://forum.xda-developers.com/showthread.php?t=811532
Click to expand...
Click to collapse
You are totaly right.
I didn't find lines to modify,
I just built a new How To, from a french one I found here : http://www.galaxys-team.fr/viewtopic.php?f=6&t=14562
I believe this french How To took its inspiration from this thread : http://forum.xda-developers.com/showthread.php?t=811532
I didn't found this thread myself, you found it for me.
I finished to write this thread at 1h30 AM and I am going just now correct this mistake ...
Sorry for this
_JKay_ said:
Nice guide. Two things when using apkmanager:
1) Never ever edit the public.xml
2) When Recompiling: Never sign system files. Copy their signature!
Sent from my GT-I9100 using XDA Premium App
Click to expand...
Click to collapse
1/ Why never edit public.xml ?
2/ You are right for that
_JKay_ said:
public.xml is auto-generated! Try add a string or a png and compile then decompile again. You will see that the new resources has been added to the public.xml
The ids MUST be unique and increased by one! Its all done in the apktool!
Click to expand...
Click to collapse
Ok but i never had errors using this How To and so, modifing public.xml.
But I will add your recommandation for people to try this How To, without modifing public.xml.
Thanks
sicopat said:
I insist on it here: only perform additions, never modify the images during the decompilation / recompilation of APK with APK_Manager.
Thanks
Click to expand...
Click to collapse
Why this statement? I'd rather say ONLY edit PNGs when decompiled!
_JKay_ said:
Why this statement? I'd rather say ONLY edit PNGs when decompiled!
Click to expand...
Click to collapse
Cause when using Apk manager, during re-compilation a keep folder is created and if you don't delete every files (and png) you modified in this keep folder, then after recompilation you will have olds .png from the keep folder and not your new png from your project folder.
It is easier to just push your new .png after recompilation.
I am just a noob who want to help a little with my short experience.
I am ready to learn and to optimise my how to
Sent from my GT-I9100 using XDA Premium App
sicopat said:
Cause when using Apk manager, during re-compilation a keep folder is created and if you don't delete every files (and png) you modified in this keep folder, then after recompilation you will have olds .png from the keep folder and not your new png from your project folder.
It is easier to just push your new .png after recompilation.
I am just a noob who want to help a little with my short experience.
I am ready to learn and to optimise my how to
Sent from my GT-I9100 using XDA Premium App
Click to expand...
Click to collapse
Its true you need to delete the files you modify from the keep folder. But you should never try and modify 9patch pngs if they are not decompiled!!
_JKay_ said:
Its true you need to delete the files you modify from the keep folder. But you should never try and modify 9patch pngs if they are not decompiled!!
Click to expand...
Click to collapse
Yes i agree with you.
But in this How to, you don't need to edit 9patch.png
For begginers i think it's easier to push the customised reboot, power off, download mode icons ... after recompilation.
Sent from my GT-I9100 using XDA Premium App
sicopat said:
Yes i agree with you.
But in this How to, you don't need to edit 9patch.png
For begginers i think it's easier to push the customised reboot, power off, download mode icons ... after recompilation.
Sent from my GT-I9100 using XDA Premium App
Click to expand...
Click to collapse
Ok...... But I think this could make beginners believe that this is always the case and how it should always be done. I rather teach them the right way
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...
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
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 ( ( (
* ARTICLES MADE IN MACHINE LG G3 ANDROID 4.4.2 MACHINE DO THE SAME AND FLEXIBLE THINKING.
Preparation:
computers
Preset apktool
You must know how to use apktool okay.
File LGPhone.apk and LGSystemUI.apk was taken in Rom deodex you want Mod okay.
Begin.
A. Working with files this most important LGPhone.apk okay.
1. Decompile LGPhone.apk out
2. Navigate to the path LGPhone / smali / com / android / phone
Find PhoneGlobals.smali open in Notepad + +
> Find the following keywords.
Code:
.field private final mMediaButtonReceiver:Landroid/content/BroadcastReceiver;
> Add the following line immediately below it.
Code:
.field private final mModeReceiver:Landroid/content/BroadcastReceiver;
> Find Next line after.
Code:
mReceiver:Landroid/content/BroadcastReceiver;
> Add the following line immediately below it.
Code:
.line 236
new-instance v0, Lcom/android/phone/NetworkModeReceiver;
invoke-direct {v0}, Lcom/android/phone/NetworkModeReceiver;-><init>()V
iput-object v0, p0, Lcom/android/phone/PhoneGlobals;->mModeReceiver:Landroid/content/BroadcastReceiver;
> Find next keyword.
Code:
registerReceiver(Landroid/content/BroadcastReceiver;Landroid/content/IntentFilter;)Landroid/content/Intent;
> Add the following line immediately below it.
Code:
.line 633
new-instance v0, Landroid/content/IntentFilter;
const-string v1, "com.android.phone.CHANGE_NETWORK_MODE"
invoke-direct {v0, v1}, Landroid/content/IntentFilter;-><init>(Ljava/lang/String;)V
iget-object v1, p0, Lcom/android/phone/PhoneGlobals;->mModeReceiver:Landroid/content/BroadcastReceiver;
invoke-virtual {p0, v1, v0}, Lcom/android/phone/PhoneGlobals;->registerReceiver(Landroid/content/BroadcastReceiver;Landroid/content/IntentFilter;)Landroid/content/Intent;
> Save PhoneGlobals.smali
3. NetworkModeReceiver Download this file to extract and copy all the files in the path LGPhone smali / smali / com / android / phone
4. Recompile the LGPhone.
5. Fixing what replaces it back old LGPhone.apk file.
-------- 2G/3G toggle mod Guide --------- Choimobile
B. How on LGSystemUI.apk
1. Decompile LGSystemUI.apk out
2. Navigate to the path LGSystemUI/smali/com/lge/quicksettings/
> Open QuicksettingsItemList.smali using Notepad + +
> Find and fix all the 2GOnlyHandler EcoHandler
> Save QuicksettingsItemList.smali back
3. Find LGsystemUI/res/values-xx/
> Open strings.xml by Notepad + +
> Sp_quicksettings_eco_mode_NORMAL edit> Eco mode <a> The 2G <
> Save the strings.xml
4. Find LGSystemUI/res/values
> Open bools.xml using Notepad + +
> Find eco edit keywords >false< >true< save.
5. Download the file, unzip
> Copy smali in LGSystemUI/smali/com/lge/quicksettings/handlers
> Copy image to LGSystemUI/res/drawable-xxhdpi
6. Recompile the LGSystemUI
Replace the following items in LGSystemUI/build/apk file into the root LGSystemUI.apk
- 2 image file in res/drawable-xxhdpi on LGSystemUI.apk/res/drawable-xxhdpi
- Resources.arsc on LGSystemUI.apk
- Classes.dex into LGSystemUI.apk
C. Copy LGPhone.apk and LGSystemUI.apk have to edit the system/app and set 644 memory and delete files LGPhone.odex LGSystemUI.odex go. Reboot the machine and see the results.
Note: The tutorial is done on LG G3 Android 4.4.2 on another machine thinking you have flexibility with each release and each code.
Mod Guide Choimobile 2G/3G toggle.
-Thank: chuc by choimobile.vn/forums
- source: http://choimobile.vn/threads/huong-dan-mod-toggle-2g-3g-2g-only-len-cac-may-android-lg.27391/
Great guide
Thanks
Seems not the same lines can be found on KK.
Also, LGPhone.apk is LGTeleService.apk on my ROM.
Also the lines on smali files are not totally the same.
Thanks for the guide though.
Hi, I know this is an old thread, but I was wondering if you would do "how to enable flashlight toggle"
I have a LG Gpro 240K running one of your lollipop roms. I would REALLY appreciate it.
:good::good::good::good::good:
hi please fix network toggle for lgsystemui and lgteleservice
hi please help
i can't do this changes to my rom
here is files you need
LGTeleService.apk
View attachment LGTeleService.apk
the network toggle is here but don't work ( it can't change network )
i spend a lot of time , i hope some one can fix it
actually can't understand what should i do with lgteleservice.apk ( how to add toggles to this apk?) how to add this codes to lgteleservice?
sorry for my bad english
hi please help
i can't do this changes to my rom
here is files you need
LGTeleService.apk
View attachment 4269150
the network toggle is here but don't work ( it can't change network )
i spend a lot of time , i hope some one can fix it
actually can't understand what should i do with lgteleservice.apk ( how to add toggles to this apk?) how to add this codes to lgteleservice?
sorry for my bad english
EAGLEBOOY said:
hi please help
i can't do this changes to my rom
here is files you need
LGTeleService.apk
View attachment 4269150
the network toggle is here but don't work ( it can't change network )
i spend a lot of time , i hope some one can fix it
actually can't understand what should i do with lgteleservice.apk ( how to add toggles to this apk?) how to add this codes to lgteleservice?
sorry for my bad english
Click to expand...
Click to collapse
hi i fixed it
you should change this line in build.prop
ro.build.user=cloudyfa
to
ro.build.user=matrix_neo
+++++++++++++++++++++++++++++++
this is because
in SystemUI\smali\com\lge\systemui
a file with this name "ModelFeature.smali" in lines 527 and 541
const-string v0, "matrix_neo"
const-string v0, "matrix_neo"
should same as line in build.prop
ro.build.user=*********