Attend XDA's Second Annual Developer Conference, XDA:DevCon 2014!
5,785,791 Members 54,330 Now Online
XDA Developers Android and Mobile Development Forum

[MOD][GUIDE]SUPERUSER MOD for all devices

Tip us?
 
DavidMKD
Old
(Last edited by DavidMKD; 27th July 2014 at 06:19 PM.)
#1  
DavidMKD's Avatar
Recognized Contributor - OP
Thanks Meter 1,781
Posts: 1,102
Join Date: Jun 2012
Location: Skopje

 
DONATE TO ME
Default [MOD][GUIDE]SUPERUSER MOD for all devices

In this post I’ll explain what is Superuser mod and how to enable it on your device. The Superuser mod disables the nasty signature verification for all apps. After applying this mod you can install apps with different signature like Xperia Z1 or newer Sony apps. Things that are needed in this process are the following:

Step 1) Decompile Services.jar file

You can pull the services.jar file via adb or using some file manager on phone. I recommend using ADB since it will be needed for the Baksmali app. Via ADB, type the command:
Code:
adb pull /system/framework/services.jar
After you pulled the file successfully copy it and paste it in the baksmali folder. Now, follow the steps on how to decompiling the file.

1. Open baksmali Manager.bat
2. Press 4 (Select file to work) and then press Enter.
3. Enter the number in which services.jar file is shown, in my case it's 3. Press 3 then Enter.
4. After you selected the file, press 1 to Baksmali. Wait until it finishes.

Step 2) Applying the MOD

This is the part we've waiting for, disabling the signature check. Follow the steps.

1. Go to the newly created services folder in the baksmali folder and enter this location; \com\android\server\pm\
2. Search for a file called PackageManagerService.smali and open it with Notepad++
3. Press CTRL+F and search for '.method static compareSignatures'
4. You will see this:

Code:
.method static compareSignatures([Landroid/content/pm/Signature;[Landroid/content/pm/Signature;)I
    .registers 9
    .parameter "s1"
    .parameter "s2"

    .prologue
    .line 2284
    if-nez p0, :cond_8

    .line 2285
    if-nez p1, :cond_6

    const/4 v6, 0x1

    .line 2304
    :goto_5
    return v6

    .line 2285
    :cond_6
    const/4 v6, -0x1

    goto :goto_5

    .line 2289
    :cond_8
    if-nez p1, :cond_c

    .line 2290
    const/4 v6, -0x2

    goto :goto_5

    .line 2292
    :cond_c
    new-instance v3, Ljava/util/HashSet;

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

    .line 2293
    .local v3, set1:Ljava/util/HashSet;,"Ljava/util/HashSet<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_14
    if-ge v1, v2, :cond_1e

    aget-object v5, v0, v1

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

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

    goto :goto_14

    .line 2296
    .end local v5           #sig:Landroid/content/pm/Signature;
    :cond_1e
    new-instance v4, Ljava/util/HashSet;

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

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

    array-length v2, v0

    const/4 v1, 0x0

    :goto_26
    if-ge v1, v2, :cond_30

    aget-object v5, v0, v1

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

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

    goto :goto_26

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

    move-result v6

    if-eqz v6, :cond_38

    .line 2302
    const/4 v6, 0x0

    goto :goto_5

    .line 2304
    :cond_38
    const/4 v6, -0x3

    goto :goto_5
.end method
5. Shrink the whole method so it looks like this:

Code:
.method static compareSignatures([Landroid/content/pm/Signature;[Landroid/content/pm/Signature;)I
    .registers 9

    const/4 v0, 0x0

    return v0
.end method
6. Save the changes.

Step 3) Recompiling services.jar and pushing it back to system

We've come to the last piece of the puzzle. This is a bit tricky part but I'll make it simple for you, I recommend backing up your services.jar file in case something goes wrong.

1. Open baksmali again and choose services.jar as I previously explained.
2. Press 2 to smali the current work in classes.dex file.
3. In the baksmali folder you will find your services.jar and classes.dex file.
4. Open services.jar file with WinRAR (you can use other software) and replace the new (modified) classes.dex file with the new classes.dex file in the archive.

 



5. Push the services.jar file using ADB or copy it to system/framework using file manager. The command for adb is:
Code:
adb push services.jar /system/framework/
6. Set the permissions to rw- r-- r--
7. Reboot your phone.
8. Enjoy!

Thanks to eybee1970 for making the Xperia T Superuser mod and helping in this awesome tutorial.
Got a problem while installing an app? Check out the guide on how to enable SUPERUSER MOD on your device:
[MOD][GUIDE]SUPERUSER MOD for all devices

Got a spare dollar? Donate, it means a lot to me!
Bitcoin: 1CiymeStMWUmS2YLa6Wh4ATz61qZ4qUgd
The Following 43 Users Say Thank You to DavidMKD For This Useful Post: [ Click to Expand ]
 
Abhiheart
Old
#2  
Abhiheart's Avatar
Senior Member
Thanks Meter 303
Posts: 438
Join Date: Dec 2011
Location: Udupi

 
DONATE TO ME
Smile What about for CM10.2 ??

@DavidMKD : What if the ROM is based on CM10.2 , that runs on a sony device ? Can I do this on its services.jar ?
 
DavidMKD
Old
#3  
DavidMKD's Avatar
Recognized Contributor - OP
Thanks Meter 1,781
Posts: 1,102
Join Date: Jun 2012
Location: Skopje

 
DONATE TO ME
Quote:
Originally Posted by Abhiheart View Post
@DavidMKD : What if the ROM is based on CM10.2 , that runs on a sony device ? Can I do this on its services.jar ?
I don't think you read the topic, Services.jar from your device, make sure it's Sony based ROM. You already know the answer.
Got a problem while installing an app? Check out the guide on how to enable SUPERUSER MOD on your device:
[MOD][GUIDE]SUPERUSER MOD for all devices

Got a spare dollar? Donate, it means a lot to me!
Bitcoin: 1CiymeStMWUmS2YLa6Wh4ATz61qZ4qUgd
 
Abhiheart
Old
#4  
Abhiheart's Avatar
Senior Member
Thanks Meter 303
Posts: 438
Join Date: Dec 2011
Location: Udupi

 
DONATE TO ME
@DavidMKD That means a NO..Am I right ?? Thats why I guess, I was getting that strange error ..is there no way to make it work on CM 10,2 ??
 
DaniPhii
Old
(Last edited by DaniPhii; 10th October 2013 at 12:43 AM.)
#5  
DaniPhii's Avatar
Senior Member
Thanks Meter 326
Posts: 724
Join Date: May 2013
Location: KEO

 
DONATE TO ME
@DavidMKD, thanks a lot for this!

By the way, I had a little problem with 3 apps that I integrated in system with Titanium Backup. They forcedly closed every time I tried to open them. But then I remembered that Titanium integrated them as odexed. I fixed it making them user app and integrating them again. After that, those apps seem to be still odexed but everything is working fine. Tried to reboot wiping caches to see if there could be any problem, but it wasn't.
ST25i Dual boot CyanogenMod 11 + BraveKernel & 6.2.A.1.100 Stock FW
PSP-2004 ZY TA-085v1 6.60 CFW ME-1.8 & LCFW PRO-C
CyanogenMod 11, FISHELL & PRO Online Client beta tester
Performance Control, Honami Settings & Power Toggles Spanish translator
 
gamer649
Old
#6  
Senior Member
Thanks Meter 323
Posts: 737
Join Date: Feb 2013

 
DONATE TO ME
As it disables signature verification wouldn't that make your device(s) extremely insecure?
My Devices:
My Phone: Sony Xperia Z1 Compact | ROM: Modified Stock | Base Firmware/BuildNumber: 14.4.A.0.108 | Android Version: 4.4.4 | Kernel: Stock (Unlockable Bootloader) | Network: giffgaff Stolen
My Tablet: Google Nexus 7 (2012) | ROM: CM11 | Base Firmware/Build Number: 11-20140527-NIGHTLY-grouper | Android Version: 4.4.4 | Kernel: CM11 | Network: N/A
Backup/Development Phone: Sony Xperia M C1905
 
DaniPhii
Old
#7  
DaniPhii's Avatar
Senior Member
Thanks Meter 326
Posts: 724
Join Date: May 2013
Location: KEO

 
DONATE TO ME
Quote:
Originally Posted by gamer649 View Post
As it disables signature verification wouldn't that make your device(s) extremely insecure?
You can still verify them by using an antivirus. xD
ST25i Dual boot CyanogenMod 11 + BraveKernel & 6.2.A.1.100 Stock FW
PSP-2004 ZY TA-085v1 6.60 CFW ME-1.8 & LCFW PRO-C
CyanogenMod 11, FISHELL & PRO Online Client beta tester
Performance Control, Honami Settings & Power Toggles Spanish translator
 
silverbios
Old
#8  
silverbios's Avatar
Senior Member
Thanks Meter 93
Posts: 386
Join Date: Oct 2012
Location: Tehran

 
DONATE TO ME
very good this method good working on 4.2.2!!!
 
FunSucker
Old
#9  
Member
Thanks Meter 8
Posts: 64
Join Date: Nov 2013
Default set permission

broo, I put the services.jar file that has been patched with the other framework files in the sd card (folder 'done_app'). then I did this command:

adb shell
su
stop
mount -o rw,remount /system/ /system/
cp /sdcard/done_frame/* /system/framework/
mount -o ro,remount /system/ /system/
reboot


that's already changed the 'set permissions' or not yet?
 
Abhiheart
Old
#10  
Abhiheart's Avatar
Senior Member
Thanks Meter 303
Posts: 438
Join Date: Dec 2011
Location: Udupi

 
DONATE TO ME
Quote:
Originally Posted by silverbios View Post
very good this method good working on 4.2.2!!!
@silverbios ..Were you in Stock Xperia 4.2.2

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes