Easy mod to save a bit of battery.
When the screen goes from dark background to light background or viceverse there is an animation in systemui (nougat stock s7e) to progressively tinting status bar icons.
This animation calls 3-4 times to the method managing the icons tint (icons, texts..).
So, we will reduce to 2 times the number of calls taken into account. We will expend some instructions to check if the tinting has to be applied, nothing compared to the number of instructions if we would leave it stock. I do not see a huge difference in the effect
- Decompile SystemUI
- Edit com/android/systemui/statusbar/phone/StatusBarIconController.smali
- Do the following changes in this method
--------------------------
Vamos a salvar un poco de batería evitando un montonazo de instrucciones mediante la limitación del número de veces que se aplica el tintado de los iconos y resto de vistas existentes en la barra de estado. Para ello, limitamos el número de veces que se ejecuta el tintado por causa de la animación de transición existente, en las transiciones de fondos oscuros a claros o viceversa . Ya sabéis, granito a granito.. Añadimos unas pocas lineas a cambio de evitar un montón de líneas..
----------------------
You can check what i mean easily. If you do not do this change
Your icons will appear grey when going from light to dark background. We are avoiding 2 tinting (lot of instructions involved) calls with this little hack
When the screen goes from dark background to light background or viceverse there is an animation in systemui (nougat stock s7e) to progressively tinting status bar icons.
This animation calls 3-4 times to the method managing the icons tint (icons, texts..).
So, we will reduce to 2 times the number of calls taken into account. We will expend some instructions to check if the tinting has to be applied, nothing compared to the number of instructions if we would leave it stock. I do not see a huge difference in the effect
- Decompile SystemUI
- Edit com/android/systemui/statusbar/phone/StatusBarIconController.smali
- Do the following changes in this method
--------------------------
Vamos a salvar un poco de batería evitando un montonazo de instrucciones mediante la limitación del número de veces que se aplica el tintado de los iconos y resto de vistas existentes en la barra de estado. Para ello, limitamos el número de veces que se ejecuta el tintado por causa de la animación de transición existente, en las transiciones de fondos oscuros a claros o viceversa . Ya sabéis, granito a granito.. Añadimos unas pocas lineas a cambio de evitar un montón de líneas..
----------------------
Código:
.method private setIconTintInternal(F)V
.locals 4 ### change locals 3 to 4
### add these lines
float-to-int v1, p1
iget v2, p0, Lcom/android/systemui/statusbar/phone/StatusBarIconController;->mDarkIntensity:F
float-to-int v2, v2
if-eq v1, v2, :cond_exit
int-to-float v1, v1
iput v1, p0, Lcom/android/systemui/statusbar/phone/StatusBarIconController;->mDarkIntensity:F
#####
#iput p1, p0, Lcom/android/systemui/statusbar/phone/StatusBarIconController;->mDarkIntensity:F ### remove this line
invoke-static {}, Landroid/animation/ArgbEvaluator;->getInstance()Landroid/animation/ArgbEvaluator;
move-result-object v0
iget v1, p0, Lcom/android/systemui/statusbar/phone/StatusBarIconController;->mLightModeIconColorSingleTone:I
invoke-static {v1}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;
move-result-object v1
iget v2, p0, Lcom/android/systemui/statusbar/phone/StatusBarIconController;->mDarkModeIconColorSingleTone:I
invoke-static {v2}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;
move-result-object v2
iget v3, p0, Lcom/android/systemui/statusbar/phone/StatusBarIconController;->mDarkIntensity:F ### add this line
#invoke-virtual {v0, p1, v1, v2}, Landroid/animation/ArgbEvaluator;->evaluate(FLjava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; ### remove this line
invoke-virtual {v0, v3, v1, v2}, Landroid/animation/ArgbEvaluator;->evaluate(FLjava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; #### add this line
move-result-object v0
check-cast v0, Ljava/lang/Integer;
invoke-virtual {v0}, Ljava/lang/Integer;->intValue()I
move-result v0
iput v0, p0, Lcom/android/systemui/statusbar/phone/StatusBarIconController;->mIconTint:I
iget-object v0, p0, Lcom/android/systemui/statusbar/phone/StatusBarIconController;->mNotificationIconAreaController:Lcom/android/systemui/statusbar/phone/NotificationIconAreaController;
iget v1, p0, Lcom/android/systemui/statusbar/phone/StatusBarIconController;->mIconTint:I
invoke-virtual {v0, v1}, Lcom/android/systemui/statusbar/phone/NotificationIconAreaController;->setIconTint(I)V
invoke-virtual {p0}, Lcom/android/systemui/statusbar/phone/StatusBarIconController;->applyIconTint()V
:cond_exit ### add this line
return-void
.end method
You can check what i mean easily. If you do not do this change
Código:
#invoke-virtual {v0, p1, v1, v2}, Landroid/animation/ArgbEvaluator;->evaluate(FLjava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; ### remove this line
invoke-virtual {v0, v3, v1, v2}, Landroid/animation/ArgbEvaluator;->evaluate(FLjava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; #### add this line
Your icons will appear grey when going from light to dark background. We are avoiding 2 tinting (lot of instructions involved) calls with this little hack