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: