Apple has filed a patent for self-maintenance technology for the iPhone that detects when you're not using it and automatically cleans or fixes itself.

The patent, filed by Apple in July 2014 but made public now, outlines various ways that an iPhone could keep itself running.

One scenario in Apple's patent involves an iPhone that has been covered in liquid. We all know that getting your iPhone wet is bad, but Apple says that getting water stuck in speaker is a real problem.

Apple's patent goes on to say that a wet iPhone could wait until the owner is somewhere loud (a bar or concert, for example) and then emit a special tone through its speaker that would reduce the amount of liquid in there.

Here's an image from Apple's patent that gives an example of a loud place:

The patent also explains how an iPhone could fix itself while you sleep. Some iPhones have issues with their screens, such as dead pixels. This can be fixed, Apple says, by cycling through a screen diagnostic schedule that lights up the screen in different ways.

It can take several hours to do this — but the iPhone could wait until its owner is asleep, and automatically do it then.

Other maintenance activities that Apple says an iPhone could do while you're asleep include testing the camera and making sure it's working, and resetting cellular components if the user had problems connecting to the internet or sending text messages.

There's no guarantee that the technology described will make it into the iPhone 7. Apple patents lots of different products and ideas, and very few of them make it to market. The Cupertino company also uses patents to protect its own ideas, and to advertise itself, so a patent filing isn't a sign that it's definitely working on an idea.

But some of the techniques it describes — fixing dead pixels and resetting components, for example — are already possible today. What the patent describes would be an easy way to make iPhones run more smoothly, without the owner having to lift a finger.