[Android General] AbrahamGC:
SIGNAL CLUSTER TO THE LEFT (WITH/WITHOUT ROMCONTROL) (ON-THE-FLY)

It's really an easy mod but I will explain how to make it on 3 ways, choose which is more easy for you.

1- With RC and working on-the-fly.

2- With RC but with UI reboot. (Will skip observer part)

3- Deleting right signal and use left always.

NOTE: RC ways will use GearUtils and in first case, GearContentObserver.

NOTE 2: Smali method also check if it's on desk mode so won't cause FC.

First way :

Nice, you choosed the "hard" way, better result :p

1- Decompile SystemUI

2- Open res\layout\system_icons.xml

You will see this:

<include android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginStart="@dimen/signal_cluster_margin_start" layout="@layout/signal_cluster_view" />

Replace with this:

<LinearLayout android:gravity="center_vertical" android:id="@+id/right_signal" android:layout_width="wrap_content" android:layout_height="fill_parent">
<include android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginStart="@dimen/signal_cluster_margin_start" layout="@layout/signal_cluster_view" />
</LinearLayout>

3- Open res\layout\notification_icon_area.xml

Directly after xmlns:android="http://schemas.android.com/apk/res/android"> add this:

<LinearLayout android:textColor="#ffffffff" android:orientation="horizontal" android:id="@+id/left_signal" android:paddingTop="5.0dip" android:layout_width="wrap_content" android:layout_height="fill_parent" android:paddingStart="0.0dip" android:paddingEnd="0.0dip" android:layout_marginStart="0.0dip" android:layout_marginEnd="-1.0dip" android:layout_alignParentStart="true">
<include android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginStart="@dimen/signal_cluster_margin_start" layout="@layout/signal_cluster_view" />
</LinearLayout>

4- Done with xml. Now open smali\com\android\systemui\statusbar\phone\StatusBar.smali

NOTE : If you already have an observer here, just add the key and the method, I can't explain since all methods are different. I will explain on clean smali.

Search # interfaces and after the latest add this:

.implements Lcom/android/wubydax/GearContentObserver$OnContentChangedListener;

Now, before return-void at makeStatusBarView()V add this :

move-object/from16 v0, p0

invoke-virtual {v0}, Lcom/android/systemui/statusbar/phone/StatusBar;->registerObserver()V

Then search this method:

inflateViews(Lcom/android/systemui/statusbar/NotificationData$Entry;Landroid/view/ViewGroup;)V

And before return-void add this :

invoke-direct {p0}, Lcom/android/systemui/statusbar/phone/StatusBar;->SignalPosition()V

Now search # virtual methods.

Before it, add this method :

.method private SignalPosition()V
.locals 7

invoke-static {}, Lcom/android/systemui/statusbar/phone/StatusBar;->isDeskMode()Z

move-result v0

if-nez v0, :cond_0

const/16 v6, 0x8

const/4 v5, 0x0

iget-object v2, p0, Lcom/android/systemui/statusbar/phone/StatusBar;->mStatusBarWindow:Lcom/android/systemui/statusbar/phone/StatusBarWindowView;

const-string v3, "left_signal"

const-string v4, "id"

invoke-static {v3, v4}, Lcom/android/wubydax/GearUtils;->getIdentifier(Ljava/lang/String;Ljava/lang/String;)I

move-result v3

invoke-virtual {v2, v3}, Lcom/android/systemui/statusbar/phone/StatusBarWindowView;->findViewById(I)Landroid/view/View;

move-result-object v0

iget-object v2, p0, Lcom/android/systemui/statusbar/phone/StatusBar;->mStatusBarWindow:Lcom/android/systemui/statusbar/phone/StatusBarWindowView;

const-string v3, "right_signal"

const-string v4, "id"

invoke-static {v3, v4}, Lcom/android/wubydax/GearUtils;->getIdentifier(Ljava/lang/String;Ljava/lang/String;)I

move-result v3

invoke-virtual {v2, v3}, Lcom/android/systemui/statusbar/phone/StatusBarWindowView;->findViewById(I)Landroid/view/View;

move-result-object v1

const-string v2, "signal_position"

const/4 v3, 0x1

invoke-static {v2, v3}, Lcom/android/wubydax/GearUtils;->getDbIntForKey(Ljava/lang/String;I)I

move-result v2

if-nez v2, :cond_1

invoke-virtual {v0, v5}, Landroid/view/View;->setVisibility(I)V

invoke-virtual {v1, v6}, Landroid/view/View;->setVisibility(I)V

:cond_0
:goto_0
return-void

:cond_1
invoke-virtual {v1, v5}, Landroid/view/View;->setVisibility(I)V

invoke-virtual {v0, v6}, Landroid/view/View;->setVisibility(I)V

goto :goto_0
.end method

And after # virtual methods just add these :

.method public onContentChanged(Ljava/lang/String;)V
.registers 3
.param p1, "key" # Ljava/lang/String;

.prologue
.line 246
const-string v0, "signal_position"

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

move-result v0

if-eqz v0, :cond_b

.line 247
invoke-direct {p0}, Lcom/android/systemui/statusbar/phone/StatusBar;->SignalPosition()V

.line 249
:cond_b
return-void
.end method

.method registerObserver()V
.registers 8

.prologue
.line 236
new-instance v3, Ljava/util/ArrayList;

invoke-direct {v3}, Ljava/util/ArrayList;-><init>()V

.line 237
.local v3, "keysList":Ljava/util/ArrayList;, "Ljava/util/ArrayList<Ljava/lang/String;>;"
const-string v4, "signal_position"

invoke-virtual {v3, v4}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z

.line 238
new-instance v1, Lcom/android/wubydax/GearContentObserver;

new-instance v4, Landroid/os/Handler;

invoke-direct {v4}, Landroid/os/Handler;-><init>()V

invoke-direct {v1, v4, p0}, Lcom/android/wubydax/GearContentObserver;-><init>(Landroid/os/Handler;Lcom/android/wubydax/GearContentObserver$OnContentChangedListener;)V

.line 239
.local v1, "gearContentObserver":Lcom/android/wubydax/GearContentObserver;
invoke-static {}, Lcom/android/systemui/SystemUIApplication;->getContext()Landroid/content/Context;

move-result-object v4

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

move-result-object v0

.line 240
.local v0, "contentResolver":Landroid/content/ContentResolver;
invoke-virtual {v3}, Ljava/util/ArrayList;->iterator()Ljava/util/Iterator;

move-result-object v4

:goto_20
invoke-interface {v4}, Ljava/util/Iterator;->hasNext()Z

move-result v5

if-eqz v5, :cond_35

invoke-interface {v4}, Ljava/util/Iterator;->next()Ljava/lang/Object;

move-result-object v2

check-cast v2, Ljava/lang/String;

.line 241
.local v2, "key":Ljava/lang/String;
invoke-static {v2}, Landroid/provider/Settings$System;->getUriFor(Ljava/lang/String;)Landroid/net/Uri;

move-result-object v5

const/4 v6, 0x0

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

goto :goto_20

.line 243
.end local v2 # "key":Ljava/lang/String;
:cond_35
return-void
.end method

Done with SystemUI.

Now for RC:

Where u want, add this :

<com.wubydax.romcontrol.v2.prefs.MyListPreference

android:title="@string/signal_positions"

android:key="signal_position"

android:defaultValue="1"

android:entryValues="@array/SignalPositionValue"

android:entries="@array/SignalPositionName" />

And this on arrays.xml :

<string-array name="SignalPositionName">

<item>Left</item>

<item>Right</item>

</string-array>

<string-array name="SignalPositionValue">

<item>0</item>

<item>1</item>

</string-array>

DONE!

Second way :

1- Decompile SystemUI

2- Open res\layout\system_icons.xml

You will see this:

<include android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginStart="@dimen/signal_cluster_margin_start" layout="@layout/signal_cluster_view" />

Replace with this:

<LinearLayout android:gravity="center_vertical" android:id="@+id/right_signal" android:layout_width="wrap_content" android:layout_height="fill_parent">
<include android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginStart="@dimen/signal_cluster_margin_start" layout="@layout/signal_cluster_view" />
</LinearLayout>

3- Open res\layout\notification_icon_area.xml

Directly after xmlns:android="http://schemas.android.com/apk/res/android"> add this:

<LinearLayout android:textColor="#ffffffff" android:orientation="horizontal" android:id="@+id/left_signal" android:paddingTop="5.0dip" android:layout_width="wrap_content" android:layout_height="fill_parent" android:paddingStart="0.0dip" android:paddingEnd="0.0dip" android:layout_marginStart="0.0dip" android:layout_marginEnd="-1.0dip" android:layout_alignParentStart="true">
<include android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginStart="@dimen/signal_cluster_margin_start" layout="@layout/signal_cluster_view" />
</LinearLayout>

4- Done with xml. Now open smali\com\android\systemui\statusbar\phone\StatusBar.smali

Then search this method:

inflateViews(Lcom/android/systemui/statusbar/NotificationData$Entry;Landroid/view/ViewGroup;)V

And before return-void add this :

invoke-direct {p0}, Lcom/android/systemui/statusbar/phone/StatusBar;->SignalPosition()V

Now search # virtual methods.

Before it, add this method :

.method private SignalPosition()V
.locals 7

invoke-static {}, Lcom/android/systemui/statusbar/phone/StatusBar;->isDeskMode()Z

move-result v0

if-nez v0, :cond_0

const/16 v6, 0x8

const/4 v5, 0x0

iget-object v2, p0, Lcom/android/systemui/statusbar/phone/StatusBar;->mStatusBarWindow:Lcom/android/systemui/statusbar/phone/StatusBarWindowView;

const-string v3, "left_signal"

const-string v4, "id"

invoke-static {v3, v4}, Lcom/android/wubydax/GearUtils;->getIdentifier(Ljava/lang/String;Ljava/lang/String;)I

move-result v3

invoke-virtual {v2, v3}, Lcom/android/systemui/statusbar/phone/StatusBarWindowView;->findViewById(I)Landroid/view/View;

move-result-object v0

iget-object v2, p0, Lcom/android/systemui/statusbar/phone/StatusBar;->mStatusBarWindow:Lcom/android/systemui/statusbar/phone/StatusBarWindowView;

const-string v3, "right_signal"

const-string v4, "id"

invoke-static {v3, v4}, Lcom/android/wubydax/GearUtils;->getIdentifier(Ljava/lang/String;Ljava/lang/String;)I

move-result v3

invoke-virtual {v2, v3}, Lcom/android/systemui/statusbar/phone/StatusBarWindowView;->findViewById(I)Landroid/view/View;

move-result-object v1

const-string v2, "signal_position"

const/4 v3, 0x1

invoke-static {v2, v3}, Lcom/android/wubydax/GearUtils;->getDbIntForKey(Ljava/lang/String;I)I

move-result v2

if-nez v2, :cond_1

invoke-virtual {v0, v5}, Landroid/view/View;->setVisibility(I)V

invoke-virtual {v1, v6}, Landroid/view/View;->setVisibility(I)V

:cond_0
:goto_0
return-void

:cond_1
invoke-virtual {v1, v5}, Landroid/view/View;->setVisibility(I)V

invoke-virtual {v0, v6}, Landroid/view/View;->setVisibility(I)V

goto :goto_0
.end method

Done with SystemUI.

Now for RC:

Where u want, add this :

<com.wubydax.romcontrol.v2.prefs.MyListPreference

android:title="@string/signal_positions"

android:key="signal_position"

android:defaultValue="1"

android:entryValues="@array/SignalPositionValue"

android:entries="@array/SignalPositionName"

app:packageNameToKill="com.android.systemui"

app:isSilent="true" />

And this on arrays.xml :

<string-array name="SignalPositionName">

<item>Left</item>

<item>Right</item>

</string-array>

<string-array name="SignalPositionValue">

<item>0</item>

<item>1</item>

</string-array>

DONE!

Third way :

1- Decompile SystemUI

2- Open res\layout\system_icons.xml

Delete this line:

<include android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginStart="@dimen/signal_cluster_margin_start" layout="@layout/signal_cluster_view" />

3- Open res\layout\notification_icon_area.xml

Directly after xmlns:android="http://schemas.android.com/apk/res/android"> add this:

<LinearLayout android:textColor="#ffffffff" android:orientation="horizontal" android:id="@+id/left_signal" android:paddingTop="5.0dip" android:layout_width="wrap_content" android:layout_height="fill_parent" android:paddingStart="0.0dip" android:paddingEnd="0.0dip" android:layout_marginStart="0.0dip" android:layout_marginEnd="-1.0dip" android:layout_alignParentStart="true">
<include android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginStart="@dimen/signal_cluster_margin_start" layout="@layout/signal_cluster_view" />
</LinearLayout>

DONE!

I hope everybody can move they signal icons :cool:
​