[Vibrant Android Development] untermensch:
s0niqu3 brought it to my attention how much the status bar bluetooth toggle

sucked so I changed the onClick method to toggle the bluetooth state instead

of opening settings to the bluetooth page

this is the replacement method for com/android/server/status/StatusBarService$31

which is in the services file in framework.

.method public onClick(Landroid/view/View;)V
.registers 7
.parameter "v"

.prologue
const-string v1, "StatusBar"

iget-object v3, p0, Lcom/android/server/status/StatusBarService$31;->this$0:Lcom/android/server/status/StatusBarService;

iget-object v3, v3, Lcom/android/server/status/StatusBarService;->mContentResolver:Landroid/content/ContentResolver;

const-string v4, "airplane_mode_on"

const/4 v5, 0x0

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

move-result v2

if-nez v2, :exit

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

move-result-object v0

if-eqz v0, :exit

const/4 v5, 0x1

const-string v3, "bluetooth"

invoke-static {v3}, Landroid/os/ServiceManager;->checkService(Ljava/lang/String;)Landroid/os/IBinder;

move-result-object v3

invoke-static {v3}, Landroid/bluetooth/IBluetooth$Stub;->asInterface(Landroid/os/IBinder;)Landroid/bluetooth/IBluetooth;

move-result-object v2

invoke-interface {v2}, Landroid/bluetooth/IBluetooth;->getBluetoothState()I

move-result v3

const/16 v4, 0xc

if-ne v3, v4, :toggleOn

:toggleOff

const-string v4, "Disabling Bluetooth"

invoke-static {v1, v4}, Landroid/util/Log;->w(Ljava/lang/String;Ljava/lang/String;)I

invoke-interface {v2, v5}, Landroid/bluetooth/IBluetooth;->disable(Z)Z

goto :exit

:toggleOn

const/16 v4, 0xa

if-ne v3, v4, :exit

const-string v4, "Enabling Bluetooth"

invoke-static {v1, v4}, Landroid/util/Log;->w(Ljava/lang/String;Ljava/lang/String;)I

invoke-interface {v2, v5}, Landroid/bluetooth/IBluetooth;->enable(Z)Z

:exit

return-void

.end method

I added flashables to this post use the stock updater to install, these should

be compatible with any JI6 based ROM because I don't think there are a lot

of mods for /system/framework/services.*. I also killed the battery full notification.

EDIT:

added 3 state toggle to the silent button so now you can toggle from Ringer on --> Vibrate --> Silent

below is the replacement onClick method com/android/server/status/StatusBarService$33

which is in the services file in framework.

.method public onClick(Landroid/view/View;)V
.registers 7
.parameter "v"

.prologue
const/4 v2, 0x0

const/4 v3, 0x1

const/4 v4, 0x2

.line 3641
iget-object v0, p0, Lcom/android/server/status/StatusBarService$33;->this$0:Lcom/android/server/status/StatusBarService;

iget-boolean v0, v0, Lcom/android/server/status/StatusBarService;->mSilentStatus:Z

if-nez v0, :cond_10

.line 3642
iget-object v0, p0, Lcom/android/server/status/StatusBarService$33;->this$0:Lcom/android/server/status/StatusBarService;

iget-object v0, v0, Lcom/android/server/status/StatusBarService;->mContentResolver:Landroid/content/ContentResolver;

const-string v1, "driving_mode_on"

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

.line 3646
:cond_10
iget-object v0, p0, Lcom/android/server/status/StatusBarService$33;->this$0:Lcom/android/server/status/StatusBarService;

iget-object v0, v0, Lcom/android/server/status/StatusBarService;->mContext:Landroid/content/Context;

const-string v1, "audio"

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

move-result-object v0

check-cast v0, Landroid/media/AudioManager;

iget-object v1, p0, Lcom/android/server/status/StatusBarService$33;->this$0:Lcom/android/server/status/StatusBarService;

iget v1, v1, Lcom/android/server/status/StatusBarService;->mSoundProfile:I

if-eqz v1, :ringerOn

if-eq v1, v4, :vibrate

if-eq v1, v3, :ringerOff

:ringerOn

move v1, v4

:goto_23
invoke-virtual {v0, v1}, Landroid/media/AudioManager;->setRingerMode(I)V

.line 3648
return-void

:ringerOff

move v1, v2

goto :goto_23

:vibrate

iget-object v1, p0, Lcom/android/server/status/StatusBarService$33;->this$0:Lcom/android/server/status/StatusBarService;

iget-object v1, v1, Lcom/android/server/status/StatusBarService;->mContext:Landroid/content/Context;

const-string v2, "vibrator"

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

move-result-object v1

check-cast v1, Landroid/os/Vibrator;

const-wide/16 v2, 0x32

invoke-virtual {v1, v2, p3}, Landroid/os/Vibrator;->vibrate(J)V

const/4 v1, 0x1

goto :goto_23

.end method

replacement method for StatusBarService.smali, this enables the 3 icons for the silent button.

you also have to add the image resource to twframework-res.apk and a line in public.xml

<public type="drawable" name="quick_panel_icon_vibrate" id="0x020200d8" />

.method private prepareQuickPanelSettingIcon(I)V
.registers 7
.parameter "mask"

.prologue
.line 1344
const/4 v2, 0x0

.line 1345
.local v2, textColor:I
const/4 v0, 0x0

.line 1346
.local v0, btnTextView:Landroid/widget/TextView;
const/4 v1, 0x0

.line 1348
.local v1, settingIcon:Landroid/graphics/drawable/Drawable;
packed-switch p1, :pswitch_data_c6

.line 1400
:goto_6
:pswitch_6
invoke-direct {p0, v0, v1, v2}, Lcom/android/server/status/StatusBarService;->updateQuickPanelSettingIcon(Landroid/widget/TextView;Landroid/graphics/drawable/Drawable;I)V

.line 1401
return-void

.line 1350
:pswitch_a
iget-object v0, p0, Lcom/android/server/status/StatusBarService;->mWiFiBtn:Landroid/widget/TextView;

.line 1352
iget-boolean v3, p0, Lcom/android/server/status/StatusBarService;->mWiFiStatus:Z

if-eqz v3, :cond_2a

.line 1353
iget-object v3, p0, Lcom/android/server/status/StatusBarService;->mContext:Landroid/content/Context;

invoke-virtual {v3}, Landroid/content/Context;->getResources()Landroid/content/res/Resources;

move-result-object v3

const v4, 0x2020062

invoke-virtual {v3, v4}, Landroid/content/res/Resources;->getDrawable(I)Landroid/graphics/drawable/Drawable;

move-result-object v1

.line 1354
const v2, -0xff8b34

.line 1355
iget-object v3, p0, Lcom/android/server/status/StatusBarService;->mWiFiBtn:Landroid/widget/TextView;

const-string v4, "WI-FI(ON)"

invoke-virtual {v3, v4}, Landroid/widget/TextView;->setText(Ljava/lang/CharSequence;)V

.line 1360
:goto_27
iget-object v0, p0, Lcom/android/server/status/StatusBarService;->mWiFiBtn:Landroid/widget/TextView;

.line 1361
goto :goto_6

.line 1357
:cond_2a
iget-object v3, p0, Lcom/android/server/status/StatusBarService;->mContext:Landroid/content/Context;

invoke-virtual {v3}, Landroid/content/Context;->getResources()Landroid/content/res/Resources;

move-result-object v3

const v4, 0x202005f

invoke-virtual {v3, v4}, Landroid/content/res/Resources;->getDrawable(I)Landroid/graphics/drawable/Drawable;

move-result-object v1

.line 1358
const/4 v2, -0x1

goto :goto_27

.line 1364
:pswitch_39
iget-object v0, p0, Lcom/android/server/status/StatusBarService;->mBTBtn:Landroid/widget/TextView;

.line 1366
iget-boolean v3, p0, Lcom/android/server/status/StatusBarService;->mBTStatus:Z

if-eqz v3, :cond_50

.line 1367
iget-object v3, p0, Lcom/android/server/status/StatusBarService;->mContext:Landroid/content/Context;

invoke-virtual {v3}, Landroid/content/Context;->getResources()Landroid/content/res/Resources;

move-result-object v3

const v4, 0x202005d

invoke-virtual {v3, v4}, Landroid/content/res/Resources;->getDrawable(I)Landroid/graphics/drawable/Drawable;

move-result-object v1

.line 1368
const v2, -0xff8b34

goto :goto_6

.line 1370
:cond_50
iget-object v3, p0, Lcom/android/server/status/StatusBarService;->mContext:Landroid/content/Context;

invoke-virtual {v3}, Landroid/content/Context;->getResources()Landroid/content/res/Resources;

move-result-object v3

const v4, 0x202005c

invoke-virtual {v3, v4}, Landroid/content/res/Resources;->getDrawable(I)Landroid/graphics/drawable/Drawable;

move-result-object v1

.line 1371
const/4 v2, -0x1

.line 1373
goto :goto_6

.line 1376
:pswitch_5f
iget-object v0, p0, Lcom/android/server/status/StatusBarService;->mSoundBtn:Landroid/widget/TextView;

.line 1378
iget v3, p0, Lcom/android/server/status/StatusBarService;->mSoundProfile:I

const/4 v2, 0x2

if-eq v3, v2, :cond_8c

const/4 v2, 0x1

if-eq v3, v2, :cond_7a

.line 1379
iget-object v3, p0, Lcom/android/server/status/StatusBarService;->mContext:Landroid/content/Context;

invoke-virtual {v3}, Landroid/content/Context;->getResources()Landroid/content/res/Resources;

move-result-object v3

const v4, 0x20200b3

invoke-virtual {v3, v4}, Landroid/content/res/Resources;->getDrawable(I)Landroid/graphics/drawable/Drawable;

move-result-object v1

.line 1380
const v2, -0xff8b34

goto :goto_6

:cond_7a
iget-object v3, p0, Lcom/android/server/status/StatusBarService;->mContext:Landroid/content/Context;

invoke-virtual {v3}, Landroid/content/Context;->getResources()Landroid/content/res/Resources;

move-result-object v3

const v4, 0x20200d8

invoke-virtual {v3, v4}, Landroid/content/res/Resources;->getDrawable(I)Landroid/graphics/drawable/Drawable;

move-result-object v1

.line 1380
const v2, -0xff8b34

goto/16 :goto_6

.line 1382
:cond_8c
iget-object v3, p0, Lcom/android/server/status/StatusBarService;->mContext:Landroid/content/Context;

invoke-virtual {v3}, Landroid/content/Context;->getResources()Landroid/content/res/Resources;

move-result-object v3

const v4, 0x20200b2

invoke-virtual {v3, v4}, Landroid/content/res/Resources;->getDrawable(I)Landroid/graphics/drawable/Drawable;

move-result-object v1

.line 1383
const/4 v2, -0x1

.line 1385
goto/16 :goto_6

.line 1388
:pswitch_9c
iget-object v0, p0, Lcom/android/server/status/StatusBarService;->mGpsBtn:Landroid/widget/TextView;

.line 1390
iget-boolean v3, p0, Lcom/android/server/status/StatusBarService;->mGpsStatus:Z

if-eqz v3, :cond_b4

.line 1391
iget-object v3, p0, Lcom/android/server/status/StatusBarService;->mContext:Landroid/content/Context;

invoke-virtual {v3}, Landroid/content/Context;->getResources()Landroid/content/res/Resources;

move-result-object v3

const v4, 0x202005e

invoke-virtual {v3, v4}, Landroid/content/res/Resources;->getDrawable(I)Landroid/graphics/drawable/Drawable;

move-result-object v1

.line 1392
const v2, -0xff8b34

goto/16 :goto_6

.line 1394
:cond_b4
iget-object v3, p0, Lcom/android/server/status/StatusBarService;->mContext:Landroid/content/Context;

invoke-virtual {v3}, Landroid/content/Context;->getResources()Landroid/content/res/Resources;

move-result-object v3

const v4, 0x20200b4

invoke-virtual {v3, v4}, Landroid/content/res/Resources;->getDrawable(I)Landroid/graphics/drawable/Drawable;

move-result-object v1

.line 1395
const/4 v2, -0x1

goto/16 :goto_6

.line 1348
nop

nop

:pswitch_data_c6
.packed-switch 0x1
:pswitch_a
:pswitch_39
:pswitch_6
:pswitch_5f
:pswitch_6
:pswitch_6
:pswitch_6
:pswitch_9c
.end packed-switch
.end method