Hướng dẫn mod cơ bản [ANDROID DEVELOPMENT]

Hướng dẫn mod cơ bản [Đã test trên Note3 N9005] có thể áp dụng cho các máy android khác
A. CHUẨN BỊ:

Các thứ cần chuẩn bị, mọi người download về và cài đặt nhé
Link tải các công cụ cần thiết và video hướng dẫn: https://www.mediafire.com/folder/d1qni9ledluob/Mod
Kênh video hướng dẫn trên youtube: http://www.youtube.com/watch?v=fGkswBDiz6c&feature=share&list=PLkT5cA0IcjLMHQc4JDk2SQ_k4MhCgFbmz

1. Apktoolhttps://www.dropbox.com/s/xuw7qrojm6legxq/Apktool.zip
2. Jdk/java link tải: http://www.java.com/en/
3. Notepad++: http://download.tuxfamily.org/notepadplus/6.2.3/npp.6.2.3.Installer.exe
4. 7-Zip: http://www.7-zip.org/download.html
5. Cài app Root Explorer vào điện thoại, chấp nhận ứng dụng đc phép chạy trong SuperSU
6. File zip flash chuẩn : http://www.mediafire.com/download/9do0ny22j4p7yjc/flash+chuan+cho+kitkat.zip

B. CÁC BƯỚC TIẾN HÀNH:
- Chép Apktool.zip qua ổ C, giải nén được thư mục Apktool
- Trên điện thoại, vào đường dẫn System/framework  copy file framework-res.apk vào thư mục khác trong bộ nhớ trong hoặc thẻ nhớ rồi copy vào thư mục C:/Apktool
- Trên điện thoại, vào đường dẫn System/pri-app hoặc System/app  copy file bạn cần làm (có thể là SystemUI.apk , SecSettings.apk, SamsungIME.apk...v.v.v) vào thư mục khác trong bộ nhớ trong hoặc thẻ nhớ rồi copy vào  thư mục C:/Apktool
Hướng dẫn : http://youtu.be/IYWIUeSb0AU
I. Decompile:
- Vào cmd (Start -> Run -> Cmd)
- Gõ cd c:\apktool -> Enter
- Gõ tiếp: apktool if framework-res.apk
- Gõ : apktool if systemui.apk (ví dụ là file systemui.apk , nếu mod file khác thì đổi thành tên file khác)


- Gõ: apktool d systemui.apk (đợi giải nén)

- Sau khi giải nén xong ta được thư mục SystemUI (đường dẫn C:\apktool\systemui)
- Làm theo các bước để mod ở dưới (II.MOD)

II. MOD 

1. Mod sửa thông báo pin yếu:

a) Hướng dẫn bằng chữ:
- Decompile file SystemUI như hướng dẫn ở mục I.Decompile
- Ta được thư mục SystemUI (đường dẫn C:\apktool\systemui).
- Xong bạn vô thư mục C:\apktool\systemui\res\value-vi\strings.xml  mở file strings.xml lên bằng Notepad++
Tìm đến những đoạn Code dưới rồi thay theo ý bạn:
<string name="battery_low_title">Kết nối bộ sạc của bạn</string>
<string name="battery_low_subtitle">Pin đang yếu.</string>
<string name="battery_low_percent_format">%d%% còn lại</string>
<string name="battery_low_why">Dùng Pin</string>
<string name="low_battery_title">Pin yếu</string>
<string name="critical_low_battery_title">Pin rất yếu</string>
<string name="low_battery_text">Kết nối vào ổ cắm để sạc thiết bị...</string>
Ví dụ mình thay:
<string name="battery_low_title">Chị Ruby Love ơi</string>
<string name="battery_low_subtitle">Em đói rồi dậy cho em ăn đi</string>
<string name="battery_low_percent_format">%d%% thể lực</string>
<string name="battery_low_why">Kệ mẹ em</string>
<string name="low_battery_title">Chị Ruby Love ơi</string>
<string name="critical_low_battery_title">Em sắp die rồi</string>
<string name="low_battery_text">Dậy cho em ăn đi</string>
Sau đó save lại.
- Copy file hình muốn hiển thị khi thông báo vào C:\apktool\systemui\res\drawable-xxhdpi
Lưu ý: file hình phải đổi tên thành : battery_low_battery.png (định dạng png)

Recompile và Sign apk (xem ở mục III.Recompile và Sign Apk bên dưới )
- Copy file SystemUI đã build được vào điện thoại đúng thư mục system/priv-app và set 6-4-4
 HoặcTạo file zip flash rồi copy vào điện thoại (xem mục IV. Tạo file zip flash hoặc 
video: http://youtu.be/Ftm68mt4eHY )
- Vào recovery flash file zip vừa tạo -> Xong

b) Video hướng dẫn:  http://youtu.be/MdfDfcb20Yo

2. Thay chữ xóa ở nofitication thành chữ khác:


- Decompile file SystemUI như hướng dẫn ở mục I.Decompile.
- Tìm đến C:\Apktool\SystemUI\res\layout\status_bar.xml​  mở file status_bar.xml  lên bằng Notepad++
- Xóa dòng:
<com.android.systemui.statusbar.policy.Clock android:textAppearance="@style/TextAppearance.StatusBar.Clock" android:gravity="left|center" android:id="@id/clock" android:layout_width="wrap_content" android:layout_height="fill_parent" android:singleLine="true" />
- Thêm đoạn code này:
<LinearLayout android:gravity="center" android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="fill_parent">​
<com.android.systemui.statusbar.policy.Clock android:textAppearance="@style/TextAppearance.StatusBar.Clock" android:textColor="#ff5cb8ff" android:gravity="center" android:id="@id/clock" android:layout_width="wrap_content" android:layout_height="fill_parent" android:singleLine="true" />​
</LinearLayout>​
 - Vào dưới dòng này:
com.android.systemui.statusbar.phone.TickerView android:id="@id/tickerText" android:paddingTop="2.0dip" android:paddingRight="10.0dip" android:layout_width="0.0dip" android:layout_height="wrap_content" android:layout_weight="1.0">​
<TextView android:textAppearance="@style/TextAppearance.StatusBar.PhoneTicker" android:layout_width="fill_parent" android:layout_height="wrap_content" android:singleLine="true" />​
<TextView android:textAppearance="@style/TextAppearance.StatusBar.PhoneTicker" android:layout_width="fill_parent" android:layout_height="wrap_content" android:singleLine="true" />​
</com.android.systemui.statusbar.phone.TickerView>​
</LinearLayout>​
- Save lại.
- Recompile và Sign Apk (xem cách Recompile và Sign apk ở mục III.Recompile, Sign apk bên dưới).
- Tạo file zip flash.


3. Mod đồng hồ ra giữa:





4. Mod đổi màu đồng hồ:


- Decompile file SystemUI như hướng dẫn ở mục I.Decompile. (nếu trong C:\apktool đã có thư mục systemui thì phải xóa đi)
- Tìm đến C:\Apktool\SystemUI\res\layout\status_bar.xml​
- Tìm dòng:
<com.android.systemui.statusbar.policy.Clock android:textAppearance="@style/TextAppearance.StatusBar.Clock" android:textColor="#ffffffff" android:gravity="center" android:id="@id/clock" android:layout_width="wrap_content" android:layout_height="fill_parent" android:singleLine="true" />​
- Đổi #ffffffff thành mã màu mà bạn muốn ( có thể lấy mã màu ở http://haylem.net/tienich/mamau.html)​
- Save lại.
- Recompile và Sign Apk.

Video hướng dẫn:

5. Mod lock home ẩn: (chạm vào góc phải vị trí đồng hồ sẽ tắt màn hình)



- Decompile SystemUI.apk
Download 2 file này về
https://www.mediafire.com/?91rj9anq3bj2pr8
cho vào C:\apktool/systemui/res/drawable-xxhdpi/
- Recompile và sign apk
- Copy file systemui.apk trong thư mục C:\apktool\systemui\dist ra ngoài  C:\apktool\  và xóa thư mục C:\apktool\systemui\
- Decomplie file systemui.apk mới này 
- Sau đó vào C:/apktool/systemui/res/layout/status_bar.xml  mở file status_bar.xml lên sửa
- Copy code này vào vị trí như hình
<LinearLayout android:gravity="left" android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="fill_parent">
        <com.android.systemui.statusbar.policy.KeyButtonView android:id="@id/home" android:paddingRight="0.0dip" android:layout_width="wrap_content" android:layout_height="fill_parent" android:src="@drawable/vnhome" android:contentDescription="@string/accessibility_home" systemui:keyCode="3" systemui:glowBackground="@drawable/ic_sysbar_highlight" />
    </LinearLayout>
    <LinearLayout android:gravity="right" android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="fill_parent">
        <com.android.systemui.statusbar.policy.KeyButtonView android:id="@id/back" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="0.0dip" android:src="@drawable/vnlock" android:singleLine="true" android:layout_toRightOf="@id/recent_apps" android:layout_alignParentLeft="true" android:contentDescription="@string/accessibility_back" systemui:keyCode="26" systemui:glowBackground="@drawable/ic_sysbar_highlight" />
    </LinearLayout>
- Save lại.

- Xong Recomplie và sign apk

Video hướng dẫn: http://youtu.be/DAYEBCcHbcw;



6. Add app hay dùng vào Notification:



- Decomplie SystemUI.apk
- Download file này về, giải nén chọn hệ điều hành của PC bạn đang dùng copy hết vào theo đường dẫn SystemUI/smali/com/android/systemui/statusbar/policy/
- Mở file SystemUI/res/layout/status_bar_expanded.xml
- Thêm code vào như hình:
<HorizontalScrollView android:scrollbars="none" android:layout_width="fill_parent" android:layout_height="wrap_content">
    <com.android.systemui.statusbar.policy.quicklaunch.QuickLaunchContainer android:gravity="center" android:layout_width="wrap_content" android:layout_height="fill_parent" />
</HorizontalScrollView>


- Recompile và sign apk
Video hướng dẫn: http://youtu.be/fGkswBDiz6c



7. Mod các phím tắt vào notification:




- Decompile SystemUI.apk
- Download file, giải nén và copy hình vào thư mục C:\apktool\systemui\res\drawable-xxhdpi
http://www.mediafire.com/download/vtyz5pj4b7zrbo7/hinh.rar
- Recompile thư mục SystemUI và Sign apk (xem hướng dẫn ở mục  III. Cách Recompile và sign apk)
- Recompile lần nữa.
- Copy file systemui.apk vừa build đc (trog thư mục C:\apktool\systemui\dist) dán vào C:\apktool và xóa thư mục SystemUI (C:\apktool\systemui\)
- Decompile file systemui.apk mới đó
- Mở file status_bar_expanded.xml trong mục SystemUI\res\layout

- Copy code này
<LinearLayout android:orientation="horizontal" android:background="#00000000" android:layout_width="fill_parent" android:layout_height="wrap_content" android:baselineAligned="false">
                        <com.android.systemui.statusbar.policy.KeyButtonView android:id="@id/recent_apps" android:background="@drawable/vn_ic_task" android:paddingRight="60.0dip" android:layout_width="60.0dip" android:layout_height="60.0dip" android:layout_toRightOf="@id/settings_button" android:contentDescription="@string/accessibility_recent" systemui:keyCode="187" systemui:keyRepeat="false" systemui:glowBackground="@drawable/vn_ic_btn_press" />
                        <com.android.systemui.statusbar.policy.KeyButtonView android:id="@id/back" android:background="@drawable/vn_ic_calllog" android:paddingRight="60.0dip" android:layout_width="60.0dip" android:layout_height="60.0dip" android:layout_toRightOf="@id/recent_apps" android:contentDescription="@string/accessibility_back" systemui:keyCode="5" systemui:keyRepeat="false" systemui:glowBackground="@drawable/vn_ic_btn_press" />
                        <com.android.systemui.statusbar.policy.KeyButtonView android:id="@id/back" android:background="@drawable/vn_ic_music" android:paddingRight="60.0dip" android:layout_width="60.0dip" android:layout_height="60.0dip" android:layout_toRightOf="@id/recent_apps" android:contentDescription="@string/accessibility_back" systemui:keyCode="79" systemui:keyRepeat="false" systemui:glowBackground="@drawable/vn_ic_btn_press" />
                        <com.android.systemui.statusbar.policy.KeyButtonView android:id="@id/back" android:background="@drawable/vn_ic_music_1" android:paddingRight="60.0dip" android:layout_width="60.0dip" android:layout_height="60.0dip" android:layout_toRightOf="@id/recent_apps" android:contentDescription="@string/accessibility_back" systemui:keyCode="25" systemui:keyRepeat="false" systemui:glowBackground="@drawable/vn_ic_btn_press" />
                        <com.android.systemui.statusbar.policy.KeyButtonView android:id="@id/back" android:background="@drawable/vn_ic_music_2" android:paddingRight="60.0dip" android:layout_width="60.0dip" android:layout_height="60.0dip" android:layout_toRightOf="@id/recent_apps" android:contentDescription="@string/accessibility_back" systemui:keyCode="24" systemui:keyRepeat="false" systemui:glowBackground="@drawable/vn_ic_btn_press" />
                        <com.android.systemui.statusbar.policy.KeyButtonView android:id="@id/back" android:background="@drawable/vn_ic_lock" android:paddingRight="60.0dip" android:layout_width="60.0dip" android:layout_height="60.0dip" android:layout_toRightOf="@id/recent_apps" android:contentDescription="@string/accessibility_back" systemui:keyCode="26" systemui:keyRepeat="false" systemui:glowBackground="@drawable/vn_ic_btn_press" />
                    </LinearLayout>  
- Đặt dưới code này:
<View android:background="@color/toggle_slider_divider_color"

- Tiếp theo bạn vào SystemUI\res\values mở file public.xml
Tìm đến cuối đoạn drawable, tìm xem có vn_ic_task không nếu có thì ok rồi

- Recompile thư mục SystemUI và Sign Apk (hướng dẫn ở mục  III. Cách Recompile và sign apk)
- Recompile lần nữa

*Tóm tắt cách làm: 
Bước 1: Decompile -> bỏ hình vào -> Recompile -> Sign Apk -> Recompile lần nữa
Bước 2: Decompile file mới build đc ở Bước 1 -> Sửa code -> Recompile -> Sign Apk -> Recompile lần nữa
Bước 3: Đóng gói file zip flash
Video hướng dẫn: http://youtu.be/KmsaC7FG32A



8. Mod bàn phím:



SamsungIME.apk nằm trong thư mục system/app 

Hướng dẫn:  Decompile SamsungIME.apk -> sửa code -> Recompile -> Sign apk -> Recompile lần nữa

* Mod dpi ( mod icon to hay nhỏ tuỳ bạn )

- SamsungIME/res/values-sw359dp-xhdpi/dimens.xml

- Tương tự làm với SamsungIME/res/values-sw359dp-land-xhdpi/dimens.xml
để mod keyboard khi quay ngang màn hình nhé.

* Mod bỏ ký tự thừa như ký tự mình khoanh đỏ phía trên ảnh đầu.
- SamsungIME/res/xml/qwerty_vi.xml
tìm
<Key android:horizontalGap="@dimen/qwerty_first_col_horizontal_gap" android:codes="97" android:popupCharacters="ăâ" android:keyEdgeFlags="left" android:keyLabel="a" />
        <Key android:codes="115" android:popupCharacters="" android:keyLabel="s" />
        <Key android:codes="100" android:popupCharacters="đ" android:keyLabel="d" />
        <Key android:codes="102" android:popupCharacters="" android:keyLabel="f" />
        <Key android:codes="103" android:popupCharacters="" android:keyLabel="g" />
        <Key android:codes="104" android:popupCharacters="" android:keyLabel="h" />
        <Key android:codes="106" android:popupCharacters="" android:keyLabel="j" />
        <Key android:codes="107" android:popupCharacters="" android:keyLabel="k" />
        <Key android:codes="108" android:popupCharacters="" android:keyLabel="l" />
        <Key android:codes="-769" android:popupKeyboard="@xml/popup_template_keyboard" android:popupCharacters="@string/vietnamese_tone" android:keyEdgeFlags="right" android:keyIcon="@drawable/qwerty_vietnam_p_01" />

Thay bằng
<Key android:horizontalGap="@dimen/qwerty_first_col_horizontal_gap_second_line" android:codes="97" android:popupCharacters="ăâ" android:keyEdgeFlags="left" android:keyLabel="a" />
        <Key android:codes="115" android:popupCharacters="" android:keyLabel="s" />
        <Key android:codes="100" android:popupCharacters="đ" android:keyLabel="d" />
        <Key android:codes="102" android:popupCharacters="" android:keyLabel="f" />
        <Key android:codes="103" android:popupCharacters="" android:keyLabel="g" />
        <Key android:codes="104" android:popupCharacters="" android:keyLabel="h" />
        <Key android:codes="106" android:popupCharacters="" android:keyLabel="j" />
        <Key android:codes="107" android:popupCharacters="" android:keyLabel="k" />
        <Key android:codes="108" android:popupCharacters="" android:keyEdgeFlags="right" android:keyLabel="l" />


- Làm tương tự với các file
+ SamsungIME/res/xml-sw359dp-xhdpi/qwerty_vi.xml
+ SamsungIME/res/xml-sw359dp-land-xxhdpi/qwerty_vi.xml

Video hướng dẫnhttp://youtu.be/kYowCE3XoP0




9. Mod Setting mang giao diện giống S5 ( Chỉ dành cho 4.4):



- Decompile file SecSettings.apk (file SecSettings.apk nằm trong System/pri-app)
- Mở file bools.xml SecSettings.apk\res\values\bools.xml
- Sửa code :
Trước:  <bool name="settings_grid">false</bool>
Sau :   <bool name="settings_grid">true</bool> 
Dể tránh xuất hiện 2 icon setting trong launcher. xóa 1 thằng trong AndroidManifest.xml này đi

<category android:name="android.intent.category.LAUNCHER" />



10. Mod Quicksettings Note 3 thành S5




Dùng app Root Explorer mở file build.prop (nằm trong thư mục System) -> Open in Text Editor -> Sửa  như hình hướng dẫn



11. Center Clock có giây:


III. Cách Recompile và sign apk:
Recompile:
- Bật cmd lên gõ apktool b systemui
Sign apk: 
- Vào C:\apktool  mở file SystemUI.apk gốc bằng cách nhấp chuột phải vào file SystemUI.apk gốc , chọn 7-zip -> Open Archive
- Copy 2 file META-INF + AndroidManifest.xml chép đè vào thư mục C:\apktool\SystemUI\build\apk
- Xong vào lại cmd gõ apktool b systemUI  tức là Recompile lại 1 lần nữa
- Sau đó vào C:\apktool\systemui\dist , đổi tên thành SystemUI.apk )

IV. Tạo file zip flash (kitkat 4.4.2)
Download file flash zip mẫu: https://www.dropbox.com/s/lg2exie7i2u6b21/flash.zip
Video hướng dẫnhttps://www.youtube.com/watch?v=Ftm68mt4eHY


Nguồn tài liệu: Topic của thanhfhuongf  và nhiều nguồn trên internet: http://www.tinhte.vn/threads/samsung-android-development-cac-buoc-mod-va-cook-rom-co-ban.2247908/
Sưu tầm và viết lại: Ruby Love

4 comments:

Unknown said...

Bé Ruby Love dễ thương nhất! oh yeah! <3 <3 <3

Unknown said...

hi. mình là thanhfhuongf. mình cũng mới chuyển qua N9005. mình đang lập 1 đội VN-TEAM NOTE 3. rất hoan nghênh nếu bạn vào nhóm.
liên hệ mình qua tk hangout doxuanminh8385@gmail.com. thank

Unknown said...

Uầy mới ngày nào còn sang hỏi cách root, mà nay đã thành cáo ������

Ruby Love said...
This comment has been removed by the author.

Post a Comment