Merge "Prevent NPE from changing all apps visibility in shared state." into main