I've check the logcat when the installation problem occur, and i have this error
"Cannot install platform packages to user storage"
I look into the cm github and i found this part of code
Signature[] s1 = null;
if (obj instanceof SharedUserSetting) {
s1 = ((SharedUserSetting)obj).signatures.mSignatures;
}
if ((compareSignatures(pkg.mSignatures, s1) == PackageManager.SIGNATURE_MATCH)) {
Slog.w(TAG, "Cannot install platform packages to user storage");
mLastScanError = PackageManager.INSTALL_FAILED_INVALID_INSTALL_LOCATION;
return null;
}
Previously, with the tutorial I've edit the compareSignatures()
function to make it return SIGNATURE_MATCH
. But in this code, the error occurs when the function return this value.
It's seem this code is a security added, to be sure a system app will not be installed in the "user storage". The only way to fix my problem was to make the error never append (and I don't think this is a big vulnerability, but maybe i'm wrong, and if you have a better solution tell me)
So in addition to the first tutorial, I've replace
invoke-static {v3, v0}, Lcom/android/server/pm/PackageManagerService;->compareSignatures([Landroid/content/pm/Signature;[Landroid/content/pm/Signature;)I
move-result v3
if-nez v3, :cond_1d1
.line 3715
const-string v3, "PackageManager"
const-string v4, "Cannot install platform packages to user storage"
invoke-static {v3, v4}, Landroid/util/Slog;->w(Ljava/lang/String;Ljava/lang/String;)I
by
invoke-static {v3, v0}, Lcom/android/server/pm/PackageManagerService;->compareSignatures([Landroid/content/pm/Signature;[Landroid/content/pm/Signature;)I
const/4 v3, -0x3
if-nez v3, :cond_1d1
.line 3715
const-string v3, "PackageManager"
const-string v4, "Cannot install platform packages to user storage"
invoke-static {v3, v4}, Landroid/util/Slog;->w(Ljava/lang/String;Ljava/lang/String;)I
And it work :) I've never work in decompiled Java bytecode before so if I've made some mistakes, tell me.
Hope it will help !