use of org.chromium.chrome.browser.preferences.PrefServiceBridge in project AndroidChromium by JackyAndroid.
the class ChromeActivitySessionTracker method updateAcceptLanguages.
/**
* Update the accept languages after changing Android locale setting. Doing so kills the
* Activities but it doesn't kill the Application, so this should be called in
* {@link #onStart} instead of {@link #initialize}.
*/
private void updateAcceptLanguages() {
PrefServiceBridge instance = PrefServiceBridge.getInstance();
// ex) en_US, de_DE, zh_CN_#Hans
String localeString = Locale.getDefault().toString();
if (hasLocaleChanged(localeString)) {
instance.resetAcceptLanguages(localeString);
// Clear cache so that accept-languages change can be applied immediately.
// TODO(changwan): The underlying BrowsingDataRemover::Remove() is an asynchronous call.
// So cache-clearing may not be effective if URL rendering can happen before
// OnBrowsingDataRemoverDone() is called, in which case we may have to reload as well.
// Check if it can happen.
instance.clearBrowsingData(null, new int[] { BrowsingDataType.CACHE }, TimePeriod.ALL_TIME);
}
}
Aggregations