[Samsung Epic 4G Touch] tdunham:
Extended Toggles Mod

Special thanks go out to Wanam, the creator of the extended toggles that we use and also to Rujelus22 and Sleshepic for porting this over and maintaining the original thread found here:

http://xdaforums.com/showthread.php?t=1706398

Please check there for the stock compiled versions of this mod.

First of all, you may notice there is extra code listed in the before & afters. Where I could have used one line to explain the changes, I preferred to include surrounding code so that this can be easily ported over to different platforms. Most of the code changes are a single value or condition change.

You will need to add both Wanam folders to the SystemUI.apk included in the source zip file at the bottom of this post before recompiling the classes.dex file for SystemUI.apk. The modified (decompiled) PhoneStatusBar.smali is included in the zip file.

Also included are the support files necessary for the extended toggles to run. The support files are already compiled and need to go into their respective app or framework system folders.

Systemui.apk

res/values/ids.xml

Add new line :

<item type="id" name="exp_power_stat">false</item>

res/values/public.xml

Add new line:

<public type="id" name="exp_power_stat" id="0x7f0f00e2" />

res/layout/tw_status_bar_expanded.xml (new line 8)

Before:

xmlns:systemui="http://schemas.android.com/apk/res/com.android.systemui">
<LinearLayout android:orientation="horizontal" android:id="@id/quicksetting_container" android:layout_width="fill_parent" android:layout_height="wrap_content">

After:

xmlns:systemui="http://schemas.android.com/apk/res/com.android.systemui">
<com.android.wanam.systemui.StBar.PowerWidget android:id="@id/exp_power_stat" android:layout_width="fill_parent" android:layout_height="wrap_content" />
<LinearLayout android:orientation="horizontal" android:id="@id/quicksetting_container" android:layout_width="fill_parent" android:layout_height="wrap_content">

Systemui - Classes.dex

/com/android/systemui/phone/statusbar/phone/PhoneStatusBar.smali

Line 219

Before:

.field mPostCollapseCleanup:Ljava/lang/Runnable;

.field private mPropFactor:Ljava/lang/Float;

After:

.field mPostCollapseCleanup:Ljava/lang/Runnable;

.field mPowerWidget:Lcom/android/wanam/systemui/StBar/PowerWidget;

.field private mPropFactor:Ljava/lang/Float;

Line 2955

Before:

invoke-virtual {v1, v0, p3, v2}, Landroid/widget/LinearLayout;->addView(Landroid/view/View;ILandroid/view/ViewGroup$LayoutParams;)V

.line 776

After:

invoke-virtual {v1, v0, p3, v2}, Landroid/widget/LinearLayout;->addView(Landroid/view/View;ILandroid/view/ViewGroup$LayoutParams;)V

iget-object v1, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mPowerWidget:Lcom/android/wanam/systemui/StBar/PowerWidget;

invoke-virtual {v1}, Lcom/android/wanam/systemui/StBar/PowerWidget;->updateWidget()V

.line 776

Line 6886

Before:

sget-boolean v21, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->useTouchWizGUI:Z

if-eqz v21, :cond_655

.line 365

After:

sget-boolean v21, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->useTouchWizGUI:Z

if-eqz v21, :cond_66d

.line 365

Line 6959

Before:

sget-boolean v21, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->useTouchWizGUI:Z

if-eqz v21, :cond_666

.line 394
const v21, 0x7f030022

After:

sget-boolean v21, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->useTouchWizGUI:Z

if-eqz v21, :cond_67e

.line 394
const v21, 0x7f030022

Line 7045

Before:

invoke-virtual/range {v21 .. v22}, Lcom/android/systemui/statusbar/phone/NavigationBarView;->setDisabledFlags(I)V
:try_end_b1
.catch Landroid/os/RemoteException; {:try_start_81 .. :try_end_b1} :catch_6b1

.line 416

After:

invoke-virtual/range {v21 .. v22}, Lcom/android/systemui/statusbar/phone/NavigationBarView;->setDisabledFlags(I)V
:try_end_b1
.catch Landroid/os/RemoteException; {:try_start_81 .. :try_end_b1} :catch_6c9

.line 416

Line 7329

Before:

iput-object v0, v1, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mScrollView:Landroid/widget/ScrollView;

.line 439
sget-boolean v21, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->useTouchWizGUI:Z

if-eqz v21, :cond_677

.line 440

After:

iput-object v0, v1, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mScrollView:Landroid/widget/ScrollView;

.line 439
const v21, 0x7f0f00e2

move/from16 v0, v21

invoke-virtual {v4, v0}, Lcom/android/systemui/statusbar/phone/ExpandedView;->findViewById(I)Landroid/view/View;

move-result-object v21

check-cast v21, Lcom/android/wanam/systemui/StBar/PowerWidget;

move-object/from16 v0, v21

move-object/from16 v1, p0

iput-object v0, v1, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mPowerWidget:Lcom/android/wanam/systemui/StBar/PowerWidget;

sget-boolean v21, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->useTouchWizGUI:Z

if-eqz v21, :cond_68f

.line 440

Line 7465

Before:

iput-object v0, v1, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mExpandedContents:Landroid/view/View;

.line 453
:goto_23c
new-instance v21, Lcom/android/systemui/statusbar/phone/PhoneStatusBar$MyTicker;

After:

iput-object v0, v1, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mExpandedContents:Landroid/view/View;

.line 453
:goto_24d
new-instance v21, Lcom/android/systemui/statusbar/phone/PhoneStatusBar$MyTicker;

Line 7513

Before:

sget-boolean v21, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->useTouchWizGUI:Z

if-eqz v21, :cond_696

.line 460
const v21, 0x7f03002a

After:

sget-boolean v21, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->useTouchWizGUI:Z

if-eqz v21, :cond_6ae

.line 460
const v21, 0x7f03002a

Line 7536

Before:

iput-object v0, v1, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mTrackingView:Lcom/android/systemui/statusbar/phone/TrackingView;

.line 466
:goto_27f
move-object/from16 v0, p0

After:

iput-object v0, v1, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mTrackingView:Lcom/android/systemui/statusbar/phone/TrackingView;

.line 466
:goto_290
move-object/from16 v0, p0

Line 7700

Before:

sget-boolean v21, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->useTouchWizGUI:Z

if-eqz v21, :cond_36b

.line 492
move-object/from16 v0, p0

After:

sget-boolean v21, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->useTouchWizGUI:Z

if-eqz v21, :cond_37c

.line 492
move-object/from16 v0, p0

Line 7766

Before:

move/from16 v1, v23

if-ne v0, v1, :cond_6ad

const/16 v21, 0x0

:goto_364
move-object/from16 v0, v22

move/from16 v1, v21

invoke-virtual {v0, v1}, Landroid/widget/TextView;->setVisibility(I)V

.line 502
:cond_36b
new-instance v21, Lcom/android/systemui/statusbar/policy/NetworkController;

After:

move/from16 v1, v23

if-ne v0, v1, :cond_6c5

const/16 v21, 0x0

:goto_375
move-object/from16 v0, v22

move/from16 v1, v21

invoke-virtual {v0, v1}, Landroid/widget/TextView;->setVisibility(I)V

.line 502
:cond_37c
new-instance v21, Lcom/android/systemui/statusbar/policy/NetworkController;

Line 7934

Before:

sget-boolean v21, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->useTouchWizGUI:Z

if-eqz v21, :cond_57a

.line 536
const v21, 0x7f0f00ba

After:

sget-boolean v21, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->useTouchWizGUI:Z

if-eqz v21, :cond_58b

.line 536
const v21, 0x7f0f00ba

Line 8316

Before:

.end local v13 #mWifi:Lcom/android/systemui/statusbar/policy/WifiController;
:cond_57a
const v21, 0x7f07000e

After:

.end local v13 #mWifi:Lcom/android/systemui/statusbar/policy/WifiController;
:cond_58b
const v21, 0x7f07000e

Line 8339

Before:

move/from16 v21, v0

if-eqz v21, :cond_5bb

.line 589
invoke-direct/range {p0 .. p0}, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->checkAutoBrightNess()Z

After:

move/from16 v21, v0

if-eqz v21, :cond_5cc

.line 589
invoke-direct/range {p0 .. p0}, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->checkAutoBrightNess()Z

Line 8382

Before:

invoke-direct/range {p0 .. p0}, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->updatePropFactorValue()V

.line 596
:cond_5bb
const v21, 0x7f070007

After:

invoke-direct/range {p0 .. p0}, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->updatePropFactorValue()V

.line 596
:cond_5cc
const v21, 0x7f070007

Line 8407

Before:

move/from16 v21, v0

if-eqz v21, :cond_613

.line 598
new-instance v15, Landroid/widget/LinearLayout$LayoutParams;

After:

move/from16 v21, v0

if-eqz v21, :cond_624

.line 598
new-instance v15, Landroid/widget/LinearLayout$LayoutParams;

Line 8476

Before:

.end local v15 #params:Landroid/widget/LinearLayout$LayoutParams;
:cond_613
const v21, 0x7f070009

After:

.end local v15 #params:Landroid/widget/LinearLayout$LayoutParams;
:cond_624
const v21, 0x7f070009

Line 8494

Before:

iput-boolean v0, v1, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mUseStatusBarMarquee:Z

.line 612

After:

iput-boolean v0, v1, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mUseStatusBarMarquee:Z

iget-object v0, v1, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mPowerWidget:Lcom/android/wanam/systemui/StBar/PowerWidget;

move-object/from16 v1, v0

invoke-virtual {v1}, Lcom/android/wanam/systemui/StBar/PowerWidget;->setupWidget()V

.line 612

Line 8556

Before:

.end local v20 #tickerView:Lcom/android/systemui/statusbar/phone/TickerView;
:cond_655
const v21, 0x7f030008

After:

.end local v20 #tickerView:Lcom/android/systemui/statusbar/phone/TickerView;
:cond_66d
const v21, 0x7f030008

Line 8577

Before:

.restart local v17 #sb:Lcom/android/systemui/statusbar/phone/PhoneStatusBarView;
:cond_666
const v21, 0x7f030006

After:

.restart local v17 #sb:Lcom/android/systemui/statusbar/phone/PhoneStatusBarView;
:cond_67e
const v21, 0x7f030006

Line 8595

Before:

goto/16 :goto_75

.line 448
:cond_677
const v21, 0x7f0f0044

After:

goto/16 :goto_75

.line 448
:cond_68f
const v21, 0x7f0f0044

Line 8626

Before:

iput-object v0, v1, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mExpandedContents:Landroid/view/View;

goto/16 :goto_23c

.line 462
.restart local v20 #tickerView:Lcom/android/systemui/statusbar/phone/TickerView;
:cond_696
const v21, 0x7f03001e

After:

iput-object v0, v1, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mExpandedContents:Landroid/view/View;

goto/16 :goto_24d

.line 462
.restart local v20 #tickerView:Lcom/android/systemui/statusbar/phone/TickerView;
:cond_6ae
const v21, 0x7f03001e

Line 8651

Before:

iput-object v0, v1, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mTrackingView:Lcom/android/systemui/statusbar/phone/TrackingView;

goto/16 :goto_27f

.line 495
:cond_6ad
const/16 v21, 0x8

goto/16 :goto_364

.line 411
.end local v20 #tickerView:Lcom/android/systemui/statusbar/phone/TickerView;
:catch_6b1
move-exception v21

After:

iput-object v0, v1, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mTrackingView:Lcom/android/systemui/statusbar/phone/TrackingView;

goto/16 :goto_290

.line 495
:cond_6c5
const/16 v21, 0x8

goto/16 :goto_375

.line 411
.end local v20 #tickerView:Lcom/android/systemui/statusbar/phone/TickerView;
:catch_6c9
move-exception v21