ClassZeroActivity: Resolve some possible NPEs, and refactor common code

Match up to the final version merged upstream

Change-Id: I215188f5ea508b3c0b69189c1bf6ccc7601eed7b