Adjusted conditional statements to use instanceof when comparing variables. Instanceof supports inheritance type checking better than type. Change-Id: I4ee0004934dc2322d43ef07e797a6811e39a812c Closes-Bug: 1548530