javaandroidbooleanapksmali

How to set a iput-object boolean to true in Smali?


I'm trying to edit a smali file of a decompiled Android APK I (legally) have. I can't figure out how to make this boolean be always true:

.method public setValid(Ljava/lang/Boolean;)V
    .locals 0

    .line 34
    iput-object p1, p0, Ltr/net/tbc/api/entity/GoalValidity;->valid:Ljava/lang/Boolean;

    return-void
.end method

and/or this one:

.method public getValid()Ljava/lang/Boolean;
    .locals 1

    .line 30
    iget-object v0, p0, Ltr/net/tbc/api/entity/GoalValidity;->valid:Ljava/lang/Boolean;

    return-object v0
.end method

Thanks so much for anyone helping.


Solution

  • put sget-object p1, Ljava/lang/Boolean;->FALSE:Ljava/lang/Boolean; before the iput-object instruction.

    Or, replace the iget-object instruction with sget-object v0, Ljava/lang/Boolean;->FALSE:Ljava/lang/Boolean;