Android OS Forum banner
1 - 1 of 1 Posts

·
Premium Member
Joined
·
1,155 Posts
Discussion Starter · #1 ·
More or less set out to try this just to see if I can do it, and it so happens the possibilities are endless!

This is specifically for the Vibrant, but I can imagine there would be little modifications for other phones.

Here's how to do it:

  1. decompile services.jar
  2. open com/android/server/status/StatusBarPolicy.smali
  3. do the edits below
  4. compile
  5. push/flash

Find (around line 690)
Code:
    .line 530<br />
    const-string v3, "phone_signal"
then comment (or remove) the following two lines out, and add these:
Code:
    const-string v4, ""<br />
	<br />
    invoke-static {v3, v4}, Lcom/android/server/status/IconData;->makeText(Ljava/lang/String;Ljava/lang/CharSequence;)Lcom/android/server/status/IconData;
here's what my final block of code looks like
Code:
    .line 530<br />
    const-string v3, "phone_signal"<br />
<br />
    # const v4, 0x10802fe<br />
<br />
    # invoke-static {v3, v7, v4, v6, v6}, Lcom/android/server/status/IconData;->makeIcon(Ljava/lang/String;Ljava/lang/String;III)Lcom/android/server/status/IconData;<br />
<br />
    const-string v4, ""<br />
	<br />
    invoke-static {v3, v4}, Lcom/android/server/status/IconData;->makeText(Ljava/lang/String;Ljava/lang/CharSequence;)Lcom/android/server/status/IconData;<br />
<br />
    move-result-object v3<br />
<br />
    iput-object v3, p0, Lcom/android/server/status/StatusBarPolicy;->mPhoneData:Lcom/android/server/status/IconData;<br />
<br />
    .line 532<br />
    iget-object v3, p0, Lcom/android/server/status/StatusBarPolicy;->mPhoneData:Lcom/android/server/status/IconData;
k that takes care of changing what type of image it is, next we replace the updateSignalStrength() method


starts on line 5368 for me

Code:
.method private final updateSignalStrength()V<br />
    .registers 7<br />
<br />
    .prologue<br />
    const/4 v5, 0x0<br />
<br />
    .line 1314<br />
    const/4 v0, -0x1<br />
<br />
    iget-object v2, p0, Lcom/android/server/status/StatusBarPolicy;->mServiceState:Landroid/telephony/ServiceState;<br />
<br />
    if-eqz v2, :cond_35<br />
<br />
    iget-object v2, p0, Lcom/android/server/status/StatusBarPolicy;->mServiceState:Landroid/telephony/ServiceState;<br />
<br />
    invoke-virtual {v2}, Landroid/telephony/ServiceState;->isEmergencyOnly()Z<br />
<br />
    move-result v2<br />
<br />
    if-nez v2, :cond_35<br />
<br />
    .line 1320<br />
    iget-object v2, p0, Lcom/android/server/status/StatusBarPolicy;->mContext:Landroid/content/Context;<br />
<br />
    invoke-virtual {v2}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;<br />
<br />
    move-result-object v2<br />
<br />
    const-string v3, "airplane_mode_on"<br />
<br />
    const/4 v4, 0x0<br />
<br />
    invoke-static {v2, v3, v4}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I<br />
<br />
    move-result v2<br />
<br />
    const/4 v3, 0x1<br />
<br />
    # flight mode is on<br />
    if-ne v2, v3, :cond_3d<br />
<br />
    .line 1322<br />
    iget-object v2, p0, Lcom/android/server/status/StatusBarPolicy;->mPhoneData:Lcom/android/server/status/IconData;<br />
	<br />
    const-string v3, " fl "<br />
	<br />
    iput-object v3, v2, Lcom/android/server/status/IconData;->text:Ljava/lang/CharSequence;<br />
	<br />
    .line 1326<br />
    :goto_2b<br />
    iget-object v2, p0, Lcom/android/server/status/StatusBarPolicy;->mService:Lcom/android/server/status/StatusBarService;<br />
<br />
    iget-object v3, p0, Lcom/android/server/status/StatusBarPolicy;->mPhoneIcon:Landroid/os/IBinder;<br />
<br />
    iget-object v4, p0, Lcom/android/server/status/StatusBarPolicy;->mPhoneData:Lcom/android/server/status/IconData;<br />
<br />
    const v5, 0x0<br />
	<br />
    invoke-virtual {v2, v3, v4, v5}, Lcom/android/server/status/StatusBarService;->updateIcon(Landroid/os/IBinder;Lcom/android/server/status/IconData;Lcom/android/server/status/NotificationData;)V<br />
	<br />
    .line 1373<br />
	:cond_34<br />
    return-void<br />
<br />
    .line 1324<br />
    :cond_35<br />
    iget-object v2, p0, Lcom/android/server/status/StatusBarPolicy;->mPhoneData:Lcom/android/server/status/IconData;<br />
	<br />
    # no service or signal<br />
    const-string v3, " X "<br />
	<br />
    iput-object v3, v2, Lcom/android/server/status/IconData;->text:Ljava/lang/CharSequence;<br />
<br />
    goto :goto_2b<br />
<br />
    .line 1330<br />
    :cond_3d<br />
	<br />
    # check if there's a signal<br />
    .line 1318<br />
    invoke-direct {p0}, Lcom/android/server/status/StatusBarPolicy;->hasService()Z<br />
<br />
    move-result v3<br />
<br />
    if-eqz v3, :cond_35<br />
	<br />
    # ok there's signal, do something<br />
	<br />
    new-instance v5, Ljava/lang/StringBuilder;<br />
<br />
    invoke-direct {v5}, Ljava/lang/StringBuilder;-><init>()V<br />
	<br />
    # add minus sign<br />
    const-string v1, "-"<br />
	<br />
    invoke-virtual {v5, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;<br />
	<br />
    move-result-object v5<br />
	<br />
    iget-object v0, p0, Lcom/android/server/status/StatusBarPolicy;->mSignalStrength:Landroid/telephony/SignalStrength;<br />
	<br />
    invoke-virtual {v0}, Landroid/telephony/SignalStrength;->getGsmSignalStrength()I<br />
	<br />
    move-result v0<br />
	<br />
    const v3, 0x2<br />
	<br />
    mul-int v4, v0, v3<br />
	<br />
    const v3, 0x71<br />
	<br />
    sub-int v0, v3, v4<br />
	<br />
    invoke-virtual {v5, v0}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;<br />
	<br />
    move-result-object v5<br />
	<br />
    # add extra padding<br />
    const-string v1, " "<br />
	<br />
    invoke-virtual {v5, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;<br />
	<br />
    move-result-object v5<br />
	<br />
    invoke-virtual {v5}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;<br />
<br />
    move-result-object v5<br />
	<br />
    iget-object v2, p0, Lcom/android/server/status/StatusBarPolicy;->mPhoneData:Lcom/android/server/status/IconData;<br />
	<br />
    iput-object v5, v2, Lcom/android/server/status/IconData;->text:Ljava/lang/CharSequence;<br />
<br />
    goto :goto_2b<br />
.end method
If you look, you can see I manually added a couple of strings towards the very bottom, like the minus sign and a space afterwords. You can customize it to say what you want (maybe if you want it to say dBm)

Note: I basically rewrote the whole method, and I took the non-GSM stuff out of there, so if any of you Epic/Fascinate/Other guys want to do it (by chance), be sure to give me a holler if you're lost. Also, you can display the asu instead if you want, the dBm is actually calculated from it (asu*2) - 113, so you would just comment out a couple lines.



The attached smali already has edits for clock toggle/ampm toggle

BT, out

(battery percentage next? watch out jocelyn!)
 
1 - 1 of 1 Posts
Top