[MOD][GUIDE] Add abbreviated day of the week to status bar - Sprint Samsung Galaxy S III

I realize most over here on the Sprint GS3 are probably running some sort of JB varient by now but those of us stuck on verizon cant play yet . So I worked this mod out for the VW GS3 and figured I would share with anyone still running an ICS Sprint GS3. The code for making this work with a JB ROM is very similar from what I can tell. I think you can actually skip the smali edits entirely if you are running a JB ROM and just mod the layout files. Anyway here is the guide...
This will cover two scenarios.
1. Center Clock Applications
2. Stock Clock Applications
First one will be for Center Clock....
Decompile SystemUI and navigate to res/layout/tw_status_bar.xml
Find the following code
Code:
<com.android.systemui.statusbar.policy.Clock
Right above this line paste the following code
Code:
<com.android.systemui.statusbar.policy.DateView android:textAppearance="@style/TextAppearance.StatusBar.Date" android:gravity="right" android:id="@id/date" android:paddingRight="2.0dip" android:paddingTop="7.0dip" android:layout_width="wrap_content" android:layout_height="fill_parent" android:singleLine="true" android:includeFontPadding="false" android:layout_weight="1.0" />
If you are running a JB ROM i am pretty sure you dont need to do this next part. ICS guys will want to continue....
Navigate to smali/com/android/systemui/statusbar/policy/dateview.smali
Find the following code
Code:
.method private final updateClock()V
Starting with and including the very next line, delete everything all the way to and including the first "end Method you come to and paste the following code in its place
Code:
.locals 9
.prologue
const v8, [B][COLOR="Red"]0x7f080002
[/COLOR][/B]
const/4 v5, 0x2
const/4 v7, 0x1
const/4 v6, 0x0
.line 92
invoke-virtual {p0}, Lcom/android/systemui/statusbar/policy/DateView;->getContext()Landroid/content/Context;
move-result-object v0
.line 93
.local v0, context:Landroid/content/Context;
new-instance v3, Ljava/util/Date;
invoke-direct {v3}, Ljava/util/Date;-><init>()V
.line 94
.local v3, now:Ljava/util/Date;
const-string v4, "EEE"
invoke-static {v4, v3}, Landroid/text/format/DateFormat;->format(Ljava/lang/CharSequence;Ljava/util/Date;)Ljava/lang/CharSequence;
move-result-object v2
.line 95
.local v2, dow:Ljava/lang/CharSequence;
invoke-static {v0}, Landroid/text/format/DateFormat;->getLongDateFormat(Landroid/content/Context;)Ljava/text/DateFormat;
move-result-object v4
invoke-virtual {v4, v3}, Ljava/text/DateFormat;->format(Ljava/util/Date;)Ljava/lang/String;
move-result-object v1
.line 98
.local v1, date:Ljava/lang/CharSequence;
sget-boolean v4, Lcom/android/systemui/statusbar/StatusBar;->useTouchWizGUI:Z
if-eqz v4, :cond_1
.line 99
sget-boolean v4, Lcom/android/systemui/statusbar/StatusBar;->canStatusBarHide:Z
if-eqz v4, :cond_0
.line 100
new-array v4, v5, [Ljava/lang/Object;
aput-object v1, v4, v6
aput-object v2, v4, v7
invoke-virtual {v0, v8, v4}, Landroid/content/Context;->getString(I[Ljava/lang/Object;)Ljava/lang/String;
move-result-object v4
invoke-virtual {p0, v4}, Lcom/android/systemui/statusbar/policy/DateView;->setText(Ljava/lang/CharSequence;)V
.line 108
:goto_0
return-void
.line 102
:cond_0
const v4, [B][COLOR="red"]0x7f080003
[/COLOR][/B]
new-array v5, v5, [Ljava/lang/Object;
aput-object v2, v5, v6
aput-object v1, v5, v7
invoke-virtual {v0, v4, v5}, Landroid/content/Context;->getString(I[Ljava/lang/Object;)Ljava/lang/String;
move-result-object v4
invoke-virtual {p0, v4}, Lcom/android/systemui/statusbar/policy/DateView;->setText(Ljava/lang/CharSequence;)V
goto :goto_0
.line 105
:cond_1
new-array v4, v5, [Ljava/lang/Object;
aput-object v2, v4, v6
aput-object v1, v4, v7
invoke-virtual {v0, v8, v4}, Landroid/content/Context;->getString(I[Ljava/lang/Object;)Ljava/lang/String;
move-result-object v4
invoke-virtual {p0, v4}, Lcom/android/systemui/statusbar/policy/DateView;->setText(Ljava/lang/CharSequence;)V
goto :goto_0
.end method
Pay attention to the code above in RED. Those ID's must match up to the date ID's in your res/values/public.xml. If they dont you will need to change them.
Since this will also change the layout of the date in your dropdown menu, you may want to delete the date reference from there. If you do, this is how you delete it
Navigate to res/layout/tw_status_bar_expanded
Find the code that begins with the following and delete the entire line
Code:
<com.android.systemui.statusbar.policy.DateView
Thats it, recompile, chmod 644, and push to /system/app.
The next steps are for a stock clock setup. I have mine setup as a center clock so I will give you the basics for the stock clock. You may have to add some padding to tweak your location in the status bar. I will assume if you know how to de/recompile, you know how to pad your code.
In SystemUI Navigate to res/layout/tw_status_bar
Find the following code
Code:
<com.android.systemui.statusbar.policy.Clock
Add the following code on top of it
Code:
<com.android.systemui.statusbar.policy.DateView android:textAppearance="@style/TextAppearance.StatusBar.Date" android:gravity="left|center" android:id="@id/date" android:paddingLeft="4.0dip" android:layout_width="wrap_content" android:layout_height="fill_parent" android:singleLine="true" android:layout_toLeftOf="@id/clock" />
If you are running a JB ROM i am pretty sure you dont need to do this next part. ICS guys will want to continue....
Navigate to smali/com/android/systemui/statusbar/policy/dateview.smali
Find the following code
Code:
.method private final updateClock()V
Starting with and including the very next line, delete everything all the way to and including the first "end Method you come to and paste the following code in its place
Code:
.locals 9
.prologue
const v8, [B][COLOR="Red"]0x7f080002
[/COLOR][/B]
const/4 v5, 0x2
const/4 v7, 0x1
const/4 v6, 0x0
.line 92
invoke-virtual {p0}, Lcom/android/systemui/statusbar/policy/DateView;->getContext()Landroid/content/Context;
move-result-object v0
.line 93
.local v0, context:Landroid/content/Context;
new-instance v3, Ljava/util/Date;
invoke-direct {v3}, Ljava/util/Date;-><init>()V
.line 94
.local v3, now:Ljava/util/Date;
const-string v4, "EEE"
invoke-static {v4, v3}, Landroid/text/format/DateFormat;->format(Ljava/lang/CharSequence;Ljava/util/Date;)Ljava/lang/CharSequence;
move-result-object v2
.line 95
.local v2, dow:Ljava/lang/CharSequence;
invoke-static {v0}, Landroid/text/format/DateFormat;->getLongDateFormat(Landroid/content/Context;)Ljava/text/DateFormat;
move-result-object v4
invoke-virtual {v4, v3}, Ljava/text/DateFormat;->format(Ljava/util/Date;)Ljava/lang/String;
move-result-object v1
.line 98
.local v1, date:Ljava/lang/CharSequence;
sget-boolean v4, Lcom/android/systemui/statusbar/StatusBar;->useTouchWizGUI:Z
if-eqz v4, :cond_1
.line 99
sget-boolean v4, Lcom/android/systemui/statusbar/StatusBar;->canStatusBarHide:Z
if-eqz v4, :cond_0
.line 100
new-array v4, v5, [Ljava/lang/Object;
aput-object v1, v4, v6
aput-object v2, v4, v7
invoke-virtual {v0, v8, v4}, Landroid/content/Context;->getString(I[Ljava/lang/Object;)Ljava/lang/String;
move-result-object v4
invoke-virtual {p0, v4}, Lcom/android/systemui/statusbar/policy/DateView;->setText(Ljava/lang/CharSequence;)V
.line 108
:goto_0
return-void
.line 102
:cond_0
const v4, [B][COLOR="red"]0x7f080003
[/COLOR][/B]
new-array v5, v5, [Ljava/lang/Object;
aput-object v2, v5, v6
aput-object v1, v5, v7
invoke-virtual {v0, v4, v5}, Landroid/content/Context;->getString(I[Ljava/lang/Object;)Ljava/lang/String;
move-result-object v4
invoke-virtual {p0, v4}, Lcom/android/systemui/statusbar/policy/DateView;->setText(Ljava/lang/CharSequence;)V
goto :goto_0
.line 105
:cond_1
new-array v4, v5, [Ljava/lang/Object;
aput-object v2, v4, v6
aput-object v1, v4, v7
invoke-virtual {v0, v8, v4}, Landroid/content/Context;->getString(I[Ljava/lang/Object;)Ljava/lang/String;
move-result-object v4
invoke-virtual {p0, v4}, Lcom/android/systemui/statusbar/policy/DateView;->setText(Ljava/lang/CharSequence;)V
goto :goto_0
.end method
Pay attention to the code above in RED. Those ID's must match up to the date ID's in your res/values/public.xml. If they dont you will need to change them.
Since this will also change the layout of the date in your dropdown menu, you may want to delete the date reference from there. If you do, this is how you delete it
Navigate to res/layout/tw_status_bar_expanded
Find the code that begins with the following and delete the entire line
Code:
<com.android.systemui.statusbar.policy.DateView
For the JB guys you will want to make one more edit....
Navigate to res/values/strings and modify the following code to look like below
Code:
<string name="status_bar_date_formatter">%2$s</string>
<string name="tw_status_bar_date_formatter">%2$s</string>
Thats it, recompile, chmod 644, and push to /system/app.
Hit the thanks button if this has been helpful to you!

By request I have added a screenshot in the OP.

Very nice!
How to change the color?

thanx for sharing tut...
what does that 2 id refers to ??? found that one refers to "status_bar_date_formatter" but i don know about the other one.... im using stock ICS rom....

Mate,
Fantastic guide! I followed it to the letter and it worked but...
I now have the date (12 May. 2013) in the status bar instead of Sun. I'm guessing it's to do with the %2$s?? I don't understand how they work though.
Any advise please??? I'm using stock JB 4.1.2 XWLSD on Samsung Galaxy S II GT-I9100.
Any advise would be hugely appreciated.
Thanks again for the great tutorials. XDA needs more Devs like you who are willing to teach noobs like me how to do awesome things to their phones.
Thanks mate,
Dave

Hi man!!!
I've also followed your guide to the letter and it has worked but... see yourself
I've upload a picture of what happens.
I'm on stock 4.1.2 Jelly Bean.
Any advise would be hugely appreciated.
Thanks for the tutorial and your support.

rockernaxo said:
Hi man!!!
I've also followed your guide to the letter and it has worked but... see yourself
I've upload a picture of what happens.
I'm on stock 4.1.2 Jelly Bean.
Any advise would be hugely appreciated.
Thanks for the tutorial and your support.
Click to expand...
Click to collapse
I think you messed with padding... correct padding by comparing with stock one ... edit xml again...
Sent from my IRIS_501 using xda premium

akash akya said:
I think you messed with padding... correct padding by comparing with stock one ... edit xml again...
Sent from my IRIS_501 using xda premium
Click to expand...
Click to collapse
Ok, thanks for the info. I don't know very well how to do it, but I'll investigate.
I have also an issue with the date too, it doesn't appear the day of the week, maybe coz the smali modification, but I can't find what those ids are.
Enviado desde mi zapatófono tuneado

akash akya said:
thanx for sharing tut...
what does that 2 id refers to ??? found that one refers to "status_bar_date_formatter" but i don know about the other one.... im using stock ICS rom....
Click to expand...
Click to collapse
daveyannihilation said:
Mate,
Fantastic guide! I followed it to the letter and it worked but...
I now have the date (12 May. 2013) in the status bar instead of Sun. I'm guessing it's to do with the %2$s?? I don't understand how they work though.
Any advise please??? I'm using stock JB 4.1.2 XWLSD on Samsung Galaxy S II GT-I9100.
Any advise would be hugely appreciated.
Thanks again for the great tutorials. XDA needs more Devs like you who are willing to teach noobs like me how to do awesome things to their phones.
Thanks mate,
Dave
Click to expand...
Click to collapse
rockernaxo said:
Hi man!!!
I've also followed your guide to the letter and it has worked but... see yourself
I've upload a picture of what happens.
I'm on stock 4.1.2 Jelly Bean.
Any advise would be hugely appreciated.
Thanks for the tutorial and your support.
Click to expand...
Click to collapse
akash akya said:
I think you messed with padding... correct padding by comparing with stock one ... edit xml again...
Sent from my IRIS_501 using xda premium
Click to expand...
Click to collapse
rockernaxo said:
Ok, thanks for the info. I don't know very well how to do it, but I'll investigate.
I have also an issue with the date too, it doesn't appear the day of the week, maybe coz the smali modification, but I can't find what those ids are.
Enviado desde mi zapatófono tuneado
Click to expand...
Click to collapse
Guys,
I suggest you follow this updated tutorial
http://forum.xda-developers.com/showthread.php?t=2109973
It will provide what you are looking for with more options.

Solved!
I did this! I got it to work!! I followed the guide to the letter but I didn't completely replace the smali file with what is written here.
All I had to do a bit differently was I added 2 new strings to /res/values/strings.xml which were:
Code:
<string name="status_bar_day_formatter">%1$s</string>
<string name="tw_status_bar_day_formatter">%1$s</string>
Then I had to recompile SystemUI.apk and then decompile it again and found the ids for the 2 new lines I created in /res/values/public.xml
In DateView.smali all I changed was 'EEEE' to 'EEE' and then changed the first id to the same as status_bar_day_formatter and the second id to the same as tw_status_bar_day_formatter and that was it!
EDIT: I now have a little problem... the date in the top left of the expanded status bar which used to say Wednesday 5 June. 2013 now just says Wed. Oops. If I delete the line beginning with <com.android.systemui.statusbar.policy.DateView will I get that original date layout back, or will it just not be there anymore?
EDIT 2: I deleted that line in tw_status_bar_expanded_header but it still shows up as Wed in the expanded status bar. I looked in tw_status_bar_expanded but there is no reference to the date anywhere in that xml file.
Please advise any suggestions on how to get back the original Wednesday 5 June. 2013 in the expanded status bar, but keep the Wed in the status bar?
Thanks in advance.
P.S. I followed your multi mod guide but it didn't work for me. All I really wanted is this day in the status bar.

Any help to port it to Xperia devices??
I get stuck at
.local v1, date:Ljava/lang/CharSequence;
sget-boolean v4, Lcom/android/systemui/statusbar/StatusBar;->useTouchWizGUI:Z
if-eqz v4, :cond_1
.line 99
sget-boolean v4, Lcom/android/systemui/statusbar/StatusBar;->canStatusBarHide:Z
Click to expand...
Click to collapse
Thanks!

will this work on htc one sense framework?

Related

[Guide] Add toggle settings to hide clock/AM/PM

{
"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"
}
****** For ICS 4.0.4, the code has changed a bit. Instead of changing the original tutorial, I'm providing a known working patch I did for an i9100 XWLPT build ******
(there's also a 2nd patch below to ignore regular swipe actions while using AOSP lockscreen)
https://github.com/shoman94/SHOstock2-XWLPT/commit/523075aac1730883a14e365e29c58eb8cce03248
https://github.com/shoman94/SHOstock2-XWLPT/commit/a55fb9b42a5f3f0c0c840c72e68372ab6a199cc2
This tutorial will be a bit involved, you've been warned! It was more of a learning experience, so here are the things you will see:
1. Add toggle settings via xml
2. Add global settings that are retained
3. Add code support for your toggles
4. Have your toggles be smart, and enable/disable other related toggles
5. Add a debug message using Slog, this is invaluable for any project!
Based on 4.0.3 LP3 base..Adjust resource IDs (bolded) for your base!!
--------------------------------------------------------------------------
Step 1. Adding the toggles to Settings/Date & Time (the easy part)
Decompile Settings.apk, modify the following:
public.xml, add:
Code:
<public type="string" name="disable_ampm" id="[b]0x7f0b0923[/b]" />
<public type="string" name="disable_ampm_text" id="[b]0x7f0b0924[/b]" />
<public type="string" name="disable_time" id="[b]0x7f0b0925[/b]" />
<public type="string" name="disable_time_text" id="[b]0x7f0b0926[/b]" />
strings.xml, add:
Code:
<string name="disable_time">Hide Time</string>
<string name="disable_time_text">Remove time from status bar</string>
<string name="disable_ampm">Hide AM/PM</string>
<string name="disable_ampm_text">Remove AM/PM from time in status bar</string>
xml/date_time_prefs.xml, add:
Code:
<CheckBoxPreference android:title="@string/disable_time" android:key="hide_time" android:summary="@string/disable_time_text" />
<CheckBoxPreference android:title="@string/disable_ampm" android:key="hide_ampm" android:summary="@string/disable_ampm_text" />
Compile settings.apk, u/l and reboot. Make sure the toggles are added!
Step 2. Adding code for the settings (the not so easy part). This code gets a bit involved since we have to handle the new settings, and also add 'toggle logic' for different combinations to enable/disable them.
Still in settings.apk, DateTimeSettings.smali:
At top, add:
Code:
.field private mHideTime:Landroid/preference/Preference;
.field private mHideAmPm:Landroid/preference/Preference;
Then in the '.method private initUI()V', find 'return-void' and add this code above it:
Code:
const-string v6, "hide_time"
invoke-virtual {p0, v6}, Lcom/android/settings/DateTimeSettings;->findPreference(Ljava/lang/CharSequence;)Landroid/preference/Preference;
move-result-object v6
check-cast v6, Landroid/preference/Preference;
iput-object v6, p0, Lcom/android/settings/DateTimeSettings;->mHideTime:Landroid/preference/Preference;
const-string v6, "hide_ampm"
invoke-virtual {p0, v6}, Lcom/android/settings/DateTimeSettings;->findPreference(Ljava/lang/CharSequence;)Landroid/preference/Preference;
move-result-object v6
check-cast v6, Landroid/preference/Preference;
iput-object v6, p0, Lcom/android/settings/DateTimeSettings;->mHideAmPm:Landroid/preference/Preference;
iget-object v0, p0, Lcom/android/settings/DateTimeSettings;->mHideTime:Landroid/preference/Preference;
check-cast v0, Landroid/preference/CheckBoxPreference;
invoke-virtual {v0}, Landroid/preference/CheckBoxPreference;->isChecked()Z
move-result v0
if-eqz v0, :no_disablebtns
const/4 v0, 0x0
iget-object v6, p0, Lcom/android/settings/DateTimeSettings;->mHideAmPm:Landroid/preference/Preference;
invoke-virtual {v6, v0}, Landroid/preference/Preference;->setEnabled(Z)V
iget-object v6, p0, Lcom/android/settings/DateTimeSettings;->mTime24Pref:Landroid/preference/Preference;
invoke-virtual {v6, v0}, Landroid/preference/Preference;->setEnabled(Z)V
:no_disablebtns
iget-object v0, p0, Lcom/android/settings/DateTimeSettings;->mTime24Pref:Landroid/preference/Preference;
check-cast v0, Landroid/preference/CheckBoxPreference;
invoke-virtual {v0}, Landroid/preference/CheckBoxPreference;->isChecked()Z
move-result v0
if-eqz v0, :no_disableampm
const/4 v0, 0x0
iget-object v6, p0, Lcom/android/settings/DateTimeSettings;->mHideAmPm:Landroid/preference/Preference;
invoke-virtual {v6, v0}, Landroid/preference/Preference;->setEnabled(Z)V
:no_disableampm
Now search for '.method public onPreferenceTreeClick' and on the line below, change .locals 2 to:
Code:
.locals 6
Now search for:
:cond_2
iget-object v0, p0, Lcom/android/settings/DateTimeSettings;->mTime24Pref:Landroid/preference/Preference;
if-ne p2, v0, :cond_0
change the last line to:
Code:
if-ne p2, v0, :cond_new
About 10 lines below that, you will see 'invoke-direct {p0, v0}, Lcom/android/settings/DateTimeSettings;->set24Hour(Z)V', add this below that line:
Code:
iget-object v1, p0, Lcom/android/settings/DateTimeSettings;->mHideAmPm:Landroid/preference/Preference;
if-nez v0, :cond_hideampm
const/4 v0, 0x1
goto :set_ampm
:cond_hideampm
const/4 v0, 0x0
:set_ampm
invoke-virtual {v1, v0}, Landroid/preference/Preference;->setEnabled(Z)V
:cond_updatetime
Then search for 'goto :goto_0' about 10 lines below and add this before '.end method':
Code:
:cond_new
const-string v3, "hide_ampm"
iget-object v0, p0, Lcom/android/settings/DateTimeSettings;->mHideAmPm:Landroid/preference/Preference;
if-ne p2, v0, :cond_new2
iget-object v0, p0, Lcom/android/settings/DateTimeSettings;->mHideAmPm:Landroid/preference/Preference;
check-cast v0, Landroid/preference/CheckBoxPreference;
invoke-virtual {v0}, Landroid/preference/CheckBoxPreference;->isChecked()Z
move-result v2
:save_ampm
invoke-virtual {p0}, Lcom/android/settings/DateTimeSettings;->getContentResolver()Landroid/content/ContentResolver;
move-result-object v3
const-string v4, "hide_ampm"
invoke-static {v3, v4, v2}, Landroid/provider/Settings$System;->putInt(Landroid/content/ContentResolver;Ljava/lang/String;I)Z
goto :cond_updatetime
:cond_new2
const-string v3, "hide_time"
iget-object v0, p0, Lcom/android/settings/DateTimeSettings;->mHideTime:Landroid/preference/Preference;
if-ne p2, v0, :goto_0
iget-object v0, p0, Lcom/android/settings/DateTimeSettings;->mHideTime:Landroid/preference/Preference;
check-cast v0, Landroid/preference/CheckBoxPreference;
invoke-virtual {v0}, Landroid/preference/CheckBoxPreference;->isChecked()Z
move-result v2
:save_time
invoke-virtual {p0}, Lcom/android/settings/DateTimeSettings;->getContentResolver()Landroid/content/ContentResolver;
move-result-object v3
const-string v4, "hide_time"
invoke-static {v3, v4, v2}, Landroid/provider/Settings$System;->putInt(Landroid/content/ContentResolver;Ljava/lang/String;I)Z
if-nez v2, :cond_hidebtns
const/4 v2, 0x1
goto :cond_setbtns
:cond_hidebtns
const/4 v2, 0x0
:cond_setbtns
iget-object v1, p0, Lcom/android/settings/DateTimeSettings;->mHideAmPm:Landroid/preference/Preference;
invoke-virtual {v1, v2}, Landroid/preference/Preference;->setEnabled(Z)V
iget-object v1, p0, Lcom/android/settings/DateTimeSettings;->mTime24Pref:Landroid/preference/Preference;
invoke-virtual {v1, v2}, Landroid/preference/Preference;->setEnabled(Z)V
goto :cond_updatetime
And that's it for Settings! Recompile and upload and check everything looks right in Settings/Date and Time and the toggles work.
Step 3. Modifying the clock code to handle new changes (kinda easy =)
Decompile SystemUI and open Clock.smali.
Search for the following in func getSmallTime:
.local v3, context:Landroid/content/Context;
invoke-static {v3}, Landroid/text/format/DateFormat;->is24HourFormat(Landroid/content/ContextZ
Then add this code BEFORE the invoke-static .. line above (NOTE: there's a constant below that refers to the clock resource in public.xml [<public type="id" name="clock" id="0x7f0e0027" />], be sure it matches!):
Code:
invoke-virtual {v3}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;
move-result-object v2
const-string v7, "hide_time"
const/4 v0, 0x0
invoke-static {v2, v7, v0}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I
move-result v7
const/4 v0, 0x0
if-eqz v7, :cond_nohide
const/16 v0, 0x8
:cond_nohide
const v1, [b]0x7f0e0027[/b]
invoke-virtual {p0, v1}, Lcom/android/systemui/statusbar/phone/PhoneStatusBarView;->findViewById(I)Landroid/view/View;
move-result-object v1
invoke-virtual {v1, v0}, Landroid/view/View;->setVisibility(I)V
About 20 lines below that, you will see:
.local v1, MAGIC2:C
invoke-virtual {v3, v5}, Landroid/content/Context;->getString(I)Ljava/lang/String;
move-result-object v4
Add this directly after:
Code:
if-nez v2, :cond_continue
invoke-virtual {v3}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;
move-result-object v2
const-string v3, "hide_ampm"
const/4 v0, 0x0
invoke-static {v2, v3, v0}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I
move-result v7
########### Start of debug msg, can be removed #######
const-string v0, "ampm"
new-instance v1, Ljava/lang/StringBuilder;
invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V
const-string v2, "getint returned="
invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v1
invoke-virtual {v1, v7}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;
move-result-object v1
invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object v1
invoke-static {v0, v1}, Landroid/util/Slog;->i(Ljava/lang/String;Ljava/lang/String;)I
########### End of debug msg ###########
move v2, v7
if-eqz v2, :cond_continue
const-string v4, "h:mm"
:cond_continue
That's it for Clock.smali.
Step 4. Almost there, now we just have to make one more change to SystemUI in PhoneStatusBar.smali.
Find '.method public showClock' and change .locals 2 to:
Code:
.locals 3
Find:
if-eqz p1, :cond_1
const/4 v0, 0x0
and insert this code after it:
Code:
iget-object v2, p0, Lcom/android/systemui/SystemUI;->mContext:Landroid/content/Context;
invoke-virtual {v2}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;
move-result-object v2
const-string v3, "hide_time"
invoke-static {v2, v3, v0}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I
move-result v2
if-eqz v2, :goto_0
const/16 v0, 0x8
Recompile SystemUI and reboot. Now try out the new feature =)
Excellent.... built into my rom. Thanks !
...or just use 24h format which is shorter and more natural
sorg said:
...or just use 24h format which is shorter and more natural
Click to expand...
Click to collapse
Ummm You can use this to remove the clock completely....
I just updated to OP to include Step 4. I didn't realize the lock screen was interfering with the feature since I don't use one..Fixed now.
Building into mine as well, tonight if I don't fall asleep.
And a few moments of disagreeing with smali, got it going...thanks a bunch Jeboo!
nice, welldone!
but it s better to leave public.xml, add only the others xml and recompile once.
then decompile again to get the public xml
it s safer, and then match the smali changes with the new public values.
Anyway great guide
if your decompiling with smali/baksmali directly make sure to use the -l flag (thats a L) so you have local varibles instead of registers, learned this the hard way lol
This mod is amazing, thank you very much my friend works fabulously
Add a toggle for CRT Animation
Building upon the same theme from the OP, we can now add another toggle under display settings for CRT animation. This feature is controlled by the boolean animateScreenLights in framework-res.apk (thanks to whomever the original author was!).
Since adding the setting is pretty much identical to the procedure in the OP, I will just discuss the relevant code needed to access the new setting (I leave adding the setting up to you!). The only requirement is you name your setting 'crt_animation'.
Our patch point will be inside services.jar, specifically PowerManagerService$BrightnessState.smali (this is based on LP7):
Code:
iget-object v6, p0, Lcom/android/server/PowerManagerService$BrightnessState;->this$0:Lcom/android/server/PowerManagerService;
iget-boolean v6, v6, Lcom/android/server/PowerManagerService;->mAnimateScreenLights:Z
if-nez v6, :cond_19
NOTE: cond_19 may differ depending on your decompiler.
So we need to delete the 3 lines above. In its place, add our new code:
Code:
iget-object v0, p0, Lcom/android/server/PowerManagerService$BrightnessState;->this$0:Lcom/android/server/PowerManagerService;
invoke-static {v0}, Lcom/android/server/PowerManagerService;->access$4300(Lcom/android/server/PowerManagerService;)Landroid/content/Context;
move-result-object v0
invoke-virtual {v0}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;
move-result-object v0
const-string v1, "crt_animation"
const/4 v4, 0x0
invoke-static {v0, v1, v4}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I
move-result v6
if-eqz v6, :cond_19
NOTE: Again, if cond_19 is different, fix the last line above!
Recompile settings.apk & services.jar, u/l and reboot!
Porting this mod to the skyrocket
Hey jeboo, as i told you I am trying to port this over to my rom but need some guidance in clock.smali and PhoneStatusBar.smali Thanks I appreciate the help I am attaching the smali files...
adding toggle CRT animation settings
jeboo said:
Building upon the same theme from the OP, we can now add another toggle under display settings for CRT animation. This feature is controlled by the boolean animateScreenLights in framework-res.apk (thanks to whomever the original author was!).
Since adding the setting is pretty much identical to the procedure in the OP, I will just discuss the relevant code needed to access the new setting (I leave adding the setting up to you!). The only requirement is you name your setting 'crt_animation'.
Our patch point will be inside services.jar, specifically PowerManagerService$BrightnessState.smali (this is based on LP7):
Code:
iget-object v6, p0, Lcom/android/server/PowerManagerService$BrightnessState;->this$0:Lcom/android/server/PowerManagerService;
iget-boolean v6, v6, Lcom/android/server/PowerManagerService;->mAnimateScreenLights:Z
if-nez v6, :cond_19
NOTE: cond_19 may differ depending on your decompiler.
So we need to delete the 3 lines above. In its place, add our new code:
Code:
iget-object v0, p0, Lcom/android/server/PowerManagerService$BrightnessState;->this$0:Lcom/android/server/PowerManagerService;
invoke-static {v0}, Lcom/android/server/PowerManagerService;->access$4300(Lcom/android/server/PowerManagerService;)Landroid/content/Context;
move-result-object v0
invoke-virtual {v0}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;
move-result-object v0
const-string v1, "crt_animation"
const/4 v4, 0x0
invoke-static {v0, v1, v4}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I
move-result v6
if-eqz v6, :cond_19
NOTE: Again, if cond_19 is different, fix the last line above!
Recompile settings.apk & services.jar, u/l and reboot!
Click to expand...
Click to collapse
hi Mr Jeboo.. could u specify the settings in the strings.xml and public.xml in settings.apk? i assume u have got this mod to work.. I couldn't get what to add in this files.. thanks..
Apparently when I was redoing the whole thing to do AOSP/CRT toggle I placed the step 4 in the wrong spot.
How would we disable Weather in Lockscreen when AOSP is checked?
Clock.smali
Ok so I found out that the the statusbarservices is where I look instead of phonestatusbar.smali
however I'm having trouble with the Clock.smali inserts.
Could someone take a look, who knows, and make any suggestions or point me where i need to edit?
jeboo said:
...
Find:
if-eqz p1, :cond_1
const/4 v0, 0x0
and insert this code after it:
Code:
iget-object v2, p0, Lcom/android/systemui/SystemUI;->mContext:Landroid/content/Context;
invoke-virtual {v2}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;
move-result-object v2
const-string v3, "hide_time"
invoke-static {v2, v3, v0}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I
move-result v2
if-eqz v2, [B][COLOR="DarkOrange"]:goto_0[/COLOR][/B]
const/16 v0, 0x8
Recompile SystemUI and reboot. Now try out the new feature =)
Click to expand...
Click to collapse
On LPD, instead of :goto_0, use :goto_e
Robobob1221 said:
Ok so I found out that the the statusbarservices is where I look instead of phonestatusbar.smali
however I'm having trouble with the Clock.smali inserts.
Could someone take a look, who knows, and make any suggestions or point me where i need to edit?
Click to expand...
Click to collapse
I took a quick look at your clock.smali, GB sure made things complicated (24 registers vs 9 in ICS). When the registers change that much, unfortunately you're going to have to track them, it sucks.
One major problem I see is the return value from is24hourfmt in your ver uses v9, so you need to update the line 'if-nez v2, :cond_continue' to use v9 as well. Try that and let me know.
Thanks to the others for helping with the other changes lately..I must admit I use a much shorter patch for personal use, so I can fall behind with the latest code changes =)
jeboo
jeboo said:
I took a quick look at your clock.smali, GB sure made things complicated (24 registers vs 9 in ICS). When the registers change that much, unfortunately you're going to have to track them, it sucks.
One major problem I see is the return value from is24hourfmt in your ver uses v9, so you need to update the line 'if-nez v2, :cond_continue' to use v9 as well. Try that and let me know.
Thanks to the others for helping with the other changes lately..I must admit I use a much shorter patch for personal use, so I can fall behind with the latest code changes =)
jeboo
Click to expand...
Click to collapse
Thanks for checking out my file.
So you mean that the line should be 'if-nez v2, v9 :cond_continue' or just replace v2 with v9?
Thanks for the help
私はローボーボブ。 Haro!!
Robobob1221 said:
Thanks for checking out my file.
So you mean that the line should be 'if-nez v2, v9 :cond_continue' or just replace v2 with v9?
Thanks for the help
私はローボーボブ。 Haro!!
Click to expand...
Click to collapse
if-nez v9, :cond_continue
Basically if you're using military time, there's no need to worry about am/pm.
Still no compiling
jeboo said:
if-nez v9, :cond_continue
Basically if you're using military time, there's no need to worry about am/pm.
Click to expand...
Click to collapse
In plain English it seems so simple! Lol!
Thanks again. I'll check it out and see if it works. I hope it does Thanks again for the help.
Ok I tried the change you suggested and it still won't compile
I tried a few other changes but it results in the same error '
Could not smali file: [email protected]'. Sometimes the numbers ate end vary but its the same result.
another set is this
[email protected]
私はローボーボブ。 Haro!!
jeboo said:
if-nez v9, :cond_continue
Basically if you're using military time, there's no need to worry about am/pm.
Click to expand...
Click to collapse
Hello Jeboo!
Weird to say but.. with ur tutorial I ve been able to make a toggle to choose Samsung lockscreen or the AOSP one credits for u in my next Simplistic Disaster III Rom
whoa!

[FIX][HOWTO] Lockscreen loading Bug

This mod (JVU/JW4/JW5/JW6) fixes bug when battery is below 20 % in lockscreen displayed "charging %" instead of "Please connect charger".
HOWTO
1. Decompile android.policy.jar
For beginers here is a guide by pantrif13 : http://forum.xda-developers.com/show...1&postcount=16
2. Edit android.policy\smali\com\android\internal\policy\impl\ClockWidget.smali
Search
.method public setBatteryInfo()V
Change line:
Code:
invoke-virtual {v3}, Lcom/android/internal/policy/impl/KeyguardUpdateMonitor;->shouldShowBatteryInfo()Z
by
Code:
invoke-virtual {v3}, Lcom/android/internal/policy/impl/KeyguardUpdateMonitor;->shouldShowBatteryInfo1()Z
3. Edit android.policy\smali\com\android\internal\policy\impl\KeyguardUpdateMonitor.smali
Search
Code:
.line 360
new-instance v1, Lcom/android/internal/policy/impl/KeyguardUpdateMonitor$3;
invoke-direct {v1, p0}, Lcom/android/internal/policy/impl/KeyguardUpdateMonitor$3;-><init>(Lcom/android/internal/policy/impl/KeyguardUpdateMonitor;)V
invoke-virtual {p1, v1, v0}, Landroid/content/Context;->registerReceiver(Landroid/content/BroadcastReceiver;Landroid/content/IntentFilter;)Landroid/content/Intent;
Add bellow
Code:
new-instance v1, Lcom/android/internal/policy/impl/KeyguardUpdateMonitor$4;
invoke-direct {v1, p0}, Lcom/android/internal/policy/impl/KeyguardUpdateMonitor$4;-><init>(Lcom/android/internal/policy/impl/KeyguardUpdateMonitor;)V
invoke-virtual {p1, v1, v0}, Landroid/content/Context;->registerReceiver(Landroid/content/BroadcastReceiver;Landroid/content/IntentFilter;)Landroid/content/Intent;
And add to end of file
Code:
.method public shouldShowBatteryInfo1()Z
.locals 1
.prologue
.line 962
iget v0, p0, Lcom/android/internal/policy/impl/KeyguardUpdateMonitor;->mBatteryStatus:I
invoke-direct {p0, v0}, Lcom/android/internal/policy/impl/KeyguardUpdateMonitor;->isPluggedIn(I)Z
move-result v0
if-nez v0, :cond_0
iget v0, p0, Lcom/android/internal/policy/impl/KeyguardUpdateMonitor;->mBatteryLevel:I
invoke-direct {p0, v0}, Lcom/android/internal/policy/impl/KeyguardUpdateMonitor;->isBatteryLow(I)Z
move-result v0
if-eqz v0, :cond_1
:cond_0
const/4 v0, 0x1
:goto_0
return v0
:cond_1
const/4 v0, 0x0
goto :goto_0
.end method
4. Copy the file KeyguardUpdateMonitor$4.smali attached in "android.policy\smali\com\android\internal\policy\impl\" and recompile
Thanks, I hope to see your fix in some ROM now !
Sent from my GT-I9000 using XDA
.Slane. said:
Thanks, I hope to see your fix in some ROM now !
Sent from my GT-I9000 using XDA
Click to expand...
Click to collapse
S A U R O M - Projekt---> JW5/JW4/JVU/JW1/JVZ for I9000
Good news and good job. thanks
I'm just curious how ppl find something like that out. And what does the smileys mean?
What changes did you make to this fix in your jw6 rom?
Yes,jw6 aviable
Sent from my GT-I9000 using xda app-developers app
dark_knight35 said:
I'm just curious how ppl find something like that out. And what does the smileys mean?
Click to expand...
Click to collapse
The smileys ar ;/) (w/out "/" ) and the forum rules are the smileys are activated
Sent from my GT-I9000 using Tapatalk 2
Is there a chance for us with the lack of skills to get this as a flashable zip?
This bug is gone in 2.3.6 ZSJW4 for chinese market. I think it is the only version of JW...firmware that comes with this fixed.
Hey there lirik0.
I tried your guide so as to fix this bug for the Samsung Galaxy S Plus (i9001).
I have made all the changes to the files that you describe (with some differences on the 3rd - it was a different line number).
But i probably need a different attachment file to download and recompile.
Could you please help all the i9001 community to resolve this issue cause?
Thanks in advance!
PS: I have also attached our android.policy.jar from XXKQH ROM.

[HOW TO] AOSP Lock + Toggle| 3 Way Ext. Power Menu| CRT-OFF| Long Menu Press to Kill

Hy Guys! in my request to isolate all the codes in Smali files to enable Extended Power Menu, CRT-OF, Long Menu Press To Kill and AOSP Lockscreen working separately to implement in my ROM (crDroid ROM) i manage to found how to do it!
Updated 19.01.2013 = Working in latest XXELLC
Requirements :
- You need to know how to work with apktool, smali and baksmali stuffs.
- Notepad++
- 7-zip
WE WILL USE FOLLOING STEPS IN ALL 4 MODS
1 - You need to extract from inside the stock framework/ a file called android.policy.jar;
2 - Open android.policy.jar with 7-zip;
3 - Extract classes.dex from it;
2 - Decompile using baksmail commands;
3 - Once it's done Recompile using smali commands:
Click to expand...
Click to collapse
== AOSP Lockscreen with Toggle ==
Decompile android.policy.jar
Go to: com\android\internal\policy\impl\LockPatternKeyguardView.smali
Click to expand...
Click to collapse
Find this method
Code:
.method createLockScreen()Landroid/view/View;
And switch completely with this (Same method with new codes inside)
Code:
[left][color="blue"].method createLockScreen()Landroid/view/View;
.registers 7
.prologue
.line 1254
iget-object v0, p0, Lcom/android/internal/policy/impl/LockPatternKeyguardView;->mContext:Landroid/content/Context;
invoke-virtual {v0}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;
move-result-object v0
const-string v1, "aosp_lock"
const/4 v2, 0x0
invoke-static {v0, v1, v2}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I
move-result v0
if-nez v0, :cond_1f
new-instance v0, Lcom/android/internal/policy/impl/sec/CircleLockScreen;
iget-object v1, p0, Lcom/android/internal/policy/impl/LockPatternKeyguardView;->mContext:Landroid/content/Context;
iget-object v2, p0, Lcom/android/internal/policy/impl/LockPatternKeyguardView;->mConfiguration:Landroid/content/res/Configuration;
iget-object v3, p0, Lcom/android/internal/policy/impl/LockPatternKeyguardView;->mLockPatternUtils:Lcom/android/internal/widget/LockPatternUtils;
iget-object v4, p0, Lcom/android/internal/policy/impl/LockPatternKeyguardView;->mUpdateMonitor:Lcom/android/internal/policy/impl/KeyguardUpdateMonitor;
iget-object v5, p0, Lcom/android/internal/policy/impl/LockPatternKeyguardView;->mKeyguardScreenCallback:Lcom/android/internal/policy/impl/KeyguardScreenCallback;
invoke-direct/range {v0 .. v5}, Lcom/android/internal/policy/impl/sec/CircleLockScreen;-><init>(Landroid/content/Context;Landroid/content/res/Configuration;Lcom/android/internal/widget/LockPatternUtils;Lcom/android/internal/policy/impl/KeyguardUpdateMonitor;Lcom/android/internal/policy/impl/KeyguardScreenCallback;)V
goto :goto_2e
.line 1260
:cond_1f
new-instance v0, Lcom/android/internal/policy/impl/LockScreen;
iget-object v1, p0, Lcom/android/internal/policy/impl/LockPatternKeyguardView;->mContext:Landroid/content/Context;
iget-object v2, p0, Lcom/android/internal/policy/impl/LockPatternKeyguardView;->mConfiguration:Landroid/content/res/Configuration;
iget-object v3, p0, Lcom/android/internal/policy/impl/LockPatternKeyguardView;->mLockPatternUtils:Lcom/android/internal/widget/LockPatternUtils;
iget-object v4, p0, Lcom/android/internal/policy/impl/LockPatternKeyguardView;->mUpdateMonitor:Lcom/android/internal/policy/impl/KeyguardUpdateMonitor;
iget-object v5, p0, Lcom/android/internal/policy/impl/LockPatternKeyguardView;->mKeyguardScreenCallback:Lcom/android/internal/policy/impl/KeyguardScreenCallback;
invoke-direct/range {v0 .. v5}, Lcom/android/internal/policy/impl/LockScreen;-><init>(Landroid/content/Context;Landroid/content/res/Configuration;Lcom/android/internal/widget/LockPatternUtils;Lcom/android/internal/policy/impl/KeyguardUpdateMonitor;Lcom/android/internal/policy/impl/KeyguardScreenCallback;)V
.local v0, lockView:Landroid/view/View;
:goto_2e
invoke-direct {p0, v0}, Lcom/android/internal/policy/impl/LockPatternKeyguardView;->initializeTransportControlView(Landroid/view/View;)V
.line 1261
return-object v0
.end method[/color][/left]
It will create the AOSP lockscreen but with one issue. Adding only this "new" method will made the lockscreen unlockable using menu button;
So let's made some changes to fix this. There are 2 ways to fix it
1st way
Go to: com\android\internal\policy\impl\LockScreen.smali
Click to expand...
Click to collapse
Find and delete the red one
Code:
.field private mCreationOrientation:I
[color="red"]--- .field private mEnableMenuKeyInLockScreen:Z[/color]
.field private mEnableRingSilenceFallback:Z
Find and delete the red ones
Code:
[left].line 447
iput-object p5, p0, Lcom/android/internal/policy/impl/LockScreen;->mCallback:Lcom/android/internal/policy/impl/KeyguardScreenCallback;
.line 448
[color="red"]--- invoke-direct {p0}, Lcom/android/internal/policy/impl/LockScreen;->shouldEnableMenuKey()Z
--- move-result v0
--- iput-boolean v0, p0, Lcom/android/internal/policy/impl/LockScreen;->mEnableMenuKeyInLockScreen:Z[/color]
.line 449
iget v0, p2, Landroid/content/res/Configuration;->orientation:I[/left]
Find the method and delete completely
Code:
[left][color="red"].method public onKeyDown(ILandroid/view/KeyEvent;)Z
.registers 4
.parameter "keyCode"
.parameter "event"
.prologue
.line 541
const/16 v0, 0x52
if-ne p1, v0, :cond_d
iget-boolean v0, p0, Lcom/android/internal/policy/impl/LockScreen;->mEnableMenuKeyInLockScreen:Z
if-eqz v0, :cond_d
.line 542
iget-object v0, p0, Lcom/android/internal/policy/impl/LockScreen;->mCallback:Lcom/android/internal/policy/impl/KeyguardScreenCallback;
invoke-interface {v0}, Lcom/android/internal/policy/impl/KeyguardScreenCallback;->goToUnlockScreen()V
.line 544
:cond_d
const/4 v0, 0x0
return v0
.end method[/color][/left]
Recompile android.policy.jar and it's done!
AOSP Lockscreen Properly working
2nd way (Thanks to jimbo77)
Using this method we will need to decompile framework-res.apk
Go to: res/values/bools
Click to expand...
Click to collapse
Find and switch
Code:
[color="red"]--- <bool name="config_disableMenuKeyInLockScreen">false</bool>[/color]
[color="blue"]+++ <bool name="config_disableMenuKeyInLockScreen">true</bool>[/color]
Recompile framework-res.apk and it's done.
Lets put toggle in SecSettings.apk
decompile SecSettings.apk
Go to:res/values/strings
Click to expand...
Click to collapse
Add this at the end of the file, before close resources</resources>.
This 2 string bellow will be shown in settings, so feel free to change.
Code:
[left][color="blue"]+++ <string name="aosp">Jelly Bean (AOSP) Lockscreen</string>
+++ <string name="aosp_summary">Enable Original Jelly Bean Lockscreen</string>[/color]
[/left]
Go to: res/xml/Lockscreen_Settings.xml
Click to expand...
Click to collapse
Find and add
Code:
[left]<SwitchPreferenceScreen android:title="@string/lock_screen_shortcut_title" android:key="lock_screen_shortcut" android:summary="@string/lock_screen_shortcut_summary">
<intent android:targetPackage="com.android.settings" android:action="android.intent.action.MAIN" android:targetClass="com.android.settings.lockscreenshortcut.LockScreenShortcutSettings" />
</SwitchPreferenceScreen>
[color="blue"]+++ <CheckBoxPreference android:title="@string/aosp" android:key="say_your_wakeup" android:summary="@string/aosp_summary" />[/color]
<SwitchPreferenceScreen android:title="@string/information_ticker" android:key="information_ticker" android:summary="@string/information_ticker_summary" android:fragment="com.android.settings.InformationTicker" />
[/left]
Go to: smali\com\android\settings\LockScreenSettings.smali
Click to expand...
Click to collapse
Find and add
Code:
[left].field private isWeatherEnabled:Z
[color="blue"]+++ .field private mAospLock:Landroid/preference/CheckBoxPreference;[/color]
.field private mCameraShortCut:Landroid/preference/SwitchPreferenceScreen;[/left]
Find and Switch
Code:
[left]iput-object v0, p0, Lcom/android/settings/LockScreenSettings;->mMotionDialog:Landroid/app/AlertDialog;
[color="red"]--- const/16 v0, 0x8[/color]
[color="blue"]+++ const/16 v0, 0x11[/color]
new-array v0, v0, [I[/left]
Find and Switch
Code:
[left]invoke-virtual {v6, v3}, Landroid/preference/CheckBoxPreference;->setChecked(Z)V
.line 294
:cond_3
[color="red"]--- iget-object v3, p0, Lcom/android/settings/LockScreenSettings;->mSayCommand:Landroid/preference/CheckBoxPreference;[/color]
[color="blue"]+++ iget-object v3, p0, Lcom/android/settings/LockScreenSettings;->mAospLock:Landroid/preference/CheckBoxPreference;[/color]
if-eqz v3, :cond_4
.line 295
[color="red"]--- iget-object v6, p0, Lcom/android/settings/LockScreenSettings;->mSayCommand:Landroid/preference/CheckBoxPreference;[/color]
[color="blue"]+++ iget-object v6, p0, Lcom/android/settings/LockScreenSettings;->mAospLock:Landroid/preference/CheckBoxPreference;[/color]
invoke-virtual {p0}, Lcom/android/settings/LockScreenSettings;->getContentResolver()Landroid/content/ContentResolver;
move-result-object v3
[color="red"]--- const-string v7, "wake_up_lock_screen"[/color]
[color="blue"]+++ const-string v7, "aosp_lock"[/color]
invoke-static {v3, v7, v5}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I[/left]
Find and Switch
Code:
[left]const-string v8, "say_your_wakeup"
invoke-virtual {p0, v8}, Lcom/android/settings/LockScreenSettings;->findPreference(Ljava/lang/CharSequence;)Landroid/preference/Preference;
move-result-object v8
check-cast v8, Landroid/preference/CheckBoxPreference;
[color="red"]--- iput-object v8, p0, Lcom/android/settings/LockScreenSettings;->mSayCommand:Landroid/preference/CheckBoxPreference;[/color]
[color="blue"]+++ iput-object v8, p0, Lcom/android/settings/LockScreenSettings;->mAospLock:Landroid/preference/CheckBoxPreference;[/color]
.line 212
iget-object v8, p0, Lcom/android/settings/LockScreenSettings;->mRippleEffect:Landroid/preference/CheckBoxPreference;
if-eqz v8, :cond_8[/left]
Find and Switch
Code:
[left]goto :goto_4
:cond_9
[color="red"]--- iget-object v4, p0, Lcom/android/settings/LockScreenSettings;->mSayCommand:Landroid/preference/CheckBoxPreference;[/color]
[color="blue"]+++ iget-object v4, p0, Lcom/android/settings/LockScreenSettings;->mAospLock:Landroid/preference/CheckBoxPreference;[/color]
invoke-virtual {p2, v4}, Ljava/lang/Object;->equals(Ljava/lang/Object;)Z
move-result v4
if-eqz v4, :cond_0
invoke-virtual {p0}, Lcom/android/settings/LockScreenSettings;->getContentResolver()Landroid/content/ContentResolver;
move-result-object v4
[color="red"]--- const-string v5, "wake_up_lock_screen"[/color]
[color="blue"]+++ const-string v5, "aosp_lock"[/color]
[color="red"]---iget-object v6, p0, Lcom/android/settings/LockScreenSettings;->mSayCommand:Landroid/preference/CheckBoxPreference;[/color]
[color="blue"]+++iget-object v6, p0, Lcom/android/settings/LockScreenSettings;->mAospLock:Landroid/preference/CheckBoxPreference;[/color]
invoke-virtual {v6}, Landroid/preference/CheckBoxPreference;->isChecked()Z
move-result v6
if-eqz v6, :cond_a[/left]
Find Switch and delete
Code:
[left]
invoke-interface {v1}, Ljava/util/List;->size()I
move-result v8
if-ge v8, v9, :cond_f
.line 240
[color="red"]--- iget-object v8, p0, Lcom/android/settings/LockScreenSettings;->mSayCommand:Landroid/preference/CheckBoxPreference;[/color]
[color="blue"]+++ iget-object v8, p0, Lcom/android/settings/LockScreenSettings;->mAospLock:Landroid/preference/CheckBoxPreference;[/color]
if-eqz v8, :cond_e
[color="red"]--- invoke-virtual {p0}, Lcom/android/settings/LockScreenSettings;->getPreferenceScreen()Landroid/preference/PreferenceScreen;[/color]
[color="red"]--- move-result-object v8[/color]
[color="red"]--- iget-object v9, p0, Lcom/android/settings/LockScreenSettings;->mSayCommand:Landroid/preference/CheckBoxPreference;[/color]
[color="red"]--- invoke-virtual {v8, v9}, Landroid/preference/PreferenceScreen;->removePreference(Landroid/preference/Preference;)Z[/color]
:cond_e
if-eqz v6, :cond_f
invoke-virtual {p0}, Lcom/android/settings/LockScreenSettings;->getPreferenceScreen()Landroid/preference/PreferenceScreen;[/left]
Recompile SecSettings.apk and it's done!
== 3 Way Extended Power Menu ==
Go to: com/android/internal/policy/impl/GlobalActions.smali
Click to expand...
Click to collapse
Find this
Code:
[LEFT].line 368
new-instance v1, Lcom/android/internal/policy/impl/GlobalActions$5;[/LEFT]
And switch with this
Code:
[LEFT][COLOR="Blue"].line 368
new-instance v1, Lcom/android/internal/policy/impl/GlobalActions$99;[/COLOR][/LEFT]
Find this
Code:
[LEFT]invoke-direct {v1, v0, v2, v3}, Lcom/android/internal/policy/impl/GlobalActions$5;-><init>(Lcom/android/internal/policy/impl/GlobalActions;II)V[/LEFT]
And switch with this
Code:
[LEFT][COLOR="Blue"]invoke-direct {v1, v0, v2, v3}, Lcom/android/internal/policy/impl/GlobalActions$99;-><init>(Lcom/android/internal/policy/impl/GlobalActions;II)V[/COLOR][/LEFT]
Now go to
com/android/internal/policy/impl/GlobalActions$SinglePressAction.smali
Click to expand...
Click to collapse
Find this
Code:
[LEFT].end annotation
# instance fields
.field private final mIconResId:I
.field private final mMessage:Ljava/lang/CharSequence;
.field private final mMessageResId:I
[/LEFT]
And between .end annotation and # instance fields, add this
Code:
[LEFT][COLOR="Blue"]# static fields
.field protected static rebootMode:I
.field protected static final rebootOptions:[Ljava/lang/String;[/COLOR][/LEFT]
Find this
Code:
[LEFT]# direct methods
.method protected constructor <init>(II)V
.registers 4
.parameter "iconResId"
.parameter "messageResId"
[/LEFT]
And between # direct methods and .method protected constructor <init>(II)V, add this
Code:
[LEFT][COLOR="Blue"].method static constructor <clinit>()V
.registers 3
const/4 v0, 0x3
new-array v0, v0, [Ljava/lang/String;
const/4 v1, 0x0
const-string v2, "Reboot"
aput-object v2, v0, v1
const/4 v1, 0x1
const-string v2, "Download"
aput-object v2, v0, v1
const/4 v1, 0x2
const-string v2, "Recovery"
aput-object v2, v0, v1
sput-object v0, Lcom/android/internal/policy/impl/GlobalActions$SinglePressAction;->rebootOptions:[Ljava/lang/String;
return-void
.end method[/COLOR][/LEFT]
To finalize Extended Power Menu you need to copy tree smali files (GlobalActions$99$1.smali, GlobalActions$99$2, and GlobalActions$1.smali) and paste then inside -> com/android/internal/policy/impl/
Recompile android.policy.jar using smali commands it's DONE!
== CRT OFF Animation ==
Follow the same procedure as android.policy.jar to decompile and extract classes.dex
Go to
Go to: com/android/internal/policy/impl/PhoneWindowManager.smali
Click to expand...
Click to collapse
find this
Code:
[LEFT]# interfaces
.implements Landroid/view/WindowManagerPolicy;
# annotations
[/LEFT]
Between .implements Landroid/view/WindowManagerPolicy and # annotations, add this
Code:
[LEFT][COLOR="Blue"].implements Ljava/lang/Runnable;[/COLOR][/LEFT]
find this
Code:
[LEFT].line 5938
.end local v9 #isAllowed:Z
.end local v16 #kioskMode:Landroid/app/enterprise/kioskmode/KioskMode;
:cond_66
:goto_66
return v19[/LEFT]
Between :goto_66 and return v19, add this
Code:
[LEFT][COLOR="Blue"]and-int/lit8 v0, v19, 0x4
if-eqz v0, :cond_71
and-int/lit8 v19, v19, -0x5
move-object/from16 v0, p0
invoke-virtual {v0}, Lcom/android/internal/policy/impl/PhoneWindowManager;->sleepDelay()V
:cond_71[/COLOR][/LEFT]
Go to the Bottom of the file and add this hole code
Code:
[LEFT][COLOR="Blue"].method public sleepDelay()V
.locals 10
iget-object v0, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mHandler:Landroid/os/Handler;
const-wide v2, 0x64
check-cast p0, Ljava/lang/Runnable;
invoke-virtual {v0, p0, v2, v3}, Landroid/os/Handler;->postDelayed(Ljava/lang/Runnable;J)Z
return-void
.end method
.method public run()V
.locals 10
.prologue
iget-object v0, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mContext:Landroid/content/Context;
const-string v1, "power"
invoke-virtual {v0, v1}, Landroid/content/Context;->getSystemService(Ljava/lang/String;)Ljava/lang/Object;
move-result-object v0
check-cast v0, Landroid/os/PowerManager;
invoke-static {}, Landroid/os/SystemClock;->uptimeMillis()J
move-result-wide v2
const-wide/16 v6, 0x3e8
add-long/2addr v2, v6
invoke-virtual {v0, v2, v3}, Landroid/os/PowerManager;->goToSleep(J)V
return-void
.end method[/COLOR][/LEFT]
Now you can recompile android.policy.jar using smali commands.
Now
Extract services.jar from inside framework folder and follow the same procedure extract classes.dex and decompile it.
Go to
Go to: com/android/server/PowerMangerService$ScreenBrightnessAnimator.smali
Click to expand...
Click to collapse
find this
Code:
[LEFT]#getter for: Lcom/android/server/PowerManagerService;->mScreenBrightnessHandler:Landroid/os/Handler;
invoke-static {v7}, Lcom/android/server/PowerManagerService;->access$7300(Lcom/android/server/PowerManagerService;)Landroid/os/Handler;
move-result-object v7
const/16 v9, 0xa[/LEFT]
Between move-result-object v7 and const/16 v9, 0xa, add this
Code:
[LEFT][COLOR="Blue"]if-eqz p2, :cond_75
const/16 v9, 0xb
const/4 v10, 0x0
const v2, 0x10
invoke-virtual {v7, v9, v2, v10}, Landroid/os/Handler;->obtainMessage(III)Landroid/os/Message;
move-result-object v9
invoke-virtual {v9}, Landroid/os/Message;->sendToTarget()V
:cond_75[/COLOR][/LEFT]
Now you can recompile services.jar using apktool and smali commands
== Long Menu Press to Kill App ==
Follow the same procedure as android.policy.jar and services.jar to decompile and extract classes.dex again from android.policy.jar
Go to: com/android/internal/policy/impl/PhoneWindowManager.smali
Click to expand...
Click to collapse
find this
Code:
.line 1455
[COLOR="Red"]new-instance v0, Lcom/android/internal/policy/impl/PhoneWindowManager$8;
invoke-direct {v0, p0}, Lcom/android/internal/policy/impl/PhoneWindowManager$8;-><init (Lcom/android/internal/policy/impl/PhoneWindowManager;)V[/COLOR]
iput-object v0, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mMenuLongPress:Ljava/lang/Runnable;
change the red ones for blues under
Code:
[COLOR="Blue"]+ new-instance v0, Lcom/android/internal/policy/impl/PhoneWindowManager$MenuLongPress;
+ invoke-direct {v0, p0}, Lcom/android/internal/policy/impl/PhoneWindowManager$MenuLongPress;-><init>(Lcom/android/internal/policy/impl/PhoneWindowManager;)V[/COLOR]
Extract the PhoneWindowManager-file.zip attached, extract the file int it and copy to com/android/internal/policy/impl/
Recompile android.policy.jar using smali commands and it's done!
With this we will be able to add or remove this 4 mods from inside any other
CREDITS
For CRT OFF Animation method all the credits goes to Sorg. I've just follow his tutorial.
For part Extended Power Menu i like to thanks mgn2o
For part of AOSP Lockscreen i like to thanks Didact74
Nice, an EPM whitout Hot Reboot (mgn2o) thanks for reference ....
Enviado de meu GT-I9300 usando o Tapatalk 2
Excellent guide! Would love one for lockscreen media skip !! I cant find the source/guide anywhere !
Great guide.
It will be great:
Can you add how to decompile .odex such that we obtain .smali for editing ??
Thanks in advance mate.
Post updated with Long Menu Press to Kill for XXELK4
Akshay (Aky) said:
Great guide.
It will be great:
Can you add how to decompile .odex such that we obtain .smali for editing ??
Thanks in advance mate.
Click to expand...
Click to collapse
You can try to deodex a file, made the changes and re-odex.
I never try with odex. I only use roms deodexed and my (crDroid) in development is surely deodexed.
Take a look in here: CLICK
how to Inkeffect tutorial
One more thing, how to add the function "Long press volume key to jump muisc" in lockscreen mode? Thanks.
I'll definitely use this to add crt animation to the 4.1.2 ROM I have for the Sprint S2. Thanks!
Sent from my SPH-D710 using xda premium
Great job, Hoping this will become a central hub for source code ! Bookmarked for future use.. looking forward to future sources!
Would you please also add the mod for "long press volume key to skip song"? Thanks.
dongfangri said:
Would you please also add the mod for "long press volume key to skip song"? Thanks.
Click to expand...
Click to collapse
I'm working on this. Trying some kind of "reverse engineering" to spot the codes.
Great tutorial, for my first attempt at these types of edits, it made life very easy. Although i have a small problem. Ive made the edits so i can have extended power menu, crt off and any app multi window in my rom. Everything went smoothly but it seems that crt off is erratic. Sometimes it works and sometimes it does not. Any ideas?
Sent from my GT-I9300 using Tapatalk 2
anaraxia said:
Great tutorial, for my first attempt at these types of edits, it made life very easy. Although i have a small problem. Ive made the edits so i can have extended power menu, crt off and any app multi window in my rom. Everything went smoothly but it seems that crt off is erratic. Sometimes it works and sometimes it does not. Any ideas?
Sent from my GT-I9300 using Tapatalk 2
Click to expand...
Click to collapse
Well a never had this kind of problem.
Using Kernle Perseus, by the way? It seems to broke CRT.
Cristiano Matos said:
Well a never had this kind of problem.
Using Kernle Perseus, by the way? It seems to broke CRT.
Click to expand...
Click to collapse
No... Stock kernel. Keeping in simple
Sent from my GT-I9300 using Tapatalk 2
anaraxia said:
No... Stock kernel. Keeping in simple
Sent from my GT-I9300 using Tapatalk 2
Click to expand...
Click to collapse
There's a problem with the Stock kernel on the newest JB update (For both leak and official)
Try using Siyah's 1.8.3 and use the CRT Fix in the STweaks application.
---------- Post added at 11:15 AM ---------- Previous post was at 10:29 AM ----------
Thanks alot for this tutorial, very simple and straight to the point!
Lost.soul said:
There's a problem with the Stock kernel on the newest JB update (For both leak and official)
Try using Siyah's 1.8.3 and use the CRT Fix in the STweaks application.
Thanks for the help. Downloaded, flashed and tested. Works perfectly now. Will have to add it to my next release. Thanks again :thumbup:
Sent from my GT-I9300 using Tapatalk 2
Click to expand...
Click to collapse
Loved your post, but i have a question: is it possible to do this with gingerbread rom? is it the same procedure?
Também sou brasileiro, hehehe. Tem como tu me ajudar com algumas coisas?
Click to expand...
Click to collapse
Note II InkEffect Lockscreen
It is not compatible with Note II InkEffect Lockscreen Mod.
When I flash this mod (extended menu) the ink effect lockscreen stop working
thank you
anaraxia said:
Great tutorial, for my first attempt at these types of edits, it made life very easy. Although i have a small problem. Ive made the edits so i can have extended power menu, crt off and any app multi window in my rom. Everything went smoothly but it seems that crt off is erratic. Sometimes it works and sometimes it does not. Any ideas?
Sent from my GT-I9300 using Tapatalk 2
Click to expand...
Click to collapse
Can you confirm it works ONLY with Wifi On ? Seams like that on my try
in the service.jar...i have 2 times those codes...234, 264 something, so how do you choose where to insert your part ?
later edit:
Makes no diff where i add those it seams. Still CRT only works with WIFI on, its like a CRT SWICH haha...suppose "stuff" should be inserted differently on 4.1.2.

[help with a mod]DigitalClock statusbar

This problem is solved see post #5
gerryS2 said:
I have found the file of DigitalClock with second for statusbar (<DigitalClock android...)in framework2.jar in smali/android/widget/DigitalClock.
I have ported this file in smali folder of SystemUI and I have insert this line in tw_status_bar:
<com.android.systemui.statusbar.policy.DigitalClock android:textSize="@dimen/status_bar_clock_text_size"...
I would like to enter a checkbox in the SecSettings to show or hide the clock, the problem is in SystemUI because I can not put a code to hide, I have use a id for hide and insert the android:visibility="gone", but doesn't work. It is possible help me with this mod in SystemUI?
P.S.I am able with SecSettings but I haven't able with SystemUI
Click to expand...
Click to collapse
I have wanted seconds on my statusbar clock. Have you a link to a tutorial? Or, where did you put the smali file into the systemui?
Wish I could help with your request but maybe I can find out on the S Advance forum... if I do I'll be back LOL...
bobfrantic said:
I have wanted seconds on my statusbar clock. Have you a link to a tutorial? Or, where did you put the smali file into the systemui?
Wish I could help with your request but maybe I can find out on the S Advance forum... if I do I'll be back LOL...
Click to expand...
Click to collapse
I have extract the file of framework2.jar in systemUI. I have create for you a zip that contains this file smali, this file must be inserted in:
smali/com/android/systemui/statubar/policy/
You have replace this line of clock in tw_status_bar.xml:
<com.android.systemui.statusbar.policy.Clock
with this:
<com.android.systemui.statusbar.policy.DigitalClock
gerryS2 said:
I have extract the file of framework2.jar in systemUI. I have create for you a zip that contains this file smali, this file must be inserted in:
smali/com/android/systemui/statubar/policy/
You have replace this line of clock in tw_status_bar.xml:
<com.android.systemui.statusbar.policy.Clock
with this:
<com.android.systemui.statusbar.policy.DigitalClock
Click to expand...
Click to collapse
Thank you for this, it worked. Will see what I can find out about a switch for turning on and off the clock in settings. Appreciated much!
bobfrantic said:
Thank you for this, it worked. Will see what I can find out about a switch for turning on and off the clock in settings. Appreciated much!
Click to expand...
Click to collapse
I solved it with the guide of @Goldie, I have created a method in PhoneStatusbar and I have insert a custom id in the line of Digital Clock like this:
Code:
<com.android.systemui.statusbar.policy.DigitalClock android:textSize="@dimen/status_bar_clock_text_size" android:textColor="#ff959595" android:ellipsize="none" android:gravity="left|center" android:id="@id/digitalclock_view" android:visibility="gone" android:paddingLeft="3.0dip" android:layout_width="wrap_content" android:layout_height="fill_parent" android:singleLine="true" android:includeFontPadding="false" />
Insert this line in ids.xml:
Code:
<item type="id" name="digitalclock_view">false</item>
In PhoneStatusbar insert this method at the end of the file:
Code:
.method digitalclock_view()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, "enable_digitalclock"
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_0
const v3, 0x8
:cond_0
iget-object v5, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mStatusBarWindow:Lcom/android/systemui/statusbar/phone/StatusBarWindowView;
const p0, 0x7f0d01e0
invoke-virtual {v5, p0}, Lcom/android/systemui/statusbar/phone/StatusBarWindowView;->findViewById(I)Landroid/view/View;
move-result-object v4
invoke-virtual {v4, v3}, Lcom/android/systemui/statusbar/policy/DigitalClock;->setVisibility(I)V
return-void
.end method
0x7f0d01e0 is the public id of "digitalclock_view"
"enable_digitalclock" is the key for checkbox (android:key="enable_digitalclock")
After I have insert this line in a part of method makestatusbarview:
Code:
invoke-virtual {p0}, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->digitalclock_view()V
Code:
iget-object v9, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mClearButton:Landroid/view/View;
const/4 v10, 0x0
invoke-virtual {v9, v10}, Landroid/view/View;->setAlpha(F)V
iget-object v9, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mClearButton:Landroid/view/View;
const/4 v10, 0x4
invoke-virtual {v9, v10}, Landroid/view/View;->setVisibility(I)V
invoke-virtual {p0}, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->digitalclock_view()V
iget-object v9, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mClearButton:Landroid/view/View;
const/4 v10, 0x0
invoke-virtual {v9, v10}, Landroid/view/View;->setEnabled(Z)V
iget-object v9, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mStatusBarWindow:Lcom/android/systemui/statusbar/phone/StatusBarWindowView;
const v10, 0x7f0d004f
invoke-virtual {v9, v10}, Lcom/android/systemui/statusbar/phone/StatusBarWindowView;->findViewById(I)Landroid/view/View;
move-result-object v9
check-cast v9, Lcom/android/systemui/statusbar/policy/DateView;
If you have this on-fly you must have PhoneStatusBar$SettingsObserver.smali and add this line in two method:
Code:
.method observe()V
.locals 3
const/4 v2, 0x0
iget-object v1, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar$SettingsObserver;->this$0:Lcom/android/systemui/statusbar/phone/PhoneStatusBar;
iget-object v1, v1, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mContext:Landroid/content/Context;
invoke-virtual {v1}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;
move-result-object v0
const-string v1, "enable_digitalclock"
invoke-static {v1}, Landroid/provider/Settings$System;->getUriFor(Ljava/lang/String;)Landroid/net/Uri;
move-result-object v1
invoke-virtual {v0, v1, v2, p0}, Landroid/content/ContentResolver;->registerContentObserver(Landroid/net/Uri;ZLandroid/database/ContentObserver;)V
Code:
.method public onChange(Z)V
.locals 1
iget-object v0, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar$SettingsObserver;->this$0:Lcom/android/systemui/statusbar/phone/PhoneStatusBar;
invoke-virtual {p0}, Lcom/android/systemui/statusbar/phone/PhoneStatusBar$SettingsObserver;->digitalclock_view()V
Thanks @Goldie for his guide of smali code
Nice to see it helping
Sent from my GT-I9305 using Tapatalk
Glad you found out how. Maybe when I have time I'll give a try. If you can, show me with a screen shot what you accomplished please. May help me when I attempt this.
Sent from my Advanced SII lite

[MOD][GUIDE]Enable Heads Up Notifications

This guide was written based on the Sprint Samsung Galaxy S3 ND8 KitKat stock ROM but with the proper modifications may work for other KitKat ROMs. Please don't ask me to modify this to work with ROM xyz or to compile this for you into a ROM. I won't do it.
Background Info
As you know, Android 4.4 has a heads-up notification feature built in but disabled with no way to enable it from settings. While there are various Xposed modules that will enable this for you as well as give some additional functionality (such as whitelisting), I personally don't use Xposed because it causes conflicts on my ROM so I decided to figure out how to enable it myself. Simply enabling Heads Up notifications caused all sorts of force closes any time an ongoing notification presented itself so that had to be worked out as well.
Requirements
apktool 2.0 beta 9 and the knowledge of how to use it. There are various guides on how to use apktool on XDA. Find one and read it. Make sure to read the information on the apktool site as well since some of the options in 2.0 may be different from the guides you find.
A text editor that supports Unix-style text files. I recommend Notepad++.
Files
You'll be working with the following apks:
SystemUI.apk
SecSettings.apk
SystemUI.apk
Decompile SystemUI.apk using apktool.
Open smali\com\android\systemui\statusbar\BaseStatusBar.smali in your preferred text editor.
Find .method protected shouldInterrupt(Landroid/service/notification/StatusBarNotificationZ.
This method is of no use to us in it's current form and is what causes the force closes/ongoing notification issues so we are going to completely remove it and replace it with the following:
Code:
.method protected shouldInterrupt(Landroid/service/notification/StatusBarNotification;)Z
.locals 12
.param p1, "sbn" # Landroid/service/notification/StatusBarNotification;
.prologue
const/4 v8, 0x0
const/4 v9, 0x1
.line 1292
invoke-virtual {p1}, Landroid/service/notification/StatusBarNotification;->isOngoing()Z
move-result v4
if-nez v4, :cond_0
iget-object v10, p0, Lcom/android/systemui/statusbar/BaseStatusBar;->mPowerManager:Landroid/os/PowerManager;
invoke-virtual {v10}, Landroid/os/PowerManager;->isScreenOn()Z
move-result v1
:goto_0
return v1
:cond_0
move v1, v8
goto :goto_0
.end method
Save the file and recompile SystemUI using apktool. Don't forget to re-sign the APK (either use an APK signer if you have a ROM that has 3rd-party system app signatures enabled or copy the AndroidManifest.xml file and META-INF folder from the original to the new APK).
That's it for SystemUI.apk.
SecSettings.apk
Decompile SecSettings.apk with apktool.
First, we need to add the title and summary for the setting to enable Heads Up notifications. Open res\values\Strings.xml in your preferred text editor.
Add the following lines to the bottom of the file:
Code:
<string name="heads_up">Heads up notifications</string>
<string name="heads_up_desc">Enable heads up notifications</string>
Save the file and close it.
Next we need to add the setting entry. Open res\xml\display_settings.xml in your preferred text editor.
Add the following line underneath your preferred setting category (I chose to place it under "General" in my ROM):
Code:
<CheckBoxPreference android:title="@string/heads_up" android:key="heads_up_setting" android:widgetLayout="@touchwiz:layout/preference_widget_twcheckbox" />
Save the file and close it.
Finally, we will add the code to enable/disable Heads Up notifications. Open smali\com\android\settings\DisplaySettings.smali in your preferred text editor.
Find # instance fields and add the following line (on a new line) somewhere before # direct methods:
Code:
.field private mHeadsUp:Landroid/preference/CheckBoxPreference;
Find .method private updateState()V, then locate the section of code that looks similar to this:
Code:
:cond_0
invoke-direct {p0}, Lcom/android/settings/DisplaySettings;->updateInformativeScreenSummary()V
.line 1374
iget-object v3, p0, Lcom/android/settings/DisplaySettings;->mDisplayBatteryLevel:Landroid/preference/CheckBoxPreference;
invoke-virtual {p0}, Lcom/android/settings/DisplaySettings;->getContentResolver()Landroid/content/ContentResolver;
move-result-object v0
const-string v4, "display_battery_percentage"
invoke-static {v0, v4, v2}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I
move-result v0
if-eqz v0, :cond_2
move v0, v1
:goto_0
invoke-virtual {v3, v0}, Landroid/preference/CheckBoxPreference;->setChecked(Z)V
Your variables (v#'s), conditionals (cond_#'s), gotos (goto_#'s), and .line #'s may differ. Under the line invoke-virtual {v3, v0}, Landroid/preference/CheckBoxPreference;->setChecked(Z)V, add:
Code:
iget-object v3, p0, Lcom/android/settings/DisplaySettings;->mHeadsUp:Landroid/preference/CheckBoxPreference;
invoke-virtual {p0}, Lcom/android/settings/DisplaySettings;->getContentResolver()Landroid/content/ContentResolver;
move-result-object v0
const-string v4, "heads_up_enabled"
invoke-static {v0, v4, v2}, Landroid/provider/Settings$Global;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I
move-result v0
if-eqz v0, :cond_8
move v0, v1
:goto_6
invoke-virtual {v3, v0}, Landroid/preference/CheckBoxPreference;->setChecked(Z)V
You'll want to change the variables to match the ones in the prior code section if they are different for you. Also make sure to change the conditional and goto labels to one hexadecimal numeral higher than the highest one already present in the method (for example, in stock ND8, the highest conditional is cond_7 so we choose cond_8 for the conditional here and the highest goto is goto_5 so we chose goto_6).
Scroll down to the end of the method and add the following above .end method:
Code:
:cond_8
move v0, v2
goto/16 :goto_6
Make sure to change v2 to whatever variable is defined at the beginning of the method as 0x0 (ie. const/4 v2, 0x0 in this case).
Find .method public onCreate(Landroid/os/BundleV, then locate the section of code that looks similar to the following:
Code:
const-string v0, "display_battery_level"
invoke-virtual {p0, v0}, Lcom/android/settings/DisplaySettings;->findPreference(Ljava/lang/CharSequence;)Landroid/preference/Preference;
move-result-object v0
check-cast v0, Landroid/preference/CheckBoxPreference;
iput-object v0, p0, Lcom/android/settings/DisplaySettings;->mDisplayBatteryLevel:Landroid/preference/CheckBoxPreference;
Again, your variables (v#'s) may differ. Beneath the line iput-object v0, p0, Lcom/android/settings/DisplaySettings;->mDisplayBatteryLevel:Landroid/preference/CheckBoxPreference;, add the following:
Code:
const-string v0, "heads_up_setting"
invoke-virtual {p0, v0}, Lcom/android/settings/DisplaySettings;->findPreference(Ljava/lang/CharSequence;)Landroid/preference/Preference;
move-result-object v0
check-cast v0, Landroid/preference/CheckBoxPreference;
iput-object v0, p0, Lcom/android/settings/DisplaySettings;->mHeadsUp:Landroid/preference/CheckBoxPreference;
Make sure to change the variable #'s to match the ones in the prior code section.
Find .method public onPreferenceTreeClick(Landroid/preference/PreferenceScreen;Landroid/preference/PreferenceZ and locate the section of code that looks similar to:
Code:
:cond_a
iget-object v0, p0, Lcom/android/settings/DisplaySettings;->mDisplayBatteryLevel:Landroid/preference/CheckBoxPreference;
invoke-virtual {p2, v0}, Ljava/lang/Object;->equals(Ljava/lang/Object;)Z
move-result v0
if-eqz v0, :cond_c
.line 1530
iget-object v0, p0, Lcom/android/settings/DisplaySettings;->mDisplayBatteryLevel:Landroid/preference/CheckBoxPreference;
invoke-virtual {v0}, Landroid/preference/CheckBoxPreference;->isChecked()Z
move-result v0
.line 1531
invoke-virtual {p0}, Lcom/android/settings/DisplaySettings;->getContentResolver()Landroid/content/ContentResolver;
move-result-object v1
const-string v4, "display_battery_percentage"
if-eqz v0, :cond_b
move v3, v2
:cond_b
invoke-static {v1, v4, v3}, Landroid/provider/Settings$System;->putInt(Landroid/content/ContentResolver;Ljava/lang/String;I)Z
goto :goto_3
.line 1533
:cond_c
As usual, your variables (v#'s), conditionals (cond_#'s), gotos (goto_#'s), and .line #'s may differ. Under :cond_c, add the following:
Code:
iget-object v0, p0, Lcom/android/settings/DisplaySettings;->mHeadsUp:Landroid/preference/CheckBoxPreference;
invoke-virtual {p2, v0}, Ljava/lang/Object;->equals(Ljava/lang/Object;)Z
move-result v0
if-eqz v0, :cond_2b
.line 1530
iget-object v0, p0, Lcom/android/settings/DisplaySettings;->mHeadsUp:Landroid/preference/CheckBoxPreference;
invoke-virtual {v0}, Landroid/preference/CheckBoxPreference;->isChecked()Z
move-result v0
.line 1531
invoke-virtual {p0}, Lcom/android/settings/DisplaySettings;->getContentResolver()Landroid/content/ContentResolver;
move-result-object v1
const-string v4, "heads_up_enabled"
if-eqz v0, :cond_2c
move v3, v2
:cond_2c
invoke-static {v1, v4, v3}, Landroid/provider/Settings$Global;->putInt(Landroid/content/ContentResolver;Ljava/lang/String;I)Z
goto/16 :goto_3
:cond_2b
Again, you'll want to change the variables to match the ones in the prior code section if they are different for you and make sure to change the conditional labels to one hexadecimal numeral higher than the highest one already present in the method. Change the goto/16 :goto_3 to match the one in the previous code section.
Save the file and close it.
That's it for SecSettings.apk. Recompile and re-sign it.
Install both files to your phone using your preferred method. You should already know this but I'll say it anyway, THESE FILES CANNOT BE INSTALLED LIKE NORMAL SIDE-LOADED APKs. I prefer to reboot to recovery and use ADB to push the files to the system, but you can use whatever method is easiest for you (ie. Aroma file manager, flashable zip, etc.).
So I guess those of us that aren't very good at this will have to wait then? Lol
Sent from my SPH-L710 using Tapatalk
Great tutorial man! Thank you looking forward to add this to all my releases soon. Great job!
Great, it compiles without mistakes with Dn3 4.4.2 for N7105, but I was playing with my 4 years old daughter and I'm sure something will be wrong, lol!
I just had to use cond 8 instead of 7, but I will report very likely my failure... It will take longer for me to let it work.
Anyway, it is a very useful tutorial and it's the only one here.
Mismatch?
I think there is a typo in the code for statusbar, it says mismatched input "p1" expecting END_METHOD_DIRECTIVE
I took this one from your original code (the one inside your rom) and it compiles fine
.method protected shouldInterrupt(Landroid/service/notification/StatusBarNotificationZ
.locals 12
.parameter "sbn"
.prologue
const/4 v8, 0x0
const/4 v9, 0x1
.line 1292
invoke-virtual {p1}, Landroid/service/notification/StatusBarNotification;->isOngoing()Z
move-result v4
if-nez v4, :cond_0
iget-object v10, p0, Lcom/android/systemui/statusbar/BaseStatusBar;->mPowerManager:Landroid/os/PowerManager;
invoke-virtual {v10}, Landroid/os/PowerManager;->isScreenOn()Z
move-result v1
:goto_0
return v1
:cond_0
move v1, v8
goto :goto_0
.end method
I will re-check the next steps, because last night I was unable to get everything working (I am not a dev).
Thanks again.
lucaoldb said:
I think there is a typo in the code for statusbar, it says mismatched input "p1" expecting END_METHOD_DIRECTIVE
I took this one from your original code (the one inside your rom) and it compiles fine
.method protected shouldInterrupt(Landroid/service/notification/StatusBarNotificationZ
.locals 12
.parameter "sbn"
.prologue
const/4 v8, 0x0
const/4 v9, 0x1
.line 1292
invoke-virtual {p1}, Landroid/service/notification/StatusBarNotification;->isOngoing()Z
move-result v4
if-nez v4, :cond_0
iget-object v10, p0, Lcom/android/systemui/statusbar/BaseStatusBar;->mPowerManager:Landroid/os/PowerManager;
invoke-virtual {v10}, Landroid/os/PowerManager;->isScreenOn()Z
move-result v1
:goto_0
return v1
:cond_0
move v1, v8
goto :goto_0
.end method
I will re-check the next steps, because last night I was unable to get everything working (I am not a dev).
Thanks again.
Click to expand...
Click to collapse
The code in the guide is taken straight from my ROM. All this method does is check to see if the notification is ongoing or not, then check to make sure the screen is on. also, I highly recommend using the latest version of apktool.
First of all, thank you.
I still have to edit the files by myself, but I have tested both your system ui and your secsettings on to the rom I am using (Dn3 4.4.2 for N7105) and they work fine, including heads up notifications... So I will keep these settings for some days, until I have the time to learn more about this matter.
Btw, I will try some of yor themed apps I found inside your rom, which are very good looking.
So what does the hud look like and how does it work? Not familiar with it.
Sent from my SPH-L710 using Tapatalk
Works great. Thank you moonknightus
Deleted
marcran75 said:
Deleted
Click to expand...
Click to collapse
???
Sent from my SPH-L710 using Tapatalk
Just an fyi, I just tried this on the S5 stock touchwiz (which is 4.4.2). I get an error when trying to compile SecSettings.apk.
Code:
I: Smaling smali folder into classes.dex...
..\_WorkArea1\_working\SecSettings.apk\smali\com\android\settings\DisplaySettings.smali[2936,4] There is already a label with that name.
Exception in thread "main" brut.androlib.AndrolibException: Could not smali file: com/android/settings/DisplaySettings.smali
at brut.androlib.src.SmaliBuilder.buildFile(SmaliBuilder.java:71)
at brut.androlib.src.SmaliBuilder.build(SmaliBuilder.java:55)
at brut.androlib.src.SmaliBuilder.build(SmaliBuilder.java:41)
at brut.androlib.Androlib.buildSourcesSmali(Androlib.java:358)
at brut.androlib.Androlib.buildSources(Androlib.java:298)
at brut.androlib.Androlib.build(Androlib.java:284)
at brut.androlib.Androlib.build(Androlib.java:258)
at brut.apktool.Main.cmdBuild(Main.java:240)
at brut.apktool.Main.main(Main.java:89)
It seems like the method or something is already being duplicated. SystemUI recompiled perfectly.
tp2215 said:
Just an fyi, I just tried this on the S5 stock touchwiz (which is 4.4.2). I get an error when trying to compile SecSettings.apk.
Code:
I: Smaling smali folder into classes.dex...
..\_WorkArea1\_working\SecSettings.apk\smali\com\android\settings\DisplaySettings.smali[2936,4] There is already a label with that name.
Exception in thread "main" brut.androlib.AndrolibException: Could not smali file: com/android/settings/DisplaySettings.smali
at brut.androlib.src.SmaliBuilder.buildFile(SmaliBuilder.java:71)
at brut.androlib.src.SmaliBuilder.build(SmaliBuilder.java:55)
at brut.androlib.src.SmaliBuilder.build(SmaliBuilder.java:41)
at brut.androlib.Androlib.buildSourcesSmali(Androlib.java:358)
at brut.androlib.Androlib.buildSources(Androlib.java:298)
at brut.androlib.Androlib.build(Androlib.java:284)
at brut.androlib.Androlib.build(Androlib.java:258)
at brut.apktool.Main.cmdBuild(Main.java:240)
at brut.apktool.Main.main(Main.java:89)
It seems like the method or something is already being duplicated. SystemUI recompiled perfectly.
Click to expand...
Click to collapse
Either a goto or a conditional label is being duplicated. Reread the instructions paying attention to the part that says to adjust the labels accordingly. The S3 and S5 use very similar code but by no means is it identical.
Thanks moonknightus for this guide. I manage to apply this mod to my tablet.:good: .Now my only problem is your other mod.
@moonknightus please check your PM sir
Do I actually need to sign the apks our can I just use them once they are modified
Sent from my SPH-L710 using Tapatalk
bigwillyg said:
Do I actually need to sign the apks our can I just use them once they are modified
Sent from my SPH-L710 using Tapatalk
Click to expand...
Click to collapse
Either use an APK signer if you have a ROM that has 3rd-party system app signatures enabled or copy the AndroidManifest.xml file and META-INF folder from the original to the new APK.As stated by moonknightus in his other thread.
filchi756 said:
Either use an APK signer if you have a ROM that has 3rd-party system app signatures enabled or copy the AndroidManifest.xml file and META-INF folder from the original to the new APK.As stated by moonknightus in his other thread.
Click to expand...
Click to collapse
Ah gotcha. Thanks
Sent from my SPH-L710 using Tapatalk
Shouldn't this be :cond_8?
Code:
[COLOR="Red"]:cond_7
[/COLOR] move v0, v2
goto/16 :goto_6
tdunham said:
Shouldn't this be :cond_8?
Code:
[COLOR="Red"]:cond_7
[/COLOR] move v0, v2
goto/16 :goto_6
Click to expand...
Click to collapse
Yup

Categories

Resources