Default [MOD][HACK] Disable ASEC (Forward locked packages) on Jellybean

I will not detail what ASEC is, how it ruines sd-ext linking (e.g. especially in Link2SD), that it can hurt performance and boot time, nor why it does nothing to deter piracy. A quick summary on this wide-spread problem with Jellybean can be found in this blog post.

From the same blog, this article explains how to disable it in sourcecode so all paid apps are installed as normal APK's - like what pre-Jellybean Android would. Full credits go to him for the original fix.

I have translated this to smali so you can apply it to any Jellybean ROM without source compile.

1) Decompile services.jar
2) Open smali/com/android/server/pm/PackageManagerService.smali in a Unix line-ending compatible editor (GEdit, Notepad++)
3) Search for this text...
Code:
android.permission.INSTALL_PACKAGES
... there will be only one match, within the installPackageWithVerification method.
4) Including the couple of lines after it, you should see something like this...
Code:
const-string v1, "android.permission.INSTALL_PACKAGES"

const/4 v2, 0x0

invoke-virtual {v0, v1, v2}, Landroid/content/Context;->enforceCallingOrSelfPermission(Ljava/lang/String;Ljava/lang/String;)V

.line 5389
invoke-static {}, Landroid/os/Binder;->getCallingUid()I
...your locals/registers (v#) may be different.
5) Before the last line - the call to getCallingUid() - add a new line...
Code:
const-string v1, "android.permission.INSTALL_PACKAGES"

const/4 v2, 0x0

invoke-virtual {v0, v1, v2},  Landroid/content/Context;->enforceCallingOrSelfPermission(Ljava/lang/String;Ljava/lang/String;)V

and-int/lit8 p3, p3, -0x2

.line 5389
invoke-static {}, Landroid/os/Binder;->getCallingUid()I
...recompile and push back to device. All done.

With this mod, any APK you install from market that would usually go in an ASEC container should now install as a standard APK, allowing you to move it to sd-ext with e.g. Link2SD. If you have existing ASEC apps already, uninstall and reinstall them.

Enjoy the extra internal space and no more headaches

XtreamerMobile Developer


My GitHub | My Apps on AppBrain


Goodbye Xperia 2011 scene - on to greater things

Current Community Projects:
Turbo Tools - Suspended
TBA...