[Samsung Galaxy Ace 4] Nikiz:
#include
/*
* Your warranty is now void.
*
* I am not responsible for bricked devices, dead SD cards,
* thermonuclear war, or you getting fired because the alarm app failed. Please
* do some research if you have any concerns about features included in this ROM
* before flashing it! YOU are choosing to make these modifications, and if
* you point the finger at me for messing up your device, I will laugh at you.
*/

General:

CyanogenMod 11 for Samsung Galaxy Trend 2. (SM-G313HN) This is not 100% completed, so bugs can be expected. There are some bugs listed on this post and if you find more, report them to me. (Either to this thread or via private messages) It will help alot to fix them.

Note: Google apps are not included. Get them here. I recommend using Mini or smaller, because when installing a OTA update, the bigger packages don't fit on RAM if the internal storage is full. You can install the rest from Play store. It is also kinda pointless to have for example, Youtube and Google Maps on /system, because when they are updated, the updated versions go to /data anyway.

Screenshots:

Downloads:

* Latest build

* All builds

Installation:

* Install a custom recovery. (Get CWM here)

* Download the latest version to your SD-card.

* Boot into the recovery mode by pressing <Vol. Up> + <Home> + <Power>

* You can navigate on the recovery mode with the volume keys. <Power> opens the selection and <Back> goes to the previous menu.

* Backup your stock ROM by going to the SD card by going to "backup and restore" -> "backup to /storage/extSdCard". You need about 3-4 gigabytes of free space on the card, depending how full your internal storage is. You can go back to stock if you don't like this ROM, by going to "backup and restore" -> "restore from /storage/extSdCard".

* You need to do a factory reset before installing this. You can do this by selecting "wipe data/factory reset". The installation won't let you install the ROM without doing this.

* Select "install zip" -> "install from /storage/extSdCard" and then select the zip you downloaded.

* Optionally install the OpenGApps-package while you are in the recovery the same way. (Doesn't need a data wipe)

* When it is done installing, go back to the main menu and select "reboot system now" and that should be pretty much it. The first startup takes a while.

Updating:

CyanogenMod checks for updates weekly by default. You can update the phone manually by going to Settings -> About phone -> CyanogenMod-updates, tapping the refresh button and selecting the latest one. After it is downloaded, you can install it.

What works?

* Audio

* Bluetooth (At least file transfer between 2 devices is confirmed, no other devices tested. (For example. headsets, keyboards, etc.)

* Calls

* Camera

* Data connection

* DSP Manager

* GPS

* NFC

* Offline-charging

* OTA updates

* Text messages

* USB (Adb, MTP, PTP, UMS, Tethering, etc)

* Video playback/recording (Mostly.. Front camera video recording doesn't work and some codecs don't work.)

* WiFi

* Wired headsets (Audio, microphone, button)

Bugs:

* First startup might is laggy. The best way is to just skip everything, change the language and set up the accounts, etc. from the Settings app.

* Some videos don't play, because there are some codec issues. (For example on Facebook. YouTube seems to work fine.)

* Some have reported about higher battery drain when using WiFi compared to stock ROM.

* Reported that when calling or sending messages, the phone causes more interference to TV/radio signals than stock. (Excessive transmitting power?) Not too noticeable unless you are very close to the antenna, so it shouldn't cause too much problems. Possibly uses more battery.

* When USB debugging enabled and the phone is restarted, turning USB tethering on too quickly doesn't turn it on completely and removing the USB cable the phone causes the phone to freeze. (This happens when using Linux, the computer shows that it is trying to connect to the internet but the phone shows that USB tethering is not enabled) When this happens, it can be fixed (When the cable is not removed) by going to the settings -> developer settings and disabling ADB, then re-enabling it and finally then turning on USB tethering. Yes, Linux + ADB + turning on USB tethering within 10-20 seconds after rebooting. I know this doesn't affect many people, but happens to me frequently.

* Front camera video recording doesn't work.

Changelog:

===================================
Build 20151214
===================================
* Fix libskia. (Updated sources)
* Remove unused or otherwise useless binary blobs. List of blobs:
/system/bin/at_distributor
/system/bin/atx
/system/bin/atxd
/system/bin/usb_portd
/system/bin/usbdev_mode
/system/etc/apanic_rename.sh
/system/etc/copy_cp_imgs.sh
/system/etc/show_navi.sh
/system/etc/usb_portd.conf
/system/lib/lib_SA_GoogleFX_ver124b.so
/system/lib/libatlog.so
/system/lib/libatparser.so
/system/lib/libaudiosa.so
* Rework /system/etc/media_profiles.xml. (Doesn't seem to fix or break anything..)
* Change kernel compression from XZ to GZip. (Speeds up booting by few seconds)
* Disable CONFIG_KSWAPD_NOSWAP from kernel. (Enable better swapping)
* Remove unused services from /init.hawaii_ss_vivaltonfc3g_base.rc.

===================================
Build 20151209
===================================
* Android security patch December 1, 2015.
* Removed the a2dp_audio_hw patch, because it did not do anything.

===================================
Build 20151207
===================================
* Fixed libstagefrighthw. (Caused some app crashes, for example YouTube and Facebook)
* Enabled zRam. (This should speed up the phone nicely, when there are alot of apps running in the background.)
* Patched a2dp_audio_hw. I don't know if it changed anything.
* Cleaned the init scripts a bit.

===================================
Build 20151128
===================================
* Fixed bluetooth
* Fixed NFC
* This build now uses CyanogenMod /init instead of the stock one
* Now uses OTA updates (yay!)

===================================
Build 20151119
===================================
* Fixed the "WiFi amnesia" bug
* Fixed offline charger

===================================
Build 20151118
===================================
* Fixed the codec issues
* Built with newer sources, now shows "Android security patch level"

===================================
Build 20150829
===================================
* First release.

Source code:

* Device tree

* Kernel

Thanks to itigr for helping me alot in this project!