implement new logic, start detect when set active not set event

fix memory leak when reporting orientation