Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f58646a6 authored by Jordan Liu's avatar Jordan Liu Committed by Gerrit Code Review
Browse files

Merge "Root locale need a configuration context"

parents 6ecb63f1 44acbc44
Loading
Loading
Loading
Loading
+9 −2
Original line number Diff line number Diff line
@@ -29,6 +29,7 @@ import static com.android.internal.telephony.cdnr.EfData.EF_SOURCE_VOICE_OPERATO

import android.annotation.NonNull;
import android.content.Context;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.os.PersistableBundle;
import android.telephony.CarrierConfigManager;
@@ -340,8 +341,14 @@ public class CarrierDisplayNameResolver {
            CarrierDisplayNameData rawCarrierDisplayNameData) {
        PersistableBundle config = getCarrierConfig();
        boolean useRootLocale = config.getBoolean(CarrierConfigManager.KEY_WFC_SPN_USE_ROOT_LOCALE);
        Resources r = mContext.getResources();
        if (useRootLocale) r.getConfiguration().setLocale(Locale.ROOT);
        Context displayNameContext = mContext;
        if (useRootLocale) {
            Configuration displayNameConfig = mContext.getResources().getConfiguration();
            displayNameConfig.setLocale(Locale.ROOT);
            // Create a new Context for this temporary change
            displayNameContext = mContext.createConfigurationContext(displayNameConfig);
        }
        Resources r = displayNameContext.getResources();
        String[] wfcSpnFormats = r.getStringArray(com.android.internal.R.array.wfcSpnFormats);
        WfcCarrierNameFormatter wfcFormatter = new WfcCarrierNameFormatter(config, wfcSpnFormats,
                getServiceState().getState() == ServiceState.STATE_POWER_OFF);