Cyanogenmod 11 M6 compatibility, general rework

please see a description of changes and pending work here:
https://github.com/OpenPDroid/OpenPDroidPatches/issues/21