I was just normally using my S4 when it restarted, and when it turned back on, it said Android is upgrading. The last time I saw this, I was notified of a software update, and I manually clicked install, IIRC. This time, it was sudden and unprecedented. I think this is a virus, though I don't know how I got it.
As it only optimised one app, and not all, it means that this app had to be recompiled. It is possible that this app had just been updated, and failed to get compiled at installation, but it's more likely that some file(s) needed by the already compiled app had been corrupted. As your phone rebooted, this app was probably a critical system app, the failure of which caused the kernel to panic (strictly speaking, a panic isn't a crash, but an active decision by the kernel to shut operations down immediately).
Data corruption shouldn't occur on a healthy storage device, but nothing is perfect, and it occasionally does. If this doesn't happen again, you needn't worry, but if it does, it may indicate that the internal storage in your phone is starting to fail. This eventually happens to all storage devicees, flash storage as well as magnetic and optical media. Back up your personal data as often as you can, and consider getting a new phone. If it does not only happen again, but does so more and more frequently, you should definitely get a new phone as soon as possible.
Theoretically it could be a virus that corrupted the file(s), but a virus that infects apps in a way that the apps or the kernel can detect, wouldn't be very cleverly designed, so I seriously doubt that this is the case.