[Android] ahmed.nasser.hk:
GUIDE Disable Signature CM12.1 - CM13

Work and Tested - CM 12.1 & CM 13 Based

What's / Why signature verification?​

The system always checks for different signatures for system apps and if they dont match the app doesnt get installed.

So if you try to make changes to Android Manifest and sign it it will not work untill you sign the whole rom with the same signature.

It's pretty annoying! If you are a modding this will help you too, you will be easily able to replace system apps from other roms without any problems

Unless they dont require something (lib's , png's from framework).

I think every rom maker should do it in their rom,so its a bit more easy to modify​

Let's Do It :cool:​

Decompile Services.jar

GO To smali/com/android/server/pm/PackageManagerService.smali

Find method :

.method static compareSignatures([Landroid/content/pm/Signature;[Landroid/content/pm/Signature;)I
.locals 11
.param p0, "s1" # [Landroid/content/pm/Signature;
.param p1, "s2" # [Landroid/content/pm/Signature;

.prologue
const/4 v6, 0x1

const/4 v8, -0x3

const/4 v7, 0x0

.line 2985
if-nez p0, :cond_1

.line 2986
if-nez p1, :cond_0

.line 3018
:goto_0
return v6

.line 2986
:cond_0
const/4 v6, -0x1

goto :goto_0

.line 2991
:cond_1
if-nez p1, :cond_2

.line 2992
const/4 v6, -0x2

goto :goto_0

.line 2995
:cond_2
array-length v9, p0

array-length v10, p1

if-eq v9, v10, :cond_3

move v6, v8

.line 2996
goto :goto_0

.line 3000
:cond_3
array-length v9, p0

if-ne v9, v6, :cond_5

.line 3001
aget-object v6, p0, v7

aget-object v9, p1, v7

invoke-virtual {v6, v9}, Landroid/content/pm/Signature;->equals(Ljava/lang/Object;)Z

move-result v6

if-eqz v6, :cond_4

move v6, v7

goto :goto_0

:cond_4
move v6, v8

goto :goto_0

.line 3006
:cond_5
new-instance v3, Landroid/util/ArraySet;

invoke-direct {v3}, Landroid/util/ArraySet;-><init>()V

.line 3007
.local v3, "set1":Landroid/util/ArraySet;, "Landroid/util/ArraySet<Landroid/content/pm/Signature;>;"
move-object v0, p0

.local v0, "arr$":[Landroid/content/pm/Signature;
array-length v2, v0

.local v2, "len$":I
const/4 v1, 0x0

.local v1, "i$":I
:goto_1
if-ge v1, v2, :cond_6

aget-object v5, v0, v1

.line 3008
.local v5, "sig":Landroid/content/pm/Signature;
invoke-virtual {v3, v5}, Landroid/util/ArraySet;->add(Ljava/lang/Object;)Z

.line 3007
add-int/lit8 v1, v1, 0x1

goto :goto_1

.line 3010
.end local v5 # "sig":Landroid/content/pm/Signature;
:cond_6
new-instance v4, Landroid/util/ArraySet;

invoke-direct {v4}, Landroid/util/ArraySet;-><init>()V

.line 3011
.local v4, "set2":Landroid/util/ArraySet;, "Landroid/util/ArraySet<Landroid/content/pm/Signature;>;"
move-object v0, p1

array-length v2, v0

const/4 v1, 0x0

:goto_2
if-ge v1, v2, :cond_7

aget-object v5, v0, v1

.line 3012
.restart local v5 # "sig":Landroid/content/pm/Signature;
invoke-virtual {v4, v5}, Landroid/util/ArraySet;->add(Ljava/lang/Object;)Z

.line 3011
add-int/lit8 v1, v1, 0x1

goto :goto_2

.line 3015
.end local v5 # "sig":Landroid/content/pm/Signature;
:cond_7
invoke-virtual {v3, v4}, Landroid/util/ArraySet;->equals(Ljava/lang/Object;)Z

move-result v6

if-eqz v6, :cond_8

move v6, v7

.line 3016
goto :goto_0

:cond_8
move v6, v8

.line 3018
goto :goto_0
.end method

Replace With

.method static compareSignatures([Landroid/content/pm/Signature;[Landroid/content/pm/Signature;)I
.locals 11
.param p0, "s1" # [Landroid/content/pm/Signature;
.param p1, "s2" # [Landroid/content/pm/Signature;

.prologue
const/4 v7, 0x0

.line 3018
return v7
.end method

Search To Find Line Below:

invoke-static {v4, v0}, Lcom/android/server/pm/PackageManagerService;->compareSignatures([Landroid/content/pm/Signature;[Landroid/content/pm/Signature;)I

move-result v4

if-nez v4, :cond_c

.line 5696
new-instance v4, Lcom/android/server/pm/PackageManagerException;

const/16 v5, -0x13

const-string v11, "Cannot install platform packages to user storage!"

invoke-direct {v4, v5, v11}, Lcom/android/server/pm/PackageManagerException;-><init>(ILjava/lang/String;)V

throw v4

Change (if-nez v4) To (if-eqz v4)

Will be like this :

invoke-static {v4, v0}, Lcom/android/server/pm/PackageManagerService;->compareSignatures([Landroid/content/pm/Signature;[Landroid/content/pm/Signature;)I

move-result v4

if-eqz v4, :cond_c

.line 5696
new-instance v4, Lcom/android/server/pm/PackageManagerException;

const/16 v5, -0x13

const-string v11, "Cannot install platform packages to user storage!"

invoke-direct {v4, v5, v11}, Lcom/android/server/pm/PackageManagerException;-><init>(ILjava/lang/String;)V

throw v4

Credit For Guide : Abdullah Ba'agil ( Thanks To Him )​