Your phone can already use a combination of signals to determine where you are, including known WiFi access points. However, that's designed to give you a geographic location. In Android P, Google has added support for IEEE 802.11mc, which allows apps to measure the distance to nearby WiFi access points and determine your exact indoor location.

The IEEE 802.11mc is more commonly known as WiFi Round-Trip-Time (RTT). Using RTT, apps can measure how long it takes for signals to travel between you and the AP. With a single WiFi access point, all you get from that is a distance measurement. With three or more nearby APs, an app can triangulate your location with an accuracy of 1-2 meters. Not all devices have the necessary hardware support for this feature, though.

With accurate indoor position awareness, apps can perform advanced automation based on where you are in a building. For example, you can have lights turn on when you enter a particular room or simply make voice controls location-aware (eg. "turn on the lights in this room").

WiFi Round-Trip-Time in Android P does not require your phone to connect to any WiFi access points, and only the phone is used to determine distance, not the APs. This feature is also tied into Android's existing location system to preserve your privacy. Apps using RTT need the location permission, and you must have location services enabled at the system level.

Source: Android Developers