[Security Discussion] unclefab:
Testers needed for WIP

The following is WIP (Work In Progress), and I need some testers.

I have successfully removed many jars, many libs and many xmls, and it works on my phone, but it may break this or that functionality (like audio/video recording, fm radio, video playing) on yours and that's why I need you guys to test and report how it goes.

Before to proceed copy your system/etc/permissions, system/framework and system/lib somewhere safe, make sure to have aroma file manager ready at hand, and that you have a backup of your system.

Safe to remove jars in system/framework:​

access.control.jar

allshare.jar

allshareJmDNS.jar

android.test.runner.jar

bmgr.jar

browsermanagement.jar

bu.jar

cneapiclient.jar

com.android.future.usb.accessory.jar

com.android.location.provider.jar (if you remove this jar then FusedLocation.apk will force close when the phone boots, greenify once the apk and click on the "hibernate all" widget everytime after booting to get rid of the annoyance)

com.android.nfc_extras.jar

com.broadcom.bt.jar

com.broadcom.nfc.jar

com.dropboxpartner.jar

com.google.android.maps.jar

com.google.android.media.effects.jar

com.google.widevine.software.drm.jar

com.quicinc.jar

com.samsung.android.sdk.bt.jar

com.samsung.device.jar

content.jar

CustFeature.jar

GlobalConfig.jar

ime.jar (stock keyboard)

javax.obex.jar

kies_feature.jar

libvtmanagerjar.jar

mmappframeworklib.lib.jar

mms-common.jar

monkey.jar

org.codeaurora.Performance.jar

org.simalliance.openmobileapi.jar

qcmmediaplayer.jar

requestsync.jar

sc.jar

scrollpause.jar

sec_feature.jar

sec_platform_library.jar

seccamera.jar

sechardware.jar

secmediarecorder.jar

secosp.jar

services-ext.jar

settings.jar

smartfaceservice.jar

smartfaceserviceapi.jar

smatlib.jar

stayrotation.jar

svc.jar

svi.jar

sws.jar

uiautomator.jar

videowall.jar

After you're done don't forget to wipe the dalvik-cache.

Bear in mind that it works for me cuz I removed nearly all the stock apps, but depending on your phone configuration you may have to keep more jars.

For example, the stock keyboard would probably not work anymore if ime.jar is gone, same story with the stock camera if seccamera.jar has been deleted.

The same applies to other apps and functionalities, but the good news is that most jars are self explanatory.

Safe to remove xmls in system/etc/permissions:​

access.control.xml

allshare_library.xml

allshareJmDNS_library.xml

android.hardware.nfc.xml

android.hardware.wifi.direct.xml

android.software.live_wallpaper.xml

android.software.sip.voip.xml

com.android.location.provider.xml (warning, to remove this xml you'll need to mod FusedLocation.apk in order to force it not to need the xml anymore)

com.android.nfc_extras.xml

com.broadcom.nfc.xml

com.google.android.media.effects.xml

com.google.widevine.software.drm.xml

com.samsung.android.sdk.bt.xml

com.samsung.device.xml

com.sec.feature.hovering_ui (accelorometer sensor)

com.sec.feature.irda_service.xml

com.sec.feature.yosemite.xml (accelorometer sensor)

kies_feature_library.xml

mmappframeworklib_library.xml

org.simalliance.openmobileapi.xml

sec_feature.xml (may break the stock FM radio, dunno about third part radios like Spirit)

sec_mdm.xml

seccamera.xml

secmediarecorder.xml (may break the stock FM radio, dunno about third part radios like Spirit)

smartfaceservice.xml

smat_library.xml

svi_library.xml

sws.xml

usb_print2.xml

videowall_library.xml

vtmanager_library.xml

Bear in mind that it works for me cuz I removed nearly all the stock apps, but depending on your phone configuration you may have to keep more xml.

For example, the nfc would probably not work anymore if one of the xmls that have "nfc" in the title are gone, same story for stock camera if seccamera.xml has been deleted.

The same applies to other functions, but fear not since most xmls are self explanatory.

Safe to remove files in system/lib:​

the whole drm folder

all files that have "google" in it

More files can be removed (about 60 that I tested up to now), but risks to break this or that functionality increase, and since I don't think that many people use such a barebone phone like me I'll pass for now.

If you want to know which libs I'm talking about just tell me and I'll add them.

Miscellaneous:​

- The system/etc/secure_storage folder.

- The system/etc/videotelephony folder.

- The system/tts folder (unless you use text to speech features).

- The system/usr/srec/en_US folder (unless you use google now's english offline typing features).

- The system/voicebargeindata folder.

- The system/wakeupdata folder

Special cases​

Am.jar​

It can be removed, and if at the same time you chmod 000 the am file in system/bin something interesting happens:

newly installed apps can't get super user rights, but apps that had previously been installed and are in the super su list work as usual.

I'm not 100 % sure but that could prevent privilege escalation by malicious apps or processes.

Let me know how it worked for you, but be careful and test it only with root apps that you know for sure are safe.

I made two scripts.

One to erase/disable am (but before to proceed, copy system/framework/am.jar somewhere safe):

#!/system/bin/sh

busybox mount -o remount,rw /system

busybox rm /system/framework/am.jar

busybox chmod 000 /system/bin/am

rm /data/dalvik-cache/system@framework@am.jar@classes.dex

One to restore/enable am (make a folder called scripts in your sd, and put am.jar inside):

#!/system/bin/sh

busybox mount -o remount,rw /system

busybox cp /sdcard/scripts/am.jar /system/framework

busybox chmod 0644 /system/framework/am.jar

busybox chmod 0755 /system/bin/am

Pm.jar​

It can be removed too, and if at the same time you chmod 000 the pm file in system/bin it seems to disable the package manager and enable one to install unsigned apps.

It can be useful in some situations (particularly when one needs to edit the adroid manifest for system apps), but remember that it's dangerous since any dodggy app could be installed. So be cautious and do it only with system apps and/or apps that you trust.

Don't forget to report here, thanks guys!!

Edit 25/12:

when pm.jar and the pm loader in system/bin are gone it prevents me from disabling apps receivers/components (like start on boot, factory reset etc.) with rom toolbox.

Not a big deal cuz pm can be easily enabled and disabled, but I report the issue nevertheless in case it happens to somebody else.....

Now, two scripts.

One to erase/disable pm (but before to proceed, copy system/framework/pm.jar somewhere safe):

#!/system/bin/sh

busybox mount -o remount,rw /system

busybox rm /system/framework/pm.jar

busybox chmod 000 /system/bin/pm

rm /data/dalvik-cache/system@framework@pm.jar@classes.dex

One to restore/enable pm (make a folder called scripts in your sd, and put pm.jar inside):

#!/system/bin/sh

busybox mount -o remount,rw /system

busybox cp /sdcard/scripts/pm.jar /system/framework

busybox chmod 0644 /system/framework/pm.jar

busybox chmod 0755 /system/bin/pm

That's all for today.

Now I wait for you guys, happy testing, at one point I'll edit what needs to be edited and I'll add everything to OP...