jadx
jadx copied to clipboard
[core] Extra local variables
Describe error
- latest unstable
- com.xiaomi.hm.health.utils.TelephonyUtil
- "mute" method
public final void mute(@NotNull Context context, boolean z) {
int i;
int i2;
Intrinsics.checkParameterIsNotNull(context, "context");
Object systemService = context.getSystemService("audio");
if (systemService != null) {
AudioManager audioManager = (AudioManager) systemService;
if (z) {
Object systemService2 = context.getSystemService("telecom");
if (systemService2 != null) {
boolean checkPermission = Utils.checkPermission(context, Permission.READ_PHONE_STATE) & ((TelecomManager) systemService2).isInCall();
if (b == -1 && checkPermission) {
b = audioManager.getRingerMode();
if (a() && c == -1) {
b = audioManager.getStreamVolume(1);
audioManager.setStreamVolume(1, 0, 0);
return;
}
return;
}
return;
}
throw new TypeCastException("null cannot be cast to non-null type android.telecom.TelecomManager");
} else if (!z && (i = b) != -1) {
audioManager.setRingerMode(i);
if (a() && (i2 = c) != -1) {
audioManager.setStreamVolume(1, i2, 0);
c = -1;
}
b = -1;
}
} else {
throw new TypeCastException("null cannot be cast to non-null type android.media.AudioManager");
}
}
local var i and i2 are always equal to global variables b and c, so they don't make sense.
- JEB 3 code
@SuppressLint(value={"MissingPermission"}) public final void mute(@NotNull Context arg6, boolean arg7) {
int v6;
Intrinsics.checkParameterIsNotNull(arg6, "context");
Object v0 = arg6.getSystemService("audio");
if(v0 != null) {
int v3 = -1;
if(arg7) {
Object v7 = arg6.getSystemService("telecom");
if(v7 != null) {
v6 = Utils.checkPermission(arg6, "android.permission.READ_PHONE_STATE") & ((TelecomManager)v7).isInCall();
if(TelephonyUtil.b == v3 && v6 != 0) {
TelephonyUtil.b = ((AudioManager)v0).getRingerMode();
if((this.a()) && TelephonyUtil.c == v3) {
TelephonyUtil.b = ((AudioManager)v0).getStreamVolume(1);
((AudioManager)v0).setStreamVolume(1, 0, 0);
}
}
}
else {
throw new TypeCastException("null cannot be cast to non-null type android.telecom.TelecomManager");
}
}
else if(!arg7) {
v6 = TelephonyUtil.b;
if(v6 != v3) {
((AudioManager)v0).setRingerMode(v6);
if(this.a()) {
v6 = TelephonyUtil.c;
if(v6 != v3) {
((AudioManager)v0).setStreamVolume(1, v6, 0);
TelephonyUtil.c = v3;
}
}
TelephonyUtil.b = v3;
}
}
return;
}
throw new TypeCastException("null cannot be cast to non-null type android.media.AudioManager");
}
}
@amspeople thanks! Looks like the cause is too aggressive variable assign inlining, I will try to fix this.
Thanks! You may also fix unnecessary "return" calls