[Samsung Galaxy S 5 Unified Development] talkingmonkeys:
Couple Status Bar Icon Toggles I'll share. Thanks to [MENTION=1016795]loserskater[/MENTION] for his guides pointing me in the right direction. Also to [MENTION=3065070]Goldie[/MENTION] for the smali guide. And a little bit of digging through [MENTION=1042140]tdunham[/MENTION] and [MENTION=1167171]rompnit[/MENTION]'s SystemUI from MOAR. I've gotten their permission to post these guides and I plan to expand upon it. Figured I'd give it its own thread too.

Add Toggle On/Off for Alarm Icon

First you will want to increase .locals by 1. Mine was .locals 5 and I changed it to .locals 6 for this. The basic idea when doing these is that you need to look at the locals you have right now. They are always 1 higher than what the highest value or v in the method is. Noting this so that this can be done on other devices besides the S5 in case code has changed and the values.

For a quick example of what values you need for the new code we're adding. We will look at what I've done with this alarm on/off toggle. We are adding 2 new values so look at the locals now. Look at the method and see what the highest value is. Where I have v4 in all the lines we're adding you will be putting it 1 value (v) higher than what the highest one in the file is. Next is the string for the toggle itself in this case it is const-string v5, "statusbar_hide_alarm". This is you key that the toggle runs off of. It will need to be 1 higher than the others. Next you will see this line with 3 values. v4 which we just went over is the first value. Then v5 which is the key will be second. And lastly v1 which is going to always be from the setIconVisibility line that was originally in the code where we are modifying to add the toggle. In this case. "invoke-virtual {v2, v3, v1}, Landroid/app/StatusBarManager;->setIconVisibility(Ljava/lang/String;Z)V" As you can see it is v1 in that line so you will place it last in the getInt line and replace it in the const/4 v1, 0x0 near the end of what we're adding.

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

As far as the cond (condition) lines go you can make them :condtm or whatever you want as long as the condition isn't already used in the method. Similar to the values.​

In SystemUI.apk edit com/android/statusbar/phone/StatusBarPhonePolicy.smali

Search for .method private updateAlarm()V

Add lines in blue. Change lines in green.

.method private updateAlarm()V
[COLOR="Green"].locals 6[/COLOR]

.prologue
.line 221
iget-object v2, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBarPolicy;->mContext:Landroid/content/Context;

const-string v3, "alarm"

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

move-result-object v0

check-cast v0, Landroid/app/AlarmManager;

.line 222
.local v0, "alarmManager":Landroid/app/AlarmManager;
const/4 v2, -0x2

invoke-virtual {v0, v2}, Landroid/app/AlarmManager;->getNextAlarmClock(I)Landroid/app/AlarmManager$AlarmClockInfo;

move-result-object v2

if-eqz v2, :cond_0

const/4 v1, 0x1

.line 223
.local v1, "alarmSet":Z
:goto_0
[COLOR="Blue"]iget-object v4, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBarPolicy;->mContext:Landroid/content/Context;

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

move-result-object v4

const-string v5, "statusbar_hide_alarm"

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

move-result v4

if-nez v4, :cond_tm

const/4 v1, 0x0

:cond_tm[/COLOR]
iget-object v2, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBarPolicy;->mService:Landroid/app/StatusBarManager;

const-string v3, "alarm_clock"

invoke-virtual {v2, v3, v1}, Landroid/app/StatusBarManager;->setIconVisibility(Ljava/lang/String;Z)V

.line 224
return-void

.line 222
.end local v1 # "alarmSet":Z
:cond_0
const/4 v1, 0x0

goto :goto_0
.end method

In your CustomSettings.apk add this line to preferences.xml where you want the toggle to appear.

<CheckBoxPreference android:title="Hide Alarm Icon" android:key="statusbar_hide_alarm" android:summaryOn="Alarm icon is visible." android:summaryOff="Alarm icon is hidden." />

Add Toggle On/Off for Bluetooth Icon

In SystemUI.apk edit com/android/statusbar/phone/StatusBarPhonePolicy.smali

First you will want to increase .locals by 2 because we are adding 2 new values. Mine was .locals 6 and I changed it to .locals 8 for this. The basic idea when doing these is that you need to look at the locals you have right now. They are always 1 higher than what the highest value or v in the method is. Noting this so that this can be done on other devices besides the S5 in case code has changed and the values.

.method private final updateBluetooth()V
[COLOR="green"].locals 8[/COLOR]

.prologue
const/4 v4, 0x0

.line 393
invoke-static {}, Landroid/bluetooth/BluetoothAdapter;->getDefaultAdapter()Landroid/bluetooth/BluetoothAdapter;

move-result-object v0

.line 394
.local v0, "adapter":Landroid/bluetooth/BluetoothAdapter;
const v2, 0x7f0202a8

.line 395
.local v2, "iconId":I
iget-object v3, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBarPolicy;->mContext:Landroid/content/Context;

const v5, 0x7f0c020a

invoke-virtual {v3, v5}, Landroid/content/Context;->getString(I)Ljava/lang/String;

move-result-object v1

.line 397
.local v1, "contentDescription":Ljava/lang/String;
if-eqz v0, :cond_2

.line 398
invoke-virtual {v0}, Landroid/bluetooth/BluetoothAdapter;->getState()I

move-result v3

const/16 v5, 0xc

if-ne v3, v5, :cond_1

const/4 v3, 0x1

:goto_0
iput-boolean v3, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBarPolicy;->mBluetoothEnabled:Z

.line 399
invoke-virtual {v0}, Landroid/bluetooth/BluetoothAdapter;->getConnectionState()I

move-result v3

const/4 v5, 0x2

if-ne v3, v5, :cond_0

.line 400
const v2, 0x7f0202a9

.line 401
iget-object v3, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBarPolicy;->mContext:Landroid/content/Context;

const v5, 0x7f0c0209

invoke-virtual {v3, v5}, Landroid/content/Context;->getString(I)Ljava/lang/String;

move-result-object v1

.line 407
:cond_0
:goto_1
iget-object v3, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBarPolicy;->mService:Landroid/app/StatusBarManager;

const-string v5, "bluetooth"

invoke-virtual {v3, v5, v2, v4, v1}, Landroid/app/StatusBarManager;->setIcon(Ljava/lang/String;IILjava/lang/String;)V

.line 408
iget-object v3, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBarPolicy;->mService:Landroid/app/StatusBarManager;

const-string v4, "bluetooth"

iget-boolean v5, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBarPolicy;->mBluetoothEnabled:Z

[COLOR="Blue"]iget-object v6, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBarPolicy;->mContext:Landroid/content/Context;

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

move-result-object v6

const-string v7, "statusbar_hide_bluetooth"

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

move-result v6

if-nez v6, :cond_tm

const/4 v5, 0x0

:cond_tm[/COLOR]
invoke-virtual {v3, v4, v5}, Landroid/app/StatusBarManager;->setIconVisibility(Ljava/lang/String;Z)V

.line 409
return-void

:cond_1
move v3, v4

.line 398
goto :goto_0

.line 367
:cond_2
iput-boolean v4, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBarPolicy;->mBluetoothEnabled:Z

goto :goto_1
.end method

In your CustomSettings.apk add this line to preferences.xml where you want the toggle to appear.

<CheckBoxPreference android:title="Hide Bluetooth Icon" android:key="statusbar_hide_bluetooth" android:summaryOn="Bluetooth Icon is visible." android:summaryOff="Bluetooth Icon is hidden." />