Trong bài này mình sẽ hướng dẫn thực hiện Superuser mod trên các thiết bị Xperia. Superuser mod giúp vô hiệu hoá các xác minh khi cài app. Thực hiện xong mod này bạn có thể cài app khác xác minh cho thiết bị của mình, ví dụ như cài app của Z3 vào các thiết bị cũ hơn hoặc ngược lại.
Lưu ý:
- Root và Superuser mod là khác nhau hoàn toàn.
- Việc thay thế file Services.jar sẽ gây reset máy, nếu file này sai máy sẽ bị boot loop.
Công cụ:
- Máy đã được root (trong bài mình sử dụng z3 đã root và unlock bootloader).
- Rom deodexed cho thiết bị của bạn. (các bạn tìm trên google)
- File Services.jar trong máy, được trích ra từ rom deodexed của máy.
- Baksmali Manager, công cụ này các bạn download ở đây.
- notepad++ download ở đây.
Bước 1: trích xuất và decompile (dịch ngược) file Services.jar
Để lấy được file services.jar này có 2 cách: thứ nhất sử dụng câu lệnh ADB, thứ 2 sử dụng trình quản lý file như Root Explorer để lấy ra. Khuyến nghị nên sử dụng lệnh ADB như sau:
Code:
adb pull /system/framework/services.jar
- mở baksmali Manager.bat .
- Chọn số 4 (trỏ đến vị trí file services.jar) -> enter.
- Nhập số mà file services.jar thể hiện, trường hợp mình là số 3.
- Sau khi chọn xong thì nhấn số 1. Đợi đến khi chạy xong.
Bước này thực hiện superuser mod để vô hiệu hoá các xác minh khi cài app.
- Vào folder services mới được tạo và theo đường dẫn sau \com\android\server\pm\
- tìm file PackageManagerService.smali và mở bằng notepad++
- Nhấn CTRL + F tìm dòng “.method static compareSignatures”
- Sẽ thấy như sau:
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
- thay bằng dòng này:
Code:
.method static compareSignatures([Landroid/content/pm/Signature;[Landroid/content/pm/Signature;)I .registers 9 const/4 v0, 0x0 return v0 .end method
- Save lại
Bước 3: Recompile (đóng gói) services.jar và đưa lại vào hệ thống
- Mở baksmali manager chọn file Services.jar như ở bước 1.
- Chọn số 2 -> xong.
- Trong folder baksmali sẽ thấy 2 file services.jar và classes.dex.
- Mở file services.jar bằng WinRAR và copy đè file classes.dex này vào thay cho file classes.dex cũ -> xong.
- Đưa file services.jar vào lại hệ thống bằng Root Explorer theo đường dẫn system/framework hay qua ADB bằng lệnh sau:
Code:
adb push services.jar /system/framework/
- set permission cho services.jar thành rw- r-- r—
- Khởi động lại máy -> xong.
Đây là theme được "đồn" sẽ là giao diện mặc định Lollipop của Sony, giao diện này thay đổi rất nhiều thành phần, can thiệp khá sâu chỉ cài được khi đã có superuser mod. Download tại đây
Các bạn nhớ share file Services.jar đã chỉnh sửa lên cho mọi người sử dụng nhé
Z3 D6635