Modifying Huawei's apk files is neither simple nor possible at times.
What can we do?
Very little...
At this time, only the framework-res.apk file can be edited (only on Marshmallow).
For all other apks we can only edit the smali files.
Here there are some tools (Windows and Ubuntu)...
Windows
SuperRsKitchen
https://forum.xda-developers.com/ap...dows-linux-superr-s-kitchen-v3-0-0-0-t3601702
I never tested Windows version... I use it in Ubuntu.
Tickle My Android
https://forum.xda-developers.com/showthread.php?t=1633333&nocache=1
with apktool versions 2.0.1 to 2.2.0 I'm able to install framework, decompile and recompile only framework-res.apk
We can also decompile framework-res-hwext.apk ... but NOT recompile!
Other apks can't be decompiled.
With this tool I can also deodex system files...
I don't know if they are perfect, but my system don't have problems! Everything works
Batch ApkTool by bursoft
http://4pda.ru/forum/index.php?showtopic=557858&view=findpost&p=30280158
Thanks to kep2008
Wonderful tool multilanguage.
We can decompile (with apktool) as with TMA...
We can Deodex, decompile and recompile smalis, convert system.new.dat, etc...
I'm testing it.
I use it on NOUGAT!
Baksmali Manager
https://forum.xda-developers.com/showthread.php?t=2311766
there is smali/baksmali version 2.0.2 inside ...
with smali/baksmali versions 2.0 to 2.1.3 I'm able to decompile, edit smalis, recompile correctly.
there is Compression Level 9 as Default... but I can't have a good SystemUI.apk with this Compression (without navbar and statusbar...and other errors).
If I set Compression Level 0 my SystemUI is very good!
Other apks and jar files are good with this Setting!
Apktool
https://ibotpeaches.github.io/Apktool/
https://forum.xda-developers.com/showthread.php?t=1755243&page=192
smali/baksmali
https://github.com/JesusFreke/smali/wiki
Ubuntu
SuperRsKitchen
https://forum.xda-developers.com/ap...chen-superr-s-kitchen-v1-1-50-v2-1-6-t3597434
Deodex release a lot of errors.
Kitchen makes other operations correctly...
but at the moment I don't know if the new ROM is good or not... I only tested the operations.
Apktool
like above
smali/baksmali
like above
All Credits to developers
MODS post n. 3
Dump Files...
https://forum.xda-developers.com/showthread.php?t=2450045
https://forum.xda-developers.com/showthread.php?t=2368121
with adb shell...
Code:
su
dd if=/dev/block/platform/hi_mci.0/by-name/system of=/storage/[B][COLOR="Red"]extSdCard[/COLOR][/B]/system.img
dd if=/dev/block/platform/hi_mci.0/by-name/recovery of=/storage/[COLOR="Red"][B]extSdCard[/B][/COLOR]/recovery.img
dd if=/dev/block/platform/hi_mci.0/by-name/boot of=/storage/[COLOR="Red"][B]extSdCard[/B][/COLOR]/boot.img
Otherwise, there is another way to retrieve these files: extracting from UPDATE.APP
Extraction can be done with the kitchen directly (there is a script that does this job) or by other apps, for example HuaweiUpdateExtractor ( https://forum.xda-developers.com/showthread.php?t=2433454 )
All Credits to developers
What can we do with files modification?
Here are some examples:
http://www.androidiani.com/forum/mo...-0-funzioni-utili-disabilitate-o-rimosse.html
In Samsung section there are a lot of examples that we could follow:
https://forum.xda-developers.com/ga...ified-development/devs-helpingd-devs-t3321679
https://forum.xda-developers.com/showthread.php?t=2799050
Mods tested on Android 6.0:
Navbar - hide virtual key
Launcher Stock: Home Layout and Rotation Toggle
Music Player on Lockscreen
Edit or translate KangVip
Advanced Power Menu by daxgirl
How to port Kangvip
Lockscreen rotation
All Rotations (360°) - Toggle by kep2008
Music/Volume Skip Mod
Colors (Notification and Toolbox buttons)
Colors ... part 2 (Toolbox edit button text)
All QS Tiles visible (Default was 9)
Step Counter ON/OFF in Lockscreen
Colors ... part 3 (Keyguard Clock and Date)
Colors ... part 4 (Notification Panel - Axis Text)
Colors ... part 5 (Header Panel Clock, Date, Week)
Colors ... part 6 (Carrier Label in Notification Panel)
Colors ... part 7 (Shortcuts not displayed)
Colors ... part 8 (Edit DONE and CANCEL Buttons)
Colors ... part 9 (QS Tiles)
...
Mods tested on Android 7.0:
Immersive Mode
All Rotation (360°)
Colors ... part 1 (Keyguard Clock and Date)
Colors ... part 2 (Keyguard Charge and Owner info)
Lockscreen rotation
Colors ... part 3 (Statusbar Clock)
App Twin - All apps in Settings menu
Launcher: Home layout and Auto-rotate
Colors ... part 4 (Back and Reset)
Volume rocker Wake
Music/Volume Skip Mod
...
Navbar - hide virtual key
Tested on Android 6.0 (L21C432B170)
Settings
smali\com\android\settings\VirtualKeySettings.smali
Code:
.method private initVirtualKeyStatus()V
.locals 5
const/4 v1, 0x1
const/4 v2, 0x0
const-class v0, Lcom/android/settings/HwCustVirtualKeySettings;
new-array v3, v1, [Ljava/lang/Object;
aput-object p0, v3, v2
invoke-static {v0, v3}, Lcom/huawei/cust/HwCustUtils;->createObj(Ljava/lang/Class;[Ljava/lang/Object;)Ljava/lang/Object;
move-result-object v0
check-cast v0, Lcom/android/settings/HwCustVirtualKeySettings;
iput-object v0, p0, Lcom/android/settings/VirtualKeySettings;->mHwCustVirtualKeySettings:Lcom/android/settings/HwCustVirtualKeySettings;
invoke-static {}, Lcom/android/settings/Utils;->isChinaArea()Z
move-result v0
if-eqz v0, :cond_22
iget-object v0, p0, Lcom/android/settings/VirtualKeySettings;->mHwCustVirtualKeySettings:Lcom/android/settings/HwCustVirtualKeySettings;
if-eqz v0, :cond_2e
iget-object v0, p0, Lcom/android/settings/VirtualKeySettings;->mHwCustVirtualKeySettings:Lcom/android/settings/HwCustVirtualKeySettings;
invoke-virtual {v0}, Lcom/android/settings/HwCustVirtualKeySettings;->isFrontFingerPrint()Z
move-result v0
if-eqz v0, :cond_2e
:cond_22
iget-object v0, p0, Lcom/android/settings/VirtualKeySettings;->mHwCustVirtualKeySettings:Lcom/android/settings/HwCustVirtualKeySettings;
if-eqz v0, :cond_58
iget-object v0, p0, Lcom/android/settings/VirtualKeySettings;->mHwCustVirtualKeySettings:Lcom/android/settings/HwCustVirtualKeySettings;
invoke-virtual {v0}, Lcom/android/settings/HwCustVirtualKeySettings;->isShowNavigationBarSwitch()Z
move-result v0
if-eqz v0, [B][COLOR="Red"]:cond_58[/COLOR][/B]
:cond_2e
const-string v0, "virtual_key"
invoke-virtual {p0, v0}, Lcom/android/settings/VirtualKeySettings;->findPreference(Ljava/lang/CharSequence;)Landroid/preference/Preference;
move-result-object v0
check-cast v0, Landroid/preference/SwitchPreference;
iput-object v0, p0, Lcom/android/settings/VirtualKeySettings;->mSwitchPreference:Landroid/preference/SwitchPreference;
iget-object v3, p0, Lcom/android/settings/VirtualKeySettings;->mSwitchPreference:Landroid/preference/SwitchPreference;
invoke-virtual {p0}, Lcom/android/settings/VirtualKeySettings;->getActivity()Landroid/app/Activity;
move-result-object v0
invoke-virtual {v0}, Landroid/app/Activity;->getContentResolver()Landroid/content/ContentResolver;
move-result-object v0
const-string v4, "hide_virtual_key"
invoke-static {v0, v4, v2}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I
move-result v0
if-lez v0, :cond_56
move v0, v1
:goto_4b
invoke-virtual {v3, v0}, Landroid/preference/SwitchPreference;->setChecked(Z)V
iget-object v0, p0, Lcom/android/settings/VirtualKeySettings;->mSwitchPreference:Landroid/preference/SwitchPreference;
iget-object v1, p0, Lcom/android/settings/VirtualKeySettings;->mPreferenceChangedListener:Landroid/preference/Preference$OnPreferenceChangeListener;
invoke-virtual {v0, v1}, Landroid/preference/SwitchPreference;->setOnPreferenceChangeListener(Landroid/preference/Preference$OnPreferenceChangeListener;)V
:goto_55
return-void
:cond_56
move v0, v2
goto :goto_4b
[B]:cond_58[/B]
const-string v0, "virtual_key"
invoke-virtual {p0, v0}, Lcom/android/settings/VirtualKeySettings;->[B]removePreference[/B](Ljava/lang/String;)V
const/4 v0, 0x0
iput-object v0, p0, Lcom/android/settings/VirtualKeySettings;->mSwitchPreference:Landroid/preference/SwitchPreference;
goto :goto_55
.end method
change :cond_58 with
Code:
if-eqz v0, [B][COLOR="DarkGreen"]:cond_2e[/COLOR][/B]
cond_2e show the toggle...
cond_58 remove the toggle.
Launcher Stock
Tested on Android 6.0
HwLauncher6
smali\com\huawei\android\launcher\Settings.smali
Home Layout 5x5
Find 4x4,4x5
there are 3 results
Edit all with 4x4,4x5,5x5
Code:
[...]
.field private static final DEFAULT_CELL_OPTIONS:Ljava/lang/String; = "4x4,4x5,5x5"
[...]
const-string v3, "4x4,4x5,5x5"
[...]
const-string v8, "4x4,4x5,5x5"
[...]
Rotation Toggle
Code:
# direct methods
.method static constructor <clinit>()V
.locals 4
const/4 v3, -0x1
const/4 v2, 0x1
const/4 v1, 0x0
[...]
sput-boolean [B][COLOR="Red"]v1[/COLOR][/B], Lcom/huawei/android/launcher/Settings;->sOrientationEnable:Z
[...]
Edit v1 with v2
Code:
sput-boolean [B][COLOR="DarkGreen"]v2[/COLOR][/B], Lcom/huawei/android/launcher/Settings;->sOrientationEnable:Z
Music Player on Lockscreen
Tested on Android 6.0
Only a few Music Player are displayed on Lockscreen...
but we can add all Music Player that we want!
Keyguard.apk
smali\com\android\huawei\music\HwMusic.smali
Code:
.method private isSupportMusic(Ljava/lang/String;)Z
.locals 2
.param p1 # Ljava/lang/String;
const-string v0, "com.android.mediacenter"
invoke-virtual {v0, p1}, Ljava/lang/String;->equalsIgnoreCase(Ljava/lang/String;)Z
move-result v0
if-nez v0, :cond_1e
[COLOR="Red"] const-string v0, "com.google.android.music"
invoke-virtual {v0, p1}, Ljava/lang/String;->equalsIgnoreCase(Ljava/lang/String;)Z
move-result v0
if-nez v0, :cond_1e[/COLOR]
[B][COLOR="Red"]## HERE WE CAN ADD ALL MUSIC APP. FOLLOW THE EXAMPLE IN RED[/COLOR][/B]
iget-object v0, p0, Lcom/android/huawei/music/HwMusic;->mHwCustHwMusic:Lcom/android/huawei/music/HwCustHwMusic;
if-eqz v0, :cond_20
iget-object v0, p0, Lcom/android/huawei/music/HwMusic;->mHwCustHwMusic:Lcom/android/huawei/music/HwCustHwMusic;
iget-object v1, p0, Lcom/android/huawei/music/HwMusic;->mContext:Landroid/content/Context;
invoke-virtual {v0, v1, p1}, Lcom/android/huawei/music/HwCustHwMusic;->isPackageInWhiteMusicList(Landroid/content/Context;Ljava/lang/String;)Z
move-result v0
if-eqz v0, :cond_20
:cond_1e
const/4 v0, 0x1
:goto_1f
return v0
:cond_20
const/4 v0, 0x0
goto :goto_1f
.end method
I added, for test, VLC and PI Music Player...
Code:
[COLOR="DarkGreen"]const-string v0, "[B]org.videolan.vlc[/B]"
invoke-virtual {v0, p1}, Ljava/lang/String;->equalsIgnoreCase(Ljava/lang/String;)Z
move-result v0
if-nez v0, :cond_1e [/COLOR]
[COLOR="Navy"]const-string v0, "[B]com.Project100Pi.themusicplayer[/B]"
invoke-virtual {v0, p1}, Ljava/lang/String;->equalsIgnoreCase(Ljava/lang/String;)Z
move-result v0
if-nez v0, :cond_1e[/COLOR]
That's a nice thread, thanks for the info.
I've been furious as to why I was unable to de/compile Huawei APKs.
I hope we're able to de/compile more than just framework-res.apk in the future!
The problem is that nobody works on a modded apktool for Huawei/Honor
So we have to use old tools...
apktool 2.2.1, 2.2.2 and the last 2.2.3 don't work...
smali/baksmali is the same
We need a developer
How to translate or edit KangVip?
We haven't problem with kangvip-res.apk ...
we are able to decompile and recompile without problems with TMA (Tickle My Android) and apktool 2.2.3!
But we have a lot of problems with KangVIPTools.apk
We can only decompile it... but not recompile!
How to solve it?
Decompile with TMA...
Open AndroidManifest.xml...
at the end of line 4 you have
Code:
android:qihoo="activity"
Delete it or you can't recompile!
Now you have a recompiled apk file... but it isn't good! ... it crashes!
So you have to open Original and Recompiled File...
from Recompiled apk take resources.arsc (if you edited values folder), layout/*.xml, xml/*.xml, ecc ...
Put resources.arsc and other modded files in Original apk (overwrite original file)...
Now you have a good apk to insert in Device /system/framework folder
...or kep2008 Procedure:
You can also copy from original .apk META-INF folder and AndroidManifest.xml and move them to a modified .apk (I do this with 7zip).
Click to expand...
Click to collapse
https://forum.xda-developers.com/showpost.php?p=73039858&postcount=21
IMPORTANT:
Not all modifications are good ... you have to try!
Aren't you able to hide some things?
Here is a solution
Tested by me on my VNS-L21C432B170
Hey that's some good work I will try it for p10 lite
Can you post the contents of res/values/config.xml from your decompiled framework-res.xml? Thanks!
In res/values there isn't config.xml
I have:
attr-privates
Arrays
Attrs
Bools
Colors
Dimens
Drawables
Fractions
Ids
Integers
Plurals
Public
Strings
Styles
Alright. Can you try doing a search for "config_statusBarIcons"?
I found it in arrays.xml
Code:
<string-array name="config_statusBarIcons">
<item>managed_profile</item>
<item>ime</item>
<item>sync_failing</item>
<item>sync_active</item>
<item>cast</item>
<item>location</item>
<item>bluetooth</item>
<item>powersavingmode</item>
<item>earphone</item>
<item>nfc</item>
<item>tty</item>
<item>speakerphone</item>
<item>zen</item>
<item>mute</item>
<item>volume</item>
<item>wifi</item>
<item>cdma_eri</item>
<item>data_connection</item>
<item>phone_evdo_signal</item>
<item>phone_signal</item>
<item>battery</item>
<item>alarm_clock</item>
<item>secure</item>
<item>clock</item>
<item>volte_call</item>
<item>unicom_call</item>
<item>eyes_protect</item>
</string-array>
Thank you! Now if only I can get the comparable list from a Huawei device running Nougat. Want to try decompiling my framework-res.apk from Mate 9?
Upload your framework
My framework-res is from Marshmallow ...I use it at the moment.
If you need, I can decompile P9 lite Nougat framework-res also
millo1978 said:
Upload your framework
My framework-res is from Marshmallow ...I use it at the moment.
If you need, I can decompile P9 lite Nougat framework-res also
Click to expand...
Click to collapse
Yes! Please decompile the P9 Lite Nougat framework-res and look for that string again. It would be a great help for an app I'm making
I tested all release of apktool, but nothing
I'm not able to decompile Nougat apks
Advanced Power Menu
Reboot Menu
ORIGINAL THREAD:
https://forum.xda-developers.com/galaxy-s5/themes-apps/app-t2996278
Thanks to @daxgirl
It isn't simple to have an Advanced Power Menu editing service.jar ...
But daxgirl helped us with this wonderful app!
daxgirl (original app was for Lollipop) gave us the source code...
so now we can build this app for Marshmallow or Nougat also... we have only to make some edits.
Android Studio on Windows is needed.
We have to import the source code and update all things that Android Studio need...
now we are ready to start!
What I edited on Android 6.0?
(same for Android 7)
build.gradle
DialogRebootFragment.java
strings.xml
In build.gradle I set version 23 for Marshmallow, instead of 21 for Lollipop.
Then I also modified the version of the Tool, as proposed by the Android Studio.
In the DialogRebootFragment I had to make some changes, as the Hot Reboot and Download Mode worked.
I edited
Code:
busybox killall zygote
Instead of
Code:
busybox killall system_server
to have Hot Reboot working.
I edited
Code:
pm.reboot("bootloader");
Instead of
Code:
pm.reboot("download");
to have Download Mode working.
If you want to hide the icon, you have to add "//"
Code:
builder.setTitle(R.string.dialog_title)
// .setIcon(R.mipmap.ic_launcher)
You can translate it in all languages!
How to port KangVIP
SOURCE
Thanks to HRT Team - kangvip
How to do?
Exactly I don't know! There aren't in internet informations about it!
...and no one wants to share what he knows.
I like sharing information...
So we can improve everyone
How did I do it?
I searched a ROM with Kangvip tools...
a ROM with same OS (in my case Android 6.0 EMUI 4.1.2) and a similar Phone (Honor 5C).
I tried, File for File, to understand what were important ... but at the end, getting various errors, I was forced to take all the files in the framework folder.
(is it right? I don't know, but it works!)
What other files are needed?
app folder:
HwFloatCalculator (floating app)
HwFloatCalendar (floating app)
HwFloatNotePad (floating app)
HwLauncher6 (to have advanced options)
etc/permissions folder:
com.google.android.dialer.support.xml
etc folder:
k.set (needed? I don't know)
priv-app folder:
IncallUI (needed? I have to test it)
Keyguard (to have lockscreen advanced settings)
SystemUI (to have SystemUI advanced settings)
Settings (to have k-settings in menu)
WiFiPW (to display Wifi passwords)
Other files needed:
...
(I don't know)
I'll complete this post with new informations.
Now I have a working Kangvip tools... but not complete.
This is a great starting point.
We can correct it, translate, edit menu, edit layout, hide chinese, unwanted or not working parts, etc...
https://forum.xda-developers.com/showpost.php?p=72846664&postcount=9
Everyone's help is welcome
Related
Guide is on post 3
Terms Explained
Clock Removed: The clock has been removed from the notification bar.
DateFormat-X: The date has been modified in the notification bar pulldown. Short (12.13.52) Medium (Dec 13, 1952) Long (December 13, 1952) Full (Monday, December 12, 1952)
TimeFormat-X: The time has been added to the notification bar pulldown. Short (3:30pm) Long (3:30:23pm) Full (3:30:23pm PST)
Alarm Clock Icon Removed: The alarm clock icon that appears when you have an upcoming alarm has been removed.
USB Debugging Icon Removed: When the usb is connected in debugging mode, the icon that usually appears will not.
Click to expand...
Click to collapse
DOWNLOADS
If you don't like the mod, or something when wrong when flashing another services.jar, use this.
1. Captivate (JPY or JS3)Stock Services.jar
2. i9000 JS3 Stock Services.jar
Click to expand...
Click to collapse
These Mods all include the clean backlight fix provided by sasovics. They should work with JPY JS3 and Rogers 2.2 Based Captivate Roms. This fix should get rid of any problems users were having with the phone.apk FC'ing.
3. Clock Removed. DateFormat-Medium. TimeFormat-Short.
4. Clock Removed. DateFormat-Medium. TimeFormat-Short. Alarm Clock Icon Removed.
5. Clock Removed. DateFormat-Medium. TimeFormat-Short. USB Debugging Icon Removed.
6. Clock Removed. DateFormat-Medium. TimeFormat-Short. Alarm Clock Icon Removed. USB Debugging Icon Removed.
Click to expand...
Click to collapse
These don't have the backlight fix. They will work with Captivate JPY, JS3, and Rogers 2.2 Roms . They will probably work on i9000 JPY and JS3 (As soon as someone tests, we'll know for sure)
7. Clock Removed. DateFormat-Medium. TimeFormat-Short.
8. Clock Removed. DateFormat-Medium. TimeFormat-Short. Alarm Clock Icon Removed.
9. Clock Removed. DateFormat-Short. TimeFormat-Short. Alarm Clock Icon Removed
10. Clock Removed. DateFormat-Medium. TimeFormat-Short. USB Debugging Icon Removed.
11. Clock Removed. DateFormat-Medium. TimeFormat-Short. Alarm Icon Removed. USB Debugging Icon Removed.
12. DateFormat-Medium. TimeFormat-Short. Alarm Icon Removed. USB Debugging Icon Removed.
Click to expand...
Click to collapse
These are Vibrant KA9 based Roms. Source is taken from Trigger 1.2 on the vibrant forums. If you are a Vibrant user, running a KA9 based Rom, try this out or request your own Mod!
13. Clock Removed. DateFormat-Full. TimeFormat-Short. Alarm Icon Removed.
Click to expand...
Click to collapse
14.
Click to expand...
Click to collapse
INSTRUCTIONS
To install, just flash the zip through Clockwork Recovery, or extract the services.jar and push the services.jar to /system/framework. The first boot will take a few minutes (up to 10 mins) then after that it should be a normal boot. This is because this mod wipes Dalvik-Cache.
REQUESTS
If you would like me to create a modded services.jar for your rom, just upload the services.jar and I'll see what I can do.
Request Format:
Rom Name and Version: Ex. Serendipity 5.4
Remove Time: Yes, No, Only AM/PM
Date in Notification Bar: None, Short, Medium, Long, Full
Time in Notification Bar: None, Short, Long, Full
Remove Alarm Icon: Yes or No
Remove Usb Debugging: Yes or No
Click to expand...
Click to collapse
Standard Disclaimer: As always, you should make a nandroid backup before doing any modifications to your phone. I am not responsible if this causes any damage.
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Sorry, what does deodexed mean? I found something like this in the i9000 section and have been using it for a week or two, but I loved how serendipity's services.jar got rid of the usb debugging icon. Do you think you could make one without both the clock and usb debugging icon?
Guide for Removing and Adding Various Items to the servics.jar.
Directions for decompiling and recompiling the services.jar
I'm going to assume that you both have adb installed and know how to use it.
1. Extract the services.jar from your ROM (make a copy in case you mess something up) and place it in the /tools folder of your sdk.
2. Download smali and baksmali from http://code.google.com/p/smali/ and place them in the tools folder. Rename the files to baksmali.jar and smali.jar
3. Open the services.jar file with an archiving program. (I use 7zip because it's free)
4. Copy out the classes.dex file to the /tools folder of the sdk
5. To decompile, run the following command from the command prompt (Directory set as the /tools folder of your sdk)
Code:
java -jar baksmali.jar -o classout/ classes.dex
6. Now you should have a "classout" folder inside "tools"
7. Apply various mods
8. To recompile, Run the following command from the command prompt
Code:
java -Xmx512M -jar smali.jar classout/ -o new-classes.dex
9. If you applied the changes correctly, you should have a "new-classes.dex" file in your /tools folder.
10. Rename your old "classes.dex" to something else (or just delete it)
11. Rename "new-classes.dex" to "classes.dex"
12. Open the services.jar archive and place the "classes.dex" we just created in its place.
13. Place the services.jar back in the /system/framework folder.
Click to expand...
Click to collapse
Applying Mods
Remove Clock - Open the StatusBarPolicy.smali located in classout/com/android/server/status. Find the line
Code:
invoke-direct {p0}, Lcom/android/server/status/StatusBarPolicy;->updateClock()V
and replace with
Code:
invoke-direct {p0}, Lcom/android/server/status/StatusBarPolicy;->updateClock()V
invoke-virtual {p2, v3, v6}, Lcom/android/server/status/StatusBarService;->setIconVisibility(Landroid/os/IBinder;Z)V
Click to expand...
Click to collapse
Remove Alarm Icon Open the StatusBarPolicy.smali located in /classout/com/android/server/status. Find the line
Code:
const-string v1, "alarmSet"
const/4 v2, 0x0
invoke-virtual {p1, v1, v2}, Landroid/content/Intent;->getBooleanExtra(Ljava/lang/String;Z)Z
move-result v0
and replace with
Code:
const/4 v0, 0x0
const-string v1, "alarmSet"
const/4 v2, 0x0
Click to expand...
Click to collapse
Removing the USB Debugging Icon Open the NotificationManagerService.smali located in /classout/com/android/server. Find the following line and just comment it out.
Code:
iput v7, v6, Landroid/app/Notification;->icon:I
Becomes
Code:
#iput v7, v6, Landroid/app/Notification;->icon:I
Click to expand...
Click to collapse
Removing the Battery Open the StatusBarPolicy.smali found in classout/com/android/server/status. Find
Code:
iput-object v3, p0, Lcom/android/server/status/StatusBarPolicy;->mBatteryIcon:Landroid/os/IBinder;
and ADD the following code below it
Code:
invoke-virtual {p2, v3, v6}, Lcom/android/server/status/StatusBarService;->setIconVisibility(Landroid/os/IBinder;Z)V
Click to expand...
Click to collapse
Adding the Time to the Notification Pulldown - Open the DateView.smali located in classout/com/android/server/status. Find the following lines, or something very similar to it. The best way is to search for "getDateFormat". I have replaced the line numbers in my example with .line # because it will be different for every services.jar
Code:
.registers 3
.prologue
.line #
new-instance v0, Ljava/util/Date;
invoke-direct {v0}, Ljava/util/Date;-><init>()V
.line #
.local v0, now:Ljava/util/Date;
iget-object v1, p0, Lcom/android/server/status/DateView;->mContext:Landroid/content/Context;
invoke-static {v1}, Landroid/text/format/DateFormat;->getDateFormat(Landroid/content/Context;)Ljava/text/DateFormat;
move-result-object v1
invoke-virtual {v1, v0}, Ljava/text/DateFormat;->format(Ljava/util/Date;)Ljava/lang/String;
move-result-object v1
invoke-virtual {p0, v1}, Lcom/android/server/status/DateView;->setText(Ljava/lang/CharSequence;)V
and replace that with
Code:
.registers 4
.prologue
.line #
new-instance v0, Ljava/util/Date;
invoke-direct {v0}, Ljava/util/Date;-><init>()V
.line #
.local v0, now:Ljava/util/Date;
const/4 v1, 0x2
const/4 v2, 0x3
invoke-static {v1, v2}, Ljava/text/DateFormat;->getDateTimeInstance(II)Ljava/text/DateFormat;
move-result-object v1
invoke-virtual {v1, v0}, Ljava/text/DateFormat;->format(Ljava/util/Date;)Ljava/lang/String;
move-result-object v1
invoke-virtual {p0, v1}, Lcom/android/server/status/DateView;->setText(Ljava/lang/CharSequence;)V
To control the length of the date and time edit
Code:
const/4 v1, 0x2
const/4 v2, 0x3
The first line is the date and the second line is the time. In My example, I am using a MEDIUM date (0x2) and a SHORT time (0x3)
FULL would be 0x0, LONG would be 0x1 etc., etc.
Click to expand...
Click to collapse
Adding Time and Removing Date from Pulldown - Open the DateView.smali located in classout/com/android/server/status. Find the following lines, or something very similar to it. The best way is to search for "getDateFormat". I have replaced the line numbers in my example with .line # because it will be different for every services.jar
Code:
.registers 3
.prologue
.line #
new-instance v0, Ljava/util/Date;
invoke-direct {v0}, Ljava/util/Date;-><init>()V
.line #
.local v0, now:Ljava/util/Date;
iget-object v1, p0, Lcom/android/server/status/DateView;->mContext:Landroid/content/Context;
invoke-static {v1}, Landroid/text/format/DateFormat;->getDateFormat(Landroid/content/Context;)Ljava/text/DateFormat;
move-result-object v1
invoke-virtual {v1, v0}, Ljava/text/DateFormat;->format(Ljava/util/Date;)Ljava/lang/String;
move-result-object v1
invoke-virtual {p0, v1}, Lcom/android/server/status/DateView;->setText(Ljava/lang/CharSequence;)V
And replace with
Code:
.registers 3
.prologue
.line #
new-instance v0, Ljava/util/Date;
invoke-direct {v0}, Ljava/util/Date;-><init>()V
.line #
.local v0, now:Ljava/util/Date;
const/4 v1, 0x3
invoke-static {v1, v2}, Ljava/text/DateFormat;->getDateTimeInstance(II)Ljava/text/DateFormat;
move-result-object v1
invoke-static {v1}, Ljava/text/DateFormat;->getTimeInstance(I)Ljava/text/DateFormat;
move-result-object v1
invoke-virtual {p0, v1}, Lcom/android/server/status/DateView;->setText(Ljava/lang/CharSequence;)V
Click to expand...
Click to collapse
Removing Date from Pulldown - Open the DateView.smali located in classout/com/android/server/status. Find the following lines, or something very similar to it. The best way is to search for "getDateFormat". I have replaced the line numbers in my example with .line # because it will be different for every services.jar
Code:
.registers 3
.prologue
.line #
new-instance v0, Ljava/util/Date;
invoke-direct {v0}, Ljava/util/Date;-><init>()V
.line #
.local v0, now:Ljava/util/Date;
iget-object v1, p0, Lcom/android/server/status/DateView;->mContext:Landroid/content/Context;
invoke-static {v1}, Landroid/text/format/DateFormat;->getDateFormat(Landroid/content/Context;)Ljava/text/DateFormat;
move-result-object v1
invoke-virtual {v1, v0}, Ljava/text/DateFormat;->format(Ljava/util/Date;)Ljava/lang/String;
move-result-object v1
invoke-virtual {p0, v1}, Lcom/android/server/status/DateView;->setText(Ljava/lang/CharSequence;)V
And replace with
Code:
.registers 3
.prologue
.line #
new-instance v0, Ljava/util/Date;
invoke-direct {v0}, Ljava/util/Date;-><init>()V
.line #
.local v0, now:Ljava/util/Date;
const/4 v1, 0x3
invoke-static {v1, v2}, Ljava/text/DateFormat;->getDateTimeInstance(II)Ljava/text/DateFormat;
move-result-object v1
invoke-static {v1}, Ljava/text/DateFormat;->getTimeInstance(I)Ljava/text/DateFormat;
move-result-object v1
const-string v1, ""
invoke-virtual {p0, v1}, Lcom/android/server/status/DateView;->setText(Ljava/lang/CharSequence;)V
Click to expand...
Click to collapse
To only remove AM/PM from the Time- Open the StatusBarIcon.smali found in classout/com/android/server/status. Replace the following lines with their counterparts. TAKEN DIRECTLY FROM amosher13 IN THE EPIC FORUM NOTE: The .line numbers maybe be different from ROM to ROM.
At line 48 change:
Code:
.line 51
iget v6, p2, Lcom/android/server/status/IconData;->type:I
packed-switch v6, :pswitch_data_9a
TO:
Code:
.line 51
iget v6, p2, Lcom/android/server/status/IconData;->type:I
packed-switch v6, :pswitch_data_9c
---------------------------------
At line 93 change:
Code:
.line 63
const/4 v6, 0x6
invoke-virtual {v4, v6, v8, v8, v8}, Landroid/widget/TextView;->setPadding(IIII)V
.line 64
invoke-virtual {v4, v2}, Landroid/widget/TextView;->setLayoutParams(Landroid/view/ViewGroup$LayoutParams;)V
.line 65
iget-object v6, p2, Lcom/android/server/status/IconData;->text:Ljava/lang/CharSequence;
invoke-virtual {v4, v6}, Landroid/widget/TextView;->setText(Ljava/lang/CharSequence;)V
.line 66
iput-object v4, p0, Lcom/android/server/status/StatusBarIcon;->view:Landroid/view/View;
goto :goto_10
.line 72
.end local v2 #layoutParams:Landroid/widget/LinearLayout$LayoutParams;
.end local v4 #t:Landroid/widget/TextView;
:pswitch_3f
const-string v6, "layout_inflater"
invoke-virtual {p1, v6}, Landroid/content/Context;->getSystemService(Ljava/lang/String;)Ljava/lang/Object;
move-result-object v1
check-cast v1, Landroid/view/LayoutInflater;
TO:
Code:
.line 63
const/4 v6, 0x6
const/16 v7, -0x26
invoke-virtual {v4, v6, v8, v7, v8}, Landroid/widget/TextView;->setPadding(IIII)V
.line 64
invoke-virtual {v4, v2}, Landroid/widget/TextView;->setLayoutParams(Landroid/view/ViewGroup$LayoutParams;)V
.line 65
iget-object v6, p2, Lcom/android/server/status/IconData;->text:Ljava/lang/CharSequence;
invoke-virtual {v4, v6}, Landroid/widget/TextView;->setText(Ljava/lang/CharSequence;)V
.line 66
iput-object v4, p0, Lcom/android/server/status/StatusBarIcon;->view:Landroid/view/View;
goto :goto_10
.line 72
.end local v2 #layoutParams:Landroid/widget/LinearLayout$LayoutParams;
.end local v4 #t:Landroid/widget/TextView;
:pswitch_41
const-string v6, "layout_inflater"
invoke-virtual {p1, v6}, Landroid/content/Context;->getSystemService(Ljava/lang/String;)Ljava/lang/Object;
move-result-object v1
check-cast v1, Landroid/view/LayoutInflater;
-----------------------------------
At line 175 change:
Code:
.line 86
iget v6, p2, Lcom/android/server/status/IconData;->number:I
if-lez v6, :cond_93
TO:
Code:
.line 86
iget v6, p2, Lcom/android/server/status/IconData;->number:I
if-lez v6, :cond_95
------------------------------------
At line 208 change:
Code:
.line 90
:cond_93
const/16 v6, 0x8
invoke-virtual {v3, v6}, Landroid/widget/TextView;->setVisibility(I)V
goto/16 :goto_10
.line 51
:pswitch_data_9a
.packed-switch 0x1
:pswitch_11
:pswitch_3f
.end packed-switch
.end method
.method static getIcon(Landroid/content/Context;Lcom/android/server/status/IconData;)Landroid/graphics/drawable/Drawable;
.registers 9
.parameter "context"
.parameter "data"
.prologue
const/4 v5, 0x0
const-string v6, "StatusBar"
TO:
Code:
.line 90
:cond_95
const/16 v6, 0x8
invoke-virtual {v3, v6}, Landroid/widget/TextView;->setVisibility(I)V
goto/16 :goto_10
.line 51
:pswitch_data_9c
.packed-switch 0x1
:pswitch_11
:pswitch_41
.end packed-switch
.end method
.method static getIcon(Landroid/content/Context;Lcom/android/server/status/IconData;)Landroid/graphics/drawable/Drawable;
.registers 9
.parameter "context"
.parameter "data"
.prologue
const/4 v5, 0x0
const-string v6, "StatusBar"
Click to expand...
Click to collapse
Click to expand...
Click to collapse
And here are the links I used to create this Tutorial. I merely read what these guys did, and put it all together in one place. If you feel the need to donate, please donate to one of these guys.
[HOW-TO] Change status bar clock color
[HOW-TO] Hide various Icons from the Status Bar
Can the time be placed next to the date on status bar when clock is removed?
[MOD] Remove Clock and Date from Statusbar/Notification Clock and Remove Date
Looks great with Serendipity.
I always hated the clock in the NB anyway. lol
Thanks a lot, just what I was looking for
JS3/JPY Versions. (No Backlight Fix)
nice. i hate clocks
Do you think you could remove the clock from the latest services.jar from serendipity 5.4? File is attached
Thnikk said:
Do you think you could remove the clock from the latest services.jar from serendipity 5.4? File is attached
Click to expand...
Click to collapse
Normally, you would just be able to flash the same .zip I attached earlier, but the most recent change in 5.4 messes with the services.jar, so I'll give it a shot.
I went from 5.3 to 5.4 on Serendipity last night and the alarm never went off using this. I was an hour late to work and my cat exploded. :-(
Sent from my SAMSUNG-SGH-I897 using Tapatalk
Debugging Removed!
Serendipity Mods Added!
For anyone that wants the usb debugging icon removed, use these.
2 More Mods added! They were built from Firefly (Rogers 2.2) but will work on JPY and JS3
No Clock No Debugging No Backlight: Doesn't have the backlight fix,
No Debugging No Backlight: Is just Clock is stock, but debugging is gone and no backlight fix.
I'd like a verion that removes the clock but keeps the alarm notification, I'm on Serendipity 5.4
i would like the clock removed completely i use a widget for weather and clock on phoenix
OP Updated!
New Update's added!
*JPY No Clock with di11igaf's Backlight Fix
http://forum.xda-developers.com/showthread.php?t=943015
*JPY No Clock No alarm with di11igaf's Backlight Fix
* Serendipity 5.4 No Clock
* Serendipity 5.4 No Clock No Alarm
I also reworked the OP a little bit, so go check it out!
mikehe said:
i would like the clock removed completely i use a widget for weather and clock on phoenix
Click to expand...
Click to collapse
Do you want it removed from the Notification Pulldown as well?
It doesn't really do too much harm to have the Date and Time listed there, and you can still access the time in 3rd Party apps just by checking your notifications.
yes a cross the toolbar is worthless to me since my widget has it big and nice on home screen
mikehe said:
yes a cross the toolbar is worthless to me since my widget has it big and nice on home screen
Click to expand...
Click to collapse
Alright, try this
Its the basic clock removal found in the first post.
Phoenix is based off JPY, so this should work for you.
Rom Name and Version: Darky's 9.2
Remove Time: Yes
Date in Notification Bar: Short
Time in Notification Bar: Short
Remove Alarm Icon: Yes
Remove Usb Debugging: No
I know Darky's 9.2 is JS3, but i would assume its similar to JPY.....and i dont mind testing
Thanks
It worked fine on Darky 9.2. Just flashed it.
I didn't see what was posted above. Sorry
[guide] adding 14 statusbar toggles to samsung galaxy y duos, y pro duos & ace duos
RATIONALE
When i set out to cook to cook my first and currently only custom rom for my first and currently only android device, i realised that porting those beautiful 14 statusbar toggles to to samsung galaxy y pro duos was not as easy as the original guide by xda member Lidroid and it's variants portrayed. i spent nearly two weeks searching and trying without success until i got some support from XDA-developers recognised contributer, Millan.sis. Together we were able to port the toggles to galaxy y pro duos. Note that Millan.sis did say Manoranjan2050 or so i think, was the first to port the statusbar toggles to the duos based phones.
having come across yet another person struggling for nearly two weeks to port these toggles to samsung galaxy ace duos, i decided to write a guide or more accurately modify the standard guide by lidroid to make it applicable on samsung galaxy dual sim based phones i n the hope that many more people will come out and cook more custom roms for these devices.
ACKNOWLEDMENTS
If you find this guide useful, you should perhaps thank me, but never forget to thank these people too. for without them this guide would never have come into existence
Lidroid for the original guide
Millan.sis for for being the first to port these toggles into duos phones providing me with the codes
Kundal for glaxy y duos codes
DISCLAIMER
In my experience, the worst that may happen to your phone if you mod your SystemUI.apk is that you loose your statusbar, a situation you can always recover from by replacing modded SystemUI.apk unmodded SystemUI.apk.
All these same, you are modding your SystemUI.apk at your own risk. I am not responsible for any damage that may come to your phone as a result of you using this guide, the original guide by lidroid or any of the tools mentioned in this guide.
THINGS YOU WILL NEED
Linux users
apk-tool, F-J Apk-tool or equivalent
patience and some common sense
windows users
Notepad++ or equivalent
apk-tool or apk-manager and their equivalents
patience and some common sense
Mac users
i'm sorry i can't help you as i have never owned a mac before but if you can get a tool capable of compiling and decompiling apk files, then you can adapt this guide to your own needs.
All OS users
Deodexed SystemUI.apk (smali files are only found in deodexed apps)
Read the original guide by Lidroid here and download Lidroid-res.apk, LidroidSystemUI.apk and QuickPanelSettings.apk
android sdk (optional) to give you adb support is not a bad idea since you will be able to directly push your finished work into the appropriate directories and reboot your phone to enjoy your toggles. Link is here
Dsixda's android kitchen (optional) for deodexing your stock rom and for signing. link is here
Batch auto apk modding tool for all OS platforms is available here
Link to apk-manager for both linux and windows is here
Step by step guide
METHOD
make sure you keep copies of the apks you are about to modify... just in case
[*]setup your apk-tool of choice
i am assuming, for the rest of this guide, that each of your apks is decompiled into a folder called 'working'
[*]
Place the LidroidSystemUI.apk into the 'in' or 'original-apk' folder of your apk-tool/manager
Decompile the LidroidSystemUI.apk and rename the created 'working' folder to say 'LidroidSystemUI'
Now place your SystemUI.apk into the 'in' or 'original-apk' folder of your apk-tool/manager and decompile it
do not rename the 'working' folder created for SystemUI.apk since we will recompile it later
Now open/browse the folder(directory) LidroidSystemUI/smali/com and copy the folder called lidroid
browse to working folder for SystemUI.apk, open working/smali/com and paste the lidroid folder from the previous step into this folder (com).
you should now have two folders (directories) called 'android' and 'lidroid' within working/smali/com of your decompiled SystemUI.apk folder(directory)
take a five-minute break if you are getting nervous
open the working folder of your decompiled SystemUI.apk from above and browse to working/smali/com/android/systemui/statusbar
you should find a bunch of smali files and two folders called 'policy' and 'quickpanel'
locate the file called 'StatusBarService.smali' and open it with the linux text editor of your choice.
if you are on windows OS, then you should use notepad++ for this.
repeat, you should use notepad++ and not notepad or wordpad etc
hit Ctrl+F on your keyboard to open the search window in your text editor.
type the following, of course without quotes, '.line 405' and hit enter key on keyboard
or instead, you may just read through the entire document until you come to .line 405
replace the following block of text (Galaxy y pro duos and ace duos only) if you use galaxy y duos, see post 8. flashlight code is same for all phones
Code:
.line 405
const/4 v12, 0x0
.line 409
.local v12, qsv:Lcom/android/systemui/statusbar/quickpanel/QuickSettingsView;
const v26, 0x7f030002
const/16 v27, 0x0
move-object/from16 v0, p1
move/from16 v1, v26
move-object/from16 v2, v27
invoke-static {v0, v1, v2}, Landroid/view/View;->inflate(Landroid/content/Context;ILandroid/view/ViewGroup;)Landroid/view/View;
move-result-object v12
.end local v12 #qsv:Lcom/android/systemui/statusbar/quickpanel/QuickSettingsView;
check-cast v12, Lcom/android/systemui/statusbar/quickpanel/QuickSettingsView;
.line 411
.restart local v12 #qsv:Lcom/android/systemui/statusbar/quickpanel/QuickSettingsView;
move-object/from16 v0, p0
with
Code:
.line 405
const/4 v12, 0x0
.line 409
const v26, 0x3030003
const/16 v27, 0x0
move-object/from16 v0, p1
move/from16 v1, v26
move-object/from16 v2, v27
invoke-static {v0, v1, v2}, Landroid/view/View;->inflate(Landroid/content/Context;ILandroid/view/ViewGroup;)Landroid/view/View;
move-result-object v12
check-cast v12, Lcom/lidroid/systemui/quickpanel/PowerWidget;
.line 411
.local v12, qsv:Lcom/lidroid/systemui/quickpanel/PowerWidget;
invoke-virtual {v12}, Lcom/lidroid/systemui/quickpanel/PowerWidget;->setupWidget()V
move-object/from16 v0, p0
FLASHLIGHT
if your phone does not have flashlight and you want to turn your normal screen into flashlight, then modify the manifest.xml file in the root of your decompiled working folder ie working/manifest.xml to look like this
Code:
<?xml version="1.0" encoding="utf-8"?>
<manifest android:sharedUserId="android.uid.system" android:process="system" android:versionCode="10" android:versionName="2.3.6" package="com.android.systemui"
xmlns:android="http://schemas.android.com/apk/res/android">
<uses-sdk android:minSdkVersion="10" android:targetSdkVersion="10" />
<uses-permission android:name="android.permission.STATUS_BAR_SERVICE" />
<uses-permission android:name="android.permission.MANAGE_USB" />
<application android:label="@string/app_label" android:icon="@drawable/ic_launcher_settings" android:allowClearUserData="false" android:persistent="true">
<service android:name=".statusbar.StatusBarService" android:exported="false" />
<activity android:name=".usb.UsbStorageActivity" android:excludeFromRecents="true" />
<activity android:theme="@android:style/Theme.IconMenu" android:name="com.android.internal.app.ExternalMediaFormatActivity" android:excludeFromRecents="true" />
<activity android:theme="@android:style/Theme.IconMenu" android:name=".usb.UsbConfirmActivity" android:permission="android.permission.MANAGE_USB" android:exported="true" android:excludeFromRecents="true" android:finishOnCloseSystemDialogs="true" />
<activity android:theme="@android:style/Theme.IconMenu" android:name=".usb.UsbPermissionActivity" android:permission="android.permission.MANAGE_USB" android:exported="true" android:excludeFromRecents="true" android:finishOnCloseSystemDialogs="true" />
<activity android:theme="@android:style/Theme.IconMenu" android:name=".usb.UsbResolverActivity" android:permission="android.permission.MANAGE_USB" android:exported="true" android:excludeFromRecents="true" android:finishOnCloseSystemDialogs="true" />
<activity android:theme="@android:style/Theme.IconMenu" android:name=".usb.UsbAccessoryUriActivity" android:permission="android.permission.MANAGE_USB" android:exported="true" android:excludeFromRecents="true" android:finishOnCloseSystemDialogs="true" />
<activity android:theme="@android:style/Theme.NoTitleBar.Fullscreen" android:name="com.lidroid.systemui.quickpanel.FlashlightActivity" android:clearTaskOnLaunch="true" android:launchMode="singleTask" android:configChanges="keyboardHidden|orientation" />
</application>
</manifest>
Notice i merely added the following line
Code:
<activity android:theme="@android:style/Theme.NoTitleBar.Fullscreen" android:name="com.lidroid.systemui.quickpanel.FlashlightActivity" android:clearTaskOnLaunch="true" android:launchMode="singleTask" android:configChanges="keyboardHidden|orientation" />
</application>
just before the line starting with </application>.
ensure that in your modified manifest.xml that the start of all the lines with <activity android:............. /> are all in a straight line since the spacing at the beggining of lines is very important.
if the phone has no flashlight and you fail to modify manifest.xml, then you will have a force close problem anytime you tap on flashlight toggle in your statusbar.
Now compile your modded working folder, sign it and push it into your /system/app folder of your phone.
Don't forget to also push lidroid-res.apk into /system/framework directory of your phone.
you may optionally push QuickpanelSettings.apk you downloaded earlier into your /system/app folder.
if you are not sure, how to push them into the appropriate directories on your phone, read the original thread by Lidroid
Reboot your phone and enjoy your modding.
SIGNING YOUR COMPILED APKS
you can use the signing facility that comes with your apk-tool or manager. in my case signing with my apk-tool make my SystemUI.apk to become too big and it also did not work. i had to resign using dsixda's kitchen.
in Dsixda's kitchen menu, choose the advanced option, select option to sign apks and then choose option to sign apks outside working folder
place you compiled SystemUI.apk inside the signed files folder created for you, go back to kitchen's menu and hit enter on our keyboard to sign your file.
TROUBLESHOOTING SECTION
all troubleshooting material will be posted here but first please read the original post by lidroid before complaining or asking questions here.
reserved
Nice!
Sent from my GT-S5360 using XDA
Cool.. now there will be more devs of roms i feel..
hit thanks button! If above post helps you..
Sent from my GT-S6102
nitubhaskar said:
Cool.. now there will be more devs of roms i feel..
hit thanks button! If above post helps you..
Sent from my GT-S6102
Click to expand...
Click to collapse
that is what i am hoping for. we can do with a few more rom.
In the SystemUI.apk of my GT S6102 (Rom XXLH1) the code block to be changed in StatusBarService.smali is at a different place.
It begins with .line 412:
Replace this:
Code:
.line 412
const/4 v12, 0x0
.line 416
.local v12, qsv:Lcom/android/systemui/statusbar/quickpanel/QuickSettingsView;
const v26, 0x7f030002
const/16 v27, 0x0
move-object/from16 v0, p1
move/from16 v1, v26
move-object/from16 v2, v27
invoke-static {v0, v1, v2}, Landroid/view/View;->inflate(Landroid/content/Context;ILandroid/view/ViewGroup;)Landroid/view/View;
move-result-object v12
.end local v12 #qsv:Lcom/android/systemui/statusbar/quickpanel/QuickSettingsView;
check-cast v12, Lcom/android/systemui/statusbar/quickpanel/QuickSettingsView;
.line 418
.restart local v12 #qsv:Lcom/android/systemui/statusbar/quickpanel/QuickSettingsView;
move-object/from16 v0, p0
with:
Code:
.line 412
const/4 v12, 0x0
.line 416
const v26, 0x3030003
const/16 v27, 0x0
move-object/from16 v0, p1
move/from16 v1, v26
move-object/from16 v2, v27
invoke-static {v0, v1, v2}, Landroid/view/View;->inflate(Landroid/content/Context;ILandroid/view/ViewGroup;)Landroid/view/View;
move-result-object v12
check-cast v12, Lcom/lidroid/systemui/quickpanel/PowerWidget;
.line 418
.local v12, qsv:Lcom/lidroid/systemui/quickpanel/PowerWidget;
invoke-virtual {v12}, Lcom/lidroid/systemui/quickpanel/PowerWidget;->setupWidget()V
move-object/from16 v0, p0
Kundal said:
In the SystemUI.apk of my GT S6102 (Rom XXLH1) the code block to be changed in StatusBarService.smali is at a different place.
It begins with .line 412:
Replace this:
Code:
.line 412
const/4 v12, 0x0
.line 416
.local v12, qsv:Lcom/android/systemui/statusbar/quickpanel/QuickSettingsView;
const v26, 0x7f030002
const/16 v27, 0x0
move-object/from16 v0, p1
move/from16 v1, v26
move-object/from16 v2, v27
invoke-static {v0, v1, v2}, Landroid/view/View;->inflate(Landroid/content/Context;ILandroid/view/ViewGroup;)Landroid/view/View;
move-result-object v12
.end local v12 #qsv:Lcom/android/systemui/statusbar/quickpanel/QuickSettingsView;
check-cast v12, Lcom/android/systemui/statusbar/quickpanel/QuickSettingsView;
.line 418
.restart local v12 #qsv:Lcom/android/systemui/statusbar/quickpanel/QuickSettingsView;
move-object/from16 v0, p0
with:
Code:
.line 412
const/4 v12, 0x0
.line 416
const v26, 0x3030003
const/16 v27, 0x0
move-object/from16 v0, p1
move/from16 v1, v26
move-object/from16 v2, v27
invoke-static {v0, v1, v2}, Landroid/view/View;->inflate(Landroid/content/Context;ILandroid/view/ViewGroup;)Landroid/view/View;
move-result-object v12
check-cast v12, Lcom/lidroid/systemui/quickpanel/PowerWidget;
.line 418
.local v12, qsv:Lcom/lidroid/systemui/quickpanel/PowerWidget;
invoke-virtual {v12}, Lcom/lidroid/systemui/quickpanel/PowerWidget;->setupWidget()V
move-object/from16 v0, p0
Click to expand...
Click to collapse
Thanks Kundal. I have never decompiled SystemUI.apk for S6102. Galaxy ace duos and y pro duos have same code when I decompiled them. Can someone upload SystemUI.apk of galaxy y duos for? Its handy to have a collection
Sent from my GT-B5512 using Tapatalk 2
thanks for the tutorial.
Can someone upload SystemUI.apk of galaxy y duos for? Its handy to have a collection
Click to expand...
Click to collapse
Here's my deodexed SystemUI.apk from GT S6102 XXLH1 Rom.
Kundal said:
Here's my deodexed SystemUI.apk from GT S6102 XXLH1 Rom.
Click to expand...
Click to collapse
Thanks once again Kundal for uploading. i decompiled you SystemUI.apk and it is as you said. I have also realised that you have had some experience in working with lidroid toggles. can you add a word on say changing the background themes etc
Since i am not sure if SystemUI.apk varies (i don't think so but...) varies with different baseband (firmware) versions, could someone else with a version different from Kundal's upload his SystemUI.apk? once this is done, i will edit my original post and credit Kundal and other uploaders as is appropriate.
I have also realised that you have had some experience in working with lidroid toggles. can you add a word on say changing the background themes etc
Click to expand...
Click to collapse
I heavily modded my SystemUi.apk and framework-res.apk. Basically I used UOT kitchen to get a black transparent background and to change statusbar icons. So far it's not really related to lidroid toggles.
With lidroid I replaced icons in /res/drawable-hdpi of lidroid-res.apk. It's easy to identify the icons you have to replace. They all have names like stat_gps_on.png. To replace icons you only need to open lidroid-res.apk with 7-Zip, navigate to /res/drawable-hdpi and drag your own (properly named) icons there to overwrite the originals.
To change the language of icon descriptions, notifications etc. you'll have to decompile lidroid-res.apk and edit the file /res/values/strings.xml. After recompiling the file I opened the original lidroid-res-apk with 7-Zip and dragged the modified file resources.arsc into it to preserve the signature of the original.
Kundal said:
I heavily modded my SystemUi.apk and framework-res.apk. Basically I used UOT kitchen to get a black transparent background and to change statusbar icons. So far it's not really related to lidroid toggles.
With lidroid I replaced icons in /res/drawable-hdpi of lidroid-res.apk. It's easy to identify the icons you have to replace. They all have names like stat_gps_on.png. To replace icons you only need to open lidroid-res.apk with 7-Zip, navigate to /res/drawable-hdpi and drag your own (properly named) icons there to overwrite the originals.
To change the language of icon descriptions, notifications etc. you'll have to decompile lidroid-res.apk and edit the file /res/values/strings.xml. After recompiling the file I opened the original lidroid-res-apk with 7-Zip and dragged the modified file resources.arsc into it to preserve the signature of the original.
Click to expand...
Click to collapse
thanks. i already changed icon packs and statusbar notification area using UOT. thanks for the info on language of icon discription and how to manually change icons without kitchen
Thanks for this useful post
Hit thanks buttonIf i helped
Kundal said:
In the SystemUI.apk of my GT S6102 (Rom XXLH1) the code block to be changed in StatusBarService.smali is at a different place.
It begins with .line 412:
Replace this:
Code:
.line 412
const/4 v12, 0x0
.line 416
.local v12, qsv:Lcom/android/systemui/statusbar/quickpanel/QuickSettingsView;
const v26, 0x7f030002
const/16 v27, 0x0
move-object/from16 v0, p1
move/from16 v1, v26
move-object/from16 v2, v27
invoke-static {v0, v1, v2}, Landroid/view/View;->inflate(Landroid/content/Context;ILandroid/view/ViewGroup;)Landroid/view/View;
move-result-object v12
.end local v12 #qsv:Lcom/android/systemui/statusbar/quickpanel/QuickSettingsView;
check-cast v12, Lcom/android/systemui/statusbar/quickpanel/QuickSettingsView;
.line 418
.restart local v12 #qsv:Lcom/android/systemui/statusbar/quickpanel/QuickSettingsView;
move-object/from16 v0, p0
with:
Code:
.line 412
const/4 v12, 0x0
.line 416
const v26, 0x3030003
const/16 v27, 0x0
move-object/from16 v0, p1
move/from16 v1, v26
move-object/from16 v2, v27
invoke-static {v0, v1, v2}, Landroid/view/View;->inflate(Landroid/content/Context;ILandroid/view/ViewGroup;)Landroid/view/View;
move-result-object v12
check-cast v12, Lcom/lidroid/systemui/quickpanel/PowerWidget;
.line 418
.local v12, qsv:Lcom/lidroid/systemui/quickpanel/PowerWidget;
invoke-virtual {v12}, Lcom/lidroid/systemui/quickpanel/PowerWidget;->setupWidget()V
move-object/from16 v0, p0
Click to expand...
Click to collapse
Ya ur right but one thing its not about ur XXLH1 firmware only.all of galaxy y duos have the same lines
Hit thanks buttonIf I helped
Hey great!
How to mod % battery to replay default icon??
Yeah this is what i was looking for!!
I m fond of modding and this will add to my current project for ace duos ..
u will be all always credited on my thread..
EDIT : DIDNT WORKED
Only added lidroid folder and edited statusbarservice
didnt touched manifiest.xml
recompiled and signed with x-took [ apk tool] and after pushing it didnt worked;
moreover i have modified pngs in systemui.apk earlier , which never created any problem may be because i never decomplied as png are to be replaced only with 7zip.
any way to modifiy ??
Device ; Galaxy ace duos s6802
Re: [guide] adding 14 statusbar toggles to samsung galaxy y duos, y pro duos & ace du
mjp93 said:
Yeah this is what i was looking for!!
I m fond of modding and this will add to my current project for ace duos ..
u will be all always credited on my thread..
EDIT : DIDNT WORKED
Only added lidroid folder and edited statusbarservice
didnt touched manifiest.xml
recompiled and signed with x-took [ apk tool] and after pushing it didnt worked;
moreover i have modified pngs in systemui.apk earlier , which never created any problem may be because i never decomplied as png are to be replaced only with 7zip.
any way to modifiy ??
Device ; Galaxy ace duos s6802
Click to expand...
Click to collapse
Use my tool
http://forum.xda-developers.com/showthread.php?t=2181597
Sent from my A116 using Tapatalk 2
its not working everytime i make this mod i lose my statusbar. currently running on DDMC1 stock rom. can anyone help me out?? the precompiled 14 toggles for stock rom is also not working.
I can't do CRT animation by my self. Because changing the value of config_animateScreenLights from true to false in framework-res.apk is not working anymore!
The problem is that are some missing commands in the /system/framework/services.jar
After comparing files from GB and ICS, i might have come up with a Method.
This is what have to be done:
First of all decompile classes of services.jar (I won't provide any information to this, there are many tutorials out there how to use the smali tools!)
Then in com/android/server/PowerManagerService.smali we have to make the method nativeStartSurfaceFlingerAnimation(I)V callable from inner classes. To do that, we have to add the following after the last access$XXXX method:
Code:
.method static synthetic access$9000(Lcom/android/server/PowerManagerService;I)V
.registers 2
.parameter "x0"
.parameter "x1"
.prologue
.line 110
invoke-direct {p0, p1}, Lcom/android/server/PowerManagerService;->nativeStartSurfaceFlingerAnimation(I)V
return-void
.end method
Than we have to add some commands to the file com/android/server/PowerManagerService$BrightnessState.smali to trigger the CRT-off-effect. For that add the red part between :cond_38 and iget-object v4, p0, Lcom/a.... like this (its around line 400 in code):
Code:
.line 2679
.restart local v3 #turningOff:Z
:cond_38
iget-object v4, p0, Lcom/android/server/PowerManagerService$BrightnessState;->this$0:Lcom/android/server/PowerManagerService;
const/16 v3, 0x11 # CRT-On and CRT-Off
#calls: Lcom/android/server/PowerManagerService;->nativeStartSurfaceFlingerAnimation(I)
invoke-static {v4, v3}, Lcom/android/server/PowerManagerService;->access$9000(Lcom/android/server/PowerManagerService;I)V
iget-object v4, p0, Lcom/android/server/PowerManagerService$BrightnessState;->this$0:Lcom/android/server/PowerManagerService;
#getter for: Lcom/android/server/PowerManagerService;->mScreenBrightness:Lcom/android/server/PowerManagerService$BrightnessState;
invoke-static {v4}, Lcom/android/server/PowerManagerService;->access$6000(Lcom/android/server/PowerManagerServiceLcom/android/server/PowerManagerService$BrightnessState;
move-result-object v4
Lastly, recompile the file, put it on your phone CRT-off effect will be magically displayed.
Lastly, i really seek the devs help to work on this and bring success to this work.
post
This is for stock Sony I suppose?
You're not getting any animation at all? I ask because stock Sony has a different animation than AOSP/CM. Stock uses a blurred circle like animation which "closes" towards the center of the screen. The opposite direction of movement when you turn on the device.
I posted this in S2 section a while ago but after talking with a senior mod I'm posting here as its useful on this device
Firstly I am by no means an expert and am just trying to share what i have learnt about smali as its hard to find much info about general smali. Contributions to the thread are always welcome
For the last year or so I have been developing AllianceROM on the i9100. During this time I have learnt lots about smali through a combination of trial and error and guides I have found here on XDA. The guides are great but one thing that stands out is that they all follow the same pattern of “Find a certain line in a certain file and copy/paste" to replace methods or chunks of code for the desired outcome. Whilst this is a great means to an end it is only a means to that particular end. Most people wont actually understand what they are doing or how it works and will blindly do as instructed.
So I thought that I would try to write some general guides. The aim is to give you the means to dream up your own mods and know how to go about implementing them from scratch by yourself. As I say, I am by no means an expert but hopefully there should be enough here to set you on your way. These are the methods I used to create many of the mods in alliance, lots of which didn’t exist on Touchwiz devices before.
You will need certain tools to do this but I am not going into how to decompile etc. Before attempting this you should have a good knowledge of decompiling apks and modding in general and have the following tools available:
ADB
Notepad ++
A good image editor like Photoshop or GIMP
The guides are in 3 sections:
Coloring stuff with color pickers
Toggling stuff to show or hide
List choices for things like toggles in view etc
For the purposes of these guides I am using an apk from our legendary alliance developer ficeto. He has made this app to enable us to easily add color pickers, checkboxes and lists by adding a single line to an xml. Huge huge thanks to him as he made this a lot easier!! You can use this to test your mods but please dont rename everything from ficeto to "ubermodders" or something and try to pass it off as your own. If you do it will be reported It is to be used as is, not changed or renamed (this causes problems for people installing alliamceMOD) and dont forget to credit ficeto!!
Please feel free to ask general smali questions here too!
So lets get started!!
Coloring Stuff:
Text Colors
There is a ton of stuff in alliance that can be colored, from text to images or backgrounds. Text works by using the setTextColor method and images and backgrounds use setColorFilter to lay a color over the top of an image ot setBackgroundColor to fill the entire background. I will cover one of each in this section starting with text color. The 3 methods use similar code and text color is the easiest to start with.
So….you decide you want to change the color of some text using a picker. For this example I will use the dropdown date. Where do you start? As you probably know dropdown stuff is dealt with by SystemUI.apk. When you decompile that you are faced with a ton of smali files. The best way to start is to use a handy function in Notepad++ called “Find in Files” which will search for certain text within files. Funnily enough its under the Search menu at the top!!
In this case the first port of call would be to search for the obvious word “date”. This returns a ton of results and you should see an obvious file called DateView.smali. If your search doesn’t return much for your specific choice of text then you have a couple of options:
1) look in the layout xml and find the id for the view you want to change. Look the id up in public.xml and then search that using “Find in Files” again. If you are unsure of the text view id then use hierarchy viewer from the tools folder of the sdk which will show you all the views on your screen
2) look through the smali files manually for anything that sounds like it might contain your target
So you think you found the right smali. Open it and search for “setText(Ljava/lang/CharSequenceV”. This will hopefully return a line something like this:
invoke-virtual {p0, v5}, Lcom/android/systemui/statusbar/policy/DateView;->setText(Ljava/lang/CharSequenceV
Scroll up until you see the name of the method. This should give you a good idea if you have the right text. In this case that line was in .method private final updateClock()V which sounds about right!
What this line is doing is calling settext with the parameter Ljava/lang/CharSequence which is the date string. Invoke virtual calls the method and the bit in the brackets {p0, v5} is the date view (p0 means “this file”) and the string (v5). The v is a register. Registers are used to store things. A few lines up in the method you will see something similar to this:
invoke-virtual {v0, v9, v5}, Landroid/content/Context;->getString(I[Ljava/lang/ObjectLjava/lang/String;
move-result-object v5
What that is doing is using getString to get the date and moving it into the register v5. This v5 is then used in our setText call.
So now we have identified our text view in the smali we can use setTextColor to change its color.
A bit of background is useful here. Color pickers do not act directly on any smali. Your phone has a database where it stores its settings. It is located in data/data/com.android.providers.settings/databases/settings.db. You can open it with Root Explorer and take a look. You will see a standard database with entries and values. What color picker code does is put an entry in this database with a “key” and a hex code. The smali then uses this key to look up the hex color it needs to set.
Now we need to add some code to look up that entry and return the color to the smali. There are 3 elements to this:
The ContentResolver
This is used to resolve the entry in the database. In order to use the content resolver we must put it into a register as we mentioned earlier. At the top of the method you will see .locals X where X is a number. This is the number of registers used in the method. So if it says .locals 5 there will be v0,v1,v2,v3 and v4. We need to add 3 to this value as we will be using 3 new registers. One for the resolver, one for the default color (in case there is no entry in the database it needs to have a color to set) and one for the key.
Now we need context in order to get the content resolver. There are a few ways to do this. A lot of files have a field called mContext. This can be used directly like this:
iget-object v5, p0, Lcom/android/systemui/statusbar/policy/BrightnessController;->mContext:Landroid/content/Context;
This is using iget-object to put mContext into v5. As mentioned earlier the p0 mean “this”.
The v5 should be the first of the new registers you added. So if previously .locals was 5 and you changed it to 8 then this would be v5 as v0 to v4 already exist. You can reuse registers but you can run into problems if it is needed further through the code so it is advisable to add new.
Alternatively, smali files whose .super is a view (look at the top of the smali for .super) like the date view we are working with here can use getcontext to get context like this:
invoke-virtual {p0}, Lcom/android/systemui/statusbar/policy/DateView;->getContext()Landroid/content/Context;
move-result-object v5
Now we have context we can use it to get the content resolver and put it into the register using this line:
invoke-virtual {v5}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;
move-result-object v5
The Key
Next we need the key that we want to look up in the database. This is as simple as :
const-string v6, "date_color"
This just puts the constant string “date_color” into v6. The text inside the “” can be anything you like but cannot have spaces and the key must match the picker key we will add later.
The Default Value
Next we need a default color for in case there is no entry in the database. For example on a fresh install or after a wipe. The value is hex but in reverse preceded with -0x so ICS blue 33b5e5 becomes -0xcc4a1a because 0 = F, 1 = E, 2 = D etc
0 = F
1 = E
2 = D
3 = C
4 = B
5 = A
6 = 9
7 = 8
8 = 7
9 = 6
A = 5
B = 4
C = 3
D = 2
E = 1
F = 0
We put that into our 3rd new register v7 using:
const v7, -0xcc4a1a
Now we have all the needed elements we can use them to return the color to the smali from the database using:
invoke-static {v5, v6, v7}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I
move-result v5
This uses the getInt method with our parameters. I have colored them so you can see how the registers relate to the getInt method. V5 is the content resolver, v6 is the string and v7 is the integer of the color.
The resultant color from the database is then moved into v5. We can use v5 register again as we no longer need the content resolver.
The color from the database is now stored in v5. From the settext line we found earlier we can see that the text view is referred to as p0:
invoke-virtual {p0, v5}, Lcom/android/systemui/statusbar/policy/DateView;->setText(Ljava/lang/CharSequenceV
The first item in the brackets is the text view. This wont be p0 in all cases. Its only p0 here because we are working with a smali that has a view as its super so the smali is effectively the text view. If working with something like ToggleSlider for example we may have something like:
invoke-virtual {v2, v3}, Landroid/widget/TextView;->setText(Ljava/lang/CharSequenceV
So in this case the text view is in v2.
We can now use setTextColor on our date which is p0 with the color which we put in v5:
invoke-virtual {p0, v5}, Lcom/android/systemui/statusbar/policy/DateView;->setTextColor(I)V
The full code looks like this:
invoke-virtual {p0, v3}, Lcom/android/systemui/statusbar/policy/DateView;->setText(Ljava/lang/CharSequenceV
invoke-virtual {p0}, Lcom/android/systemui/statusbar/policy/DateView;->getContext()Landroid/content/Context;
move-result-object v5
invoke-virtual {v5}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;
move-result-object v5
const-string v6, "date_color"
const v7, -0xcc4a1a
invoke-static {v5, v6, v7}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I
move-result v5
invoke-virtual {p0, v5}, Lcom/android/systemui/statusbar/policy/DateView;->setTextColor(I)V
Oh and just so you know the big V at the end of lines like ;->setText(Ljava/lang/CharSequenceV and ;->setTextColor(I)V means the method returns void or nothing.
Hopefully the apk will now compile and you can test the result. In order for something to change immediately you need observers but I wont go into that here. This will only change when the updateClock method runs. A reboot will also trigger it to update the color.
I know I have written a lot to take in here. But hopefully this will give you a good basic understanding of how methods are called with parameters in smali.
Next stop…..choosing the color!
Thanks to ficeto this part is REALLY easy!
Decompile the attached apk. You will find a file called preferences.xml in the xml folder. Open it with Notepad++. Each instance of this line will add another picker…
<com.ficeto.colorpicker.ColorPickerPreference android:title="Dropdown Date Color" android:key="date_color" android:summary="Select Color" android:dialogTitle="Select Color" />
Change the android:title to what you want your picker to be called and change android:key=“date_color” to whatever the key you used earlier was. So if your smali was....
const-string v6, "clock_color"
Then the android:key would be “clock_color”.
That’s it. Compile and push the apk or install as a system app and it will show in your app drawer as custom settings. Now go test your new mod!!
Any questions or problems please ask (with logs and files if possible) as its impossible to cover all eventualities in a guide.
OK....time for part 2
COLORING IMAGES
This part will cover two things. Coloring images in a similar way to setting text colors from part 1 and also how to create a method and pass it context. Sometimes you wont be able to use mContext or getcontext but most smali files have context already in their init so you can use that and pass it to a new method. Using your own method is more efficient as you can run your code to get the color from the database just once and use it on multiple items and in multiple places.
There are three main ways to color an image. Using the method setColorFilter(I)V which is in android/widget/ImageView smali in framework2.jar, using method public final setColorFilter(ILandroid/graphics/PorterDuff$ModeV in the same file and using method public setColorFilter(ILandroid/graphics/PorterDuff$ModeV in android/graphics/drawable/Drawable smali in framework.jar. It depends what and where the image is as to which you use. All three methods overlay a color on an existing image and the two with porterduffmode have a means of choosing what effect the overlay has. There is more about this at the bottom of the post.
Lets start....
Things are stored in fields in a smali. At the top of the file you will see them like this:
Code:
.field protected mType:Ljava/lang/String;
.field protected mView:Landroid/view/View;
.field protected mIcon:I
These fields can be used to store things of their type. So in the ones shown above you would put a string, a view and an integer respectively. You can see the type a field should hold after the :
In order to use your own method to get the color from the database we need to add a new field to store the value in so we can use it in another method. For this example i am going to use the toggle icons in lidroids toggle mod but this can be done on pretty much any image you want.
At the top of the smali with the other instance fields add your new field. You can call it whatever you want and it is going to store an integer so you will need an I after the colon. Im calling this one mToggleColor for obvious reasons:
Code:
.field private mToggleColor:I
We now have somewhere to put our value so now we can write the new method. At this point you should refer to the text color guide for explanations about the content resolver, context and registers as I will assume you have an idea about these now.
You can call your method anything you want. It will need 3 registers to store the resolver, default value and integer. This method has no context parameter (in the brackets after the method name) so you would need to use getcontext or mContext....
Code:
.method color_toggles()V
.locals 3
If you are going to use existing context and pass it to your method it would look like this. As you can see the method is expecting context as its parameter when called...
Code:
.method color_toggles(Landroid/content/Context;)V
.locals 3
Now we get the content resolver so we need context. If using the first method then you would need to call your view and invoke getcontext like this in stock toggles:
Code:
iget-object v1, p0, Lcom/android/systemui/statusbar/policy/quicksetting/QuickSettingButton;->mBtnImage:Landroid/widget/ImageView;
invoke-virtual {v1}, Landroid/widget/ImageView;->getContext()Landroid/content/Context;
move-result-object v1
invoke-virtual {v1}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;
move-result-object v1
As metioned in the text color guide your contentresolver is now in v1.
If you are passing context to your method then the context is the parameter of the method. Each item in brackets after methods name is stored in a p. So in this case the context would be in p1. All you need to do is use it to get the resolver:
Code:
invoke-virtual {p1}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;
move-result-object v1
Again...resolver now in v1.
The next part is identical to the text color guide so i wont repeat it. But you should have now something that looks like this:
Code:
.method color_toggles()V
.locals 3
iget-object v1, p0, Lcom/android/systemui/statusbar/policy/quicksetting/QuickSettingButton;->mBtnImage:Landroid/widget/ImageView;
invoke-virtual {v1}, Landroid/widget/ImageView;->getContext()Landroid/content/Context;
move-result-object v1
const-string v2, "theme_color"
const v3, -0x4d06ff
invoke-static {v1, v2, v3}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I
move-result v1
or if passing context:
Code:
.method color_toggles(Landroid/content/Context;)V
.locals 3
invoke-virtual {p1}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;
move-result-object v1
const-string v2, "theme_color"
const v3, -0xcc4a1a
invoke-static {v1, v2, v3}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I
move-result v1
Both of the above now have your color stored in v1. We can now put it into your new field that you created earlier using iput:
Code:
iput v1, p0, Lcom/alliance/systemui/quickpanel/PowerButton;->mToggleColor:I
This puts the integer in v1 into the field in p0 (this file) and stores it as mToggleColor
Your method is not expected to return anything meaning something doesnt call it and ask for a value in reply so after this we need:
Code:
return-void
....and then to finish the method....
Code:
.end method
The final methods look like this:
Code:
.method color_toggles()V
.locals 3
iget-object v1, p0, Lcom/android/systemui/statusbar/policy/quicksetting/QuickSettingButton;->mBtnImage:Landroid/widget/ImageView;
invoke-virtual {v1}, Landroid/widget/ImageView;->getContext()Landroid/content/Context;
move-result-object v1
const-string v2, "theme_color"
const v3, -0x4d06ff
invoke-static {v1, v2, v3}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I
move-result v1
iput v1, p0, Lcom/android/systemui/statusbar/policy/quicksetting/QuickSettingButton;->mToggleColor:I
return-void
.end method
Code:
.method color_toggles(Landroid/content/Context;)V
.locals 3
invoke-virtual {p1}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;
move-result-object v1
const-string v2, "theme_color"
const v3, -0xcc4a1a
invoke-static {v1, v2, v3}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I
move-result v1
iput v1, p0, Lcom/alliance/systemui/quickpanel/PowerButton;->mColor:I
return-void
.end method
Now your color can be put into your new field we need to invoke your new method. Otherwise it will just be an empty field. You can do this in a number of places. Either directly before you use it or in the methods init. We will come back to this.
In order to color an image you need to find it first. There are ways of calling the image by its id but looking for it this way will familiarise you more with smali. Images can be set using setImageResource and setImageDrawable. If you search firstly for the images id in the smalis to find the correct file and if that doesnt find anything then have a look at file names and see what you can find that looks like it might be right. In this case PowerButton smali has a method called :
Code:
.method private updateImageView(II)V
...which uses setImageResource(I)V. Sounds like a good place to start!
Code:
.method private updateImageView(II)V
.locals 2
iget-object v1, p0, Lcom/alliance/systemui/quickpanel/PowerButton;->mView:Landroid/view/View;
invoke-virtual {v1, p1}, Landroid/view/View;->findViewById(I)Landroid/view/View;
move-result-object v0
check-cast v0, Landroid/widget/ImageView;
invoke-virtual {v0, p2}, Landroid/widget/ImageView;->setImageResource(I)V
return-void
.end method
We need to invoke your new method. If you are not passing context you can just do this:
Code:
invoke-virtual {p0}, Lcom/android/systemui/statusbar/policy/quicksetting/QuickSettingButton;->color_toggles()V
...which will invoke your new method and put your color in your field.
Or to pass context you would do:
Code:
invoke-virtual {v1}, Landroid/view/View;->getContext()Landroid/content/Context;
move-result-object v1
invoke-virtual {p0, v1}, Lcom/alliance/systemui/quickpanel/PowerButton;->color_toggles(Landroid/content/Context;)V
In the above code the method you are in has a Landroid/view/View; stored in v1. You can use getContext on this and then invoke your method. The invoke says to call your method color_toggles(Landroid/content/ContextV which is in this file (p0) with the parameter v1 (the context). Now your method has run we can use iget to get the color from the field:
Code:
iget v1, p0, Lcom/alliance/systemui/quickpanel/PowerButton;->mColor:I
You can see in the original updateImage method that the imageView is in v0. We can now apply the color (in v1) to the image (v0).
Code:
invoke-virtual {v0, v1}, Landroid/widget/ImageView;->setColorFilter(I)V
Final methods would look like this:
Code:
.method private updateImageView(II)V
.locals 2
invoke-virtual {p0}, Lcom/android/systemui/statusbar/policy/quicksetting/QuickSettingButton;->color_toggles()V
iget-object v1, p0, Lcom/alliance/systemui/quickpanel/PowerButton;->mView:Landroid/view/View;
invoke-virtual {v1, p1}, Landroid/view/View;->findViewById(I)Landroid/view/View;
move-result-object v0
check-cast v0, Landroid/widget/ImageView;
invoke-virtual {v0, p2}, Landroid/widget/ImageView;->setImageResource(I)V
iget v1, p0, Lcom/alliance/systemui/quickpanel/PowerButton;->mColor:I
invoke-virtual {v0, v1}, Landroid/widget/ImageView;->setColorFilter(I)V
return-void
.end method
or
Code:
.method private updateImageView(II)V
.locals 2
iget-object v1, p0, Lcom/alliance/systemui/quickpanel/PowerButton;->mView:Landroid/view/View;
invoke-virtual {v1, p1}, Landroid/view/View;->findViewById(I)Landroid/view/View;
move-result-object v0
check-cast v0, Landroid/widget/ImageView;
invoke-virtual {v0, p2}, Landroid/widget/ImageView;->setImageResource(I)V
invoke-virtual {v1}, Landroid/view/View;->getContext()Landroid/content/Context;
move-result-object v1
invoke-virtual {p0, v1}, Lcom/alliance/systemui/quickpanel/PowerButton;->color_toggles(Landroid/content/Context;)V
iget v1, p0, Lcom/alliance/systemui/quickpanel/PowerButton;->mColor:I
invoke-virtual {v0, v1}, Landroid/widget/ImageView;->setColorFilter(I)V
return-void
.end method
Your source image should be white. You can make them semi transparent so the color is not as bright. For example the off toggles could be 50% transparent so they will only appear dim compared to the on ones.
You will notice in PowerButton smali there is another method....
Code:
.method private updateImageView(ILandroid/graphics/drawable/Drawable;)V
.locals 2
iget-object v1, p0, Lcom/alliance/systemui/quickpanel/PowerButton;->mView:Landroid/view/View;
invoke-virtual {v1, p1}, Landroid/view/View;->findViewById(I)Landroid/view/View;
move-result-object v0
check-cast v0, Landroid/widget/ImageView;
invoke-virtual {v0, p2}, Landroid/widget/ImageView;->setImageDrawable(Landroid/graphics/drawable/Drawable;)V
return-void
.end method
This is the same except it uses 2 parameters (in the brackets after the name) of and (I)nteger and Landroid/graphics/drawable/Drawable rather than two (I)ntegers.
You don't HAVE to use your own method. You could just use identical code to the textColor code straight after the setImageResource and invoke setColorFilter on the ImageView rather than setTextColor on a TextView. But I think it is good practice to use a new method
PorterDuffMode
Sometimes when you implement a color picker you will get an outcome you dont want like a battery that had a a white centre and the fill in a color wouldnt show the level as it would all have the same color overlay. Instead of using setColorFilter(I)V you can use setColorFilter(ILandroid/graphics/PorterDuff$ModeV.
If you are familiar with Photoshop you may be better than me at this but basically it changes the way the color is laid over. Using different modes will give different results. As Im not great with Photoshop for me its more trial and error!
There are lots of different modes:
PorterDuff.Mode ADD Saturate(S + D)
PorterDuff.Mode CLEAR [0, 0]
PorterDuff.Mode DARKEN [Sa + Da - Sa*Da, Sc*(1 - Da) + Dc*(1 - Sa) + min(Sc, Dc)]
PorterDuff.Mode DST [Da, Dc]
PorterDuff.Mode DST_ATOP [Sa, Sa * Dc + Sc * (1 - Da)]
PorterDuff.Mode DST_IN [Sa * Da, Sa * Dc]
PorterDuff.Mode DST_OUT [Da * (1 - Sa), Dc * (1 - Sa)]
PorterDuff.Mode DST_OVER [Sa + (1 - Sa)*Da, Rc = Dc + (1 - Da)*Sc]
PorterDuff.Mode LIGHTEN [Sa + Da - Sa*Da, Sc*(1 - Da) + Dc*(1 - Sa) + max(Sc, Dc)]
PorterDuff.Mode MULTIPLY [Sa * Da, Sc * Dc]
PorterDuff.Mode OVERLAY
PorterDuff.Mode SCREEN [Sa + Da - Sa * Da, Sc + Dc - Sc * Dc]
PorterDuff.Mode SRC [Sa, Sc]
PorterDuff.Mode SRC_ATOP [Da, Sc * Da + (1 - Sa) * Dc]
PorterDuff.Mode SRC_IN [Sa * Da, Sc * Da]
PorterDuff.Mode SRC_OUT [Sa * (1 - Da), Sc * (1 - Da)]
PorterDuff.Mode SRC_OVER [Sa + (1 - Sa)*Da, Rc = Sc + (1 - Sa)*Dc]
PorterDuff.Mode XOR [Sa + Da - 2 * Sa * Da, Sc * (1 - Da) + (1 - Sa) * Dc]
The letters in CAPITALS are the what you put as the parameter.
I have found that MULTIPLY is the most useful. SRC_ATOP is used as default in setColorFilter(I)V
To use one you need to put the mode into a register. You do that using sget:
Code:
sget-object v1, Landroid/graphics/PorterDuff$Mode;->MULTIPLY:Landroid/graphics/PorterDuff$Mode;
Then you call the porterduff setcolorfilter method instead of the normal one. Like this:
invoke-virtual {v6, v12, v1}, Landroid/widget/ImageView;->setColorFilter(ILandroid/graphics/PorterDuff$ModeV
...instead of this:
invoke-virtual {v6, v12}, Landroid/widget/ImageView;->setColorFilter(I)V
There is a good article here
Please ask if anything is unclear.
Toggles
You have learnt how to get a value from the database creating a toggle is pretty straightforward. For this example I will use toggling the text on lidroid toggles but you can use this on anything from settings button in statusbar to things stopping auto scroll on toggles etc.
Again we start by finiding the method we need to mod. Look at the top of smali files for the field names. This may help you to find the item you wish to toggle. Method names will also help you find your place. In this example we can see in PowerButton smali there is a method called:
Code:
.method protected updateText()V
Obvious huh! It wont always be that easy to find so i will cover how to call something by it's ID later in this post.
In this method you can see that the text is set by calling the setText method. There are two ways to do this. The obvious thing to do is not to run this line so the text will not be set. This is the first way i will cover and it is the way that things are toggled such as ink effect or crt etc rather than showing/hiding things. I will get to that later.
TURNING THINGS ON/OFF
We need to read that value into our smali. This is done in exactly the same way as a color so if you are not sure please go back and read those posts.
This would be added the line before the setText call....
Code:
iget-object v3, p0, Lcom/alliance/systemui/quickpanel/PowerButton;->mView:Landroid/view/View;
invoke-virtual {v3}, Landroid/view/View;->getContext()Landroid/content/Context;
move-result-object v3
...dont forget to add to .locals if you are using a new register!! That gets us context so now we can...
Code:
const-string v4, "toggle_text"
const v5, 0x1
invoke-static {v3, v4, v5}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I
move-result v3
...which gets the value from the database which will be 1 or 0 for on/off and puts it into v3.
To toggle something we then act on that value. The if-nez checks if a value is non-zero. So the next line would be:
Code:
if-nez v3, :cond_skip_text
....as you can see, if v3 is non-zero then it goes to the condition skip_text.
All we need to do now is make a new cond called skip_text after the setText line so it effectively does just that.....skips the setText. Right before return-void put:
Code:
:cond_skip_text
That's it. All you have to do with a toggle to turn something on or off is skip the chunk of text that does what you want to stop. So as long as your new cond comes after it then it should work
SHOWING/HIDING
This works in exactly the same way as above but instead of skipping code you are going to use setVisibility(I)V method.
We have got the value from the database as we did before:
Code:
iget-object v3, p0, Lcom/alliance/systemui/quickpanel/PowerButton;->mView:Landroid/view/View;
invoke-virtual {v3}, Landroid/view/View;->getContext()Landroid/content/Context;
move-result-object v3
const-string v4, "toggle_text"
const v5, 0x1
invoke-static {v3, v4, v5}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I
move-result v3
if-nez v3, :cond_show_text
To hide something we must set visibility of the item to "gone". The value for this is 0x8. Visible is 0x1. If the database value returns 0 then the item is unchecked and so should be hidden. If it returns 1 then the item should be visible.
If the value from the database was 1 and the checkbox was ticked then you can use the value in v3 as the value for setVisibility. If it was 0 then the value needs to be set to 0x8 for "gone". We can put 0x8 into v4 here because the line will be skipped if the checkbox was checked:
Code:
const v3, 0x8
....now we add the new cond:
Code:
:cond_show_text
and invoke the set visibility which now has either 0x1 or 0x8 in it.
Code:
invoke-virtual {v1, v3}, Landroid/widget/TextView;->setVisibility(I)V
This tells the code to find the place labelled :goto_new so we add that straight after the code that sets visibility to shown. The full code would look like this....
Code:
iget-object v3, p0, Lcom/alliance/systemui/quickpanel/PowerButton;->mView:Landroid/view/View;
invoke-virtual {v3}, Landroid/view/View;->getContext()Landroid/content/Context;
move-result-object v3
const-string v4, "toggle_text"
const v5, 0x1
invoke-static {v3, v4, v5}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I
move-result v3
if-nez v3, :cond_show_text
const v4, 0x8
:cond_show_text
invoke-virtual {v1, v4}, Landroid/widget/TextView;->setVisibility(I)V
Thats it!
CALLING THINGS BY ID
Say you wanted to make a show/hide for the recents button that can be added to dropdown header. You can call it by it's public ID and then use setvisibility. Create a new method like you did for coloring images (refer to that guide if unsure), get a value from the database, test for non-zero and skip to cond. You can use mCcontext here from in Phonestatusbar:
Code:
.method Update_recents()V
.locals 6
iget-object v1, p0, Lcom/android/systemui/SystemUI;->mContext:Landroid/content/Context;
invoke-virtual {v1}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;
move-result-object v1
const-string v2, "recents_button"
const/4 v3, 0x1
invoke-static {v1, v2, v3}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I
move-result v3
if-nez v3, :cond_1
const v3, 0x8
Now to get the image we can use findViewById method. In order to use it we need the parent view that contains the image. In Phonestatusbar you can get to most stuff by using the field mStatusBarWindow.
Code:
iget-object v4, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mStatusBarWindow:Lcom/android/systemui/statusbar/phone/StatusBarWindowView;
Now we get the id of the image from public.xml and put it into a register:
Code:
const v5, 0x7f0d0014
....and then findViewById. This method expects an integer as a parameter which we have in v5...
Code:
invoke-virtual {v4, v5}, Lcom/android/systemui/statusbar/phone/StatusBarWindowView;->findViewById(I)Landroid/view/View;
move-result-object v4
Now we have the item we can setVisibility with the value in v3:
Code:
:cond_1
invoke-virtual {v4, v3}, Landroid/widget/LinearLayout;->setVisibility(I)V
In this case I used LinearLayout but you can use imageView or whatever depending what you are doing. The full method would look like this:
Code:
.method Update_recents()V
.locals 6
iget-object v1, p0, Lcom/android/systemui/SystemUI;->mContext:Landroid/content/Context;
invoke-virtual {v1}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;
move-result-object v1
const-string v2, "recents_button"
const/4 v3, 0x1
invoke-static {v1, v2, v3}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I
move-result v3
if-nez v3, :cond_1
const/4 v3, 0x8
:cond_1
iget-object v5, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mStatusBarWindow:Lcom/android/systemui/statusbar/phone/StatusBarWindowView;
const v6, 0x7f0d0014
invoke-virtual {v5, v6}, Lcom/android/systemui/statusbar/phone/StatusBarWindowView;->findViewById(I)Landroid/view/View;
move-result-object v4
invoke-virtual {v4, v3}, Landroid/widget/LinearLayout;->setVisibility(I)V
return-void
.end method
All we need to do now is to call the method. The best place for this is during makestatusbarview. I put it right after the settings button is set but you can put it in loads of places. It just invokes update_recents_button in p0 (this file):
Code:
iget-object v9, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mSettingsButton:Landroid/widget/ImageView;
iget-object v10, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mSettingsButtonListener:Landroid/view/View$OnClickListener;
invoke-virtual {v9, v10}, Landroid/widget/ImageView;->setOnClickListener(Landroid/view/View$OnClickListener;)V
[COLOR="Red"] invoke-virtual {p0}, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->update_recents_button()V[/COLOR]
Thats all for now
USEFUL POSTS:
NOTEPAD++ SMALI HIGHLIGHTING - Thanks to @majdinj
LIST OF DALVIK OPCODES - Thanks to @majdinj
good work Goldie, 5st
Goldie said:
USEFUL POSTS:
NOTEPAD++ SMALI HIGHLIGHTING - Thanks to @majdinj
LIST OF DALVIK OPCODES - Thanks to @majdinj
Click to expand...
Click to collapse
this is great! im good with xml, scripting, binary etc etc, Im starting to learm smali and honestly this guide is perfect to the T! thanks!
Thank you very much, sir!
Keep that great work up.
Hi guys,
Today I'm going to share a method with which you can add apps shortcuts to your SystemUI, well it's called Onclick method and it's not mine it's sir @SpaceCaker's and as I got he's permission to make a separate guide on it I'm posting this, I said separate because this guide is already there on he's 4.2.2 status bar guide but I thought a separate guide would be more helpful for some people so I'm posting this with permission so let's begin
Requirements:
Brain
Patience
Experience
Apktool or anything like it
How to:
1. Decompile your SystemUI.apk
2. Go to smali/com/android/systemui/SystemUIService.smali
3. Now add this:
Code:
.method public settings(Landroid/view/
View;)V
.locals 5
.parameter "view"
.prologue
.line 99
.line 100
:try_start_0
new-instance v1, Landroid/content/Intent;
invoke-direct {v1}, Landroid/content/Intent;-
><init>()V
.line 102
.local v1, intent:Landroid/content/Intent;
const-string v2, "android.intent.action.MAIN"
invoke-virtual {v1, v2}, Landroid/content/
Intent;->setAction(Ljava/lang/String;)Landroid/
content/Intent;
.line 105
const/high16 v2, 0x1000
invoke-virtual {v1, v2}, Landroid/content/
Intent;->setFlags(I)Landroid/content/Intent;
.line 107
const-string v2, "com.android.settings"
const-string v3,
"com.android.settings.Settings"
invoke-virtual {v1, v2, v3}, Landroid/content/
Intent;->setClassName(Ljava/lang/String;Ljava/
lang/String;)Landroid/content/Intent;
invoke-virtual {p0, v1}, Lcom/android/systemui/
SystemUIService;->startActivity(Landroid/
content/Intent;)V
:try_end_0
.catch Ljava/lang/Exception; {:try_start_
0 .. :try_end_0} :catch_0
.line 109
.line 112
.end local v1 #intent:Landroid/content/
Intent;
:goto_0
return-void
.line 115
:catch_0
move-exception v0
.line 117
.local v0, e:Ljava/lang/Exception;
invoke-virtual {v0}, Ljava/lang/Exception;-
>printStackTrace()V
goto :goto_0
.end method
4. Now you can edit 3 things in it and they are:
1. The Onclick title: "settings" above here or in easy words the one below between "****"
Code:
.method public "anything"(Landroid/view/View;)V
2. The package: const-string v2, "anything"
3. The activity: const-string v3, "anything"
4. So now you need to edit these 3 things to whatever you want, give your Onclick a title, change the package and than the activity, do note you have to edit both and you can add any shortcut with this but if you're adding user installed apps shortcuts than make sure you have the app installed
5. Now add this to res/layout/"wherever you want "
Code:
android:onClick="anything"
This is what adds the onclick method to something
6. Now recompile your SystemUI.apk, sign, push, reboot and enjoy a shortcut which will save some valuable time of yours
Credits:
@SpaceCaker
Use this app to get the activities:
https://play.google.com/store/apps/details?id=de.szalkowski.activitylauncher&hl=en
If your browser has problems with coping the code from the first post download this and copy:
https://www.androidfilehost.com/?fid=673368273298942983
Screenshot: