[Galaxy Note GT-N7000 Android Development] majdinj:
Continue moddings!!

Control The Full Battery Notification With Toggle Switch On or Off

After this guide, you will be able to switch on or off the full battery notification after the device is being fully charged..

​

So here we go..

We will be working with two files, SystemUI.apk and SecSettings.apk

Setting The Toggle Switch >>>

1) SecSettings.apk

- Decompile SecSettings.apk

- Go to res\values folder and open strings.xml and add these new lines:

<string name="set_remove_bat">Full Battery Notification</string>
<string name="notif_on">Notification is Enabled</string>
<string name="notif_off">Notification is Disabled</string>

- Go to res\xml folder and open display_settings.xml and add these codes where you want to display the toggle check box:

<CheckBoxPreference android:title="@string/set_remove_bat" android:key="bat_sbar" android:summaryOn="@string/notif_on" android:summaryOff="@string/notif_off" />

- Now for the smali.. Go to classout\com\android\settings folder and open DisplaySettings.smali.

- Add this line to [# instance fields] section:

.field private mBatPref:Landroid/preference/CheckBoxPreference;

- On the method ".method public onCreate(Landroid/os/Bundle;)V", search for ""key_multi_window"" and add these lines:

.line 570
const-string v11, "key_multi_window"

invoke-virtual {p0, v11}, Lcom/android/settings/DisplaySettings;->findPreference(Ljava/lang/CharSequence;)Landroid/preference/Preference;

move-result-object v11

check-cast v11, Landroid/preference/CheckBoxPreference;

iput-object v11, p0, Lcom/android/settings/DisplaySettings;->mMultiWindowPref:Landroid/preference/CheckBoxPreference;

[B][COLOR="Blue"]const-string v11, "bat_sbar"

invoke-virtual {p0, v11}, Lcom/android/settings/DisplaySettings;->findPreference(Ljava/lang/CharSequence;)Landroid/preference/Preference;

move-result-object v11

check-cast v11, Landroid/preference/CheckBoxPreference;

iput-object v11, p0, Lcom/android/settings/DisplaySettings;->mBatPref:Landroid/preference/CheckBoxPreference;[/COLOR][/B]

- Now in the method ".method public onPreferenceTreeClick(Landroid/preference/PreferenceScreen;Landroid/preference/Preference;)Z", search for ""multi_window_enabled"" to locate this part at the end:

:cond_15c
iget-object v0, p0, Lcom/android/settings/DisplaySettings;->mMultiWindowPref:Landroid/preference/CheckBoxPreference;

invoke-virtual {p2, v0}, Ljava/lang/Object;->equals(Ljava/lang/Object;)Z

move-result v0

if-eqz v0, [B][COLOR="Red"]:cond_179[/COLOR][/B]

.line 1022
iget-object v0, p0, Lcom/android/settings/DisplaySettings;->mMultiWindowPref:Landroid/preference/CheckBoxPreference;

invoke-virtual {v0}, Landroid/preference/CheckBoxPreference;->isChecked()Z

move-result v0

.line 1023
invoke-virtual {p0}, Lcom/android/settings/DisplaySettings;->getContentResolver()Landroid/content/ContentResolver;

move-result-object v3

const-string v4, "multi_window_enabled"

if-eqz v0, :cond_177

:goto_172
invoke-static {v3, v4, v1}, Landroid/provider/Settings$System;->putInt(Landroid/content/ContentResolver;Ljava/lang/String;I)Z

goto/16 [B][COLOR="Lime"]:goto_1c[/COLOR][/B]

:cond_177
move v1, v2

goto :goto_172
.end method

Add new codes before [.end method] in the previous section. Pay attention to the red color condition and the green color condition..!!!, so that section will be like this:

:cond_15c
iget-object v0, p0, Lcom/android/settings/DisplaySettings;->mMultiWindowPref:Landroid/preference/CheckBoxPreference;

invoke-virtual {p2, v0}, Ljava/lang/Object;->equals(Ljava/lang/Object;)Z

move-result v0

if-eqz v0, [B][COLOR="Blue"]:cond_batteryToggle[/COLOR][/B]

.line 1022
iget-object v0, p0, Lcom/android/settings/DisplaySettings;->mMultiWindowPref:Landroid/preference/CheckBoxPreference;

invoke-virtual {v0}, Landroid/preference/CheckBoxPreference;->isChecked()Z

move-result v0

.line 1023
invoke-virtual {p0}, Lcom/android/settings/DisplaySettings;->getContentResolver()Landroid/content/ContentResolver;

move-result-object v3

const-string v4, "multi_window_enabled"

if-eqz v0, :cond_177

:goto_172
invoke-static {v3, v4, v1}, Landroid/provider/Settings$System;->putInt(Landroid/content/ContentResolver;Ljava/lang/String;I)Z

goto/16 [B][COLOR="Lime"]:goto_1c[/COLOR][/B]

:cond_177
move v1, v2

goto :goto_172

[B][COLOR="Blue"]:cond_batteryToggle
iget-object v0, p0, Lcom/android/settings/DisplaySettings;->mBatPref:Landroid/preference/CheckBoxPreference;

invoke-virtual {p2, v0}, Ljava/lang/Object;->equals(Ljava/lang/Object;)Z

move-result v0

if-eqz v0, [COLOR="Red"]:cond_179[/COLOR]

.line 1022
iget-object v0, p0, Lcom/android/settings/DisplaySettings;->mBatPref:Landroid/preference/CheckBoxPreference;

invoke-virtual {v0}, Landroid/preference/CheckBoxPreference;->isChecked()Z

move-result v0

.line 1023
invoke-virtual {p0}, Lcom/android/settings/DisplaySettings;->getContentResolver()Landroid/content/ContentResolver;

move-result-object v3

const-string v4, "bat_sbar"

if-eqz v0, :cond_majdiB

:goto_njB
invoke-static {v3, v4, v1}, Landroid/provider/Settings$System;->putInt(Landroid/content/ContentResolver;Ljava/lang/String;I)Z

goto/16 [B][COLOR="Lime"]:goto_1c[/COLOR][/B]

:cond_majdiB
move v1, v2

goto :goto_njB[/COLOR][/B]
.end method

- Now in the method ".method public onResume()V", search for ""multi_window_enabled"" and locate this part, pay attention to the red color condition..!!!:

:cond_9d
sget-boolean v0, Lcom/android/settings/DisplaySettings;->UseMultiWindow:Z

if-eqz v0, [B][COLOR="Red"]:cond_c1[/COLOR][/B]

.line 847
iget-object v0, p0, Lcom/android/settings/DisplaySettings;->mMultiWindowPref:Landroid/preference/CheckBoxPreference;

invoke-virtual {p0}, Lcom/android/settings/DisplaySettings;->getContentResolver()Landroid/content/ContentResolver;

move-result-object v3

const-string v4, "multi_window_enabled"

invoke-static {v3, v4, v1}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I

move-result v3

if-ne v3, v1, :cond_de

:goto_af
invoke-virtual {v0, v1}, Landroid/preference/CheckBoxPreference;->setChecked(Z)V

.line 848
invoke-virtual {p0}, Lcom/android/settings/DisplaySettings;->getContentResolver()Landroid/content/ContentResolver;

move-result-object v0

const-string v1, "multi_window_enabled"

invoke-static {v1}, Landroid/provider/Settings$System;->getUriFor(Ljava/lang/String;)Landroid/net/Uri;

move-result-object v1

iget-object v3, p0, Lcom/android/settings/DisplaySettings;->mMultiWindowModeObserver:Landroid/database/ContentObserver;

invoke-virtual {v0, v1, v2, v3}, Landroid/content/ContentResolver;->registerContentObserver(Landroid/net/Uri;ZLandroid/database/ContentObserver;)V

line 850
:cond_c1
return-void

:cond_c2
move v0, v2

And do these modification:

:cond_9d
sget-boolean v0, Lcom/android/settings/DisplaySettings;->UseMultiWindow:Z

if-eqz v0, [B][COLOR="Blue"]:cond_newBattery[/COLOR][/B]

.line 847
iget-object v0, p0, Lcom/android/settings/DisplaySettings;->mMultiWindowPref:Landroid/preference/CheckBoxPreference;

invoke-virtual {p0}, Lcom/android/settings/DisplaySettings;->getContentResolver()Landroid/content/ContentResolver;

move-result-object v3

const-string v4, "multi_window_enabled"

invoke-static {v3, v4, v1}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I

move-result v3

if-ne v3, v1, :cond_de

:goto_af
invoke-virtual {v0, v1}, Landroid/preference/CheckBoxPreference;->setChecked(Z)V

.line 848
invoke-virtual {p0}, Lcom/android/settings/DisplaySettings;->getContentResolver()Landroid/content/ContentResolver;

move-result-object v0

const-string v1, "multi_window_enabled"

invoke-static {v1}, Landroid/provider/Settings$System;->getUriFor(Ljava/lang/String;)Landroid/net/Uri;

move-result-object v1

iget-object v3, p0, Lcom/android/settings/DisplaySettings;->mMultiWindowModeObserver:Landroid/database/ContentObserver;

invoke-virtual {v0, v1, v2, v3}, Landroid/content/ContentResolver;->registerContentObserver(Landroid/net/Uri;ZLandroid/database/ContentObserver;)V

[B][COLOR="Blue"]:cond_newBattery
iget-object v0, p0, Lcom/android/settings/DisplaySettings;->mBatPref:Landroid/preference/CheckBoxPreference;

if-eqz v0, [COLOR="Red"]:cond_c1[/COLOR]

.line 3001
iget-object v0, p0, Lcom/android/settings/DisplaySettings;->mBatPref:Landroid/preference/CheckBoxPreference;

invoke-virtual {p0}, Lcom/android/settings/DisplaySettings;->getContentResolver()Landroid/content/ContentResolver;

move-result-object v3

const-string v4, "bat_sbar"

const/4 v1, 0x0

invoke-static {v3, v4, v1}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I

move-result v3

if-eqz v3, :cond_noShow

const/4 v1, 0x1

goto :goto_yesShow

:cond_noShow
const/4 v1, 0x0

:goto_yesShow
invoke-virtual {v0, v1}, Landroid/preference/CheckBoxPreference;->setChecked(Z)V[/COLOR][/B]

line 850
:cond_c1
return-void

:cond_c2
move v0, v2

- Save all changes and compile and push to phone and prof working then continue to next step.

Setting The Referral Switch >>>

2) SystemUI.apk

- Baksmali SystemUI.apk.

- Go to classes/com/android/systemui/power/ folder and open PowerUI.smali.

- Search for this method ".method notifyFullBatteryNotification()V" and add the blue lines and delete or comment out the red line:

.method notifyFullBatteryNotification()V
.registers 12

.prologue
const/4 v10, 0x0

.line 827
iget-object v7, p0, Lcom/android/systemui/SystemUI;->mContext:Landroid/content/Context;

const-string v8, "notification"

invoke-virtual {v7, v8}, Landroid/content/Context;->getSystemService(Ljava/lang/String;)Ljava/lang/Object;

move-result-object v2

check-cast v2, Landroid/app/NotificationManager;

.line 829
.local v2, "notificationManager":Landroid/app/NotificationManager;
[B][COLOR="Blue"]move-object v0, p0

iget-object v5, v0, Lcom/android/systemui/power/PowerUI;->mContext:Landroid/content/Context;

invoke-virtual {v5}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;

move-result-object v5

const-string v6, "bat_sbar"

const/4 v7, 0x1

invoke-static {v5, v6, v7}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I

move-result v5

if-nez v5, :cond_15

[COLOR="Red"]#if-nez v2, :cond_15[/COLOR][/COLOR] [COLOR="Green"]<!--- Put the same condition value in the above new condition[/COLOR][/B]

.line 830
const-string v7, "PowerUI"

const-string v8, "notifyFullBatteryNotification : fail to get NotificationManager reference"

invoke-static {v7, v8}, Landroid/util/Slog;->e(Ljava/lang/String;Ljava/lang/String;)I

.line 860
:goto_14
return-void

.line 834
:cond_15
iget-object v7, p0, Lcom/android/systemui/SystemUI;->mContext:Landroid/content/Context;

- Save changes and compile and push to phone...

Disable Low Battery Notification

- Baksmali SystemUI.apk.

- Go to classes/com/android/systemui/power/ folder and open PowerUI.smali.

- Search for this method ".method showLowBatteryWarning()V" and add the blue line:

.method showLowBatteryWarning()V
.registers 20

.prologue
[B][COLOR="Blue"]return-void[/COLOR][/B]

.line 433
const-string v16, "PowerUI"

- Save changes.. smali.. push to device, fix permissions (644) and reboot

Remove cloudy overlay and improve ripple lockscreen - All Samsung Devices

This mod and guide credit goes to [MENTION=3065070]Goldieking[/MENTION] and [MENTION=3527854]dazznuts2000[/MENTION]..

It is already explained in very excellent and easy way,, so please go ahead to the main thread here and look to the tutorial and give him some thanks respect :good:

Disable Auto Scroll in Statusbar Quickpanel Toggle

This guide credits goes to [MENTION=2805784]mr.harsh[/MENTION]. Please go ahead to the main post here.

Settings menu extra hidden options

This one is explained very well by [MENTION=2312076]tkari4[/MENTION] in this post here. Make sure to hit Thanks button for him if that made your day :o