<div dir="ltr">I have the following Jimple:<div><div><br></div><div> public boolean getFlashlightEnabled()</div><div>    {</div><div>        com.android.server.lights.LightsService$1 r0;</div><div>        int i0;</div><div>        java.io.FileInputStream $r1, r3; // I&#39;m interested in this</div><div>        java.lang.Exception $r2;</div><div>        boolean $z0;</div><div>        r0 := @this: com.android.server.lights.LightsService$1;</div><div>     label1:</div><div>        $r1 = new java.io.FileInputStream;</div><div>        specialinvoke $r1.&lt;java.io.FileInputStream: void &lt;init&gt;(java.lang.String)&gt;(&quot;/sys/class/leds/spotlight/brightness&quot;);  // But my interest in $r1 and r3 are predicated upon this</div><div>        r3 = $r1;</div><div>        i0 = virtualinvoke r3.&lt;java.io.FileInputStream: int read()&gt;();</div><div>        virtualinvoke r3.&lt;java.io.FileInputStream: void close()&gt;();</div><div>        if i0 == 48 goto label2;</div><div>        $z0 = 1;</div><div>        goto label3;</div><div>     label2:</div><div>        $z0 = 0;</div><div>     label3:</div><div>        return $z0;</div><div>     label4:</div><div>        $r2 := @caughtexception;</div><div>        return 0;</div><div>        catch java.lang.Exception from label1 to label3 with label4;</div><div>    }</div></div><div><br></div><div>You can see that I am interested in the variable that, in some way or another, uses the &quot;/sys/class/leds/spotlight/brightness&quot; string.  Thus, I am interested in the variable $r1.  But I don&#39;t know that I&#39;m interested in $r1 until I see that $r1 is using the string that I am interested.</div><div><br></div><div>Now I know that $r1 is a local, more specifically a LinkedRValueBox.  I know that the string, &quot;/sys/class/...&quot; is an ImmediateBox, which is leveraged in an InvokeExprBox (specialinvoke $r1...).  What I cannot seem to manage to figure out is how to derive the Local $r1 variable from either the InvokeExprBox or the ImmediateBox.  Neither of them have any formal link to $r1 (a Local) other than by parsing the string representation of them and then going through the Locals looking for what you want.</div><div><br></div><div>So my question is: Is there a way to get the Local from the InvokeExprBox or the ImmediateBox in this case, or the general case?  I can only get ValueBoxes from anything which is of ValueBox, as defined by the ValueBox interface.</div><div><br></div><div>Thanks.</div></div>