[Google Camera Mods] defcomg:
Fixes WB Issue on S9 goes in cok.smali gcam 5.1.018***4271

.method public static a(Liic;Lgdq;)Lcom/google/googlex/gcam/AwbInfo;
.locals 10

const/4 v6, 0x4

new-instance v3, Lcom/google/googlex/gcam/AwbInfo;

invoke-direct {v3}, Lcom/google/googlex/gcam/AwbInfo;-><init>()V

sget v0, Lcok;->c:I

invoke-virtual {v3, v0}, Lcom/google/googlex/gcam/AwbInfo;->setColor_temp(I)V

sget-object v1, Landroid/hardware/camera2/CaptureResult;->SENSOR_NEUTRAL_COLOR_POINT:Landroid/hardware/camera2/CaptureResult$Key;

invoke-interface {p0, v1}, Liic;->a(Landroid/hardware/camera2/CaptureResult$Key;)Ljava/lang/Object;

move-result-object v0

check-cast v0, [Landroid/util/Rational;

if-nez v0, :cond_0

sget-object v0, Lcok;->a:Ljava/lang/String;

invoke-virtual {v1}, Landroid/hardware/camera2/CaptureResult$Key;->getName()Ljava/lang/String;

move-result-object v1

invoke-static {v1}, Ljava/lang/String;->valueOf(Ljava/lang/Object;)Ljava/lang/String;

move-result-object v2

invoke-virtual {v2}, Ljava/lang/String;->length()I

move-result v2

add-int/lit8 v2, v2, 0x1b

new-instance v4, Ljava/lang/StringBuilder;

invoke-direct {v4, v2}, Ljava/lang/StringBuilder;-><init>(I)V

const-string v2, "getAwbGains - key "

invoke-virtual {v4, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

move-result-object v2

invoke-virtual {v2, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

move-result-object v1

const-string v2, " is null."

invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

move-result-object v1

invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

move-result-object v1

invoke-static {v0, v1}, Lbhz;->e(Ljava/lang/String;Ljava/lang/String;)V

new-array v0, v6, [F

const/high16 v1, 0x3f800000 # 1.0f

invoke-static {v0, v1}, Ljava/util/Arrays;->fill([FF)V

:goto_0
invoke-static {v0}, Ldeeznutz/lol;->logArray([F)V

invoke-virtual {v3, v0}, Lcom/google/googlex/gcam/AwbInfo;->setGains([F)V

sget-object v0, Landroid/hardware/camera2/CaptureResult;->COLOR_CORRECTION_TRANSFORM:Landroid/hardware/camera2/CaptureResult$Key;

invoke-interface {p0, v0}, Liic;->a(Landroid/hardware/camera2/CaptureResult$Key;)Ljava/lang/Object;

move-result-object v0

check-cast v0, Landroid/hardware/camera2/params/ColorSpaceTransform;

if-nez v0, :cond_2

sget-object v0, Lcok;->a:Ljava/lang/String;

const-string v1, "getAwbRgb2Rgb: CaptureResult.COLOR_CORRECTION_TRANSFORM is null."

invoke-static {v0, v1}, Lbhz;->e(Ljava/lang/String;Ljava/lang/String;)V

const/16 v0, 0x9

new-array v0, v0, [F

fill-array-data v0, :array_0

:goto_1

invoke-static {v0}, Ldeeznutz/lol;->logArray([F)V
invoke-virtual {v3, v0}, Lcom/google/googlex/gcam/AwbInfo;->setRgb2rgb([F)V

return-object v3

:cond_0
new-array v2, v6, [F

sget-object v1, Landroid/hardware/camera2/CameraCharacteristics;->SENSOR_INFO_COLOR_FILTER_ARRANGEMENT:Landroid/hardware/camera2/CameraCharacteristics$Key;

invoke-interface {p1, v1}, Lgdq;->a(Landroid/hardware/camera2/CameraCharacteristics$Key;)Ljava/lang/Object;

move-result-object v1

check-cast v1, Ljava/lang/Integer;

invoke-virtual {v1}, Ljava/lang/Integer;->intValue()I

move-result v1

invoke-static {v1}, Lcok;->a(I)[I

move-result-object v4

const/4 v1, 0x0
const/4 v6, 0x1
:goto_2

if-ge v1, v6, :cond_1

#aget v5, v4, v1
#invoke-virtual {v0, v5}, Landroid/hardware/camera2/params/RggbChannelVector;->getComponent(I)F
#move-result v5

const/high16 v8, 0x3f800000 # 1.0f

######################### IDX1 #########################################################
const/4 v5, 0x0
const/4 v7, 0x0

aget-object v5, v0, v5

invoke-virtual {v5}, Landroid/util/Rational;->floatValue()F

move-result v5

div-float v9, v8, v5

aput v9, v2, v7
####################### IDX2 #############################################

const/4 v5, 0x1
const/4 v7, 0x1
const/high16 v8, 0x3f800000 # 1.0f
aget-object v5, v0, v5

invoke-virtual {v5}, Landroid/util/Rational;->floatValue()F

move-result v5
div-float v9, v8, v5

aput v9, v2, v7
###################### IDX3 ########################################################
const/4 v5, 0x1
const/4 v7, 0x2
const/high16 v8, 0x3f800000 # 1.0f
aget-object v5, v0, v5

invoke-virtual {v5}, Landroid/util/Rational;->floatValue()F

move-result v5
div-float v9, v8, v5

aput v9, v2, v7
####################### IDX4 ###########################################################
const/4 v5, 0x2
const/4 v7, 0x3
const/high16 v8, 0x3f800000 # 1.0f
aget-object v5, v0, v5

invoke-virtual {v5}, Landroid/util/Rational;->floatValue()F

move-result v5
div-float v9, v8, v5

aput v9, v2, v7
##################################################################################

add-int/lit8 v1, v1, 0x1

goto :goto_2

:cond_1
move-object v0, v2

goto :goto_0

:cond_2
invoke-static {v0}, Lcok;->a(Landroid/hardware/camera2/params/ColorSpaceTransform;)[F

move-result-object v0

goto :goto_1

:array_0
.array-data 4
0x3f800000 # 1.0f
0x0
0x0
0x0
0x3f800000 # 1.0f
0x0
0x0
0x0
0x3f800000 # 1.0f
.end array-data
.end method