AndroModding - Android Q&A, Help & Troubleshooting

Requirements:
1) Have the .apk file you want to hack.
2) Have WinRar installed on your PC. (*Download WinRar 32bit*|*Download WinRar 64bit*)
3) Have .NET Reflector. (*Download .NET Reflector 9.0*)
4) Have "Reflexil", a required Plugin to hack files with .NET Reflector. (*Download Reflexil Plugin for .NET Reflector*)
5) Have an APK SIGNER. I personally use the one-click signer. (*Download one click apk signer*)
Get Ready
Let's prepare our workspace:
1) The first step is to look inside our .apk file, in order to be sure it can be hacked with this method. What we will do is to rename the apk from .apk to .zip;
2) Double click on the .zip file and you should be able to open it with WinRar. If not, make right-click and select "Open With..." and then chose "WinRar";
3) Try to go to the following location: assets/bin/Data/Managed/. If you reached it succesfully, and if you see lots of .dll files inside it then YES, you can hack this game (or you can TRY hacking it) using .NET Reflector!
4) Now, extract the whole "Managed" folder wherever you like (I personally have a folder on my Desktop I exclusively use to hack games, where I put all the softwares I need to hack them).
5) Open ".NET Reflector", move ALL THE .DLL FILES from the "Managed" folder inside it (move them in the LEFT box of Reflector).
6) Press F3, then press Ctrl+M. This will enable the Search box and set it properly for our scopes. Please note this must be done EVERY TIME you open .NET Reflector.
7) Launch Reflector (if you read the "ReadMe.txt" into the Reflexil folder of my download link above, you already know how to launch it. Otherwise, well, click on the Gear icon or go to Tools -> Reflexil and click on it)
Ok, we managed to set up everything properly and we can finally start hacking!
Let's start
So, let's read what I'll write below very carefully, since it's easy to understand if you spend enough time reading, ok?
1) The first step, after you grabbed your .apk file is to open it with WinRar (I personally rename the extension to .zip in order to open it automatically with WinRar, but you can simply do Right Click on the .apk file and select "Open With..." -> WinRar).
2) Browse to the following path, inside the WinRar window: assets/bin/data/Managed/, like the screenshot below:

3) Extract (you can simply drag them) all the .dll files of this archive into your desired folder (or, to be faster, just drag the entire "Managed" folder of the archive out of it.
4) Now, Open NET Reflector, press F3 and Ctrl+M (this must be done every time, to quickly set up NET Reflector for our usage), load the "Reflexil" plugin by clicking on the Gear icon and move all the .dll files inside .NET Reflector's window (at the left, like in the screenshot below):

Now we're ready to search, so input your desired keyword in the Search Box and edit the desired code, like in the Screenshot below. Watch it carefully:

6) To edit the code, you need to right-click on the desired instruction you want to modify and select "Edit". When you're done with edits, click on Update, like in the screenshot below:

7) Now, let's save our code. To do this, in the Left panel of .NET Reflector, scroll up until you find the name of the Assembly you modified, then do Right Click -> Reflexil -> Save, like in the screenshot below:

8) It'll add ".Patched" to the original name the of the .dll file, so you know which one is the modified and which one is the original .dll file. Now, to be sure we modified the right code, let's load again the Assembly into .NET Reflector, to see how it does look now. (this step is optional, but recommended if you're not 100% sure the hack is properly coded:

9) Ok, in my example the codes were right so we can proceed adding the modified .dll file to our original .apk file. So we open the .apk file again with WinRar and replace the original "Assembly-Csharp.dll" (or any other .dll files you modified) with the one containing ".Patched", but of course, you need to rename the file to its original name, or the game will not load. So, in my example, I renamed Assembly-Csharp.Patched.dll to Assembly-Csharp.dll in order to restore its original name.
10) Now it's time to sign it (or you can add*toast*before singning apk if you want, before signing the .apk file). So we move the modified .apk file in the same folder of the "one_click_signer.cmd" file (or, if you use another apk signer, use your method to sign it), then we open it by double-clicking it and a Command Prompt window will appear.
All we need to do is to type:
"name of the apk file.apk"
and press Enter, like in the screenshot below (don't forget the "" symbols, they are part of the code you need to write!):

11) That's it! Our MOD APK file is ready! You'll find a new .apk file in this folder, starting with "signed-". This is the signed .apk file you can finally share! But first, of course, test the game and ensure it does properly work. If yes, it means you're a good hacker and you can finally upload the .apk file to share it with everyone! If the .apk file is not properly working, or if the codes you made aren't showing, well, don't lose hope! Just try again, modifying some other offsets! Good luck!
FAQs:
If you need help, as always, reply below and I'll be glad to add further details or to give you an helping hand!*
Do you have an Int32?
You can return a value this way:
ldc.i4 -> Int32 -> Your_Value (no limits)
ret
or
ldc.i4.s -> SByte -> Your_Value (max 128)
ret
Do you have an Int64?
You can return a value this way:
ldc.i8 -> Int64 -> Your_Value
ret
Do you have a Single?
You can return a value this way:
ldc.r4 -> Single -> Your_Value
ret
Do you have a Double?
You can return a value this way:
ldc.r8 -> Double -> Your_Value
ret
Do you have a "Boolean"?
I'm used to compare "Boolean" with a question. Basically, it "asks" something to the game, and the game will answer with True (yes) or False (no).
For example: get_isVip will "ask" the game if the user is a VIP, and the game will probably answer "No, he's not a VIP!!!", so what can we do here?
We have two ways. The first (easier, but you will not learn much..) is about returning always True (yes), while the second (not alwasy applicable, but it's the "pros" way) is about making the game thing you're a VIP for real.
But first, let's explain how to return "True" or "False" in the game.
True = ldc.i4.1 (or ldc.i4 -> Int32 -> 1)*
False = ldc.i4.0 (or ldc.i4 -> Int32 -> 0)
Beware that you must always use ldc.i4 (and not ldc.r4, ldc.i8 and so on..) or the game will crash.
So, the easiest way to always return True (or False) to a Boolean is to replace the whole function with:
[TRUE]
ldc.i4.1
ret
[FALSE]
ldc.i4.0
ret
Now, let's talk about the pros' method. As we said above, it's all about making the game think you're a VIP for real, so the Boolean will naturally return a true value, even if we both know you're not a VIP for real in the game (of course I talk about VIP to make an example, you can replace the word "VIP" with anything. For example, "get_isUnlocked" or simply "IsUnlocked" is a boolean to unlock stuff in the game and so on.. it's up to you to find the right keyword to hack a value).
Sometimes, there are some "checks" to ensure if you're a VIP or not. For example, the game checks you VIP level and, if it's equal to 0 returns a false, while if it's higher than 0, it returns true.
It should look like this (very basic example) in NET Reflector decompilation window:
get_isVip {
if (this.Player.get_vipLevel) > 0*
{
return true
}
return false
}
And, in Reflexil (the plugin's window you have at the bottom) you should see something like:
0 ldarg.0
1 ldfld Player.get_vipLevel
2 ldc.i4 0
3 bge (6 -> ldc.i4.1)
4 ldc.i4.0
5 br (7 -> ret)
6 ldc.i4.1
7 ret
Now, it's not that hard to understand what Reflexil says. Let's compare the text with the NET Reflector's decompiled code:
ldarg.0 -> "this."
ldfld -> loads the value, in particular, the one about the Player's vip Level
ldc.i4 0 -> it means 0, referring to the player's vip level
bge (6 -> ldc.i4.1) -> it means "branch if greather than". This means, if the Player's vip Level (ldarg.0 + ldfld) is greather than 0 (ldc.i4 0), the function will jump to the sixth function (ldc.i4.1 which means true)
ldc.i4.0 -> which means false. If the function didn't jump to the ldc.i4.1, the game will return this value (false) so the player will not be a VIP
br (7 -> ret) -> this will jump to the 7th function, which is the "ret". Of course, after returning the false, the function needs to close itself, so it'll jump to the "ret" at the end of it.
ldc.i4.1 -> this means true and it's called by the "bge" we've seen above. This is the only way this value is called so, if the player value is higher than 0, this will be the next value returned = the Player IS a VIP.
ret -> You know better than me that "ret" ends the function. Remember EVERY function in the game must end with "ret" or the game will not work properly.
So, after this long and boring lesson, what's the pros' way to hack this?
The answer is in your brain. If the player vip level is higher than 0, the player will be a VIP so what will we do? Of course, we'll hack the player vip level! How? Simply look for "get_vipLevel" (please note this is just an example, it doesn't apply to any particular games and the keyword could change) and it'll probably be an Int32 so you'll simply replace its whole function to:
ldc.i4 -> Int32 -> 15 (for example, as most games with the VIP interface caps the VIP level at 15, while some other have got 10 as VIP level's cap)
ret
This will not only automatically enable your VIP membership, but it will also give you a VIP level = 15.
Please note, even if we manage to hack the VIP level in particular, some online games will still NOT give you the privileges of the VIP membership, or you will get only some of them. Why? Because sometimes the vip level in online games is managed by the server, so you could be the only one seeing you're a VIP member, while all the other people will see you're NOT a VIP member, because you're not a VIP for the server. So, if this value is server-sided, you may still not be able to get your vip privileges with this hack.
How to multiply a value?
Easy, you have to add the number you want to multiply the value with followed by "mul", before the "ret" or, to be more precise, after the function returns the value you want to hack.
Example:
ldarg.0 (which means "this.")
ldfld Player::get_money
ldc.i4 (or ldc.i8, or ldc.r4, or ldc.r8. Which one? See my above examples) -> Int32 (or Int64, or Single, or Double. Which one? See my above examples) -> Your_Value
mul
ret
Sometimes the function returns different values if different events occur, so it could be necessary to multiply more values.
How to divide/subtract/add a value?
It's the same as before, you just need to use "div" (or "sub" or "add") and not "mul" (div = divide, mul = multiply, sub = subtract, add = add).
What's the difference between multiplying something and simply returning 9999999?
The main difference is that returning 9999999 will give a STATIC value. It will never decrease/increase, while multiplying (or adding) a value will give a DYNAMIC value, so you can run out of money, but you theorically also have a lower ban chance. Don't think about 9999999 only when talking about money. This could be HP or Damage or XP and so on..
We are Cracker.

Help
Hey I’m new to this. I was wondering if there is another method to this because my game doesn’t have the dll files there. It has some folders such as meta data. Thanks

So i modded a dll from a multiplatform .NET app and it works fine when using it on PC. But when placing it in the app, all i get is a black screen.

Related

Formatting your phone book to work with facebook sync

In the spirit of xmas, i figured i'd try & contribute something to the community
I just upgraded to the new Energyrom with sense 2.5, and noticed that it will search your facebook for people that match contacts, and give you the option to sync certain info with your phone, ie, pictures.
Problem is, if you're anything like me, your contacts aren't exactly in WinMo-friendly format. Specifically, it'll only sync contacts where the first & last name are in separate fields. Having just imported my contacts from an old phone via sim card to my raphael, this was not the case.
Anyway, here's how to fix it (note that if you do this, it will overwrite any photos you may have on contacts with their facebook photos. The solution to this is to, when your phone asks if you want to link facebook profiles with contacts, deselect the names of people whose pictures you'd like to keep.
Step 1: Sync your contacts with outlook, then go to Contacts in outlook
Step 2: In outlook, go to file->import/export
Step 3: Click Export to a File and click next
Step 4: Click Microsoft Excel 97-2003, click next
Step 5: click contacts, click next
Step 6:Select a destination file and click next until that process is finished
Now open Excel
Step 1: highlight the column with your full names
Step 2: Click the Data tab, click Text to Clumns
Step 3: Click next
Step 4: Deselect all delimiters except Space
Step 5: Click next until finished
This will split off all of your last names into the next column. Do any necessary tidying up by hand until you have two clear columns with first/last name. This might be a good time to remove duplicates, the function right next to the Text to Columns function in the data tab.
Save your excel file.
Now back to Outlook
Step 1: Go to contacts, delete all of your contacts
Step 2: File -> import/export
Step 3: Import from another program or file, click next
Step 4: select Microsoft Excel 97-2003
Step 5: make sure "File to Import" is the file you just finished
Step 6: Your call on duplicates, shouldn't matter. Click through until finished
Okay, now just resynch with your phone.
If your having the problem of all your contacts filed as Last, First, follow these steps:
(note: i didn't write this code, but i forgot at what site i found it, so i'm not giving credit where it's due... if you're curious, just google it)
Step 1: Press alt+f11
Step 2: In projects window, go to ThisOutlookSession
Step 3: Paste the code below
Step 4: Uncomment the strFileAs line that you want to format your contacts as
Step 5: close VB editor
Step 6: Go to tools -> macros -> macros
Step 7: Run your new macro. voila.
Code:
Public Sub ChangeFileAs()
Dim objOL As Outlook.Application
Dim objNS As Outlook.NameSpace
Dim objContact As Outlook.ContactItem
Dim objItems As Outlook.Items
Dim objContactsFolder As Outlook.MAPIFolder
Dim obj As Object
Dim strFirstName As String
Dim strLastName As String
Dim strFileAs As String
On Error Resume Next
Set objOL = CreateObject("Outlook.Application")
Set objNS = objOL.GetNamespace("MAPI")
Set objContactsFolder = objNS.GetDefaultFolder(olFolderContacts)
Set objItems = objContactsFolder.Items
For Each obj In objItems
'Test for contact and not distribution list
If obj.Class = olContact Then
Set objContact = obj
With objContact
' Uncomment the strFileAs line for the desired format
'Lastname, Firstname (Company) format
' strFileAs = .FullNameAndCompany
'Firstname Lastname format
' strFileAs = .FullName
'Lastname, Firstname format
' strFileAs = .LastNameAndFirstName
'Company name only
' strFileAs = .CompanyName
'Companyname (Lastname, Firstname)
' strFileAs = .CompanyAndFullName
.FileAs = strFileAs
.Save
End With
End If
Err.Clear
Next
Set objOL = Nothing
Set objNS = Nothing
Set obj = Nothing
Set objContact = Nothing
Set objItems = Nothing
Set objContactsFolder = Nothing
End Sub
Great POST and clearly layed out.
After reading this I dicided to do this but then found out how terribly I name my contacts, nick names etc.
After I had sorted out all the contacts with there right name and re-synced my contacts back to my phone (you might want to mention this in your first POST) that you will loose any pictures you had associated with the contacts (other than the facebook ones), but this is ok because they will be replaced by the new facebook ones but there are still some people in this world that dont have a Facebook account (cave dwellers etc (Joking)) that I had photo's attached to that are now gone&I dont have a seperate copy (its ok I did backup before I attempted this so I could get them back if I wanted).
After I have sync back I remebered why I never did this before, thats because if you put the names in the right sections then in your contacts on your phone you get the lastname first e.g instead of 'John Smith' you get 'Smith, John' which is a horrible way to view them.
I will continue to find a solution and let you know here if I find an answer.
Thank you again
Install and run this on your PPC and it will convert all your contacts to First, Last format.
Shubaroo Contact Changer
jab1a said:
Great POST and clearly layed out.
(you might want to mention this in your first POST) that you will loose any pictures you had associated with the contacts (other than the facebook ones),
Click to expand...
Click to collapse
Added, thanks
jab1a said:
After I have sync back I remebered why I never did this before, thats because if you put the names in the right sections then in your contacts on your phone you get the lastname first e.g instead of 'John Smith' you get 'Smith, John' which is a horrible way to view them.
Click to expand...
Click to collapse
This is covered by the last portion of my post. If you can convert all contacts to "file as:" in the first last format, they will sync to your phone that way. How it displays is contingent upon a setting in each contact, not your phone or anything. Running that VB macro will convert each contact to the format you're looking for, let me know if you have a problem!

[TUT]How to remove the 01:02 flip in Manila 2.5 properly and how to make CDMA SMS fix

Part 1 - How to remove 01:02 flip:
I write this manual because I find there are people using wrong way to get rid of this nasty "feature", which will cause clock stuck or Manila starts with 0:00AM. Here I provide a proper way to remove this "feature":
1. Download LuaTool(Thanks Co0kieMonster), and make sure you know how to use Command Line.
2. Grab 5fa4d4b7_manila from Manila Home to the same folder as LuaTool.
3. Open Command Line, input "LuaTool /decompile 5fa4d4b7_manila"(without the quotes) and enter. You may not get 100% sucess rate but that's okay.
4. Open 5fa4d4b7_manila.lua that just generated by LuaTool, search for "DoFlip", and you will find something like this:
Code:
Below comes from Manila_Home_2_5_20111612_0, other versions may differ:
local l_28_0 = _application.Store:GetIntValue(Lifetime_Application, "ShowCacheHomePage")
if l_28_0 == 1 then
if _TickControlForClock:CheckBoundary() then
ClockHelper:DoFlip()
else
ClockHelper:SetTimeInstantly()
end
else
local l_28_1 = _application.Store:GetIntValue(Lifetime_Application, "AnimationForHomeKey")
if l_28_1 == 1 then
if _TickControlForClock:CheckBoundary() then
ClockHelper:DoFlip()
else
ClockHelper:SetTimeInstantly()
end
end
end
Simply replace all those "DoFlip" with "SetTimeInstantly", or you can reconstruct the code structure like below:
Code:
local l_28_0 = _application.Store:GetIntValue(Lifetime_Application, "ShowCacheHomePage")
if l_28_0 == 1 then
ClockHelper:SetTimeInstantly()
else
local l_28_1 = _application.Store:GetIntValue(Lifetime_Application, "AnimationForHomeKey")
if l_28_1 == 1 then
ClockHelper:SetTimeInstantly()
end
end
This can reduce internal operations in Manila.
5. After editing the code, save the file and in the Command Line, input "LuaTool /compile -s -r n 5fa4d4b7_manila 5fa4d4b7_manila.lua"(this "n" should be the function number of the edited function. In this example, it's 28) and enter.
6. Overwrite the original 5fa4d4b7_manila with the edited one.
Part 2 - How to make a CDMA SMS fix for Manila 2.5:
This fix can fix the SIM error when you send a SMS from a CDMA2000 phone in Manila 2.5 Classic Messaging Page. To enable Classic Messaging Page, import these registry keys:
Code:
[HKEY_CURRENT_USER\Software\HTC\Manila]
"Manila://PeopleDetail\\peopleMessageClassic.page.hidden"=dword:0
"Manila://PeopleDetail_SIM\\peopleMessageClassic.page.hidden"=dword:0
"Manila://PeopleDetail\\peopleMessage.page.hidden"=dword:2
"Manila://PeopleDetail_SIM\\peopleMessage.page.hidden"=dword:2
Then let's start making this fix:
1. Download LuaTool(Thanks Co0kieMonster), and make sure you know how to use Command Line.
2. Grab 57a92846_manila from Manila People to the same folder as LuaTool.
3. Open Command Line, input "LuaTool /decompile 57a92846_manila"(without the quotes) and enter. You may not get 100% sucess rate but that's okay.
4. Open 57a92846_manila.lua that just generated by LuaTool, search for "SIM", and you will find something like this:
Code:
if not l_43_2.bIsSIMPresent then
trace("[peopleMessage.lua] : SIM is not present")
ShowDialog(Locale:GetString("IDS_NOSIMCARD"), Locale:GetString("IDS_NOSIMCARD_DESP"), "OK")
return
end
and this:
Code:
if not l_43_2.bIsSIMReady then
trace("[peopleMessage.lua] : SIM is not ready")
l_43_2:OpenPINCodeDialog()
return
end
Simply delete these two part of code.
5. After editing the code, save the file and in the Command Line, input "LuaTool /compile -s -r n 57a92846_manila 57a92846_manila.lua"(this "n" should be the function number of the edited function. In this example, it's 43) and enter.
6. Overwrite the original 57a92846_manila with the edited one.

[IMEI] IMEI Generator

Current version: !IMEIme 2.2.0.4
Bug Fix
Fixed bug in use previous patch that could result in variable used before declared error.
Changed processing order when custom patches were to be used
The program will now process custom patches prior to editing framework.jar and build.prop edits. With new kernel patches requiring a new build.prop users would lose build.prop edits if the kernel was included in custom patches, the program will now patch any user modifications, then process IMEI generation and build.prop edits.
Updated to work with ROMs that do not include GSMPhone.smali
Recently, many ROMs are not including GSM phone utilities in framework.jar. I have added testing for missing GSMPhone.smali and patching via TelephonyManager.smali if necessary.
UPDATED FILES UPLOADED
MANY of the support files have been updated to the newer versions (smali, baksmali, adb and components).
I encourage you to delete all files in your existing IMEI Generator folder and use the new !IMEIMe.exe to generate the files necessary.
The devices.dat file if you've used the previous version has several issues that prevents the device model from being correctly patched on many of the devices. This has been fixed here and in the device list thread.
There is a known issue with the GUI when your screen settings are set at 125% in Control Panel - Appearance and Personalization - Display... I will work on fixing that in the next release.
Bug reporting thread for !IMEIme
Device list thread
New features:
Will patch GSMPhone.smali if present in framework... patches TelephonyManager.smali otherwise.
I chose this method since more ROMs are coming out for wifi tablets that do not have GSM phone information included in framework.jar. I was playing with CM10.1 and discovered GSMPhone.smali is not present, thus I was getting unable to patch GSMPhone.smali error, and there was no patching for an IMEI. In all honesty... this should be irrelevent, since IMEI is only utilized in cellular communications on GSM phones... however... some applications MAY (xda free does) require an IMEI to work, even on wifi only devices.
ODEX files still in the works
odex file support... I think this solution will work on odex file systems as long as the patching is done on the ROM prior to flashing to device (anyone using odexed system please let us know) and I am working on in place patching on odexed systems... however, I am not completely comfortable since there is a lot of work done by the device itself during odexing of the modified files... I am very hesitant since any mistake could render a bricked device and I don't have a system to test with prior to release.
Previous Important Changes
The new version of the IMEI Generator will no longer overwrite your existing devices.dat file with the current. To use new devices.dat file, delete the old one prior to running the program, or download the new one and unzip it in the IMEI Generator directory.
Device Communications not necessary in certain situations
If you select to Update ROM, using Serial Number based IMEI and do not select Encrypt IMEI, the program will no longer need to communicate with the device when performing its tasks. The framework.jar patch will not hard patch the IMEI in this situation as before. This is useful for patching a ROM for distribution to multiple people, since they will all maintain unique IMEI's. This is accomplished with the following change in the framework.jar
Code:
/com/android/internal/telephony/gsm/GSMPhone.smali
.method public getDeviceId()Ljava/lang/String;
[b]changed[/b] iget-object v0, p0, Lcom/android/internal/telephony/gsm/GSMPhone;->mImei:Ljava/lang/String;
[b]to[/b] sget-object v1, Landroid/os/Build;->SERIAL:Ljava/lang/String;
prior to patching in code to prepend "0"
.method public getDeviceSvn()Ljava/lang/String;
[b]changed[/b] iget-object v0, p0, Lcom/android/internal/telephony/gsm/GSMPhone;->mImeiSv:Ljava/lang/String;
[b]to[/b] sget-object v1, Landroid/os/Build;->SERIAL:Ljava/lang/String;
prior to patching in code to prepend "0"
To try to explain the above a little...
The above is always changed, no matter what IMEI generation method you select...
If you select Serial Number and New Type IMEI and not Encrypt: no other patching is done for the IMEI... this can be implemented on many devices, since each will have a unique serial number.
If you select Serial Number and do not select New Type: additional code is added to format the IMEI to the old standard ("00-" and "-"s)... this can be implemented on many devices for same reason.
If you select MAC Address or Encrypt (or both): additional code is added that results in the IMEI being hard coded, this makes it very much device specific.
If you select MAC Address or Encrypt (or both) and do not select New Type: additional code is added that results in the IMEI being hard coded as well as code to format the IMEI, this makes it very much device specific.
Use Custom Patch NOTE: This is only used when patching a ROM
This is going to take some major explanation, since I ran into so many possible scenarios...
One thing of note... the only additional lines added to updater-script will be for files in the base directory
The order of processing is:
1. Original ROM updater-script and files
2. Custom Patch zip file
3. Custom Patch folder
The program will utilize folders (from Patch zip file or Patch folder itself) named modboot, modsys, or system (not case sensitive in windows) as well as files in the base folder
Any files in modboot will be moved to the root of the **ROM**-IMEI.zip file and lines added to updater-script as needed
Any files in modsys will be moved to the system directory of the **ROM**-IMEI.zip file
If Custom Patch is checked...
/META-INF/com/google/android/updater-script is extracted from the ROM
the program will ask you to select the Custom Patch Folder
If there is a zip file present in the folder the program will ask if you want to use it
You have 3 options, "Yes", "No" or "Cancel"
Yes = Use the zip file
No = Don't use it, select another
Cancel = Don't use a zip file
If you use a zip file, it will extract the zip file and process the updater-script in it for any additional lines needed
After the above, any non-zip files and modboot, modsys and system directories in the Patch Folder will be processed
I chose this order so you can have a "go to" patch zip file, and test other additions by using the file, folder options prior to including them in the zip.
Example here:
I have my custom patches in folder /CM7/UserMods with these contents:
/META-INF
/modboot
/modsys
patch.zip
The program processes patch.zip first, then overwrites any files with the files in modboot and modsys
It also processes /META-INF/com/google/android/updater-script for any lines extracting files to /boot and adds them to the original ROM updater-script if not already there.
It then adds lines for any files originally in /modboot to updater-script to extract them to /boot
"New IMEI Type" of IMEI which no longer has the "-"s in it, but maintain backward compatibility for those who already have IMEI's generated or prefer the old style. When the new type is selected in the GUI:
NOTE: Per the IMEI standards... Using a single 0 prepended to the IMEI indicates a TEST IMEI for a country with 3 digit international code... while it should have no implications to us since we are not on a cell... it may provide potential country validity issues... I will monitor this and resort to 00 prefix in the new type of IMEI if necessary.
ADDITIONAL NOTE: Per the IMEI standards... For devices without an IMEI, they are to provide a unique serial number to be used... This program modifies framework.jar to allow this.
I am now patching framework.jar in the /com/android/internal/telephony/gsm/GSMPhone.smali file instead of /android/telephony/TelephonyManager.smali (this change is what allows the information to display in the about tablet information)
I am renaming and patching 2 functions... getDeviceID() and getDeviceSvn()
By patching the two functions in this file... the IMEI now shows in Settings... About Tablet... Status... no longer have to use external program or dial *#06# to verify the device is patched.
getDeviceID() shows it in IMEI
getDeviceSvn() shows it in IMEI SVN
You can rename or copy !IMEIme.ini to IMEIme.ini and the program will work.... useful for *nix users and probably mac users... since they have issues with special char actors (!)... While I like to use it in windows to keep the executable and ini file at the top of the file list in windows explorer... anyway...
The program looks for IMEIme.ini first and uses it if present... if it is not... it then looks for !IMEIme.ini (which will be there... because the program installs the generic !IMEIme.ini if it isn't ) This also provides a good way to keep your ini.. and see the new settings in the compiled in ini.
GUI selection and related ini setting
GUI: New IMEI Type
INI Setting:
New_Type =
; If 0 then the old type of "00-XXXXXX-YYYYYY-ZZZ" will be used
; If 1 then the new type of "00XXXXXXYYYYYYZZZ" will be used
BUG FIX
No known or reported bugs to work out.
!IMEIme.ini file default settings and explanation:
Code:
;The setting options are 1 (use the option) or 0 (don't use the option)
;WiFi IP Address can be set to your Nook's IP address here to a default to use
;IMEI can be set to a default here... you can also set the seed you use for generation
;Setting Device_Manufacturer to anything will result in an edit to build.prop setting the entered manufacturer
;IF Device_Manufacturer is NOT blank then:
;Setting Manufacturer_Device to anything will result in an edit to build.prop setting the entered device
;
;NOTE: ONLY Device_Manufacturer is necessary for this edit... there have been no software that appears to
; require a device edit
;
;Setting LCD_Density will result in build.prop edit for this setting regardless of Device_Manufacturer setting
;
;Set all options in [Settings] section at the bottom
[Settings_Explained]
Use_In_Place = 1
; If 0 Disable In Place patching... useful for those who always update AOSP ROM files and never patches on device framework.jar
; If 1 Enables In Place patching if ADB is working
Use_Previous_Patch = 0
; If 0 Ignore IMEI.fix
; If 1 AND IMEI.fix exists... use it for patching
Use_Serial_Number = 1
; If 0 then do not base IMEI off of Device Serial Number
; If 1 then base IMEI off of Device Serial Number
; NOTE: This takes priority over Use_MAC_Address
Use_MAC_Address = 0
; If 0 then do not base IMEI off of Device MAC Address
; If 1 then base IMEI off of of DeOvice MAC Address (last 5 hex words) (2 bytes = 1 hex word)
; 0A is converted to 010, FF is converted to 255 etc.
; NOTE: Use_Serial_Number takes priority
Use_Manual_Input = 1
; If 0 then Manual Input disabled
; If 1 then Manual Input enabled
Encrypt_IMEI = 1
; If 0 then uses actual data for IMEI... i.e. Serial Number (last 15 digits) or MAC Address (last 5 hex words) is actual IMEI
; If 1 then program encrypts data for IMEI generation... hiding actual Device data
New_Type = 1
; If 0 then the old type of "00-XXXXXX-YYYYYY-ZZZ" will be used
; If 1 then the new type of "00XXXXXXYYYYYYZZZ" will be used
Use_ADB = 1
; If 0 then ADB is disabled... this will prevent In-Place updating from working all together
; If 1 then ADB is enabled... In-Place will work... IF adb is working on your device
; NOTE: This takes priority over Use_ADB(usb) and Use_ADB(WiFi)
Use_ADB(usb) = 1
; If 0 then ADB via USB connection is disabled... I use this since some ROM's have Debug Mode issues
; If 1 then ADB via USB is enabled and attempted first
; NOTE: Use_ADB takes priority over Use_ADB(usb) and Use_ADB(WiFi)
Use_ADB(WiFi) = 1
; If 0 then ADB via WiFi connection is disabled
; If 1 then ADB via WiFi is enabled... I use this since some ROM's have Debug Mode issues
; NOTE: Use_ADB takes priority over Use_ADB(usb) and Use_ADB(WiFi)
Clean_Up = 1
; If 0 then the program will leave all support files when cleaning up and exiting
; If 1 then the program will delete all support files when cleaning up and exiting if none of them
; existed at program start
Include_Patch = 0
; If 0 then custom patches is disabled
; If 1 then the program will prompt for custom patches to include
Device_Manufacturer =
; If blank then the program will not edit build.prop
; If anything other than blank the program will edit build.prop to include manufacturer
Manufacturer_Device =
; If blank then the program will not include device in build.prop edit
; IF anything other than blank the program will include device in build.prop edit
; NOTE: No build.prop edit will occur if Device_Manufacturer is blank
Device_Model =
; If blank then the program will not include model in build.prop edit
; IF anything other than blank the program will include model in build.prop edit
; NOTE: No build.prop edit will occur if Device_Manufacturer is blank
Build_Fingerprint =
; If blank then the program will not include Build Fingerprint in build.prop edit
; IF anything other than blank the program will include Build Fingerprint in build.prop edit
; NOTE: This edit will occur even if Device_Manufacturer is blank
LCD_Density =
; If blank then the program will not include LCD Density in build.prop edit
; IF anything other than blank the program will include LCD Density in build.prop edit
; NOTE: This edit will occur even if Device_Manufacturer is blank
WiFi_IP_Address =
; You can enter the default Device IP address here... especially useful if you are only using this on one device...
; or if you keep seperate folders for each device you use (!IMEIme.exe and !IMEIme.ini must be in each folder)...
; i.e. folder for "sister" containing the program and ini file at minimum.
; If blank the program will prompt you for the IP address of the device to establish ADB WiFi connection
IMEI =
; Enter a base 10 (integer) and it will be used as the IMEI (duplicated until 15 digits is reached)
; Enter your "seed" and the program will generate an IMEI based off of it
; NOTE: If you try to generate the old GENERIC IMEI the program will not do it
[Settings]
Use_In_Place = 0
Use_Previous_Patch = 0
Use_Serial_Number = 1
Use_MAC_Address = 0
Use_Manual_Input = 1
Encrypt_IMEI = 0
New_Type = 1
Use_IMEI(15) = 0
Use_ADB = 1
Use_ADB(usb) = 1
Use_ADB(WiFi) = 1
Clean_Up = 1
Include_Patch = 1
Device_Manufacturer =
Manufacturer_Device =
Device_Model =
Build_Fingerprint =
LCD_Density =
WiFi_IP_Address =
IMEI =
Credits:
mthe0ry: Credit for the original IMEI patches released for us Nookers(TM). His original thread is here...
martian21: Took mthe0ry's work and maintained it for releases of CM7, upeating it for each nightly that needed a new one. Martian21's thread.
HacDan on irc.freenodes.net #nookcolor for helping me figure out patching GSMphone.smali instead of TelephonyManager.smali
Thank you's:
paleh0rse: I believe was the first to download and test this program... I think the first bug report too... helped many users with suggestions regarding their apps.
mr_fosi: Continues testing and reporting despite no need to. Tested a few private beta builds to help iron out a significant issue. Also providing information regarding Phone App *#06# IMEI test.
martian21: Set the wheels turning. Provides invaluable feedback and suggestions. He is an invaluable tester and Q&A guy. Thanks for dangling that bait
mellopete: Provided the very first bug report... prompted me to include necessary files in the program itself.
TheMainCat, 12paq and frankusb: Provided bug reports leading me to look at why some Windows versions didn't run the program initially.
Nayla1977: Bug report regarding a mistyped EndIf in my source.
jdexheimer: Bug report that lead me to find a problem with folders with spaces in them.
LinuxParadigm: Bug report regarding missmatching If - EndIf's.
BitingChaos: first public post to get me back on target.
dillweed, garrisj and many others: for PM's indicating the importance of this solution.
lemdaddy for reporting the bug that we tracked down to the java version and reporting back that it was the java version causing issues.
adusumilli for reporting the bug where IMEI was generated as "00-cat: c-an't o-pen"
topcaser for being persistent enough with the bug causing In-Place to fail in certain situations.
HacDan on IRC for leading me in the right direction to impliment the patching of GSMphone.smali.
We are all adults, if we break our toys... we only have ourselves to blame and we may have to buy new ones... (this will NOT break your Nook... I PROMISE you that! but it may break some of your apps... more on that later in post)
BUG REPORTING:
This program was initially ineteded to generate a unique IMEI based on your device S/N and update Dev's install zip files... it has become so much more, and as such there are many functions involved in this process.
Due to the complexity the program has taken on... far beyond what I initially intended... to report bugs please try to use the following as a template:
Function attempting: i.e. Updating ROM... In Place Upgrade... Update framwork saved on computer... etc.
Error Messages: any error message you receive... or the last message you saw prior to the issue.
End result: i.e. GSMphone.smali updated, ROM not... GSMphone.smali updated framework.jar not... etc....
Environment: ROM in same folder as IMEIme.exe... ROM on same drive as IMEIme.exe... ROM on different drive... etc. (same for framework if updating framework instead)
!IMEIme.ini settings: you can put your entire ini file if you'd like.
If you could take notes of EXACTLY what which selection in the GUI you have selected and any buttons you click on which prompt it would be EXTREMELY helpful...
As I said, this program has taken on functions I initially had not imagined including... the more features added, the more complex testing and tracking bugs becomes... I don't want to include a bunch of messages just for the sake of letting you know where in the code you are... would not be beneficial to you... more buttons to click for no reason, etc.
The more detailed you can be, the quicker I can see what is happening... otherwise I have to try to duplicate what I think you are doing when you get the error.
mr_fosi and martian21 have been very tedious in reporting bugs... I greatly appreciate their testing despite not needing to, and the manner in which they document what is going on....
Everyone should click "Thanks" on their bug report posts... they have been instrumental in getting the program where it is so far.
Background:
Some developers require a unique number that is supposed to be provided by hardware manufacturers that is unique to every device. This unique number (IMEI) is extremely important in devices utilizing cellular communications.
Since B&N has not registered IMEI numbers for the Nooks, the AOS's we are using do not acquire it as they do in other Android devices.
The developers that require a unique IMEI have been less than receptive of our devices and past methods to provide functionality to utilize their apps.
I decided to provide what I believe to be a viable solution to this problem.
What this program is:
It is a method to provide a unique IMEI (with reasonable certainty) for our Nooks.
It IS intended to be a supplement until IMEI is addressed in dev's ROM's.
It IS viable for Froyo... CM7... CM9... CM10...Honeycomb... MIUI.... AOKP... and others.
I can't think of any reason it will not work with ANY ROM you choose to utilize... if you run across one... just let me know and I'll see if I can't fix that.
What this program is not and does not do:
This is not a perfect solution to our Nook specific issues. Let me make it PERFECTLY CLEAR there is NO PERFECT SOLUTION We are generating an IMEI from something else... I use TEST IMEI patterns based off of our device serial number, to ensure apk devs wouldn't come down on us.
It is not targeting any specific AOS.
It is not guaranteed to be accepted by any other developers.
It is not intended to be the end all, beat all solution.
It is not intended to dissuade other developers from providing what they feel is a better method.
It will not cause any programs to show in the market. That has to be dealt with via APK developers and/or build.prop Manufacturer strings.
Potential issues:
There is NO legitimate solution to the IMEI issue we Nookers (TM) face... unless a group desires to register a block of them for our use... thus I am generating TEST IMEI's... ideal... no, but the only method available to us.
While I feel, with significant certainty, there will be no negative consequences from apk devs in general, I cannot speak for them, or their logic. This can easily be disabled by them again. That is on them, not me or us. By the same token, they can decide to stop providing their service for cause, I still have no control over that.
Above, I emphasize “with reasonable certainty” due to the fact that, in theory, you can wind up with an IMEI that 9 other Nooks that use this software has. That can only happen if the other 9 owners use this program and have a serial number within the same 10 as yours. This is even less likely with the New IMEI Type since it is using the right most 16 digits of a device serial number (and we know they all start with 2)
If everyone who has the same beginning 15 digits utilizes this program to generate an IMEI, you will all wind up with the same IMEI. Given the number of Nooks out there compared to the number of user's hacking them.... I find it extremely difficult to believe, with a reasonable certainty, that any 2 (much less 10) devices would ever wind up with the same IMEI generated by this program. This is prevented when using the New IMEI Type
What this program does/is capable of:
It allows you to extract framework.jar from a developers update zip file.
It will allow you to pull framework.jar from your Nook or use an existing framework.jar already stored on your computer.
It will generate an IMEI based on your Nook's serial number (or MAC Address) if adb is working on your system. If you have issues running adb via USB (ADB(USB)), it provides the opportunity to utilize adb via WiFi (ADB(WiFi)) for any computer-device communications.
It will provide you a method to manually input your serial number if you cannot connect to the device via adb. You can also input a “seed” (easy to remember word or phrase) and generate an IMEI based on the ASCII codes of the text you enter.
It will edit /com/android/internal/telephony/gsm/GSMPhone.smali to rename any existing getDeviceId() and getDeviceSvn() function to getDeviceId2() getDeviceSvn2() and append the patch to end of that file. NOTE: When the program "smali's" the resulting GSMphone.smali... it relocates the appended function to be before the renamed function.
It will save the patch as IMEI.fix, thus allowing you to utilize it for subsequent runs of the program. A caveat to this is... if you run it from the same folder on a friend's Nook... it will overwrite your original one if it is in the same folder or they will have the same IMEI as you do if you use Previous Run.
It will offer to push the patched framework.jar to your Nook... IF you opted to pull framework.jar from your Nook AND adb successfully worked to do that. This facilates in place upgrading.
It will backup the existing developers zip file appending “-IMEI” to it, distinguishing it is one this program has been used on. It will update this file, not the original developers file.
If there are issues with file names that become duplicate in a case insensitive OS such that windows is, it will warn you of this case and not remove the updated framework.jar to facilitate manual updating of the zip file.
Caveats:
This program is known to work on Java version 1.6.0_23 and known NOT to work on version 1.6.0_17 or earlier. If your system seems to work fine... but the nook does not give you an IMEI number... check your java version by typing this in a DOS window (start-run and type in cmd):
java -version
this will tell you the version of java you are running.
Java must be on your system. It must be in your system's path statement, or this program must be in the java/bin folder. It is possible that you must have java 32 bit version, this is being researched.
It will very likely break your swype, or any other app that utilizes IMEI for validation and you have used previous methods to circumvent their validation process.
It will likely break the same software if/when developers include a fix to the Nook IMEI situation in their AOS. Unless you opt to use this method again on their AOS to ensure you maintain the IMEI you used my program to generate.
Since I have opted to utilize test formed IMEI's to prevent duplicating someone's “real device” IMEI, software developers can easily shut us down again. That is their option. I am trying to provide a solution that is acceptable to both sides of the fence.
Closing statement:
As I desire to make this program as beneficial as possible... PLEASE provide any feedback and/or bug reports... just don't continue to push your ideals once it has been discussed... beating dead horses gets tiresome and just wastes precious time.
112 downloads of 2.2.0.3 with bug when pervious fix was selected
1686 downloads of 2.2.0.2 with no bugs reported
141 downloads of 2.2.0.1 with CM10 in place bug that would cause BBSOB and never boot
197 downloads of 2.2.0.0 (that actually appeared to be 2.1.0.4 in the zip) with a few minor bugs... mostly in custom patching
648 downloads of 2.1.0.3 with known GT for GameLoft issues
1123 downloads of 2.1 with no known bugs
182 downloads of 2.0a with a Generic IMEI bug
1919 downloads of 1.9 with no bug reports
3131 downloads of 1.8 with all bug reports being for non-nook devices
80 downloads of 1.7 with no bug reports
600 downloads of 1.6 with a couple of reports of In-Place update bug
880 downloads of 1.5a with 0 bug reports
148 downloads of 1.5 with a bug that could result in IMEI being generated without being properly formed.
36 downloads of 1.4 with a bug that could result in IMEI of "cat: can't open".
258 downloads of 1.3 with 0 bug reports... time to move on with next feature.
1618 downloads of 1.1 and the only bug noted has been tracked to the user's Java version.
12,758 downloads prior to the current version.
Bug reporting thread for !IMEIme
Device list thread
Looks like I have something new to mess with tomorrow night... thanks for working this, we owe ya!
Been looking forward to this! Thanks for your hard work DizzyDen.
Tested it out however it isn't finding 7zip. I've tried both the 64-bit and the 32-bit version (on 64-bit Windows 7). I'm probably doing something wrong if so please feel free to enlighten me
Martian21
martian21 said:
Been looking forward to this! Thanks for your hard work DizzyDen.
Tested it out however it isn't finding 7zip. I've tried both the 64-bit and the 32-bit version (on 64-bit Windows 7). I'm probably doing something wrong if so please feel free to enlighten me
Martian21
Click to expand...
Click to collapse
It wasn't you... there's something weird with the API to the fileopendialog that changes the working directory... a TEMPORARY work around is to copy the zip file to the folder you are running the program from.
Updating to beta 2 to auto extract support files on run.
Beta 2 is up... OP updated... note the bold text... for now the zip file must be in the same folder as IMEIme.exe
That will be fixed shortly.
Updated to beta 3. OP updated.
Fixed file browse for update file.
Improved cleanup behind itself before exiting...
removes helper files
removes framework.jar
removes classes.dex
removes out folder
removes system folder (the one used to add framework.jar to the zip file)
Still debating ability to allow manual input of the IMEI or a serial number... but those that want to do it will probably figure out how to do it manually... its REALLY not that hard.
Will add random IMEI generation as an option. The only purpose I see for this is for those who don't want to use the generic IMEI and cannot get adb working... even with the included adb in this program.
Feedback and bug reports are welcome and will help improve the program.
Thank you for this
I had to copy my AdbWinApi.dll for it to work. It did not put the new framework.jar in the zip though. It made the files, but didn't update the zip. I moved it to the root of my drive and ran it as administrator, but it still didn't update the zip. I am using Windows 7 x64. I used the IMEI.fix file and updated the zip myself. Thanks again for this nice tool.
mellopete said:
I had to copy my AdbWinApi.dll for it to work. It did not put the new framework.jar in the zip though. It made the files, but didn't update the zip. I moved it to the root of my drive and ran it as administrator, but it still didn't update the zip. I am using Windows 7 x64. I used the IMEI.fix file and updated the zip myself. Thanks again for this nice tool.
Click to expand...
Click to collapse
Did you use something prior to b3 ?
There was an issue I discovered that was preventing appending IMEI.fix to TelephoneProvider.smali that was fixed in b3.
I did my development on windows64 so that shouldn't be an issue.
As for the dll... I hadn't experience issues with that... but I can certainly add it to the program.
Both adb dll's will be included in all releases after b3.
Good job!
Can you explain more about how rom is being affected?and what to check?
Sent from my phiremod for Nook using Tapatalk
DizzyDen said:
Did you use something prior to b3 ?
There was an issue I discovered that was preventing appending IMEI.fix to TelephoneProvider.smali that was fixed in b3.
I did my development on windows64 so that shouldn't be an issue.
As for the dll... I hadn't experience issues with that... but I can certainly add it to the program.
Both adb dll's will be included in all releases after b3.
Click to expand...
Click to collapse
b3 is the first one I tried. I didn't look at the classes.dex before it was deleted. I will check.
RASTAVIPER said:
Good job!
Can you explain more about how rom is being affected?and what to check?
Sent from my phiremod for Nook using Tapatalk
Click to expand...
Click to collapse
Read here http://forum.xda-developers.com/showthread.php?t=1004102
TelephonyManager.smali did not change.
mellopete said:
TelephonyManager.smali did not change.
Click to expand...
Click to collapse
Please make sure b3 is the one you are using. When you originally posted... the thread was showing 0 downloads of that file.... or just wait a few minutes... beta 4 is on its way shortly.
To ensure TelephonyManager.smali is not changed you need to look in two places.... the easiest way is to search for getDeviceID
If it worked correctly you should find 2 instances... the first is the original function and my program renames it to getDeviceID2()... the second should be the one !IMEMe adds to the end of TelephonyManager.smali
Additionally... could you check and see if your run is actually overwriting update zip file.... see if there is a update ".zip.tmp" file left over... if it is there... the zipping is running into an issue overwriting the original file... I thought I had that issue worked out... but may need to add a check for that within my program.
I d/l b4, dropped it in a directory with just the .zip for n87 and ran it (win7 pro 64-bit). It errored out and here's the play-by-play of each of the windows which popped up one immediately after the other:
- I was warned about you being an unverified software publisher, which I OKed.
- "Windows cannot find 'java'. Make sure you typed the name correctly, and then try again." I OKed this one as well.
- window titled "DizzyDen's IMEI Generator" containing: "Return Code is:0 and Error Code is: 1"
- window titled "DizzyDen's IMEI Generator" containing: "Java is required on your system. You can download the current version from http://java.com"
I have JRE6 on my machine, though it is not in the system PATH.
Oh, and there were files for 7za, adb, .dll's and .jar files left behind.
mr_fosi said:
I d/l b4, dropped it in a directory with just the .zip for n87 and ran it (win7 pro 64-bit). It errored out and here's the play-by-play of each of the windows which popped up one immediately after the other:
- I was warned about you being an unverified software publisher, which I OKed.
- "Windows cannot find 'java'. Make sure you typed the name correctly, and then try again." I OKed this one as well.
- window titled "DizzyDen's IMEI Generator" containing: "Return Code is:0 and Error Code is: 1"
- window titled "DizzyDen's IMEI Generator" containing: "Java is required on your system. You can download the current version from http://java.com"
I have JRE6 on my machine, though it is not in the system PATH.
Oh, and there were files for 7za, adb, .dll's and .jar files left behind.
Click to expand...
Click to collapse
java will need to be in your path... I have no way of including all possible locations of where it could be installed... and it is way too big to include with my program.
The left over files is due to the program exiting when it did... I will fix that in next beta... should have waited until java was tested to extract them... or have it perform cleanup before exiting on any errors... sorry bout that.... you can leave them... when you have successful run (or run beta 5 or later) it will clean them up.
For now you may have to run as administrator.... I will try to add code to avoid this in the short future.
BTW. Nowhere does getDeviceID does it say that it must be a well formed IMEI.
nemith said:
BTW. Nowhere does getDeviceID does it say that it must be a well formed IMEI.
Click to expand...
Click to collapse
As much as I admire your work... I am honored that you are even checking this out.
I do understand that as of now it is not required... but I figure if I utilize standards (as much as there are anyway) we may avoid future issues if dev's start checking for well formed IMEI's.
I figure if I'm going to make this... I might as well make it right.
As far as I can determine... if a sw dev implemented IMEI checks, the only thing that could cause them to shut down someone using this would be to check that it is a "TEST" IMEI... but I don't see that happening, because hardware manufacturers do use these in testing.
DizzyDen said:
java will need to be in your path... I have no way of including all possible locations of where it could be installed... and it is way too big to include with my program.
Click to expand...
Click to collapse
Roger that. Should the instructions then note either the required change to PATH or that the file must be run in the user's jre#\bin directory?
DizzyDen said:
The left over files is due to the program exiting when it did... I will fix that in next beta...
Click to expand...
Click to collapse
I figured as much, but thought you should know.
DizzyDen said:
For now you may have to run as administrator...
Click to expand...
Click to collapse
I ran it this way and got the same behavior.
I'll keep a lookout for further versions, test them and report.
Beta 5 is up... OP updated to include Java requirements... thank you mr_fosi for pointing this out.
RASTAVIPER said:
Good job!
Can you explain more about how rom is being affected?and what to check?
Sent from my phiremod for Nook using Tapatalk
Click to expand...
Click to collapse
Did you find the information in the thread linked in response to your questions?
TY mellopete for that.
- Plugged NC into USB port.
- Copied new B5 exe and n87 zip to java\jre6\bin directory.
- Ran exe as admin.
- Prompted for .zip check ("is this correct") and it was, so I OKed it. Not OKing it gave me the option to browse for the file, which I cancelled, resulting in a termination of the prog with a few more dialogs. Any extracted files were cleaned up an prog close, except for adb.exe (which I deal with below).
- Re-ran, exe, chose the detected n87 .zip.
- Displayed correct serial.
- Displayed correct generated 17-digit IMEI.
- Dialog contents "Modifying" gave error "Unable to open file", which I OKed.
- Several more dialogs flew by in rapid succession without error, ending with "Updating ROM" overlaid by "Updated ROM file has been saved as: cm_encore_full-87-IMEI.zip".
- Not all ancillary files were cleaned up. Two files remained: 1) IMEI.fix, a plain txt file containing the correct code to insert the generated IMEI and 2)adb.exe which could not be removed because it was still running the devices server. Running "adb kill-server" in the java\jre6\bin directory allowed me to remove adb.exe.
- A check of the modified smali showed only one instance of "getDeviceId" indicating that the smali had not been modified to add the code to spoof the IMEI.
I would also not have been able to eject my NC, had I tried, until I killed the adb server. Looks like one more line of code to add before cleanup.

Registry Tweaks for Lumia 710&800

Your phone must be Full Unlocked!
Then you should install WP7 Root Tools.
Unlock the hidden options in the settings:
LOCAL MACHINE/System/Accessibility/
Code:
"CompactMode"=dword: 0
"TTY"=dword: 1
"telecoil UI"=dword: 1
"telecoil"=dword: 1
Change Search Engine in Internet Explorer by vova1609
CURRENT USER/Software/Microsoft/Internet Explorer/SearchProviders
Google:
1. Create key "Google"
2. Create value:
value name: URL
value type: string
value data: http://www.google.com/m?hl=en&gl=us&client=ms-hms-tmobile-us&q={searchTerms}
3. Done!
Yahoo!
1. Create key "Yahoo!"
2. Create value:
value name: URL
value type: string
value data: http://search.yahoo.com/search?p={searchTerms}
Yandex
1. Create key "Yandex"
2. Create value:
value name: URL
value type: string
value data: http://yandex.ru/msearch?text={searchTerms}
Remove built-in applications from saintonotole's firmware by vova1609
As you know, if you delete application, like Bazaar, this application will be installed again after reboot. I have found solution:
Local Machine/Software/OEM/FirstBoot/InstallApps
Delete folder InstallApps
Nice. What about local nachine/software/oem/cloaking/appreinstaller
Maybe this reinstalls deleted apps?
Sent from my Lumia 710 using XDA Windows Phone 7 App
Also can we find any battery tweaks, cause battery really sucks.
Sent from my Lumia 710 using XDA Windows Phone 7 App
mariosraptor said:
Nice. What about local nachine/software/oem/cloaking/appreinstaller
Maybe this reinstalls deleted apps?
Sent from my Lumia 710 using XDA Windows Phone 7 App
Click to expand...
Click to collapse
no
For very low brightness(tested on lumia 710)
Current User/Control Panel/Brightness
"LowBrightness"
Value= 1
1 is the lowest I have tried, I don't want to try 0 lol. Value is probably 1-100.
Battery performance FTW now.
Sb know how to change the vibration pattern? I always miss the incoming calls due to poor vibration level!
There's any way to change the boot splash screen? (Not the nokia logo)
I really searched for anything on registry or file system... but can't find anything
My phone is the Lumia 710
vova1609 said:
Your phone must be Full Unlocked!
Then you should install WP7 Root Tools.
Unlock the hidden options in the settings:
LOCAL MACHINE/System/Accessibility/
Code:
"CompactMode"=dword: 0
"TTY"=dword: 1
"telecoil UI"=dword: 1
"telecoil"=dword: 1
Change Search Engine in Internet Explorer by vova1609
CURRENT USER/Software/Microsoft/Internet Explorer/SearchProviders
Google:
1. Create key "Google"
2. Create value:
value name: URL
value type: string
value data: http://www.google.com/m?hl=en&gl=us&client=ms-hms-tmobile-us&q={searchTerms}
3. Done!
Yahoo!
1. Create key "Yahoo!"
2. Create value:
value name: URL
value type: string
value data: http://search.yahoo.com/search?p={searchTerms}
Yandex
1. Create key "Yandex"
2. Create value:
value name: URL
value type: string
value data: http://yandex.ru/msearch?text={searchTerms}
Remove built-in applications from saintonotole's firmware by vova1609
As you know, if you delete application, like Bazaar, this application will be installed again after reboot. I have found solution:
Local Machine/Software/OEM/FirstBoot/InstallApps
Delete folder InstallApps
Click to expand...
Click to collapse
I only try to do the first tweak but i don't see any change... I'm using a custom rom (Rataplan v3)
what about lumia 800 Music enhacement (vol boost or sth like that) has anyone tried to find something?
I'm preparing my phone for testpoint bootloader swap with ATF so I'll help u out soon ,try
to work on that cuz Original setup sucks 4 real
cdbase said:
what about lumia 800 Music enhacement (vol boost or sth like that) has anyone tried to find something?
I'm preparing my phone for testpoint bootloader swap with ATF so I'll help u out soon ,try
to work on that cuz Original setup sucks 4 real
Click to expand...
Click to collapse
yes, i also want to change the standard volume!
In my case, for this huge range of 30, its way too loud on 1, and way to quiet on 30. In between, you can't really hear a difference for example 23 and 24.
It would be awesome to change this.
Have anyone interested in disabling prediction and auto correct?
I just found that tweak today! (Changing some registy values myself)
Go to: Local Machine\System\Input
enter in the folder that corresponds your alnguage id (in my case is lang_0416 for Portuguese Brazilian)
add the string ".disable" in the end of the values of "Dictionary File" and "HTR Dictionary File" and restart your phone.
Next time you type something, you should not be bothered again with the prediction and auto correct.
Hi guys! You problems with the phone vibration ends here!
Access the phone registry and go to "Current User\Control Panel\SoundCategories\Ring"
First go to: RingerOffVibrateOn
and change script value to: av0.1v2.2w2r
Now go to: RingerOnVibrateOn
and change script value to: av0.1v2.1w0.1v1.pr
DONE!
Reboot isn't required. Call your phone and you will see the classic vibration while on silent.
Unfortunately the phone cannot vibrate and ring... Only vibrate, then ring.
---------- Post added at 09:55 AM ---------- Previous post was at 09:07 AM ----------
I don't know if i'm really helping here...
If you found out that your alarm volume is too low... You can go to in registry: "Current User\Control Panel\SoundCategories\Alarm\RingOnVibrateOn"
Change script to: p
yes... just "p" (that means PLAY)
it will not change the volume at all... it will just play in the same volume as your ringtone ^^

[GUIDE] Removing Duplicate Media Entries with root/adb/sqlite3

STD DISCLAIMER: I am not responsible for you screwing up your phone. Make BACKUPS!
I have the ever-present problem with the media files on my phone showing up as duplicates. I see from around the forums that several other users experience this regularly on CM9/CM10/AOKP based roms. I'm not sure why this is happening, but it seems to be a side-effect of the mediascanner re-indexing media it shouldn't. In this guide I show you what is going on with your data and how to remove the duplicates.
REQUIREMENTS
Your phone must be rooted to access the sqlite3 database.
You must have debugging turned on your phone
You must have access to adb and ideally have used it in the past. This thread is not about adb/driver setup!
PROCEDURE
Connect your phone via USB and make sure your adb server is started.
Code:
[[email protected] ~]$ adb start-server
* daemon not running. starting it now on port 5037 *
* daemon started successfully *
Run 'adb shell' and become superuser (run 'su')
Code:
[[email protected] ~]$ adb shell
[email protected]:/ $
255|[email protected]:/ $ su
su
[email protected]:/ #
cd to /data/data/com.android.providers.media/databases/
Code:
[email protected]:/ # cd /data/data/com.android.providers.media/databases/
cd /data/data/com.android.providers.media/databases/
[email protected]:/data/data/com.android.providers.media/databases # ls
ls
external.db
external.db-shm
external.db-wal
internal.db
internal.db-shm
internal.db-wal
Attach to the external.db database with sqlite3
Code:
[email protected]:/data/data/com.android.providers.media/databases # sqlite3 external.db
external.db <
SQLite version 3.7.4
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite>
view the avaible tables (.tables). Now almost every table here, except for the 'files' table is a view based on the files table. What happens is that some data is in 'files' is blanked out and the views create duplicates of the data with seemingly good filenames. However since the primary piece of data in 'files' is missing, all the media players relying on this database freak out.
Code:
sqlite> .tables
.tables
album_art audio files
album_info audio_genres images
albums audio_genres_map search
android_metadata audio_genres_map_noid searchhelpertitle
artist_info audio_meta thumbnails
artists audio_playlists video
artists_albums_map audio_playlists_map videothumbnails
sqlite>
look at the files table sql schema and find an example (.schema files). With the duplicate problem bad data is created with the '_data' field blanked out, but a valid media_type=2, since views rely on the media_type=2 but merges other fields with the file name, etc. you get a media entry that looks good but no entry to pull off the file system. See the _data section of the single entry I queried below to see what a good record looks like. A bad record will have a different '_id' and blank '_data'
Code:
sqlite> .schema files
.schema files
CREATE TABLE files (_id INTEGER PRIMARY KEY AUTOINCREMENT,_data TEXT,_size INTEGER,format INTEGER,parent INTEGER,date_added INTEGER,date_modified INTEGER,mime_type TEXT,title TEXT,description TEXT,_display_name TEXT,picasa_id TEXT,orientation INTEGER,latitude DOUBLE,longitude DOUBLE,datetaken INTEGER,mini_thumb_magic INTEGER,bucket_id TEXT,bucket_display_name TEXT,isprivate INTEGER,title_key TEXT,artist_id INTEGER,album_id INTEGER,composer TEXT,track INTEGER,year INTEGER CHECK(year!=0),is_ringtone INTEGER,is_music INTEGER,is_alarm INTEGER,is_notification INTEGER,is_podcast INTEGER,album_artist TEXT,duration INTEGER,bookmark INTEGER,artist TEXT,album TEXT,resolution TEXT,tags TEXT,category TEXT,language TEXT,mini_thumb_data TEXT,name TEXT,media_type INTEGER,old_id INTEGER, storage_id INTEGER, is_drm INTEGER, width INTEGER, height INTEGER);
CREATE INDEX album_id_idx ON files(album_id);
CREATE INDEX artist_id_idx ON files(artist_id);
CREATE INDEX bucket_index on files(bucket_id, media_type, datetaken, _id);
CREATE INDEX bucket_name on files(bucket_id, media_type, bucket_display_name);
CREATE INDEX format_index ON files(format);
CREATE INDEX media_type_index ON files(media_type);
CREATE INDEX parent_index ON files(parent);
CREATE INDEX path_index ON files(_data);
CREATE INDEX sort_index ON files(datetaken ASC, _id ASC);
CREATE INDEX title_idx ON files(title);
CREATE INDEX titlekey_index ON files(title_key);
CREATE TRIGGER audio_meta_cleanup DELETE ON files WHEN old.media_type = 2 BEGIN DELETE FROM audio_genres_map WHERE audio_id = old._id;DELETE FROM audio_playlists_map WHERE audio_id = old._id;END;
CREATE TRIGGER audio_playlists_cleanup DELETE ON files WHEN old.media_type = 4 BEGIN DELETE FROM audio_playlists_map WHERE playlist_id = old._id;SELECT _DELETE_FILE(old._data);END;
CREATE TRIGGER files_cleanup DELETE ON files BEGIN SELECT _OBJECT_REMOVED(old._id);END;
CREATE TRIGGER images_cleanup DELETE ON files WHEN old.media_type = 1 BEGIN DELETE FROM thumbnails WHERE image_id = old._id;SELECT _DELETE_FILE(old._data);END;
CREATE TRIGGER video_cleanup DELETE ON files WHEN old.media_type = 3 BEGIN SELECT _DELETE_FILE(old._data);END;
sqlite>
sqlite> select * from files where _data like '%Unhuman%';
select * from files where _data like '%Unhuman%';
16566|/mnt/emmc/mp3/Architect - 2010 - Consume Adapt Create/Architect - 04 - Unhuman.ogg|8176842|47362|16559|1345650424|1337460350|application/ogg|Unhuman||Architect - 04 - Unhuman.ogg|||||||-1041554543|Architect - 2010 - Consume Adapt Create|| O A 5 O ? ' A |5|7||4||0|1|0|0|0||338973||||||||||2||131073|0||
query the duplicates in the files tables. Here I look at just one example... This is from a later date than the earlier section. You can see how the one media file id = 16566 has been re-indexed again. 16566 and 19522 have been blanked and new record 22822 has been indexed with the complete record.
Code:
sqlite> select _id,_data,_display_name from files WHERE _data = '' AND media_type = 2;
select _id,_data,_display_name from files WHERE _data = '' AND media_type = 2;
19518||Architect - 13 - Wachsmuth.ogg
19519||Architect - 01 - The ***** is Back.ogg
19520||Architect - 02 - The Shadow of Eve.ogg
19521||Architect - 03 - Fast Lane (Freeze Frame).ogg
19522||Architect - 04 - Unhuman.ogg
19523||Architect - 05 - For You.ogg
19524||Architect - 06 - So I Went Out.ogg
19525||Architect - 08 - Attack Ships on Fire.ogg
19526||Architect - 09 - Pure.ogg
19527||Architect - 10 - I Lost my 808 on a Rainy Day.ogg
19528||Architect - 11 - Awake (Album Version).ogg
19529||Architect - 12 - The Beauty and the Beat (Rokka).ogg
<<more bad entries>>
sqlite> select * from files where _display_name like '%Unhuman%';
select * from files where _display_name like '%Unhuman%';
16566||8176842|47362|16559|1345650424|1337460350|application/ogg|Unhuman||Architect - 04 - Unhuman.ogg|||||||-1041554543|Architect - 2010 - Consume Adapt Create|| O A 5 O ? 'A |5|7||4||0|1|0|0|0||338973||||||||||2||131073|0||
19522||8176842|47362|19515|1345728924|1337460350|application/ogg|Unhuman||Architect - 04 - Unhuman.ogg|||||||-1041554543|Architect - 2010 - Consume Adapt Create|| O A 5 O ? 'A |5|7||4||0|1|0|0|0||338973||||||||||2||131073|0||
22822|/mnt/emmc/mp3/Architect - 2010 - Consume Adapt Create/Architect - 04 - Unhuman.ogg|8176842|47362|22815|1346073675|1337460350|application/ogg|Unhuman||Architect - 04 - Unhuman.ogg|||||||-1041554543|Architect - 2010 - Consume Adapt Create|| O A 5 O ? ' A |5|7||4||0|1|0|0|0||338973||||||||||2||131073|0||
delete all the duplicates. Note we won't be able to delete until we temporarily remove any triggers referring to api functions. If you look at '.schema' again you'll note a trigger refer to _OBJECT_REMOVED, we'll need to remove them. So STEP1. List schema -- cut and paste this to notepad or something. STEP2. DROP TRIGGER on anything referencing _OBJECT_REMOVED. STEP 3. delete our duplicates. STEP 4. re-create all triggers.
Code:
sqlite> drop TRIGGER files_cleanup;
drop TRIGGER files_cleanup;
sqlite> DELETE FROM files WHERE _data = '' and media_type = 2;
DELETE FROM files WHERE _data = '' and media_type = 2;
sqlite> CREATE TRIGGER files_cleanup DELETE ON files BEGIN SELECT _OBJECT_REMOVED(old._id);END;
(optional) Add a trigger to nuke duplicates. So maybe I'd like sqlite3 to remove dupes for me anytime it re-indexes, say for a deletion? Some other events might be too expensive to have this triggering all the time, but I've tested it with a file delete and it works.
Code:
CREATE TRIGGER duplicates_cleanup DELETE ON files WHEN old.media_type = 2 BEGIN DELETE FROM files WHERE _data = '' and media_type = 2;END;
That's IT.
Code:
sqlite> .quit
.quit
Takes about 2-5 minutes to clean up manually, vs waiting 14-30 minutes to re-index a huge collection. This could also be automated if you were so inclined with a better trigger or an app.
UPDATE: 10/26/2012
One clarification: media_type = 2 is audio files -- mp3, ogg, wav and the like. If you have issues with other media you can simple use that media type, or leave the qualifier off for all media types.
I was 'trying out' this trigger, but now have gone for months without any duplicates. I think it works. Basically, you can skip doing any other sql work in the above guide -- just creating this trigger and adding a media audio file. Adding a media file should launch this trigger and clear out any duplicates (may have to reboot once).
Code:
sqlite> create trigger duplicates_cleanup AFTER UPDATE OF _data ON files BEGIN DELETE FROM files WHERE _data = '' and media_type = 2;END;
create trigger duplicates_cleanup AFTER UPDATE OF _data ON files BEGIN DELETE FROM files WHERE _data = '' and media_type = 2;END;
Interesting.
Where do you see duplicates show up? I'm not running aosp.
The reason this caught my eye is because I've always had the issue of duplicate entries in ringtone and notification sounds lists, while there are not duplicate files in /system/media/audio/*. I don't think this is the same issue you are adressing, is it?
creepyncrawly said:
Interesting.
Where do you see duplicates show up? I'm not running aosp.
The reason this caught my eye is because I've always had the issue of duplicate entries in ringtone and notification sounds lists, while there are not duplicate files in /system/media/audio/*. I don't think this is the same issue you are adressing, is it?
Click to expand...
Click to collapse
It's a similar issue. Note the following items in the schema:
is_ringtone INTEGER,is_music INTEGER,is_alarm INTEGER,is_notification INTEGER,is_podcast INTEGER
The same thing could very well be happening where you have two records with mostly the same records but a blank '_data'.
othermark said:
It's a similar issue. Note the following items in the schema:
is_ringtone INTEGER,is_music INTEGER,is_alarm INTEGER,is_notification INTEGER,is_podcast INTEGER
The same thing could very well be happening where you have two records with mostly the same records but a blank '_data'.
Click to expand...
Click to collapse
Meaning it would be the same database?
creepyncrawly said:
Meaning it would be the same database?
Click to expand...
Click to collapse
If the duplicates are all on external media, yes, however, if it's on the internal media then it will be in the internal.db instead of the external.db as posted in my guide.
So if you're seeing duplicates with 'Whistle' showing up twice in notifications, there's probably a problem with internal.db.
Had a little time to play around with this today. First, I was surprised that I didn't have sqlite3 on my phone. I had to install it, using a market app called SQLite Installer for Root by ptSoft. (SHOstock2 v4.1.3)
I ran the query "select _id,_data from files WHERE _data = '' and media_type = 2;" on both the external.db and internal.db but in both cases no entries were found. So no joy finding duplicate entries in notifications and ringtones with this method.
creepyncrawly said:
Had a little time to play around with this today. First, I was surprised that I didn't have sqlite3 on my phone. I had to install it, using a market app called SQLite Installer for Root by ptSoft. (SHOstock2 v4.1.3)
I ran the query "select _id,_data from files WHERE _data = '' and media_type = 2;" on both the external.db and internal.db but in both cases no entries were found. So no joy finding duplicate entries in notifications and ringtones with this method.
Click to expand...
Click to collapse
The schema is maybe different in samsung based roms? How I originally found this was to pick a duplicate and look at the various tables and work backwards through the views and matching up fields.
You can always start with a select * from files and see if you can find where it lists the same name or file name twice. This should be easy to do on the internal.db with it's limited number of entries.
for the past year that i've had my sgs2, i've constantly had this issue with my phone and it's been a constant annoyance. i honestly want to say thank you for this but the problem is i got to step 1 and i went full retard. for some reason, i already have adb on my comp and i guess i used it for something at some point, possibly when i was rooting my phone a while back but i have no clue how to use it that well. i would love to try and get this to work on my phone but can you really dumb it down for those not really familiar with how to do all this? if not, i thank you for putting this up in the first place, i'll try to give it another go.
I tried the fix and it seemed to work until I pulled up ringtones a second time and there were the doubles and even triples. Frustrated that it didn't take I delved deeper into my files and discovered a couple unzipped (but not installed) ROMs that I had extracted just to look at. Deleted them and problem solved. Did I mention I'm a noob, lol?
bandit1210 said:
I tried the fix and it seemed to work until I pulled up ringtones a second time and there were the doubles and even triples. Frustrated that it didn't take I delved deeper into my files and discovered a couple unzipped (but not installed) ROMs that I had extracted just to look at. Deleted them and problem solved. Did I mention I'm a noob, lol?
Click to expand...
Click to collapse
Cool
ok, is there anyway to undo all of this because i have a feeling this might have caused my phone to delete all my pictures i've taken and when i try to flash a new rom, it sends me into a boot loop and i can't reflash anything.
ender127 said:
ok, is there anyway to undo all of this because i have a feeling this might have caused my phone to delete all my pictures i've taken and when i try to flash a new rom, it sends me into a boot loop and i can't reflash anything.
Click to expand...
Click to collapse
Flash to stock?
ender127 said:
ok, is there anyway to undo all of this because i have a feeling this might have caused my phone to delete all my pictures i've taken and when i try to flash a new rom, it sends me into a boot loop and i can't reflash anything.
Click to expand...
Click to collapse
You can "Clear Data" on the "Media Storage" app, this has the same effect as removing the db files.
However a boot loop is already beyond all this... You need to get into recovery to fix that.
well, i figured it was one of two things. after i did this on saturday, i tried to flash new firmwarm (10.31 task) but i got stuck in a boot loop. i can flash to another rom (super nexus) without problems and i can get to a really old nandroid backup. but basically you're telling me if i do a clear data on media storage, it'll wipe anything i did on adb? i really appreciate the responses by the way, i literally just flew out of the country for vacation and luckily i brought a laptop to fix this, but i can't function without my phone running.
ender127 said:
basically you're telling me if i do a clear data on media storage, it'll wipe anything i did on adb.
Click to expand...
Click to collapse
I believe so, yes. At least that is my experience.
How do delete duplicates if the _data is NOT empty
If you have root and can put sqlite3 on your device, this works without scanning and all that silliness:
http://forum.xda-developers.com/showthread.php?t=1847586
---------- Post added at 02:09 PM ---------- Previous post was at 01:49 PM ----------
Sweet, thank you so much for this. I found that on my Galaxy S3, Zedge creates a mess of things. I had up to 5 of each notification and ringtone, all with the same valid info aside from _id. Here's what I did to pick the first entry and clean things up:
sqlite3 external.db
FROM files WHERE _id not in (select MIN(_id) FROM files GROUP BY _data);
You can choose to keep the LAST entry for each by changing MIN to MAX, which might be a better idea if you trust recent modifications over earlier ones. If they all have valid _data it probably does not matter.

Categories

Resources