[Android Software Development] CosmicDan:
No, it's not for CRT on/off animation. It's only for old MIUI, no longer on new ones.

No idea how to implement CRT animation.

---------- Post added at 11:02 AM ---------- Previous post was at 10:51 AM ----------

Right, long post - prepare yourself. Here is my full build batch script, based on latest CM10 for my device (FXP137) and 2.9.7 for Nexus S. For those who don't know, "::" are comments and ignored by the script (I kept them there for your info).

cls
@echo off
echo MIUI Build script for CM10
echo --------------------------
echo.
IF EXIST "%CD%\system" (
echo [!] A folder named system already exists!
echo Please delete or rename it first.
pause>nul
EXIT
)
IF NOT EXIST "%CD%\base_miui" (
echo [!] There is no folder named base_miui in the current
echo folder! Please place the miui system template here now.
pause>nul
)

SETLOCAL
SET BUILDER_PATH=%CD%
SET PATH=%PATH%;%CD%\base_tool\;
echo New build log started>"%BUILDER_PATH%\~build.log"
call logecho SET WORK=%TEMP%\miui_build
echo [i] Temporary folder set, this will be removed when done
echo Work folder: %TEMP%\miui_build
IF EXIST "%WORK%" (
echo [i] Previous work folder found, removing...
RMDIR /S /Q "%WORK%"
)
mkdir "%TEMP%\miui_build"
call logecho2 echo [i] Installing MIUI frameworks for APKTool...
call logecho java -jar base_tool\apktool.jar if base_miui\framework\framework-res.apk
call logecho java -jar base_tool\apktool.jar if base_miui\framework\framework-miui-res.apk

:: v0.1.0.0
call logecho mkdir system
call logecho2 echo [i] Copying CM10 files...
call logecho2 echo bin...
call logecho xcopy /e /y base_jb\bin system\bin\
call logecho2 echo etc...
call logecho xcopy /e /y base_jb\etc system\etc\
call logecho2 echo fonts...
call logecho xcopy /e /y base_jb\fonts system\fonts\
call logecho2 echo lib...
call logecho xcopy /e /y base_jb\lib system\lib\
call logecho2 echo semc...
call logecho xcopy /e /y base_jb\semc system\semc\
call logecho2 echo tts...
call logecho xcopy /e /y base_jb\tts system\tts\
call logecho2 echo usr...
call logecho xcopy /e /y base_jb\usr system\usr\
call logecho2 echo vendor...
call logecho xcopy /e /y base_jb\vendor system\vendor\
call logecho2 echo xbin...
call logecho xcopy /e /y base_jb\xbin system\xbin\
call logecho2 echo [i] Copying MIUI files...
call logecho2 echo app...
call logecho xcopy /e /y base_miui\app system\app\
::call logecho2 echo bin (specific files only)...
::nothing in bin is used
call logecho2 echo etc (specific files only)...
::call logecho copy /y base_miui\etc\be_movie system\etc\
::call logecho copy /y base_miui\etc\be_photo system\etc\
::call logecho copy /y base_miui\etc\audio_effects.conf system\etc\
call logecho copy /y base_miui\etc\yellowpage.db system\etc\
call logecho2 echo etc/permissions (specific files only)...
call logecho copy /y base_miui\etc\permissions\miui-framework.xml system\etc\permissions
call logecho copy /y base_miui\etc\permissions\com.google.android.media.effects.xml system\etc\permissions
call logecho copy /y base_miui\etc\permissions\com.google.widevine.software.drm.xml system\etc\permissions
call logecho copy /y base_miui\etc\permissions\com.google.android.maps.xml system\etc\permissions
call logecho2 echo fonts...
call logecho xcopy /e /y base_miui\fonts system\fonts\
call logecho2 echo framework...
call logecho xcopy /e /y base_miui\framework system\framework\
call logecho2 echo lib (specific files only)...
call logecho copy /y base_miui\lib\content-types.properties system\lib\
call logecho copy /y base_miui\lib\liblbesec.so system\lib\
:: Fix mediascanner
call logecho copy /y base_miui\lib\libdrmframework_jni.so system\lib\
call logecho copy /y base_miui\lib\libmedia_jni.so system\lib\
call logecho copy /y base_miui\lib\libmtp.so system\lib\
:: Screen Security
call logecho copy /y base_miui\lib\libphonelock.so system\lib\
:: Media/Google related
call logecho copy /y base_miui\lib\libfacelock_jni.so system\lib\
call logecho copy /y base_miui\lib\libffplayer_jni.so system\lib\
call logecho copy /y base_miui\lib\libflint_engine_jni_api.so system\lib\
:: These two are for Google Now Voice Search, but they are too big so I skip them
::call logecho copy /y base_miui\lib\libgcomm_jni.so system\lib\
::call logecho copy /y base_miui\lib\libgoogle_recognizer_jni.so system\lib\
call logecho copy /y base_miui\lib\libpatts_engine_jni_api.so system\lib\
call logecho copy /y base_miui\lib\libvideochat_jni.so system\lib\
call logecho2 echo media...
call logecho xcopy /e /y base_miui\media system\media\
call logecho2 echo xbin (specific files only)...
call logecho copy /y base_miui\xbin\invoke-as system\xbin\
call logecho copy /y base_miui\xbin\su system\xbin\

call logecho2 echo [i] Deleting specific MIUI files...
call logecho del system\app\Gmail.apk
call logecho del system\app\Maps.apk
call logecho del system\app\MIUIStats.apk
call logecho del system\app\Tag.apk
call logecho del system\app\Updater.apk
call logecho del system\app\YouTube.apk
call logecho del system\app\BugReport.apk
call logecho del system\app\Nfc.apk
call logecho del system\app\MusicFX.apk
call logecho del system\app\QuickSearchBox.apk
call logecho del system\app\LiveWallpapers.apk
call logecho del system\app\Galaxy4.apk
call logecho del system\app\MagicSmokeWallpapers.apk
call logecho del system\app\VisualizationWallpapers.apk
call logecho del system\app\NoiseField.apk
call logecho del system\app\PhaseBeam.apk
call logecho del system\app\HoloSpiralWallpaper.apk
call logecho2 echo [i] Deleting non-English TTS files...
call logecho del system\tts\lang_pico\de-DE_gl0_sg.bin
call logecho del system\tts\lang_pico\de-DE_ta.bin
call logecho del system\tts\lang_pico\es-ES_ta.bin
call logecho del system\tts\lang_pico\es-ES_zl0_sg.bin
call logecho del system\tts\lang_pico\fr-FR_nk0_sg.bin
call logecho del system\tts\lang_pico\fr-FR_ta.bin
call logecho del system\tts\lang_pico\it-IT_cm0_sg.bin
call logecho del system\tts\lang_pico\it-IT_ta.bin

call logecho2 echo [i] Copying specific CM10 files...
::call logecho copy /y base_jb\app\Camera.apk system\app\
:: compass fix
call logecho copy /y base_jb\etc\sensors.conf system\etc\
:: xperia/playstation
call logecho copy /y base_jb\framework\com.playstation.playstationcertified.jar system\framework\
call logecho copy /y base_jb\framework\playstationcertified.jar system\framework\
call logecho copy /y base_jb\framework\xperiaplaycertified.jar system\framework\
call logecho copy /y base_jb\app\preinstalledservice.apk system\app\
call logecho copy /y base_jb\app\com.sonyericsson.androidapp.storefront.apk system\app\
call logecho copy /y base_jb\etc\permissions\com.playstation.playstationcertified.xml system\etc\permissions\
call logecho copy /y base_jb\etc\permissions\com.sony.android.playstationcertified.xml system\etc\permissions\
call logecho copy /y base_jb\etc\permissions\com.sonyericsson.android.xperiaplaycertified.xml system\etc\permissions\

call logecho2 echo.
call logecho2 echo [i] Adding post-build mods....
call logecho xcopy /e /y base_postmods\system system\

:: -----------------------------------------------------------
call logecho2 echo [i] Patching files...
call logecho mkdir "%WORK%\app"
call logecho mkdir "%WORK%\framework"

CD /D "%BUILDER_PATH%\base_postmods_inject\app"
FOR /D %%D IN (*.apk) DO CALL :inject_apk %%D app
CD /D "%BUILDER_PATH%\base_postmods_inject\framework"
FOR /D %%D IN (*.jar) DO CALL :inject_jar %%D framework
CD /D "%BUILDER_PATH%\base_postmods_inject_dex\app"
FOR /D %%D IN (*.apk) DO CALL :inject_dex %%D app
CD /D "%BUILDER_PATH%\base_postmods_inject\framework"
FOR /D %%D IN (*.apk) DO CALL :inject_apk %%D framework

call logecho2 echo [i] Cleaning up work folder...
call logecho rmdir /S /Q "%WORK%\app"
call logecho rmdir /S /Q "%WORK%\framework"
call logecho mkdir "%WORK%\app"
call logecho mkdir "%WORK%\framework"

call logecho2 echo.
call logecho2 echo [i] Cleaning up temporary files...
call logecho RMDIR /S /Q "%WORK%"
call logecho2 echo [i] All done! "system" build finished =)
call logecho2 echo.
call logecho2 echo.
call logecho pause
GOTO END

:: -------------------------------
:: Helper functions
:: -------------------------------

:inject_apk
call logecho2 echo [i] %1 (from %2)...
call logecho copy "%BUILDER_PATH%\system\%2\%1" "%WORK%\%2\"
call logecho CD /D "%WORK%\%2"
call logecho java -jar "%BUILDER_PATH%\base_tool\apktool.jar" d "%1"
call logecho2 echo [i] Injecting new files...
call logecho xcopy /e /y "%BUILDER_PATH%\base_postmods_inject\%2\%1" "%~n1\"
IF EXIST "%BUILDER_PATH%\base_postmods_inject\%2\%1.patch" (
call logecho2 echo [i] Patch file found, running...
call logecho copy "%BUILDER_PATH%\base_postmods_inject\%2\%1.patch" "%CD%"
call logecho patch -p0 -i "%CD%\%1.patch" -d %1
call logecho2 echo [i] Checking for rejects...
FOR /F %%F IN ('dir /b /s %1\*.rej') DO CALL :handle_rej "%%F"
call logecho2 echo ...everything seems OK! Building...
)
call logecho java -jar "%BUILDER_PATH%\base_tool\apktool.jar" b "%~n1"
::call logecho java -jar "%BUILDER_PATH%\base_tool\signapk.jar" "%BUILDER_PATH%\base_tool\testkey.x509.pem" "%BUILDER_PATH%\base_tool\testkey.pk8" "%~n1\dist\%1" "%~n1\dist\%~n1_signed.apk"
:: We need to skip framework build-caching since apktool doesn't detect changed resources properly
IF NOT "%1"=="framework-res.apk" (
call logecho xcopy /e /y "%~n1\build" "%BUILDER_PATH%\base_postmods_inject\%2\%1\build\"
)
call logecho CD /D "%BUILDER_PATH%"
call logecho move /y "%WORK%\%2\%~n1\dist\%~n1.apk" "system\%2\%1"
call logecho2 echo ...OK.
GOTO :EOF

:inject_dex
call logecho2 echo [i] %1 (from %2) (dex only)...
call logecho copy "%BUILDER_PATH%\system\%2\%1" "%WORK%\%2\"
call logecho CD /D "%WORK%\%2"
call logecho 7z.exe e -y "%1" classes.dex
call logecho ren "%1" "%~n1.zip"
call logecho java -jar "%BUILDER_PATH%\base_tool\baksmali-1.3.3.jar" -o "%1/" classes.dex
call logecho2 echo [i] Injecting new files...
call logecho xcopy /e /y "%BUILDER_PATH%\base_postmods_inject_dex\%2\%1" "%1\"
IF EXIST "%BUILDER_PATH%\base_postmods_inject_dex\%2\%1.patch" (
call logecho2 echo [i] Patch file found, running...
call logecho copy "%BUILDER_PATH%\base_postmods_inject_dex\%2\%1.patch" "%CD%"
call logecho patch -p0 -i "%CD%\%1.patch" -d %1
call logecho2 echo [i] Checking for rejects...
FOR /F %%F IN ('dir /b /s %1\*.rej') DO CALL :handle_rej "%%F"
call logecho2 echo ...everything seems OK! Building...
)
call logecho del classes.dex
call logecho java -Xmx512M -jar "%BUILDER_PATH%\base_tool\smali-1.3.3.jar" "%1/" -o classes.dex
call logecho 7z.exe a -y "%~n1.zip" classes.dex
call logecho del classes.dex
call logecho CD /D "%BUILDER_PATH%"
call logecho move /y "%WORK%\%2\%~n1.zip" "system\%2\%1"
call logecho2 echo ...OK.
GOTO :EOF

:inject_jar
call logecho2 echo [i] %1 (from %2)...
call logecho copy "%BUILDER_PATH%\system\%2\%1" "%WORK%\%2\"
call logecho CD /D "%WORK%\%2"
call logecho ren %1 %~n1.apk
call logecho java -jar "%BUILDER_PATH%\base_tool\apktool.jar" d "%~n1.apk"
::IF "%1"=="framework.jar" (
:: echo Deleting AudioFX NoiseSuppressor...
:: DEL /Q "%~n1\smali\android\media\audiofx\NoiseSuppressor.smali"
::)
call logecho2 echo [i] Injecting new files...
call logecho xcopy /e /y "%BUILDER_PATH%\base_postmods_inject\%2\%1" "%~n1\"
IF EXIST "%BUILDER_PATH%\base_postmods_inject\%2\%1.patch" (
call logecho2 echo [i] Patch file found, running...
call logecho copy "%BUILDER_PATH%\base_postmods_inject\%2\%1.patch" "%CD%"
call logecho patch -p0 -i "%CD%\%1.patch" -d %~n1
call logecho2 echo [i] Checking for rejects...
FOR /F %%F IN ('dir /b /s %~n1\*.rej') DO CALL :handle_rej "%%F"
call logecho2 echo ...everything seems OK! Building...
)
call logecho java -jar "%BUILDER_PATH%\base_tool\apktool.jar" b "%~n1"
::call logecho java -jar "%BUILDER_PATH%\base_tool\signapk.jar" "%BUILDER_PATH%\base_tool\testkey.x509.pem" "%BUILDER_PATH%\base_tool\testkey.pk8" "%~n1\dist\%~n1.apk" "%~n1\dist\%~n1_signed.apk"
::call logecho ren "%~n1\dist\%~n1_signed.apk" %1
call logecho xcopy /e /y "%~n1\build" "%BUILDER_PATH%\base_postmods_inject\%2\%1\build\"
call logecho CD /D "%BUILDER_PATH%"
call logecho move /y "%WORK%\%2\%~n1\dist\%~n1.apk" "system\%2\%1"
call logecho2 echo ...OK.
GOTO :EOF

:handle_rej
IF EXIST "%1" (
call logecho2 echo [!] Reject found -
call logecho2 echo %1
call logecho2 echo [!] Build process halted. Please resolve the
call logecho2 echo conflict and update the patch file. Press
call logecho2 echo any key to exit.
pause>nul
EXIT
)
GOTO :EOF

:: -------------------------------
:: -------------------------------
:: -------------------------------

:END
call logecho ENDLOCAL

init.d script:

#!/system/bin/sh
# Misc. fixes for MIUI port

# Fix Play Store crashing on startup
if [ ! -d /data/download ];
then
mkdir /data/download
chmod 777 /data/download
fi;

# Fix stale symlinks from Link2SD bug
if [ -d /data/sdext2 ];
then
chmod -R 777 /data/sdext2/*
fi;

framework.jar.patch:

--- smali/android/content/res/AssetManager.smali Tue Jan 20 09:26:36 1970
+++ smali/android/content/res/AssetManager.smali Tue Jan 20 09:26:36 1970
@@ -308,12 +308,18 @@
return v0
.end method

+.method private final native addRedirectionsNative(I)V
+.end method
+
.method static final native applyStyle(IIII[I[I[I)Z
.end method

.method static final native applyThemeStyle(IIZ)V
.end method

+.method private final native clearRedirectionsNative()V
+.end method
+
.method static final native copyTheme(II)V
.end method

@@ -508,6 +514,9 @@
.method private final native seekAsset(IJI)J
.end method

+.method private final native splitThemePackage(Ljava/lang/String;Ljava/lang/String;[Ljava/lang/String;)I
+.end method
+

# virtual methods
.method public final native addAssetPath(Ljava/lang/String;)I
@@ -559,6 +568,9 @@
goto :goto_0
.end method

+.method public final native attachThemePath(Ljava/lang/String;)I
+.end method
+
.method public close()V
.locals 1

@@ -653,6 +665,9 @@
return v0
.end method

+.method public final native detachThemePath(Ljava/lang/String;I)Z
+.end method
+
.method final ensureStringBlocks()V
.locals 1

@@ -725,10 +740,22 @@
throw v0
.end method

+.method public final native generateStyleRedirections(III)Z
+.end method
+
.method final native getArrayIntResource(I)[I
.end method

.method final native getArraySize(I)I
+.end method
+
+.method public final native getBasePackageCount()I
+.end method
+
+.method public final native getBasePackageId(I)I
+.end method
+
+.method public final native getBasePackageName(I)Ljava/lang/String;
.end method

.method public final native getCookieName(I)Ljava/lang/String;

Continued in next post...