Handle races caused by rapid settings changed broadcasts

- Fix b/10447517

Change-Id: I63ef98c9023cee1a15be61b966aed06dc35e9bd5
This commit is contained in:
Tom O'Neill
2013-08-23 15:23:12 -07:00
parent 32e016b5fa
commit e17ce5fb73
3 changed files with 232 additions and 114 deletions

View File

@@ -31,6 +31,7 @@ import android.preference.PreferenceGroup;
import android.preference.PreferenceManager;
import android.preference.PreferenceScreen;
import android.provider.Settings;
import android.util.Log;
import android.view.Gravity;
import android.widget.CompoundButton;
import android.widget.Switch;
@@ -47,6 +48,9 @@ import java.util.List;
*/
public class LocationSettings extends LocationSettingsBase
implements CompoundButton.OnCheckedChangeListener {
private static final String TAG = "LocationSettings";
/** Key for preference screen "Mode" */
private static final String KEY_LOCATION_MODE = "location_mode";
/** Key for preference category "Recent location requests" */
@@ -146,8 +150,6 @@ public class LocationSettings extends LocationSettingsBase
}
});
final PreferenceManager preferenceManager = getPreferenceManager();
PreferenceCategory categoryRecentLocationRequests =
(PreferenceCategory) root.findPreference(KEY_RECENT_LOCATION_REQUESTS);
RecentLocationApps recentApps = new RecentLocationApps(activity, mStatsHelper);
@@ -172,6 +174,9 @@ public class LocationSettings extends LocationSettingsBase
mReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
if (Log.isLoggable(TAG, Log.DEBUG)) {
Log.d(TAG, "Received settings change intent: " + intent);
}
injector.reloadStatusMessages();
}
};