Refactor DynamicSystemInstallationService notifications

Right now we use two flags to track the internal states of DSU
notifications, mJustCancelledByUser and mKeepNotification. This makes
the notification posting / dismissing logic very complicated, as any
method can potentially modify the flags.

This change refactors the logic around postStatus() and
resetTaskAndStop() and remove the two flags. After this change,
notification posting logic are consolidated within postStatus() and
dismissing logic are consolidated within resetTaskAndStop().

Bug: 165471299
Test: Start a DSU installation and test "cancel" & "discard"
Change-Id: I59548553e0e92399d322c301011dfd270e7bb0e9
1 file changed