You are here

FLAC support for Motorola Milestone

Updated libraries:
29 June 2010: fixed the flac duration reported by the mediascanner (fixes also the flac seeking in the bTunes player)

(media database needs to be rebuilt for this fix to have an effect on the flac files already present on your SD card: menu>Settings>Applications>Manage applications>menu>Filter>All>Media Storage>Clear data - custom ringtones will need to be reassigned afterwards)
26 June 2010: applied FLAC decoder lock contention fix by Glenn Maynard

Native support for the Free Lossless Audio Codec in Android system. FLAC files can be used also as ring tones.
FLAC files will play in the Music.apk and any other players that use the standard system services.

Kenny Root's patches adjusted and applied to 2.1_r2 platform source:
Compiled for compatibility with other Milestone system libraries.

Consists of:
(<- modified MediaScanner and MediaFile classes in android/media)


Automatic installation from OpenRecovery:
Copy the extracted libraries and the framework.jar to /OpenRecovery/flac folder on your SD card.
Copy the extracted script to /OpenRecovery/scripts folder on your SD card.
Boot to recovery, launch the OpenRecovery and in the Run Script menu select

Automatic installation from G.O.T.’s OpenRecovery:
Copy the updated libraries and the framework.jar to /OpenRecovery/GOT/ocflac folder on your SD card.
Boot to recovery, launch the OpenRecovery and in the G.O.T. Modding Menu select Install FLAC support.
UPDATE: GOT OR 1.04a already contains the up to date libraries.

Automatic installation from ADBRecovery:
Copy the unpacked ocflac folder to your sdcard.
Copy the included script to the recovery folder on your sdcard (so it's like this: recovery/ - do not put it in the scripts subfolder).
Boot to recovery (power off,hold camera or X + power, then volume up+camera), apply (use d-pad and enter), then reboot.
Remove the file from the recovery folder.

Manual installation:
Copy the unpacked ocflac folder to your sdcard.
From adb shell or terminal on the phone do:

mkdir /sdcard/ocflacbackup
cp /system/framework/framework.jar /sdcard/ocflacbackup
cp /system/lib/ /sdcard/ocflacbackup
cp /system/lib/ /sdcard/ocflacbackup

mount -o remount,rw /dev/mtd/mtdblock6 /system
cp -f /sdcard/ocflac/framework.jar /system/framework
cp -f /sdcard/ocflac/ /system/lib
cp -f /sdcard/ocflac/ /system/lib
cp -f /sdcard/ocflac/ /system/lib
chmod 644 /system/framework/framework.jar
chmod 644 /system/lib/
chmod 644 /system/lib/
chmod 644 /system/lib/
mount -o remount,ro /dev/mtd/mtdblock6 /system

Then reboot the phone. The first reboot will take longer than usual, be patient. Second reboot might be needed for everything to settle down.

The framework.jar has been disassembled and reassembled by JesusFreke's smali/baksmali.

The framework.jar differs between different builds of Milestone system so I've assembled several versions, use the one appropriate for your build.

Download FLAC for 2.1 system:

updated libraries (w/o framework.jar) [29.6.2010]:

framework.jar + older libraries:
SHOLS_U2_02.38.0 (ES/FR/IT 2.1 fix)

SHOLS_U2_02.36.0 and SHOLS_U2_03.11.0 (CA/DE/Central Europe/HK/SG/TH/UK 2.1 fix)

SHOLS_U2_02.34.3 (HK 2.1 fix)

SHOLS_U2_02.31.0, SHOLS_U2_02.34.0 and SHOLS_U2_03.10.0 (CA/Central Europe/DE/FR/HK/IT/TH/UK 2.1)

SHOLS_U2_02.27.6 (Arabia/Israel 2.1)

SHOLS_U2_02.27.7 (RU 2.1)

SHLA_U2_03.05.0 (AR/BR/VE 2.1)

For those who want to incorporate the FLAC support into their framework.jar by themselves (usually because their framework.jar has been already modified or they use a firmware version that is not listed above), here are the smali files that need to be replaced in /android/media with the help of smali/baksmali:


Copy to /sdcard/openrecovery/updates. Apply with Open Recovery. :)
Framework.jar included
FLAC libraries up to date
Hope this helps

After I cleared the media database as suggested every ring tone I had set got blanked out and just defaulted to playing my music until I reset everything individually.

Affected ring tones and notifications all the way down to it playing music just plugging it to charge.

Oh yes, I should have mentioned that. The effect of rebuilding of the database is the same as when you change (upgrade) your SD card - you need to reassign all the custom ringtones and notification sounds, as they will be messed up.
More gentle approach might be to move all the flac files away from the SD card, then let the phone to scan the card without the flac files (it happens as soon as you change the USB connection from "Memory card access" to e.g. "Charge only"), then finally put them back - the database entries should be renewed afterwards.
That way, at least the mp3 and ogg files on SD card will retain their database indexes...

Any hope for a release of a framework.jar by tomorrow for SHOLS_U2_03.11.0 (New version for Canada Telus that was just released by GOT) I will understand if it is not ready but I would like it before I go away for the weekend.

The SHOLS_U2_03.11.0 framework is identical with the framework from SHOLS_U2_02.36.0. So you can safely use the framework.jar from the already uploaded archive (remember that the libraries in that archive are the older v3, better use the updated v4 ones from 29.6.2010). I've updated the listing above.

Will any of this work for people using the newly released hacked together Froyo for Milestone EU 2.36 kernel with Nexus One 2.2 software on top.

The 2.2 system will surely need a new version of the FLAC support. I'll work on it.

Hi, any chance on a FLAC version for the final 2.2?

If i edit the framework the current lib will work or a new lib is required?


To be honest, the last time I checked, the hacked 2.2 was a real mess.
Until the release somehow stabilizes and cleans up, I see no point in trying to adapt the FLAC support for it, as it can stop working as soon as the next update to this release is out.
I see too many chaotic replacements there and there is no track of the changes made...

are you going to release an update for 2.2.1?thank you

sorry, is this "Download FLAC for 2.1 system" can be used on HTC Hero GSM Stock Sense 2.1 ROM? so should I download the "updated libraries (w/o framework.jar) [29.6.2010]:" with file under attachments (MediaFile.smali and MediaScanner$MyMediaScannerClient.smali)?

Give me a suggestion if that is real to receive the middle east essays paper at the writing services, or maybe that's much better to order term papers for cheap?

Do not you get know that you are really very professional history dissertation writer and the custom dissertation services won’t compare with your writing skillfulness. If you continue to do the things like that, some guys would buy theses relating with this good topic not from custom thesis writing services, but buy from you also.

Add new comment

Filtered HTML

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.