Related
I have been looking at this mod for the past 2 days and cant seem to figure out where the problem lies. I edit Settings.apk correctly and the options show correctly, the problem is that all right-side icons disappear from the status bar when "Do not display AM/PM" is unchecked. To give a little background, the mod consists of 2 mods actually - hide clock altogether and hide am/pm from the clock. The hide/unhide clock option works and the hide am/pm option works, but the show am/pm option does not work. It actually has to do with the editing of services.jar. Through testing 3 different versions, I found that the method to hide am/pm without an option of turning it on/off worked perfectly, it is only when adding the method to use the checkbox under settings that it gets borked.
These are the threads:
Method trying to implement: here
Method that worked originally but without a way to turn on/off: here
Original method that inspired the previous 2: here
This is the code that does not seem to work, if anyone has any ideas as to how to fix this, please let me know. Again, the method for hiding is fine, its the method for showing that does not work
Code:
.method private final updateClock()V
.locals 7
.prologue
.line 940
iget-object v0, p0, Lcom/android/server/status/StatusBarPolicy;->mCalendar:Ljava/util/Calendar;
invoke-static {}, Ljava/lang/System;->currentTimeMillis()J
move-result-wide v1
invoke-virtual {v0, v1, v2}, Ljava/util/Calendar;->setTimeInMillis(J)V
.line 941
iget-object v0, p0, Lcom/android/server/status/StatusBarPolicy;->mClockData:Lcom/android/server/status/IconData;
iget-object v1, p0, Lcom/android/server/status/StatusBarPolicy;->mContext:Landroid/content/Context;
invoke-static {v1}, Landroid/text/format/DateFormat;->getTimeFormat(Landroid/content/Context;)Ljava/text/DateFormat;
move-result-object v1
iget-object v2, p0, Lcom/android/server/status/StatusBarPolicy;->mCalendar:Ljava/util/Calendar;
invoke-virtual {v2}, Ljava/util/Calendar;->getTime()Ljava/util/Date;
move-result-object v2
invoke-virtual {v1, v2}, Ljava/text/DateFormat;->format(Ljava/util/Date;)Ljava/lang/String;
move-result-object v1
iget-object v4, p0, Lcom/android/server/status/StatusBarPolicy;->mContext:Landroid/content/Context;
invoke-virtual {v4}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;
move-result-object v4
const-string v2, "am_pm"
const/4 v3, 0x0
invoke-static {v4, v2, v3}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I
move-result v4
if-eqz v4, :cond_1
const-string v5, " PM"
const-string v6, ""
invoke-virtual {v1, v5, v6}, Ljava/lang/String;->replace(Ljava/lang/CharSequence;Ljava/lang/CharSequence;)Ljava/lang/String;
move-result-object v1
const-string v5, " AM"
const-string v6, ""
invoke-virtual {v1, v5, v6}, Ljava/lang/String;->replace(Ljava/lang/CharSequence;Ljava/lang/CharSequence;)Ljava/lang/String;
move-result-object v1
:goto_0
iget-object v4, p0, Lcom/android/server/status/StatusBarPolicy;->mContext:Landroid/content/Context;
invoke-virtual {v4}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;
move-result-object v4
const-string v2, "time_display"
const/4 v3, 0x1
invoke-static {v4, v2, v3}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I
move-result v4
if-nez v4, :cond_0
const-string v1, ""
:cond_0
iput-object v1, v0, Lcom/android/server/status/IconData;->text:Ljava/lang/CharSequence;
.line 942
iget-object v0, p0, Lcom/android/server/status/StatusBarPolicy;->mService:Lcom/android/server/status/StatusBarService;
iget-object v1, p0, Lcom/android/server/status/StatusBarPolicy;->mClockIcon:Landroid/os/IBinder;
iget-object v2, p0, Lcom/android/server/status/StatusBarPolicy;->mClockData:Lcom/android/server/status/IconData;
const/4 v3, 0x0
invoke-virtual {v0, v1, v2, v3}, Lcom/android/server/status/StatusBarService;->updateIcon(Landroid/os/IBinder;Lcom/android/server/status/IconData;Lcom/android/server/status/NotificationData;)V
.line 943
return-void
:cond_1
iget-object v0, p0, Lcom/android/server/status/StatusBarPolicy;->mClockData:Lcom/android/server/status/IconData;
invoke-direct {p0}, Lcom/android/server/status/StatusBarPolicy;->getSmallTime()Ljava/lang/CharSequence;
move-result-object v1
goto :goto_0
.end method
This is actually what our StatusBarPolicy.smali SHOULD look like - the original mod is for the EVO and possibly 2,2 also, and I am trying to use it on 2,1
Code:
.method private final updateClock()V
.locals 7
.prologue
.line 849
const-string v0, "persist.sys.timezone"
invoke-static {v0}, Landroid/os/SystemProperties;->get(Ljava/lang/String;)Ljava/lang/String;
move-result-object v0
invoke-static {v0}, Ljava/util/TimeZone;->getTimeZone(Ljava/lang/String;)Ljava/util/TimeZone;
move-result-object v0
invoke-static {v0}, Ljava/util/Calendar;->getInstance(Ljava/util/TimeZone;)Ljava/util/Calendar;
move-result-object v0
iget-object v0, p0, Lcom/android/server/status/StatusBarPolicy;->mCalendar:Ljava/util/Calendar;
invoke-static {}, Ljava/lang/System;->currentTimeMillis()J
move-result-wide v1
invoke-virtual {v0, v1, v2}, Ljava/util/Calendar;->setTimeInMillis(J)V
.line 941
iget-object v0, p0, Lcom/android/server/status/StatusBarPolicy;->mClockData:Lcom/android/server/status/IconData;
iget-object v1, p0, Lcom/android/server/status/StatusBarPolicy;->mContext:Landroid/content/Context;
invoke-static {v1}, Landroid/text/format/DateFormat;->getTimeFormat(Landroid/content/Context;)Ljava/text/DateFormat;
move-result-object v1
iget-object v2, p0, Lcom/android/server/status/StatusBarPolicy;->mCalendar:Ljava/util/Calendar;
invoke-virtual {v2}, Ljava/util/Calendar;->getTime()Ljava/util/Date;
move-result-object v2
invoke-virtual {v1, v2}, Ljava/text/DateFormat;->format(Ljava/util/Date;)Ljava/lang/String;
move-result-object v1
iget-object v4, p0, Lcom/android/server/status/StatusBarPolicy;->mContext:Landroid/content/Context;
invoke-virtual {v4}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;
move-result-object v4
const-string v2, "am_pm"
const/4 v3, 0x0
invoke-static {v4, v2, v3}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I
move-result v4
if-eqz v4, :cond_1
const-string v5, " PM"
const-string v6, ""
invoke-virtual {v1, v5, v6}, Ljava/lang/String;->replace(Ljava/lang/CharSequence;Ljava/lang/CharSequence;)Ljava/lang/String;
move-result-object v1
const-string v5, " AM"
const-string v6, ""
invoke-virtual {v1, v5, v6}, Ljava/lang/String;->replace(Ljava/lang/CharSequence;Ljava/lang/CharSequence;)Ljava/lang/String;
move-result-object v1
:goto_0
iget-object v4, p0, Lcom/android/server/status/StatusBarPolicy;->mContext:Landroid/content/Context;
invoke-virtual {v4}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;
move-result-object v4
const-string v2, "time_display"
const/4 v3, 0x1
invoke-static {v4, v2, v3}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I
move-result v4
if-nez v4, :cond_0
const-string v1, ""
:cond_0
iput-object v1, v0, Lcom/android/server/status/IconData;->text:Ljava/lang/CharSequence;
.line 942
iget-object v0, p0, Lcom/android/server/status/StatusBarPolicy;->mService:Lcom/android/server/status/StatusBarService;
iget-object v1, p0, Lcom/android/server/status/StatusBarPolicy;->mClockIcon:Landroid/os/IBinder;
iget-object v2, p0, Lcom/android/server/status/StatusBarPolicy;->mClockData:Lcom/android/server/status/IconData;
const/4 v3, 0x0
invoke-virtual {v0, v1, v2, v3}, Lcom/android/server/status/StatusBarService;->updateIcon(Landroid/os/IBinder;Lcom/android/server/status/IconData;Lcom/android/server/status/NotificationData;)V
.line 943
return-void
:cond_1
iget-object v0, p0, Lcom/android/server/status/StatusBarPolicy;->mClockData:Lcom/android/server/status/IconData;
invoke-direct {p0}, Lcom/android/server/status/StatusBarPolicy;->getSmallTime()Ljava/lang/CharSequence;
move-result-object v1
goto :goto_0
.end method
Thanks to JsChiSurf for creating this awesome mod
Hi Guys
I have a Samsung GT-S5570 Galaxy Mini and want to change the color of the clock in the status bar, I was reviewing some options and come to decompile the file services.odex, I have seen options to change the color but I have not yet been possible, help me?
PD: Sorry for me english
My File StatusBarIcon.smali
.class Lcom/android/server/status/StatusBarIcon;
.super Ljava/lang/Object;
.source "StatusBarIcon.java"
# static fields
.field private static final ICON_GAP:I = 0x8
.field private static final ICON_HEIGHT:I = 0x19
.field private static final ICON_WIDTH:I = 0x19
# instance fields
.field mData:Lcom/android/server/status/IconData;
.field private mImageView:Lcom/android/server/status/AnimatedImageView;
.field private mNumberView:Landroid/widget/TextView;
.field private mTextView:Landroid/widget/TextView;
.field public view:Landroid/view/View;
# direct methods
.method public constructor <init>(Landroid/content/Context;Lcom/android/server/status/IconData;Landroid/view/ViewGroupV
.registers 13
.parameter "context"
.parameter "data"
.parameter "parent"
.prologue
const/4 v7, -0x1
const/4 v8, 0x0
.line 50
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
.line 51
invoke-virtual {p2}, Lcom/android/server/status/IconData;->clone()Lcom/android/server/status/IconData;
move-result-object v6
iput-object v6, p0, Lcom/android/server/status/StatusBarIcon;->mData:Lcom/android/server/status/IconData;
.line 53
iget v6, p2, Lcom/android/server/status/IconData;->type:I
packed-switch v6, switch_data_9a
.line 97
:goto_10
return-void
.line 56
switch_11
new-instance v4, Landroid/widget/TextView;
invoke-direct {v4, p1}, Landroid/widget/TextView;-><init>(Landroid/content/ContextV
.line 57
.local v4, t:Landroid/widget/TextView;
iput-object v4, p0, Lcom/android/server/status/StatusBarIcon;->mTextView:Landroid/widget/TextView;
.line 58
new-instance v2, Landroid/widget/LinearLayout$LayoutParams;
const/4 v6, -0x2
invoke-direct {v2, v6, v7}, Landroid/widget/LinearLayout$LayoutParams;-><init>(II)V
.line 61
.local v2, layoutParams:Landroid/widget/LinearLayout$LayoutParams;
const/high16 v6, 0x4180
invoke-virtual {v4, v6}, Landroid/widget/TextView;->setTextSize(F)V
.line 62
invoke-virtual {v4, v7}, Landroid/widget/TextView;->setTextColor(I)V
.line 63
sget-object v6, Landroid/graphics/Typeface;->DEFAULT_BOLD:Landroid/graphics/Typeface;
invoke-virtual {v4, v6}, Landroid/widget/TextView;->setTypeface(Landroid/graphics/TypefaceV
.line 64
const/16 v6, 0x13
invoke-virtual {v4, v6}, Landroid/widget/TextView;->setGravity(I)V
.line 65
const/4 v6, 0x6
invoke-virtual {v4, v6, v8, v8, v8}, Landroid/widget/TextView;->setPadding(IIII)V
.line 66
invoke-virtual {v4, v2}, Landroid/widget/TextView;->setLayoutParams(Landroid/view/ViewGroup$LayoutParamsV
.line 67
iget-object v6, p2, Lcom/android/server/status/IconData;->text:Ljava/lang/CharSequence;
invoke-virtual {v4, v6}, Landroid/widget/TextView;->setText(Ljava/lang/CharSequenceV
.line 68
iput-object v4, p0, Lcom/android/server/status/StatusBarIcon;->view:Landroid/view/View;
goto :goto_10
.line 74
.end local v2 #layoutParams:Landroid/widget/LinearLayout$LayoutParams;
.end local v4 #t:Landroid/widget/TextView;
switch_3f
const-string v6, "layout_inflater"
invoke-virtual {p1, v6}, Landroid/content/Context;->getSystemService(Ljava/lang/StringLjava/lang/Object;
move-result-object v1
check-cast v1, Landroid/view/LayoutInflater;
.line 76
.local v1, inflater:Landroid/view/LayoutInflater;
const v6, 0x1090064
invoke-virtual {v1, v6, p3, v8}, Landroid/view/LayoutInflater;->inflate(ILandroid/view/ViewGroup;Z)Landroid/view/View;
move-result-object v5
.line 77
.local v5, v:Landroid/view/View;
iput-object v5, p0, Lcom/android/server/status/StatusBarIcon;->view:Landroid/view/View;
.line 80
const v6, 0x102017e
invoke-virtual {v5, v6}, Landroid/view/View;->findViewById(I)Landroid/view/View;
move-result-object v0
check-cast v0, Lcom/android/server/status/AnimatedImageView;
.line 81
.local v0, im:Lcom/android/server/status/AnimatedImageView;
invoke-static {p1, p2}, Lcom/android/server/status/StatusBarIcon;->getIcon(Landroid/content/Context;Lcom/android/server/status/IconDataLandroid/graphics/drawable/Drawable;
move-result-object v6
invoke-virtual {v0, v6}, Lcom/android/server/status/AnimatedImageView;->setImageDrawable(Landroid/graphics/drawable/DrawableV
.line 82
iget v6, p2, Lcom/android/server/status/IconData;->iconLevel:I
invoke-virtual {v0, v6}, Lcom/android/server/status/AnimatedImageView;->setImageLevel(I)V
.line 83
iput-object v0, p0, Lcom/android/server/status/StatusBarIcon;->mImageView:Lcom/android/server/status/AnimatedImageView;
.line 86
const v6, 0x1020055
invoke-virtual {v5, v6}, Landroid/view/View;->findViewById(I)Landroid/view/View;
move-result-object v3
check-cast v3, Landroid/widget/TextView;
.line 87
.local v3, nv:Landroid/widget/TextView;
iput-object v3, p0, Lcom/android/server/status/StatusBarIcon;->mNumberView:Landroid/widget/TextView;
.line 88
iget v6, p2, Lcom/android/server/status/IconData;->number:I
if-lez v6, :cond_93
.line 89
new-instance v6, Ljava/lang/StringBuilder;
invoke-direct {v6}, Ljava/lang/StringBuilder;-><init>()V
const-string v7, ""
invoke-virtual {v6, v7}, Ljava/lang/StringBuilder;->append(Ljava/lang/StringLjava/lang/StringBuilder;
move-result-object v6
iget v7, p2, Lcom/android/server/status/IconData;->number:I
invoke-virtual {v6, v7}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;
move-result-object v6
invoke-virtual {v6}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object v6
invoke-virtual {v3, v6}, Landroid/widget/TextView;->setText(Ljava/lang/CharSequenceV
.line 90
invoke-virtual {v3, v8}, Landroid/widget/TextView;->setVisibility(I)V
goto/16 :goto_10
.line 92
:cond_93
const/16 v6, 0x8
invoke-virtual {v3, v6}, Landroid/widget/TextView;->setVisibility(I)V
goto/16 :goto_10
.line 53
switch_data_9a
.packed-switch 0x1
switch_11
switch_3f
.end packed-switch
.end method
.method static getIcon(Landroid/content/Context;Lcom/android/server/status/IconDataLandroid/graphics/drawable/Drawable;
.registers 9
.parameter "context"
.parameter "data"
.prologue
const/4 v5, 0x0
const-string v6, "StatusBar"
.line 155
const/4 v2, 0x0
.line 157
.local v2, r:Landroid/content/res/Resources;
iget-object v3, p1, Lcom/android/server/status/IconData;->iconPackage:Ljava/lang/String;
if-eqz v3, :cond_50
.line 159
:try_start_8
invoke-virtual {p0}, Landroid/content/Context;->getPackageManager()Landroid/content/pm/PackageManager;
move-result-object v3
iget-object v4, p1, Lcom/android/server/status/IconData;->iconPackage:Ljava/lang/String;
invoke-virtual {v3, v4}, Landroid/content/pm/PackageManager;->getResourcesForApplication(Ljava/lang/StringLandroid/content/res/Resources;
:try_end_11
.catch Landroid/content/pm/PackageManager$NameNotFoundException; {:try_start_8 .. :try_end_11} :catch_32
move-result-object v2
.line 168
:goto_12
iget v3, p1, Lcom/android/server/status/IconData;->iconId:I
if-nez v3, :cond_55
.line 169
const-string v3, "StatusBar"
new-instance v3, Ljava/lang/StringBuilder;
invoke-direct {v3}, Ljava/lang/StringBuilder;-><init>()V
const-string v4, "No icon ID for slot "
invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/StringLjava/lang/StringBuilder;
move-result-object v3
iget-object v4, p1, Lcom/android/server/status/IconData;->slot:Ljava/lang/String;
invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/StringLjava/lang/StringBuilder;
move-result-object v3
invoke-virtual {v3}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object v3
invoke-static {v6, v3}, Landroid/util/Slog;->w(Ljava/lang/String;Ljava/lang/StringI
move-object v3, v5
.line 181
:goto_31
return-object v3
.line 160
:catch_32
move-exception v3
move-object v1, v3
.line 161
.local v1, ex:Landroid/content/pm/PackageManager$NameNotFoundException;
const-string v3, "StatusBar"
new-instance v3, Ljava/lang/StringBuilder;
invoke-direct {v3}, Ljava/lang/StringBuilder;-><init>()V
const-string v4, "Icon package not found: "
invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/StringLjava/lang/StringBuilder;
move-result-object v3
iget-object v4, p1, Lcom/android/server/status/IconData;->iconPackage:Ljava/lang/String;
invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/StringLjava/lang/StringBuilder;
move-result-object v3
invoke-virtual {v3}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object v3
invoke-static {v6, v3, v1}, Landroid/util/Slog;->e(Ljava/lang/String;Ljava/lang/String;Ljava/lang/ThrowableI
move-object v3, v5
.line 162
goto :goto_31
.line 165
.end local v1 #ex:Landroid/content/pm/PackageManager$NameNotFoundException;
:cond_50
invoke-virtual {p0}, Landroid/content/Context;->getResources()Landroid/content/res/Resources;
move-result-object v2
goto :goto_12
.line 174
:cond_55
:try_start_55
iget v3, p1, Lcom/android/server/status/IconData;->iconId:I
invoke-virtual {v2, v3}, Landroid/content/res/Resources;->getDrawable(I)Landroid/graphics/drawable/Drawable;
:try_end_5a
.catch Ljava/lang/RuntimeException; {:try_start_55 .. :try_end_5a} :catch_5c
move-result-object v3
goto :goto_31
.line 175
:catch_5c
move-exception v3
move-object v0, v3
.line 176
.local v0, e:Ljava/lang/RuntimeException;
const-string v3, "StatusBar"
new-instance v3, Ljava/lang/StringBuilder;
invoke-direct {v3}, Ljava/lang/StringBuilder;-><init>()V
const-string v4, "Icon not found in "
invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/StringLjava/lang/StringBuilder;
move-result-object v3
iget-object v4, p1, Lcom/android/server/status/IconData;->iconPackage:Ljava/lang/String;
if-eqz v4, :cond_92
iget v4, p1, Lcom/android/server/status/IconData;->iconId:I
invoke-static {v4}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;
move-result-object v4
:goto_75
invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/ObjectLjava/lang/StringBuilder;
move-result-object v3
const-string v4, ": "
invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/StringLjava/lang/StringBuilder;
move-result-object v3
iget v4, p1, Lcom/android/server/status/IconData;->iconId:I
invoke-static {v4}, Ljava/lang/Integer;->toHexString(I)Ljava/lang/String;
move-result-object v4
invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/StringLjava/lang/StringBuilder;
move-result-object v3
invoke-virtual {v3}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object v3
invoke-static {v6, v3}, Landroid/util/Slog;->w(Ljava/lang/String;Ljava/lang/StringI
move-object v3, v5
.line 181
goto :goto_31
.line 176
:cond_92
const-string v4, "<system>"
goto :goto_75
.end method
# virtual methods
.method getNumber()I
.registers 2
.prologue
.line 185
iget-object v0, p0, Lcom/android/server/status/StatusBarIcon;->mData:Lcom/android/server/status/IconData;
iget v0, v0, Lcom/android/server/status/IconData;->number:I
return v0
.end method
.method public update(I)V
.registers 6
.parameter "number"
.prologue
const-string v3, ""
.line 133
iget-object v1, p0, Lcom/android/server/status/StatusBarIcon;->mData:Lcom/android/server/status/IconData;
iget v1, v1, Lcom/android/server/status/IconData;->number:I
if-eq v1, p1, :cond_22
.line 134
iget-object v0, p0, Lcom/android/server/status/StatusBarIcon;->mNumberView:Landroid/widget/TextView;
.line 135
.local v0, nv:Landroid/widget/TextView;
if-lez p1, :cond_27
.line 136
new-instance v1, Ljava/lang/StringBuilder;
invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V
const-string v2, ""
invoke-virtual {v1, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/StringLjava/lang/StringBuilder;
move-result-object v1
invoke-virtual {v1, p1}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;
move-result-object v1
invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object v1
invoke-virtual {v0, v1}, Landroid/widget/TextView;->setText(Ljava/lang/CharSequenceV
.line 141
.end local v0 #nv:Landroid/widget/TextView;
:cond_22
:goto_22
iget-object v1, p0, Lcom/android/server/status/StatusBarIcon;->mData:Lcom/android/server/status/IconData;
iput p1, v1, Lcom/android/server/status/IconData;->number:I
.line 142
return-void
.line 138
.restart local v0 #nv:Landroid/widget/TextView;
:cond_27
const-string v1, ""
invoke-virtual {v0, v3}, Landroid/widget/TextView;->setText(Ljava/lang/CharSequenceV
goto :goto_22
.end method
.method public update(Landroid/content/Context;Lcom/android/server/status/IconDataV
.registers 9
.parameter "context"
.parameter "data"
.annotation system Ldalvik/annotation/Throws;
value = {
Lcom/android/server/status/StatusBarException;
}
.end annotation
.prologue
const-string v5, ""
.line 100
iget-object v3, p0, Lcom/android/server/status/StatusBarIcon;->mData:Lcom/android/server/status/IconData;
iget v3, v3, Lcom/android/server/status/IconData;->type:I
iget v4, p2, Lcom/android/server/status/IconData;->type:I
if-eq v3, v4, :cond_12
.line 101
new-instance v3, Lcom/android/server/status/StatusBarException;
const-string v4, "status bar entry type can\'t change"
invoke-direct {v3, v4}, Lcom/android/server/status/StatusBarException;-><init>(Ljava/lang/StringV
throw v3
.line 103
:cond_12
iget v3, p2, Lcom/android/server/status/IconData;->type:I
packed-switch v3, switch_data_92
.line 129
:cond_17
:goto_17
iget-object v3, p0, Lcom/android/server/status/StatusBarIcon;->mData:Lcom/android/server/status/IconData;
invoke-virtual {v3, p2}, Lcom/android/server/status/IconData;->copyFrom(Lcom/android/server/status/IconDataV
.line 130
return-void
.line 105
switch_1d
iget-object v3, p0, Lcom/android/server/status/StatusBarIcon;->mData:Lcom/android/server/status/IconData;
iget-object v3, v3, Lcom/android/server/status/IconData;->text:Ljava/lang/CharSequence;
iget-object v4, p2, Lcom/android/server/status/IconData;->text:Ljava/lang/CharSequence;
invoke-static {v3, v4}, Landroid/text/TextUtils;->equals(Ljava/lang/CharSequence;Ljava/lang/CharSequenceZ
move-result v3
if-nez v3, :cond_17
.line 106
iget-object v2, p0, Lcom/android/server/status/StatusBarIcon;->mTextView:Landroid/widget/TextView;
.line 107
.local v2, tv:Landroid/widget/TextView;
iget-object v3, p2, Lcom/android/server/status/IconData;->text:Ljava/lang/CharSequence;
invoke-virtual {v2, v3}, Landroid/widget/TextView;->setText(Ljava/lang/CharSequenceV
goto :goto_17
.line 111
.end local v2 #tv:Landroid/widget/TextView;
switch_31
iget-object v3, p0, Lcom/android/server/status/StatusBarIcon;->mData:Lcom/android/server/status/IconData;
iget-object v3, v3, Lcom/android/server/status/IconData;->iconPackage:Ljava/lang/String;
if-eqz v3, :cond_47
iget-object v3, p2, Lcom/android/server/status/IconData;->iconPackage:Ljava/lang/String;
if-eqz v3, :cond_47
iget-object v3, p0, Lcom/android/server/status/StatusBarIcon;->mData:Lcom/android/server/status/IconData;
iget-object v3, v3, Lcom/android/server/status/IconData;->iconPackage:Ljava/lang/String;
iget-object v4, p2, Lcom/android/server/status/IconData;->iconPackage:Ljava/lang/String;
invoke-virtual {v3, v4}, Ljava/lang/String;->equals(Ljava/lang/ObjectZ
move-result v3
if-eqz v3, :cond_57
:cond_47
iget-object v3, p0, Lcom/android/server/status/StatusBarIcon;->mData:Lcom/android/server/status/IconData;
iget v3, v3, Lcom/android/server/status/IconData;->iconId:I
iget v4, p2, Lcom/android/server/status/IconData;->iconId:I
if-ne v3, v4, :cond_57
iget-object v3, p0, Lcom/android/server/status/StatusBarIcon;->mData:Lcom/android/server/status/IconData;
iget v3, v3, Lcom/android/server/status/IconData;->iconLevel:I
iget v4, p2, Lcom/android/server/status/IconData;->iconLevel:I
if-eq v3, v4, :cond_65
.line 115
:cond_57
iget-object v0, p0, Lcom/android/server/status/StatusBarIcon;->mImageView:Lcom/android/server/status/AnimatedImageView;
.line 116
.local v0, im:Landroid/widget/ImageView;
invoke-static {p1, p2}, Lcom/android/server/status/StatusBarIcon;->getIcon(Landroid/content/Context;Lcom/android/server/status/IconDataLandroid/graphics/drawable/Drawable;
move-result-object v3
invoke-virtual {v0, v3}, Lcom/android/server/status/AnimatedImageView;->setImageDrawable(Landroid/graphics/drawable/DrawableV
.line 117
iget v3, p2, Lcom/android/server/status/IconData;->iconLevel:I
invoke-virtual {v0, v3}, Lcom/android/server/status/AnimatedImageView;->setImageLevel(I)V
.line 119
.end local v0 #im:Landroid/widget/ImageView;
:cond_65
iget-object v3, p0, Lcom/android/server/status/StatusBarIcon;->mData:Lcom/android/server/status/IconData;
iget v3, v3, Lcom/android/server/status/IconData;->number:I
iget v4, p2, Lcom/android/server/status/IconData;->number:I
if-eq v3, v4, :cond_17
.line 120
iget-object v1, p0, Lcom/android/server/status/StatusBarIcon;->mNumberView:Landroid/widget/TextView;
.line 121
.local v1, nv:Landroid/widget/TextView;
iget v3, p2, Lcom/android/server/status/IconData;->number:I
if-lez v3, :cond_8c
.line 122
new-instance v3, Ljava/lang/StringBuilder;
invoke-direct {v3}, Ljava/lang/StringBuilder;-><init>()V
const-string v4, ""
invoke-virtual {v3, v5}, Ljava/lang/StringBuilder;->append(Ljava/lang/StringLjava/lang/StringBuilder;
move-result-object v3
iget v4, p2, Lcom/android/server/status/IconData;->number:I
invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;
move-result-object v3
invoke-virtual {v3}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object v3
invoke-virtual {v1, v3}, Landroid/widget/TextView;->setText(Ljava/lang/CharSequenceV
goto :goto_17
.line 124
:cond_8c
const-string v3, ""
invoke-virtual {v1, v5}, Landroid/widget/TextView;->setText(Ljava/lang/CharSequenceV
goto :goto_17
.line 103
switch_data_92
.packed-switch 0x1
switch_1d
switch_31
.end packed-switch
.end method
Click to expand...
Click to collapse
Hi xda peoples
I ported this mods from concept showed by dictact74 & Mirko_DDD, so major credits go to their.....
There are two ways to make this mod.
Improve a new method or by use a old unused method.
Here we going to create a new method, if a lot of people will be interested about this thread, I'll post the other method
YOU CAN DOWNLOAD HERE A FLASHABLE FILE:
http://forum.xda-developers.com/showthread.php?t=2047010
Android.policy.jar
Let's start with Android.policy.jar
smali/com/android/internal/policy/imp/LockPatternKeyguardView
Find and replace the whole method,so we'll improve the aosp lockcreen:
Code:
.method createLockScreen()Landroid/view/View;
.locals 6
.prologue
.line 1268
const/4 v0, 0x0
iget-object v5, p0, Lcom/android/internal/policy/impl/LockPatternKeyguardView;->mContext:Landroid/content/Context;
invoke-virtual {v5}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;
move-result-object v5
const-string v4, "darboc_aosp_lock"
invoke-static {v5, v4, v0}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I
move-result v5
if-nez v5, :cond_dar
.line 1044
new-instance v0, Lcom/android/internal/policy/impl/sec/CircleLockScreen;
iget-object v1, p0, Lcom/android/internal/policy/impl/LockPatternKeyguardView;->mContext:Landroid/content/Context;
iget-object v2, p0, Lcom/android/internal/policy/impl/LockPatternKeyguardView;->mConfiguration:Landroid/content/res/Configuration;
iget-object v3, p0, Lcom/android/internal/policy/impl/LockPatternKeyguardView;->mLockPatternUtils:Lcom/android/internal/widget/LockPatternUtils;
iget-object v4, p0, Lcom/android/internal/policy/impl/LockPatternKeyguardView;->mUpdateMonitor:Lcom/android/internal/policy/impl/KeyguardUpdateMonitor;
iget-object v5, p0, Lcom/android/internal/policy/impl/LockPatternKeyguardView;->mKeyguardScreenCallback:Lcom/android/internal/policy/impl/KeyguardScreenCallback;
invoke-direct/range {v0 .. v5}, Lcom/android/internal/policy/impl/sec/CircleLockScreen;->(Landroid/content/Context;Landroid/content/res/Configuration;Lcom/android/internal/widget/LockPatternUtils;Lcom/android/internal/policy/impl/KeyguardUpdateMonitor;Lcom/android/internal/policy/impl/KeyguardScreenCallback;)V
.line 1274
.local v0, lockView:Landroid/view/View;
:goto_0
invoke-direct {p0, v0}, Lcom/android/internal/policy/impl/LockPatternKeyguardView;->initializeTransportControlView(Landroid/view/View;)V
.line 1275
return-object v0
:cond_dar
new-instance v0, Lcom/android/internal/policy/impl/LockScreen;
iget-object v1, p0, Lcom/android/internal/policy/impl/LockPatternKeyguardView;->mContext:Landroid/content/Context;
iget-object v2, p0, Lcom/android/internal/policy/impl/LockPatternKeyguardView;->mConfiguration:Landroid/content/res/Configuration;
iget-object v3, p0, Lcom/android/internal/policy/impl/LockPatternKeyguardView;->mLockPatternUtils:Lcom/android/internal/widget/LockPatternUtils;
iget-object v4, p0, Lcom/android/internal/policy/impl/LockPatternKeyguardView;->mUpdateMonitor:Lcom/android/internal/policy/impl/KeyguardUpdateMonitor;
iget-object v5, p0, Lcom/android/internal/policy/impl/LockPatternKeyguardView;->mKeyguardScreenCallback:Lcom/android/internal/policy/impl/KeyguardScreenCallback;
invoke-direct/range {v0 .. v5}, Lcom/android/internal/policy/impl/LockScreen;->(Landroid/content/Context;Landroid/content/res/Configuration;Lcom/android/internal/widget/LockPatternUtils;Lcom/android/internal/policy/impl/KeyguardUpdateMonitor;Lcom/android/internal/policy/impl/KeyguardScreenCallback;)V
.line 1274
goto :goto_0
.end method
Save and exit
Recompile and push to /system/app
SecSettings:
Open
smali/com/android/settings/LockScreenSettings
we going to improve the checkbox.......
add BLU lines
canc RED lines
Code:
.method private updateState()V
.locals 9
.prologue
const/4 v5, 0x1
const/4 v6, 0x0
.line 263
[COLOR="Blue"]iget-object v7, p0, Lcom/android/settings/LockScreenSettings;->mAospLock:Landroid/preference/CheckBoxPreference;
invoke-virtual {p0}, Lcom/android/settings/LockScreenSettings;->getContentResolver()Landroid/content/ContentResolver;
move-result-object v4
const-string v8, "darboc_aosp_lock"
invoke-static {v4, v8, v6}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I
move-result v4
if-eqz v4, :cond_7
move v4, v5
invoke-virtual {v7, v4}, Landroid/preference/CheckBoxPreference;->setChecked(Z)V
.line 265
invoke-virtual {p0}, Lcom/android/settings/LockScreenSettings;->getContentResolver()Landroid/content/ContentResolver;
move-result-object v4
iget-object v7, p0, Lcom/android/settings/LockScreenSettings;->mClock:Landroid/preference/CheckBoxPreference;
invoke-virtual {p0}, Lcom/android/settings/LockScreenSettings;->getContentResolver()Landroid/content/ContentResolver;
move-result-object v4[/COLOR]
const-string v8, "show_clock"
Find and replace
Code:
iget-object v9, p0, Lcom/android/settings/LockScreenSettings;->mClock:Landroid/preference/CheckBoxPreference;
const/4 v10, 0x0
invoke-virtual {v9, v10}, Landroid/preference/CheckBoxPreference;->setPersistent(Z)V
[COLOR="blue"]const-string v9, "darboc_aosp_lock"
invoke-virtual {p0, v9}, Lcom/android/settings/LockScreenSettings;->findPreference(Ljava/lang/CharSequence;)Landroid/preference/Preference;
move-result-object v9
check-cast v9, Landroid/preference/CheckBoxPreference;
iput-object v9, p0, Lcom/android/settings/LockScreenSettings;->mAospLock:Landroid/preference/CheckBoxPreference;
.line 159
iget-object v9, p0, Lcom/android/settings/LockScreenSettings;->mAospLock:Landroid/preference/CheckBoxPreference;
const/4 v10, 0x0
invoke-virtual {v9, v10}, Landroid/preference/CheckBoxPreference;->setPersistent(Z)V
[/COLOR]
.line 161
const-string v9, "weather"
invoke-virtual {p0, v9}, Lcom/android/settings/LockScreenSettings;->findPreference(Ljava/lang/CharSequence;)Landroid/preference/Preference;
Find and add the condition
Code:
iget-object v4, p0, Lcom/android/settings/LockScreenSettings;->mSayCommand:Landroid/preference/CheckBoxPreference;
invoke-virtual {p2, v4}, Ljava/lang/Object;->equals(Ljava/lang/Object;)Z
move-result v4
if-eqz v4, [COLOR="Blue"]:cond_bbb[/COLOR]
.line 338
invoke-virtual {p0}, Lcom/android/settings/LockScreenSettings;->getContentResolver()Landroid/content/ContentResolver;
move-result-object v4
const-string v5, "wake_up_lock_screen"
iget-object v6, p0, Lcom/android/settings/LockScreenSettings;->mSayCommand:Landroid/preference/CheckBoxPreference;
Find and add the new condition method
Code:
invoke-static {v4, v5, v2}, Landroid/provider/Settings$System;->putInt(Landroid/content/ContentResolver;Ljava/lang/String;I)Z
goto/16 :goto_1
:cond_a
move v2, v3
goto :goto_5
[COLOR="blue"]:cond_bbb
iget-object v4, p0, Lcom/android/settings/LockScreenSettings;->mAospLock:Landroid/preference/CheckBoxPreference;
invoke-virtual {p2, v4}, Ljava/lang/Object;->equals(Ljava/lang/Object;)Z
move-result v4
if-eqz v4, :cond_0
.line 313
invoke-virtual {p0}, Lcom/android/settings/LockScreenSettings;->getContentResolver()Landroid/content/ContentResolver;
move-result-object v4
const-string v5, "darboc_aosp_lock"
iget-object v6, p0, Lcom/android/settings/LockScreenSettings;->mAospLock:Landroid/preference/CheckBoxPreference;
invoke-virtual {v6}, Landroid/preference/CheckBoxPreference;->isChecked()Z
move-result v6
if-eqz v6, :cond_c
:goto_6
invoke-static {v4, v5, v2}, Landroid/provider/Settings$System;->putInt(Landroid/content/ContentResolver;Ljava/lang/String;I)Z
.line 314
invoke-direct {p0}, Lcom/android/settings/LockScreenSettings;->updateState()V
.line 340
invoke-super {p0, p1, p2}, Lcom/android/settings/SettingsPreferenceFragment;->onPreferenceTreeClick(Landroid/preference/PreferenceScreen;Landroid/preference/Preference;)Z
move-result v2
return v2
:cond_c
move v2, v3
.line 313
goto :goto_6[/COLOR]
.line 337
.end method
.method public onResume()V
.locals 0
.prologue
.line 257
invoke-super {p0}, Lcom/android/settings/SettingsPreferenceFragment;->onResume()V
Save and exit
Now we'll iprove the xml part that show the checkbox and call the mali part
Go to res/values/strings.xml
Add the following lines somewhere in this file:
Code:
<string name="enable_aosp_lock">AOSP lockscreen</string>
<string name="enable_aosp_lock_text">Enable AOSP lockscreen</string>
Save and exit
Go to res/xml/Lockscreen_Settings.xml
Add the following lines where you like that checkbox would be showed
Code:
<CheckBoxPreference android:title="@string/enable_aosp_lock" android:key="darboc_aosp_lock" android:summary="@string/enable_aosp_lock_text" />
Recompile and push to /system/app
Reboot
Now will find your new toggle in lockscreen options
Enjoy
MERRY X-MAS AND HAPPY MODS NEW YEAR
Reserved.........
Inviato dal mio GT-N7000 con Tapatalk 2
One more
Inviato dal mio GT-N7000 con Tapatalk 2
Thanks for sharing your knowledge ! I will see how far I can get
Hello everyone ,
this is my first tutorial on MODS like these.. so plz correct me if anything is wrong :good:
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
for now, this is tested on gingerbread only .. check out the demo video here (pre-release version but works similarly) : HERE
Credits :
> ADITHYA RAJAGOPAL (he is the one who gave me tips at the beginning which were very helpful)
> stackoverflow
> developer.android.com
> All of you guys :fingers-crossed:
Click to expand...
Click to collapse
What does this MOD do??
This MOD enables the statusbar to automatically change its color depending on the activity/app shown on the screen at that time.
Which apks have to be edited??
Only SystemUI.apk.( It also requires the StatusBar Colors.apk attached below)
What do i have to know before trying this out??
Decompiling and recompiling of apps.. if u dont then google it,learn and come back.
Click to expand...
Click to collapse
Ok then, lets get started..
Step 1. Decompile your SystemUI.apk.
For Gingerbread :
Step 2. Goto SystemUI\smali\com\android\systemui\statusbar and open StatusBarView.smali in an editor.
Step 3. find this line:
Code:
.method public constructor <init>(Landroid/content/Context;Landroid/util/AttributeSet;)V
for me it was something like this :
Code:
# direct methods
.method public constructor <init>(Landroid/content/Context;Landroid/util/AttributeSet;)V
[COLOR="Red"].locals 0
.parameter "context"
.parameter "attrs"
.prologue
.line 77
invoke-direct {p0, p1, p2}, Landroid/widget/FrameLayout;-><init>(Landroid/content/Context;Landroid/util/AttributeSet;)V
.line 78
return-void[/COLOR]
.end method
Step 4. Replace the whole code(shown in red above) inside the method with the code below :
NOTE : WHILE WRITING THE CODE IN YOUR .smali , REMOVE THE COMMENTS HIGHLIGHTED IN RED COLOR
Code:
.locals 3
.parameter "context"
.parameter "attrs"
.prologue
.line 15
invoke-direct {p0, p1, p2}, Landroid/widget/FrameLayout;-><init>(Landroid/content/Context;Landroid/util/AttributeSet;)V
.line 16
const-string v2, "#FF000000" [COLOR="Red"]// THIS IS THE DEFAULT COLOR FOR THE STATUS BAR WHEN THE COLOR CHANGER IS NOT ACTIVATED. YOU CAN CHANGE IT AS YOU WISH [/COLOR]
invoke-static {v2}, Landroid/graphics/Color;->parseColor(Ljava/lang/String;)I
move-result v2
invoke-virtual {p0, v2}, Lcom/android/systemui/statusbar/StatusBarView;->setBackgroundColor(I)V
.line 17
new-instance v1, Landroid/content/IntentFilter;
const-string v2, "com.prithvee.Bc"
invoke-direct {v1, v2}, Landroid/content/IntentFilter;-><init>(Ljava/lang/String;)V
.line 18
.local v1, fiter:Landroid/content/IntentFilter;
new-instance v0, Lcom/android/systemui/statusbar/StatusBarView$1;
invoke-direct {v0, p0}, Lcom/android/systemui/statusbar/StatusBarView$1;-><init>(Lcom/android/systemui/statusbar/StatusBarView;)V
.line 26
.local v0, Brc:Landroid/content/BroadcastReceiver;
invoke-virtual {p0}, Lcom/android/systemui/statusbar/StatusBarView;->getContext()Landroid/content/Context;
move-result-object v2
invoke-virtual {v2, v0, v1}, Landroid/content/Context;->registerReceiver(Landroid/content/BroadcastReceiver;Landroid/content/IntentFilter;)Landroid/content/Intent;
.line 28
return-void
Step 5. Find this :
Code:
[COLOR="Red"]# virtual methods[/COLOR]
Step 6. Paste this below :
Code:
[COLOR="Red"]# virtual methods[/COLOR]
.method updatecolor(Ljava/lang/String;)V
.locals 1
.parameter "apn"
.prologue
.line 34
:try_start_0
const-string v0, "com.android.contacts"
invoke-virtual {p1, v0}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v0
if-eqz v0, :cond_0
.line 35
const-string v0, "#ff185984"
invoke-static {v0}, Landroid/graphics/Color;->parseColor(Ljava/lang/String;)I
move-result v0
invoke-virtual {p0, v0}, Lcom/android/systemui/statusbar/StatusBarView;->setBackgroundColor(I)V
.line 91
:goto_0
return-void
.line 38
:cond_0
const-string v0, "com.android.settings"
invoke-virtual {p1, v0}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v0
if-eqz v0, :cond_1
.line 40
const-string v0, "#FF000000"
invoke-static {v0}, Landroid/graphics/Color;->parseColor(Ljava/lang/String;)I
move-result v0
invoke-virtual {p0, v0}, Lcom/android/systemui/statusbar/StatusBarView;->setBackgroundColor(I)V
goto :goto_0
.line 88
:catch_0
move-exception v0
goto :goto_0
.line 42
:cond_1
const-string v0, "com.android.mms"
invoke-virtual {p1, v0}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v0
if-eqz v0, :cond_2
.line 44
const-string v0, "#ff394963"
invoke-static {v0}, Landroid/graphics/Color;->parseColor(Ljava/lang/String;)I
move-result v0
invoke-virtual {p0, v0}, Lcom/android/systemui/statusbar/StatusBarView;->setBackgroundColor(I)V
goto :goto_0
.line 46
:cond_2
const-string v0, "com.opera.mini.android.Browser"
invoke-virtual {p1, v0}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v0
if-eqz v0, :cond_3
.line 48
const-string v0, "#ff9d372c"
invoke-static {v0}, Landroid/graphics/Color;->parseColor(Ljava/lang/String;)I
move-result v0
invoke-virtual {p0, v0}, Lcom/android/systemui/statusbar/StatusBarView;->setBackgroundColor(I)V
goto :goto_0
.line 50
:cond_3
const-string v0, "com.tencent.mm"
invoke-virtual {p1, v0}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v0
if-eqz v0, :cond_4
.line 52
const-string v0, "#ff3c3c3c"
invoke-static {v0}, Landroid/graphics/Color;->parseColor(Ljava/lang/String;)I
move-result v0
invoke-virtual {p0, v0}, Lcom/android/systemui/statusbar/StatusBarView;->setBackgroundColor(I)V
goto :goto_0
.line 54
:cond_4
const-string v0, "com.google.android.finsky"
invoke-virtual {p1, v0}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v0
if-eqz v0, :cond_5
.line 56
const-string v0, "#ff666666"
invoke-static {v0}, Landroid/graphics/Color;->parseColor(Ljava/lang/String;)I
move-result v0
invoke-virtual {p0, v0}, Lcom/android/systemui/statusbar/StatusBarView;->setBackgroundColor(I)V
goto :goto_0
.line 58
:cond_5
const-string v0, "com.estrongs.android.pop"
invoke-virtual {p1, v0}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v0
if-nez v0, :cond_6
const-string v0, "com.estrongs.android"
invoke-virtual {p1, v0}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v0
if-eqz v0, :cond_7
.line 60
:cond_6
const-string v0, "#ff66cae5"
invoke-static {v0}, Landroid/graphics/Color;->parseColor(Ljava/lang/String;)I
move-result v0
invoke-virtual {p0, v0}, Lcom/android/systemui/statusbar/StatusBarView;->setBackgroundColor(I)V
goto :goto_0
.line 62
:cond_7
const-string v0, "com.google.android.gms"
invoke-virtual {p1, v0}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v0
if-eqz v0, :cond_8
.line 64
const-string v0, "#ff96aa39"
invoke-static {v0}, Landroid/graphics/Color;->parseColor(Ljava/lang/String;)I
move-result v0
invoke-virtual {p0, v0}, Lcom/android/systemui/statusbar/StatusBarView;->setBackgroundColor(I)V
goto/16 :goto_0
.line 66
:cond_8
const-string v0, "com.facebook.katana"
invoke-virtual {p1, v0}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v0
if-eqz v0, :cond_9
.line 68
const-string v0, "#ff5978b0"
invoke-static {v0}, Landroid/graphics/Color;->parseColor(Ljava/lang/String;)I
move-result v0
invoke-virtual {p0, v0}, Lcom/android/systemui/statusbar/StatusBarView;->setBackgroundColor(I)V
goto/16 :goto_0
.line 70
:cond_9
const-string v0, "com.whatsapp"
invoke-virtual {p1, v0}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v0
if-eqz v0, :cond_a
.line 72
const-string v0, "#ff2f4444"
invoke-static {v0}, Landroid/graphics/Color;->parseColor(Ljava/lang/String;)I
move-result v0
invoke-virtual {p0, v0}, Lcom/android/systemui/statusbar/StatusBarView;->setBackgroundColor(I)V
goto/16 :goto_0
.line 74
:cond_a
const-string v0, "com.mgeek.android.DolphinBrowser.Browser"
invoke-virtual {p1, v0}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v0
if-eqz v0, :cond_b
.line 76
const-string v0, "#ff389d00"
invoke-static {v0}, Landroid/graphics/Color;->parseColor(Ljava/lang/String;)I
move-result v0
invoke-virtual {p0, v0}, Lcom/android/systemui/statusbar/StatusBarView;->setBackgroundColor(I)V
goto/16 :goto_0
.line 79
:cond_b
const-string v0, "com.uc.browser.en"
invoke-virtual {p1, v0}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v0
if-eqz v0, :cond_c
.line 81
const-string v0, "#ff31639c"
invoke-static {v0}, Landroid/graphics/Color;->parseColor(Ljava/lang/String;)I
move-result v0
invoke-virtual {p0, v0}, Lcom/android/systemui/statusbar/StatusBarView;->setBackgroundColor(I)V
goto/16 :goto_0
.line 85
:cond_c
const-string v0, "#FF000000"
invoke-static {v0}, Landroid/graphics/Color;->parseColor(Ljava/lang/String;)I
move-result v0
invoke-virtual {p0, v0}, Lcom/android/systemui/statusbar/StatusBarView;->setBackgroundColor(I)V
:try_end_0
.catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0
goto/16 :goto_0
.end method
Step 7. Save and close this file.
Step 8. Download StatusBarView$1.rar extract it from attachments and place StatusBarView$1.smali in SystemUI\smali\com\android\systemui\statusbar
For Jelly Bean (not tested):
Step 2. Goto SystemUI\smali\com\android\systemui\statusbar\phone and open PhoneStatusBarView.smali in an editor.
Step 3. find this line:
Code:
.method public constructor <init>(Landroid/content/Context;Landroid/util/AttributeSet;)V
for me it was something like this :
Code:
# direct methods
.method public constructor <init>(Landroid/content/Context;Landroid/util/AttributeSet;)V
.locals 2
.parameter "context"
.parameter "attrs"
.prologue
const/4 v0, 0x0
.line 56
invoke-direct {p0, p1, p2}, Landroid/widget/FrameLayout;-><init>(Landroid/content/Context;Landroid/util/AttributeSet;)V
.line 48
iput-boolean v0, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBarView;->mNightMode:Z
.line 49
iput v0, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBarView;->mStartAlpha:I
iput v0, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBarView;->mEndAlpha:I
.line 50
const-wide/16 v0, 0x0
iput-wide v0, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBarView;->mEndTime:J
.line 52
new-instance v0, Landroid/graphics/Rect;
invoke-direct {v0}, Landroid/graphics/Rect;-><init>()V
iput-object v0, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBarView;->mButtonBounds:Landroid/graphics/Rect;
.line 53
const/4 v0, 0x1
iput-boolean v0, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBarView;->mCapturingEvents:Z
.line 57
return-void
.end method
Step 4. Add the whole code(shown in green below) inside the method properly :
NOTE : WHILE WRITING THE CODE IN YOUR .smali , REMOVE THE COMMENTS HIGHLIGHTED IN RED COLOR
Code:
# direct methods
.method public constructor <init>(Landroid/content/Context;Landroid/util/AttributeSet;)V
.locals [COLOR="SeaGreen"]5[/COLOR] [COLOR="Red"]//ADD 3 TO THE EXISTING NUMBER ACCORDING TO YOUR CODE [/COLOR]
.parameter "context"
.parameter "attrs"
.prologue
[COLOR="SeaGreen"].line 15
invoke-direct {p0, p1, p2}, Landroid/widget/FrameLayout;-><init>(Landroid/content/Context;Landroid/util/AttributeSet;)V
.line 16
const-string v2, "#FF000000" [COLOR="Red"]// THIS IS THE DEFAULT COLOR FOR THE STATUS BAR WHEN THE COLOR CHANGER IS NOT ACTIVATED. YOU CAN CHANGE IT AS YOU WISH [/COLOR]
invoke-static {v2}, Landroid/graphics/Color;->parseColor(Ljava/lang/String;)I
move-result v2
invoke-virtual {p0, v2}, Lcom/android/systemui/statusbar/phone/PhoneStatusBarView;->setBackgroundColor(I)V
.line 17
new-instance v1, Landroid/content/IntentFilter;
const-string v2, "com.prithvee.Bc"
invoke-direct {v1, v2}, Landroid/content/IntentFilter;-><init>(Ljava/lang/String;)V
.line 18
.local v1, fiter:Landroid/content/IntentFilter;
new-instance v0, Lcom/android/systemui/statusbar/phone/PhoneStatusBarView$1;
invoke-direct {v0, p0}, Lcom/android/systemui/statusbar/phone/PhoneStatusBarView$1;-><init>(Lcom/android/systemui/statusbar/phone/PhoneStatusBarView;)V
.line 26
.local v0, Brc:Landroid/content/BroadcastReceiver;
invoke-virtual {p0}, Lcom/android/systemui/statusbar/phone/PhoneStatusBarView;->getContext()Landroid/content/Context;
move-result-object v2
invoke-virtual {v2, v0, v1}, Landroid/content/Context;->registerReceiver(Landroid/content/BroadcastReceiver;Landroid/content/IntentFilter;)Landroid/content/Intent;[/COLOR]
const/4 v0, 0x0
.line 56
invoke-direct {p0, p1, p2}, Landroid/widget/FrameLayout;-><init>(Landroid/content/Context;Landroid/util/AttributeSet;)V
.line 48
iput-boolean v0, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBarView;->mNightMode:Z
.line 49
iput v0, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBarView;->mStartAlpha:I
iput v0, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBarView;->mEndAlpha:I
.line 50
const-wide/16 v0, 0x0
iput-wide v0, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBarView;->mEndTime:J
.line 52
new-instance v0, Landroid/graphics/Rect;
invoke-direct {v0}, Landroid/graphics/Rect;-><init>()V
iput-object v0, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBarView;->mButtonBounds:Landroid/graphics/Rect;
.line 53
const/4 v0, 0x1
iput-boolean v0, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBarView;->mCapturingEvents:Z
.line 57
return-void
.end method
Step 5. Find this :
Code:
[COLOR="Red"]# virtual methods[/COLOR]
Step 6. Paste this below :
Code:
[COLOR="Red"]# virtual methods[/COLOR]
.method updatecolor(Ljava/lang/String;)V
.locals 1
.parameter "apn"
.prologue
.line 34
:try_start_0
const-string v0, "com.android.contacts"
invoke-virtual {p1, v0}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v0
if-eqz v0, :cond_0
.line 35
const-string v0, "#ff185984"
invoke-static {v0}, Landroid/graphics/Color;->parseColor(Ljava/lang/String;)I
move-result v0
invoke-virtual {p0, v0}, Lcom/android/systemui/statusbar/phone/PhoneStatusBarView;->setBackgroundColor(I)V
.line 91
:goto_0
return-void
.line 38
:cond_0
const-string v0, "com.android.settings"
invoke-virtual {p1, v0}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v0
if-eqz v0, :cond_1
.line 40
const-string v0, "#FF000000"
invoke-static {v0}, Landroid/graphics/Color;->parseColor(Ljava/lang/String;)I
move-result v0
invoke-virtual {p0, v0}, Lcom/android/systemui/statusbar/phone/PhoneStatusBarView;->setBackgroundColor(I)V
goto :goto_0
.line 88
:catch_0
move-exception v0
goto :goto_0
.line 42
:cond_1
const-string v0, "com.android.mms"
invoke-virtual {p1, v0}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v0
if-eqz v0, :cond_2
.line 44
const-string v0, "#ff394963"
invoke-static {v0}, Landroid/graphics/Color;->parseColor(Ljava/lang/String;)I
move-result v0
invoke-virtual {p0, v0}, Lcom/android/systemui/statusbar/phone/PhoneStatusBarView;->setBackgroundColor(I)V
goto :goto_0
.line 46
:cond_2
const-string v0, "com.opera.mini.android.Browser"
invoke-virtual {p1, v0}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v0
if-eqz v0, :cond_3
.line 48
const-string v0, "#ff9d372c"
invoke-static {v0}, Landroid/graphics/Color;->parseColor(Ljava/lang/String;)I
move-result v0
invoke-virtual {p0, v0}, Lcom/android/systemui/statusbar/phone/PhoneStatusBarView;->setBackgroundColor(I)V
goto :goto_0
.line 50
:cond_3
const-string v0, "com.tencent.mm"
invoke-virtual {p1, v0}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v0
if-eqz v0, :cond_4
.line 52
const-string v0, "#ff3c3c3c"
invoke-static {v0}, Landroid/graphics/Color;->parseColor(Ljava/lang/String;)I
move-result v0
invoke-virtual {p0, v0}, Lcom/android/systemui/statusbar/phone/PhoneStatusBarView;->setBackgroundColor(I)V
goto :goto_0
.line 54
:cond_4
const-string v0, "com.google.android.finsky"
invoke-virtual {p1, v0}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v0
if-eqz v0, :cond_5
.line 56
const-string v0, "#ff666666"
invoke-static {v0}, Landroid/graphics/Color;->parseColor(Ljava/lang/String;)I
move-result v0
invoke-virtual {p0, v0}, Lcom/android/systemui/statusbar/phone/PhoneStatusBarView;->setBackgroundColor(I)V
goto :goto_0
.line 58
:cond_5
const-string v0, "com.estrongs.android.pop"
invoke-virtual {p1, v0}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v0
if-nez v0, :cond_6
const-string v0, "com.estrongs.android"
invoke-virtual {p1, v0}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v0
if-eqz v0, :cond_7
.line 60
:cond_6
const-string v0, "#ff66cae5"
invoke-static {v0}, Landroid/graphics/Color;->parseColor(Ljava/lang/String;)I
move-result v0
invoke-virtual {p0, v0}, Lcom/android/systemui/statusbar/phone/PhoneStatusBarView;->setBackgroundColor(I)V
goto :goto_0
.line 62
:cond_7
const-string v0, "com.google.android.gms"
invoke-virtual {p1, v0}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v0
if-eqz v0, :cond_8
.line 64
const-string v0, "#ff96aa39"
invoke-static {v0}, Landroid/graphics/Color;->parseColor(Ljava/lang/String;)I
move-result v0
invoke-virtual {p0, v0}, Lcom/android/systemui/statusbar/phone/PhoneStatusBarView;->setBackgroundColor(I)V
goto/16 :goto_0
.line 66
:cond_8
const-string v0, "com.facebook.katana"
invoke-virtual {p1, v0}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v0
if-eqz v0, :cond_9
.line 68
const-string v0, "#ff5978b0"
invoke-static {v0}, Landroid/graphics/Color;->parseColor(Ljava/lang/String;)I
move-result v0
invoke-virtual {p0, v0}, Lcom/android/systemui/statusbar/phone/PhoneStatusBarView;->setBackgroundColor(I)V
goto/16 :goto_0
.line 70
:cond_9
const-string v0, "com.whatsapp"
invoke-virtual {p1, v0}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v0
if-eqz v0, :cond_a
.line 72
const-string v0, "#ff2f4444"
invoke-static {v0}, Landroid/graphics/Color;->parseColor(Ljava/lang/String;)I
move-result v0
invoke-virtual {p0, v0}, Lcom/android/systemui/statusbar/phone/PhoneStatusBarView;->setBackgroundColor(I)V
goto/16 :goto_0
.line 74
:cond_a
const-string v0, "com.mgeek.android.DolphinBrowser.Browser"
invoke-virtual {p1, v0}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v0
if-eqz v0, :cond_b
.line 76
const-string v0, "#ff389d00"
invoke-static {v0}, Landroid/graphics/Color;->parseColor(Ljava/lang/String;)I
move-result v0
invoke-virtual {p0, v0}, Lcom/android/systemui/statusbar/phone/PhoneStatusBarView;->setBackgroundColor(I)V
goto/16 :goto_0
.line 79
:cond_b
const-string v0, "com.uc.browser.en"
invoke-virtual {p1, v0}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v0
if-eqz v0, :cond_c
.line 81
const-string v0, "#ff31639c"
invoke-static {v0}, Landroid/graphics/Color;->parseColor(Ljava/lang/String;)I
move-result v0
invoke-virtual {p0, v0}, Lcom/android/systemui/statusbar/phone/PhoneStatusBarView;->setBackgroundColor(I)V
goto/16 :goto_0
.line 85
:cond_c
const-string v0, "#FF000000"
invoke-static {v0}, Landroid/graphics/Color;->parseColor(Ljava/lang/String;)I
move-result v0
invoke-virtual {p0, v0}, Lcom/android/systemui/statusbar/phone/PhoneStatusBarView;->setBackgroundColor(I)V
:try_end_0
.catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0
goto/16 :goto_0
.end method
Step 7. Save and close this file.
Step 8. Download PhoneStatusBarView$1.rar extract it from attachments and place PhoneStatusBarView$1.smali in SystemUI\smali\com\android\systemui\statusbar\phone\
Step 9. Thats it!!! Now re-compile the apk and install / push it into your device .
Step 10. Download the StatusBarColors.apk from the attachments and install it. Open it and tap on Start button to start the magic
if u have done till this step successfully then these apps can make change in status bar color :
whatsapp
fb
wechat
es file explorer
message
contacts
uc browser
Dolphin Browser
in the next post i'll tell how to add more apps and colors
NOTE:
:good: When you use the StatusBarColors.apk in your ROM or theme plz do not change the creator name.. it hurts when the only mark denoting all of the hard work is just removed by just a single name change
:good: If u liked this tutorial hit the thanks button.
:good: Feel free to integrate this in ur ROM and give proper credits
THE COLOR OF THE STATUS BAR DEPENDS ON THE APP SHOWN ON THE SCREEN... HENCE THE APPS AND THEIR COLORS HAVE TO BE DEFINED FIRST..
THEN...HOW TO ADD MORE APPS AND COLORS ????
Go to this code (from Step 6), observe the comments below and make changes accordingly :
NOTE : WHILE WRITING THE CODE IN YOUR .smali , REMOVE THE COMMENTS HIGHLIGHTED IN RED COLOR
Code:
[COLOR="Red"]
# virtual methods[/COLOR]
.method updatecolor(Ljava/lang/String;)V
.locals 1
.parameter "apn"
.prologue
.line 34
:try_start_0
const-string v0, "com.android.contacts" [COLOR="Red"]//this one is for contacts[/COLOR]
invoke-virtual {p1, v0}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v0
if-eqz v0, :cond_0
.line 35
const-string v0, "#ff185984" [COLOR="Red"]//this color is for contacts[/COLOR]
invoke-static {v0}, Landroid/graphics/Color;->parseColor(Ljava/lang/String;)I
move-result v0
invoke-virtual {p0, v0}, [COLOR="Orange"]Lcom/android/systemui/statusbar/StatusBarView[/COLOR];->setBackgroundColor(I)V [COLOR="Red"]//JB USERS DON'T FORGET TO CHANGE THE LINES IN [COLOR="Orange"]ORANGE[/COLOR] TO[/COLOR] '[COLOR="DarkOrchid"]Lcom/android/systemui/statusbar/phone/PhoneStatusBarView[/COLOR]' [COLOR="Red"]WHERE REQUIRED [/COLOR]
.line 91
:goto_0
return-void
.line 38
:cond_0
const-string v0, "com.android.settings" [COLOR="Red"]//similarly this one is for settings[/COLOR]
invoke-virtual {p1, v0}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v0
if-eqz v0, :cond_1
.line 40
const-string v0, "#FF000000" [COLOR="Red"]//this color is for settings[/COLOR]
invoke-static {v0}, Landroid/graphics/Color;->parseColor(Ljava/lang/String;)I
move-result v0
invoke-virtual {p0, v0}, Lcom/android/systemui/statusbar/StatusBarView;->setBackgroundColor(I)V
goto :goto_0
.line 88
:catch_0
move-exception v0
goto :goto_0
.line 42
:cond_1
const-string v0, "com.android.mms"
invoke-virtual {p1, v0}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v0
if-eqz v0, :cond_2
.line 44
const-string v0, "#ff394963"
invoke-static {v0}, Landroid/graphics/Color;->parseColor(Ljava/lang/String;)I
move-result v0
invoke-virtual {p0, v0}, Lcom/android/systemui/statusbar/StatusBarView;->setBackgroundColor(I)V
goto :goto_0
.line 46
:cond_2
const-string v0, "com.opera.mini.android.Browser"
invoke-virtual {p1, v0}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v0
if-eqz v0, :cond_3
.line 48
const-string v0, "#ff9d372c"
invoke-static {v0}, Landroid/graphics/Color;->parseColor(Ljava/lang/String;)I
move-result v0
invoke-virtual {p0, v0}, Lcom/android/systemui/statusbar/StatusBarView;->setBackgroundColor(I)V
goto :goto_0
.line 50
:cond_3
const-string v0, "com.tencent.mm"
invoke-virtual {p1, v0}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v0
if-eqz v0, :cond_4
.line 52
const-string v0, "#ff3c3c3c"
invoke-static {v0}, Landroid/graphics/Color;->parseColor(Ljava/lang/String;)I
move-result v0
invoke-virtual {p0, v0}, Lcom/android/systemui/statusbar/StatusBarView;->setBackgroundColor(I)V
goto :goto_0
.line 54
:cond_4
const-string v0, "com.google.android.finsky"
invoke-virtual {p1, v0}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v0
if-eqz v0, :cond_5
.line 56
const-string v0, "#ff666666"
invoke-static {v0}, Landroid/graphics/Color;->parseColor(Ljava/lang/String;)I
move-result v0
invoke-virtual {p0, v0}, Lcom/android/systemui/statusbar/StatusBarView;->setBackgroundColor(I)V
goto :goto_0
.line 58
:cond_5
const-string v0, "com.estrongs.android.pop"
invoke-virtual {p1, v0}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v0
if-nez v0, :cond_6
const-string v0, "com.estrongs.android"
invoke-virtual {p1, v0}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v0
if-eqz v0, :cond_7
.line 60
:cond_6
const-string v0, "#ff66cae5"
invoke-static {v0}, Landroid/graphics/Color;->parseColor(Ljava/lang/String;)I
move-result v0
invoke-virtual {p0, v0}, Lcom/android/systemui/statusbar/StatusBarView;->setBackgroundColor(I)V
goto :goto_0
.line 62
:cond_7
const-string v0, "com.google.android.gms"
invoke-virtual {p1, v0}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v0
if-eqz v0, :cond_8
.line 64
const-string v0, "#ff96aa39"
invoke-static {v0}, Landroid/graphics/Color;->parseColor(Ljava/lang/String;)I
move-result v0
invoke-virtual {p0, v0}, Lcom/android/systemui/statusbar/StatusBarView;->setBackgroundColor(I)V
goto/16 :goto_0
.line 66
:cond_8
const-string v0, "com.facebook.katana"
invoke-virtual {p1, v0}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v0
if-eqz v0, :cond_9
.line 68
const-string v0, "#ff5978b0"
invoke-static {v0}, Landroid/graphics/Color;->parseColor(Ljava/lang/String;)I
move-result v0
invoke-virtual {p0, v0}, Lcom/android/systemui/statusbar/StatusBarView;->setBackgroundColor(I)V
goto/16 :goto_0
.line 70
:cond_9
const-string v0, "com.whatsapp"
invoke-virtual {p1, v0}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v0
if-eqz v0, :cond_a
.line 72
const-string v0, "#ff2f4444"
invoke-static {v0}, Landroid/graphics/Color;->parseColor(Ljava/lang/String;)I
move-result v0
invoke-virtual {p0, v0}, Lcom/android/systemui/statusbar/StatusBarView;->setBackgroundColor(I)V
goto/16 :goto_0
.line 74
:cond_a
const-string v0, "com.mgeek.android.DolphinBrowser.Browser"
invoke-virtual {p1, v0}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v0
if-eqz v0, :cond_b
.line 76
const-string v0, "#ff389d00"
invoke-static {v0}, Landroid/graphics/Color;->parseColor(Ljava/lang/String;)I
move-result v0
invoke-virtual {p0, v0}, Lcom/android/systemui/statusbar/StatusBarView;->setBackgroundColor(I)V
goto/16 :goto_0
.line 79
:cond_b
const-string v0, "com.uc.browser.en"
invoke-virtual {p1, v0}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v0
if-eqz v0, :cond_c
.line 81
const-string v0, "#ff31639c"
invoke-static {v0}, Landroid/graphics/Color;->parseColor(Ljava/lang/String;)I
move-result v0
invoke-virtual {p0, v0}, Lcom/android/systemui/statusbar/StatusBarView;->setBackgroundColor(I)V
goto/16 :goto_0
.line 85
:cond_c
const-string v0, "#FF000000" [COLOR="Red"]// THIS PART IS FOR THE DEFAULT COLOR FOR THE APPS THAT ARE NOT MENTIONED ABOVE [/COLOR]
invoke-static {v0}, Landroid/graphics/Color;->parseColor(Ljava/lang/String;)I
move-result v0
invoke-virtual {p0, v0}, Lcom/android/systemui/statusbar/StatusBarView;->setBackgroundColor(I)V
:try_end_0
.catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0
goto/16 :goto_0
.end method
Now if u want to add different apps then the follow this :
1. Find this part at the near end of the above code
Code:
.line 79
:cond_b
const-string v0,[COLOR="YellowGreen"] "com.uc.browser.en"[/COLOR] [COLOR="Red"]//this one is for UC browser[/COLOR]
invoke-virtual {p1, v0}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v0
if-eqz v0, :cond_c
.line 81
const-string v0, [COLOR="YellowGreen"]"#ff31639c"[/COLOR] [COLOR="Red"]//this color is for UC browser[/COLOR]
invoke-static {v0}, Landroid/graphics/Color;->parseColor(Ljava/lang/String;)I
move-result v0
invoke-virtual {p0, v0}, Lcom/android/systemui/statusbar/StatusBarView;->setBackgroundColor(I)V
goto/16 :goto_0
.line 85
:cond_c
...........................................
...........................................
2. Now to add your app just paste this segment below ... just as shown below :
Code:
.line 79
:cond_b
const-string v0,[COLOR="YellowGreen"] "com.uc.browser.en"[/COLOR] [COLOR="Red"]//this one is for UC browser[/COLOR]
invoke-virtual {p1, v0}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v0
if-eqz v0, :cond_c
.line 81
const-string v0, [COLOR="YellowGreen"]"#ff31639c"[/COLOR] [COLOR="Red"]//this color is for UC browser[/COLOR]
invoke-static {v0}, Landroid/graphics/Color;->parseColor(Ljava/lang/String;)I
move-result v0
invoke-virtual {p0, v0}, Lcom/android/systemui/statusbar/StatusBarView;->setBackgroundColor(I)V
goto/16 :goto_0
[COLOR="Purple"] .line 79
:cond_b
const-string v0,[COLOR="YellowGreen"] "Your app's package name "[/COLOR] [COLOR="Red"]//this one is for your app[/COLOR]
invoke-virtual {p1, v0}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v0
if-eqz v0, :cond_c
.line 81
const-string v0, [COLOR="YellowGreen"]"Color that you want to be set when this app is on the screen "[/COLOR] [COLOR="Red"]//this color is for your app[/COLOR]
invoke-static {v0}, Landroid/graphics/Color;->parseColor(Ljava/lang/String;)I
move-result v0
invoke-virtual {p0, v0}, [COLOR="Orange"]Lcom/android/systemui/statusbar/StatusBarView[/COLOR];->setBackgroundColor(I)V [COLOR="Red"]//JB USERS DON'T FORGET TO CHANGE THE LINES IN [COLOR="Orange"]ORANGE[/COLOR] TO[/COLOR] '[COLOR="DarkOrchid"]Lcom/android/systemui/statusbar/phone/PhoneStatusBarView[/COLOR]' [COLOR="Red"]WHERE REQUIRED [/COLOR]
goto/16 :goto_0[/COLOR]
.line 85
:cond_c [COLOR="Red"]// THIS PART IS FOR THE DEFAULT COLOR FOR THE APPS THAT ARE NOT MENTIONED ABOVE [/COLOR]
...........................................
...........................................[/COLOR]
YOU CAN ADD AS MANY APPS YOU WISH BUT FOLLOW THE SAME PATTERN AS SHOWN ABOVE. ALSO TAKE CARE THAT YOU ADD THE CODE BETWEEN UC BROWSER'S CODE AND THE DEFAULT COLOR CODE.
Thanks, will try tomorrow
iamareebjamal said:
Thanks, will try tomorrow
Click to expand...
Click to collapse
Thanks ... post updated now
One for Magnus buddy?
And you own a Magnus?
And please can you create updater-script for Magnus?
Minimilised_MR said:
One for Magnus buddy?
And you own a Magnus?
And please can you create updater-script for Magnus?
Click to expand...
Click to collapse
Tried it working perfectly
Just one thing,give statusbar colors.apk an icon
Thanks for this wonderful guide
nightwalker said:
Tried it working perfectly
Just one thing,give statusbar colors.apk an icon
Thanks for this wonderful guide
Click to expand...
Click to collapse
thanks for the confirmation and yeah ill give an icon for that in the next apk with reduced time delay in color update :fingers-crossed:
prithvee said:
thanks for the confirmation and yeah ill give an icon for that in the next apk with reduced time delay in color update :fingers-crossed:
Click to expand...
Click to collapse
Gud to know that
Thanks
Awesome guide! Hopefully you can make it work for ICS & Jelly Bean users as well! More power to you!
joeyhuab said:
Awesome guide! Hopefully you can make it work for ICS & Jelly Bean users as well! More power to you!
Click to expand...
Click to collapse
thanks,
it will be ready in two days
prithvee said:
thanks,
it will be ready in two days
Click to expand...
Click to collapse
wooww.. nice tutorial bro.. cant wait to try this on my GB Device. :good:
i set
.line 16
const-string v2, "#FF000000"
to "#00000000" and work. and then i start ur app and then my status bar to be black. but when i stop ur app, my statusbar still black. i should restart my device to make my statusbar transparent again.
and whe i want to add more apps and colors, i got error when recompile like this
I: Checking whether sources has changed...
I: Smaling...
Exception in thread "main" brut.androlib.AndrolibException: Could not smali file: [email protected]
at brut.androlib.src.DexFileBuilder.addSmaliFile(DexFileBuilder.java:45)
at brut.androlib.src.DexFileBuilder.addSmaliFile(DexFileBuilder.java:33)
at brut.androlib.src.SmaliBuilder.buildFile(SmaliBuilder.java:64)
at brut.androlib.src.SmaliBuilder.build(SmaliBuilder.java:48)
at brut.androlib.src.SmaliBuilder.build(SmaliBuilder.java:35)
at brut.androlib.Androlib.buildSourcesSmali(Androlib.java:243)
at brut.androlib.Androlib.buildSources(Androlib.java:200)
at brut.androlib.Androlib.build(Androlib.java:191)
at brut.androlib.Androlib.build(Androlib.java:174)
at brut.apktool.Main.cmdBuild(Main.java:185)
at brut.apktool.Main.main(Main.java:70)
Click to expand...
Click to collapse
cleverior.ipul said:
i set
.line 16
const-string v2, "#FF000000"
to "#00000000" and work. and then i start ur app and then my status bar to be black. but when i stop ur app, my statusbar still black. i should restart my device to make my statusbar transparent again.
and whe i want to add more apps and colors, i got error when recompile like this
Click to expand...
Click to collapse
sorry for the late reply.. I'm having my exams now
if u r adding #00000000 in the top segment then u must add also at the end where it resets the color.. I.e. at the end of the code..
and while adding new apps make sure you have deleted those comments
hi great guide, can its apply to JB 4.2.2 ? are the result same with tinted status bar?if yes then its looks great,thx for the answer
Nice guide. One question though. I want to make the background a drawable XML for a certain app (I want gradient background for the launcher) and I wasn't able to do so. Could you please help me out? Thanks.
hey dude,
nice guide keep up the good work.
But i have got an error when compiling .
Nice guide sir,this mod is work perfectly but i have question,can you show me the guide to tint not only at the main page of the app? Just in case that playstore has diferent action bar color when we press myapp list,and other tap..thanks before sir
[Guide How-to] KitKat 4.4.2/Android L Music Control - Volume Music Skip
UPDATED FOR ANDROID L
This guide requires knowledge of decompiling and compiling apk and smali files.
It is only a guide.
I do not take requests. If you want this mod for your rom, get with a dev with the knowledge to get it done.
I have attached android.policy files for diffing in case you get stuck on a section.
SecSettings.apk
In SecSettings.apk we setup the Music Control menu items & toggles.
(This edit does not work on Android L)
*** Add the two new files from the SecSettings_new_files.zip attached at the bottom of this post.
res/values/strings.xml edit:
Add new lines
Code:
<string name="volbtn_toggle_title">Music Control</string>
<string name="volbtn_timeout_title">Button Delay</string>
<string name="volbtn_timeout_summary">%s</string>
<string name="volbtn_vol_up_title">Volume Up Action</string>
<string name="volbtn_vol_up_summary">%s</string>
<string name="volbtn_vol_down_title">Volume Down Action</string>
<string name="volbtn_vol_down_summary">%s</string>
res/values/arrays.xml edit:
Add new lines
Code:
<string-array name="volbtn_action_entries">
<item>Next</item>
<item>Pause</item>
<item>Play</item>
<item>Play/Pause</item>
<item>Previous</item>
<item>Stop</item>
</string-array>
<string-array name="volbtn_action_values">
<item>87</item>
<item>127</item>
<item>126</item>
<item>85</item>
<item>88</item>
<item>86</item>
</string-array>
<string-array name="volbtn_timeout_entries">
<item>100ms</item>
<item>150ms</item>
<item>200ms</item>
<item>250ms</item>
<item>300ms</item>
<item>350ms</item>
<item>400ms</item>
<item>450ms</item>
<item>500ms</item>
</string-array>
<string-array name="volbtn_timeout_values">
<item>100</item>
<item>150</item>
<item>200</item>
<item>250</item>
<item>300</item>
<item>350</item>
<item>400</item>
<item>450</item>
<item>500</item>
</string-array>
res/xml/sound_settings.xml edit:
Add new line where you want the menu item to appear in the Sound settings menu.
Code:
<SwitchPreferenceScreen android:title="@string/volbtn_toggle_title" android:key="volbtn_music_controls" android:fragment="com.android.settings.VolBtnSettings" />
Smali Edit:
smali/com/android/settings/SoundSettings.smali
Add new line in BLUE
Code:
.field private mVibrateWhenRinging:Landroid/preference/CheckBoxPreference;
[COLOR="Blue"].field private mVolBtnMusicCtrl:Landroid/preference/SwitchPreferenceScreen;
[/COLOR]
.field private mVolume:Lcom/android/settings/RingerVolumePreference;
Increase locals value by 1 indicated in GREEN
Note:
When the change to .locals is increased by one, both of the V7 values in the new lines should be one LESS than the .locals value.
(New .locals value in our example is 8. 8-1=7, so we use V7)
Add new lines indicated in BLUE
Code:
.method private updateState(Z)V
[COLOR="Green"].locals 8
[/COLOR]
const/4 v2, 0x1
const/4 v4, 0x0
invoke-virtual {p0}, Landroid/app/Fragment;->getActivity()Landroid/app/Activity;
move-result-object v0
if-nez v0, :cond_1
:cond_0
:goto_0
return-void
:cond_1
iget-object v0, p0, Lcom/android/settings/SoundSettings;->mAudioManager:Landroid/media/AudioManager;
invoke-virtual {v0}, Landroid/media/AudioManager;->getRingerMode()I
move-result v6
[COLOR="Blue"] iget-object v1, p0, Lcom/android/settings/SoundSettings;->mVolBtnMusicCtrl:Landroid/preference/SwitchPreferenceScreen;
if-eqz v1, :cond_td
iget-object v3, p0, Lcom/android/settings/SoundSettings;->mVolBtnMusicCtrl:Landroid/preference/SwitchPreferenceScreen;
invoke-virtual {p0}, Lcom/android/settings/SoundSettings;->getContentResolver()Landroid/content/ContentResolver;
move-result-object v1
const-string v7, "volbtn_music_controls"
invoke-static {v1, v7, v4}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I
move-result v1
if-eqz v1, :cond_vol
move v1, v2
:goto_vol
invoke-virtual {v3, v1}, Landroid/preference/SwitchPreferenceScreen;->setChecked(Z)V
:cond_td
[/COLOR] const-string v0, "CTC"
New lines at the end of the same method.
Add lines indicated in BLUE
Code:
.method private updateState(Z)V
.
.
.
goto/16 :goto_1
[COLOR="Blue"] :cond_vol
move v1, v4
goto/16 :goto_vol
[/COLOR].end method
Search for the string "phone_vibration" in SoundSettings.smali and add the new lines indicated in BLUE right above it.
Code:
[COLOR="Blue"]const-string v32, "volbtn_music_controls"
move-object/from16 v0, p0
move-object/from16 v1, v32
invoke-virtual {v0, v1}, Lcom/android/settings/SoundSettings;->findPreference(Ljava/lang/CharSequence;)Landroid/preference/Preference;
move-result-object v32
check-cast v32, Landroid/preference/SwitchPreferenceScreen;
move-object/from16 v0, v32
move-object/from16 v1, p0
iput-object v0, v1, Lcom/android/settings/SoundSettings;->mVolBtnMusicCtrl:Landroid/preference/SwitchPreferenceScreen;
move-object/from16 v0, p0
iget-object v0, v0, Lcom/android/settings/SoundSettings;->mVolBtnMusicCtrl:Landroid/preference/SwitchPreferenceScreen;
move-object/from16 v32, v0
move-object/from16 v0, v32
move-object/from16 v1, p0
invoke-virtual {v0, v1}, Landroid/preference/Preference;->setOnPreferenceChangeListener(Landroid/preference/Preference$OnPreferenceChangeListener;)V
[/COLOR]
const-string v32, "phone_vibration"
Add new lines indicated in BLUE
Make sure values v2, v3 & v4 values match surrounding code.
Code:
.method public onPreferenceChange(Landroid/preference/Preference;Ljava/lang/Object;)Z
.locals 6
const/4 v0, 0x0
const/4 v1, 0x1
invoke-virtual {p1}, Landroid/preference/Preference;->getKey()Ljava/lang/String;
move-result-object v2
const-string v3, "SoundSettings"
new-instance v4, Ljava/lang/StringBuilder;
invoke-direct {v4}, Ljava/lang/StringBuilder;-><init>()V
const-string v5, "onPreferenceChange : "
invoke-virtual {v4, v5}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v4
invoke-virtual {v4, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v4
invoke-virtual {v4}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object v4
invoke-static {v3, v4}, Landroid/util/secutil/Log;->secV(Ljava/lang/String;Ljava/lang/String;)I
[COLOR="Blue"]const-string v3, "volbtn_music_controls"
invoke-virtual {v3, v2}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v3
if-eqz v3, :cond_td3
check-cast p2, Ljava/lang/Boolean;
invoke-virtual {p2}, Ljava/lang/Boolean;->booleanValue()Z
move-result v3
if-eqz v3, :cond_td4
const/4 v0, 0x1
:goto_td5
invoke-virtual {p0}, Lcom/android/settings/SoundSettings;->getContentResolver()Landroid/content/ContentResolver;
move-result-object v4
const-string v3, "volbtn_music_controls"
invoke-static {v4, v3, v0}, Landroid/provider/Settings$System;->putInt(Landroid/content/ContentResolver;Ljava/lang/String;I)Z
goto :goto_0
:cond_td4
const/4 v0, 0x0
goto :goto_td5
:cond_td3[/COLOR]
const-string v3, "emergency_tone"
We need to change three public value so compile the changed SecSettings.apk, then decompile it. Open res/values/public.xml and search for the string these strings and write down the public values:
"action_bar_switch_padding"
"volbtn_toggle_title"
"volbtn_settings"
Now in the original SecSettings, open the smali file we added
smali/com/android/settings/VolBtnSettings.smali, search for each of the strings and change your public value to match as indicated in BLUE.
Code:
const v4, 0x[COLOR="Blue"]7f0f0045[/COLOR] # type="dimen" name="action_bar_switch_padding"
const v4, 0x[COLOR="Blue"]7f091a29[/COLOR] # type="string" name="volbtn_toggle_title"
const v0, 0x[COLOR="Blue"]7f0700fe[/COLOR] # type="xml" name="volbtn_settings"
That should be it for SecSettings.apk. Compile after making these last value changes and make sure the Music Control menu functions before continuing with android.policy.jar.
android.policy.jar
(also see additional changes for Android L linked at the bottom of this post)
*** Add the two new files from the android.policy.new_files.zip attached at the bottom of this post.
Smali Edits
smali/com/android/internal/policy/impl/PhoneWindowManager.smali
Add new line in BLUE
Code:
.field private mKeyEventInjectionThread:Ljava/lang/Thread;
[COLOR="Blue"].field mIsVolLongPressed:Z
[/COLOR]
.field mKeyboardTapVibePattern:[J
Add new lines in BLUE
Code:
.field mVirtualKeyVibePattern:[J
[COLOR="Blue"].field mVolBtnMusicControls:I
.field mVolBtnTimeout:I
.field mVolBtnVolDown:I
.field mVolBtnVolUp:I
[/COLOR].field private mVolumeDownKeyConsumedByScreenshotChord:Z
.field private mVolumeDownKeyTime:J
.field private mVolumeDownKeyTriggered:Z
[COLOR="Blue"].field final mVolumeDownLongPress:Ljava/lang/Runnable;
[/COLOR]
.field private mVolumeUpKeyConsumedByScreenshotChord:Z
.field private mVolumeUpKeyTime:J
.field private mVolumeUpKeyTriggered:Z
[COLOR="Blue"].field final mVolumeUpLongPress:Ljava/lang/Runnable;
[/COLOR]
.field mWifiDisplayConnected:Z
Add new lines in BLUE near end of method BEFORE the return-void.
Code:
.method public constructor <init>()V
.
.
.
[COLOR="Blue"] new-instance v0, Lcom/android/internal/policy/impl/PhoneWindowManager$MusicNext;
invoke-direct {v0, p0}, Lcom/android/internal/policy/impl/PhoneWindowManager$MusicNext;-><init>(Lcom/android/internal/policy/impl/PhoneWindowManager;)V
iput-object v0, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mVolumeUpLongPress:Ljava/lang/Runnable;
new-instance v0, Lcom/android/internal/policy/impl/PhoneWindowManager$MusicPrev;
invoke-direct {v0, p0}, Lcom/android/internal/policy/impl/PhoneWindowManager$MusicPrev;-><init>(Lcom/android/internal/policy/impl/PhoneWindowManager;)V
iput-object v0, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mVolumeDownLongPress:Ljava/lang/Runnable;
[/COLOR]
return-void
.end method
.method static synthetic access$000(Lcom/android/internal/policy/impl/PhoneWindowManager;)V
Add new methods ABOVE
.method public hasNavigationBar()Z
Code:
.method handleVolumeLongPress(I)V
.locals 4
const/16 v1, 0x18
if-ne p1, v1, :cond_0
iget-object v0, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mVolumeUpLongPress:Ljava/lang/Runnable;
:goto_0
iget-object v1, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mHandler:Landroid/os/Handler;
iget v2, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mVolBtnTimeout:I
int-to-long v2, v2
invoke-virtual {v1, v0, v2, v3}, Landroid/os/Handler;->postDelayed(Ljava/lang/Runnable;J)Z
return-void
:cond_0
iget-object v0, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mVolumeDownLongPress:Ljava/lang/Runnable;
goto :goto_0
.end method
.method handleVolumeLongPressAbort()V
.locals 2
iget-object v0, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mHandler:Landroid/os/Handler;
iget-object v1, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mVolumeUpLongPress:Ljava/lang/Runnable;
invoke-virtual {v0, v1}, Landroid/os/Handler;->removeCallbacks(Ljava/lang/Runnable;)V
iget-object v0, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mHandler:Landroid/os/Handler;
iget-object v1, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mVolumeDownLongPress:Ljava/lang/Runnable;
invoke-virtual {v0, v1}, Landroid/os/Handler;->removeCallbacks(Ljava/lang/Runnable;)V
return-void
.end method
The next section may be a little difficult to find.
Search for the string: "interceptKeyBeforeQueueing: VOLUME key-down while ringing: Silence ringer!", scroll up a few lines and place the new lines indicated in BLUE, right below the :sswitch_1 statement.
Important Note:
(AFTER adding the new section below, come back here)
The v12 value may need to be changed to match surrounding code. The next occurrence in our code is this statement:
Code:
invoke-virtual {v0, v12, v6, v5}, Lcom/android/internal/policy/impl/sec/SamsungPhoneWindowManager;->handleSamsungVolumeControl(IZZ)V
Search for the next occurrence of handleSamsungVolumeControl(IZZ)V and if your second values of v12 & v6 match, then you are good to go. If it is NOT, then the v12 & v6 in the new code below needs to be changed to match that value.
Code:
:sswitch_1
[COLOR="Blue"] move-object/from16 v0, p0
iget v0, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mVolBtnMusicControls:I
if-eqz v0, :cond_td
invoke-virtual/range {p0 .. p0}, Lcom/android/internal/policy/impl/PhoneWindowManager;->isMusicActive()Z
move-result v0
if-eqz v0, :cond_td
move-object/from16 v0, p0
iget-boolean v0, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mScreenOnEarly:Z
if-nez v0, :cond_td
if-eqz v6, :cond_td2
move-object/from16 v0, p0
move/from16 v1, v12
invoke-virtual {v0, v1}, Lcom/android/internal/policy/impl/PhoneWindowManager;->handleVolumeLongPress(I)V
const/4 v15, 0x0
goto/16 :goto_0
:cond_td2
move-object/from16 v0, p0
invoke-virtual {v0}, Lcom/android/internal/policy/impl/PhoneWindowManager;->handleVolumeLongPressAbort()V
iget-boolean v1, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mIsVolLongPressed:Z
if-nez v1, :cond_td3
move/from16 v1, v12
const/4 v3, 0x3
invoke-virtual {v0, v3, v1}, Lcom/android/internal/policy/impl/PhoneWindowManager;->handleVolumeKey(II)V
:cond_td3
const/4 v1, 0x0
iput-boolean v1, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mIsVolLongPressed:Z
:cond_td
[/COLOR]
if-eqz v6, :cond_19
invoke-static {}, Lcom/android/internal/policy/impl/PhoneWindowManager;->getTelephonyService()Lcom/android/internal/telephony/ITelephony;
move-result-object v17
if-eqz v17, :cond_19
:try_start_0
invoke-interface/range {v17 .. v17}, Lcom/android/internal/telephony/ITelephony;->isRinging()Z
move-result v21
if-eqz v21, :cond_19
const-string v21, "WindowManager"
const-string v22, "interceptKeyBeforeQueueing: VOLUME key-down while ringing: Silence ringer!"
invoke-static/range {v21 .. v22}, Landroid/util/Log;->i(Ljava/lang/String;Ljava/lang/String;)I
invoke-interface/range {v17 .. v17}, Lcom/android/internal/telephony/ITelephony;->silenceRinger()V
:try_end_0
.catch Landroid/os/RemoteException; {:try_start_0 .. :try_end_0} :catch_0
and-int/lit8 v15, v15, -0x2
Android L version of previous section:
New code is BLUE, make sure the code in GREEN match original
Code:
:sswitch_0
[COLOR="Blue"] move-object/from16 v0, p0
iget v0, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mVolBtnMusicControls:I
if-eqz v0, :cond_td
invoke-virtual/range {p0 .. p0}, Lcom/android/internal/policy/impl/PhoneWindowManager;->isMusicActive()Z
move-result v0
if-eqz v0, :cond_td
move-object/from16 v0, p0
iget-boolean v0, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mScreenOnEarly:Z
if-nez v0, :cond_td
if-eqz v5, :cond_td2
move-object/from16 v0, p0
move/from16 v1, v11
invoke-virtual {v0, v1}, Lcom/android/internal/policy/impl/PhoneWindowManager;->handleVolumeLongPress(I)V
const/16 v16, 0x0
goto/16[/COLOR] [COLOR="Green"]:goto_8[/COLOR]
[COLOR="Blue"]:cond_td2
move-object/from16 v0, p0
invoke-virtual {v0}, Lcom/android/internal/policy/impl/PhoneWindowManager;->handleVolumeLongPressAbort()V
iget-boolean v1, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mIsVolLongPressed:Z
if-nez v1, :cond_td3
move/from16 v1, v11
const/4 v3, 0x3
invoke-virtual {v0, v3, v1}, Lcom/android/internal/policy/impl/PhoneWindowManager;->handleVolumeKey(II)V
:cond_td3
const/4 v1, 0x0
iput-boolean v1, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mIsVolLongPressed:Z
:cond_td[/COLOR]
invoke-virtual/range {p0 .. p0}, Lcom/android/internal/policy/impl/PhoneWindowManager;->getTelecommService()Landroid/telecom/TelecomManager;
move-result-object v17
if-eqz v17, :cond_19
if-eqz v5, :cond_18
invoke-virtual/range {v17 .. v17}, Landroid/telecom/TelecomManager;->isRinging()Z
move-result v21
if-eqz v21, :cond_18
const-string v21, "WindowManager"
const-string v22, "interceptKeyBeforeQueueing: VOLUME key-down while ringing: Silence ringer!"
invoke-static/range {v21 .. v22}, Landroid/util/Log;->i(Ljava/lang/String;Ljava/lang/String;)I
invoke-virtual/range {v17 .. v17}, Landroid/telecom/TelecomManager;->silenceRinger()V
and-int/lit8 v16, v16, -0x2
goto/16 [COLOR="Green"]:goto_8[/COLOR]
Add new method indicated in BLUE:
Code:
.method public isMetaKeyEventRequested(Landroid/content/ComponentName;)Z
.locals 1
iget-object v0, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mSystemKeyManager:Lcom/android/internal/policy/impl/sec/SystemKeyManager;
invoke-virtual {v0, p1}, Lcom/android/internal/policy/impl/sec/SystemKeyManager;->isMetaKeyEventRequested(Landroid/content/ComponentName;)Z
move-result v0
return v0
.end method
[COLOR="Blue"].method isMusicActive()Z
.locals 3
iget-object v1, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mContext:Landroid/content/Context;
const-string v2, "audio"
invoke-virtual {v1, v2}, Landroid/content/Context;->getSystemService(Ljava/lang/String;)Ljava/lang/Object;
move-result-object v0
check-cast v0, Landroid/media/AudioManager;
if-nez v0, :cond_0
const-string v1, "WindowManager"
const-string v2, "isMusicActive: couldn\'t get AudioManager reference"
invoke-static {v1, v2}, Landroid/util/Log;->w(Ljava/lang/String;Ljava/lang/String;)I
const/4 v1, 0x0
:goto_0
return v1
:cond_0
invoke-virtual {v0}, Landroid/media/AudioManager;->isLocalOrRemoteMusicActive()Z
move-result v1
goto :goto_0
.end method[/COLOR]
Add new method indicated in BLUE:
Code:
.method sendCloseSystemWindows(Ljava/lang/String;)V
.locals 1
iget-object v0, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mContext:Landroid/content/Context;
invoke-static {v0, p1}, Lcom/android/internal/policy/impl/PhoneWindowManager;->sendCloseSystemWindows(Landroid/content/Context;Ljava/lang/String;)V
return-void
.end method
[COLOR="Blue"].method protected sendMediaButtonEvent(I)V
.locals 13
invoke-static {}, Landroid/os/SystemClock;->uptimeMillis()J
move-result-wide v1
new-instance v11, Landroid/content/Intent;
const-string v4, "android.intent.action.MEDIA_BUTTON"
const/4 v5, 0x0
invoke-direct {v11, v4, v5}, Landroid/content/Intent;-><init>(Ljava/lang/String;Landroid/net/Uri;)V
new-instance v0, Landroid/view/KeyEvent;
const/4 v5, 0x0
const/4 v7, 0x0
move-wide v3, v1
move v6, p1
invoke-direct/range {v0 .. v7}, Landroid/view/KeyEvent;-><init>(JJIII)V
invoke-virtual {p0, v0}, Lcom/android/internal/policy/impl/PhoneWindowManager;->dispatchMediaKeyWithWakeLockToAudioService(Landroid/view/KeyEvent;)V
const/16 v2, 0x1
invoke-static {v0, v2}, Landroid/view/KeyEvent;->changeAction(Landroid/view/KeyEvent;I)Landroid/view/KeyEvent;
move-result-object v0
invoke-virtual {p0, v0}, Lcom/android/internal/policy/impl/PhoneWindowManager;->dispatchMediaKeyWithWakeLockToAudioService(Landroid/view/KeyEvent;)V
return-void
const-string v4, "android.intent.extra.KEY_EVENT"
invoke-virtual {v11, v4, v0}, Landroid/content/Intent;->putExtra(Ljava/lang/String;Landroid/os/Parcelable;)Landroid/content/Intent;
iget-object v4, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mContext:Landroid/content/Context;
const/4 v5, 0x0
invoke-virtual {v4, v11, v5}, Landroid/content/Context;->sendOrderedBroadcast(Landroid/content/Intent;Ljava/lang/String;)V
new-instance v12, Landroid/content/Intent;
const-string v4, "android.intent.action.MEDIA_BUTTON"
const/4 v5, 0x0
invoke-direct {v12, v4, v5}, Landroid/content/Intent;-><init>(Ljava/lang/String;Landroid/net/Uri;)V
new-instance v3, Landroid/view/KeyEvent;
const/4 v8, 0x1
const/4 v10, 0x0
move-wide v4, v1
move-wide v6, v1
move v9, p1
invoke-direct/range {v3 .. v10}, Landroid/view/KeyEvent;-><init>(JJIII)V
const-string v4, "android.intent.extra.KEY_EVENT"
invoke-virtual {v12, v4, v3}, Landroid/content/Intent;->putExtra(Ljava/lang/String;Landroid/os/Parcelable;)Landroid/content/Intent;
iget-object v4, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mContext:Landroid/content/Context;
const/4 v5, 0x0
invoke-virtual {v4, v12, v5}, Landroid/content/Context;->sendOrderedBroadcast(Landroid/content/Intent;Ljava/lang/String;)V
return-void
.end method[/COLOR]
Add new lines indicated in BLUE
NOTE:
Make note of the value of the line in GREEN.
If your value is different, the 4 occurrences of v13 in our new code must also be changed to match.
Example:
If your line before the new code is:
move-result-object v8
You would change the 4 values of v13 to v8.
Code:
.method public updateSettings()V
.locals 23
move-object/from16 v0, p0
iget-object v0, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mContext:Landroid/content/Context;
move-object/from16 v18, v0
invoke-virtual/range {v18 .. v18}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;
[COLOR="Green"]move-result-object v13
[/COLOR]
[COLOR="Blue"]const-string v7, "volbtn_music_controls"
const/4 v9, 0x0
invoke-static {v13, v7, v9}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I
move-result v3
move-object/from16 v0, p0
iput v3, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mVolBtnMusicControls:I
const-string v7, "volbtn_timeout"
const/16 v9, 0x190
invoke-static {v13, v7, v9}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I
move-result v3
move-object/from16 v0, p0
iput v3, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mVolBtnTimeout:I
const-string v7, "volbtn_vol_up"
const/16 v9, 0x57
invoke-static {v13, v7, v9}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I
move-result v3
move-object/from16 v0, p0
iput v3, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mVolBtnVolUp:I
const-string v7, "volbtn_vol_down"
const/16 v9, 0x58
invoke-static {v13, v7, v9}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I
move-result v3
move-object/from16 v0, p0
iput v3, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mVolBtnVolDown:I[/COLOR]
Android L Version of previous section:
New code is in BLUE
Code:
.method public updateSettings()V
.locals 19
move-object/from16 v0, p0
iget-object v15, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mContext:Landroid/content/Context;
invoke-virtual {v15}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;
move-result-object v9
[COLOR="Blue"]const-string v7, "volbtn_music_controls"
const/4 v10, 0x0
invoke-static {v9, v7, v10}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I
move-result v3
move-object/from16 v0, p0
iput v3, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mVolBtnMusicControls:I
const-string v7, "volbtn_timeout"
const/16 v10, 0x190
invoke-static {v9, v7, v10}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I
move-result v3
move-object/from16 v0, p0
iput v3, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mVolBtnTimeout:I
const-string v7, "volbtn_vol_up"
const/16 v10, 0x57
invoke-static {v9, v7, v10}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I
move-result v3
move-object/from16 v0, p0
iput v3, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mVolBtnVolUp:I
const-string v7, "volbtn_vol_down"
const/16 v10, 0x58
invoke-static {v9, v7, v10}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I
move-result v3
move-object/from16 v0, p0
iput v3, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mVolBtnVolDown:I[/COLOR]
Smali edit
\com\android\internal\policy\impl\PhoneWindowManager$SettingsObserver.smali
Search for string "immersive_mode_confirmations" and add new section in BLUE right above that line.
Make sure the values above in GREEN match the new code.
Code:
const-string v1, "default_input_method"
invoke-static {v1}, Landroid/provider/Settings$Secure;->getUriFor(Ljava/lang/String;)Landroid/net/Uri;
move-result-object v1
invoke-virtual {[COLOR="Green"]v0, v1, v4, p0, v5[/COLOR]}, Landroid/content/ContentResolver;->registerContentObserver(Landroid/net/Uri;ZLandroid/database/ContentObserver;I)V
[COLOR="Blue"] const-string v1, "volbtn_music_controls"
invoke-static {v1}, Landroid/provider/Settings$System;->getUriFor(Ljava/lang/String;)Landroid/net/Uri;
move-result-object v1
invoke-virtual {v0, v1, v4, p0, v5}, Landroid/content/ContentResolver;->registerContentObserver(Landroid/net/Uri;ZLandroid/database/ContentObserver;I)V
const-string v1, "volbtn_timeout"
invoke-static {v1}, Landroid/provider/Settings$System;->getUriFor(Ljava/lang/String;)Landroid/net/Uri;
move-result-object v1
invoke-virtual {v0, v1, v4, p0, v5}, Landroid/content/ContentResolver;->registerContentObserver(Landroid/net/Uri;ZLandroid/database/ContentObserver;I)V
const-string v1, "volbtn_vol_up"
invoke-static {v1}, Landroid/provider/Settings$System;->getUriFor(Ljava/lang/String;)Landroid/net/Uri;
move-result-object v1
invoke-virtual {v0, v1, v4, p0, v5}, Landroid/content/ContentResolver;->registerContentObserver(Landroid/net/Uri;ZLandroid/database/ContentObserver;I)V
const-string v1, "volbtn_vol_down"
invoke-static {v1}, Landroid/provider/Settings$System;->getUriFor(Ljava/lang/String;)Landroid/net/Uri;
move-result-object v1
invoke-virtual {v0, v1, v4, p0, v5}, Landroid/content/ContentResolver;->registerContentObserver(Landroid/net/Uri;ZLandroid/database/ContentObserver;I)V
[/COLOR]
const-string v1, "immersive_mode_confirmations"
Android L UPDATE:
Additional Android L Changes
Additional changes for Android L are here --->> Android L amended guide
Credits: @loserskater for the orginal mod HERE ; @jeboo for his GitHub HERE @sac23 for the tremendous help getting framework.jar changes
tdunham said:
[Guide How-to] KitKat 4.4.2 Music Control - Volume Music Skip and More
This guide requires knowledge of decompiling and compiling apk and smali files.
It is only a guide.
I do not take requests. If you want this mod for your rom, get with a dev with the knowledge to get it done.
I have attached android.policy files for diffing in case you get stuck on a section.
Click to expand...
Click to collapse
Thank you, thank. You are a god...
Sent from my SM-T320 using Xparent BlueTapatalk 2
Gotta agree with the above post... You are awesome dude...
Are you about to ask a question? Hold up. Before you do that, did you check HERE? or HERE? :good:
FOR ANY ND8 RELATED QUESTIONS PLEASE VISIT THIS THREAD ----> TouchWiz 4.4 KitKat ND8 myth busters
My KITKAT 4.4.2 Touchwiz, Blue PCB Theme
TOUCHWIZ KITKAT ANIMATED PULLDOWN BAR AND ANIMATED PULLDOWN BACKGROUND MOD
Another awesome guide TD! Thank you for sharing your knowledge with the community!
Sent from my SM-G900P using Tapatalk
@tdunham, you point to the VolBtnSettings in the settings.apk, but you didn't attach the files. Just giving you a heads up. Glad to see my work lives on! Thanks for updating this :good:
loserskater said:
@tdunham, you point to the VolBtnSettings in the settings.apk, but you didn't attach the files. Just giving you a heads up. Glad to see my work lives on! Thanks for updating this :good:
Click to expand...
Click to collapse
Thanks. I'm glad someone's looking out for me.
Thanks a ton for sharing your knowledge. You're a real class act man!
Appreciate you sharing the knowledge, thank you sir.
Delete
tdunham said:
Thanks. I'm glad someone's looking out for me.
Click to expand...
Click to collapse
Hey @tdunham...this is the first time for me using <SwitchPreferenceScreen in any mod...there shouldn't be a problem with me adding an icon to line should there?
<SwitchPreferenceScreen android:icon="@drawable/xxxxxxxx" android:title="@string/volbtn_toggle_title" android:key="volbtn_music_controls" android:fragment="com.android.settings.VolBtnSettings" />
Edit: I'll post pics when I'm done
deuce_biggins said:
Hey @tdunham...this is the first time for me using <SwitchPreferenceScreen in any mod...there shouldn't be a problem with me adding an icon to line should there?
<SwitchPreferenceScreen android:icon="@drawable/xxxxxxxx android:title="@string/volbtn_toggle_title" android:key="volbtn_music_controls" android:fragment="com.android.settings.VolBtnSettings" />
Click to expand...
Click to collapse
I don't see why not.
The good thing about SecSettings is that modifying it won't cause a bootloop, just a force close when you try to access the part of it that isn't coded properly.
However, why set an icon? This is a submenu of sounds and not a single item has an icon, stock Touchwiz of course. I just checked on my Galaxy SIII KitKat and the same goes there.
My SS is attached (without this menu item, we use CustomSettings.apk for toggles, colorizers & scripts).
Anyone get the android.policy edits right on the Sprint Note 3?
If someone with the know-how could take a look at my PhoneWindowsManager I'd sure be greatful. I'll leave it here......PhoneWindowsManager.smali
This is an error I'm getting when I...1 2 3 4 screenshot!
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Thank you
Once again my Sammy tablet is a bit diff...
Code:
.method public updateSettings()V
.locals 17
.prologue
.line 1714
move-object/from16 v0, p0
iget-object v12, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mContext:Landroid/content/Context;
invoke-virtual {v12}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;
move-result-object v8
.line 1715
.local v8, resolver:Landroid/content/ContentResolver;
const/4 v9, 0x0
.line 1722
.local v9, updateRotation:Z
const-string v12, "multi_window_enabled"
const/4 v13, 0x0
const/4 v14, -0x2
invoke-static {v8, v12, v13, v14}, Landroid/provider/Settings$System;->getIntForUser(Landroid/content/ContentResolver;Ljava/lang/String;II)I
move-result v1
.line 1726
.local v1, enableMultiWindowUISetting:I
move-object/from16 v0, p0
iget-object v13, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mLock:Ljava/lang/Object;
monitor-enter v13
.line 1728
:try_start_0
move-object/from16 v0, p0
iget-boolean v12, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mIsMultiWindowEnabled:Z
if-eqz v12, :cond_1
.line 1729
move-object/from16 v0, p0
iget-boolean v12, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mSystemReady:Z
if-eqz v12, :cond_1
.line 1730
move-object/from16 v0, p0
iget v12, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mEnableMultiWindowUISetting:I
const/4 v14, -0x1
if-ne v12, v14, :cond_c
.line 1731
move-object/from16 v0, p0
iget-object v12, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mContext:Landroid/content/Context;
invoke-virtual {v12}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;
move-result-object v12
const-string v14, "multi_window_flashbar_shown"
const/4 v15, -0x1
const/16 v16, -0x2
move/from16 v0, v16
invoke-static {v12, v14, v15, v0}, Landroid/provider/Settings$System;->getIntForUser(Landroid/content/ContentResolver;Ljava/lang/String;II)I
move-result v6
.line 1734
.local v6, lastFlashBarVisibility:I
if-nez v6, :cond_b
Where and how to put this last piece of code. in. I have tried several times, but all I get is Sammy Logo. No boot...
Code:
#Music Mod
const-string v7, "volbtn_music_controls"
const/4 v9, 0x0
invoke-static {v12, v7, v9}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I
move-result v3
move-object/from16 v0, p0
iput v3, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mVolBtnMusicControls:I
const-string v7, "volbtn_timeout"
const/16 v9, 0x190
invoke-static {v12, v7, v9}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I
move-result v3
move-object/from16 v0, p0
iput v3, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mVolBtnTimeout:I
const-string v7, "volbtn_vol_up"
const/16 v9, 0x57
invoke-static {v12, v7, v9}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I
move-result v3
move-object/from16 v0, p0
iput v3, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mVolBtnVolUp:I
const-string v7, "volbtn_vol_down"
const/16 v9, 0x58
invoke-static {v12, v7, v9}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I
move-result v3
move-object/from16 v0, p0
iput v3, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mVolBtnVolDown:I
#End of Add - Music Mod
1brainsurgeon said:
If someone with the know-how could take a look at my PhoneWindowsManager I'd sure be greatful. I'll leave it here......PhoneWindowsManager.smali
This is an error I'm getting when I...1 2 3 4 screenshot!
Thank you
Click to expand...
Click to collapse
The error is somewhere on or around line 16553 is what the baksmali is reporting there.
Gunthermic said:
Once again my Sammy tablet is a bit diff...
Click to expand...
Click to collapse
Line right before adding the new section:
Code:
move-result-object v8
You didn't use v8 in the 4 places like I recommended in the guide to replace v13 in the new code.
tdunham said:
Line right before adding the new section:
Code:
move-result-object v8
You didn't use v8 in the 4 places like I recommended in the guide to replace v13 in the new code.
Click to expand...
Click to collapse
Will try again. I actually tried be and v12.. but maybe the placement is the screwy part... will try and see.
Thank you for helping tdun
Sent from my SM-T320 using Xparent BlueTapatalk 2
Gunthermic said:
Will try again. I actually tried be and v12.. but maybe the placement is the screwy part... will try and see.
Click to expand...
Click to collapse
It HAS to be v8 in those 4 places but maybe we need to change some other values too. Let me know how you make out.
tdunham said:
It HAS to be v8 in those 4 places but maybe we need to change some other values too. Let me know how you make out.
Click to expand...
Click to collapse
I will try v8... I think that is the area that can cause a big issue... I will report back....
Sent from my SM-T320 using Xparent BlueTapatalk 2
Question. I haven't had time to try the android policy edits yet but finished settings.... I tried to click the menu in settings to see if it works.... But get an fc in tap, menu won't even open..... Is this due to not doing the policy edits yet.... Or should it at least open anyways? Curious if I should go back thru settings or not.
Thanks.