From 183cb71663320f16149d83eeebaff7795a4b55f2 Mon Sep 17 00:00:00 2001 From: linyuh Date: Wed, 27 Dec 2017 17:02:37 -0800 Subject: Remove field prefixes. Test: Existing tests PiperOrigin-RevId: 180230450 Change-Id: I0b2589cfeeaef81e42a04efa48af24b4e4d0e95f --- .../voicemail/impl/OmtpVvmCarrierConfigHelper.java | 142 ++++++++++----------- 1 file changed, 71 insertions(+), 71 deletions(-) (limited to 'java/com/android/voicemail/impl/OmtpVvmCarrierConfigHelper.java') diff --git a/java/com/android/voicemail/impl/OmtpVvmCarrierConfigHelper.java b/java/com/android/voicemail/impl/OmtpVvmCarrierConfigHelper.java index 0b63e8658..d5cde72bd 100644 --- a/java/com/android/voicemail/impl/OmtpVvmCarrierConfigHelper.java +++ b/java/com/android/voicemail/impl/OmtpVvmCarrierConfigHelper.java @@ -88,86 +88,86 @@ public class OmtpVvmCarrierConfigHelper { public static final String KEY_VVM_CLIENT_PREFIX_STRING = "vvm_client_prefix_string"; - @Nullable private static PersistableBundle sOverrideConfigForTest; + @Nullable private static PersistableBundle overrideConfigForTest; - private final Context mContext; - private final PersistableBundle mCarrierConfig; - private final String mVvmType; - private final VisualVoicemailProtocol mProtocol; - private final PersistableBundle mTelephonyConfig; + private final Context context; + private final PersistableBundle carrierConfig; + private final String vvmType; + private final VisualVoicemailProtocol protocol; + private final PersistableBundle telephonyConfig; - @Nullable private final PersistableBundle mOverrideConfig; + @Nullable private final PersistableBundle overrideConfig; - private PhoneAccountHandle mPhoneAccountHandle; + private PhoneAccountHandle phoneAccountHandle; public OmtpVvmCarrierConfigHelper(Context context, @Nullable PhoneAccountHandle handle) { - mContext = context; - mPhoneAccountHandle = handle; + this.context = context; + phoneAccountHandle = handle; TelephonyManager telephonyManager = context .getSystemService(TelephonyManager.class) - .createForPhoneAccountHandle(mPhoneAccountHandle); + .createForPhoneAccountHandle(phoneAccountHandle); if (telephonyManager == null) { VvmLog.e(TAG, "PhoneAccountHandle is invalid"); - mCarrierConfig = null; - mTelephonyConfig = null; - mOverrideConfig = null; - mVvmType = null; - mProtocol = null; + carrierConfig = null; + telephonyConfig = null; + overrideConfig = null; + vvmType = null; + protocol = null; return; } - if (sOverrideConfigForTest != null) { - mOverrideConfig = sOverrideConfigForTest; - mCarrierConfig = new PersistableBundle(); - mTelephonyConfig = new PersistableBundle(); + if (overrideConfigForTest != null) { + overrideConfig = overrideConfigForTest; + carrierConfig = new PersistableBundle(); + telephonyConfig = new PersistableBundle(); } else { if (ConfigOverrideFragment.isOverridden(context)) { - mOverrideConfig = ConfigOverrideFragment.getConfig(context); - VvmLog.w(TAG, "Config override is activated: " + mOverrideConfig); + overrideConfig = ConfigOverrideFragment.getConfig(context); + VvmLog.w(TAG, "Config override is activated: " + overrideConfig); } else { - mOverrideConfig = null; + overrideConfig = null; } - mCarrierConfig = getCarrierConfig(telephonyManager); - mTelephonyConfig = + carrierConfig = getCarrierConfig(telephonyManager); + telephonyConfig = new TelephonyVvmConfigManager(context).getConfig(telephonyManager.getSimOperator()); } - mVvmType = getVvmType(); - mProtocol = VisualVoicemailProtocolFactory.create(mContext.getResources(), mVvmType); + vvmType = getVvmType(); + protocol = VisualVoicemailProtocolFactory.create(this.context.getResources(), vvmType); } @VisibleForTesting OmtpVvmCarrierConfigHelper( Context context, PersistableBundle carrierConfig, PersistableBundle telephonyConfig) { - mContext = context; - mCarrierConfig = carrierConfig; - mTelephonyConfig = telephonyConfig; - mOverrideConfig = null; - mVvmType = getVvmType(); - mProtocol = VisualVoicemailProtocolFactory.create(mContext.getResources(), mVvmType); + this.context = context; + this.carrierConfig = carrierConfig; + this.telephonyConfig = telephonyConfig; + overrideConfig = null; + vvmType = getVvmType(); + protocol = VisualVoicemailProtocolFactory.create(this.context.getResources(), vvmType); } public PersistableBundle getConfig() { PersistableBundle result = new PersistableBundle(); - if (mTelephonyConfig != null) { - result.putAll(mTelephonyConfig); + if (telephonyConfig != null) { + result.putAll(telephonyConfig); } - if (mCarrierConfig != null) { - result.putAll(mCarrierConfig); + if (carrierConfig != null) { + result.putAll(carrierConfig); } return result; } public Context getContext() { - return mContext; + return context; } @Nullable public PhoneAccountHandle getPhoneAccountHandle() { - return mPhoneAccountHandle; + return phoneAccountHandle; } /** @@ -175,7 +175,7 @@ public class OmtpVvmCarrierConfigHelper { * known protocol. */ public boolean isValid() { - if (mProtocol == null) { + if (protocol == null) { return false; } if (isCarrierAppPreloaded()) { @@ -191,7 +191,7 @@ public class OmtpVvmCarrierConfigHelper { @Nullable public VisualVoicemailProtocol getProtocol() { - return mProtocol; + return protocol; } /** @returns arbitrary String stored in the config file. Used for protocol specific values. */ @@ -209,15 +209,15 @@ public class OmtpVvmCarrierConfigHelper { @Nullable private Set getCarrierVvmPackageNamesWithoutValidation() { - Set names = getCarrierVvmPackageNames(mOverrideConfig); + Set names = getCarrierVvmPackageNames(overrideConfig); if (names != null) { return names; } - names = getCarrierVvmPackageNames(mCarrierConfig); + names = getCarrierVvmPackageNames(carrierConfig); if (names != null) { return names; } - return getCarrierVvmPackageNames(mTelephonyConfig); + return getCarrierVvmPackageNames(telephonyConfig); } private static Set getCarrierVvmPackageNames(@Nullable PersistableBundle bundle) { @@ -255,7 +255,7 @@ public class OmtpVvmCarrierConfigHelper { } for (String packageName : carrierPackages) { try { - mContext.getPackageManager().getPackageInfo(packageName, 0); + context.getPackageManager().getPackageInfo(packageName, 0); return false; } catch (NameNotFoundException e) { // Do nothing. @@ -305,15 +305,15 @@ public class OmtpVvmCarrierConfigHelper { public Set getDisabledCapabilities() { Assert.checkArgument(isValid()); Set disabledCapabilities; - disabledCapabilities = getDisabledCapabilities(mOverrideConfig); + disabledCapabilities = getDisabledCapabilities(overrideConfig); if (disabledCapabilities != null) { return disabledCapabilities; } - disabledCapabilities = getDisabledCapabilities(mCarrierConfig); + disabledCapabilities = getDisabledCapabilities(carrierConfig); if (disabledCapabilities != null) { return disabledCapabilities; } - return getDisabledCapabilities(mTelephonyConfig); + return getDisabledCapabilities(telephonyConfig); } @Nullable @@ -367,7 +367,7 @@ public class OmtpVvmCarrierConfigHelper { return; } - if (mVvmType == null || mVvmType.isEmpty()) { + if (vvmType == null || vvmType.isEmpty()) { // The VVM type is invalid; we should never have gotten here in the first place since // this is loaded initially in the constructor, and callers should check isValid() // before trying to start activation anyways. @@ -375,15 +375,15 @@ public class OmtpVvmCarrierConfigHelper { return; } - if (mProtocol != null) { - ActivationTask.start(mContext, mPhoneAccountHandle, null); + if (protocol != null) { + ActivationTask.start(context, this.phoneAccountHandle, null); } } public void activateSmsFilter() { Assert.checkArgument(isValid()); TelephonyMangerCompat.setVisualVoicemailSmsFilterSettings( - mContext, + context, getPhoneAccountHandle(), new VisualVoicemailSmsFilterSettings.Builder().setClientPrefix(getClientPrefix()).build()); } @@ -394,18 +394,18 @@ public class OmtpVvmCarrierConfigHelper { if (!isLegacyModeEnabled()) { // SMS should still be filtered in legacy mode TelephonyMangerCompat.setVisualVoicemailSmsFilterSettings( - mContext, getPhoneAccountHandle(), null); + context, getPhoneAccountHandle(), null); VvmLog.i(TAG, "filter disabled"); } - if (mProtocol != null) { - mProtocol.startDeactivation(this); + if (protocol != null) { + protocol.startDeactivation(this); } - VvmAccountManager.removeAccount(mContext, getPhoneAccountHandle()); + VvmAccountManager.removeAccount(context, getPhoneAccountHandle()); } public boolean supportsProvisioning() { Assert.checkArgument(isValid()); - return mProtocol.supportsProvisioning(); + return protocol.supportsProvisioning(); } public void startProvisioning( @@ -415,18 +415,18 @@ public class OmtpVvmCarrierConfigHelper { StatusMessage message, Bundle data) { Assert.checkArgument(isValid()); - mProtocol.startProvisioning(task, phone, this, status, message, data); + protocol.startProvisioning(task, phone, this, status, message, data); } public void requestStatus(@Nullable PendingIntent sentIntent) { Assert.checkArgument(isValid()); - mProtocol.requestStatus(this, sentIntent); + protocol.requestStatus(this, sentIntent); } public void handleEvent(VoicemailStatus.Editor status, OmtpEvents event) { Assert.checkArgument(isValid()); VvmLog.i(TAG, "OmtpEvent:" + event); - mProtocol.handleEvent(mContext, this, status, event); + protocol.handleEvent(context, this, status, event); } @Override @@ -434,11 +434,11 @@ public class OmtpVvmCarrierConfigHelper { StringBuilder builder = new StringBuilder("OmtpVvmCarrierConfigHelper ["); builder .append("phoneAccountHandle: ") - .append(mPhoneAccountHandle) + .append(phoneAccountHandle) .append(", carrierConfig: ") - .append(mCarrierConfig != null) + .append(carrierConfig != null) .append(", telephonyConfig: ") - .append(mTelephonyConfig != null) + .append(telephonyConfig != null) .append(", type: ") .append(getVvmType()) .append(", destinationNumber: ") @@ -462,7 +462,7 @@ public class OmtpVvmCarrierConfigHelper { @Nullable private PersistableBundle getCarrierConfig(@NonNull TelephonyManager telephonyManager) { CarrierConfigManager carrierConfigManager = - (CarrierConfigManager) mContext.getSystemService(Context.CARRIER_CONFIG_SERVICE); + (CarrierConfigManager) context.getSystemService(Context.CARRIER_CONFIG_SERVICE); if (carrierConfigManager == null) { VvmLog.w(TAG, "No carrier config service found."); return null; @@ -484,21 +484,21 @@ public class OmtpVvmCarrierConfigHelper { @Nullable private Object getValue(String key, Object defaultValue) { Object result; - if (mOverrideConfig != null) { - result = mOverrideConfig.get(key); + if (overrideConfig != null) { + result = overrideConfig.get(key); if (result != null) { return result; } } - if (mCarrierConfig != null) { - result = mCarrierConfig.get(key); + if (carrierConfig != null) { + result = carrierConfig.get(key); if (result != null) { return result; } } - if (mTelephonyConfig != null) { - result = mTelephonyConfig.get(key); + if (telephonyConfig != null) { + result = telephonyConfig.get(key); if (result != null) { return result; } @@ -508,7 +508,7 @@ public class OmtpVvmCarrierConfigHelper { @VisibleForTesting public static void setOverrideConfigForTest(PersistableBundle config) { - sOverrideConfigForTest = config; + overrideConfigForTest = config; } private boolean isCarrierAppPreloaded() { -- cgit v1.2.3