nvllsvm / freecyngn

A small tool to remove proprietary parts from CyanogenMod 13
Do What The F*ck You Want To Public License
126 stars 10 forks source link

Support for CM12 #13

Closed ghost closed 9 years ago

ghost commented 9 years ago

/system/freecyngn/log says: "!!! Did not find Settings.apk on /system, is any ROM installed?" Moto G 2013, Android 5.0.2, CM-Version: 12-20150304-NIGHTLY-falcon, works perfectly

mar-v-in commented 9 years ago

I did not do any tests on Android 5 / CM 12 yet.

Until now, cyngn seems not to have added Google Analytics to CM12. It has always been the main task of freecyngn to remove these. Everything else can easily be done by opening the zip file before flashing and removing critical apps from there. The list of apps that are to be removed, is https://github.com/mar-v-in/freecyngn/blob/master/freecyngn.sh#L73 I don't want to release anything for CM12 while in nightly and Google Analytics not added back again, because I don't want that users trust in freecyngn while an cm update ships a version of Google Analytics that is not removed by freecyngn.

ghost commented 9 years ago

It seems that CM12 has a completly different structure in reference to the structure of the zip

jago@JU09C-JAGO-01:~/Downloads/smartphones/moto_g/cm$ ll
insgesamt 254724
drwxr-xr-x 3 jago users      4096  6. Mär 08:56 ./
drwxr-xr-x 9 jago users      4096  6. Mär 08:55 ../
drwxr-xr-x 5 jago users      4096  6. Mär 08:56 cm-12-20150304-NIGHTLY-falcon/
-rw-r--r-- 1 jago users 260820644  6. Mär 08:55 cm-12-20150304-NIGHTLY-falcon.zip
jago@JU09C-JAGO-01:~/Downloads/smartphones/moto_g/cm$ ll cm-12-20150304-NIGHTLY-falcon/system
insgesamt 16
drwx------ 2 jago users 4096  6. Mär 08:56 ./
drwxr-xr-x 5 jago users 4096  6. Mär 08:56 ../
-rw-r--r-- 1 jago users 4556 28. Feb 2008  build.prop

And searching for .apk has no results

jago@JU09C-JAGO-01:~/Downloads/smartphones/moto_g/cm$ find cm-12-20150304-NIGHTLY-falcon/ -iname '*.apk'
DocSniper commented 9 years ago

CM 12 is using Google Analytics. They switched recently from V2 to V3: http://review.cyanogenmod.org/#/c/95993/

grote commented 9 years ago

How about a test version for CM12, so freecygn is already tested and works once CM12 becomes "stable"? There's also devices that receive CM12 already via OTA.

mar-v-in commented 9 years ago

Google Analytics was added less than 24 hours ago, give me some time to sort things out :)

grote commented 9 years ago

Is 9212f01d already fixing this or is more needed?

DocSniper commented 9 years ago

I tired the new version of the script but afterwards settings.apk is corrupt and crashes so the complete system is unusable. Another problem is, the APKs of the CM Apps aren't deleted even with the new version of the script.

mar-v-in commented 9 years ago

@grote I'm sorry to say that, but the way freecyngn worked on pre-5.0 systems is probably no longer possible.
ART does not allow to use it in recovery easily anymore, but freecyngn is highly based on Java code and thus requires a Java VM. The only possible way not to completely rewrite everything in C/C++ (which would be an unreasonable amount of work) is to do the patching during the first system startup after ART was initialized but before the system (and thus Google Analytics) is started. I'm still investigating how to do this in a good way, but I'm currently very busy. I'll let you know about my findings sometime next week ;)

DocSniper commented 9 years ago

After thinking about this problem for a while I have two ideas to ace this.

How aout using /data/local/userinit.sh for the script ? Or isn't ART available at this moment ?

Another possible opinion is maybe executing the script after booting is finished. Sure this isn't the best solution to patch the system, but with internet connection disabled (user or freecyngn installer ZIP), modifying settings.apk, deleting the CM APKs and rebooting everything should be done.

mar-v-in commented 9 years ago

/etc/init.d/* as well as /data/local/userinit.sh (which is actually executed by /etc/init.d/90userinit) are 1. executed before ART is initialized and 2. are non-blocking, so the system and analytics will start faster than the patching is.

I think the best on-device approach will be:

  1. Install a freecyngn app (either from f-droid or when flashing a zip, include it)
  2. Move Settings app in a temporary location from the freecyngn app (with root), the recovery script or after the system was updated using addon.d hook.
  3. Replace it with a dummy replacement, that once launched, mentions that the patching is in progress.
  4. When the system is running (again, or continued to) use the freecyngn app to patch the Settings app from the temporary location and store it in another temporary location.
  5. When not using root, reboot into recovery and use a second stage (else do the following using root)
  6. Remove the dummy app and put the patched Settings app in place

When using root, the above process can be fully automatically, else it requires the user to boot back into recovery and flash a second stage zip. However the new approach requires some new work in the app.

Finally, I just wanted to add a quote by @cyanogen here (from this thread on G+):

Interestingly, our commercial version is no longer using Google Analytics for stats/metrics. GA is actually a terrible solution for collecting this kind of data because of it's use of sampling. We built a new in-house solution to house this data and rolled it out on COS12. Eventually we will consolidate it all.

So hopefully, we can come around all this messy patching of the Settings app someday and just remove files to have a free CM userspace again (at least on some devices) :pray:

relan commented 9 years ago

Looks like they have switched from Google Analytics to own solution (commit). Could you please review the current "proprietarisation" state of CM? Any ideas on how to block this new "anonymous statistics" are also welcome.