Fix crash when rotating all apps

Bug: 8134296
Change-Id: If03a66aae1beefc7e58b36c01f9f904cb586955d