Merge "Consider lock state when determining next activity to become visible." into pi-dev