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

Commit cbe357ed authored by Jordan Liu's avatar Jordan Liu Committed by Automerger Merge Worker
Browse files

Merge "Root locale need a configuration context" am: f58646a6

Original change: https://android-review.googlesource.com/c/platform/frameworks/opt/telephony/+/1512529

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I7ffb221d0e01689fd72eff008041f5ff32b9e14d
parents 4430e317 f58646a6
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);