My Android phone has the input system periodically freeze for up to thirty seconds. If it does so while I am tapping text in, some of the keypresses are ignored (for example, I might type "right away" and have the text "ray" appear). Sometimes, a dialog box saying "process 'System' isn't responding. Meanwhile, background processes such as showing a video keep running, unimpaired.
I tried clearing all caches. No improvement. I tried doing a factory reset. This helped for about a week, then the slowdowns reappeared.
I suspect some of the flash memory internal to the phone is going bad, causing multiple retries. I know the SD card isn't at fault, as I replaced the SD card, and that didn't solve the problem.
Is there an Android equivalent to scanning a hard drive for bad blocks, and mapping them to be avoided? My phone is not rooted, and no one has reported a way to root it. It is a 2019 Moto G Stylus.