Ensure locale is correct when querying MediaProvider

MediaProvider listens for locale changes using the regular
BroadcastReceiver mechanism. Because MediaProvider listens via a
Manifest receiver and is a system component, it will usually register
before other applications. Broadcasts are sent in reverse registration
order and Manifest receivers are given lower priority vs runtime
receivers. Because of this, MediaProvider will usually be informed of
locale changes after other applications.

If an application receives a locale change broadcast and immediately
queries MediaProvider it's possible for MediaProvider to have not yet
received the locale change broadcast and its data may be stale.

This CL forces MediaProvider to ensure its locale is up to date when
being queried to avoid this issue.

Bug: 161337469
Test: Manual - Change system locale and immediately launch Clock app.
Ensure that ringtone titles localize correctly.

Change-Id: I881933f4368a390070c80030da36f2672eda2a5c
1 file changed