yashsingh1/xdaforums huggingface dataset:
[Nook Color Android Development] can teh man:
I have a possible theory to fix the IMEI number problem...

When you flash a rom, and Gapps, you have to enter an account... say you took the users account name (for this example, it will be sample@gmail.com) and converted it to hex.

sample@gmail.com -> 73616d706c6540676d61696c2e636f6d

now, seeing as we can't have letters in an IMEI number, strip the all the non-numeric characters out..

73616d706c6540676d61696c2e636f6d -> 736167066540676616962636f6d

Now we need to split it into the following format: xx-xxxxx-xxxxx-xx

736167066540676616962636f6d -> 73-61670-66540-676616962636f6d

Now, thats too long. So we need to trim it at the 2nd digit of the last segment

73-61670-66540-676616962636f6d -> 73-61670-66540-67

Its by no means the *best* solution ever, but it ensures that anyone using this method will be almost guaranteed to have a unique IMEI number.
[Nook Color Android Development] ansleyj44:
http://phandroid.com/2011/05/25/swy...rced-them-to-end-their-beta-program/#bXpulseX

Just curious, but what do you his make of this? I was holding off on doing this hack because I thought it would be integrated or fixed in another way, but...
[Nook Color Android Development] martian21:
A proper implementation based off the devices unique serial number would result in a unique IMEI number and therefore should not taint Swype's data.
[Nook Color Android Development] ansleyj44:
Thanks for clarifying that for me
[Nook Color Android Development] paleh0rse:
Uh oh... it looks like Swype's revenue is going to get in the way of any proper solution. I'd love to hear how they expect us to run their products on devices that don't have an IMEI.

I'm guessing this framework hack may be our only option for a while -- unless one of the devs decides to release a non-official flashable patch... <hint hint nudge nudge>
[Nook Color Android Development] mr_fosi:
Yeah... This (and the Comcast guy on the last page of this thread) is why I think the original solution isn't so great. The idea of a bunch of people all reporting the same IMEI is a major red flag to any IT guy on the other end of the line.

The best thing we can do is use unique numbers so people don't find their accounts being disabled because the company (rightfully) detects fraud.

This is why, like martian and Dan have suggested, each person should do their own hack incorporating their NC serial number. It won't fully appease firms that make things like Swype and HBO's streaming app because even though the IMEI's will be unique, they also contain info that is technically erroneous since IMEI's contain location, manufacturer and device-specific info that simply can't be spoofed.

I don't think that using parts of the hex translation of your email address is that great since you can only use about 50% of the info, which would seem to have a lesser degree of uniqueness than the device serial number. The serial number is easy yo get either by peeking into the proper partition (p3, I think?) or getting it from >adb devices.
[Nook Color Android Development] paleh0rse:
Perhaps whoever was working on the cm7 patch to do what you suggest would be kind enough to release an apk or windows app that creates a unique framework.jar for each of our systems...? Or even just the jar itself if we provide our serials? I, for one, don't currently have the skills or tools necessary to compile my own. :(
[Nook Color Android Development] mr_fosi:
You'd need a script to do it and it would be a ***** to write since everyone puts their tools (Java, ADB, etc) in different places.

It's actually really simple to do and you have all the tools you need if you have:

- Java - just the plain sort that allows you to view Java on the web

- A program that will look into archives (like WinRAR).

- ADB, which everyone who hacks the NC has.

- A file to edit TXT files (notepad).

It seriously takes less than 5 min including the time it takes to extract the framework.jar and build the dex file. It's fewer than 10 console commands and a little bit of notepad editing.
[Nook Color Android Development] nolook:
is there a apk or similar patch for cm7 for this hack?

im running nightly 87 btw
[Nook Color Android Development] mr_fosi:
Did you read any of the thread? Even the OP or the last two posts?
[Nook Color Android Development] paleh0rse:
No. But, you can currently use one of the hacked jar files found in the OP if you're not philosophically opposed to spoofing your IMEI, and you don't mind taking the risk of using the same IMEI as 1000 other users.

Unless you compile your own, that's pretty much your only option at this point. You'll need to manually copy/paste the jar file and then set the proper permissions -- all of which can be done using root explorer...
[Nook Color Android Development] DizzyDen:
I will see about putting together a window app to do the patch for us... my conern is all the questions that are going to come up because people don't have adb working... etc... I think I'll do it so that if adb devices returns "no devices" it generates a random test pattern IMEI.
[Nook Color Android Development] mr_fosi:
Technically, we don't really need ADB.

They could grab copies of the framework.jar and their serial off of the EMMC with root explorer and drop them on the uSD or FAT32 EMMC partiton then transfer the files with USB storage.

The only things that're really key are

- root explorer

- the Java bin (plus supporting libs) to do the .jar extraction and dex build

- the archiver. I dunno if the archiver on the NC is up to the task

If they can transfer the files to/from the nook, we just need a script to do the beefy java work, the IMEI generation and the archive manipulation on the PC/mac.

EDIT: Oh, and add smali and baksmali to that list. :p
[Nook Color Android Development] martian21:
It's completely beyond my skill but would be really slick to create a website that would allow users to upload their framework.jar (or select from the common ones) and then enter either their unique serial number or MAC address and it would then generate a modified framwork.jar (or even better CMR .zip) for download.

If you wanted to get really fancy you could require an e-mail address and tie the S/N or MAC to that e-mail address to prevent reuse.
[Nook Color Android Development] ramiss:
Couple of thoughts:

1) Could someone re-write this function to pull the string from a text file instead of the static variable? This would at least be an intermediate step.

2) If anyone has purchased Gameloft games while spoofing their IMEI then I can tell you that using a different IMEI will stop the game from working....just FYI for future knowledge.

Richard
[Nook Color Android Development] DizzyDen:
I agree.... but I am thinking of the best way to minimize confusion for all involved... If I write the program to have them connect via usb... have the program call adb devices and read the sn into a variable... then create the patch formatting contents of that variable correctly... extract framework.jar... write the patch to end of the TelephoneProvider.smali and rename original getDeviceID() function... smali up the changes... update framework.jar... update the dev's zip... be done.

To take care of those that can't get adb working... maybe a popup asking for the text file with the serial nuber in it... and the option to generate a random IMEI.

FWIW... I had written dos batch files (windows ".cmd") files to extract framework and recompile it previously... just thinking of writing an actual windows program to do the whole thing.
[Nook Color Android Development] mr_fosi:
If I knew anything about the vocabulary and syntax of a real programming language, I'd be able to do more but alas, my college credits were spent elsewhere.
[Nook Color Android Development] DizzyDen:
No worries Fosi... I'll get something put together to do what people need... as far as the intent to use adb connection to get serial... if that fails give option of text or random... what's ppl's thoughts on that?
[Nook Color Android Development] martian21:
I think random is a bad idea. This will create a lot of problems when people switch ROMs and don't use the same number. You can already see people having issues with Swype and Xfinity.

Would it be easier to pull the MAC	address and generate an IMEI from it? Like the S/N it isn't going to change. Whatever solution it needs to ensure the same device gets the same number otherwise it will create problems when IMEA numbers start mysteriously changing.

When I changed my framework.jar from the "public" IMEI to one I made up for myself it made Swype very angry.

Martian21
[Nook Color Android Development] DizzyDen:
Atually... the IMEI generation would ONLY have to happen the first time... then the app will have it stored.... it would only have to regenerate another if it were lost/deleted.... also planned to store it in file on computer AND in data on the NOOK (IF adb is working)
[Nook Color Android Development] mr_fosi:
I think that is a fine idea.

A lot of ppl here don't know ADB from a hole in the ground, but we could bundle a short txt file with it telling them how to get their serial from the plain text on the NC.

The random part... is ok I suppose since there's prolly some conspiracy nuts out there who don't want their serial tied up in their IMEI.

The main beef of the Swype guy in that blog post was that erroneous data jack up their stat metrics, but what if we can throw them a bone there?

What do you think about standardizing the first and last two digits of the 16 char (or the first two and last one of the 15 char) IMEI that are generated? That way they are all reported as tests with the same software version. That might serve to allay some of the "statistics are really important" fears that the Swype people put forth in that blog post. This would leave 12 chars to work with, which leaves billions of number combinations.

I'd hate for this tool to be a reason for large software developers to clamp down on the progs that people use (HBO/Swype/etc) and if we give them a way to quantify non-standard devices they may leave us alone. On the other hand, they could use this info to block such numbers, but there's an easy way around that.

What do you think?
[Nook Color Android Development] martian21:
Fixed it :-)

Sorry, not trying to be a jerk but I work in software QA and if you give the user the option to mess something up they will every time!

At the very minimum I think any solution that is not based off a unique number (ie. S/N or MAC) should be made intentionally difficult and come with stern warnings to prevent those who shouldn't use it from using it.
[Nook Color Android Development] DizzyDen:
Actually... one of the options I was toying around with in my head is a correct 15 digit "test" IMEI with the last digit correctly calculate.... and a 17 digit "test" version that would have as many digits as possible from the seiral number...

I suppose I could throw in another user option for 15 or 17 digit IMEI generation.

I am thinking along the lines of including bare bones adb packaged with the app... if the drivers are insatalled it should work fine... perhaps driver installation as well in my app... when the app runs... if it finds the saved IMEI from previous runs... pop up an option to regenerate or use existing IMEI... if it doesn't find the saved IMEI data or if choice is to generate.... IF adb devices worked... use the serial number returned... if it fails... pop up window offering to generate one or load serial number from a text file.

The ONE downside I can foresee is exactly what you describe in the swype issue... providing the user the chance to change something may cause them to get pissy... that's kind of why I want to stick with drawing number/data from the device itself... and still think that is the best way to go.

The one possible issue is those that cannot seem to get adb working to draw the unique data from the device.
[Nook Color Android Development] hoodred:
what part to change ?

Sorry to interupt

I was able to baksmali the classes.dex

Which file do i need to change and what changes do I need to make ?

Thanks for all the help.
[Nook Color Android Development] mr_fosi:
baksmali extracts the framework.jar to a directory you specify.

smali is what builds the classes.dex that you swap back into the framework.jar after you've modded the correct .smali to add your IMEI.

In specified directory is \android\telephony\TelephonyManager.smali and this is the file you need to modify. The rest of the instructions are here.
[Nook Color Android Development] paleh0rse:
Mr_fosi pointed out to me that the S/N is also stored as plain text in:

/rom/devconf/SerialNumber

Any user who would use this tool should also be able to view that file in any file manager / text editor on the NC. So, worst case, they could then fat-finger it into this tool. Heck, if adb does work, the tool could even compare that text file to the "adb devices" result just to be sure they're the same... just a thought.

On another note, as long as the resulting IMEIs conform to the "test IMEI" standard, and our algorithm is disclosed publicly, we may even have a real shot at getting Swype and others to back off... maybe... hopefully...
[Nook Color Android Development] DizzyDen:
Getting them to back off... is one major reason I have injected myself into the threads to prompt people to use correctly formatted IMEI's and suggeste people use their serial numbers (as many of the digits as possible) for them.
[Nook Color Android Development] actorman46:
Thanks guys for the work. With all the issues you all are bringing up, should we wait until the software is ready to modify our nooks?

Sent from my NookColor
[Nook Color Android Development] mr_fosi:
If you are competent to do the mod yourself then there is no need to wait.

I would suggest that you follow what has been suggested here and to generate an IMEI for yourself that is based on the last 14 digits of your s/n. The first two digits of the IMEI should be "00" to denote it as a test number.

I still think it would be useful to standardize the last two as well (which denote the software version your device is running), but there hasn't been much comment on that. I personally favor something higher than 10 since most devices don't get anywhere near 10 software updates before they are obsoleted.
[Nook Color Android Development] RASTAVIPER:
This new app that U r discussing about, will create a framework.jar file without the problems and the risk of what we can use now?
[Nook Color Android Development] RASTAVIPER:
This new app that U r discussing about, will create a framework.jar file without the problems and the risk of what we can use now?Or is just another way to make the same thing that someone could make it also before?
[Nook Color Android Development] DizzyDen:
The windows program I am putting together will create you a unique IMEI TelephoneProvider.smali inside framework.jar. It will make it so you do not have to manually edit the file, and will not have the same IMEI. The IMEI will be based off your NC serial number if adb works, or if you manually input it in a pop up.
[Nook Color Android Development] martian21:
You sure are a gentleman and a scholar!
[Nook Color Android Development] DizzyDen:
Thank you, but I am only taking mthe0ry and your work to the next level... should also avoid you having to generate new framework.jar for everyone for every different ROM out... and every update.
[Nook Color Android Development] dexx0008:
what are the chances this will be included in cm7 as a nook specific item? I think an official solution would be best so you don't have everyone using imei differently. Based off serial number and being reported as a test imie is a great idea.
[Nook Color Android Development] DizzyDen:
OK.... coding has began.... here's the program's functions.... any requests/recommendations should NOT be addressed in this thread... wait for my own thread when I have a working application available...

; Author: DizzyDen
;
; Program Functions:
;	Check if 7zip unzip program available in user's path or program install location
;	install 7zip in program install location if necessary
;	Extract framework.jar from update
;	Check if baksmali.jar is available in user's path or program install location
;	install baksmali.jar in program install location if necessary
;	baksmali extract framework.jar
;	Generate IMEI
;	Ask User IMEI(15) or IMEI(17) IMEI (17 default) NOTE: DizzyDen's naming convention here
;	Use previous run if exist
;	Use manual input if desired
;	Use adb.exe if available
;	Check for manual input if adb fails
;	Use random if required
;	Format device serial number to test IMEI standards if necessary (17 digit "TEST" IMEI default) "00-ABCDEF-GHIJKL-MNO"
;	where ABCDEFGHIJKLMNO are the FIRST 15 digits of serial number or user input
;	If IMEI(15) selected... automatically generate last digit as defined in IMEI standards
;	Save IMEI.gen to program install location for future runs
;	Patch "IMEI.fix" using generated IMEI ... IMEI.fix is the patch to TelephoneProvider.smali
;	edit system/lib/TelephoneProvider.smali
;	rename current getDeviceID() to getDeviceID2()
;	append patched "IMEI.fix" to end of TelephoneProvider.smali
;	Check if smali.jar exists in user's path or program install location
;	install smali.jar in program install location if necessary
;	smali compress classes.dex
;	Update framework.jar with new classes.dex
;	Update ROM zip with new framework.jar
;	End

martian21: If you want me to take this to a different thred at this point I will... want to keep your thread as clean as possible. But some may see something I am missing and want to let me know... I think I have all bases covered, but know some are going to want to address winrar... winzip... etc... and will look at including uniextract functions.
[Nook Color Android Development] DizzyDen:
As for what the GREAT coders of CM7 decide to include is unknown... I know they have stated that a solution is being addressed... I don't know what it will be.

This program will be a fill-in until... and should be able to be used (even if I have to modify it after their fix) to ensure a user ALWAYS keeps the same IMEI once it is generated in this program.
[Nook Color Android Development] dexx0008:
excellent, thanks.
[Nook Color Android Development] SuperDeform:
good coding im aware now
[Nook Color Android Development] BroDroid:
I don't use adb, and used a friends computer to initially root my NOOKcolor. I do all upgrading straight from my NOOKcolor. Will there be a way for me to use this also? I'm talking about the fix to have individual imei numbers.

Sent from my Droid
[Nook Color Android Development] DizzyDen:
I may have been harsh in initial response....

Yes... this will be a method to update the ROM zip files... not for adb to push framework.jar to nook... but I may add that option as well.
[Nook Color Android Development] TDO:
Sounds great.

It would be nice if the program would offer the manual input of an IMEI.

I have an old phone it don't use anymore - so I have an IMEI free to use ...
[Nook Color Android Development] DizzyDen:
As stated in my post regarding the program I am developing (almost done as a matter of fact) I currently intend to include the opportunity to manually input a serial number or IMEI... but I can see potential abuse of that, so I am still internally debating whether to include manual input or not.

I really hate it when both my brain cells aren't on the same page on things.
[Nook Color Android Development] martian21:
Hey DizzyDen,

You could create a Donate! version that allows manual entry of the IMEA. That should create a sufficient barrier to entry for those unwilling to learn to use ADB and perhaps put a little coin in your pocket. Win - Win!

Martian21
[Nook Color Android Development] ivanmmj:
Does the change in IMEI in the framework propagated into what the network sees on a phone? I only ask because recently, due to a small mistake, several Nexus S owners were left with their EFS partitions deleted and that partition is what holds the IMEI on Samsung phones. The phone automatically recreated the partition but it now uses the Samsung failsafe IMEI. The problem is that if people who had this happened to them live within the same network, the network is blacklisting them for sharing the same IMEI and their phones are basically becoming useless. Even if the program didn't let them type in their own IMEI, if they can show picture proof of their IMEI, I'm thinking we can provide them with a fix for their phones. (Assuming that the changes in the framework affect the IMEI reported to the network.)
[Nook Color Android Development] mr_fosi:
I don't work for a cellular company, so I can't speak for what the guy on the other end of the line sees.

Having said that, the IMEI is clearly used for something and my guess is that, as stated a couple times already, a person is playing with fire if they try to spoof or clone another phone's IMEI.

For the NC, we are apparently fairly safe since we will never be able to connect to a cell network. The hottest water we are able to get in is with software developers who use the IMEI as a basis for their backend statistics.
[Nook Color Android Development] DizzyDen:
As of right now... I have working program that IF adb is working... will read the serial number off the nook partition /dev/block/mmcblk0p2 and create a 17 digit "Test" IEMI off of that.

It will accomplish the following so far:

* test for working java

1. test for ADB working

2. attempt to find the latest ROM zip file in the directory... allow confirmation or browsing to find it

3. extract framework.jar from it

4. baksmali framework.jar

5. IF the file already exists from previous run... offers to use existing IMEI

6. mount /dev/block/mmcblk0p2 to /rom if ADB working and necessary

7. read serial number from /dev/block/mmcblk0p2/DevConf/DeviceID if necessary

8. generate a "test" (i.e. 00-) IMEI from the left most 15 digits of the device serial number

9. update TelephoneProvider.smali by renaming getDeviceID() to getDeviceID2()

10. appends the patch to the end of original TelephoneProvider.smali

11. smali changes

12. update framework.jar

13. update ROM update zip file... appending "-IMEI" to the name

NOTES:

at this point I have not included the ability to manually input a number.

have not included random generation yet... will be included shortly.

IF you have ADB working (the program includes minimilistic adb, smali, baksmali and 7za if needed) this will generate a unique IMEI based off of your serial number for you.

If you would like to test at this point... I will create new thread and upload.
[Nook Color Android Development] mr_fosi:
I'd be happy to. :D

I feel like a heel not being able to actually do anything to help you. :(
[Nook Color Android Development] DizzyDen:
Don't... I love doing this kind of stuff....

btw... I did this in an environment called AutoIT... a basic language on stehroids... will be happy to share source code as well.

will be uploaded and new thread shortly.

A couple of caveats.. there are a few dialogue boxes that may pop up every now and then.. most will auto disappear after 5 seconds... some were just for testing and haven't been removed at this point... can still serve as a helper if needed... if they don't go away... just click the "OK" button... they will be removed after more testing and features are implemented or opted against.
[Nook Color Android Development] fuzzynco:
What zip file are you talking about?

I'm running Nookie Froyo on SD. Its creation is via restoring an .img

to an SD card (no .zip for installing via CWR). How do I make the

zip to update and apply it to SD card OS?

The standalone CWR card I have updates emmc not the SD card?

Where do I find a modded CWR to update the SD card ?
[Nook Color Android Development] DizzyDen:
Easier way would be to just create the framework.jar and either adb push it... or copy it from sd to /framework folder on /dev/block/mmcblk0p1 (you have to moun the partition r/w first)