Merge "Clear the previous states before setting the new app visibility"