yashsingh1/xdaforums huggingface dataset:
[Nook Color Android Development] DizzyDen:
I have come up with a way to patch framework that will show the IMEI and IMEI SVN on the about tablet screen...

As soon as I can... work permitting... I will be rewriting the IMEI Generator to use this method...

For now... quick code to use Device Serial Number is as follows

# /com/android/internal/telephony/gsm/GSMPhone.smali
# rename current getDeviceId() to getDeviceId2()
# rename current getDeviceSvn()to getDeviceSvn2()
# then paste this at the end
#

.method public getDeviceId()Ljava/lang/String;
.registers 5

.prologue
sget-object v1, Landroid/os/Build;->SERIAL:Ljava/lang/String;

.local v1, str:Ljava/lang/String;
new-instance v0, Ljava/lang/StringBuffer;

const/4 v2, 0x0

invoke-virtual {v1, v2}, Ljava/lang/String;->substring(I)Ljava/lang/String;
move-result-object v2

invoke-direct {v0, v2}, Ljava/lang/StringBuffer;-><init>(Ljava/lang/String;)V

.local v0, sb:Ljava/lang/StringBuffer;
const/4 v2, 0x0
const-string v3, "0"

invoke-virtual {v0, v2, v3}, Ljava/lang/StringBuffer;->insert(ILjava/lang/String;)Ljava/lang/StringBuffer;

invoke-virtual {v0}, Ljava/lang/StringBuffer;->toString()Ljava/lang/String;

move-result-object v1

return-object v1
.end method

.method public getDeviceSvn()Ljava/lang/String;
.registers 5

.prologue
sget-object v1, Landroid/os/Build;->SERIAL:Ljava/lang/String;

.local v1, str:Ljava/lang/String;
new-instance v0, Ljava/lang/StringBuffer;

const/4 v2, 0x0

invoke-virtual {v1, v2}, Ljava/lang/String;->substring(I)Ljava/lang/String;
move-result-object v2

invoke-direct {v0, v2}, Ljava/lang/StringBuffer;-><init>(Ljava/lang/String;)V

.local v0, sb:Ljava/lang/StringBuffer;
const/4 v2, 0x0
const-string v3, "0"

invoke-virtual {v0, v2, v3}, Ljava/lang/StringBuffer;->insert(ILjava/lang/String;)Ljava/lang/StringBuffer;

invoke-virtual {v0}, Ljava/lang/StringBuffer;->toString()Ljava/lang/String;

move-result-object v1

return-object v1
.end method

This keeps with the newest revision of the IMEI standards... specifically appendix B regarding Test IMEI's in that the IMEI will begin with 0 which reflects a test IMEI.

It also removes the -'s from the IMEI as newer devices do not have them any longer and the standard no longer reflects their use.

With this method... the entire device Serial Number is used for IMEI generation, thus further ensuring unique IMEI.
[Nook Color Android Development] DizzyDen:
!IMEIme 2.1.0.3 uploaded

NOTE: I apologize for the long delay in the new IMEI Generator. I think you'll understand as you read about new features and realize the amount of work required to impliment the features while maintaining backward compatibility. This is a MAJOR upgrade.

New features:

I have now included the ability to generate "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:

If based on Serial Number... it will use the right most 16 digits of the serial number... encrypt it if selected... then place a 0 at the beginning

If based on MAC Address... it will use the right most 5 two byte hex words... convert each byte to 3 digit decimal (F=015... FF=255... FFFF=255255255255 not 65535)... encrypt if selected... place 00 at the beginning If "New IMEI Type" is not selected... the program still functions as it previously did... if Serial Number based using the left 15 digits... 00- prepended... -'s added where they were before.

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.

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 now... 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 charactors (!)... 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.

With the new version I have done some major rework but had to maintain compatibility for those who would have issues with a new type of IMEI.

NEWGUI 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
[Nook Color Android Development] MaxRabbit:
You rock, Dizzy.
[Nook Color Android Development] DizzyDen:
Thanks Max... I take it you like this version ;)

Always looking to improve/expand this "little" tools functionality... any ides just let me know.

Hard to believe this tool is over a year old... and I missed a "birthday" celebration :)
[Nook Color Android Development] 12paq:
This major release is a big belated B-day gift!

Well done again, Dizzy.
[Nook Color Android Development] DizzyDen:
Damn... I was just reviewing this... and that damned typo is still in there... I promise to have it fixed in future releases.
[Nook Color Android Development] DizzyDen:
Poll added

I have added a poll to the thread for the next version... I will let you guys and gals decide while I work on some of the other enhancements I have planned.

Simply, do you like the way the program exits automatically when its done, or do you want it to come back to the GUI until you exit manually... the second option is handy if you want to run it multiple times for any reason... like updating many ROMs or devices at one time.

Anyway... you decide that part of it... on to implimenting hybrid IMEI generation and custom patching.
[Nook Color Android Development] MaxRabbit:
Dizzy,

Unfortunately, I don't use the app anymore because I gave away my Kindle Fire for this deployment. However, I personally am not a fan of apps that exit themselves automatically. I much prefer a "Hey, I'm done, are you?"
[Nook Color Android Development] deboyz1014:
I've been lurking mostly and did some googling regarding this but I've yet to find a tutorial of how to use this program properly. I understand the concept, but I guess I'm one of those that need

1. connect usb cable to NC

2. ...

Is that buried somewhere on this thread or is this one of those thing that you just need to try and learn?
[Nook Color Android Development] DizzyDen:
For the most part... see the first few posts on this page.

Also for some further explanation of some of the options... see this post.

As noted in OP now... if you select Use Serial Number and do not select Encrypt... you don't need adb... it will patch whatever ROM you select while the generator is running.
[Nook Color Android Development] DizzyDen:
IMEI Generator 2.2.0.2 uploaded

Current version: !IMEIme 2.2.0.2

This is a bug fix version

There were issues using In Place patching on CM10... it was the result of permissions when pushing build.prop and framework.jar... code has been added to set the correct permissions after pushing the files to the device. The bug would cause BBSOB (Backlit Black Screen on Boot) and never finish booting.
[Nook Color Android Development] technut:
Dizzy,I tried this on my Samsung Note 10.1 GT-N8010 Stock Rooted JellyBean and it generated an IMEI but then it says something about the GSMPhone.smali before it finishes.Could you tell me anything about that?I used this before on my kindle fire and it worked awsome.Thanks for your hard work.
[Nook Color Android Development] DizzyDen:
Not having a Samsung Note... I am not sure of all the particulars... it may not have GSMPhone.smali... if you could adb the framework.jar file from it and send to me I can look and see if its there... and put in checks to force a different way of patching.

I went to patching GSMPhone.smali instead of TelephonyManager.smali because it came across as cleaner IMHO... but I can certainly add checks for GSMPhone and patch the other way if needed.
[Nook Color Android Development] technut:
Sounds great.I don't have Android SDK installed so I pulled it from ESF file explorer.There was also a framework2.jar there I will attach both.Thank You so much for getting back to me.If you need any other files like build.prop etc...let me know.
[Nook Color Android Development] DizzyDen:
The framework.jar poted is only 15KB... and is not an odex'd jar... either the Note is using a different framework than that one... or something else is going on... if you can use adb to pull /system and zip it... you can upload it somewhere for me... or let me know and I can give you email addy or someplace to upload.
[Nook Color Android Development] technut:
Well after searching ye ol` faithful(GOOGLE)LOL I found an adb bundle without having to download the entire android SDK and then I found out how to adb the system file to my PC.It is now zipped and ready for your downloading.I will PM you a link to my dropbox public folder.I really appreciate your help and I'm so thankful for all of you guys here at XDA that know how to do these amazing things.Thanks DIZz
[Nook Color Android Development] brolylindeb:
Hello,

I'm the happy owner of an nexus 4. My pb is I would used it for my profesionnal usage, and one most important thing for me are my emails.

The pb is my company build a system who authorise or not some kind a phone (called the enrollment), and I have to declare my emei on that system.

When I declared it, my emei and phone model is not recocnize, before i had a S3 declared on that system and it works fine.

So my question is, can I use this program to "fake" or generate a random EMEI that I can used on my system's company ?

Thanks in advance
[Nook Color Android Development] DizzyDen:
What did you use for the EMEI that you declared?

As for your question... that is the intent of the program... to generate an EMEI for devices that do not have them. That being said... some newer tablet devices are using different components of framework.. and I am looking for the best method to deal with this.

Bottome line... give it a shot... UNLESS your device has a factory IMEI... then it could cause your device to stop working on their systems.
[Nook Color Android Development] brolylindeb:
I don't nkow but there's just a few model authorise in my company to synchronise it's exchange account; like iphone or nokia lumia ...

So I just need a little help to change my current EMEI to looks like a galaxy S3 whitch it is aggreed.

And for your information I can use my old S3 EMEI because it is broken.

Please how can I help, because it will help me.

regards ...
[Nook Color Android Development] DizzyDen:
The IMEI will not be an issue... Use the IMEI Generator and select Samsung Galaxy S3 as the device from the device drop down... be advised... it may cause some market issues as far as app compatability... and will list it as yet another device in your market account.
[Nook Color Android Development] DizzyDen:
technut... I haven't forgotten about you...

What ROM are you running? I've been looking for a ROM with the odexed files so I could do some testing, but none of the one's I've found have them. Checking more into baksmali and odex files... it looks like I will need to have it pull the 5 core dependency files from device or ROM... but I won't know for certain if it works correctly unless I can find a system that is odexed.

If you could do me a favor and pull and zip the entire /system/framework folder and include the /system/build.prop I may be able to make some headway on making IMEIme work for you.

Also, are you trying in place patching... or patching ROM file?
[Nook Color Android Development] technut:
Dizzy thanks,I don't follow threads and I just thought to myself " I should check to see if Dizzy has made any headway on Note 10.1 thing" so I stopped by here. I had tried in place patching and just tried patching rom file.Still same error as before no gsm.smali. I am always running a custom de-odexed rom but I think I have a nandriod of the original rom(or at least I did have) I will check for it, if I find it I will post back and send you a DB link again. Thanks man I really appreciate your work.:highfive:

***edit*** I can't find my nandroid either,I must of wiped data before without removing the nandroid. Right now I just loaded this rom from Darkman

http://xdaforums.com/showthread.php?t=1909950

it is for N8000 not my N8010 but the rom works great.It too is also deodexed.Let me know if there is anything else I can do to try to help out.
[Nook Color Android Development] DizzyDen:
IMEI Generator 2.2.0.3 uploaded

Current version: !IMEIme 2.2.0.3

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.

PATCHES

If GSMPhone.smali is present, this will continue to be the primary edit. If it is not present, TelephonyManager.smali will be edited.

I have yet to implement support for deodexing odex file and patching since this will result in much on device activity, and I do not have a device with odex files to ensure proper functionality. However, patching of the ROM prior to flashing these files should work correctly.
[Nook Color Android Development] DizzyDen:
IMEI Generator 2.2.0.4 uploaded

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.
[Nook Color Android Development] technut:
Dizzy, I just checked back here after a bit and see you have made a new generator after our chats about the Note 10.1.I'm gonna give this a go today.I'll post back my results to you.Thanks brother for all your hard work.:highfive:

**edit** Every which way I tried to generate and it always came back with"it appears we are having problems updating your device please reboot..." something along those lines" It seemed like everything was working fine before the push back though,I didn't receive any errors or the gsm.smali error like previous versions.Feel free to PM me if you have any other ideas on what I could possibly do to help out.I did copy and paste all the files generated at one point and saved them in a different folder right before the push in case any of that would be helpful to you.Thanks Dizzy
[Nook Color Android Development] Kaptinkrunk:
im confussed on what this does can you trick or clone your meid to the nook?
[Nook Color Android Development] DizzyDen:
While you can clone your MEID to the nook... I don't make it easy with the program... it is intended to generate a test pattern formed IMEI for devices that don't have one. Some apps require this to function on android devices. It will also allow you to fake device id's in build.prop for app compatibility in market, as well as change default screen resolution.
[Nook Color Android Development] Kaptinkrunk:
Ah hmmm I wanna clone my meid to the nook it would awesome

Sent from my Galaxy Nexus using Xparent Cyan Tapatalk 2
[Nook Color Android Development] vancchris:
Goodness. I would love a quick tutorial on how this would work on HP touch pad running cm 10.2
[Nook Color Android Development] DizzyDen:
I'm not sure what you're asking... it would hopefully generate an IMEI for the device... although in reality I think XDA free app is the only one this is still needed for. What the program does is patch framework.jar so calls for device id return the device id patched from the serial number.
[Nook Color Android Development] dft601:
Fire HDX 7

sorry

deleted
[Nook Color Android Development] mrhell95:
i need help

hello bro.

could you please contact me on adib.kadi@gmail.com

i need your help

thank you in advance.
[Nook Color Android Development] E:V:A:
[MENTION=3626300]DizzyDen[/MENTION]

This is a Great Project!!

Too bad I don't find it until now. Is it still alive and maintained?

Please join us on AIMSICD!
[Nook Color Android Development] makingmoneyla:
Hello,

I want know if the software still working and maybe if i can help with my knowledge for generate cert on samsung

regards
[Nook Color Android Development] ivanmmj:
The nook also does not access a carrier network which is where spoofing your IMEI becomes a problem. I do agree that theoretically, it can cause issues for certain apps if you end up with someone else's IMEI but the issue will not spill over to the network.
[Nook Color Android Development] DizzyDen:
In addition to my response in Post #40. This program is capable of updating any ROM install zip that utilizes proper utilization of framework.jar (i.e. keeps it in /system/framework folder). So, unless ALL "ROM cookers" address the need for IMEI's, this program will have functionality.
[Nook Color Android Development] martian21:
The only potential problem I see is for those who have generated their own IMEI number or used one of my modded framework.jar files who then switch to an IMEI based off your NOOK's S/N.

Swype does NOT like this and will most likely break!

The Swype Beta does allow you to de-register your device and add a new device (ie. new IMEI) once per e-mail address. (It detects "unique" devices via IMEI number)

The only method I know of to get Swype working on a third "device" (ie. third IMEI number) is to register a new e-mail address with the Swype Beta.

I'm sure Swype has already scrubbed their database of all entries with an IMEA of 12-34567-89012-45 probably while cursing my name (and a few others). [My sincere apologies to any Swype employees who happen to read this]

My advise to Swype fans (such as myself) is to always use the same IMEI based on your NOOK's unique S/N and then register a new e-mail address with a new Swype Beta account just for your NOOK. Hopefully this will allow us to continue using the Swype Beta (legally) and not mess up Swype's data (thus pissing off the people we are trying to support).

EDIT: Forgot to mention - Comcast's Xfinity app also doesn't seem to like it when the IMEI linked to your account changes so if you have used the Xfinity app and change your IMEI be prepared for that to potentially trigger anti-piracy actions. I'm not a Comcast subscriber anymore (yeah FIOS) so I can test this any further.

Martian21

PS: DizzyDen, you might want to note these potential "gotchas" in the OP. Feel free to plagiarize the crap out of anything I wrote if you wish!
[Nook Color Android Development] DizzyDen:
That is one reason I was defaulting to (albiet wrong because of a typo) the generic IMEI... for those that already registered with that IMEI.... but... I think we are well on our way away from that....

I'd encourage everyone to follow Martian21's advice since we are so close to being able to make sure we always have one of two UNIQUE IMEI's for each nook.... meaning... I am finishing up manual seeding of the IMEI generation from a phrase or number the user enters so you can always enter the same seed....

Thus...

IF the program can read your DeviceID from the device itself... it will use that.

IF it cannot... you can enter a seed for IMEI generation... it will ALWAYS generate the same IMEI from the same seed.
[Nook Color Android Development] BitingChaos:
You have answered everything, thank you.
[Nook Color Android Development] mr_fosi:
I'm loving this prog, btw, even though I'm not likely to need it again.

I do hope that it greases the wheels of the large software devs and communications companies well enough that they don't take action against us "off brand" users.
[Nook Color Android Development] DizzyDen:
The thing is... it makes it quite easy each time a ROM update comes down... simply run this and update the included framework.jar.
[Nook Color Android Development] mr_fosi:
I agree, but it isn't a need for me.

Convenient? Absolutely!

Worth the d/l? Certainly!

Like I said, I love this prog. :D
[Nook Color Android Development] DizzyDen:
Beta 8 is up... added manual input...

READ ALL BOLD TEXT in OP carefully... I put it there for a reason

Next on the agenda... reading framework.jar from the Nook or file on computer... updating it and pushing it to the Nook. (Creating a backup of the current one on the Nook of course.)
[Nook Color Android Development] mr_fosi:
Can we make the push/pull an option?

Personally, I'd like to make it an option rather than requirement in case I am working on someone else's nook from afar (since I help some tech-illiterate people from time to time), or for testing purposes. If it is a requirement, it could be a PITA but if it is an option, it would be a great asset.
[Nook Color Android Development] DizzyDen:
It'll be an option for the NO response to new initial window "Are you planning to update a dev's ROM zip file?"... if you click no now... it just tells you that the feature is not implimented and exits.
[Nook Color Android Development] mr_fosi:
Roger that.

Sounds like a good place to put it.
[Nook Color Android Development] martian21:
Danger ?!?!

This statement just set off a spark in my brain. In theory NOOK serial number are sequential and by using the leftmost digits of the serial number you are cutting off the least significant digits thus creating the possibility that unique serial numbers could still result in the same IMEI number!!!

Example:

20 digit sequential S/N's (can't recall how long the nook's actually is)

11111111110000000001
11111111110000000002
11111111110000000003
11111111110000000004
11111111110000000005
11111111110000000006
11111111110000000007
11111111110000000008
11111111110000000009
11111111110000000010

All unique number but now truncated to the left most 15 digits:

111111111100000
111111111100000
111111111100000
111111111100000
111111111100000
111111111100000
111111111100000
111111111100000
111111111100000
111111111100000

Now they are all the same!!!

I think you will need to modify your program to use the right most 15 digits (assuming NOOK serial numbers are sequential):

111110000000001
111110000000002
111110000000003
111110000000004
111110000000005
111110000000006
111110000000007
111110000000008
111110000000009
111110000000010

Still all unique.

In this hypothetical scenario, using the left most digits ~10 thousand Nooks could all resolve to the same IMEI.

Does this make sense, or am I off in left field here?

Martian21
[Nook Color Android Development] anonim1:
Your theory certainly makes sense. I suppose the question is whether device serials are truly sequential. I don't see why they wouldn't be, but one never knows..
[Nook Color Android Development] jjvcuyler:
Quadrillion, actually.