Fix leak in RotationHelper registration to DeviceStateManager
It seems RotationHelper#enable was being called several times, and each "enable" was not matched by a "disabled". This resulted in DeviceStateManager#FoldStateListener having a huge number of callbacks, and eventually it took 500ms for DeviceStateManager to deliver the event to SystemUI.
This avoids creating a new listener every time: the DSM#registerCallback will not register a callback twice.
Flag: None
Fixes: 310584951
Test: checked listeners count after unfolds and rotations
Change-Id: I7e938794031203828bad26a4ee114a9a3b147668
1 file changed