summaryrefslogtreecommitdiff
path: root/java/com/android/voicemail/impl
diff options
context:
space:
mode:
authorlinyuh <linyuh@google.com>2017-12-27 17:02:37 -0800
committerCopybara-Service <copybara-piper@google.com>2017-12-27 17:03:47 -0800
commit183cb71663320f16149d83eeebaff7795a4b55f2 (patch)
treebc8bfcce809257b3ddbb423a9808082292b9f6a3 /java/com/android/voicemail/impl
parentfc81a030a7b4f6d4a497f71aed593d398795e7da (diff)
Remove field prefixes.
Test: Existing tests PiperOrigin-RevId: 180230450 Change-Id: I0b2589cfeeaef81e42a04efa48af24b4e4d0e95f
Diffstat (limited to 'java/com/android/voicemail/impl')
-rw-r--r--java/com/android/voicemail/impl/ActivationTask.java18
-rw-r--r--java/com/android/voicemail/impl/Assert.java12
-rw-r--r--java/com/android/voicemail/impl/OmtpEvents.java20
-rw-r--r--java/com/android/voicemail/impl/OmtpVvmCarrierConfigHelper.java142
-rw-r--r--java/com/android/voicemail/impl/TelephonyVvmConfigManager.java16
-rw-r--r--java/com/android/voicemail/impl/Voicemail.java192
-rw-r--r--java/com/android/voicemail/impl/VoicemailStatus.java46
-rw-r--r--java/com/android/voicemail/impl/VvmLog.java32
-rw-r--r--java/com/android/voicemail/impl/VvmPhoneStateListener.java48
-rw-r--r--java/com/android/voicemail/impl/fetch/FetchVoicemailReceiver.java58
-rw-r--r--java/com/android/voicemail/impl/fetch/VoicemailFetchedCallback.java34
-rw-r--r--java/com/android/voicemail/impl/imap/ImapHelper.java137
-rw-r--r--java/com/android/voicemail/impl/imap/VoicemailPayload.java12
-rw-r--r--java/com/android/voicemail/impl/mail/Address.java60
-rw-r--r--java/com/android/voicemail/impl/mail/Base64Body.java16
-rw-r--r--java/com/android/voicemail/impl/mail/BodyPart.java4
-rw-r--r--java/com/android/voicemail/impl/mail/FixedLengthInputStream.java28
-rw-r--r--java/com/android/voicemail/impl/mail/MailTransport.java126
-rw-r--r--java/com/android/voicemail/impl/mail/Message.java22
-rw-r--r--java/com/android/voicemail/impl/mail/MessagingException.java16
-rw-r--r--java/com/android/voicemail/impl/mail/Multipart.java24
-rw-r--r--java/com/android/voicemail/impl/mail/PackedString.java34
-rw-r--r--java/com/android/voicemail/impl/mail/PeekableInputStream.java37
-rw-r--r--java/com/android/voicemail/impl/mail/TempDirectory.java8
-rw-r--r--java/com/android/voicemail/impl/mail/internet/BinaryTempFileBody.java16
-rw-r--r--java/com/android/voicemail/impl/mail/internet/MimeBodyPart.java46
-rw-r--r--java/com/android/voicemail/impl/mail/internet/MimeHeader.java20
-rw-r--r--java/com/android/voicemail/impl/mail/internet/MimeMessage.java150
-rw-r--r--java/com/android/voicemail/impl/mail/internet/MimeMultipart.java42
-rw-r--r--java/com/android/voicemail/impl/mail/internet/TextBody.java10
-rw-r--r--java/com/android/voicemail/impl/mail/store/ImapConnection.java116
-rw-r--r--java/com/android/voicemail/impl/mail/store/ImapFolder.java100
-rw-r--r--java/com/android/voicemail/impl/mail/store/ImapStore.java78
-rw-r--r--java/com/android/voicemail/impl/mail/store/imap/DigestMd5Utils.java48
-rw-r--r--java/com/android/voicemail/impl/mail/store/imap/ImapElement.java8
-rw-r--r--java/com/android/voicemail/impl/mail/store/imap/ImapList.java22
-rw-r--r--java/com/android/voicemail/impl/mail/store/imap/ImapMemoryLiteral.java18
-rw-r--r--java/com/android/voicemail/impl/mail/store/imap/ImapResponse.java22
-rw-r--r--java/com/android/voicemail/impl/mail/store/imap/ImapResponseParser.java50
-rw-r--r--java/com/android/voicemail/impl/mail/store/imap/ImapSimpleString.java12
-rw-r--r--java/com/android/voicemail/impl/mail/store/imap/ImapString.java20
-rw-r--r--java/com/android/voicemail/impl/mail/store/imap/ImapTempFileLiteral.java20
-rw-r--r--java/com/android/voicemail/impl/mail/utility/CountingOutputStream.java16
-rw-r--r--java/com/android/voicemail/impl/mail/utils/LogUtils.java12
-rw-r--r--java/com/android/voicemail/impl/protocol/Vvm3Subscriber.java68
-rw-r--r--java/com/android/voicemail/impl/scheduling/BaseTask.java76
-rw-r--r--java/com/android/voicemail/impl/scheduling/MinimalIntervalPolicy.java22
-rw-r--r--java/com/android/voicemail/impl/scheduling/PostponePolicy.java16
-rw-r--r--java/com/android/voicemail/impl/scheduling/RetryPolicy.java59
-rw-r--r--java/com/android/voicemail/impl/sms/OmtpMessageReceiver.java18
-rw-r--r--java/com/android/voicemail/impl/sms/OmtpMessageSender.java21
-rw-r--r--java/com/android/voicemail/impl/sms/OmtpStandardMessageSender.java28
-rw-r--r--java/com/android/voicemail/impl/sms/StatusMessage.java104
-rw-r--r--java/com/android/voicemail/impl/sms/StatusSmsFetcher.java29
-rw-r--r--java/com/android/voicemail/impl/sms/SyncMessage.java56
-rw-r--r--java/com/android/voicemail/impl/sync/OmtpVvmSyncService.java76
-rw-r--r--java/com/android/voicemail/impl/sync/SyncOneTask.java14
-rw-r--r--java/com/android/voicemail/impl/sync/SyncTask.java14
-rw-r--r--java/com/android/voicemail/impl/sync/VoicemailStatusQueryHelper.java16
-rw-r--r--java/com/android/voicemail/impl/sync/VoicemailsQueryHelper.java38
-rw-r--r--java/com/android/voicemail/impl/sync/VvmNetworkRequest.java20
-rw-r--r--java/com/android/voicemail/impl/sync/VvmNetworkRequestCallback.java72
-rw-r--r--java/com/android/voicemail/impl/utils/IndentingPrintWriter.java64
63 files changed, 1389 insertions, 1390 deletions
diff --git a/java/com/android/voicemail/impl/ActivationTask.java b/java/com/android/voicemail/impl/ActivationTask.java
index 83f2fd836..3cdbee484 100644
--- a/java/com/android/voicemail/impl/ActivationTask.java
+++ b/java/com/android/voicemail/impl/ActivationTask.java
@@ -63,16 +63,16 @@ public class ActivationTask extends BaseTask {
@VisibleForTesting static final String EXTRA_MESSAGE_DATA_BUNDLE = "extra_message_data_bundle";
- private final RetryPolicy mRetryPolicy;
+ private final RetryPolicy retryPolicy;
@Nullable private OmtpVvmCarrierConfigHelper configForTest;
- private Bundle mMessageData;
+ private Bundle messageData;
public ActivationTask() {
super(TASK_ACTIVATION);
- mRetryPolicy = new RetryPolicy(RETRY_TIMES, RETRY_INTERVAL_MILLIS);
- addPolicy(mRetryPolicy);
+ retryPolicy = new RetryPolicy(RETRY_TIMES, RETRY_INTERVAL_MILLIS);
+ addPolicy(retryPolicy);
}
/** Has the user gone through the setup wizard yet. */
@@ -108,7 +108,7 @@ public class ActivationTask extends BaseTask {
@Override
public void onCreate(Context context, Bundle extras) {
super.onCreate(context, extras);
- mMessageData = extras.getParcelable(EXTRA_MESSAGE_DATA_BUNDLE);
+ messageData = extras.getParcelable(EXTRA_MESSAGE_DATA_BUNDLE);
}
@Override
@@ -168,7 +168,7 @@ public class ActivationTask extends BaseTask {
}
VvmLog.i(TAG, "VVM content provider configured - " + helper.getVvmType());
- if (mMessageData == null
+ if (messageData == null
&& VvmAccountManager.isAccountActivated(getContext(), phoneAccountHandle)) {
VvmLog.i(TAG, "Account is already activated");
// The activated state might come from restored data, the filter still needs to be set up.
@@ -191,15 +191,15 @@ public class ActivationTask extends BaseTask {
}
helper.activateSmsFilter();
- VoicemailStatus.Editor status = mRetryPolicy.getVoicemailStatusEditor();
+ VoicemailStatus.Editor status = retryPolicy.getVoicemailStatusEditor();
VisualVoicemailProtocol protocol = helper.getProtocol();
Bundle data;
- if (mMessageData != null) {
+ if (messageData != null) {
// The content of STATUS SMS is provided to launch this task, no need to request it
// again.
- data = mMessageData;
+ data = messageData;
} else {
try (StatusSmsFetcher fetcher = new StatusSmsFetcher(getContext(), phoneAccountHandle)) {
protocol.startActivation(helper, fetcher.getSentIntent());
diff --git a/java/com/android/voicemail/impl/Assert.java b/java/com/android/voicemail/impl/Assert.java
index fe063727a..0e9e4dc7d 100644
--- a/java/com/android/voicemail/impl/Assert.java
+++ b/java/com/android/voicemail/impl/Assert.java
@@ -21,7 +21,7 @@ import android.os.Looper;
/** Assertions which will result in program termination. */
public class Assert {
- private static Boolean sIsMainThreadForTest;
+ private static Boolean isMainThreadForTest;
public static void isTrue(boolean condition) {
if (!condition) {
@@ -30,16 +30,16 @@ public class Assert {
}
public static void isMainThread() {
- if (sIsMainThreadForTest != null) {
- isTrue(sIsMainThreadForTest);
+ if (isMainThreadForTest != null) {
+ isTrue(isMainThreadForTest);
return;
}
isTrue(Looper.getMainLooper().equals(Looper.myLooper()));
}
public static void isNotMainThread() {
- if (sIsMainThreadForTest != null) {
- isTrue(!sIsMainThreadForTest);
+ if (isMainThreadForTest != null) {
+ isTrue(!isMainThreadForTest);
return;
}
isTrue(!Looper.getMainLooper().equals(Looper.myLooper()));
@@ -52,6 +52,6 @@ public class Assert {
/** Override the main thread status for tests. Set to null to revert to normal behavior */
@NeededForTesting
public static void setIsMainThreadForTesting(Boolean isMainThread) {
- sIsMainThreadForTest = isMainThread;
+ isMainThreadForTest = isMainThread;
}
}
diff --git a/java/com/android/voicemail/impl/OmtpEvents.java b/java/com/android/voicemail/impl/OmtpEvents.java
index 6807edcf0..ddca80f1a 100644
--- a/java/com/android/voicemail/impl/OmtpEvents.java
+++ b/java/com/android/voicemail/impl/OmtpEvents.java
@@ -123,30 +123,30 @@ public enum OmtpEvents {
public static final int OTHER = 4;
}
- private final int mType;
- private final boolean mIsSuccess;
+ private final int type;
+ private final boolean isSuccess;
OmtpEvents(int type, boolean isSuccess) {
- mType = type;
- mIsSuccess = isSuccess;
+ this.type = type;
+ this.isSuccess = isSuccess;
}
OmtpEvents(int type) {
- mType = type;
- mIsSuccess = false;
+ this.type = type;
+ isSuccess = false;
}
OmtpEvents() {
- mType = Type.OTHER;
- mIsSuccess = false;
+ type = Type.OTHER;
+ isSuccess = false;
}
@Type.Values
public int getType() {
- return mType;
+ return type;
}
public boolean isSuccess() {
- return mIsSuccess;
+ return isSuccess;
}
}
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<String> getCarrierVvmPackageNamesWithoutValidation() {
- Set<String> names = getCarrierVvmPackageNames(mOverrideConfig);
+ Set<String> 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<String> 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<String> getDisabledCapabilities() {
Assert.checkArgument(isValid());
Set<String> 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() {
diff --git a/java/com/android/voicemail/impl/TelephonyVvmConfigManager.java b/java/com/android/voicemail/impl/TelephonyVvmConfigManager.java
index 046113c26..ecf4e6ffc 100644
--- a/java/com/android/voicemail/impl/TelephonyVvmConfigManager.java
+++ b/java/com/android/voicemail/impl/TelephonyVvmConfigManager.java
@@ -43,28 +43,28 @@ public class TelephonyVvmConfigManager {
private static final String KEY_FEATURE_FLAG_NAME = "feature_flag_name";
- private static Map<String, PersistableBundle> sCachedConfigs;
+ private static Map<String, PersistableBundle> cachedConfigs;
- private final Map<String, PersistableBundle> mConfigs;
+ private final Map<String, PersistableBundle> configs;
public TelephonyVvmConfigManager(Context context) {
- if (sCachedConfigs == null) {
- sCachedConfigs = loadConfigs(context, context.getResources().getXml(R.xml.vvm_config));
+ if (cachedConfigs == null) {
+ cachedConfigs = loadConfigs(context, context.getResources().getXml(R.xml.vvm_config));
}
- mConfigs = sCachedConfigs;
+ configs = cachedConfigs;
}
@VisibleForTesting
TelephonyVvmConfigManager(Context context, XmlPullParser parser) {
- mConfigs = loadConfigs(context, parser);
+ configs = loadConfigs(context, parser);
}
@Nullable
public PersistableBundle getConfig(String mccMnc) {
if (USE_DEBUG_CONFIG) {
- return mConfigs.get("TEST");
+ return configs.get("TEST");
}
- return mConfigs.get(mccMnc);
+ return configs.get(mccMnc);
}
private static Map<String, PersistableBundle> loadConfigs(Context context, XmlPullParser parser) {
diff --git a/java/com/android/voicemail/impl/Voicemail.java b/java/com/android/voicemail/impl/Voicemail.java
index f98d56f0a..a2282a92a 100644
--- a/java/com/android/voicemail/impl/Voicemail.java
+++ b/java/com/android/voicemail/impl/Voicemail.java
@@ -25,17 +25,17 @@ import android.text.TextUtils;
/** Represents a single voicemail stored in the voicemail content provider. */
public class Voicemail implements Parcelable {
- private final Long mTimestamp;
- private final String mNumber;
- private final PhoneAccountHandle mPhoneAccount;
- private final Long mId;
- private final Long mDuration;
- private final String mSource;
- private final String mProviderData;
- private final Uri mUri;
- private final Boolean mIsRead;
- private final Boolean mHasContent;
- private final String mTranscription;
+ private final Long timestamp;
+ private final String number;
+ private final PhoneAccountHandle phoneAccount;
+ private final Long id;
+ private final Long duration;
+ private final String source;
+ private final String providerData;
+ private final Uri uri;
+ private final Boolean isRead;
+ private final Boolean hasContent;
+ private final String transcription;
private Voicemail(
Long timestamp,
@@ -49,17 +49,17 @@ public class Voicemail implements Parcelable {
Boolean isRead,
Boolean hasContent,
String transcription) {
- mTimestamp = timestamp;
- mNumber = number;
- mPhoneAccount = phoneAccountHandle;
- mId = id;
- mDuration = duration;
- mSource = source;
- mProviderData = providerData;
- mUri = uri;
- mIsRead = isRead;
- mHasContent = hasContent;
- mTranscription = transcription;
+ this.timestamp = timestamp;
+ this.number = number;
+ phoneAccount = phoneAccountHandle;
+ this.id = id;
+ this.duration = duration;
+ this.source = source;
+ this.providerData = providerData;
+ this.uri = uri;
+ this.isRead = isRead;
+ this.hasContent = hasContent;
+ this.transcription = transcription;
}
/**
@@ -89,93 +89,93 @@ public class Voicemail implements Parcelable {
*/
public static class Builder {
- private Long mBuilderTimestamp;
- private String mBuilderNumber;
- private PhoneAccountHandle mBuilderPhoneAccount;
- private Long mBuilderId;
- private Long mBuilderDuration;
- private String mBuilderSourcePackage;
- private String mBuilderSourceData;
- private Uri mBuilderUri;
- private Boolean mBuilderIsRead;
- private boolean mBuilderHasContent;
- private String mBuilderTranscription;
+ private Long builderTimestamp;
+ private String builderNumber;
+ private PhoneAccountHandle builderPhoneAccount;
+ private Long builderId;
+ private Long builderDuration;
+ private String builderSourcePackage;
+ private String builderSourceData;
+ private Uri builderUri;
+ private Boolean builderIsRead;
+ private boolean builderHasContent;
+ private String builderTranscription;
/** You should use the correct factory method to construct a builder. */
private Builder() {}
public Builder setNumber(String number) {
- mBuilderNumber = number;
+ builderNumber = number;
return this;
}
public Builder setTimestamp(long timestamp) {
- mBuilderTimestamp = timestamp;
+ builderTimestamp = timestamp;
return this;
}
public Builder setPhoneAccount(PhoneAccountHandle phoneAccount) {
- mBuilderPhoneAccount = phoneAccount;
+ builderPhoneAccount = phoneAccount;
return this;
}
public Builder setId(long id) {
- mBuilderId = id;
+ builderId = id;
return this;
}
public Builder setDuration(long duration) {
- mBuilderDuration = duration;
+ builderDuration = duration;
return this;
}
public Builder setSourcePackage(String sourcePackage) {
- mBuilderSourcePackage = sourcePackage;
+ builderSourcePackage = sourcePackage;
return this;
}
public Builder setSourceData(String sourceData) {
- mBuilderSourceData = sourceData;
+ builderSourceData = sourceData;
return this;
}
public Builder setUri(Uri uri) {
- mBuilderUri = uri;
+ builderUri = uri;
return this;
}
public Builder setIsRead(boolean isRead) {
- mBuilderIsRead = isRead;
+ builderIsRead = isRead;
return this;
}
public Builder setHasContent(boolean hasContent) {
- mBuilderHasContent = hasContent;
+ builderHasContent = hasContent;
return this;
}
public Builder setTranscription(String transcription) {
- mBuilderTranscription = transcription;
+ builderTranscription = transcription;
return this;
}
public Voicemail build() {
- mBuilderId = mBuilderId == null ? -1 : mBuilderId;
- mBuilderTimestamp = mBuilderTimestamp == null ? 0 : mBuilderTimestamp;
- mBuilderDuration = mBuilderDuration == null ? 0 : mBuilderDuration;
- mBuilderIsRead = mBuilderIsRead == null ? false : mBuilderIsRead;
+ builderId = builderId == null ? -1 : builderId;
+ builderTimestamp = builderTimestamp == null ? 0 : builderTimestamp;
+ builderDuration = builderDuration == null ? 0 : builderDuration;
+ builderIsRead = builderIsRead == null ? false : builderIsRead;
return new Voicemail(
- mBuilderTimestamp,
- mBuilderNumber,
- mBuilderPhoneAccount,
- mBuilderId,
- mBuilderDuration,
- mBuilderSourcePackage,
- mBuilderSourceData,
- mBuilderUri,
- mBuilderIsRead,
- mBuilderHasContent,
- mBuilderTranscription);
+ builderTimestamp,
+ builderNumber,
+ builderPhoneAccount,
+ builderId,
+ builderDuration,
+ builderSourcePackage,
+ builderSourceData,
+ builderUri,
+ builderIsRead,
+ builderHasContent,
+ builderTranscription);
}
}
@@ -187,27 +187,27 @@ public class Voicemail implements Parcelable {
* none is specified, we return -1.
*/
public long getId() {
- return mId;
+ return id;
}
/** The number of the person leaving the voicemail, empty string if unknown, null if not set. */
public String getNumber() {
- return mNumber;
+ return number;
}
/** The phone account associated with the voicemail, null if not set. */
public PhoneAccountHandle getPhoneAccount() {
- return mPhoneAccount;
+ return phoneAccount;
}
/** The timestamp the voicemail was received, in millis since the epoch, zero if not set. */
public long getTimestampMillis() {
- return mTimestamp;
+ return timestamp;
}
/** Gets the duration of the voicemail in millis, or zero if the field is not set. */
public long getDuration() {
- return mDuration;
+ return duration;
}
/**
@@ -215,7 +215,7 @@ public class Voicemail implements Parcelable {
* set.
*/
public String getSourcePackage() {
- return mSource;
+ return source;
}
/**
@@ -227,7 +227,7 @@ public class Voicemail implements Parcelable {
* server-generated identifying string.
*/
public String getSourceData() {
- return mProviderData;
+ return providerData;
}
/**
@@ -236,7 +236,7 @@ public class Voicemail implements Parcelable {
* <p>Returns null if we don't know the Uri.
*/
public Uri getUri() {
- return mUri;
+ return uri;
}
/**
@@ -245,17 +245,17 @@ public class Voicemail implements Parcelable {
* <p>Always returns false if this field has not been set, i.e. if hasRead() returns false.
*/
public boolean isRead() {
- return mIsRead;
+ return isRead;
}
/** Tells us if there is content stored at the Uri. */
public boolean hasContent() {
- return mHasContent;
+ return hasContent;
}
/** Returns the text transcription of this voicemail, or null if this field is not set. */
public String getTranscription() {
- return mTranscription;
+ return transcription;
}
@Override
@@ -265,35 +265,35 @@ public class Voicemail implements Parcelable {
@Override
public void writeToParcel(Parcel dest, int flags) {
- dest.writeLong(mTimestamp);
- writeCharSequence(dest, mNumber);
- if (mPhoneAccount == null) {
+ dest.writeLong(timestamp);
+ writeCharSequence(dest, number);
+ if (phoneAccount == null) {
dest.writeInt(0);
} else {
dest.writeInt(1);
- mPhoneAccount.writeToParcel(dest, flags);
+ phoneAccount.writeToParcel(dest, flags);
}
- dest.writeLong(mId);
- dest.writeLong(mDuration);
- writeCharSequence(dest, mSource);
- writeCharSequence(dest, mProviderData);
- if (mUri == null) {
+ dest.writeLong(id);
+ dest.writeLong(duration);
+ writeCharSequence(dest, source);
+ writeCharSequence(dest, providerData);
+ if (uri == null) {
dest.writeInt(0);
} else {
dest.writeInt(1);
- mUri.writeToParcel(dest, flags);
+ uri.writeToParcel(dest, flags);
}
- if (mIsRead) {
+ if (isRead) {
dest.writeInt(1);
} else {
dest.writeInt(0);
}
- if (mHasContent) {
+ if (hasContent) {
dest.writeInt(1);
} else {
dest.writeInt(0);
}
- writeCharSequence(dest, mTranscription);
+ writeCharSequence(dest, transcription);
}
public static final Creator<Voicemail> CREATOR =
@@ -310,25 +310,25 @@ public class Voicemail implements Parcelable {
};
private Voicemail(Parcel in) {
- mTimestamp = in.readLong();
- mNumber = (String) readCharSequence(in);
+ timestamp = in.readLong();
+ number = (String) readCharSequence(in);
if (in.readInt() > 0) {
- mPhoneAccount = PhoneAccountHandle.CREATOR.createFromParcel(in);
+ phoneAccount = PhoneAccountHandle.CREATOR.createFromParcel(in);
} else {
- mPhoneAccount = null;
+ phoneAccount = null;
}
- mId = in.readLong();
- mDuration = in.readLong();
- mSource = (String) readCharSequence(in);
- mProviderData = (String) readCharSequence(in);
+ id = in.readLong();
+ duration = in.readLong();
+ source = (String) readCharSequence(in);
+ providerData = (String) readCharSequence(in);
if (in.readInt() > 0) {
- mUri = Uri.CREATOR.createFromParcel(in);
+ uri = Uri.CREATOR.createFromParcel(in);
} else {
- mUri = null;
+ uri = null;
}
- mIsRead = in.readInt() > 0 ? true : false;
- mHasContent = in.readInt() > 0 ? true : false;
- mTranscription = (String) readCharSequence(in);
+ isRead = in.readInt() > 0 ? true : false;
+ hasContent = in.readInt() > 0 ? true : false;
+ transcription = (String) readCharSequence(in);
}
private static CharSequence readCharSequence(Parcel in) {
diff --git a/java/com/android/voicemail/impl/VoicemailStatus.java b/java/com/android/voicemail/impl/VoicemailStatus.java
index a24bad4c4..2ebc49b05 100644
--- a/java/com/android/voicemail/impl/VoicemailStatus.java
+++ b/java/com/android/voicemail/impl/VoicemailStatus.java
@@ -32,15 +32,15 @@ public class VoicemailStatus {
public static class Editor {
- private final Context mContext;
- @Nullable private final PhoneAccountHandle mPhoneAccountHandle;
+ private final Context context;
+ @Nullable private final PhoneAccountHandle phoneAccountHandle;
- private ContentValues mValues = new ContentValues();
+ private ContentValues values = new ContentValues();
private Editor(Context context, PhoneAccountHandle phoneAccountHandle) {
- mContext = context;
- mPhoneAccountHandle = phoneAccountHandle;
- if (mPhoneAccountHandle == null) {
+ this.context = context;
+ this.phoneAccountHandle = phoneAccountHandle;
+ if (this.phoneAccountHandle == null) {
VvmLog.w(
TAG,
"VoicemailStatus.Editor created with null phone account, status will"
@@ -50,26 +50,26 @@ public class VoicemailStatus {
@Nullable
public PhoneAccountHandle getPhoneAccountHandle() {
- return mPhoneAccountHandle;
+ return phoneAccountHandle;
}
public Editor setType(String type) {
- mValues.put(Status.SOURCE_TYPE, type);
+ values.put(Status.SOURCE_TYPE, type);
return this;
}
public Editor setConfigurationState(int configurationState) {
- mValues.put(Status.CONFIGURATION_STATE, configurationState);
+ values.put(Status.CONFIGURATION_STATE, configurationState);
return this;
}
public Editor setDataChannelState(int dataChannelState) {
- mValues.put(Status.DATA_CHANNEL_STATE, dataChannelState);
+ values.put(Status.DATA_CHANNEL_STATE, dataChannelState);
return this;
}
public Editor setNotificationChannelState(int notificationChannelState) {
- mValues.put(Status.NOTIFICATION_CHANNEL_STATE, notificationChannelState);
+ values.put(Status.NOTIFICATION_CHANNEL_STATE, notificationChannelState);
return this;
}
@@ -79,8 +79,8 @@ public class VoicemailStatus {
return this;
}
- mValues.put(Status.QUOTA_OCCUPIED, occupied);
- mValues.put(Status.QUOTA_TOTAL, total);
+ values.put(Status.QUOTA_OCCUPIED, occupied);
+ values.put(Status.QUOTA_TOTAL, total);
return this;
}
@@ -90,28 +90,28 @@ public class VoicemailStatus {
* @return {@code true} if the changes were successfully applied, {@code false} otherwise.
*/
public boolean apply() {
- if (mPhoneAccountHandle == null) {
+ if (phoneAccountHandle == null) {
return false;
}
- mValues.put(
+ values.put(
Status.PHONE_ACCOUNT_COMPONENT_NAME,
- mPhoneAccountHandle.getComponentName().flattenToString());
- mValues.put(Status.PHONE_ACCOUNT_ID, mPhoneAccountHandle.getId());
- ContentResolver contentResolver = mContext.getContentResolver();
- Uri statusUri = VoicemailContract.Status.buildSourceUri(mContext.getPackageName());
+ phoneAccountHandle.getComponentName().flattenToString());
+ values.put(Status.PHONE_ACCOUNT_ID, phoneAccountHandle.getId());
+ ContentResolver contentResolver = context.getContentResolver();
+ Uri statusUri = VoicemailContract.Status.buildSourceUri(context.getPackageName());
try {
- StrictModeUtils.bypass(() -> contentResolver.insert(statusUri, mValues));
+ StrictModeUtils.bypass(() -> contentResolver.insert(statusUri, values));
} catch (IllegalArgumentException iae) {
VvmLog.e(TAG, "apply :: failed to insert content resolver ", iae);
- mValues.clear();
+ values.clear();
return false;
}
- mValues.clear();
+ values.clear();
return true;
}
public ContentValues getValues() {
- return mValues;
+ return values;
}
}
diff --git a/java/com/android/voicemail/impl/VvmLog.java b/java/com/android/voicemail/impl/VvmLog.java
index 6dc4fa6c0..7d47904cc 100644
--- a/java/com/android/voicemail/impl/VvmLog.java
+++ b/java/com/android/voicemail/impl/VvmLog.java
@@ -30,7 +30,7 @@ public class VvmLog {
private static final int MAX_OMTP_VVM_LOGS = 100;
- private static final LocalLog sLocalLog = new LocalLog(MAX_OMTP_VVM_LOGS);
+ private static final LocalLog localLog = new LocalLog(MAX_OMTP_VVM_LOGS);
public static void log(String tag, String log) {
PersistentLogger.logText(tag, log);
@@ -39,7 +39,7 @@ public class VvmLog {
public static void dump(FileDescriptor fd, PrintWriter printwriter, String[] args) {
IndentingPrintWriter indentingPrintWriter = new IndentingPrintWriter(printwriter, " ");
indentingPrintWriter.increaseIndent();
- sLocalLog.dump(fd, indentingPrintWriter, args);
+ localLog.dump(fd, indentingPrintWriter, args);
indentingPrintWriter.decreaseIndent();
}
@@ -116,16 +116,16 @@ public class VvmLog {
public static class LocalLog {
- private final Deque<String> mLog;
- private final int mMaxLines;
+ private final Deque<String> log;
+ private final int maxLines;
public LocalLog(int maxLines) {
- mMaxLines = Math.max(0, maxLines);
- mLog = new ArrayDeque<>(mMaxLines);
+ this.maxLines = Math.max(0, maxLines);
+ log = new ArrayDeque<>(this.maxLines);
}
public void log(String msg) {
- if (mMaxLines <= 0) {
+ if (maxLines <= 0) {
return;
}
Calendar c = Calendar.getInstance();
@@ -134,21 +134,21 @@ public class VvmLog {
}
private synchronized void append(String logLine) {
- while (mLog.size() >= mMaxLines) {
- mLog.remove();
+ while (log.size() >= maxLines) {
+ log.remove();
}
- mLog.add(logLine);
+ log.add(logLine);
}
public synchronized void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
- Iterator<String> itr = mLog.iterator();
+ Iterator<String> itr = log.iterator();
while (itr.hasNext()) {
pw.println(itr.next());
}
}
public synchronized void reverseDump(FileDescriptor fd, PrintWriter pw, String[] args) {
- Iterator<String> itr = mLog.descendingIterator();
+ Iterator<String> itr = log.descendingIterator();
while (itr.hasNext()) {
pw.println(itr.next());
}
@@ -156,18 +156,18 @@ public class VvmLog {
public static class ReadOnlyLocalLog {
- private final LocalLog mLog;
+ private final LocalLog log;
ReadOnlyLocalLog(LocalLog log) {
- mLog = log;
+ this.log = log;
}
public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
- mLog.dump(fd, pw, args);
+ log.dump(fd, pw, args);
}
public void reverseDump(FileDescriptor fd, PrintWriter pw, String[] args) {
- mLog.reverseDump(fd, pw, args);
+ log.reverseDump(fd, pw, args);
}
}
diff --git a/java/com/android/voicemail/impl/VvmPhoneStateListener.java b/java/com/android/voicemail/impl/VvmPhoneStateListener.java
index 914120b69..a9082e895 100644
--- a/java/com/android/voicemail/impl/VvmPhoneStateListener.java
+++ b/java/com/android/voicemail/impl/VvmPhoneStateListener.java
@@ -31,73 +31,73 @@ public class VvmPhoneStateListener extends PhoneStateListener {
private static final String TAG = "VvmPhoneStateListener";
- private PhoneAccountHandle mPhoneAccount;
- private Context mContext;
- private int mPreviousState = -1;
+ private PhoneAccountHandle phoneAccount;
+ private Context context;
+ private int previousState = -1;
public VvmPhoneStateListener(Context context, PhoneAccountHandle accountHandle) {
// TODO(twyen): a bug too much trouble to call super constructor through reflection,
// just use non-phoneAccountHandle version for now.
super();
- mContext = context;
- mPhoneAccount = accountHandle;
+ this.context = context;
+ phoneAccount = accountHandle;
}
@Override
public void onServiceStateChanged(ServiceState serviceState) {
- if (mPhoneAccount == null) {
+ if (phoneAccount == null) {
VvmLog.e(
TAG,
"onServiceStateChanged on phoneAccount "
- + mPhoneAccount
+ + phoneAccount
+ " with invalid phoneAccountHandle, ignoring");
return;
}
int state = serviceState.getState();
- if (state == mPreviousState
+ if (state == previousState
|| (state != ServiceState.STATE_IN_SERVICE
- && mPreviousState != ServiceState.STATE_IN_SERVICE)) {
+ && previousState != ServiceState.STATE_IN_SERVICE)) {
// Only interested in state changes or transitioning into or out of "in service".
// Otherwise just quit.
- mPreviousState = state;
+ previousState = state;
return;
}
- OmtpVvmCarrierConfigHelper helper = new OmtpVvmCarrierConfigHelper(mContext, mPhoneAccount);
+ OmtpVvmCarrierConfigHelper helper = new OmtpVvmCarrierConfigHelper(context, phoneAccount);
if (state == ServiceState.STATE_IN_SERVICE) {
VoicemailStatusQueryHelper voicemailStatusQueryHelper =
- new VoicemailStatusQueryHelper(mContext);
- if (voicemailStatusQueryHelper.isVoicemailSourceConfigured(mPhoneAccount)) {
- if (!voicemailStatusQueryHelper.isNotificationsChannelActive(mPhoneAccount)) {
- VvmLog.v(TAG, "Notifications channel is active for " + mPhoneAccount);
+ new VoicemailStatusQueryHelper(context);
+ if (voicemailStatusQueryHelper.isVoicemailSourceConfigured(phoneAccount)) {
+ if (!voicemailStatusQueryHelper.isNotificationsChannelActive(phoneAccount)) {
+ VvmLog.v(TAG, "Notifications channel is active for " + phoneAccount);
helper.handleEvent(
- VoicemailStatus.edit(mContext, mPhoneAccount), OmtpEvents.NOTIFICATION_IN_SERVICE);
+ VoicemailStatus.edit(context, phoneAccount), OmtpEvents.NOTIFICATION_IN_SERVICE);
}
}
- if (VvmAccountManager.isAccountActivated(mContext, mPhoneAccount)) {
- VvmLog.v(TAG, "Signal returned: requesting resync for " + mPhoneAccount);
+ if (VvmAccountManager.isAccountActivated(context, phoneAccount)) {
+ VvmLog.v(TAG, "Signal returned: requesting resync for " + phoneAccount);
// If the source is already registered, run a full sync in case something was missed
// while signal was down.
- SyncTask.start(mContext, mPhoneAccount);
+ SyncTask.start(context, phoneAccount);
} else {
- VvmLog.v(TAG, "Signal returned: reattempting activation for " + mPhoneAccount);
+ VvmLog.v(TAG, "Signal returned: reattempting activation for " + phoneAccount);
// Otherwise initiate an activation because this means that an OMTP source was
// recognized but either the activation text was not successfully sent or a response
// was not received.
helper.startActivation();
}
} else {
- VvmLog.v(TAG, "Notifications channel is inactive for " + mPhoneAccount);
+ VvmLog.v(TAG, "Notifications channel is inactive for " + phoneAccount);
- if (!VvmAccountManager.isAccountActivated(mContext, mPhoneAccount)) {
+ if (!VvmAccountManager.isAccountActivated(context, phoneAccount)) {
return;
}
helper.handleEvent(
- VoicemailStatus.edit(mContext, mPhoneAccount), OmtpEvents.NOTIFICATION_SERVICE_LOST);
+ VoicemailStatus.edit(context, phoneAccount), OmtpEvents.NOTIFICATION_SERVICE_LOST);
}
- mPreviousState = state;
+ previousState = state;
}
}
diff --git a/java/com/android/voicemail/impl/fetch/FetchVoicemailReceiver.java b/java/com/android/voicemail/impl/fetch/FetchVoicemailReceiver.java
index 0348a60c5..9fda37343 100644
--- a/java/com/android/voicemail/impl/fetch/FetchVoicemailReceiver.java
+++ b/java/com/android/voicemail/impl/fetch/FetchVoicemailReceiver.java
@@ -64,13 +64,13 @@ public class FetchVoicemailReceiver extends BroadcastReceiver {
// Number of retries
private static final int NETWORK_RETRY_COUNT = 3;
- private ContentResolver mContentResolver;
- private Uri mUri;
- private VvmNetworkRequestCallback mNetworkCallback;
- private Context mContext;
- private String mUid;
- private PhoneAccountHandle mPhoneAccount;
- private int mRetryCount = NETWORK_RETRY_COUNT;
+ private ContentResolver contentResolver;
+ private Uri uri;
+ private VvmNetworkRequestCallback networkCallback;
+ private Context context;
+ private String uid;
+ private PhoneAccountHandle phoneAccount;
+ private int retryCount = NETWORK_RETRY_COUNT;
@Override
public void onReceive(final Context context, Intent intent) {
@@ -79,31 +79,31 @@ public class FetchVoicemailReceiver extends BroadcastReceiver {
}
if (VoicemailContract.ACTION_FETCH_VOICEMAIL.equals(intent.getAction())) {
VvmLog.i(TAG, "ACTION_FETCH_VOICEMAIL received");
- mContext = context;
- mContentResolver = context.getContentResolver();
- mUri = intent.getData();
+ this.context = context;
+ contentResolver = context.getContentResolver();
+ uri = intent.getData();
- if (mUri == null) {
+ if (uri == null) {
VvmLog.w(TAG, VoicemailContract.ACTION_FETCH_VOICEMAIL + " intent sent with no data");
return;
}
if (!context
.getPackageName()
- .equals(mUri.getQueryParameter(VoicemailContract.PARAM_KEY_SOURCE_PACKAGE))) {
+ .equals(uri.getQueryParameter(VoicemailContract.PARAM_KEY_SOURCE_PACKAGE))) {
// Ignore if the fetch request is for a voicemail not from this package.
VvmLog.e(TAG, "ACTION_FETCH_VOICEMAIL from foreign pacakge " + context.getPackageName());
return;
}
- Cursor cursor = mContentResolver.query(mUri, PROJECTION, null, null, null);
+ Cursor cursor = contentResolver.query(uri, PROJECTION, null, null, null);
if (cursor == null) {
VvmLog.i(TAG, "ACTION_FETCH_VOICEMAIL query returned null");
return;
}
try {
if (cursor.moveToFirst()) {
- mUid = cursor.getString(SOURCE_DATA);
+ uid = cursor.getString(SOURCE_DATA);
String accountId = cursor.getString(PHONE_ACCOUNT_ID);
if (TextUtils.isEmpty(accountId)) {
TelephonyManager telephonyManager =
@@ -116,31 +116,31 @@ public class FetchVoicemailReceiver extends BroadcastReceiver {
}
}
- mPhoneAccount =
+ phoneAccount =
new PhoneAccountHandle(
ComponentName.unflattenFromString(cursor.getString(PHONE_ACCOUNT_COMPONENT_NAME)),
cursor.getString(PHONE_ACCOUNT_ID));
TelephonyManager telephonyManager =
context
.getSystemService(TelephonyManager.class)
- .createForPhoneAccountHandle(mPhoneAccount);
+ .createForPhoneAccountHandle(phoneAccount);
if (telephonyManager == null) {
// can happen when trying to fetch voicemails from a SIM that is no longer on the
// device
VvmLog.e(TAG, "account no longer valid, cannot retrieve message");
return;
}
- if (!VvmAccountManager.isAccountActivated(context, mPhoneAccount)) {
- mPhoneAccount = getAccountFromMarshmallowAccount(context, mPhoneAccount);
- if (mPhoneAccount == null) {
+ if (!VvmAccountManager.isAccountActivated(context, phoneAccount)) {
+ phoneAccount = getAccountFromMarshmallowAccount(context, phoneAccount);
+ if (phoneAccount == null) {
VvmLog.w(TAG, "Account not registered - cannot retrieve message.");
return;
}
VvmLog.i(TAG, "Fetching voicemail with Marshmallow PhoneAccountHandle");
}
VvmLog.i(TAG, "Requesting network to fetch voicemail");
- mNetworkCallback = new fetchVoicemailNetworkRequestCallback(context, mPhoneAccount);
- mNetworkCallback.requestNetwork();
+ networkCallback = new fetchVoicemailNetworkRequestCallback(context, phoneAccount);
+ networkCallback.requestNetwork();
}
} finally {
cursor.close();
@@ -203,16 +203,16 @@ public class FetchVoicemailReceiver extends BroadcastReceiver {
@Override
public void run() {
try {
- while (mRetryCount > 0) {
- VvmLog.i(TAG, "fetching voicemail, retry count=" + mRetryCount);
+ while (retryCount > 0) {
+ VvmLog.i(TAG, "fetching voicemail, retry count=" + retryCount);
try (ImapHelper imapHelper =
- new ImapHelper(mContext, mPhoneAccount, network, status)) {
+ new ImapHelper(context, phoneAccount, network, status)) {
boolean success =
imapHelper.fetchVoicemailPayload(
- new VoicemailFetchedCallback(mContext, mUri, mPhoneAccount), mUid);
- if (!success && mRetryCount > 0) {
+ new VoicemailFetchedCallback(context, uri, phoneAccount), uid);
+ if (!success && retryCount > 0) {
VvmLog.i(TAG, "fetch voicemail failed, retrying");
- mRetryCount--;
+ retryCount--;
} else {
return;
}
@@ -222,8 +222,8 @@ public class FetchVoicemailReceiver extends BroadcastReceiver {
}
}
} finally {
- if (mNetworkCallback != null) {
- mNetworkCallback.releaseNetwork();
+ if (networkCallback != null) {
+ networkCallback.releaseNetwork();
}
}
}
diff --git a/java/com/android/voicemail/impl/fetch/VoicemailFetchedCallback.java b/java/com/android/voicemail/impl/fetch/VoicemailFetchedCallback.java
index e8e14bedb..78dbdc06f 100644
--- a/java/com/android/voicemail/impl/fetch/VoicemailFetchedCallback.java
+++ b/java/com/android/voicemail/impl/fetch/VoicemailFetchedCallback.java
@@ -40,16 +40,16 @@ import org.apache.commons.io.IOUtils;
public class VoicemailFetchedCallback {
private static final String TAG = "VoicemailFetchedCallback";
- private final Context mContext;
- private final ContentResolver mContentResolver;
- private final Uri mUri;
- private final PhoneAccountHandle mPhoneAccountHandle;
+ private final Context context;
+ private final ContentResolver contentResolver;
+ private final Uri uri;
+ private final PhoneAccountHandle phoneAccountHandle;
public VoicemailFetchedCallback(Context context, Uri uri, PhoneAccountHandle phoneAccountHandle) {
- mContext = context;
- mContentResolver = context.getContentResolver();
- mUri = uri;
- mPhoneAccountHandle = phoneAccountHandle;
+ this.context = context;
+ contentResolver = context.getContentResolver();
+ this.uri = uri;
+ this.phoneAccountHandle = phoneAccountHandle;
}
/**
@@ -65,26 +65,26 @@ public class VoicemailFetchedCallback {
ContentValues values = new ContentValues();
values.put(
Voicemails.TRANSCRIPTION,
- mContext.getString(
+ context.getString(
R.string.vvm_unsupported_message_format,
- mContext
+ context
.getSystemService(TelecomManager.class)
- .getVoiceMailNumber(mPhoneAccountHandle)));
+ .getVoiceMailNumber(phoneAccountHandle)));
updateVoicemail(values);
return;
}
- VvmLog.d(TAG, String.format("Writing new voicemail content: %s", mUri));
+ VvmLog.d(TAG, String.format("Writing new voicemail content: %s", uri));
OutputStream outputStream = null;
try {
- outputStream = mContentResolver.openOutputStream(mUri);
+ outputStream = contentResolver.openOutputStream(uri);
byte[] inputBytes = voicemailPayload.getBytes();
if (inputBytes != null) {
outputStream.write(inputBytes);
}
} catch (IOException e) {
- VvmLog.w(TAG, String.format("File not found for %s", mUri));
+ VvmLog.w(TAG, String.format("File not found for %s", uri));
return;
} finally {
IOUtils.closeQuietly(outputStream);
@@ -98,15 +98,15 @@ public class VoicemailFetchedCallback {
ThreadUtil.postOnUiThread(
() -> {
if (!TranscriptionService.scheduleNewVoicemailTranscriptionJob(
- mContext, mUri, mPhoneAccountHandle, true)) {
- VvmLog.w(TAG, String.format("Failed to schedule transcription for %s", mUri));
+ context, uri, phoneAccountHandle, true)) {
+ VvmLog.w(TAG, String.format("Failed to schedule transcription for %s", uri));
}
});
}
}
private boolean updateVoicemail(ContentValues values) {
- int updatedCount = mContentResolver.update(mUri, values, null, null);
+ int updatedCount = contentResolver.update(uri, values, null, null);
if (updatedCount != 1) {
VvmLog.e(TAG, "Updating voicemail should have updated 1 row, was: " + updatedCount);
return false;
diff --git a/java/com/android/voicemail/impl/imap/ImapHelper.java b/java/com/android/voicemail/impl/imap/ImapHelper.java
index a0e86dcae..1f04edbef 100644
--- a/java/com/android/voicemail/impl/imap/ImapHelper.java
+++ b/java/com/android/voicemail/impl/imap/ImapHelper.java
@@ -66,17 +66,17 @@ public class ImapHelper implements Closeable {
private static final String TAG = "ImapHelper";
- private ImapFolder mFolder;
- private ImapStore mImapStore;
+ private ImapFolder folder;
+ private ImapStore imapStore;
- private final Context mContext;
- private final PhoneAccountHandle mPhoneAccount;
- private final Network mNetwork;
- private final Editor mStatus;
+ private final Context context;
+ private final PhoneAccountHandle phoneAccount;
+ private final Network network;
+ private final Editor status;
- VisualVoicemailPreferences mPrefs;
+ VisualVoicemailPreferences prefs;
- private final OmtpVvmCarrierConfigHelper mConfig;
+ private final OmtpVvmCarrierConfigHelper config;
/** InitializingException */
public static class InitializingException extends Exception {
@@ -104,30 +104,29 @@ public class ImapHelper implements Closeable {
Network network,
Editor status)
throws InitializingException {
- mContext = context;
- mPhoneAccount = phoneAccount;
- mNetwork = network;
- mStatus = status;
- mConfig = config;
- mPrefs = new VisualVoicemailPreferences(context, phoneAccount);
+ this.context = context;
+ this.phoneAccount = phoneAccount;
+ this.network = network;
+ this.status = status;
+ this.config = config;
+ prefs = new VisualVoicemailPreferences(context, phoneAccount);
try {
TempDirectory.setTempDirectory(context);
- String username = mPrefs.getString(OmtpConstants.IMAP_USER_NAME, null);
- String password = mPrefs.getString(OmtpConstants.IMAP_PASSWORD, null);
- String serverName = mPrefs.getString(OmtpConstants.SERVER_ADDRESS, null);
- int port = Integer.parseInt(mPrefs.getString(OmtpConstants.IMAP_PORT, null));
+ String username = prefs.getString(OmtpConstants.IMAP_USER_NAME, null);
+ String password = prefs.getString(OmtpConstants.IMAP_PASSWORD, null);
+ String serverName = prefs.getString(OmtpConstants.SERVER_ADDRESS, null);
+ int port = Integer.parseInt(prefs.getString(OmtpConstants.IMAP_PORT, null));
int auth = ImapStore.FLAG_NONE;
- int sslPort = mConfig.getSslPort();
+ int sslPort = this.config.getSslPort();
if (sslPort != 0) {
port = sslPort;
auth = ImapStore.FLAG_SSL;
}
- mImapStore =
- new ImapStore(context, this, username, password, port, serverName, auth, network);
+ imapStore = new ImapStore(context, this, username, password, port, serverName, auth, network);
} catch (NumberFormatException e) {
handleEvent(OmtpEvents.DATA_INVALID_PORT);
LogUtils.w(TAG, "Could not parse port number");
@@ -137,13 +136,13 @@ public class ImapHelper implements Closeable {
@Override
public void close() {
- mImapStore.closeConnection();
+ imapStore.closeConnection();
}
public boolean isRoaming() {
ConnectivityManager connectivityManager =
- (ConnectivityManager) mContext.getSystemService(Context.CONNECTIVITY_SERVICE);
- NetworkInfo info = connectivityManager.getNetworkInfo(mNetwork);
+ (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
+ NetworkInfo info = connectivityManager.getNetworkInfo(network);
if (info == null) {
return false;
}
@@ -151,11 +150,11 @@ public class ImapHelper implements Closeable {
}
public OmtpVvmCarrierConfigHelper getConfig() {
- return mConfig;
+ return config;
}
public ImapConnection connect() {
- return mImapStore.getConnection();
+ return imapStore.getConnection();
}
/** The caller thread will block until the method returns. */
@@ -169,7 +168,7 @@ public class ImapHelper implements Closeable {
}
public void handleEvent(OmtpEvents event) {
- mConfig.handleEvent(mStatus, event);
+ config.handleEvent(status, event);
}
/**
@@ -184,9 +183,9 @@ public class ImapHelper implements Closeable {
return false;
}
try {
- mFolder = openImapFolder(ImapFolder.MODE_READ_WRITE);
- if (mFolder != null) {
- mFolder.setFlags(convertToImapMessages(voicemails), flags, true);
+ folder = openImapFolder(ImapFolder.MODE_READ_WRITE);
+ if (folder != null) {
+ folder.setFlags(convertToImapMessages(voicemails), flags, true);
return true;
}
return false;
@@ -207,14 +206,14 @@ public class ImapHelper implements Closeable {
List<Voicemail> result = new ArrayList<Voicemail>();
Message[] messages;
try {
- mFolder = openImapFolder(ImapFolder.MODE_READ_WRITE);
- if (mFolder == null) {
+ folder = openImapFolder(ImapFolder.MODE_READ_WRITE);
+ if (folder == null) {
// This means we were unable to successfully open the folder.
return null;
}
// This method retrieves lightweight messages containing only the uid of the message.
- messages = mFolder.getMessages(null);
+ messages = folder.getMessages(null);
for (Message message : messages) {
// Get the voicemail details (message structure).
@@ -245,7 +244,7 @@ public class ImapHelper implements Closeable {
FetchProfile fetchProfile = new FetchProfile();
fetchProfile.add(messageStructureWrapper.transcriptionBodyPart);
- mFolder.fetch(new Message[] {messageDetails}, fetchProfile, listener);
+ folder.fetch(new Message[] {messageDetails}, fetchProfile, listener);
}
// Found an audio attachment, this is a valid voicemail.
@@ -255,8 +254,8 @@ public class ImapHelper implements Closeable {
Long duration = messageDetails.getDuration();
Voicemail.Builder builder =
Voicemail.createForInsertion(time, number)
- .setPhoneAccount(mPhoneAccount)
- .setSourcePackage(mContext.getPackageName())
+ .setPhoneAccount(phoneAccount)
+ .setSourcePackage(context.getPackageName())
.setSourceData(messageDetails.getUid())
.setIsRead(isRead)
.setTranscription(listener.getVoicemailTranscription());
@@ -307,18 +306,18 @@ public class ImapHelper implements Closeable {
// The IMAP folder fetch method will call "messageRetrieved" on the listener when the
// message is successfully retrieved.
- mFolder.fetch(new Message[] {message}, fetchProfile, listener);
+ folder.fetch(new Message[] {message}, fetchProfile, listener);
return listener.getMessageStructure();
}
public boolean fetchVoicemailPayload(VoicemailFetchedCallback callback, final String uid) {
try {
- mFolder = openImapFolder(ImapFolder.MODE_READ_WRITE);
- if (mFolder == null) {
+ folder = openImapFolder(ImapFolder.MODE_READ_WRITE);
+ if (folder == null) {
// This means we were unable to successfully open the folder.
return false;
}
- Message message = mFolder.getMessage(uid);
+ Message message = folder.getMessage(uid);
if (message == null) {
return false;
}
@@ -345,19 +344,19 @@ public class ImapHelper implements Closeable {
FetchProfile fetchProfile = new FetchProfile();
fetchProfile.add(FetchProfile.Item.BODY);
- mFolder.fetch(new Message[] {message}, fetchProfile, listener);
+ folder.fetch(new Message[] {message}, fetchProfile, listener);
return listener.getVoicemailPayload();
}
public boolean fetchTranscription(TranscriptionFetchedCallback callback, String uid) {
try {
- mFolder = openImapFolder(ImapFolder.MODE_READ_WRITE);
- if (mFolder == null) {
+ folder = openImapFolder(ImapFolder.MODE_READ_WRITE);
+ if (folder == null) {
// This means we were unable to successfully open the folder.
return false;
}
- Message message = mFolder.getMessage(uid);
+ Message message = folder.getMessage(uid);
if (message == null) {
return false;
}
@@ -371,7 +370,7 @@ public class ImapHelper implements Closeable {
// This method is called synchronously so the transcription will be populated
// in the listener once the next method is called.
- mFolder.fetch(new Message[] {message}, fetchProfile, listener);
+ folder.fetch(new Message[] {message}, fetchProfile, listener);
callback.setVoicemailTranscription(listener.getVoicemailTranscription());
}
}
@@ -386,7 +385,7 @@ public class ImapHelper implements Closeable {
@ChangePinResult
public int changePin(String oldPin, String newPin) throws MessagingException {
- ImapConnection connection = mImapStore.getConnection();
+ ImapConnection connection = imapStore.getConnection();
try {
String command =
getConfig().getProtocol().getCommand(OmtpConstants.IMAP_CHANGE_TUI_PWD_FORMAT);
@@ -401,7 +400,7 @@ public class ImapHelper implements Closeable {
}
public void changeVoicemailTuiLanguage(String languageCode) throws MessagingException {
- ImapConnection connection = mImapStore.getConnection();
+ ImapConnection connection = imapStore.getConnection();
try {
String command =
getConfig().getProtocol().getCommand(OmtpConstants.IMAP_CHANGE_VM_LANG_FORMAT);
@@ -414,7 +413,7 @@ public class ImapHelper implements Closeable {
}
public void closeNewUserTutorial() throws MessagingException {
- ImapConnection connection = mImapStore.getConnection();
+ ImapConnection connection = imapStore.getConnection();
try {
String command = getConfig().getProtocol().getCommand(OmtpConstants.IMAP_CLOSE_NUT);
connection.executeSimpleCommand(command, false);
@@ -457,12 +456,12 @@ public class ImapHelper implements Closeable {
public void updateQuota() {
try {
- mFolder = openImapFolder(ImapFolder.MODE_READ_WRITE);
- if (mFolder == null) {
+ folder = openImapFolder(ImapFolder.MODE_READ_WRITE);
+ if (folder == null) {
// This means we were unable to successfully open the folder.
return;
}
- updateQuota(mFolder);
+ updateQuota(folder);
} catch (MessagingException e) {
LogUtils.e(TAG, e, "Messaging Exception");
} finally {
@@ -473,13 +472,13 @@ public class ImapHelper implements Closeable {
@Nullable
public Quota getQuota() {
try {
- mFolder = openImapFolder(ImapFolder.MODE_READ_ONLY);
- if (mFolder == null) {
+ folder = openImapFolder(ImapFolder.MODE_READ_ONLY);
+ if (folder == null) {
// This means we were unable to successfully open the folder.
LogUtils.e(TAG, "Unable to open folder");
return null;
}
- return mFolder.getQuota();
+ return folder.getQuota();
} catch (MessagingException e) {
LogUtils.e(TAG, e, "Messaging Exception");
return null;
@@ -505,7 +504,7 @@ public class ImapHelper implements Closeable {
+ quota.occupied
+ " new quota total:"
+ quota.total);
- VoicemailStatus.edit(mContext, mPhoneAccount).setQuota(quota.occupied, quota.total).apply();
+ VoicemailStatus.edit(context, phoneAccount).setQuota(quota.occupied, quota.total).apply();
LogUtils.i(TAG, "Updated quota occupied and total");
}
@@ -525,12 +524,12 @@ public class ImapHelper implements Closeable {
private final class MessageStructureFetchedListener
implements ImapFolder.MessageRetrievalListener {
- private MessageStructureWrapper mMessageStructure;
+ private MessageStructureWrapper messageStructure;
public MessageStructureFetchedListener() {}
public MessageStructureWrapper getMessageStructure() {
- return mMessageStructure;
+ return messageStructure;
}
@Override
@@ -538,8 +537,8 @@ public class ImapHelper implements Closeable {
LogUtils.d(TAG, "Fetched message structure for " + message.getUid());
LogUtils.d(TAG, "Message retrieved: " + message);
try {
- mMessageStructure = getMessageOrNull(message);
- if (mMessageStructure == null) {
+ messageStructure = getMessageOrNull(message);
+ if (messageStructure == null) {
LogUtils.d(TAG, "This voicemail does not have an attachment...");
return;
}
@@ -591,11 +590,11 @@ public class ImapHelper implements Closeable {
/** Listener for the message body being fetched. */
private final class MessageBodyFetchedListener implements ImapFolder.MessageRetrievalListener {
- private VoicemailPayload mVoicemailPayload;
+ private VoicemailPayload voicemailPayload;
/** Returns the fetch voicemail payload. */
public VoicemailPayload getVoicemailPayload() {
- return mVoicemailPayload;
+ return voicemailPayload;
}
@Override
@@ -603,7 +602,7 @@ public class ImapHelper implements Closeable {
LogUtils.d(TAG, "Fetched message body for " + message.getUid());
LogUtils.d(TAG, "Message retrieved: " + message);
try {
- mVoicemailPayload = getVoicemailPayloadFromMessage(message);
+ voicemailPayload = getVoicemailPayloadFromMessage(message);
} catch (MessagingException e) {
LogUtils.e(TAG, "Messaging Exception:", e);
} catch (IOException e) {
@@ -633,18 +632,18 @@ public class ImapHelper implements Closeable {
/** Listener for the transcription being fetched. */
private final class TranscriptionFetchedListener implements ImapFolder.MessageRetrievalListener {
- private String mVoicemailTranscription;
+ private String voicemailTranscription;
/** Returns the fetched voicemail transcription. */
public String getVoicemailTranscription() {
- return mVoicemailTranscription;
+ return voicemailTranscription;
}
@Override
public void messageRetrieved(Message message) {
LogUtils.d(TAG, "Fetched transcription for " + message.getUid());
try {
- mVoicemailTranscription = new String(getDataFromBody(message.getBody()));
+ voicemailTranscription = new String(getDataFromBody(message.getBody()));
} catch (MessagingException e) {
LogUtils.e(TAG, "Messaging Exception:", e);
} catch (IOException e) {
@@ -655,10 +654,10 @@ public class ImapHelper implements Closeable {
private ImapFolder openImapFolder(String modeReadWrite) {
try {
- if (mImapStore == null) {
+ if (imapStore == null) {
return null;
}
- ImapFolder folder = new ImapFolder(mImapStore, ImapConstants.INBOX);
+ ImapFolder folder = new ImapFolder(imapStore, ImapConstants.INBOX);
folder.open(modeReadWrite);
return folder;
} catch (MessagingException e) {
@@ -677,8 +676,8 @@ public class ImapHelper implements Closeable {
}
private void closeImapFolder() {
- if (mFolder != null) {
- mFolder.close(true);
+ if (folder != null) {
+ folder.close(true);
}
}
diff --git a/java/com/android/voicemail/impl/imap/VoicemailPayload.java b/java/com/android/voicemail/impl/imap/VoicemailPayload.java
index 69befb42f..e91726456 100644
--- a/java/com/android/voicemail/impl/imap/VoicemailPayload.java
+++ b/java/com/android/voicemail/impl/imap/VoicemailPayload.java
@@ -18,19 +18,19 @@ package com.android.voicemail.impl.imap;
/** The payload for a voicemail, usually audio data. */
public class VoicemailPayload {
- private final String mMimeType;
- private final byte[] mBytes;
+ private final String mimeType;
+ private final byte[] bytes;
public VoicemailPayload(String mimeType, byte[] bytes) {
- mMimeType = mimeType;
- mBytes = bytes;
+ this.mimeType = mimeType;
+ this.bytes = bytes;
}
public byte[] getBytes() {
- return mBytes;
+ return bytes;
}
public String getMimeType() {
- return mMimeType;
+ return mimeType;
}
}
diff --git a/java/com/android/voicemail/impl/mail/Address.java b/java/com/android/voicemail/impl/mail/Address.java
index ac8e8a294..7556e4d39 100644
--- a/java/com/android/voicemail/impl/mail/Address.java
+++ b/java/com/android/voicemail/impl/mail/Address.java
@@ -39,19 +39,19 @@ import org.apache.james.mime4j.codec.EncoderUtil;
public class Address implements Parcelable {
public static final String ADDRESS_DELIMETER = ",";
/** Address part, in the form local_part@domain_part. No surrounding angle brackets. */
- private String mAddress;
+ private String address;
/**
* Name part. No surrounding double quote, and no MIME/base64 encoding. This must be null if
* Address has no name part.
*/
- private String mPersonal;
+ private String personal;
/**
* When personal is set, it will return the first token of the personal string. Otherwise, it will
* return the e-mail address up to the '@' sign.
*/
- private String mSimplifiedName;
+ private String simplifiedName;
// Regex that matches address surrounded by '<>' optionally. '^<?([^>]+)>?$'
private static final Pattern REMOVE_OPTIONAL_BRACKET = Pattern.compile("^<?([^>]+)>?$");
@@ -96,26 +96,26 @@ public class Address implements Parcelable {
* first token of that name. Otherwise, it will return the e-mail address up to the '@' sign.
*/
public String getSimplifiedName() {
- if (mSimplifiedName == null) {
- if (TextUtils.isEmpty(mPersonal) && !TextUtils.isEmpty(mAddress)) {
- int atSign = mAddress.indexOf('@');
- mSimplifiedName = (atSign != -1) ? mAddress.substring(0, atSign) : "";
- } else if (!TextUtils.isEmpty(mPersonal)) {
+ if (simplifiedName == null) {
+ if (TextUtils.isEmpty(personal) && !TextUtils.isEmpty(address)) {
+ int atSign = address.indexOf('@');
+ simplifiedName = (atSign != -1) ? address.substring(0, atSign) : "";
+ } else if (!TextUtils.isEmpty(personal)) {
// TODO: use Contacts' NameSplitter for more reliable first-name extraction
- int end = mPersonal.indexOf(' ');
- while (end > 0 && mPersonal.charAt(end - 1) == ',') {
+ int end = personal.indexOf(' ');
+ while (end > 0 && personal.charAt(end - 1) == ',') {
end--;
}
- mSimplifiedName = (end < 1) ? mPersonal : mPersonal.substring(0, end);
+ simplifiedName = (end < 1) ? personal : personal.substring(0, end);
} else {
LogUtils.w(LOG_TAG, "Unable to get a simplified name");
- mSimplifiedName = "";
+ simplifiedName = "";
}
}
- return mSimplifiedName;
+ return simplifiedName;
}
public static synchronized Address getEmailAddress(String rawAddress) {
@@ -137,11 +137,11 @@ public class Address implements Parcelable {
}
public String getAddress() {
- return mAddress;
+ return address;
}
public void setAddress(String address) {
- mAddress = REMOVE_OPTIONAL_BRACKET.matcher(address).replaceAll("$1");
+ this.address = REMOVE_OPTIONAL_BRACKET.matcher(address).replaceAll("$1");
}
/**
@@ -150,7 +150,7 @@ public class Address implements Parcelable {
* @return Name part of email address. Returns null if it is omitted.
*/
public String getPersonal() {
- return mPersonal;
+ return personal;
}
/**
@@ -160,7 +160,7 @@ public class Address implements Parcelable {
* @param personal name part of email address as UTF-16 string. Null is acceptable.
*/
public void setPersonal(String personal) {
- mPersonal = decodeAddressPersonal(personal);
+ this.personal = decodeAddressPersonal(personal);
}
/**
@@ -265,14 +265,14 @@ public class Address implements Parcelable {
*/
@Override
public String toString() {
- if (mPersonal != null && !mPersonal.equals(mAddress)) {
- if (mPersonal.matches(".*[\\(\\)<>@,;:\\\\\".\\[\\]].*")) {
- return ensureQuotedString(mPersonal) + " <" + mAddress + ">";
+ if (personal != null && !personal.equals(address)) {
+ if (personal.matches(".*[\\(\\)<>@,;:\\\\\".\\[\\]].*")) {
+ return ensureQuotedString(personal) + " <" + address + ">";
} else {
- return mPersonal + " <" + mAddress + ">";
+ return personal + " <" + address + ">";
}
} else {
- return mAddress;
+ return address;
}
}
@@ -336,10 +336,10 @@ public class Address implements Parcelable {
* and MIME/base64 encoded if necessary.
*/
public String toHeader() {
- if (mPersonal != null) {
- return EncoderUtil.encodeAddressDisplayName(mPersonal) + " <" + mAddress + ">";
+ if (personal != null) {
+ return EncoderUtil.encodeAddressDisplayName(personal) + " <" + address + ">";
} else {
- return mAddress;
+ return address;
}
}
@@ -374,10 +374,10 @@ public class Address implements Parcelable {
*/
@VisibleForTesting
public String toFriendly() {
- if (mPersonal != null && mPersonal.length() > 0) {
- return mPersonal;
+ if (personal != null && personal.length() > 0) {
+ return personal;
} else {
- return mAddress;
+ return address;
}
}
@@ -516,7 +516,7 @@ public class Address implements Parcelable {
@Override
public void writeToParcel(Parcel out, int flags) {
- out.writeString(mPersonal);
- out.writeString(mAddress);
+ out.writeString(personal);
+ out.writeString(address);
}
}
diff --git a/java/com/android/voicemail/impl/mail/Base64Body.java b/java/com/android/voicemail/impl/mail/Base64Body.java
index def94dbb5..5c14296af 100644
--- a/java/com/android/voicemail/impl/mail/Base64Body.java
+++ b/java/com/android/voicemail/impl/mail/Base64Body.java
@@ -23,17 +23,17 @@ import java.io.OutputStream;
import org.apache.commons.io.IOUtils;
public class Base64Body implements Body {
- private final InputStream mSource;
+ private final InputStream source;
// Because we consume the input stream, we can only write out once
- private boolean mAlreadyWritten;
+ private boolean alreadyWritten;
public Base64Body(InputStream source) {
- mSource = source;
+ this.source = source;
}
@Override
public InputStream getInputStream() throws MessagingException {
- return mSource;
+ return source;
}
/**
@@ -47,15 +47,15 @@ public class Base64Body implements Body {
@Override
public void writeTo(OutputStream out)
throws IllegalStateException, IOException, MessagingException {
- if (mAlreadyWritten) {
+ if (alreadyWritten) {
throw new IllegalStateException("Base64Body can only be written once");
}
- mAlreadyWritten = true;
+ alreadyWritten = true;
try {
final Base64OutputStream b64out = new Base64OutputStream(out, Base64.DEFAULT);
- IOUtils.copyLarge(mSource, b64out);
+ IOUtils.copyLarge(source, b64out);
} finally {
- mSource.close();
+ source.close();
}
}
}
diff --git a/java/com/android/voicemail/impl/mail/BodyPart.java b/java/com/android/voicemail/impl/mail/BodyPart.java
index 3d15d4bad..669b08804 100644
--- a/java/com/android/voicemail/impl/mail/BodyPart.java
+++ b/java/com/android/voicemail/impl/mail/BodyPart.java
@@ -16,9 +16,9 @@
package com.android.voicemail.impl.mail;
public abstract class BodyPart implements Part {
- protected Multipart mParent;
+ protected Multipart parent;
public Multipart getParent() {
- return mParent;
+ return parent;
}
}
diff --git a/java/com/android/voicemail/impl/mail/FixedLengthInputStream.java b/java/com/android/voicemail/impl/mail/FixedLengthInputStream.java
index bd3c16401..473281e09 100644
--- a/java/com/android/voicemail/impl/mail/FixedLengthInputStream.java
+++ b/java/com/android/voicemail/impl/mail/FixedLengthInputStream.java
@@ -24,25 +24,25 @@ import java.io.InputStream;
* where the protocol handler intended the client to read.
*/
public class FixedLengthInputStream extends InputStream {
- private final InputStream mIn;
- private final int mLength;
- private int mCount;
+ private final InputStream in;
+ private final int length;
+ private int count;
public FixedLengthInputStream(InputStream in, int length) {
- this.mIn = in;
- this.mLength = length;
+ this.in = in;
+ this.length = length;
}
@Override
public int available() throws IOException {
- return mLength - mCount;
+ return length - count;
}
@Override
public int read() throws IOException {
- if (mCount < mLength) {
- mCount++;
- return mIn.read();
+ if (count < length) {
+ count++;
+ return in.read();
} else {
return -1;
}
@@ -50,12 +50,12 @@ public class FixedLengthInputStream extends InputStream {
@Override
public int read(byte[] b, int offset, int length) throws IOException {
- if (mCount < mLength) {
- int d = mIn.read(b, offset, Math.min(mLength - mCount, length));
+ if (count < this.length) {
+ int d = in.read(b, offset, Math.min(this.length - count, length));
if (d == -1) {
return -1;
} else {
- mCount += d;
+ count += d;
return d;
}
} else {
@@ -69,11 +69,11 @@ public class FixedLengthInputStream extends InputStream {
}
public int getLength() {
- return mLength;
+ return length;
}
@Override
public String toString() {
- return String.format("FixedLengthInputStream(in=%s, length=%d)", mIn.toString(), mLength);
+ return String.format("FixedLengthInputStream(in=%s, length=%d)", in.toString(), length);
}
}
diff --git a/java/com/android/voicemail/impl/mail/MailTransport.java b/java/com/android/voicemail/impl/mail/MailTransport.java
index c35e41450..a2a6a691a 100644
--- a/java/com/android/voicemail/impl/mail/MailTransport.java
+++ b/java/com/android/voicemail/impl/mail/MailTransport.java
@@ -52,17 +52,17 @@ public class MailTransport {
private static final HostnameVerifier HOSTNAME_VERIFIER =
HttpsURLConnection.getDefaultHostnameVerifier();
- private final Context mContext;
- private final ImapHelper mImapHelper;
- private final Network mNetwork;
- private final String mHost;
- private final int mPort;
- private Socket mSocket;
- private BufferedInputStream mIn;
- private BufferedOutputStream mOut;
- private final int mFlags;
- private SocketCreator mSocketCreator;
- private InetSocketAddress mAddress;
+ private final Context context;
+ private final ImapHelper imapHelper;
+ private final Network network;
+ private final String host;
+ private final int port;
+ private Socket socket;
+ private BufferedInputStream in;
+ private BufferedOutputStream out;
+ private final int flags;
+ private SocketCreator socketCreator;
+ private InetSocketAddress address;
public MailTransport(
Context context,
@@ -71,12 +71,12 @@ public class MailTransport {
String address,
int port,
int flags) {
- mContext = context;
- mImapHelper = imapHelper;
- mNetwork = network;
- mHost = address;
- mPort = port;
- mFlags = flags;
+ this.context = context;
+ this.imapHelper = imapHelper;
+ this.network = network;
+ host = address;
+ this.port = port;
+ this.flags = flags;
}
/**
@@ -85,15 +85,15 @@ public class MailTransport {
*/
@Override
public MailTransport clone() {
- return new MailTransport(mContext, mImapHelper, mNetwork, mHost, mPort, mFlags);
+ return new MailTransport(context, imapHelper, network, host, port, flags);
}
public boolean canTrySslSecurity() {
- return (mFlags & ImapStore.FLAG_SSL) != 0;
+ return (flags & ImapStore.FLAG_SSL) != 0;
}
public boolean canTrustAllCertificates() {
- return (mFlags & ImapStore.FLAG_TRUST_ALL) != 0;
+ return (flags & ImapStore.FLAG_TRUST_ALL) != 0;
}
/**
@@ -101,36 +101,36 @@ public class MailTransport {
* SSL connection if indicated.
*/
public void open() throws MessagingException {
- LogUtils.d(TAG, "*** IMAP open " + mHost + ":" + String.valueOf(mPort));
+ LogUtils.d(TAG, "*** IMAP open " + host + ":" + String.valueOf(port));
List<InetSocketAddress> socketAddresses = new ArrayList<InetSocketAddress>();
- if (mNetwork == null) {
- socketAddresses.add(new InetSocketAddress(mHost, mPort));
+ if (network == null) {
+ socketAddresses.add(new InetSocketAddress(host, port));
} else {
try {
- InetAddress[] inetAddresses = mNetwork.getAllByName(mHost);
+ InetAddress[] inetAddresses = network.getAllByName(host);
if (inetAddresses.length == 0) {
throw new MessagingException(
MessagingException.IOERROR,
- "Host name " + mHost + "cannot be resolved on designated network");
+ "Host name " + host + "cannot be resolved on designated network");
}
for (int i = 0; i < inetAddresses.length; i++) {
- socketAddresses.add(new InetSocketAddress(inetAddresses[i], mPort));
+ socketAddresses.add(new InetSocketAddress(inetAddresses[i], port));
}
} catch (IOException ioe) {
LogUtils.d(TAG, ioe.toString());
- mImapHelper.handleEvent(OmtpEvents.DATA_CANNOT_RESOLVE_HOST_ON_NETWORK);
+ imapHelper.handleEvent(OmtpEvents.DATA_CANNOT_RESOLVE_HOST_ON_NETWORK);
throw new MessagingException(MessagingException.IOERROR, ioe.toString());
}
}
boolean success = false;
while (socketAddresses.size() > 0) {
- mSocket = createSocket();
+ socket = createSocket();
try {
- mAddress = socketAddresses.remove(0);
- mSocket.connect(mAddress, SOCKET_CONNECT_TIMEOUT);
+ address = socketAddresses.remove(0);
+ socket.connect(address, SOCKET_CONNECT_TIMEOUT);
if (canTrySslSecurity()) {
/*
@@ -140,9 +140,9 @@ public class MailTransport {
*/
reopenTls();
} else {
- mIn = new BufferedInputStream(mSocket.getInputStream(), 1024);
- mOut = new BufferedOutputStream(mSocket.getOutputStream(), 512);
- mSocket.setSoTimeout(SOCKET_READ_TIMEOUT);
+ in = new BufferedInputStream(socket.getInputStream(), 1024);
+ out = new BufferedOutputStream(socket.getOutputStream(), 512);
+ socket.setSoTimeout(SOCKET_READ_TIMEOUT);
}
success = true;
return;
@@ -150,14 +150,14 @@ public class MailTransport {
LogUtils.d(TAG, ioe.toString());
if (socketAddresses.size() == 0) {
// Only throw an error when there are no more sockets to try.
- mImapHelper.handleEvent(OmtpEvents.DATA_ALL_SOCKET_CONNECTION_FAILED);
+ imapHelper.handleEvent(OmtpEvents.DATA_ALL_SOCKET_CONNECTION_FAILED);
throw new MessagingException(MessagingException.IOERROR, ioe.toString());
}
} finally {
if (!success) {
try {
- mSocket.close();
- mSocket = null;
+ socket.close();
+ socket = null;
} catch (IOException ioe) {
throw new MessagingException(MessagingException.IOERROR, ioe.toString());
}
@@ -175,15 +175,15 @@ public class MailTransport {
@VisibleForTesting
void setSocketCreator(SocketCreator creator) {
- mSocketCreator = creator;
+ socketCreator = creator;
}
protected Socket createSocket() throws MessagingException {
- if (mSocketCreator != null) {
- return mSocketCreator.createSocket();
+ if (socketCreator != null) {
+ return socketCreator.createSocket();
}
- if (mNetwork == null) {
+ if (network == null) {
LogUtils.v(TAG, "createSocket: network not specified");
return new Socket();
}
@@ -191,7 +191,7 @@ public class MailTransport {
try {
LogUtils.v(TAG, "createSocket: network specified");
TrafficStats.setThreadStatsTag(TrafficStatsTags.VISUAL_VOICEMAIL_TAG);
- return mNetwork.getSocketFactory().createSocket();
+ return network.getSocketFactory().createSocket();
} catch (IOException ioe) {
LogUtils.d(TAG, ioe.toString());
throw new MessagingException(MessagingException.IOERROR, ioe.toString());
@@ -204,17 +204,17 @@ public class MailTransport {
public void reopenTls() throws MessagingException {
try {
LogUtils.d(TAG, "open: converting to TLS socket");
- mSocket =
+ socket =
HttpsURLConnection.getDefaultSSLSocketFactory()
- .createSocket(mSocket, mAddress.getHostName(), mAddress.getPort(), true);
+ .createSocket(socket, address.getHostName(), address.getPort(), true);
// After the socket connects to an SSL server, confirm that the hostname is as
// expected
if (!canTrustAllCertificates()) {
- verifyHostname(mSocket, mHost);
+ verifyHostname(socket, host);
}
- mSocket.setSoTimeout(SOCKET_READ_TIMEOUT);
- mIn = new BufferedInputStream(mSocket.getInputStream(), 1024);
- mOut = new BufferedOutputStream(mSocket.getOutputStream(), 512);
+ socket.setSoTimeout(SOCKET_READ_TIMEOUT);
+ in = new BufferedInputStream(socket.getInputStream(), 1024);
+ out = new BufferedOutputStream(socket.getOutputStream(), 512);
} catch (SSLException e) {
LogUtils.d(TAG, e.toString());
@@ -248,7 +248,7 @@ public class MailTransport {
SSLSession session = ssl.getSession();
if (session == null) {
- mImapHelper.handleEvent(OmtpEvents.DATA_CANNOT_ESTABLISH_SSL_SESSION);
+ imapHelper.handleEvent(OmtpEvents.DATA_CANNOT_ESTABLISH_SSL_SESSION);
throw new SSLException("Cannot verify SSL socket without session");
}
// TODO: Instead of reporting the name of the server we think we're connecting to,
@@ -256,52 +256,52 @@ public class MailTransport {
// in the verifier code and is not available in the verifier API, and extracting the
// CN & alts is beyond the scope of this patch.
if (!HOSTNAME_VERIFIER.verify(hostname, session)) {
- mImapHelper.handleEvent(OmtpEvents.DATA_SSL_INVALID_HOST_NAME);
+ imapHelper.handleEvent(OmtpEvents.DATA_SSL_INVALID_HOST_NAME);
throw new SSLPeerUnverifiedException(
"Certificate hostname not useable for server: " + session.getPeerPrincipal());
}
}
public boolean isOpen() {
- return (mIn != null
- && mOut != null
- && mSocket != null
- && mSocket.isConnected()
- && !mSocket.isClosed());
+ return (in != null
+ && out != null
+ && socket != null
+ && socket.isConnected()
+ && !socket.isClosed());
}
/** Close the connection. MUST NOT return any exceptions - must be "best effort" and safe. */
public void close() {
try {
- mIn.close();
+ in.close();
} catch (Exception e) {
// May fail if the connection is already closed.
}
try {
- mOut.close();
+ out.close();
} catch (Exception e) {
// May fail if the connection is already closed.
}
try {
- mSocket.close();
+ socket.close();
} catch (Exception e) {
// May fail if the connection is already closed.
}
- mIn = null;
- mOut = null;
- mSocket = null;
+ in = null;
+ out = null;
+ socket = null;
}
public String getHost() {
- return mHost;
+ return host;
}
public InputStream getInputStream() {
- return mIn;
+ return in;
}
public OutputStream getOutputStream() {
- return mOut;
+ return out;
}
/** Writes a single line to the server using \r\n termination. */
diff --git a/java/com/android/voicemail/impl/mail/Message.java b/java/com/android/voicemail/impl/mail/Message.java
index ca65d3d73..4e2c64239 100644
--- a/java/com/android/voicemail/impl/mail/Message.java
+++ b/java/com/android/voicemail/impl/mail/Message.java
@@ -33,18 +33,18 @@ public abstract class Message implements Part, Body {
BCC,
}
- protected String mUid;
+ protected String uid;
- private HashSet<String> mFlags = null;
+ private HashSet<String> flags = null;
- protected Date mInternalDate;
+ protected Date internalDate;
public String getUid() {
- return mUid;
+ return uid;
}
public void setUid(String uid) {
- this.mUid = uid;
+ this.uid = uid;
}
public abstract String getSubject() throws MessagingException;
@@ -52,11 +52,11 @@ public abstract class Message implements Part, Body {
public abstract void setSubject(String subject) throws MessagingException;
public Date getInternalDate() {
- return mInternalDate;
+ return internalDate;
}
public void setInternalDate(Date internalDate) {
- this.mInternalDate = internalDate;
+ this.internalDate = internalDate;
}
public abstract Date getReceivedDate() throws MessagingException;
@@ -95,10 +95,10 @@ public abstract class Message implements Part, Body {
}
private HashSet<String> getFlagSet() {
- if (mFlags == null) {
- mFlags = new HashSet<String>();
+ if (flags == null) {
+ flags = new HashSet<String>();
}
- return mFlags;
+ return flags;
}
/*
@@ -145,6 +145,6 @@ public abstract class Message implements Part, Body {
@Override
public String toString() {
- return getClass().getSimpleName() + ':' + mUid;
+ return getClass().getSimpleName() + ':' + uid;
}
}
diff --git a/java/com/android/voicemail/impl/mail/MessagingException.java b/java/com/android/voicemail/impl/mail/MessagingException.java
index c1e3051df..fda5fbc9d 100644
--- a/java/com/android/voicemail/impl/mail/MessagingException.java
+++ b/java/com/android/voicemail/impl/mail/MessagingException.java
@@ -70,9 +70,9 @@ public class MessagingException extends Exception {
/** The server indicates it experienced an internal error */
public static final int SERVER_ERROR = 19;
- protected int mExceptionType;
+ protected int exceptionType;
// Exception type-specific data
- protected Object mExceptionData;
+ protected Object exceptionData;
public MessagingException(String message, Throwable throwable) {
this(UNSPECIFIED_EXCEPTION, message, throwable);
@@ -80,8 +80,8 @@ public class MessagingException extends Exception {
public MessagingException(int exceptionType, String message, Throwable throwable) {
super(message, throwable);
- mExceptionType = exceptionType;
- mExceptionData = null;
+ this.exceptionType = exceptionType;
+ exceptionData = null;
}
/**
@@ -120,8 +120,8 @@ public class MessagingException extends Exception {
*/
public MessagingException(int exceptionType, String message, Object data) {
super(message);
- mExceptionType = exceptionType;
- mExceptionData = data;
+ this.exceptionType = exceptionType;
+ exceptionData = data;
}
/**
@@ -130,7 +130,7 @@ public class MessagingException extends Exception {
* @return Returns the exception type.
*/
public int getExceptionType() {
- return mExceptionType;
+ return exceptionType;
}
/**
* Return the exception data. Will be null if not explicitly set.
@@ -138,6 +138,6 @@ public class MessagingException extends Exception {
* @return Returns the exception data.
*/
public Object getExceptionData() {
- return mExceptionData;
+ return exceptionData;
}
}
diff --git a/java/com/android/voicemail/impl/mail/Multipart.java b/java/com/android/voicemail/impl/mail/Multipart.java
index e8d5046d5..c226ca5ce 100644
--- a/java/com/android/voicemail/impl/mail/Multipart.java
+++ b/java/com/android/voicemail/impl/mail/Multipart.java
@@ -18,45 +18,45 @@ package com.android.voicemail.impl.mail;
import java.util.ArrayList;
public abstract class Multipart implements Body {
- protected Part mParent;
+ protected Part parent;
- protected ArrayList<BodyPart> mParts = new ArrayList<BodyPart>();
+ protected ArrayList<BodyPart> parts = new ArrayList<BodyPart>();
- protected String mContentType;
+ protected String contentType;
public void addBodyPart(BodyPart part) throws MessagingException {
- mParts.add(part);
+ parts.add(part);
}
public void addBodyPart(BodyPart part, int index) throws MessagingException {
- mParts.add(index, part);
+ parts.add(index, part);
}
public BodyPart getBodyPart(int index) throws MessagingException {
- return mParts.get(index);
+ return parts.get(index);
}
public String getContentType() throws MessagingException {
- return mContentType;
+ return contentType;
}
public int getCount() throws MessagingException {
- return mParts.size();
+ return parts.size();
}
public boolean removeBodyPart(BodyPart part) throws MessagingException {
- return mParts.remove(part);
+ return parts.remove(part);
}
public void removeBodyPart(int index) throws MessagingException {
- mParts.remove(index);
+ parts.remove(index);
}
public Part getParent() throws MessagingException {
- return mParent;
+ return parent;
}
public void setParent(Part parent) throws MessagingException {
- this.mParent = parent;
+ this.parent = parent;
}
}
diff --git a/java/com/android/voicemail/impl/mail/PackedString.java b/java/com/android/voicemail/impl/mail/PackedString.java
index 701dab62b..de04b6bbc 100644
--- a/java/com/android/voicemail/impl/mail/PackedString.java
+++ b/java/com/android/voicemail/impl/mail/PackedString.java
@@ -36,8 +36,8 @@ public class PackedString {
private static final char DELIMITER_TAG = '\2';
- private String mString;
- private ArrayMap<String, String> mExploded;
+ private String string;
+ private ArrayMap<String, String> exploded;
private static final ArrayMap<String, String> EMPTY_MAP = new ArrayMap<String, String>();
/**
@@ -46,8 +46,8 @@ public class PackedString {
* @param string packed string
*/
public PackedString(String string) {
- mString = string;
- mExploded = null;
+ this.string = string;
+ exploded = null;
}
/**
@@ -57,10 +57,10 @@ public class PackedString {
* @return returns value, or null if no string is found
*/
public String get(String tag) {
- if (mExploded == null) {
- mExploded = explode(mString);
+ if (exploded == null) {
+ exploded = explode(string);
}
- return mExploded.get(tag);
+ return exploded.get(tag);
}
/**
@@ -70,10 +70,10 @@ public class PackedString {
* @return a map of the values in the packed string
*/
public Map<String, String> unpack() {
- if (mExploded == null) {
- mExploded = explode(mString);
+ if (exploded == null) {
+ exploded = explode(string);
}
- return new ArrayMap<String, String>(mExploded);
+ return new ArrayMap<String, String>(exploded);
}
/** Read out all values into a map. */
@@ -118,16 +118,16 @@ public class PackedString {
* PackedString representations.
*/
public static class Builder {
- ArrayMap<String, String> mMap;
+ ArrayMap<String, String> map;
/** Create a builder that's empty (for filling) */
public Builder() {
- mMap = new ArrayMap<String, String>();
+ map = new ArrayMap<String, String>();
}
/** Create a builder using the values of an existing PackedString (for editing). */
public Builder(String packed) {
- mMap = explode(packed);
+ map = explode(packed);
}
/**
@@ -138,9 +138,9 @@ public class PackedString {
*/
public void put(String tag, String value) {
if (value == null) {
- mMap.remove(tag);
+ map.remove(tag);
} else {
- mMap.put(tag, value);
+ map.put(tag, value);
}
}
@@ -151,14 +151,14 @@ public class PackedString {
* @return returns value, or null if no string is found
*/
public String get(String tag) {
- return mMap.get(tag);
+ return map.get(tag);
}
/** Pack the values and return a single, encoded string */
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
- for (Map.Entry<String, String> entry : mMap.entrySet()) {
+ for (Map.Entry<String, String> entry : map.entrySet()) {
if (sb.length() > 0) {
sb.append(DELIMITER_ELEMENT);
}
diff --git a/java/com/android/voicemail/impl/mail/PeekableInputStream.java b/java/com/android/voicemail/impl/mail/PeekableInputStream.java
index 08f867f82..cc362e801 100644
--- a/java/com/android/voicemail/impl/mail/PeekableInputStream.java
+++ b/java/com/android/voicemail/impl/mail/PeekableInputStream.java
@@ -25,40 +25,40 @@ import java.io.InputStream;
* will still return the peeked byte.
*/
public class PeekableInputStream extends InputStream {
- private final InputStream mIn;
- private boolean mPeeked;
- private int mPeekedByte;
+ private final InputStream in;
+ private boolean peeked;
+ private int peekedByte;
public PeekableInputStream(InputStream in) {
- this.mIn = in;
+ this.in = in;
}
@Override
public int read() throws IOException {
- if (!mPeeked) {
- return mIn.read();
+ if (!peeked) {
+ return in.read();
} else {
- mPeeked = false;
- return mPeekedByte;
+ peeked = false;
+ return peekedByte;
}
}
public int peek() throws IOException {
- if (!mPeeked) {
- mPeekedByte = read();
- mPeeked = true;
+ if (!peeked) {
+ peekedByte = read();
+ peeked = true;
}
- return mPeekedByte;
+ return peekedByte;
}
@Override
public int read(byte[] b, int offset, int length) throws IOException {
- if (!mPeeked) {
- return mIn.read(b, offset, length);
+ if (!peeked) {
+ return in.read(b, offset, length);
} else {
- b[0] = (byte) mPeekedByte;
- mPeeked = false;
- int r = mIn.read(b, offset + 1, length - 1);
+ b[0] = (byte) peekedByte;
+ peeked = false;
+ int r = in.read(b, offset + 1, length - 1);
if (r == -1) {
return 1;
} else {
@@ -75,7 +75,6 @@ public class PeekableInputStream extends InputStream {
@Override
public String toString() {
return String.format(
- "PeekableInputStream(in=%s, peeked=%b, peekedByte=%d)",
- mIn.toString(), mPeeked, mPeekedByte);
+ "PeekableInputStream(in=%s, peeked=%b, peekedByte=%d)", in.toString(), peeked, peekedByte);
}
}
diff --git a/java/com/android/voicemail/impl/mail/TempDirectory.java b/java/com/android/voicemail/impl/mail/TempDirectory.java
index 42adbeb1f..f12e45b82 100644
--- a/java/com/android/voicemail/impl/mail/TempDirectory.java
+++ b/java/com/android/voicemail/impl/mail/TempDirectory.java
@@ -23,18 +23,18 @@ import java.io.File;
* initialization.
*/
public class TempDirectory {
- private static File sTempDirectory = null;
+ private static File tempDirectory = null;
public static void setTempDirectory(Context context) {
- sTempDirectory = context.getCacheDir();
+ tempDirectory = context.getCacheDir();
}
public static File getTempDirectory() {
- if (sTempDirectory == null) {
+ if (tempDirectory == null) {
throw new RuntimeException(
"TempDirectory not set. "
+ "If in a unit test, call Email.setTempDirectory(context) in setUp().");
}
- return sTempDirectory;
+ return tempDirectory;
}
}
diff --git a/java/com/android/voicemail/impl/mail/internet/BinaryTempFileBody.java b/java/com/android/voicemail/impl/mail/internet/BinaryTempFileBody.java
index 753b70f23..d1521bdcb 100644
--- a/java/com/android/voicemail/impl/mail/internet/BinaryTempFileBody.java
+++ b/java/com/android/voicemail/impl/mail/internet/BinaryTempFileBody.java
@@ -36,7 +36,7 @@ import org.apache.commons.io.IOUtils;
* closed the file is deleted and the Body should be considered disposed of.
*/
public class BinaryTempFileBody implements Body {
- private File mFile;
+ private File file;
/**
* An alternate way to put data into a BinaryTempFileBody is to simply supply an already- created
@@ -45,19 +45,19 @@ public class BinaryTempFileBody implements Body {
* @param filePath The file containing the data to be stored on disk temporarily
*/
public void setFile(String filePath) {
- mFile = new File(filePath);
+ file = new File(filePath);
}
public OutputStream getOutputStream() throws IOException {
- mFile = File.createTempFile("body", null, TempDirectory.getTempDirectory());
- mFile.deleteOnExit();
- return new FileOutputStream(mFile);
+ file = File.createTempFile("body", null, TempDirectory.getTempDirectory());
+ file.deleteOnExit();
+ return new FileOutputStream(file);
}
@Override
public InputStream getInputStream() throws MessagingException {
try {
- return new BinaryTempFileBodyInputStream(new FileInputStream(mFile));
+ return new BinaryTempFileBodyInputStream(new FileInputStream(file));
} catch (IOException ioe) {
throw new MessagingException("Unable to open body", ioe);
}
@@ -69,7 +69,7 @@ public class BinaryTempFileBody implements Body {
Base64OutputStream base64Out = new Base64OutputStream(out, Base64.CRLF | Base64.NO_CLOSE);
IOUtils.copy(in, base64Out);
base64Out.close();
- mFile.delete();
+ file.delete();
in.close();
}
@@ -81,7 +81,7 @@ public class BinaryTempFileBody implements Body {
@Override
public void close() throws IOException {
super.close();
- mFile.delete();
+ file.delete();
}
}
}
diff --git a/java/com/android/voicemail/impl/mail/internet/MimeBodyPart.java b/java/com/android/voicemail/impl/mail/internet/MimeBodyPart.java
index 2add76c72..12a2b0b7d 100644
--- a/java/com/android/voicemail/impl/mail/internet/MimeBodyPart.java
+++ b/java/com/android/voicemail/impl/mail/internet/MimeBodyPart.java
@@ -27,10 +27,10 @@ import java.util.regex.Pattern;
/** TODO this is a close approximation of Message, need to update along with Message. */
public class MimeBodyPart extends BodyPart {
- protected MimeHeader mHeader = new MimeHeader();
- protected MimeHeader mExtendedHeader;
- protected Body mBody;
- protected int mSize;
+ protected MimeHeader header = new MimeHeader();
+ protected MimeHeader extendedHeader;
+ protected Body body;
+ protected int size;
// regex that matches content id surrounded by "<>" optionally.
private static final Pattern REMOVE_OPTIONAL_BRACKETS = Pattern.compile("^<?([^>]+)>?$");
@@ -53,37 +53,37 @@ public class MimeBodyPart extends BodyPart {
}
protected String getFirstHeader(String name) throws MessagingException {
- return mHeader.getFirstHeader(name);
+ return header.getFirstHeader(name);
}
@Override
public void addHeader(String name, String value) throws MessagingException {
- mHeader.addHeader(name, value);
+ header.addHeader(name, value);
}
@Override
public void setHeader(String name, String value) throws MessagingException {
- mHeader.setHeader(name, value);
+ header.setHeader(name, value);
}
@Override
public String[] getHeader(String name) throws MessagingException {
- return mHeader.getHeader(name);
+ return header.getHeader(name);
}
@Override
public void removeHeader(String name) throws MessagingException {
- mHeader.removeHeader(name);
+ header.removeHeader(name);
}
@Override
public Body getBody() throws MessagingException {
- return mBody;
+ return body;
}
@Override
public void setBody(Body body) throws MessagingException {
- this.mBody = body;
+ this.body = body;
if (body instanceof Multipart) {
Multipart multipart =
((Multipart) body);
@@ -142,12 +142,12 @@ public class MimeBodyPart extends BodyPart {
}
public void setSize(int size) {
- this.mSize = size;
+ this.size = size;
}
@Override
public int getSize() throws MessagingException {
- return mSize;
+ return size;
}
/**
@@ -160,15 +160,15 @@ public class MimeBodyPart extends BodyPart {
@Override
public void setExtendedHeader(String name, String value) throws MessagingException {
if (value == null) {
- if (mExtendedHeader != null) {
- mExtendedHeader.removeHeader(name);
+ if (extendedHeader != null) {
+ extendedHeader.removeHeader(name);
}
return;
}
- if (mExtendedHeader == null) {
- mExtendedHeader = new MimeHeader();
+ if (extendedHeader == null) {
+ extendedHeader = new MimeHeader();
}
- mExtendedHeader.setHeader(name, END_OF_LINE.matcher(value).replaceAll(""));
+ extendedHeader.setHeader(name, END_OF_LINE.matcher(value).replaceAll(""));
}
/**
@@ -180,21 +180,21 @@ public class MimeBodyPart extends BodyPart {
*/
@Override
public String getExtendedHeader(String name) throws MessagingException {
- if (mExtendedHeader == null) {
+ if (extendedHeader == null) {
return null;
}
- return mExtendedHeader.getFirstHeader(name);
+ return extendedHeader.getFirstHeader(name);
}
/** Write the MimeMessage out in MIME format. */
@Override
public void writeTo(OutputStream out) throws IOException, MessagingException {
BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(out), 1024);
- mHeader.writeTo(out);
+ header.writeTo(out);
writer.write("\r\n");
writer.flush();
- if (mBody != null) {
- mBody.writeTo(out);
+ if (body != null) {
+ body.writeTo(out);
}
}
}
diff --git a/java/com/android/voicemail/impl/mail/internet/MimeHeader.java b/java/com/android/voicemail/impl/mail/internet/MimeHeader.java
index 8f0817650..00a9eccf2 100644
--- a/java/com/android/voicemail/impl/mail/internet/MimeHeader.java
+++ b/java/com/android/voicemail/impl/mail/internet/MimeHeader.java
@@ -45,10 +45,10 @@ public class MimeHeader {
HEADER_ANDROID_ATTACHMENT_STORE_DATA
};
- protected final ArrayList<Field> mFields = new ArrayList<Field>();
+ protected final ArrayList<Field> fields = new ArrayList<Field>();
public void clear() {
- mFields.clear();
+ fields.clear();
}
public String getFirstHeader(String name) throws MessagingException {
@@ -60,7 +60,7 @@ public class MimeHeader {
}
public void addHeader(String name, String value) throws MessagingException {
- mFields.add(new Field(name, value));
+ fields.add(new Field(name, value));
}
public void setHeader(String name, String value) throws MessagingException {
@@ -73,7 +73,7 @@ public class MimeHeader {
public String[] getHeader(String name) throws MessagingException {
ArrayList<String> values = new ArrayList<String>();
- for (Field field : mFields) {
+ for (Field field : fields) {
if (field.name.equalsIgnoreCase(name)) {
values.add(field.value);
}
@@ -86,12 +86,12 @@ public class MimeHeader {
public void removeHeader(String name) throws MessagingException {
ArrayList<Field> removeFields = new ArrayList<Field>();
- for (Field field : mFields) {
+ for (Field field : fields) {
if (field.name.equalsIgnoreCase(name)) {
removeFields.add(field);
}
}
- mFields.removeAll(removeFields);
+ fields.removeAll(removeFields);
}
/**
@@ -101,11 +101,11 @@ public class MimeHeader {
* empty
*/
public String writeToString() {
- if (mFields.size() == 0) {
+ if (fields.size() == 0) {
return null;
}
StringBuilder builder = new StringBuilder();
- for (Field field : mFields) {
+ for (Field field : fields) {
if (!arrayContains(WRITE_OMIT_FIELDS, field.name)) {
builder.append(field.name + ": " + field.value + "\r\n");
}
@@ -115,7 +115,7 @@ public class MimeHeader {
public void writeTo(OutputStream out) throws IOException, MessagingException {
BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(out), 1024);
- for (Field field : mFields) {
+ for (Field field : fields) {
if (!arrayContains(WRITE_OMIT_FIELDS, field.name)) {
writer.write(field.name + ": " + field.value + "\r\n");
}
@@ -140,7 +140,7 @@ public class MimeHeader {
@Override
public String toString() {
- return (mFields == null) ? null : mFields.toString();
+ return (fields == null) ? null : fields.toString();
}
public static final boolean arrayContains(Object[] a, Object o) {
diff --git a/java/com/android/voicemail/impl/mail/internet/MimeMessage.java b/java/com/android/voicemail/impl/mail/internet/MimeMessage.java
index 39378a092..2997ad8c5 100644
--- a/java/com/android/voicemail/impl/mail/internet/MimeMessage.java
+++ b/java/com/android/voicemail/impl/mail/internet/MimeMessage.java
@@ -53,24 +53,24 @@ import org.apache.james.mime4j.stream.Field;
* It would be better to simply do it explicitly on local creation of new outgoing messages.
*/
public class MimeMessage extends Message {
- private MimeHeader mHeader;
- private MimeHeader mExtendedHeader;
+ private MimeHeader header;
+ private MimeHeader extendedHeader;
// NOTE: The fields here are transcribed out of headers, and values stored here will supersede
// the values found in the headers. Use caution to prevent any out-of-phase errors. In
// particular, any adds/changes/deletes here must be echoed by changes in the parse() function.
- private Address[] mFrom;
- private Address[] mTo;
- private Address[] mCc;
- private Address[] mBcc;
- private Address[] mReplyTo;
- private Date mSentDate;
- private Body mBody;
- protected int mSize;
- private boolean mInhibitLocalMessageId = false;
+ private Address[] from;
+ private Address[] to;
+ private Address[] cc;
+ private Address[] bcc;
+ private Address[] replyTo;
+ private Date sentDate;
+ private Body body;
+ protected int size;
+ private boolean inhibitLocalMessageId = false;
// Shared random source for generating local message-id values
- private static final java.util.Random sRandom = new java.util.Random();
+ private static final java.util.Random random = new java.util.Random();
// In MIME, en_US-like date format should be used. In other words "MMM" should be encoded to
// "Jan", not the other localized format like "Ene" (meaning January in locale es).
@@ -86,7 +86,7 @@ public class MimeMessage extends Message {
private static final Pattern END_OF_LINE = Pattern.compile("\r?\n");
public MimeMessage() {
- mHeader = null;
+ header = null;
}
/**
@@ -100,7 +100,7 @@ public class MimeMessage extends Message {
sb.append("<");
for (int i = 0; i < 24; i++) {
// We'll use a 5-bit range (0..31)
- final int value = sRandom.nextInt() & 31;
+ final int value = random.nextInt() & 31;
final char c = "0123456789abcdefghijklmnopqrstuv".charAt(value);
sb.append(c);
}
@@ -125,14 +125,14 @@ public class MimeMessage extends Message {
// Before parsing the input stream, clear all local fields that may be superceded by
// the new incoming message.
getMimeHeaders().clear();
- mInhibitLocalMessageId = true;
- mFrom = null;
- mTo = null;
- mCc = null;
- mBcc = null;
- mReplyTo = null;
- mSentDate = null;
- mBody = null;
+ inhibitLocalMessageId = true;
+ from = null;
+ to = null;
+ cc = null;
+ bcc = null;
+ replyTo = null;
+ sentDate = null;
+ body = null;
final MimeStreamParser parser = new MimeStreamParser();
parser.setContentHandler(new MimeMessageBuilder());
@@ -149,10 +149,10 @@ public class MimeMessage extends Message {
* not creating the headers until needed.
*/
private MimeHeader getMimeHeaders() {
- if (mHeader == null) {
- mHeader = new MimeHeader();
+ if (header == null) {
+ header = new MimeHeader();
}
- return mHeader;
+ return header;
}
@Override
@@ -162,40 +162,40 @@ public class MimeMessage extends Message {
@Override
public Date getSentDate() throws MessagingException {
- if (mSentDate == null) {
+ if (sentDate == null) {
try {
DateTimeField field =
(DateTimeField)
DefaultFieldParser.parse(
"Date: " + MimeUtility.unfoldAndDecode(getFirstHeader("Date")));
- mSentDate = field.getDate();
+ sentDate = field.getDate();
// TODO: We should make it more clear what exceptions can be thrown here,
// and whether they reflect a normal or error condition.
} catch (Exception e) {
LogUtils.v(LogUtils.TAG, "Message missing Date header");
}
}
- if (mSentDate == null) {
+ if (sentDate == null) {
// If we still don't have a date, fall back to "Delivery-date"
try {
DateTimeField field =
(DateTimeField)
DefaultFieldParser.parse(
"Date: " + MimeUtility.unfoldAndDecode(getFirstHeader("Delivery-date")));
- mSentDate = field.getDate();
+ sentDate = field.getDate();
// TODO: We should make it more clear what exceptions can be thrown here,
// and whether they reflect a normal or error condition.
} catch (Exception e) {
LogUtils.v(LogUtils.TAG, "Message also missing Delivery-Date header");
}
}
- return mSentDate;
+ return sentDate;
}
@Override
public void setSentDate(Date sentDate) throws MessagingException {
setHeader("Date", DATE_FORMAT.format(sentDate));
- this.mSentDate = sentDate;
+ this.sentDate = sentDate;
}
@Override
@@ -253,7 +253,7 @@ public class MimeMessage extends Message {
@Override
public int getSize() throws MessagingException {
- return mSize;
+ return size;
}
/**
@@ -263,20 +263,20 @@ public class MimeMessage extends Message {
@Override
public Address[] getRecipients(String type) throws MessagingException {
if (type == RECIPIENT_TYPE_TO) {
- if (mTo == null) {
- mTo = Address.parse(MimeUtility.unfold(getFirstHeader("To")));
+ if (to == null) {
+ to = Address.parse(MimeUtility.unfold(getFirstHeader("To")));
}
- return mTo;
+ return to;
} else if (type == RECIPIENT_TYPE_CC) {
- if (mCc == null) {
- mCc = Address.parse(MimeUtility.unfold(getFirstHeader("CC")));
+ if (cc == null) {
+ cc = Address.parse(MimeUtility.unfold(getFirstHeader("CC")));
}
- return mCc;
+ return cc;
} else if (type == RECIPIENT_TYPE_BCC) {
- if (mBcc == null) {
- mBcc = Address.parse(MimeUtility.unfold(getFirstHeader("BCC")));
+ if (bcc == null) {
+ bcc = Address.parse(MimeUtility.unfold(getFirstHeader("BCC")));
}
- return mBcc;
+ return bcc;
} else {
throw new MessagingException("Unrecognized recipient type.");
}
@@ -290,26 +290,26 @@ public class MimeMessage extends Message {
if (type == RECIPIENT_TYPE_TO) {
if (addresses == null || addresses.length == 0) {
removeHeader("To");
- this.mTo = null;
+ this.to = null;
} else {
setHeader("To", MimeUtility.fold(Address.toHeader(addresses), toLength));
- this.mTo = addresses;
+ this.to = addresses;
}
} else if (type == RECIPIENT_TYPE_CC) {
if (addresses == null || addresses.length == 0) {
removeHeader("CC");
- this.mCc = null;
+ this.cc = null;
} else {
setHeader("CC", MimeUtility.fold(Address.toHeader(addresses), ccLength));
- this.mCc = addresses;
+ this.cc = addresses;
}
} else if (type == RECIPIENT_TYPE_BCC) {
if (addresses == null || addresses.length == 0) {
removeHeader("BCC");
- this.mBcc = null;
+ this.bcc = null;
} else {
setHeader("BCC", MimeUtility.fold(Address.toHeader(addresses), bccLength));
- this.mBcc = addresses;
+ this.bcc = addresses;
}
} else {
throw new MessagingException("Unrecognized recipient type.");
@@ -330,14 +330,14 @@ public class MimeMessage extends Message {
@Override
public Address[] getFrom() throws MessagingException {
- if (mFrom == null) {
+ if (from == null) {
String list = MimeUtility.unfold(getFirstHeader("From"));
if (list == null || list.length() == 0) {
list = MimeUtility.unfold(getFirstHeader("Sender"));
}
- mFrom = Address.parse(list);
+ from = Address.parse(list);
}
- return mFrom;
+ return from;
}
@Override
@@ -345,18 +345,18 @@ public class MimeMessage extends Message {
final int fromLength = 6; // "From: "
if (from != null) {
setHeader("From", MimeUtility.fold(from.toHeader(), fromLength));
- this.mFrom = new Address[] {from};
+ this.from = new Address[] {from};
} else {
- this.mFrom = null;
+ this.from = null;
}
}
@Override
public Address[] getReplyTo() throws MessagingException {
- if (mReplyTo == null) {
- mReplyTo = Address.parse(MimeUtility.unfold(getFirstHeader("Reply-to")));
+ if (replyTo == null) {
+ replyTo = Address.parse(MimeUtility.unfold(getFirstHeader("Reply-to")));
}
- return mReplyTo;
+ return replyTo;
}
@Override
@@ -364,10 +364,10 @@ public class MimeMessage extends Message {
final int replyToLength = 10; // "Reply-to: "
if (replyTo == null || replyTo.length == 0) {
removeHeader("Reply-to");
- mReplyTo = null;
+ this.replyTo = null;
} else {
setHeader("Reply-to", MimeUtility.fold(Address.toHeader(replyTo), replyToLength));
- mReplyTo = replyTo;
+ this.replyTo = replyTo;
}
}
@@ -392,7 +392,7 @@ public class MimeMessage extends Message {
@Override
public String getMessageId() throws MessagingException {
String messageId = getFirstHeader("Message-ID");
- if (messageId == null && !mInhibitLocalMessageId) {
+ if (messageId == null && !inhibitLocalMessageId) {
messageId = generateMessageId();
setMessageId(messageId);
}
@@ -406,12 +406,12 @@ public class MimeMessage extends Message {
@Override
public Body getBody() throws MessagingException {
- return mBody;
+ return body;
}
@Override
public void setBody(Body body) throws MessagingException {
- this.mBody = body;
+ this.body = body;
if (body instanceof Multipart) {
final Multipart multipart = ((Multipart) body);
multipart.setParent(this);
@@ -447,7 +447,7 @@ public class MimeMessage extends Message {
public void removeHeader(String name) throws MessagingException {
getMimeHeaders().removeHeader(name);
if ("Message-ID".equalsIgnoreCase(name)) {
- mInhibitLocalMessageId = true;
+ inhibitLocalMessageId = true;
}
}
@@ -461,15 +461,15 @@ public class MimeMessage extends Message {
@Override
public void setExtendedHeader(String name, String value) throws MessagingException {
if (value == null) {
- if (mExtendedHeader != null) {
- mExtendedHeader.removeHeader(name);
+ if (extendedHeader != null) {
+ extendedHeader.removeHeader(name);
}
return;
}
- if (mExtendedHeader == null) {
- mExtendedHeader = new MimeHeader();
+ if (extendedHeader == null) {
+ extendedHeader = new MimeHeader();
}
- mExtendedHeader.setHeader(name, END_OF_LINE.matcher(value).replaceAll(""));
+ extendedHeader.setHeader(name, END_OF_LINE.matcher(value).replaceAll(""));
}
/**
@@ -481,10 +481,10 @@ public class MimeMessage extends Message {
*/
@Override
public String getExtendedHeader(String name) throws MessagingException {
- if (mExtendedHeader == null) {
+ if (extendedHeader == null) {
return null;
}
- return mExtendedHeader.getFirstHeader(name);
+ return extendedHeader.getFirstHeader(name);
}
/**
@@ -496,15 +496,15 @@ public class MimeMessage extends Message {
*/
public void setExtendedHeaders(String headers) throws MessagingException {
if (TextUtils.isEmpty(headers)) {
- mExtendedHeader = null;
+ extendedHeader = null;
} else {
- mExtendedHeader = new MimeHeader();
+ extendedHeader = new MimeHeader();
for (final String header : END_OF_LINE.split(headers)) {
final String[] tokens = header.split(":", 2);
if (tokens.length != 2) {
throw new MessagingException("Illegal extended headers: " + headers);
}
- mExtendedHeader.setHeader(tokens[0].trim(), tokens[1].trim());
+ extendedHeader.setHeader(tokens[0].trim(), tokens[1].trim());
}
}
}
@@ -515,8 +515,8 @@ public class MimeMessage extends Message {
* @return "CR-NL-separated extended headers - null if extended header does not exist
*/
public String getExtendedHeaders() {
- if (mExtendedHeader != null) {
- return mExtendedHeader.writeToString();
+ if (extendedHeader != null) {
+ return extendedHeader.writeToString();
}
return null;
}
@@ -536,8 +536,8 @@ public class MimeMessage extends Message {
// because it is intended to internal use.
writer.write("\r\n");
writer.flush();
- if (mBody != null) {
- mBody.writeTo(out);
+ if (body != null) {
+ body.writeTo(out);
}
}
diff --git a/java/com/android/voicemail/impl/mail/internet/MimeMultipart.java b/java/com/android/voicemail/impl/mail/internet/MimeMultipart.java
index 87b88b52a..6cb2c2701 100644
--- a/java/com/android/voicemail/impl/mail/internet/MimeMultipart.java
+++ b/java/com/android/voicemail/impl/mail/internet/MimeMultipart.java
@@ -25,25 +25,25 @@ import java.io.OutputStream;
import java.io.OutputStreamWriter;
public class MimeMultipart extends Multipart {
- protected String mPreamble;
+ protected String preamble;
- protected String mContentType;
+ protected String contentType;
- protected String mBoundary;
+ protected String boundary;
- protected String mSubType;
+ protected String subType;
public MimeMultipart() throws MessagingException {
- mBoundary = generateBoundary();
+ boundary = generateBoundary();
setSubType("mixed");
}
public MimeMultipart(String contentType) throws MessagingException {
- this.mContentType = contentType;
+ this.contentType = contentType;
try {
- mSubType = MimeUtility.getHeaderParameter(contentType, null).split("/")[1];
- mBoundary = MimeUtility.getHeaderParameter(contentType, "boundary");
- if (mBoundary == null) {
+ subType = MimeUtility.getHeaderParameter(contentType, null).split("/")[1];
+ boundary = MimeUtility.getHeaderParameter(contentType, "boundary");
+ if (boundary == null) {
throw new MessagingException("MultiPart does not contain boundary: " + contentType);
}
} catch (Exception e) {
@@ -65,40 +65,40 @@ public class MimeMultipart extends Multipart {
}
public String getPreamble() throws MessagingException {
- return mPreamble;
+ return preamble;
}
public void setPreamble(String preamble) throws MessagingException {
- this.mPreamble = preamble;
+ this.preamble = preamble;
}
@Override
public String getContentType() throws MessagingException {
- return mContentType;
+ return contentType;
}
public void setSubType(String subType) throws MessagingException {
- this.mSubType = subType;
- mContentType = String.format("multipart/%s; boundary=\"%s\"", subType, mBoundary);
+ this.subType = subType;
+ contentType = String.format("multipart/%s; boundary=\"%s\"", subType, boundary);
}
@Override
public void writeTo(OutputStream out) throws IOException, MessagingException {
BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(out), 1024);
- if (mPreamble != null) {
- writer.write(mPreamble + "\r\n");
+ if (preamble != null) {
+ writer.write(preamble + "\r\n");
}
- for (int i = 0, count = mParts.size(); i < count; i++) {
- BodyPart bodyPart = mParts.get(i);
- writer.write("--" + mBoundary + "\r\n");
+ for (int i = 0, count = parts.size(); i < count; i++) {
+ BodyPart bodyPart = parts.get(i);
+ writer.write("--" + boundary + "\r\n");
writer.flush();
bodyPart.writeTo(out);
writer.write("\r\n");
}
- writer.write("--" + mBoundary + "--\r\n");
+ writer.write("--" + boundary + "--\r\n");
writer.flush();
}
@@ -108,6 +108,6 @@ public class MimeMultipart extends Multipart {
}
public String getSubTypeForTest() {
- return mSubType;
+ return subType;
}
}
diff --git a/java/com/android/voicemail/impl/mail/internet/TextBody.java b/java/com/android/voicemail/impl/mail/internet/TextBody.java
index dae562508..506e1f52e 100644
--- a/java/com/android/voicemail/impl/mail/internet/TextBody.java
+++ b/java/com/android/voicemail/impl/mail/internet/TextBody.java
@@ -25,15 +25,15 @@ import java.io.OutputStream;
import java.io.UnsupportedEncodingException;
public class TextBody implements Body {
- String mBody;
+ String body;
public TextBody(String body) {
- this.mBody = body;
+ this.body = body;
}
@Override
public void writeTo(OutputStream out) throws IOException, MessagingException {
- byte[] bytes = mBody.getBytes("UTF-8");
+ byte[] bytes = body.getBytes("UTF-8");
out.write(Base64.encode(bytes, Base64.CRLF));
}
@@ -43,14 +43,14 @@ public class TextBody implements Body {
* @return
*/
public String getText() {
- return mBody;
+ return body;
}
/** Returns an InputStream that reads this body's text in UTF-8 format. */
@Override
public InputStream getInputStream() throws MessagingException {
try {
- byte[] b = mBody.getBytes("UTF-8");
+ byte[] b = body.getBytes("UTF-8");
return new ByteArrayInputStream(b);
} catch (UnsupportedEncodingException usee) {
return null;
diff --git a/java/com/android/voicemail/impl/mail/store/ImapConnection.java b/java/com/android/voicemail/impl/mail/store/ImapConnection.java
index 0a48dfc69..ac43f8d72 100644
--- a/java/com/android/voicemail/impl/mail/store/ImapConnection.java
+++ b/java/com/android/voicemail/impl/mail/store/ImapConnection.java
@@ -42,11 +42,11 @@ import javax.net.ssl.SSLException;
public class ImapConnection {
private final String TAG = "ImapConnection";
- private String mLoginPhrase;
- private ImapStore mImapStore;
- private MailTransport mTransport;
- private ImapResponseParser mParser;
- private Set<String> mCapabilities = new ArraySet<>();
+ private String loginPhrase;
+ private ImapStore imapStore;
+ private MailTransport transport;
+ private ImapResponseParser parser;
+ private Set<String> capabilities = new ArraySet<>();
static final String IMAP_REDACTED_LOG = "[IMAP command redacted]";
@@ -55,7 +55,7 @@ public class ImapConnection {
* counter to make tests simpler. (Some of the tests involve multiple connections but only have a
* single counter to track the tag.)
*/
- private final AtomicInteger mNextCommandTag = new AtomicInteger(0);
+ private final AtomicInteger nextCommandTag = new AtomicInteger(0);
ImapConnection(ImapStore store) {
setStore(store);
@@ -65,8 +65,8 @@ public class ImapConnection {
// TODO: maybe we should throw an exception if the connection is not closed here,
// if it's not currently closed, then we won't reopen it, so if the credentials have
// changed, the connection will not be reestablished.
- mImapStore = store;
- mLoginPhrase = null;
+ imapStore = store;
+ loginPhrase = null;
}
/**
@@ -76,42 +76,42 @@ public class ImapConnection {
* @return the login command string to sent to the IMAP server
*/
String getLoginPhrase() {
- if (mLoginPhrase == null) {
- if (mImapStore.getUsername() != null && mImapStore.getPassword() != null) {
+ if (loginPhrase == null) {
+ if (imapStore.getUsername() != null && imapStore.getPassword() != null) {
// build the LOGIN string once (instead of over-and-over again.)
// apply the quoting here around the built-up password
- mLoginPhrase =
+ loginPhrase =
ImapConstants.LOGIN
+ " "
- + mImapStore.getUsername()
+ + imapStore.getUsername()
+ " "
- + ImapUtility.imapQuoted(mImapStore.getPassword());
+ + ImapUtility.imapQuoted(imapStore.getPassword());
}
}
- return mLoginPhrase;
+ return loginPhrase;
}
public void open() throws IOException, MessagingException {
- if (mTransport != null && mTransport.isOpen()) {
+ if (transport != null && transport.isOpen()) {
return;
}
try {
// copy configuration into a clean transport, if necessary
- if (mTransport == null) {
- mTransport = mImapStore.cloneTransport();
+ if (transport == null) {
+ transport = imapStore.cloneTransport();
}
- mTransport.open();
+ transport.open();
createParser();
// The server should greet us with something like
// * OK IMAP4rev1 Server
// consume the response before doing anything else.
- ImapResponse response = mParser.readResponse(false);
+ ImapResponse response = parser.readResponse(false);
if (!response.isOk()) {
- mImapStore.getImapHelper().handleEvent(OmtpEvents.DATA_INVALID_INITIAL_SERVER_RESPONSE);
+ imapStore.getImapHelper().handleEvent(OmtpEvents.DATA_INVALID_INITIAL_SERVER_RESPONSE);
throw new MessagingException(
MessagingException.AUTHENTICATION_FAILED_OR_SERVER_ERROR,
"Invalid server initial response");
@@ -125,11 +125,11 @@ public class ImapConnection {
doLogin();
} catch (SSLException e) {
LogUtils.d(TAG, "SSLException ", e);
- mImapStore.getImapHelper().handleEvent(OmtpEvents.DATA_SSL_EXCEPTION);
+ imapStore.getImapHelper().handleEvent(OmtpEvents.DATA_SSL_EXCEPTION);
throw new CertificateValidationException(e.getMessage(), e);
} catch (IOException ioe) {
LogUtils.d(TAG, "IOException", ioe);
- mImapStore.getImapHelper().handleEvent(OmtpEvents.DATA_IOE_ON_OPEN);
+ imapStore.getImapHelper().handleEvent(OmtpEvents.DATA_IOE_ON_OPEN);
throw ioe;
} finally {
destroyResponses();
@@ -139,10 +139,10 @@ public class ImapConnection {
void logout() {
try {
sendCommand(ImapConstants.LOGOUT, false);
- if (!mParser.readResponse(true).is(0, ImapConstants.BYE)) {
+ if (!parser.readResponse(true).is(0, ImapConstants.BYE)) {
VvmLog.e(TAG, "Server did not respond LOGOUT with BYE");
}
- if (!mParser.readResponse(false).isOk()) {
+ if (!parser.readResponse(false).isOk()) {
VvmLog.e(TAG, "Server did not respond OK after LOGOUT");
}
} catch (IOException | MessagingException e) {
@@ -155,14 +155,14 @@ public class ImapConnection {
* {@link #setStore(ImapStore)} is called.
*/
void close() {
- if (mTransport != null) {
+ if (transport != null) {
logout();
- mTransport.close();
- mTransport = null;
+ transport.close();
+ transport = null;
}
destroyResponses();
- mParser = null;
- mImapStore = null;
+ parser = null;
+ imapStore = null;
}
/** Attempts to convert the connection into secure connection. */
@@ -171,7 +171,7 @@ public class ImapConnection {
// Make sure the server does have this capability
if (hasCapability(ImapConstants.CAPABILITY_STARTTLS)) {
executeSimpleCommand(ImapConstants.STARTTLS);
- mTransport.reopenTls();
+ transport.reopenTls();
createParser();
// The cached capabilities should be refreshed after TLS is established.
queryCapability();
@@ -181,7 +181,7 @@ public class ImapConnection {
/** Logs into the IMAP server */
private void doLogin() throws IOException, MessagingException, AuthenticationFailedException {
try {
- if (mCapabilities.contains(ImapConstants.CAPABILITY_AUTH_DIGEST_MD5)) {
+ if (capabilities.contains(ImapConstants.CAPABILITY_AUTH_DIGEST_MD5)) {
doDigestMd5Auth();
} else {
executeSimpleCommand(getLoginPhrase(), true);
@@ -195,36 +195,36 @@ public class ImapConnection {
if (ImapConstants.NO.equals(status)) {
switch (statusMessage) {
case ImapConstants.NO_UNKNOWN_USER:
- mImapStore.getImapHelper().handleEvent(OmtpEvents.DATA_AUTH_UNKNOWN_USER);
+ imapStore.getImapHelper().handleEvent(OmtpEvents.DATA_AUTH_UNKNOWN_USER);
break;
case ImapConstants.NO_UNKNOWN_CLIENT:
- mImapStore.getImapHelper().handleEvent(OmtpEvents.DATA_AUTH_UNKNOWN_DEVICE);
+ imapStore.getImapHelper().handleEvent(OmtpEvents.DATA_AUTH_UNKNOWN_DEVICE);
break;
case ImapConstants.NO_INVALID_PASSWORD:
- mImapStore.getImapHelper().handleEvent(OmtpEvents.DATA_AUTH_INVALID_PASSWORD);
+ imapStore.getImapHelper().handleEvent(OmtpEvents.DATA_AUTH_INVALID_PASSWORD);
break;
case ImapConstants.NO_MAILBOX_NOT_INITIALIZED:
- mImapStore.getImapHelper().handleEvent(OmtpEvents.DATA_AUTH_MAILBOX_NOT_INITIALIZED);
+ imapStore.getImapHelper().handleEvent(OmtpEvents.DATA_AUTH_MAILBOX_NOT_INITIALIZED);
break;
case ImapConstants.NO_SERVICE_IS_NOT_PROVISIONED:
- mImapStore.getImapHelper().handleEvent(OmtpEvents.DATA_AUTH_SERVICE_NOT_PROVISIONED);
+ imapStore.getImapHelper().handleEvent(OmtpEvents.DATA_AUTH_SERVICE_NOT_PROVISIONED);
break;
case ImapConstants.NO_SERVICE_IS_NOT_ACTIVATED:
- mImapStore.getImapHelper().handleEvent(OmtpEvents.DATA_AUTH_SERVICE_NOT_ACTIVATED);
+ imapStore.getImapHelper().handleEvent(OmtpEvents.DATA_AUTH_SERVICE_NOT_ACTIVATED);
break;
case ImapConstants.NO_USER_IS_BLOCKED:
- mImapStore.getImapHelper().handleEvent(OmtpEvents.DATA_AUTH_USER_IS_BLOCKED);
+ imapStore.getImapHelper().handleEvent(OmtpEvents.DATA_AUTH_USER_IS_BLOCKED);
break;
case ImapConstants.NO_APPLICATION_ERROR:
- mImapStore.getImapHelper().handleEvent(OmtpEvents.DATA_REJECTED_SERVER_RESPONSE);
+ imapStore.getImapHelper().handleEvent(OmtpEvents.DATA_REJECTED_SERVER_RESPONSE);
break;
default:
- mImapStore.getImapHelper().handleEvent(OmtpEvents.DATA_BAD_IMAP_CREDENTIAL);
+ imapStore.getImapHelper().handleEvent(OmtpEvents.DATA_BAD_IMAP_CREDENTIAL);
}
throw new AuthenticationFailedException(alertText, ie);
}
- mImapStore.getImapHelper().handleEvent(OmtpEvents.DATA_REJECTED_SERVER_RESPONSE);
+ imapStore.getImapHelper().handleEvent(OmtpEvents.DATA_REJECTED_SERVER_RESPONSE);
throw new MessagingException(alertText, ie);
}
}
@@ -243,7 +243,7 @@ public class ImapConnection {
String decodedChallenge = decodeBase64(responses.get(0).getStringOrEmpty(0).getString());
Map<String, String> challenge = DigestMd5Utils.parseDigestMessage(decodedChallenge);
- DigestMd5Utils.Data data = new DigestMd5Utils.Data(mImapStore, mTransport, challenge);
+ DigestMd5Utils.Data data = new DigestMd5Utils.Data(imapStore, transport, challenge);
String response = data.createResponse();
// Respond to the challenge. If the server accepts it, it will reply a response-auth which
@@ -281,9 +281,9 @@ public class ImapConnection {
private void queryCapability() throws IOException, MessagingException {
List<ImapResponse> responses = executeSimpleCommand(ImapConstants.CAPABILITY);
- mCapabilities.clear();
+ capabilities.clear();
Set<String> disabledCapabilities =
- mImapStore.getImapHelper().getConfig().getDisabledCapabilities();
+ imapStore.getImapHelper().getConfig().getDisabledCapabilities();
for (ImapResponse response : responses) {
if (response.isTagged()) {
continue;
@@ -292,40 +292,40 @@ public class ImapConnection {
String capability = response.getStringOrEmpty(i).getString();
if (disabledCapabilities != null) {
if (!disabledCapabilities.contains(capability)) {
- mCapabilities.add(capability);
+ capabilities.add(capability);
}
} else {
- mCapabilities.add(capability);
+ capabilities.add(capability);
}
}
}
- LogUtils.d(TAG, "Capabilities: " + mCapabilities.toString());
+ LogUtils.d(TAG, "Capabilities: " + capabilities.toString());
}
private boolean hasCapability(String capability) {
- return mCapabilities.contains(capability);
+ return capabilities.contains(capability);
}
/**
* Create an {@link ImapResponseParser} from {@code mTransport.getInputStream()} and set it to
- * {@link #mParser}.
+ * {@link #parser}.
*
* <p>If we already have an {@link ImapResponseParser}, we {@link #destroyResponses()} and throw
* it away.
*/
private void createParser() {
destroyResponses();
- mParser = new ImapResponseParser(mTransport.getInputStream());
+ parser = new ImapResponseParser(transport.getInputStream());
}
public void destroyResponses() {
- if (mParser != null) {
- mParser.destroyResponses();
+ if (parser != null) {
+ parser.destroyResponses();
}
}
public ImapResponse readResponse() throws IOException, MessagingException {
- return mParser.readResponse(false);
+ return parser.readResponse(false);
}
public List<ImapResponse> executeSimpleCommand(String command)
@@ -356,18 +356,18 @@ public class ImapConnection {
throws IOException, MessagingException {
open();
- if (mTransport == null) {
+ if (transport == null) {
throw new IOException("Null transport");
}
- String tag = Integer.toString(mNextCommandTag.incrementAndGet());
+ String tag = Integer.toString(nextCommandTag.incrementAndGet());
String commandToSend = tag + " " + command;
- mTransport.writeLine(commandToSend, (sensitive ? IMAP_REDACTED_LOG : command));
+ transport.writeLine(commandToSend, (sensitive ? IMAP_REDACTED_LOG : command));
return tag;
}
List<ImapResponse> executeContinuationResponse(String response, boolean sensitive)
throws IOException, MessagingException {
- mTransport.writeLine(response, (sensitive ? IMAP_REDACTED_LOG : response));
+ transport.writeLine(response, (sensitive ? IMAP_REDACTED_LOG : response));
return getCommandResponses();
}
@@ -382,7 +382,7 @@ public class ImapConnection {
final List<ImapResponse> responses = new ArrayList<ImapResponse>();
ImapResponse response;
do {
- response = mParser.readResponse(false);
+ response = parser.readResponse(false);
responses.add(response);
} while (!(response.isTagged() || response.isContinuationRequest()));
diff --git a/java/com/android/voicemail/impl/mail/store/ImapFolder.java b/java/com/android/voicemail/impl/mail/store/ImapFolder.java
index 5760ee216..3c76ec33d 100644
--- a/java/com/android/voicemail/impl/mail/store/ImapFolder.java
+++ b/java/com/android/voicemail/impl/mail/store/ImapFolder.java
@@ -59,21 +59,21 @@ public class ImapFolder {
};
private static final int COPY_BUFFER_SIZE = 16 * 1024;
- private final ImapStore mStore;
- private final String mName;
- private int mMessageCount = -1;
- private ImapConnection mConnection;
- private String mMode;
- private boolean mExists;
+ private final ImapStore store;
+ private final String name;
+ private int messageCount = -1;
+ private ImapConnection connection;
+ private String mode;
+ private boolean exists;
/** A set of hashes that can be used to track dirtiness */
- Object[] mHash;
+ Object[] hash;
public static final String MODE_READ_ONLY = "mode_read_only";
public static final String MODE_READ_WRITE = "mode_read_write";
public ImapFolder(ImapStore store, String name) {
- mStore = store;
- mName = name;
+ this.store = store;
+ this.name = name;
}
/** Callback for each message retrieval. */
@@ -82,8 +82,8 @@ public class ImapFolder {
}
private void destroyResponses() {
- if (mConnection != null) {
- mConnection.destroyResponses();
+ if (connection != null) {
+ connection.destroyResponses();
}
}
@@ -93,7 +93,7 @@ public class ImapFolder {
throw new AssertionError("Duplicated open on ImapFolder");
}
synchronized (this) {
- mConnection = mStore.getConnection();
+ connection = store.getConnection();
}
// * FLAGS (\Answered \Flagged \Deleted \Seen \Draft NonJunk
// $MDNSent)
@@ -107,28 +107,28 @@ public class ImapFolder {
try {
doSelect();
} catch (IOException ioe) {
- throw ioExceptionHandler(mConnection, ioe);
+ throw ioExceptionHandler(connection, ioe);
} finally {
destroyResponses();
}
} catch (AuthenticationFailedException e) {
// Don't cache this connection, so we're forced to try connecting/login again
- mConnection = null;
+ connection = null;
close(false);
throw e;
} catch (MessagingException e) {
- mExists = false;
+ exists = false;
close(false);
throw e;
}
}
public boolean isOpen() {
- return mExists && mConnection != null;
+ return exists && connection != null;
}
public String getMode() {
- return mMode;
+ return mode;
}
public void close(boolean expunge) {
@@ -139,14 +139,14 @@ public class ImapFolder {
VvmLog.e(TAG, "Messaging Exception", e);
}
}
- mMessageCount = -1;
+ messageCount = -1;
synchronized (this) {
- mConnection = null;
+ connection = null;
}
}
public int getMessageCount() {
- return mMessageCount;
+ return messageCount;
}
String[] getSearchUids(List<ImapResponse> responses) {
@@ -173,7 +173,7 @@ public class ImapFolder {
try {
try {
final String command = ImapConstants.UID_SEARCH + " " + searchCriteria;
- final String[] result = getSearchUids(mConnection.executeSimpleCommand(command));
+ final String[] result = getSearchUids(connection.executeSimpleCommand(command));
VvmLog.d(TAG, "searchForUids '" + searchCriteria + "' results: " + result.length);
return result;
} catch (ImapException me) {
@@ -181,8 +181,8 @@ public class ImapFolder {
return Utility.EMPTY_STRINGS; // Not found
} catch (IOException ioe) {
VvmLog.d(TAG, "IOException in search: " + searchCriteria, ioe);
- mStore.getImapHelper().handleEvent(OmtpEvents.DATA_GENERIC_IMAP_IOE);
- throw ioExceptionHandler(mConnection, ioe);
+ store.getImapHelper().handleEvent(OmtpEvents.DATA_GENERIC_IMAP_IOE);
+ throw ioExceptionHandler(connection, ioe);
}
} finally {
destroyResponses();
@@ -296,7 +296,7 @@ public class ImapFolder {
}
try {
- mConnection.sendCommand(
+ connection.sendCommand(
String.format(
Locale.US,
ImapConstants.UID_FETCH + " %s (%s)",
@@ -307,7 +307,7 @@ public class ImapFolder {
do {
response = null;
try {
- response = mConnection.readResponse();
+ response = connection.readResponse();
if (!response.isDataResponse(1, ImapConstants.FETCH)) {
continue; // Ignore
@@ -395,7 +395,7 @@ public class ImapFolder {
// (We'll need to share a temp file. Protect it with a ref-count.)
message.setBody(
decodeBody(
- mStore.getContext(),
+ store.getContext(),
bodyStream,
contentTransferEncoding,
fetchPart.getSize(),
@@ -417,8 +417,8 @@ public class ImapFolder {
}
} while (!response.isTagged());
} catch (IOException ioe) {
- mStore.getImapHelper().handleEvent(OmtpEvents.DATA_GENERIC_IMAP_IOE);
- throw ioExceptionHandler(mConnection, ioe);
+ store.getImapHelper().handleEvent(OmtpEvents.DATA_GENERIC_IMAP_IOE);
+ throw ioExceptionHandler(connection, ioe);
}
}
@@ -476,7 +476,7 @@ public class ImapFolder {
*/
private void handleUntaggedResponse(ImapResponse response) {
if (response.isDataResponse(1, ImapConstants.EXISTS)) {
- mMessageCount = response.getStringOrEmpty(0).getNumberOrZero();
+ messageCount = response.getStringOrEmpty(0).getNumberOrZero();
}
}
@@ -660,10 +660,10 @@ public class ImapFolder {
public Message[] expunge() throws MessagingException {
checkOpen();
try {
- handleUntaggedResponses(mConnection.executeSimpleCommand(ImapConstants.EXPUNGE));
+ handleUntaggedResponses(connection.executeSimpleCommand(ImapConstants.EXPUNGE));
} catch (IOException ioe) {
- mStore.getImapHelper().handleEvent(OmtpEvents.DATA_GENERIC_IMAP_IOE);
- throw ioExceptionHandler(mConnection, ioe);
+ store.getImapHelper().handleEvent(OmtpEvents.DATA_GENERIC_IMAP_IOE);
+ throw ioExceptionHandler(connection, ioe);
} finally {
destroyResponses();
}
@@ -692,7 +692,7 @@ public class ImapFolder {
allFlags = flagList.substring(1);
}
try {
- mConnection.executeSimpleCommand(
+ connection.executeSimpleCommand(
String.format(
Locale.US,
ImapConstants.UID_STORE + " %s %s" + ImapConstants.FLAGS_SILENT + " (%s)",
@@ -701,8 +701,8 @@ public class ImapFolder {
allFlags));
} catch (IOException ioe) {
- mStore.getImapHelper().handleEvent(OmtpEvents.DATA_GENERIC_IMAP_IOE);
- throw ioExceptionHandler(mConnection, ioe);
+ store.getImapHelper().handleEvent(OmtpEvents.DATA_GENERIC_IMAP_IOE);
+ throw ioExceptionHandler(connection, ioe);
} finally {
destroyResponses();
}
@@ -714,11 +714,11 @@ public class ImapFolder {
*/
private void doSelect() throws IOException, MessagingException {
final List<ImapResponse> responses =
- mConnection.executeSimpleCommand(
- String.format(Locale.US, ImapConstants.SELECT + " \"%s\"", mName));
+ connection.executeSimpleCommand(
+ String.format(Locale.US, ImapConstants.SELECT + " \"%s\"", name));
// Assume the folder is opened read-write; unless we are notified otherwise
- mMode = MODE_READ_WRITE;
+ mode = MODE_READ_WRITE;
int messageCount = -1;
for (ImapResponse response : responses) {
if (response.isDataResponse(1, ImapConstants.EXISTS)) {
@@ -726,12 +726,12 @@ public class ImapFolder {
} else if (response.isOk()) {
final ImapString responseCode = response.getResponseCodeOrEmpty();
if (responseCode.is(ImapConstants.READ_ONLY)) {
- mMode = MODE_READ_ONLY;
+ mode = MODE_READ_ONLY;
} else if (responseCode.is(ImapConstants.READ_WRITE)) {
- mMode = MODE_READ_WRITE;
+ mode = MODE_READ_WRITE;
}
} else if (response.isTagged()) { // Not OK
- mStore.getImapHelper().handleEvent(OmtpEvents.DATA_MAILBOX_OPEN_FAILED);
+ store.getImapHelper().handleEvent(OmtpEvents.DATA_MAILBOX_OPEN_FAILED);
throw new MessagingException(
"Can't open mailbox: " + response.getStatusResponseTextOrEmpty());
}
@@ -739,8 +739,8 @@ public class ImapFolder {
if (messageCount == -1) {
throw new MessagingException("Did not find message count during select");
}
- mMessageCount = messageCount;
- mExists = true;
+ this.messageCount = messageCount;
+ exists = true;
}
public class Quota {
@@ -757,8 +757,8 @@ public class ImapFolder {
public Quota getQuota() throws MessagingException {
try {
final List<ImapResponse> responses =
- mConnection.executeSimpleCommand(
- String.format(Locale.US, ImapConstants.GETQUOTAROOT + " \"%s\"", mName));
+ connection.executeSimpleCommand(
+ String.format(Locale.US, ImapConstants.GETQUOTAROOT + " \"%s\"", name));
for (ImapResponse response : responses) {
if (!response.isDataResponse(0, ImapConstants.QUOTA)) {
@@ -775,8 +775,8 @@ public class ImapFolder {
}
}
} catch (IOException ioe) {
- mStore.getImapHelper().handleEvent(OmtpEvents.DATA_GENERIC_IMAP_IOE);
- throw ioExceptionHandler(mConnection, ioe);
+ store.getImapHelper().handleEvent(OmtpEvents.DATA_GENERIC_IMAP_IOE);
+ throw ioExceptionHandler(connection, ioe);
} finally {
destroyResponses();
}
@@ -785,15 +785,15 @@ public class ImapFolder {
private void checkOpen() throws MessagingException {
if (!isOpen()) {
- throw new MessagingException("Folder " + mName + " is not open.");
+ throw new MessagingException("Folder " + name + " is not open.");
}
}
private MessagingException ioExceptionHandler(ImapConnection connection, IOException ioe) {
VvmLog.d(TAG, "IO Exception detected: ", ioe);
connection.close();
- if (connection == mConnection) {
- mConnection = null; // To prevent close() from returning the connection to the pool.
+ if (connection == this.connection) {
+ this.connection = null; // To prevent close() from returning the connection to the pool.
close(false);
}
return new MessagingException(MessagingException.IOERROR, "IO Error", ioe);
diff --git a/java/com/android/voicemail/impl/mail/store/ImapStore.java b/java/com/android/voicemail/impl/mail/store/ImapStore.java
index 838bae257..6b88080fe 100644
--- a/java/com/android/voicemail/impl/mail/store/ImapStore.java
+++ b/java/com/android/voicemail/impl/mail/store/ImapStore.java
@@ -34,12 +34,12 @@ public class ImapStore {
*/
public static final int FETCH_BODY_SANE_SUGGESTED_SIZE = (125 * 1024);
- private final Context mContext;
- private final ImapHelper mHelper;
- private final String mUsername;
- private final String mPassword;
- private final MailTransport mTransport;
- private ImapConnection mConnection;
+ private final Context context;
+ private final ImapHelper helper;
+ private final String username;
+ private final String password;
+ private final MailTransport transport;
+ private ImapConnection connection;
public static final int FLAG_NONE = 0x00; // No flags
public static final int FLAG_SSL = 0x01; // Use SSL
@@ -58,32 +58,32 @@ public class ImapStore {
String serverName,
int flags,
Network network) {
- mContext = context;
- mHelper = helper;
- mUsername = username;
- mPassword = password;
- mTransport = new MailTransport(context, this.getImapHelper(), network, serverName, port, flags);
+ this.context = context;
+ this.helper = helper;
+ this.username = username;
+ this.password = password;
+ transport = new MailTransport(context, this.getImapHelper(), network, serverName, port, flags);
}
public Context getContext() {
- return mContext;
+ return context;
}
public ImapHelper getImapHelper() {
- return mHelper;
+ return helper;
}
public String getUsername() {
- return mUsername;
+ return username;
}
public String getPassword() {
- return mPassword;
+ return password;
}
/** Returns a clone of the transport associated with this store. */
MailTransport cloneTransport() {
- return mTransport.clone();
+ return transport.clone();
}
/** Returns UIDs of Messages joined with "," as the separator. */
@@ -101,15 +101,15 @@ public class ImapStore {
}
static class ImapMessage extends MimeMessage {
- private ImapFolder mFolder;
+ private ImapFolder folder;
ImapMessage(String uid, ImapFolder folder) {
- mUid = uid;
- mFolder = folder;
+ this.uid = uid;
+ this.folder = folder;
}
public void setSize(int size) {
- mSize = size;
+ this.size = size;
}
@Override
@@ -124,17 +124,17 @@ public class ImapStore {
@Override
public void setFlag(String flag, boolean set) throws MessagingException {
super.setFlag(flag, set);
- mFolder.setFlags(new Message[] {this}, new String[] {flag}, set);
+ folder.setFlags(new Message[] {this}, new String[] {flag}, set);
}
}
static class ImapException extends MessagingException {
private static final long serialVersionUID = 1L;
- private final String mStatus;
- private final String mStatusMessage;
- private final String mAlertText;
- private final String mResponseCode;
+ private final String status;
+ private final String statusMessage;
+ private final String alertText;
+ private final String responseCode;
public ImapException(
String message,
@@ -143,40 +143,40 @@ public class ImapStore {
String alertText,
String responseCode) {
super(message);
- mStatus = status;
- mStatusMessage = statusMessage;
- mAlertText = alertText;
- mResponseCode = responseCode;
+ this.status = status;
+ this.statusMessage = statusMessage;
+ this.alertText = alertText;
+ this.responseCode = responseCode;
}
public String getStatus() {
- return mStatus;
+ return status;
}
public String getStatusMessage() {
- return mStatusMessage;
+ return statusMessage;
}
public String getAlertText() {
- return mAlertText;
+ return alertText;
}
public String getResponseCode() {
- return mResponseCode;
+ return responseCode;
}
}
public void closeConnection() {
- if (mConnection != null) {
- mConnection.close();
- mConnection = null;
+ if (connection != null) {
+ connection.close();
+ connection = null;
}
}
public ImapConnection getConnection() {
- if (mConnection == null) {
- mConnection = new ImapConnection(this);
+ if (connection == null) {
+ connection = new ImapConnection(this);
}
- return mConnection;
+ return connection;
}
}
diff --git a/java/com/android/voicemail/impl/mail/store/imap/DigestMd5Utils.java b/java/com/android/voicemail/impl/mail/store/imap/DigestMd5Utils.java
index f156f67c1..aa2886812 100644
--- a/java/com/android/voicemail/impl/mail/store/imap/DigestMd5Utils.java
+++ b/java/com/android/voicemail/impl/mail/store/imap/DigestMd5Utils.java
@@ -121,27 +121,27 @@ public class DigestMd5Utils {
private static class ResponseBuilder {
- private StringBuilder mBuilder = new StringBuilder();
+ private StringBuilder builder = new StringBuilder();
public ResponseBuilder appendQuoted(String key, String value) {
- if (mBuilder.length() != 0) {
- mBuilder.append(",");
+ if (builder.length() != 0) {
+ builder.append(",");
}
- mBuilder.append(key).append("=\"").append(value).append("\"");
+ builder.append(key).append("=\"").append(value).append("\"");
return this;
}
public ResponseBuilder append(String key, String value) {
- if (mBuilder.length() != 0) {
- mBuilder.append(",");
+ if (builder.length() != 0) {
+ builder.append(",");
}
- mBuilder.append(key).append("=").append(value);
+ builder.append(key).append("=").append(value);
return this;
}
@Override
public String toString() {
- return mBuilder.toString();
+ return builder.toString();
}
}
}
@@ -229,20 +229,20 @@ public class DigestMd5Utils {
/** Parse the key-value pair returned by the server. */
private static class DigestMessageParser {
- private final String mMessage;
- private int mPosition = 0;
- private Map<String, String> mResult = new ArrayMap<>();
+ private final String message;
+ private int position = 0;
+ private Map<String, String> result = new ArrayMap<>();
public DigestMessageParser(String message) {
- mMessage = message;
+ this.message = message;
}
@Nullable
public Map<String, String> parse() {
try {
- while (mPosition < mMessage.length()) {
+ while (position < message.length()) {
parsePair();
- if (mPosition != mMessage.length()) {
+ if (position != message.length()) {
expect(',');
}
}
@@ -250,42 +250,42 @@ public class DigestMd5Utils {
VvmLog.e(TAG, e.toString());
return null;
}
- return mResult;
+ return result;
}
private void parsePair() {
String key = parseKey();
expect('=');
String value = parseValue();
- mResult.put(key, value);
+ result.put(key, value);
}
private void expect(char c) {
if (pop() != c) {
- throw new IllegalStateException("unexpected character " + mMessage.charAt(mPosition));
+ throw new IllegalStateException("unexpected character " + message.charAt(position));
}
}
private char pop() {
char result = peek();
- mPosition++;
+ position++;
return result;
}
private char peek() {
- return mMessage.charAt(mPosition);
+ return message.charAt(position);
}
private void goToNext(char c) {
while (peek() != c) {
- mPosition++;
+ position++;
}
}
private String parseKey() {
- int start = mPosition;
+ int start = position;
goToNext('=');
- return mMessage.substring(start, mPosition);
+ return message.substring(start, position);
}
private String parseValue() {
@@ -319,13 +319,13 @@ public class DigestMd5Utils {
if (c == '\\') {
result.append(pop());
} else if (c == ',') {
- mPosition--;
+ position--;
break;
} else {
result.append(c);
}
- if (mPosition == mMessage.length()) {
+ if (position == message.length()) {
break;
}
}
diff --git a/java/com/android/voicemail/impl/mail/store/imap/ImapElement.java b/java/com/android/voicemail/impl/mail/store/imap/ImapElement.java
index ee255d1eb..c2571f3d9 100644
--- a/java/com/android/voicemail/impl/mail/store/imap/ImapElement.java
+++ b/java/com/android/voicemail/impl/mail/store/imap/ImapElement.java
@@ -77,14 +77,14 @@ public abstract class ImapElement {
}
};
- private boolean mDestroyed = false;
+ private boolean destroyed = false;
public abstract boolean isList();
public abstract boolean isString();
protected boolean isDestroyed() {
- return mDestroyed;
+ return destroyed;
}
/**
@@ -92,12 +92,12 @@ public abstract class ImapElement {
* ImapTempFileLiteral}.
*/
public void destroy() {
- mDestroyed = true;
+ destroyed = true;
}
/** Throws {@link RuntimeException} if it's already destroyed. */
protected final void checkNotDestroyed() {
- if (mDestroyed) {
+ if (destroyed) {
throw new RuntimeException("Already destroyed");
}
}
diff --git a/java/com/android/voicemail/impl/mail/store/imap/ImapList.java b/java/com/android/voicemail/impl/mail/store/imap/ImapList.java
index e4a6ec0ac..a72883fa6 100644
--- a/java/com/android/voicemail/impl/mail/store/imap/ImapList.java
+++ b/java/com/android/voicemail/impl/mail/store/imap/ImapList.java
@@ -35,13 +35,13 @@ public class ImapList extends ImapElement {
}
};
- private ArrayList<ImapElement> mList = new ArrayList<ImapElement>();
+ private ArrayList<ImapElement> list = new ArrayList<ImapElement>();
/* package */ void add(ImapElement e) {
if (e == null) {
throw new RuntimeException("Can't add null");
}
- mList.add(e);
+ list.add(e);
}
@Override
@@ -55,7 +55,7 @@ public class ImapList extends ImapElement {
}
public final int size() {
- return mList.size();
+ return list.size();
}
public final boolean isEmpty() {
@@ -84,7 +84,7 @@ public class ImapList extends ImapElement {
* ImapElement#NONE}.
*/
public final ImapElement getElementOrNone(int index) {
- return (index >= mList.size()) ? ImapElement.NONE : mList.get(index);
+ return (index >= list.size()) ? ImapElement.NONE : list.get(index);
}
/**
@@ -112,7 +112,7 @@ public class ImapList extends ImapElement {
/* package */ final ImapElement getKeyedElementOrNull(String key, boolean prefixMatch) {
for (int i = 1; i < size(); i += 2) {
if (is(i - 1, key, prefixMatch)) {
- return mList.get(i);
+ return list.get(i);
}
}
return null;
@@ -162,18 +162,18 @@ public class ImapList extends ImapElement {
@Override
public void destroy() {
- if (mList != null) {
- for (ImapElement e : mList) {
+ if (list != null) {
+ for (ImapElement e : list) {
e.destroy();
}
- mList = null;
+ list = null;
}
super.destroy();
}
@Override
public String toString() {
- return mList.toString();
+ return list.toString();
}
/** Return the text representations of the contents concatenated with ",". */
@@ -192,7 +192,7 @@ public class ImapList extends ImapElement {
*/
private final StringBuilder flatten(StringBuilder sb) {
sb.append('[');
- for (int i = 0; i < mList.size(); i++) {
+ for (int i = 0; i < list.size(); i++) {
if (i > 0) {
sb.append(',');
}
@@ -217,7 +217,7 @@ public class ImapList extends ImapElement {
return false;
}
for (int i = 0; i < size(); i++) {
- if (!mList.get(i).equalsForTest(thatList.getElementOrNone(i))) {
+ if (!list.get(i).equalsForTest(thatList.getElementOrNone(i))) {
return false;
}
}
diff --git a/java/com/android/voicemail/impl/mail/store/imap/ImapMemoryLiteral.java b/java/com/android/voicemail/impl/mail/store/imap/ImapMemoryLiteral.java
index 96a8c4ae5..46f3fc5ed 100644
--- a/java/com/android/voicemail/impl/mail/store/imap/ImapMemoryLiteral.java
+++ b/java/com/android/voicemail/impl/mail/store/imap/ImapMemoryLiteral.java
@@ -26,35 +26,35 @@ import java.io.UnsupportedEncodingException;
/** Subclass of {@link ImapString} used for literals backed by an in-memory byte array. */
public class ImapMemoryLiteral extends ImapString {
private final String TAG = "ImapMemoryLiteral";
- private byte[] mData;
+ private byte[] data;
/* package */ ImapMemoryLiteral(FixedLengthInputStream in) throws IOException {
// We could use ByteArrayOutputStream and IOUtils.copy, but it'd perform an unnecessary
// copy....
- mData = new byte[in.getLength()];
+ data = new byte[in.getLength()];
int pos = 0;
- while (pos < mData.length) {
- int read = in.read(mData, pos, mData.length - pos);
+ while (pos < data.length) {
+ int read = in.read(data, pos, data.length - pos);
if (read < 0) {
break;
}
pos += read;
}
- if (pos != mData.length) {
+ if (pos != data.length) {
VvmLog.w(TAG, "length mismatch");
}
}
@Override
public void destroy() {
- mData = null;
+ data = null;
super.destroy();
}
@Override
public String getString() {
try {
- return new String(mData, "US-ASCII");
+ return new String(data, "US-ASCII");
} catch (UnsupportedEncodingException e) {
VvmLog.e(TAG, "Unsupported encoding: ", e);
}
@@ -63,11 +63,11 @@ public class ImapMemoryLiteral extends ImapString {
@Override
public InputStream getAsStream() {
- return new ByteArrayInputStream(mData);
+ return new ByteArrayInputStream(data);
}
@Override
public String toString() {
- return String.format("{%d byte literal(memory)}", mData.length);
+ return String.format("{%d byte literal(memory)}", data.length);
}
}
diff --git a/java/com/android/voicemail/impl/mail/store/imap/ImapResponse.java b/java/com/android/voicemail/impl/mail/store/imap/ImapResponse.java
index d53d458da..48eb39d2d 100644
--- a/java/com/android/voicemail/impl/mail/store/imap/ImapResponse.java
+++ b/java/com/android/voicemail/impl/mail/store/imap/ImapResponse.java
@@ -18,12 +18,12 @@ package com.android.voicemail.impl.mail.store.imap;
/** Class represents an IMAP response. */
public class ImapResponse extends ImapList {
- private final String mTag;
- private final boolean mIsContinuationRequest;
+ private final String tag;
+ private final boolean isContinuationRequest;
/* package */ ImapResponse(String tag, boolean isContinuationRequest) {
- mTag = tag;
- mIsContinuationRequest = isContinuationRequest;
+ this.tag = tag;
+ this.isContinuationRequest = isContinuationRequest;
}
/* package */ static boolean isStatusResponse(String symbol) {
@@ -36,12 +36,12 @@ public class ImapResponse extends ImapList {
/** @return whether it's a tagged response. */
public boolean isTagged() {
- return mTag != null;
+ return tag != null;
}
/** @return whether it's a continuation request. */
public boolean isContinuationRequest() {
- return mIsContinuationRequest;
+ return isContinuationRequest;
}
public boolean isStatusResponse() {
@@ -112,7 +112,7 @@ public class ImapResponse extends ImapList {
@Override
public String toString() {
- String tag = mTag;
+ String tag = this.tag;
if (isContinuationRequest()) {
tag = "+";
}
@@ -125,16 +125,16 @@ public class ImapResponse extends ImapList {
return false;
}
final ImapResponse thatResponse = (ImapResponse) that;
- if (mTag == null) {
- if (thatResponse.mTag != null) {
+ if (tag == null) {
+ if (thatResponse.tag != null) {
return false;
}
} else {
- if (!mTag.equals(thatResponse.mTag)) {
+ if (!tag.equals(thatResponse.tag)) {
return false;
}
}
- if (mIsContinuationRequest != thatResponse.mIsContinuationRequest) {
+ if (isContinuationRequest != thatResponse.isContinuationRequest) {
return false;
}
return true;
diff --git a/java/com/android/voicemail/impl/mail/store/imap/ImapResponseParser.java b/java/com/android/voicemail/impl/mail/store/imap/ImapResponseParser.java
index e37106a69..68d6babbd 100644
--- a/java/com/android/voicemail/impl/mail/store/imap/ImapResponseParser.java
+++ b/java/com/android/voicemail/impl/mail/store/imap/ImapResponseParser.java
@@ -33,21 +33,21 @@ public class ImapResponseParser {
public static final int LITERAL_KEEP_IN_MEMORY_THRESHOLD = 2 * 1024 * 1024;
/** Input stream */
- private final PeekableInputStream mIn;
+ private final PeekableInputStream in;
- private final int mLiteralKeepInMemoryThreshold;
+ private final int literalKeepInMemoryThreshold;
/** StringBuilder used by readUntil() */
- private final StringBuilder mBufferReadUntil = new StringBuilder();
+ private final StringBuilder bufferReadUntil = new StringBuilder();
/** StringBuilder used by parseBareString() */
- private final StringBuilder mParseBareString = new StringBuilder();
+ private final StringBuilder parseBareString = new StringBuilder();
/**
* We store all {@link ImapResponse} in it. {@link #destroyResponses()} must be called from time
* to time to destroy them and clear it.
*/
- private final ArrayList<ImapResponse> mResponsesToDestroy = new ArrayList<ImapResponse>();
+ private final ArrayList<ImapResponse> responsesToDestroy = new ArrayList<ImapResponse>();
/**
* Exception thrown when we receive BYE. It derives from IOException, so it'll be treated in the
@@ -68,8 +68,8 @@ public class ImapResponseParser {
/** Constructor for testing to override the literal size threshold. */
/* package for test */ ImapResponseParser(InputStream in, int literalKeepInMemoryThreshold) {
- mIn = new PeekableInputStream(in);
- mLiteralKeepInMemoryThreshold = literalKeepInMemoryThreshold;
+ this.in = new PeekableInputStream(in);
+ this.literalKeepInMemoryThreshold = literalKeepInMemoryThreshold;
}
private static IOException newEOSException() {
@@ -85,7 +85,7 @@ public class ImapResponseParser {
* shouldn't see EOF during parsing.
*/
private int peek() throws IOException {
- final int next = mIn.peek();
+ final int next = in.peek();
if (next == -1) {
throw newEOSException();
}
@@ -93,13 +93,13 @@ public class ImapResponseParser {
}
/**
- * Read and return one byte from {@link #mIn}, and put it in {@link #mDiscourseLogger}.
+ * Read and return one byte from {@link #in}, and put it in {@link #mDiscourseLogger}.
*
* <p>Throws IOException() if reaches EOF. As long as logical response lines end with \r\n, we
* shouldn't see EOF during parsing.
*/
private int readByte() throws IOException {
- int next = mIn.read();
+ int next = in.read();
if (next == -1) {
throw newEOSException();
}
@@ -112,10 +112,10 @@ public class ImapResponseParser {
* @see #readResponse()
*/
public void destroyResponses() {
- for (ImapResponse r : mResponsesToDestroy) {
+ for (ImapResponse r : responsesToDestroy) {
r.destroy();
}
- mResponsesToDestroy.clear();
+ responsesToDestroy.clear();
}
/**
@@ -151,7 +151,7 @@ public class ImapResponseParser {
response.destroy();
throw new ByeException();
}
- mResponsesToDestroy.add(response);
+ responsesToDestroy.add(response);
return response;
}
@@ -192,13 +192,13 @@ public class ImapResponseParser {
* (rather than peeked) and won't be included in the result.
*/
/* package for test */ String readUntil(char end) throws IOException {
- mBufferReadUntil.setLength(0);
+ bufferReadUntil.setLength(0);
for (; ; ) {
final int ch = readByte();
if (ch != end) {
- mBufferReadUntil.append((char) ch);
+ bufferReadUntil.append((char) ch);
} else {
- return mBufferReadUntil.toString();
+ return bufferReadUntil.toString();
}
}
}
@@ -326,7 +326,7 @@ public class ImapResponseParser {
* <p>If the value is "NIL", returns an empty string.
*/
private ImapString parseBareString() throws IOException, MessagingException {
- mParseBareString.setLength(0);
+ parseBareString.setLength(0);
for (; ; ) {
final int ch = peek();
@@ -351,10 +351,10 @@ public class ImapResponseParser {
ch == '"'
|| (0x00 <= ch && ch <= 0x1f)
|| ch == 0x7f) {
- if (mParseBareString.length() == 0) {
+ if (parseBareString.length() == 0) {
throw new MessagingException("Expected string, none found.");
}
- String s = mParseBareString.toString();
+ String s = parseBareString.toString();
// NIL will be always converted into the empty string.
if (ImapConstants.NIL.equalsIgnoreCase(s)) {
@@ -363,11 +363,11 @@ public class ImapResponseParser {
return new ImapSimpleString(s);
} else if (ch == '[') {
// Eat all until next ']'
- mParseBareString.append((char) readByte());
- mParseBareString.append(readUntil(']'));
- mParseBareString.append(']'); // readUntil won't include the end char.
+ parseBareString.append((char) readByte());
+ parseBareString.append(readUntil(']'));
+ parseBareString.append(']'); // readUntil won't include the end char.
} else {
- mParseBareString.append((char) readByte());
+ parseBareString.append((char) readByte());
}
}
}
@@ -414,8 +414,8 @@ public class ImapResponseParser {
}
expect('\r');
expect('\n');
- FixedLengthInputStream in = new FixedLengthInputStream(mIn, size);
- if (size > mLiteralKeepInMemoryThreshold) {
+ FixedLengthInputStream in = new FixedLengthInputStream(this.in, size);
+ if (size > literalKeepInMemoryThreshold) {
return new ImapTempFileLiteral(in);
} else {
return new ImapMemoryLiteral(in);
diff --git a/java/com/android/voicemail/impl/mail/store/imap/ImapSimpleString.java b/java/com/android/voicemail/impl/mail/store/imap/ImapSimpleString.java
index 7cc866b74..76d3c6e91 100644
--- a/java/com/android/voicemail/impl/mail/store/imap/ImapSimpleString.java
+++ b/java/com/android/voicemail/impl/mail/store/imap/ImapSimpleString.java
@@ -24,27 +24,27 @@ import java.io.UnsupportedEncodingException;
/** Subclass of {@link ImapString} used for non literals. */
public class ImapSimpleString extends ImapString {
private final String TAG = "ImapSimpleString";
- private String mString;
+ private String string;
/* package */ ImapSimpleString(String string) {
- mString = (string != null) ? string : "";
+ this.string = (string != null) ? string : "";
}
@Override
public void destroy() {
- mString = null;
+ string = null;
super.destroy();
}
@Override
public String getString() {
- return mString;
+ return string;
}
@Override
public InputStream getAsStream() {
try {
- return new ByteArrayInputStream(mString.getBytes("US-ASCII"));
+ return new ByteArrayInputStream(string.getBytes("US-ASCII"));
} catch (UnsupportedEncodingException e) {
VvmLog.e(TAG, "Unsupported encoding: ", e);
}
@@ -54,6 +54,6 @@ public class ImapSimpleString extends ImapString {
@Override
public String toString() {
// Purposefully not return just mString, in order to prevent using it instead of getString.
- return "\"" + mString + "\"";
+ return "\"" + string + "\"";
}
}
diff --git a/java/com/android/voicemail/impl/mail/store/imap/ImapString.java b/java/com/android/voicemail/impl/mail/store/imap/ImapString.java
index d5c555126..099e569a8 100644
--- a/java/com/android/voicemail/impl/mail/store/imap/ImapString.java
+++ b/java/com/android/voicemail/impl/mail/store/imap/ImapString.java
@@ -64,9 +64,9 @@ public abstract class ImapString extends ImapElement {
private static final SimpleDateFormat DATE_TIME_FORMAT =
new SimpleDateFormat("dd-MMM-yyyy HH:mm:ss Z", Locale.US);
- private boolean mIsInteger;
- private int mParsedInteger;
- private Date mParsedDate;
+ private boolean isInteger;
+ private int parsedInteger;
+ private Date parsedDate;
@Override
public final boolean isList() {
@@ -94,12 +94,12 @@ public abstract class ImapString extends ImapElement {
/** @return whether it can be parsed as a number. */
public final boolean isNumber() {
- if (mIsInteger) {
+ if (isInteger) {
return true;
}
try {
- mParsedInteger = Integer.parseInt(getString());
- mIsInteger = true;
+ parsedInteger = Integer.parseInt(getString());
+ isInteger = true;
return true;
} catch (NumberFormatException e) {
return false;
@@ -116,19 +116,19 @@ public abstract class ImapString extends ImapElement {
if (!isNumber()) {
return defaultValue;
}
- return mParsedInteger;
+ return parsedInteger;
}
/** @return whether it can be parsed as a date using {@link #DATE_TIME_FORMAT}. */
public final boolean isDate() {
- if (mParsedDate != null) {
+ if (parsedDate != null) {
return true;
}
if (isEmpty()) {
return false;
}
try {
- mParsedDate = DATE_TIME_FORMAT.parse(getString());
+ parsedDate = DATE_TIME_FORMAT.parse(getString());
return true;
} catch (ParseException e) {
VvmLog.w("ImapString", getString() + " can't be parsed as a date.");
@@ -141,7 +141,7 @@ public abstract class ImapString extends ImapElement {
if (!isDate()) {
return null;
}
- return mParsedDate;
+ return parsedDate;
}
/** @return whether the value case-insensitively equals to {@code s}. */
diff --git a/java/com/android/voicemail/impl/mail/store/imap/ImapTempFileLiteral.java b/java/com/android/voicemail/impl/mail/store/imap/ImapTempFileLiteral.java
index ab64d8537..417adcc02 100644
--- a/java/com/android/voicemail/impl/mail/store/imap/ImapTempFileLiteral.java
+++ b/java/com/android/voicemail/impl/mail/store/imap/ImapTempFileLiteral.java
@@ -33,20 +33,20 @@ import org.apache.commons.io.IOUtils;
public class ImapTempFileLiteral extends ImapString {
private final String TAG = "ImapTempFileLiteral";
- /* package for test */ final File mFile;
+ /* package for test */ final File file;
/** Size is purely for toString() */
- private final int mSize;
+ private final int size;
/* package */ ImapTempFileLiteral(FixedLengthInputStream stream) throws IOException {
- mSize = stream.getLength();
- mFile = File.createTempFile("imap", ".tmp", TempDirectory.getTempDirectory());
+ size = stream.getLength();
+ file = File.createTempFile("imap", ".tmp", TempDirectory.getTempDirectory());
// Unfortunately, we can't really use deleteOnExit(), because temp filenames are random
// so it'd simply cause a memory leak.
// deleteOnExit() simply adds filenames to a static list and the list will never shrink.
// mFile.deleteOnExit();
- OutputStream out = new FileOutputStream(mFile);
+ OutputStream out = new FileOutputStream(file);
IOUtils.copy(stream, out);
out.close();
}
@@ -69,7 +69,7 @@ public class ImapTempFileLiteral extends ImapString {
public InputStream getAsStream() {
checkNotDestroyed();
try {
- return new FileInputStream(mFile);
+ return new FileInputStream(file);
} catch (FileNotFoundException e) {
// It's probably possible if we're low on storage and the system clears the cache dir.
LogUtils.w(TAG, "ImapTempFileLiteral: Temp file not found");
@@ -98,8 +98,8 @@ public class ImapTempFileLiteral extends ImapString {
@Override
public void destroy() {
try {
- if (!isDestroyed() && mFile.exists()) {
- mFile.delete();
+ if (!isDestroyed() && file.exists()) {
+ file.delete();
}
} catch (RuntimeException re) {
// Just log and ignore.
@@ -110,10 +110,10 @@ public class ImapTempFileLiteral extends ImapString {
@Override
public String toString() {
- return String.format("{%d byte literal(file)}", mSize);
+ return String.format("{%d byte literal(file)}", size);
}
public boolean tempFileExistsForTest() {
- return mFile.exists();
+ return file.exists();
}
}
diff --git a/java/com/android/voicemail/impl/mail/utility/CountingOutputStream.java b/java/com/android/voicemail/impl/mail/utility/CountingOutputStream.java
index c3586105f..0136b0272 100644
--- a/java/com/android/voicemail/impl/mail/utility/CountingOutputStream.java
+++ b/java/com/android/voicemail/impl/mail/utility/CountingOutputStream.java
@@ -23,26 +23,26 @@ import java.io.OutputStream;
* count available to callers.
*/
public class CountingOutputStream extends OutputStream {
- private long mCount;
- private final OutputStream mOutputStream;
+ private long count;
+ private final OutputStream outputStream;
public CountingOutputStream(OutputStream outputStream) {
- mOutputStream = outputStream;
+ this.outputStream = outputStream;
}
public long getCount() {
- return mCount;
+ return count;
}
@Override
public void write(byte[] buffer, int offset, int count) throws IOException {
- mOutputStream.write(buffer, offset, count);
- mCount += count;
+ outputStream.write(buffer, offset, count);
+ this.count += count;
}
@Override
public void write(int oneByte) throws IOException {
- mOutputStream.write(oneByte);
- mCount++;
+ outputStream.write(oneByte);
+ count++;
}
}
diff --git a/java/com/android/voicemail/impl/mail/utils/LogUtils.java b/java/com/android/voicemail/impl/mail/utils/LogUtils.java
index f6c3c6ba3..772048d49 100644
--- a/java/com/android/voicemail/impl/mail/utils/LogUtils.java
+++ b/java/com/android/voicemail/impl/mail/utils/LogUtils.java
@@ -1,5 +1,5 @@
-/**
- * Copyright (c) 2015 The Android Open Source Project
+/*
+ * Copyright (C) 2015 The Android Open Source Project
*
* <p>Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of the License at
@@ -46,7 +46,7 @@ public class LogUtils {
*/
private static final int MAX_ENABLED_LOG_LEVEL = DEBUG;
- private static Boolean sDebugLoggingEnabledForTests = null;
+ private static Boolean debugLoggingEnabledForTests = null;
/** Enable debug logging for unit tests. */
@VisibleForTesting
@@ -55,7 +55,7 @@ public class LogUtils {
}
protected static void setDebugLoggingEnabledForTestsInternal(boolean enabled) {
- sDebugLoggingEnabledForTests = Boolean.valueOf(enabled);
+ debugLoggingEnabledForTests = Boolean.valueOf(enabled);
}
/** Returns true if the build configuration prevents debug logging. */
@@ -69,8 +69,8 @@ public class LogUtils {
if (buildPreventsDebugLogging()) {
return false;
}
- if (sDebugLoggingEnabledForTests != null) {
- return sDebugLoggingEnabledForTests.booleanValue();
+ if (debugLoggingEnabledForTests != null) {
+ return debugLoggingEnabledForTests.booleanValue();
}
return Log.isLoggable(tag, Log.DEBUG) || Log.isLoggable(TAG, Log.DEBUG);
}
diff --git a/java/com/android/voicemail/impl/protocol/Vvm3Subscriber.java b/java/com/android/voicemail/impl/protocol/Vvm3Subscriber.java
index d9a06494e..ce5094f1a 100644
--- a/java/com/android/voicemail/impl/protocol/Vvm3Subscriber.java
+++ b/java/com/android/voicemail/impl/protocol/Vvm3Subscriber.java
@@ -131,15 +131,15 @@ public class Vvm3Subscriber {
private static final int REQUEST_TIMEOUT_SECONDS = 30;
- private final ActivationTask mTask;
- private final PhoneAccountHandle mHandle;
- private final OmtpVvmCarrierConfigHelper mHelper;
- private final VoicemailStatus.Editor mStatus;
- private final Bundle mData;
+ private final ActivationTask task;
+ private final PhoneAccountHandle handle;
+ private final OmtpVvmCarrierConfigHelper helper;
+ private final VoicemailStatus.Editor status;
+ private final Bundle data;
- private final String mNumber;
+ private final String number;
- private RequestQueue mRequestQueue;
+ private RequestQueue requestQueue;
@VisibleForTesting
static class ProvisioningException extends Exception {
@@ -166,19 +166,19 @@ public class Vvm3Subscriber {
VoicemailStatus.Editor status,
Bundle data) {
Assert.isNotMainThread();
- mTask = task;
- mHandle = handle;
- mHelper = helper;
- mStatus = status;
- mData = data;
+ this.task = task;
+ this.handle = handle;
+ this.helper = helper;
+ this.status = status;
+ this.data = data;
// Assuming getLine1Number() will work with VVM3. For unprovisioned users the IMAP username
// is not included in the status SMS, thus no other way to get the current phone number.
- mNumber =
- mHelper
+ number =
+ this.helper
.getContext()
.getSystemService(TelephonyManager.class)
- .createForPhoneAccountHandle(mHandle)
+ .createForPhoneAccountHandle(this.handle)
.getLine1Number();
}
@@ -189,15 +189,15 @@ public class Vvm3Subscriber {
// processSubscription() is called after network is available.
VvmLog.i(TAG, "Subscribing");
- try (NetworkWrapper wrapper = VvmNetworkRequest.getNetwork(mHelper, mHandle, mStatus)) {
+ try (NetworkWrapper wrapper = VvmNetworkRequest.getNetwork(helper, handle, status)) {
Network network = wrapper.get();
VvmLog.d(TAG, "provisioning: network available");
- mRequestQueue =
- Volley.newRequestQueue(mHelper.getContext(), new NetworkSpecifiedHurlStack(network));
+ requestQueue =
+ Volley.newRequestQueue(helper.getContext(), new NetworkSpecifiedHurlStack(network));
processSubscription();
} catch (RequestFailedException e) {
- mHelper.handleEvent(mStatus, OmtpEvents.VVM3_VMG_CONNECTION_FAILED);
- mTask.fail();
+ helper.handleEvent(status, OmtpEvents.VVM3_VMG_CONNECTION_FAILED);
+ task.fail();
}
}
@@ -206,11 +206,11 @@ public class Vvm3Subscriber {
String gatewayUrl = getSelfProvisioningGateway();
String selfProvisionResponse = getSelfProvisionResponse(gatewayUrl);
String subscribeLink =
- findSubscribeLink(getSubscribeLinkPatterns(mHelper.getContext()), selfProvisionResponse);
+ findSubscribeLink(getSubscribeLinkPatterns(helper.getContext()), selfProvisionResponse);
clickSubscribeLink(subscribeLink);
} catch (ProvisioningException e) {
VvmLog.e(TAG, e.toString());
- mTask.fail();
+ task.fail();
}
}
@@ -236,7 +236,7 @@ public class Vvm3Subscriber {
@Override
protected Map<String, String> getParams() {
Map<String, String> params = new ArrayMap<>();
- params.put(SPG_VZW_MDN_PARAM, mNumber);
+ params.put(SPG_VZW_MDN_PARAM, number);
params.put(SPG_VZW_SERVICE_PARAM, SPG_VZW_SERVICE_BASIC);
params.put(SPG_DEVICE_MODEL_PARAM, SPG_DEVICE_MODEL_ANDROID);
params.put(SPG_APP_TOKEN_PARAM, SPG_APP_TOKEN);
@@ -247,11 +247,11 @@ public class Vvm3Subscriber {
}
};
- mRequestQueue.add(stringRequest);
+ requestQueue.add(stringRequest);
try {
return future.get(REQUEST_TIMEOUT_SECONDS, TimeUnit.SECONDS);
} catch (InterruptedException | ExecutionException | TimeoutException e) {
- mHelper.handleEvent(mStatus, OmtpEvents.VVM3_SPG_CONNECTION_FAILED);
+ helper.handleEvent(status, OmtpEvents.VVM3_SPG_CONNECTION_FAILED);
throw new ProvisioningException(e.toString());
}
}
@@ -262,12 +262,12 @@ public class Vvm3Subscriber {
StringRequest stringRequest =
new StringRequest(Request.Method.POST, subscribeLink, future, future);
- mRequestQueue.add(stringRequest);
+ requestQueue.add(stringRequest);
try {
// A new STATUS SMS will be sent after this request.
future.get(REQUEST_TIMEOUT_SECONDS, TimeUnit.SECONDS);
} catch (TimeoutException | ExecutionException | InterruptedException e) {
- mHelper.handleEvent(mStatus, OmtpEvents.VVM3_SPG_CONNECTION_FAILED);
+ helper.handleEvent(status, OmtpEvents.VVM3_SPG_CONNECTION_FAILED);
throw new ProvisioningException(e.toString());
}
// It could take very long for the STATUS SMS to return. Waiting for it is unreliable.
@@ -277,7 +277,7 @@ public class Vvm3Subscriber {
private String vvm3XmlRequest(String operation) throws ProvisioningException {
VvmLog.d(TAG, "Sending vvm3XmlRequest for " + operation);
- String voicemailManagementGateway = mData.getString(VMG_URL_KEY);
+ String voicemailManagementGateway = data.getString(VMG_URL_KEY);
if (voicemailManagementGateway == null) {
VvmLog.e(TAG, "voicemailManagementGateway url unknown");
return null;
@@ -285,7 +285,7 @@ public class Vvm3Subscriber {
String transactionId = createTransactionId();
String body =
String.format(
- Locale.US, VMG_XML_REQUEST_FORMAT, transactionId, mNumber, operation, Build.MODEL);
+ Locale.US, VMG_XML_REQUEST_FORMAT, transactionId, number, operation, Build.MODEL);
RequestFuture<String> future = RequestFuture.newFuture();
StringRequest stringRequest =
@@ -295,7 +295,7 @@ public class Vvm3Subscriber {
return body.getBytes();
}
};
- mRequestQueue.add(stringRequest);
+ requestQueue.add(stringRequest);
try {
String response = future.get(REQUEST_TIMEOUT_SECONDS, TimeUnit.SECONDS);
@@ -304,7 +304,7 @@ public class Vvm3Subscriber {
}
return response;
} catch (InterruptedException | ExecutionException | TimeoutException e) {
- mHelper.handleEvent(mStatus, OmtpEvents.VVM3_VMG_CONNECTION_FAILED);
+ helper.handleEvent(status, OmtpEvents.VVM3_VMG_CONNECTION_FAILED);
throw new ProvisioningException(e.toString());
}
}
@@ -364,15 +364,15 @@ public class Vvm3Subscriber {
private static class NetworkSpecifiedHurlStack extends HurlStack {
- private final Network mNetwork;
+ private final Network network;
public NetworkSpecifiedHurlStack(Network network) {
- mNetwork = network;
+ this.network = network;
}
@Override
protected HttpURLConnection createConnection(URL url) throws IOException {
- return (HttpURLConnection) mNetwork.openConnection(url);
+ return (HttpURLConnection) network.openConnection(url);
}
}
}
diff --git a/java/com/android/voicemail/impl/scheduling/BaseTask.java b/java/com/android/voicemail/impl/scheduling/BaseTask.java
index 773d026bf..0b707583c 100644
--- a/java/com/android/voicemail/impl/scheduling/BaseTask.java
+++ b/java/com/android/voicemail/impl/scheduling/BaseTask.java
@@ -44,25 +44,25 @@ public abstract class BaseTask implements Task {
private static final String EXTRA_EXECUTION_TIME = "extra_execution_time";
- private Bundle mExtras;
+ private Bundle extras;
- private Context mContext;
+ private Context context;
- private int mId;
- private PhoneAccountHandle mPhoneAccountHandle;
+ private int id;
+ private PhoneAccountHandle phoneAccountHandle;
- private boolean mHasStarted;
- private volatile boolean mHasFailed;
+ private boolean hasStarted;
+ private volatile boolean hasFailed;
- @NonNull private final List<Policy> mPolicies = new ArrayList<>();
+ @NonNull private final List<Policy> policies = new ArrayList<>();
- private long mExecutionTime;
+ private long executionTime;
- private static Clock sClock = new Clock();
+ private static Clock clock = new Clock();
protected BaseTask(int id) {
- mId = id;
- mExecutionTime = getTimeMillis();
+ this.id = id;
+ executionTime = getTimeMillis();
}
/**
@@ -72,27 +72,27 @@ public abstract class BaseTask implements Task {
@MainThread
public void setId(int id) {
Assert.isMainThread();
- mId = id;
+ this.id = id;
}
@MainThread
public boolean hasStarted() {
Assert.isMainThread();
- return mHasStarted;
+ return hasStarted;
}
@MainThread
public boolean hasFailed() {
Assert.isMainThread();
- return mHasFailed;
+ return hasFailed;
}
public Context getContext() {
- return mContext;
+ return context;
}
public PhoneAccountHandle getPhoneAccountHandle() {
- return mPhoneAccountHandle;
+ return phoneAccountHandle;
}
/**
* Should be call in the constructor or {@link Policy#onCreate(BaseTask, Bundle)} will be missed.
@@ -100,7 +100,7 @@ public abstract class BaseTask implements Task {
@MainThread
public BaseTask addPolicy(Policy policy) {
Assert.isMainThread();
- mPolicies.add(policy);
+ policies.add(policy);
return this;
}
@@ -112,18 +112,18 @@ public abstract class BaseTask implements Task {
@WorkerThread
public void fail() {
Assert.isNotMainThread();
- mHasFailed = true;
+ hasFailed = true;
}
/** @param timeMillis the time since epoch, in milliseconds. */
@MainThread
public void setExecutionTime(long timeMillis) {
Assert.isMainThread();
- mExecutionTime = timeMillis;
+ executionTime = timeMillis;
}
public long getTimeMillis() {
- return sClock.getTimeMillis();
+ return clock.getTimeMillis();
}
/**
@@ -131,7 +131,7 @@ public abstract class BaseTask implements Task {
* their intent upon this.
*/
public Intent createRestartIntent() {
- return createIntent(getContext(), this.getClass(), mPhoneAccountHandle);
+ return createIntent(getContext(), this.getClass(), phoneAccountHandle);
}
/**
@@ -147,22 +147,22 @@ public abstract class BaseTask implements Task {
@Override
public TaskId getId() {
- return new TaskId(mId, mPhoneAccountHandle);
+ return new TaskId(id, phoneAccountHandle);
}
@Override
public Bundle toBundle() {
- mExtras.putLong(EXTRA_EXECUTION_TIME, mExecutionTime);
- return mExtras;
+ extras.putLong(EXTRA_EXECUTION_TIME, executionTime);
+ return extras;
}
@Override
@CallSuper
public void onCreate(Context context, Bundle extras) {
- mContext = context;
- mExtras = extras;
- mPhoneAccountHandle = extras.getParcelable(EXTRA_PHONE_ACCOUNT_HANDLE);
- for (Policy policy : mPolicies) {
+ this.context = context;
+ this.extras = extras;
+ phoneAccountHandle = extras.getParcelable(EXTRA_PHONE_ACCOUNT_HANDLE);
+ for (Policy policy : policies) {
policy.onCreate(this, extras);
}
}
@@ -170,42 +170,42 @@ public abstract class BaseTask implements Task {
@Override
@CallSuper
public void onRestore(Bundle extras) {
- if (mExtras.containsKey(EXTRA_EXECUTION_TIME)) {
- mExecutionTime = extras.getLong(EXTRA_EXECUTION_TIME);
+ if (this.extras.containsKey(EXTRA_EXECUTION_TIME)) {
+ executionTime = extras.getLong(EXTRA_EXECUTION_TIME);
}
}
@Override
public long getReadyInMilliSeconds() {
- return mExecutionTime - getTimeMillis();
+ return executionTime - getTimeMillis();
}
@Override
@CallSuper
public void onBeforeExecute() {
- for (Policy policy : mPolicies) {
+ for (Policy policy : policies) {
policy.onBeforeExecute();
}
- mHasStarted = true;
+ hasStarted = true;
}
@Override
@CallSuper
public void onCompleted() {
- if (mHasFailed) {
- for (Policy policy : mPolicies) {
+ if (hasFailed) {
+ for (Policy policy : policies) {
policy.onFail();
}
}
- for (Policy policy : mPolicies) {
+ for (Policy policy : policies) {
policy.onCompleted();
}
}
@Override
public void onDuplicatedTaskAdded(Task task) {
- for (Policy policy : mPolicies) {
+ for (Policy policy : policies) {
policy.onDuplicatedTaskAdded();
}
}
@@ -221,6 +221,6 @@ public abstract class BaseTask implements Task {
/** Used to replace the clock with an deterministic clock */
@NeededForTesting
static void setClockForTesting(Clock clock) {
- sClock = clock;
+ BaseTask.clock = clock;
}
}
diff --git a/java/com/android/voicemail/impl/scheduling/MinimalIntervalPolicy.java b/java/com/android/voicemail/impl/scheduling/MinimalIntervalPolicy.java
index 342b56e8a..6d6a0a1af 100644
--- a/java/com/android/voicemail/impl/scheduling/MinimalIntervalPolicy.java
+++ b/java/com/android/voicemail/impl/scheduling/MinimalIntervalPolicy.java
@@ -27,18 +27,18 @@ import com.android.voicemail.impl.scheduling.Task.TaskId;
*/
public class MinimalIntervalPolicy implements Policy {
- BaseTask mTask;
- TaskId mId;
- int mBlockForMillis;
+ BaseTask task;
+ TaskId id;
+ int blockForMillis;
public MinimalIntervalPolicy(int blockForMillis) {
- mBlockForMillis = blockForMillis;
+ this.blockForMillis = blockForMillis;
}
@Override
public void onCreate(BaseTask task, Bundle extras) {
- mTask = task;
- mId = mTask.getId();
+ this.task = task;
+ id = this.task.getId();
}
@Override
@@ -46,12 +46,12 @@ public class MinimalIntervalPolicy implements Policy {
@Override
public void onCompleted() {
- if (!mTask.hasFailed()) {
+ if (!task.hasFailed()) {
Intent intent =
- BaseTask.createIntent(mTask.getContext(), BlockerTask.class, mId.phoneAccountHandle);
- intent.putExtra(BlockerTask.EXTRA_TASK_ID, mId.id);
- intent.putExtra(BlockerTask.EXTRA_BLOCK_FOR_MILLIS, mBlockForMillis);
- mTask.getContext().sendBroadcast(intent);
+ BaseTask.createIntent(task.getContext(), BlockerTask.class, id.phoneAccountHandle);
+ intent.putExtra(BlockerTask.EXTRA_TASK_ID, id.id);
+ intent.putExtra(BlockerTask.EXTRA_BLOCK_FOR_MILLIS, blockForMillis);
+ task.getContext().sendBroadcast(intent);
}
}
diff --git a/java/com/android/voicemail/impl/scheduling/PostponePolicy.java b/java/com/android/voicemail/impl/scheduling/PostponePolicy.java
index 46773b53a..8ff1478e3 100644
--- a/java/com/android/voicemail/impl/scheduling/PostponePolicy.java
+++ b/java/com/android/voicemail/impl/scheduling/PostponePolicy.java
@@ -29,17 +29,17 @@ public class PostponePolicy implements Policy {
private static final String TAG = "PostponePolicy";
- private final int mPostponeMillis;
- private BaseTask mTask;
+ private final int postponeMillis;
+ private BaseTask task;
public PostponePolicy(int postponeMillis) {
- mPostponeMillis = postponeMillis;
+ this.postponeMillis = postponeMillis;
}
@Override
public void onCreate(BaseTask task, Bundle extras) {
- mTask = task;
- mTask.setExecutionTime(mTask.getTimeMillis() + mPostponeMillis);
+ this.task = task;
+ this.task.setExecutionTime(this.task.getTimeMillis() + postponeMillis);
}
@Override
@@ -59,10 +59,10 @@ public class PostponePolicy implements Policy {
@Override
public void onDuplicatedTaskAdded() {
- if (mTask.hasStarted()) {
+ if (task.hasStarted()) {
return;
}
- VvmLog.i(TAG, "postponing " + mTask);
- mTask.setExecutionTime(mTask.getTimeMillis() + mPostponeMillis);
+ VvmLog.i(TAG, "postponing " + task);
+ task.setExecutionTime(task.getTimeMillis() + postponeMillis);
}
}
diff --git a/java/com/android/voicemail/impl/scheduling/RetryPolicy.java b/java/com/android/voicemail/impl/scheduling/RetryPolicy.java
index c408bdc4a..ec4d72de9 100644
--- a/java/com/android/voicemail/impl/scheduling/RetryPolicy.java
+++ b/java/com/android/voicemail/impl/scheduling/RetryPolicy.java
@@ -32,23 +32,23 @@ public class RetryPolicy implements Policy {
private static final String TAG = "RetryPolicy";
private static final String EXTRA_RETRY_COUNT = "extra_retry_count";
- private final int mRetryLimit;
- private final int mRetryDelayMillis;
+ private final int retryLimit;
+ private final int retryDelayMillis;
- private BaseTask mTask;
+ private BaseTask task;
- private int mRetryCount;
- private boolean mFailed;
+ private int retryCount;
+ private boolean failed;
- private VoicemailStatus.DeferredEditor mVoicemailStatusEditor;
+ private VoicemailStatus.DeferredEditor voicemailStatusEditor;
public RetryPolicy(int retryLimit, int retryDelayMillis) {
- mRetryLimit = retryLimit;
- mRetryDelayMillis = retryDelayMillis;
+ this.retryLimit = retryLimit;
+ this.retryDelayMillis = retryDelayMillis;
}
private boolean hasMoreRetries() {
- return mRetryCount < mRetryLimit;
+ return retryCount < retryLimit;
}
/**
@@ -57,18 +57,23 @@ public class RetryPolicy implements Policy {
* the task is successful or there are no retries left.
*/
public VoicemailStatus.Editor getVoicemailStatusEditor() {
- return mVoicemailStatusEditor;
+ return voicemailStatusEditor;
}
@Override
public void onCreate(BaseTask task, Bundle extras) {
- mTask = task;
- mRetryCount = extras.getInt(EXTRA_RETRY_COUNT, 0);
- if (mRetryCount > 0) {
+ this.task = task;
+ retryCount = extras.getInt(EXTRA_RETRY_COUNT, 0);
+ if (retryCount > 0) {
VvmLog.i(
TAG,
- "retry #" + mRetryCount + " for " + mTask + " queued, executing in " + mRetryDelayMillis);
- mTask.setExecutionTime(mTask.getTimeMillis() + mRetryDelayMillis);
+ "retry #"
+ + retryCount
+ + " for "
+ + this.task
+ + " queued, executing in "
+ + retryDelayMillis);
+ this.task.setExecutionTime(this.task.getTimeMillis() + retryDelayMillis);
}
PhoneAccountHandle phoneAccountHandle = task.getPhoneAccountHandle();
if (phoneAccountHandle == null) {
@@ -76,7 +81,7 @@ public class RetryPolicy implements Policy {
// This should never happen, but continue on if it does. The status write will be
// discarded.
}
- mVoicemailStatusEditor = VoicemailStatus.deferredEdit(task.getContext(), phoneAccountHandle);
+ voicemailStatusEditor = VoicemailStatus.deferredEdit(task.getContext(), phoneAccountHandle);
}
@Override
@@ -84,27 +89,27 @@ public class RetryPolicy implements Policy {
@Override
public void onCompleted() {
- if (!mFailed || !hasMoreRetries()) {
- if (!mFailed) {
- VvmLog.i(TAG, mTask + " completed successfully");
+ if (!failed || !hasMoreRetries()) {
+ if (!failed) {
+ VvmLog.i(TAG, task + " completed successfully");
}
if (!hasMoreRetries()) {
- VvmLog.i(TAG, "Retry limit for " + mTask + " reached");
+ VvmLog.i(TAG, "Retry limit for " + task + " reached");
}
- VvmLog.i(TAG, "committing deferred status: " + mVoicemailStatusEditor.getValues());
- mVoicemailStatusEditor.deferredApply();
+ VvmLog.i(TAG, "committing deferred status: " + voicemailStatusEditor.getValues());
+ voicemailStatusEditor.deferredApply();
return;
}
- VvmLog.i(TAG, "discarding deferred status: " + mVoicemailStatusEditor.getValues());
- Intent intent = mTask.createRestartIntent();
- intent.putExtra(EXTRA_RETRY_COUNT, mRetryCount + 1);
+ VvmLog.i(TAG, "discarding deferred status: " + voicemailStatusEditor.getValues());
+ Intent intent = task.createRestartIntent();
+ intent.putExtra(EXTRA_RETRY_COUNT, retryCount + 1);
- mTask.getContext().sendBroadcast(intent);
+ task.getContext().sendBroadcast(intent);
}
@Override
public void onFail() {
- mFailed = true;
+ failed = true;
}
@Override
diff --git a/java/com/android/voicemail/impl/sms/OmtpMessageReceiver.java b/java/com/android/voicemail/impl/sms/OmtpMessageReceiver.java
index 43835276b..eae990ab0 100644
--- a/java/com/android/voicemail/impl/sms/OmtpMessageReceiver.java
+++ b/java/com/android/voicemail/impl/sms/OmtpMessageReceiver.java
@@ -46,11 +46,11 @@ public class OmtpMessageReceiver extends BroadcastReceiver {
private static final String TAG = "OmtpMessageReceiver";
- private Context mContext;
+ private Context context;
@Override
public void onReceive(Context context, Intent intent) {
- mContext = context;
+ this.context = context;
VisualVoicemailSms sms = intent.getExtras().getParcelable(OmtpService.EXTRA_VOICEMAIL_SMS);
PhoneAccountHandle phone = sms.getPhoneAccountHandle();
@@ -69,12 +69,12 @@ public class OmtpMessageReceiver extends BroadcastReceiver {
return;
}
- OmtpVvmCarrierConfigHelper helper = new OmtpVvmCarrierConfigHelper(mContext, phone);
+ OmtpVvmCarrierConfigHelper helper = new OmtpVvmCarrierConfigHelper(this.context, phone);
if (!helper.isValid()) {
VvmLog.e(TAG, "vvm config no longer valid");
return;
}
- if (!VisualVoicemailSettingsUtil.isEnabled(mContext, phone)) {
+ if (!VisualVoicemailSettingsUtil.isEnabled(this.context, phone)) {
if (helper.isLegacyModeEnabled()) {
LegacyModeSmsHandler.handle(context, sms);
} else {
@@ -140,18 +140,18 @@ public class OmtpMessageReceiver extends BroadcastReceiver {
.setPhoneAccount(phone)
.setSourceData(message.getId())
.setDuration(message.getLength())
- .setSourcePackage(mContext.getPackageName());
+ .setSourcePackage(context.getPackageName());
Voicemail voicemail = builder.build();
- VoicemailsQueryHelper queryHelper = new VoicemailsQueryHelper(mContext);
+ VoicemailsQueryHelper queryHelper = new VoicemailsQueryHelper(context);
if (queryHelper.isVoicemailUnique(voicemail)) {
- Uri uri = VoicemailDatabaseUtil.insert(mContext, voicemail);
+ Uri uri = VoicemailDatabaseUtil.insert(context, voicemail);
voicemail = builder.setId(ContentUris.parseId(uri)).setUri(uri).build();
- SyncOneTask.start(mContext, phone, voicemail);
+ SyncOneTask.start(context, phone, voicemail);
}
break;
case OmtpConstants.MAILBOX_UPDATE:
- SyncTask.start(mContext, phone);
+ SyncTask.start(context, phone);
break;
case OmtpConstants.GREETINGS_UPDATE:
// Not implemented in V1
diff --git a/java/com/android/voicemail/impl/sms/OmtpMessageSender.java b/java/com/android/voicemail/impl/sms/OmtpMessageSender.java
index 19661e99d..76a258366 100644
--- a/java/com/android/voicemail/impl/sms/OmtpMessageSender.java
+++ b/java/com/android/voicemail/impl/sms/OmtpMessageSender.java
@@ -35,20 +35,20 @@ import com.android.voicemail.impl.VvmLog;
*/
public abstract class OmtpMessageSender {
protected static final String TAG = "OmtpMessageSender";
- protected final Context mContext;
- protected final PhoneAccountHandle mPhoneAccountHandle;
- protected final short mApplicationPort;
- protected final String mDestinationNumber;
+ protected final Context context;
+ protected final PhoneAccountHandle phoneAccountHandle;
+ protected final short applicationPort;
+ protected final String destinationNumber;
public OmtpMessageSender(
Context context,
PhoneAccountHandle phoneAccountHandle,
short applicationPort,
String destinationNumber) {
- mContext = context;
- mPhoneAccountHandle = phoneAccountHandle;
- mApplicationPort = applicationPort;
- mDestinationNumber = destinationNumber;
+ this.context = context;
+ this.phoneAccountHandle = phoneAccountHandle;
+ this.applicationPort = applicationPort;
+ this.destinationNumber = destinationNumber;
}
/**
@@ -78,11 +78,10 @@ public abstract class OmtpMessageSender {
protected void sendSms(String text, PendingIntent sentIntent) {
VvmLog.v(
- TAG,
- String.format("Sending sms '%s' to %s:%d", text, mDestinationNumber, mApplicationPort));
+ TAG, String.format("Sending sms '%s' to %s:%d", text, destinationNumber, applicationPort));
TelephonyMangerCompat.sendVisualVoicemailSms(
- mContext, mPhoneAccountHandle, mDestinationNumber, mApplicationPort, text, sentIntent);
+ context, phoneAccountHandle, destinationNumber, applicationPort, text, sentIntent);
}
protected void appendField(StringBuilder sb, String field, Object value) {
diff --git a/java/com/android/voicemail/impl/sms/OmtpStandardMessageSender.java b/java/com/android/voicemail/impl/sms/OmtpStandardMessageSender.java
index 7974699a0..a8d27ff99 100644
--- a/java/com/android/voicemail/impl/sms/OmtpStandardMessageSender.java
+++ b/java/com/android/voicemail/impl/sms/OmtpStandardMessageSender.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2015 Google Inc. All Rights Reserved.
+ * Copyright (C) 2015 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -24,9 +24,9 @@ import com.android.voicemail.impl.OmtpConstants;
/** A implementation of the OmtpMessageSender using the standard OMTP sms protocol. */
public class OmtpStandardMessageSender extends OmtpMessageSender {
- private final String mClientType;
- private final String mProtocolVersion;
- private final String mClientPrefix;
+ private final String clientType;
+ private final String protocolVersion;
+ private final String clientPrefix;
/**
* Creates a new instance of OmtpStandardMessageSender.
@@ -49,9 +49,9 @@ public class OmtpStandardMessageSender extends OmtpMessageSender {
String protocolVersion,
String clientPrefix) {
super(context, phoneAccountHandle, applicationPort, destinationNumber);
- mClientType = clientType;
- mProtocolVersion = protocolVersion;
- mClientPrefix = clientPrefix;
+ this.clientType = clientType;
+ this.protocolVersion = protocolVersion;
+ this.clientPrefix = clientPrefix;
}
// Activate message:
@@ -63,8 +63,8 @@ public class OmtpStandardMessageSender extends OmtpMessageSender {
StringBuilder sb = new StringBuilder().append(OmtpConstants.ACTIVATE_REQUEST);
appendProtocolVersionAndClientType(sb);
- if (TextUtils.equals(mProtocolVersion, OmtpConstants.PROTOCOL_VERSION1_2)
- || TextUtils.equals(mProtocolVersion, OmtpConstants.PROTOCOL_VERSION1_3)) {
+ if (TextUtils.equals(protocolVersion, OmtpConstants.PROTOCOL_VERSION1_2)
+ || TextUtils.equals(protocolVersion, OmtpConstants.PROTOCOL_VERSION1_3)) {
appendApplicationPort(sb);
appendClientPrefix(sb);
}
@@ -92,7 +92,7 @@ public class OmtpStandardMessageSender extends OmtpMessageSender {
public void requestVvmStatus(@Nullable PendingIntent sentIntent) {
StringBuilder sb = new StringBuilder().append(OmtpConstants.STATUS_REQUEST);
- if (TextUtils.equals(mProtocolVersion, OmtpConstants.PROTOCOL_VERSION1_3)) {
+ if (TextUtils.equals(protocolVersion, OmtpConstants.PROTOCOL_VERSION1_3)) {
appendProtocolVersionAndClientType(sb);
appendApplicationPort(sb);
appendClientPrefix(sb);
@@ -103,18 +103,18 @@ public class OmtpStandardMessageSender extends OmtpMessageSender {
private void appendProtocolVersionAndClientType(StringBuilder sb) {
sb.append(OmtpConstants.SMS_PREFIX_SEPARATOR);
- appendField(sb, OmtpConstants.PROTOCOL_VERSION, mProtocolVersion);
+ appendField(sb, OmtpConstants.PROTOCOL_VERSION, protocolVersion);
sb.append(OmtpConstants.SMS_FIELD_SEPARATOR);
- appendField(sb, OmtpConstants.CLIENT_TYPE, mClientType);
+ appendField(sb, OmtpConstants.CLIENT_TYPE, clientType);
}
private void appendApplicationPort(StringBuilder sb) {
sb.append(OmtpConstants.SMS_FIELD_SEPARATOR);
- appendField(sb, OmtpConstants.APPLICATION_PORT, mApplicationPort);
+ appendField(sb, OmtpConstants.APPLICATION_PORT, applicationPort);
}
private void appendClientPrefix(StringBuilder sb) {
sb.append(OmtpConstants.SMS_FIELD_SEPARATOR);
- sb.append(mClientPrefix);
+ sb.append(clientPrefix);
}
}
diff --git a/java/com/android/voicemail/impl/sms/StatusMessage.java b/java/com/android/voicemail/impl/sms/StatusMessage.java
index a5766a61a..7fd2966a4 100644
--- a/java/com/android/voicemail/impl/sms/StatusMessage.java
+++ b/java/com/android/voicemail/impl/sms/StatusMessage.java
@@ -32,66 +32,66 @@ public class StatusMessage {
// to be useful for initial omtp source implementation.
// lang, g_len, vs_len, pw_len, pm, gm, vtc, vt
- private final String mProvisioningStatus;
- private final String mStatusReturnCode;
- private final String mSubscriptionUrl;
- private final String mServerAddress;
- private final String mTuiAccessNumber;
- private final String mClientSmsDestinationNumber;
- private final String mImapPort;
- private final String mImapUserName;
- private final String mImapPassword;
- private final String mSmtpPort;
- private final String mSmtpUserName;
- private final String mSmtpPassword;
- private final String mTuiPasswordLength;
+ private final String provisioningStatus;
+ private final String statusReturnCode;
+ private final String subscriptionUrl;
+ private final String serverAddress;
+ private final String tuiAccessNumber;
+ private final String clientSmsDestinationNumber;
+ private final String imapPort;
+ private final String imapUserName;
+ private final String imapPassword;
+ private final String smtpPort;
+ private final String smtpUserName;
+ private final String smtpPassword;
+ private final String tuiPasswordLength;
@Override
public String toString() {
return "StatusMessage [mProvisioningStatus="
- + mProvisioningStatus
+ + provisioningStatus
+ ", mStatusReturnCode="
- + mStatusReturnCode
+ + statusReturnCode
+ ", mSubscriptionUrl="
- + mSubscriptionUrl
+ + subscriptionUrl
+ ", mServerAddress="
- + mServerAddress
+ + serverAddress
+ ", mTuiAccessNumber="
- + mTuiAccessNumber
+ + tuiAccessNumber
+ ", mClientSmsDestinationNumber="
- + mClientSmsDestinationNumber
+ + clientSmsDestinationNumber
+ ", mImapPort="
- + mImapPort
+ + imapPort
+ ", mImapUserName="
- + mImapUserName
+ + imapUserName
+ ", mImapPassword="
- + VvmLog.pii(mImapPassword)
+ + VvmLog.pii(imapPassword)
+ ", mSmtpPort="
- + mSmtpPort
+ + smtpPort
+ ", mSmtpUserName="
- + mSmtpUserName
+ + smtpUserName
+ ", mSmtpPassword="
- + VvmLog.pii(mSmtpPassword)
+ + VvmLog.pii(smtpPassword)
+ ", mTuiPasswordLength="
- + mTuiPasswordLength
+ + tuiPasswordLength
+ "]";
}
public StatusMessage(Bundle wrappedData) {
- mProvisioningStatus = unquote(getString(wrappedData, OmtpConstants.PROVISIONING_STATUS));
- mStatusReturnCode = getString(wrappedData, OmtpConstants.RETURN_CODE);
- mSubscriptionUrl = getString(wrappedData, OmtpConstants.SUBSCRIPTION_URL);
- mServerAddress = getString(wrappedData, OmtpConstants.SERVER_ADDRESS);
- mTuiAccessNumber = getString(wrappedData, OmtpConstants.TUI_ACCESS_NUMBER);
- mClientSmsDestinationNumber =
+ provisioningStatus = unquote(getString(wrappedData, OmtpConstants.PROVISIONING_STATUS));
+ statusReturnCode = getString(wrappedData, OmtpConstants.RETURN_CODE);
+ subscriptionUrl = getString(wrappedData, OmtpConstants.SUBSCRIPTION_URL);
+ serverAddress = getString(wrappedData, OmtpConstants.SERVER_ADDRESS);
+ tuiAccessNumber = getString(wrappedData, OmtpConstants.TUI_ACCESS_NUMBER);
+ clientSmsDestinationNumber =
getString(wrappedData, OmtpConstants.CLIENT_SMS_DESTINATION_NUMBER);
- mImapPort = getString(wrappedData, OmtpConstants.IMAP_PORT);
- mImapUserName = getString(wrappedData, OmtpConstants.IMAP_USER_NAME);
- mImapPassword = getString(wrappedData, OmtpConstants.IMAP_PASSWORD);
- mSmtpPort = getString(wrappedData, OmtpConstants.SMTP_PORT);
- mSmtpUserName = getString(wrappedData, OmtpConstants.SMTP_USER_NAME);
- mSmtpPassword = getString(wrappedData, OmtpConstants.SMTP_PASSWORD);
- mTuiPasswordLength = getString(wrappedData, OmtpConstants.TUI_PASSWORD_LENGTH);
+ imapPort = getString(wrappedData, OmtpConstants.IMAP_PORT);
+ imapUserName = getString(wrappedData, OmtpConstants.IMAP_USER_NAME);
+ imapPassword = getString(wrappedData, OmtpConstants.IMAP_PASSWORD);
+ smtpPort = getString(wrappedData, OmtpConstants.SMTP_PORT);
+ smtpUserName = getString(wrappedData, OmtpConstants.SMTP_USER_NAME);
+ smtpPassword = getString(wrappedData, OmtpConstants.SMTP_PASSWORD);
+ tuiPasswordLength = getString(wrappedData, OmtpConstants.TUI_PASSWORD_LENGTH);
}
private static String unquote(String string) {
@@ -106,12 +106,12 @@ public class StatusMessage {
/** @return the subscriber's VVM provisioning status. */
public String getProvisioningStatus() {
- return mProvisioningStatus;
+ return provisioningStatus;
}
/** @return the return-code of the status SMS. */
public String getReturnCode() {
- return mStatusReturnCode;
+ return statusReturnCode;
}
/**
@@ -120,14 +120,14 @@ public class StatusMessage {
*/
@NeededForTesting
public String getSubscriptionUrl() {
- return mSubscriptionUrl;
+ return subscriptionUrl;
}
/**
* @return the voicemail server address. Either server IP address or fully qualified domain name.
*/
public String getServerAddress() {
- return mServerAddress;
+ return serverAddress;
}
/**
@@ -135,50 +135,50 @@ public class StatusMessage {
*/
@NeededForTesting
public String getTuiAccessNumber() {
- return mTuiAccessNumber;
+ return tuiAccessNumber;
}
/** @return the number to which client originated SMSes should be sent to. */
@NeededForTesting
public String getClientSmsDestinationNumber() {
- return mClientSmsDestinationNumber;
+ return clientSmsDestinationNumber;
}
/** @return the IMAP server port to talk to. */
public String getImapPort() {
- return mImapPort;
+ return imapPort;
}
/** @return the IMAP user name to be used for authentication. */
public String getImapUserName() {
- return mImapUserName;
+ return imapUserName;
}
/** @return the IMAP password to be used for authentication. */
public String getImapPassword() {
- return mImapPassword;
+ return imapPassword;
}
/** @return the SMTP server port to talk to. */
@NeededForTesting
public String getSmtpPort() {
- return mSmtpPort;
+ return smtpPort;
}
/** @return the SMTP user name to be used for SMTP authentication. */
@NeededForTesting
public String getSmtpUserName() {
- return mSmtpUserName;
+ return smtpUserName;
}
/** @return the SMTP password to be used for SMTP authentication. */
@NeededForTesting
public String getSmtpPassword() {
- return mSmtpPassword;
+ return smtpPassword;
}
public String getTuiPasswordLength() {
- return mTuiPasswordLength;
+ return tuiPasswordLength;
}
private static String getString(Bundle bundle, String key) {
diff --git a/java/com/android/voicemail/impl/sms/StatusSmsFetcher.java b/java/com/android/voicemail/impl/sms/StatusSmsFetcher.java
index d178628c6..73e0c7f3c 100644
--- a/java/com/android/voicemail/impl/sms/StatusSmsFetcher.java
+++ b/java/com/android/voicemail/impl/sms/StatusSmsFetcher.java
@@ -58,14 +58,14 @@ public class StatusSmsFetcher extends BroadcastReceiver implements Closeable {
"com.android.voicemailomtp.sms.REQUEST_SENT";
private static final int ACTION_REQUEST_SENT_REQUEST_CODE = 0;
- private CompletableFuture<Bundle> mFuture = new CompletableFuture<>();
+ private CompletableFuture<Bundle> future = new CompletableFuture<>();
- private final Context mContext;
- private final PhoneAccountHandle mPhoneAccountHandle;
+ private final Context context;
+ private final PhoneAccountHandle phoneAccountHandle;
public StatusSmsFetcher(Context context, PhoneAccountHandle phoneAccountHandle) {
- mContext = context;
- mPhoneAccountHandle = phoneAccountHandle;
+ this.context = context;
+ this.phoneAccountHandle = phoneAccountHandle;
IntentFilter filter = new IntentFilter(ACTION_REQUEST_SENT_INTENT);
filter.addAction(OmtpService.ACTION_SMS_RECEIVED);
context.registerReceiver(this, filter);
@@ -73,7 +73,7 @@ public class StatusSmsFetcher extends BroadcastReceiver implements Closeable {
@Override
public void close() throws IOException {
- mContext.unregisterReceiver(this);
+ context.unregisterReceiver(this);
}
@WorkerThread
@@ -81,16 +81,16 @@ public class StatusSmsFetcher extends BroadcastReceiver implements Closeable {
public Bundle get()
throws InterruptedException, ExecutionException, TimeoutException, CancellationException {
Assert.isNotMainThread();
- return mFuture.get(STATUS_SMS_TIMEOUT_MILLIS, TimeUnit.MILLISECONDS);
+ return future.get(STATUS_SMS_TIMEOUT_MILLIS, TimeUnit.MILLISECONDS);
}
public PendingIntent getSentIntent() {
Intent intent = new Intent(ACTION_REQUEST_SENT_INTENT);
- intent.setPackage(mContext.getPackageName());
+ intent.setPackage(context.getPackageName());
// Because the receiver is registered dynamically, implicit intent must be used.
// There should only be a single status SMS request at a time.
return PendingIntent.getBroadcast(
- mContext, ACTION_REQUEST_SENT_REQUEST_CODE, intent, PendingIntent.FLAG_CANCEL_CURRENT);
+ context, ACTION_REQUEST_SENT_REQUEST_CODE, intent, PendingIntent.FLAG_CANCEL_CURRENT);
}
@Override
@@ -106,19 +106,19 @@ public class StatusSmsFetcher extends BroadcastReceiver implements Closeable {
}
VvmLog.e(TAG, "Request SMS send failed: " + sentSmsResultToString(resultCode));
- mFuture.cancel(true);
+ future.cancel(true);
return;
}
VisualVoicemailSms sms = intent.getExtras().getParcelable(OmtpService.EXTRA_VOICEMAIL_SMS);
- if (!mPhoneAccountHandle.equals(sms.getPhoneAccountHandle())) {
+ if (!phoneAccountHandle.equals(sms.getPhoneAccountHandle())) {
return;
}
String eventType = sms.getPrefix();
if (eventType.equals(OmtpConstants.STATUS_SMS_PREFIX)) {
- mFuture.complete(sms.getFields());
+ future.complete(sms.getFields());
return;
}
@@ -129,8 +129,7 @@ public class StatusSmsFetcher extends BroadcastReceiver implements Closeable {
VvmLog.i(
TAG,
"VVM SMS with event " + eventType + " received, attempting to translate to STATUS SMS");
- OmtpVvmCarrierConfigHelper helper =
- new OmtpVvmCarrierConfigHelper(context, mPhoneAccountHandle);
+ OmtpVvmCarrierConfigHelper helper = new OmtpVvmCarrierConfigHelper(context, phoneAccountHandle);
VisualVoicemailProtocol protocol = helper.getProtocol();
if (protocol == null) {
return;
@@ -139,7 +138,7 @@ public class StatusSmsFetcher extends BroadcastReceiver implements Closeable {
if (translatedBundle != null) {
VvmLog.i(TAG, "Translated to STATUS SMS");
- mFuture.complete(translatedBundle);
+ future.complete(translatedBundle);
}
}
diff --git a/java/com/android/voicemail/impl/sms/SyncMessage.java b/java/com/android/voicemail/impl/sms/SyncMessage.java
index 3cfa1a7b3..de5b3ce35 100644
--- a/java/com/android/voicemail/impl/sms/SyncMessage.java
+++ b/java/com/android/voicemail/impl/sms/SyncMessage.java
@@ -31,47 +31,47 @@ import java.util.Locale;
*/
public class SyncMessage {
// Sync event that triggered this message.
- private final String mSyncTriggerEvent;
+ private final String syncTriggerEvent;
// Total number of new messages on the server.
- private final int mNewMessageCount;
+ private final int newMessageCount;
// UID of the new message.
- private final String mMessageId;
+ private final String messageId;
// Length of the message.
- private final int mMessageLength;
+ private final int messageLength;
// Content type (voice, video, fax...) of the new message.
- private final String mContentType;
+ private final String contentType;
// Sender of the new message.
- private final String mSender;
+ private final String sender;
// Timestamp (in millis) of the new message.
- private final long mMsgTimeMillis;
+ private final long msgTimeMillis;
@Override
public String toString() {
return "SyncMessage [mSyncTriggerEvent="
- + mSyncTriggerEvent
+ + syncTriggerEvent
+ ", mNewMessageCount="
- + mNewMessageCount
+ + newMessageCount
+ ", mMessageId="
- + mMessageId
+ + messageId
+ ", mMessageLength="
- + mMessageLength
+ + messageLength
+ ", mContentType="
- + mContentType
+ + contentType
+ ", mSender="
- + mSender
+ + sender
+ ", mMsgTimeMillis="
- + mMsgTimeMillis
+ + msgTimeMillis
+ "]";
}
public SyncMessage(Bundle wrappedData) {
- mSyncTriggerEvent = getString(wrappedData, OmtpConstants.SYNC_TRIGGER_EVENT);
- mMessageId = getString(wrappedData, OmtpConstants.MESSAGE_UID);
- mMessageLength = getInt(wrappedData, OmtpConstants.MESSAGE_LENGTH);
- mContentType = getString(wrappedData, OmtpConstants.CONTENT_TYPE);
- mSender = getString(wrappedData, OmtpConstants.SENDER);
- mNewMessageCount = getInt(wrappedData, OmtpConstants.NUM_MESSAGE_COUNT);
- mMsgTimeMillis = parseTime(wrappedData.getString(OmtpConstants.TIME));
+ syncTriggerEvent = getString(wrappedData, OmtpConstants.SYNC_TRIGGER_EVENT);
+ messageId = getString(wrappedData, OmtpConstants.MESSAGE_UID);
+ messageLength = getInt(wrappedData, OmtpConstants.MESSAGE_LENGTH);
+ contentType = getString(wrappedData, OmtpConstants.CONTENT_TYPE);
+ sender = getString(wrappedData, OmtpConstants.SENDER);
+ newMessageCount = getInt(wrappedData, OmtpConstants.NUM_MESSAGE_COUNT);
+ msgTimeMillis = parseTime(wrappedData.getString(OmtpConstants.TIME));
}
private static long parseTime(@Nullable String value) {
@@ -89,13 +89,13 @@ public class SyncMessage {
* set.
*/
public String getSyncTriggerEvent() {
- return mSyncTriggerEvent;
+ return syncTriggerEvent;
}
/** @return the number of new messages stored on the voicemail server. */
@NeededForTesting
public int getNewMessageCount() {
- return mNewMessageCount;
+ return newMessageCount;
}
/**
@@ -103,7 +103,7 @@ public class SyncMessage {
* <p>Expected to be set only for {@link OmtpConstants#NEW_MESSAGE}
*/
public String getId() {
- return mMessageId;
+ return messageId;
}
/**
@@ -112,7 +112,7 @@ public class SyncMessage {
*/
@NeededForTesting
public String getContentType() {
- return mContentType;
+ return contentType;
}
/**
@@ -120,7 +120,7 @@ public class SyncMessage {
* <p>Expected to be set only for {@link OmtpConstants#NEW_MESSAGE}
*/
public int getLength() {
- return mMessageLength;
+ return messageLength;
}
/**
@@ -128,7 +128,7 @@ public class SyncMessage {
* <p>Expected to be set only for {@link OmtpConstants#NEW_MESSAGE}
*/
public String getSender() {
- return mSender;
+ return sender;
}
/**
@@ -136,7 +136,7 @@ public class SyncMessage {
* <p>Expected to be set only for {@link OmtpConstants#NEW_MESSAGE}
*/
public long getTimestampMillis() {
- return mMsgTimeMillis;
+ return msgTimeMillis;
}
private static int getInt(Bundle wrappedData, String key) {
diff --git a/java/com/android/voicemail/impl/sync/OmtpVvmSyncService.java b/java/com/android/voicemail/impl/sync/OmtpVvmSyncService.java
index f7c8f29c7..cf2763be7 100644
--- a/java/com/android/voicemail/impl/sync/OmtpVvmSyncService.java
+++ b/java/com/android/voicemail/impl/sync/OmtpVvmSyncService.java
@@ -56,12 +56,12 @@ public class OmtpVvmSyncService {
/** Threshold for whether we should archive and delete voicemails from the remote VM server. */
private static final float AUTO_DELETE_ARCHIVE_VM_THRESHOLD = 0.75f;
- private final Context mContext;
- private final VoicemailsQueryHelper mQueryHelper;
+ private final Context context;
+ private final VoicemailsQueryHelper queryHelper;
public OmtpVvmSyncService(Context context) {
- mContext = context;
- mQueryHelper = new VoicemailsQueryHelper(mContext);
+ this.context = context;
+ queryHelper = new VoicemailsQueryHelper(this.context);
}
public void sync(
@@ -79,22 +79,22 @@ public class OmtpVvmSyncService {
PhoneAccountHandle phoneAccount,
Voicemail voicemail,
VoicemailStatus.Editor status) {
- if (!VisualVoicemailSettingsUtil.isEnabled(mContext, phoneAccount)) {
+ if (!VisualVoicemailSettingsUtil.isEnabled(context, phoneAccount)) {
VvmLog.e(TAG, "Sync requested for disabled account");
return;
}
- if (!VvmAccountManager.isAccountActivated(mContext, phoneAccount)) {
- ActivationTask.start(mContext, phoneAccount, null);
+ if (!VvmAccountManager.isAccountActivated(context, phoneAccount)) {
+ ActivationTask.start(context, phoneAccount, null);
return;
}
- OmtpVvmCarrierConfigHelper config = new OmtpVvmCarrierConfigHelper(mContext, phoneAccount);
- LoggerUtils.logImpressionOnMainThread(mContext, DialerImpression.Type.VVM_SYNC_STARTED);
+ OmtpVvmCarrierConfigHelper config = new OmtpVvmCarrierConfigHelper(context, phoneAccount);
+ LoggerUtils.logImpressionOnMainThread(context, DialerImpression.Type.VVM_SYNC_STARTED);
// DATA_IMAP_OPERATION_STARTED posting should not be deferred. This event clears all data
// channel errors, which should happen when the task starts, not when it ends. It is the
// "Sync in progress..." status, which is currently displayed to the user as no error.
config.handleEvent(
- VoicemailStatus.edit(mContext, phoneAccount), OmtpEvents.DATA_IMAP_OPERATION_STARTED);
+ VoicemailStatus.edit(context, phoneAccount), OmtpEvents.DATA_IMAP_OPERATION_STARTED);
try (NetworkWrapper network = VvmNetworkRequest.getNetwork(config, phoneAccount, status)) {
if (network == null) {
VvmLog.e(TAG, "unable to acquire network");
@@ -114,7 +114,7 @@ public class OmtpVvmSyncService {
PhoneAccountHandle phoneAccount,
Voicemail voicemail,
VoicemailStatus.Editor status) {
- try (ImapHelper imapHelper = new ImapHelper(mContext, phoneAccount, network, status)) {
+ try (ImapHelper imapHelper = new ImapHelper(context, phoneAccount, network, status)) {
boolean success;
if (voicemail == null) {
success = syncAll(imapHelper, phoneAccount);
@@ -126,7 +126,7 @@ public class OmtpVvmSyncService {
imapHelper.updateQuota();
autoDeleteAndArchiveVM(imapHelper, phoneAccount);
imapHelper.handleEvent(OmtpEvents.DATA_IMAP_OPERATION_COMPLETED);
- LoggerUtils.logImpressionOnMainThread(mContext, DialerImpression.Type.VVM_SYNC_COMPLETED);
+ LoggerUtils.logImpressionOnMainThread(context, DialerImpression.Type.VVM_SYNC_COMPLETED);
} else {
task.fail();
}
@@ -142,16 +142,16 @@ public class OmtpVvmSyncService {
*/
private void autoDeleteAndArchiveVM(
ImapHelper imapHelper, PhoneAccountHandle phoneAccountHandle) {
- if (!isArchiveAllowedAndEnabled(mContext, phoneAccountHandle)) {
+ if (!isArchiveAllowedAndEnabled(context, phoneAccountHandle)) {
VvmLog.i(TAG, "autoDeleteAndArchiveVM is turned off");
LoggerUtils.logImpressionOnMainThread(
- mContext, DialerImpression.Type.VVM_ARCHIVE_AUTO_DELETE_TURNED_OFF);
+ context, DialerImpression.Type.VVM_ARCHIVE_AUTO_DELETE_TURNED_OFF);
return;
}
Quota quotaOnServer = imapHelper.getQuota();
if (quotaOnServer == null) {
LoggerUtils.logImpressionOnMainThread(
- mContext, DialerImpression.Type.VVM_ARCHIVE_AUTO_DELETE_FAILED_DUE_TO_FAILED_QUOTA_CHECK);
+ context, DialerImpression.Type.VVM_ARCHIVE_AUTO_DELETE_FAILED_DUE_TO_FAILED_QUOTA_CHECK);
VvmLog.e(TAG, "autoDeleteAndArchiveVM failed - Can't retrieve Imap quota.");
return;
}
@@ -161,7 +161,7 @@ public class OmtpVvmSyncService {
deleteAndArchiveVM(imapHelper, quotaOnServer);
imapHelper.updateQuota();
LoggerUtils.logImpressionOnMainThread(
- mContext, DialerImpression.Type.VVM_ARCHIVE_AUTO_DELETED_VM_FROM_SERVER);
+ context, DialerImpression.Type.VVM_ARCHIVE_AUTO_DELETED_VM_FROM_SERVER);
} else {
VvmLog.i(TAG, "no need to archive and auto delete VM, quota below threshold");
}
@@ -194,10 +194,10 @@ public class OmtpVvmSyncService {
// The number of voicemails that exceed our threshold and should be deleted from the server
int numVoicemails =
quotaOnServer.occupied - (int) (AUTO_DELETE_ARCHIVE_VM_THRESHOLD * quotaOnServer.total);
- List<Voicemail> oldestVoicemails = mQueryHelper.oldestVoicemailsOnServer(numVoicemails);
+ List<Voicemail> oldestVoicemails = queryHelper.oldestVoicemailsOnServer(numVoicemails);
VvmLog.w(TAG, "number of voicemails to delete " + numVoicemails);
if (!oldestVoicemails.isEmpty()) {
- mQueryHelper.markArchivedInDatabase(oldestVoicemails);
+ queryHelper.markArchivedInDatabase(oldestVoicemails);
imapHelper.markMessagesAsDeleted(oldestVoicemails);
VvmLog.i(
TAG,
@@ -211,8 +211,8 @@ public class OmtpVvmSyncService {
private boolean syncAll(ImapHelper imapHelper, PhoneAccountHandle account) {
List<Voicemail> serverVoicemails = imapHelper.fetchAllVoicemails();
- List<Voicemail> localVoicemails = mQueryHelper.getAllVoicemails(account);
- List<Voicemail> deletedVoicemails = mQueryHelper.getDeletedVoicemails(account);
+ List<Voicemail> localVoicemails = queryHelper.getAllVoicemails(account);
+ List<Voicemail> deletedVoicemails = queryHelper.getDeletedVoicemails(account);
boolean succeeded = true;
if (localVoicemails == null || serverVoicemails == null) {
@@ -225,7 +225,7 @@ public class OmtpVvmSyncService {
if (imapHelper.markMessagesAsDeleted(deletedVoicemails)) {
// Delete only the voicemails that was deleted on the server, in case more are deleted
// since the IMAP query was completed.
- mQueryHelper.deleteFromDatabase(deletedVoicemails);
+ queryHelper.deleteFromDatabase(deletedVoicemails);
} else {
succeeded = false;
}
@@ -249,10 +249,10 @@ public class OmtpVvmSyncService {
// Do not delete voicemails that are archived marked as archived.
if (remoteVoicemail == null) {
- mQueryHelper.deleteNonArchivedFromDatabase(localVoicemail);
+ queryHelper.deleteNonArchivedFromDatabase(localVoicemail);
} else {
if (remoteVoicemail.isRead() && !localVoicemail.isRead()) {
- mQueryHelper.markReadInDatabase(localVoicemail);
+ queryHelper.markReadInDatabase(localVoicemail);
} else if (localVoicemail.isRead() && !remoteVoicemail.isRead()) {
localReadVoicemails.add(localVoicemail);
}
@@ -260,8 +260,8 @@ public class OmtpVvmSyncService {
if (!TextUtils.isEmpty(remoteVoicemail.getTranscription())
&& TextUtils.isEmpty(localVoicemail.getTranscription())) {
LoggerUtils.logImpressionOnMainThread(
- mContext, DialerImpression.Type.VVM_TRANSCRIPTION_DOWNLOADED);
- mQueryHelper.updateWithTranscription(localVoicemail, remoteVoicemail.getTranscription());
+ context, DialerImpression.Type.VVM_TRANSCRIPTION_DOWNLOADED);
+ queryHelper.updateWithTranscription(localVoicemail, remoteVoicemail.getTranscription());
}
}
}
@@ -270,7 +270,7 @@ public class OmtpVvmSyncService {
VvmLog.i(TAG, "Marking voicemails as read");
if (imapHelper.markMessagesAsRead(localReadVoicemails)) {
VvmLog.i(TAG, "Marking voicemails as clean");
- mQueryHelper.markCleanInDatabase(localReadVoicemails);
+ queryHelper.markCleanInDatabase(localReadVoicemails);
} else {
return false;
}
@@ -281,12 +281,12 @@ public class OmtpVvmSyncService {
for (Voicemail remoteVoicemail : remoteMap.values()) {
if (!TextUtils.isEmpty(remoteVoicemail.getTranscription())) {
LoggerUtils.logImpressionOnMainThread(
- mContext, DialerImpression.Type.VVM_TRANSCRIPTION_DOWNLOADED);
+ context, DialerImpression.Type.VVM_TRANSCRIPTION_DOWNLOADED);
}
- Uri uri = VoicemailDatabaseUtil.insert(mContext, remoteVoicemail);
+ Uri uri = VoicemailDatabaseUtil.insert(context, remoteVoicemail);
if (prefetchEnabled) {
VoicemailFetchedCallback fetchedCallback =
- new VoicemailFetchedCallback(mContext, uri, account);
+ new VoicemailFetchedCallback(context, uri, account);
imapHelper.fetchVoicemailPayload(fetchedCallback, remoteVoicemail.getSourceData());
}
}
@@ -298,17 +298,17 @@ public class OmtpVvmSyncService {
ImapHelper imapHelper, Voicemail voicemail, PhoneAccountHandle account) {
if (shouldPerformPrefetch(account, imapHelper)) {
VoicemailFetchedCallback callback =
- new VoicemailFetchedCallback(mContext, voicemail.getUri(), account);
+ new VoicemailFetchedCallback(context, voicemail.getUri(), account);
imapHelper.fetchVoicemailPayload(callback, voicemail.getSourceData());
}
return imapHelper.fetchTranscription(
- new TranscriptionFetchedCallback(mContext, voicemail), voicemail.getSourceData());
+ new TranscriptionFetchedCallback(context, voicemail), voicemail.getSourceData());
}
private boolean shouldPerformPrefetch(PhoneAccountHandle account, ImapHelper imapHelper) {
OmtpVvmCarrierConfigHelper carrierConfigHelper =
- new OmtpVvmCarrierConfigHelper(mContext, account);
+ new OmtpVvmCarrierConfigHelper(context, account);
return carrierConfigHelper.isPrefetchEnabled() && !imapHelper.isRoaming();
}
@@ -324,17 +324,17 @@ public class OmtpVvmSyncService {
/** Callback for {@link ImapHelper#fetchTranscription(TranscriptionFetchedCallback, String)} */
public static class TranscriptionFetchedCallback {
- private Context mContext;
- private Voicemail mVoicemail;
+ private Context context;
+ private Voicemail voicemail;
public TranscriptionFetchedCallback(Context context, Voicemail voicemail) {
- mContext = context;
- mVoicemail = voicemail;
+ this.context = context;
+ this.voicemail = voicemail;
}
public void setVoicemailTranscription(String transcription) {
- VoicemailsQueryHelper queryHelper = new VoicemailsQueryHelper(mContext);
- queryHelper.updateWithTranscription(mVoicemail, transcription);
+ VoicemailsQueryHelper queryHelper = new VoicemailsQueryHelper(context);
+ queryHelper.updateWithTranscription(voicemail, transcription);
}
}
}
diff --git a/java/com/android/voicemail/impl/sync/SyncOneTask.java b/java/com/android/voicemail/impl/sync/SyncOneTask.java
index 70c6bd890..2f0b23f46 100644
--- a/java/com/android/voicemail/impl/sync/SyncOneTask.java
+++ b/java/com/android/voicemail/impl/sync/SyncOneTask.java
@@ -41,8 +41,8 @@ public class SyncOneTask extends BaseTask {
private static final String EXTRA_PHONE_ACCOUNT_HANDLE = "extra_phone_account_handle";
private static final String EXTRA_VOICEMAIL = "extra_voicemail";
- private PhoneAccountHandle mPhone;
- private Voicemail mVoicemail;
+ private PhoneAccountHandle phone;
+ private Voicemail voicemail;
public static void start(Context context, PhoneAccountHandle phone, Voicemail voicemail) {
Intent intent = BaseTask.createIntent(context, SyncOneTask.class, phone);
@@ -59,22 +59,22 @@ public class SyncOneTask extends BaseTask {
@Override
public void onCreate(Context context, Bundle extras) {
super.onCreate(context, extras);
- mPhone = extras.getParcelable(EXTRA_PHONE_ACCOUNT_HANDLE);
- mVoicemail = extras.getParcelable(EXTRA_VOICEMAIL);
+ phone = extras.getParcelable(EXTRA_PHONE_ACCOUNT_HANDLE);
+ voicemail = extras.getParcelable(EXTRA_VOICEMAIL);
}
@Override
public void onExecuteInBackgroundThread() {
OmtpVvmSyncService service = new OmtpVvmSyncService(getContext());
- service.sync(this, mPhone, mVoicemail, VoicemailStatus.edit(getContext(), mPhone));
+ service.sync(this, phone, voicemail, VoicemailStatus.edit(getContext(), phone));
}
@Override
public Intent createRestartIntent() {
LoggerUtils.logImpressionOnMainThread(getContext(), DialerImpression.Type.VVM_AUTO_RETRY_SYNC);
Intent intent = super.createRestartIntent();
- intent.putExtra(EXTRA_PHONE_ACCOUNT_HANDLE, mPhone);
- intent.putExtra(EXTRA_VOICEMAIL, mVoicemail);
+ intent.putExtra(EXTRA_PHONE_ACCOUNT_HANDLE, phone);
+ intent.putExtra(EXTRA_VOICEMAIL, voicemail);
return intent;
}
}
diff --git a/java/com/android/voicemail/impl/sync/SyncTask.java b/java/com/android/voicemail/impl/sync/SyncTask.java
index 68ce0122e..06a5e9e81 100644
--- a/java/com/android/voicemail/impl/sync/SyncTask.java
+++ b/java/com/android/voicemail/impl/sync/SyncTask.java
@@ -38,9 +38,9 @@ public class SyncTask extends BaseTask {
private static final String EXTRA_PHONE_ACCOUNT_HANDLE = "extra_phone_account_handle";
- private final RetryPolicy mRetryPolicy;
+ private final RetryPolicy retryPolicy;
- private PhoneAccountHandle mPhone;
+ private PhoneAccountHandle phone;
public static void start(Context context, PhoneAccountHandle phone) {
Intent intent = BaseTask.createIntent(context, SyncTask.class, phone);
@@ -50,28 +50,28 @@ public class SyncTask extends BaseTask {
public SyncTask() {
super(TASK_SYNC);
- mRetryPolicy = new RetryPolicy(RETRY_TIMES, RETRY_INTERVAL_MILLIS);
- addPolicy(mRetryPolicy);
+ retryPolicy = new RetryPolicy(RETRY_TIMES, RETRY_INTERVAL_MILLIS);
+ addPolicy(retryPolicy);
addPolicy(new MinimalIntervalPolicy(MINIMAL_INTERVAL_MILLIS));
}
@Override
public void onCreate(Context context, Bundle extras) {
super.onCreate(context, extras);
- mPhone = extras.getParcelable(EXTRA_PHONE_ACCOUNT_HANDLE);
+ phone = extras.getParcelable(EXTRA_PHONE_ACCOUNT_HANDLE);
}
@Override
public void onExecuteInBackgroundThread() {
OmtpVvmSyncService service = new OmtpVvmSyncService(getContext());
- service.sync(this, mPhone, null, mRetryPolicy.getVoicemailStatusEditor());
+ service.sync(this, phone, null, retryPolicy.getVoicemailStatusEditor());
}
@Override
public Intent createRestartIntent() {
LoggerUtils.logImpressionOnMainThread(getContext(), DialerImpression.Type.VVM_AUTO_RETRY_SYNC);
Intent intent = super.createRestartIntent();
- intent.putExtra(EXTRA_PHONE_ACCOUNT_HANDLE, mPhone);
+ intent.putExtra(EXTRA_PHONE_ACCOUNT_HANDLE, phone);
return intent;
}
}
diff --git a/java/com/android/voicemail/impl/sync/VoicemailStatusQueryHelper.java b/java/com/android/voicemail/impl/sync/VoicemailStatusQueryHelper.java
index 4ef19daf6..259d79bcc 100644
--- a/java/com/android/voicemail/impl/sync/VoicemailStatusQueryHelper.java
+++ b/java/com/android/voicemail/impl/sync/VoicemailStatusQueryHelper.java
@@ -39,14 +39,14 @@ public class VoicemailStatusQueryHelper {
public static final int NOTIFICATION_CHANNEL_STATE = 2;
public static final int SOURCE_PACKAGE = 3;
- private Context mContext;
- private ContentResolver mContentResolver;
- private Uri mSourceUri;
+ private Context context;
+ private ContentResolver contentResolver;
+ private Uri sourceUri;
public VoicemailStatusQueryHelper(Context context) {
- mContext = context;
- mContentResolver = context.getContentResolver();
- mSourceUri = VoicemailContract.Status.buildSourceUri(mContext.getPackageName());
+ this.context = context;
+ contentResolver = context.getContentResolver();
+ sourceUri = VoicemailContract.Status.buildSourceUri(this.context.getPackageName());
}
/**
@@ -97,8 +97,8 @@ public class VoicemailStatusQueryHelper {
+ "=? AND "
+ Status.SOURCE_PACKAGE
+ "=?";
- String[] whereArgs = {phoneAccountComponentName, phoneAccountId, mContext.getPackageName()};
- cursor = mContentResolver.query(mSourceUri, PROJECTION, whereClause, whereArgs, null);
+ String[] whereArgs = {phoneAccountComponentName, phoneAccountId, context.getPackageName()};
+ cursor = contentResolver.query(sourceUri, PROJECTION, whereClause, whereArgs, null);
if (cursor != null && cursor.moveToFirst()) {
return cursor.getInt(columnIndex) == value;
}
diff --git a/java/com/android/voicemail/impl/sync/VoicemailsQueryHelper.java b/java/com/android/voicemail/impl/sync/VoicemailsQueryHelper.java
index 1af5e688e..c47b40dab 100644
--- a/java/com/android/voicemail/impl/sync/VoicemailsQueryHelper.java
+++ b/java/com/android/voicemail/impl/sync/VoicemailsQueryHelper.java
@@ -52,14 +52,14 @@ public class VoicemailsQueryHelper {
static final String DELETED_SELECTION = Voicemails.DELETED + "=1";
static final String ARCHIVED_SELECTION = Voicemails.ARCHIVED + "=0";
- private Context mContext;
- private ContentResolver mContentResolver;
- private Uri mSourceUri;
+ private Context context;
+ private ContentResolver contentResolver;
+ private Uri sourceUri;
public VoicemailsQueryHelper(Context context) {
- mContext = context;
- mContentResolver = context.getContentResolver();
- mSourceUri = VoicemailContract.Voicemails.buildSourceUri(mContext.getPackageName());
+ this.context = context;
+ contentResolver = context.getContentResolver();
+ sourceUri = VoicemailContract.Voicemails.buildSourceUri(this.context.getPackageName());
}
/**
@@ -90,7 +90,7 @@ public class VoicemailsQueryHelper {
*/
private List<Voicemail> getLocalVoicemails(
@NonNull PhoneAccountHandle unusedPhoneAccountHandle, String selection) {
- Cursor cursor = mContentResolver.query(mSourceUri, PROJECTION, selection, null, null);
+ Cursor cursor = contentResolver.query(sourceUri, PROJECTION, selection, null, null);
if (cursor == null) {
return null;
}
@@ -135,12 +135,12 @@ public class VoicemailsQueryHelper {
}
String selectionStatement = String.format(Voicemails._ID + " IN (%s)", sb.toString());
- return mContentResolver.delete(Voicemails.CONTENT_URI, selectionStatement, null);
+ return contentResolver.delete(Voicemails.CONTENT_URI, selectionStatement, null);
}
/** Utility method to delete a single voicemail that is not archived. */
public void deleteNonArchivedFromDatabase(Voicemail voicemail) {
- mContentResolver.delete(
+ contentResolver.delete(
Voicemails.CONTENT_URI,
Voicemails._ID + "=? AND " + Voicemails.ARCHIVED + "= 0",
new String[] {Long.toString(voicemail.getId())});
@@ -156,10 +156,10 @@ public class VoicemailsQueryHelper {
/** Utility method to mark single message as read. */
public void markReadInDatabase(Voicemail voicemail) {
- Uri uri = ContentUris.withAppendedId(mSourceUri, voicemail.getId());
+ Uri uri = ContentUris.withAppendedId(sourceUri, voicemail.getId());
ContentValues contentValues = new ContentValues();
contentValues.put(Voicemails.IS_READ, "1");
- mContentResolver.update(uri, contentValues, null, null);
+ contentResolver.update(uri, contentValues, null, null);
}
/**
@@ -181,17 +181,17 @@ public class VoicemailsQueryHelper {
/** Utility method to mark single message as clean. */
public void markCleanInDatabase(Voicemail voicemail) {
- Uri uri = ContentUris.withAppendedId(mSourceUri, voicemail.getId());
+ Uri uri = ContentUris.withAppendedId(sourceUri, voicemail.getId());
ContentValues contentValues = new ContentValues();
- mContentResolver.update(uri, contentValues, null, null);
+ contentResolver.update(uri, contentValues, null, null);
}
/** Utility method to add a transcription to the voicemail. */
public void updateWithTranscription(Voicemail voicemail, String transcription) {
- Uri uri = ContentUris.withAppendedId(mSourceUri, voicemail.getId());
+ Uri uri = ContentUris.withAppendedId(sourceUri, voicemail.getId());
ContentValues contentValues = new ContentValues();
contentValues.put(Voicemails.TRANSCRIPTION, transcription);
- mContentResolver.update(uri, contentValues, null, null);
+ contentResolver.update(uri, contentValues, null, null);
}
/**
@@ -221,7 +221,7 @@ public class VoicemailsQueryHelper {
+ Voicemails.SOURCE_DATA
+ "=?";
String[] whereArgs = {phoneAccountComponentName, phoneAccountId, sourceData};
- cursor = mContentResolver.query(mSourceUri, PROJECTION, whereClause, whereArgs, null);
+ cursor = contentResolver.query(sourceUri, PROJECTION, whereClause, whereArgs, null);
if (cursor.getCount() == 0) {
return true;
} else {
@@ -249,10 +249,10 @@ public class VoicemailsQueryHelper {
/** Utility method to mark single voicemail as archived. */
public void markArchiveInDatabase(Voicemail voicemail) {
- Uri uri = ContentUris.withAppendedId(mSourceUri, voicemail.getId());
+ Uri uri = ContentUris.withAppendedId(sourceUri, voicemail.getId());
ContentValues contentValues = new ContentValues();
contentValues.put(Voicemails.ARCHIVED, "1");
- mContentResolver.update(uri, contentValues, null, null);
+ contentResolver.update(uri, contentValues, null, null);
}
/** Find the oldest voicemails that are on the device, and also on the server. */
@@ -265,7 +265,7 @@ public class VoicemailsQueryHelper {
String sortAndLimit = "date ASC limit " + numVoicemails;
try (Cursor cursor =
- mContentResolver.query(mSourceUri, PROJECTION, ARCHIVED_SELECTION, null, sortAndLimit)) {
+ contentResolver.query(sourceUri, PROJECTION, ARCHIVED_SELECTION, null, sortAndLimit)) {
Assert.isNotNull(cursor);
diff --git a/java/com/android/voicemail/impl/sync/VvmNetworkRequest.java b/java/com/android/voicemail/impl/sync/VvmNetworkRequest.java
index 189dc8f2b..e7517363c 100644
--- a/java/com/android/voicemail/impl/sync/VvmNetworkRequest.java
+++ b/java/com/android/voicemail/impl/sync/VvmNetworkRequest.java
@@ -45,21 +45,21 @@ public class VvmNetworkRequest {
*/
public static class NetworkWrapper implements Closeable {
- private final Network mNetwork;
- private final VvmNetworkRequestCallback mCallback;
+ private final Network network;
+ private final VvmNetworkRequestCallback callback;
private NetworkWrapper(Network network, VvmNetworkRequestCallback callback) {
- mNetwork = network;
- mCallback = callback;
+ this.network = network;
+ this.callback = callback;
}
public Network get() {
- return mNetwork;
+ return network;
}
@Override
public void close() {
- mCallback.releaseNetwork();
+ callback.releaseNetwork();
}
}
@@ -92,7 +92,7 @@ public class VvmNetworkRequest {
* {@link CompletableFuture#get()} will block until {@link CompletableFuture# complete(Object) }
* has been called on the other thread.
*/
- private final CompletableFuture<NetworkWrapper> mFuture = new CompletableFuture<>();
+ private final CompletableFuture<NetworkWrapper> future = new CompletableFuture<>();
public FutureNetworkRequestCallback(
OmtpVvmCarrierConfigHelper config,
@@ -102,19 +102,19 @@ public class VvmNetworkRequest {
}
public Future<NetworkWrapper> getFuture() {
- return mFuture;
+ return future;
}
@Override
public void onAvailable(Network network) {
super.onAvailable(network);
- mFuture.complete(new NetworkWrapper(network, this));
+ future.complete(new NetworkWrapper(network, this));
}
@Override
public void onFailed(String reason) {
super.onFailed(reason);
- mFuture.complete(null);
+ future.complete(null);
}
}
}
diff --git a/java/com/android/voicemail/impl/sync/VvmNetworkRequestCallback.java b/java/com/android/voicemail/impl/sync/VvmNetworkRequestCallback.java
index 17f5c1608..60ba166ba 100644
--- a/java/com/android/voicemail/impl/sync/VvmNetworkRequestCallback.java
+++ b/java/com/android/voicemail/impl/sync/VvmNetworkRequestCallback.java
@@ -48,37 +48,37 @@ public abstract class VvmNetworkRequestCallback extends ConnectivityManager.Netw
public static final String NETWORK_REQUEST_FAILED_TIMEOUT = "timeout";
public static final String NETWORK_REQUEST_FAILED_LOST = "lost";
- protected Context mContext;
- protected PhoneAccountHandle mPhoneAccount;
- protected NetworkRequest mNetworkRequest;
- private ConnectivityManager mConnectivityManager;
- private final OmtpVvmCarrierConfigHelper mCarrierConfigHelper;
- private final VoicemailStatus.Editor mStatus;
- private boolean mRequestSent = false;
- private boolean mResultReceived = false;
+ protected Context context;
+ protected PhoneAccountHandle phoneAccount;
+ protected NetworkRequest networkRequest;
+ private ConnectivityManager connectivityManager;
+ private final OmtpVvmCarrierConfigHelper carrierConfigHelper;
+ private final VoicemailStatus.Editor status;
+ private boolean requestSent = false;
+ private boolean resultReceived = false;
public VvmNetworkRequestCallback(
Context context, PhoneAccountHandle phoneAccount, VoicemailStatus.Editor status) {
- mContext = context;
- mPhoneAccount = phoneAccount;
- mStatus = status;
- mCarrierConfigHelper = new OmtpVvmCarrierConfigHelper(context, mPhoneAccount);
- mNetworkRequest = createNetworkRequest();
+ this.context = context;
+ this.phoneAccount = phoneAccount;
+ this.status = status;
+ carrierConfigHelper = new OmtpVvmCarrierConfigHelper(context, this.phoneAccount);
+ networkRequest = createNetworkRequest();
}
public VvmNetworkRequestCallback(
OmtpVvmCarrierConfigHelper config,
PhoneAccountHandle phoneAccount,
VoicemailStatus.Editor status) {
- mContext = config.getContext();
- mPhoneAccount = phoneAccount;
- mStatus = status;
- mCarrierConfigHelper = config;
- mNetworkRequest = createNetworkRequest();
+ context = config.getContext();
+ this.phoneAccount = phoneAccount;
+ this.status = status;
+ carrierConfigHelper = config;
+ networkRequest = createNetworkRequest();
}
public VoicemailStatus.Editor getVoicemailStatusEditor() {
- return mStatus;
+ return status;
}
/**
@@ -91,12 +91,10 @@ public abstract class VvmNetworkRequestCallback extends ConnectivityManager.Netw
new NetworkRequest.Builder().addCapability(NetworkCapabilities.NET_CAPABILITY_INTERNET);
TelephonyManager telephonyManager =
- mContext
- .getSystemService(TelephonyManager.class)
- .createForPhoneAccountHandle(mPhoneAccount);
+ context.getSystemService(TelephonyManager.class).createForPhoneAccountHandle(phoneAccount);
// At this point mPhoneAccount should always be valid and telephonyManager will never be null
Assert.isNotNull(telephonyManager);
- if (mCarrierConfigHelper.isCellularDataRequired()) {
+ if (carrierConfigHelper.isCellularDataRequired()) {
VvmLog.d(TAG, "Transport type: CELLULAR");
builder
.addTransportType(NetworkCapabilities.TRANSPORT_CELLULAR)
@@ -108,14 +106,14 @@ public abstract class VvmNetworkRequestCallback extends ConnectivityManager.Netw
}
public NetworkRequest getNetworkRequest() {
- return mNetworkRequest;
+ return networkRequest;
}
@Override
@CallSuper
public void onLost(Network network) {
VvmLog.d(TAG, "onLost");
- mResultReceived = true;
+ resultReceived = true;
onFailed(NETWORK_REQUEST_FAILED_LOST);
}
@@ -123,22 +121,22 @@ public abstract class VvmNetworkRequestCallback extends ConnectivityManager.Netw
@CallSuper
public void onAvailable(Network network) {
super.onAvailable(network);
- mResultReceived = true;
+ resultReceived = true;
}
@CallSuper
public void onUnavailable() {
// TODO(twyen): a bug this is hidden, do we really need this?
- mResultReceived = true;
+ resultReceived = true;
onFailed(NETWORK_REQUEST_FAILED_TIMEOUT);
}
public void requestNetwork() {
- if (mRequestSent == true) {
+ if (requestSent == true) {
VvmLog.e(TAG, "requestNetwork() called twice");
return;
}
- mRequestSent = true;
+ requestSent = true;
getConnectivityManager().requestNetwork(getNetworkRequest(), this);
/**
* Somehow requestNetwork() with timeout doesn't work, and it's a hidden method. Implement our
@@ -149,7 +147,7 @@ public abstract class VvmNetworkRequestCallback extends ConnectivityManager.Netw
new Runnable() {
@Override
public void run() {
- if (mResultReceived == false) {
+ if (resultReceived == false) {
onFailed(NETWORK_REQUEST_FAILED_TIMEOUT);
}
}
@@ -163,20 +161,20 @@ public abstract class VvmNetworkRequestCallback extends ConnectivityManager.Netw
}
public ConnectivityManager getConnectivityManager() {
- if (mConnectivityManager == null) {
- mConnectivityManager =
- (ConnectivityManager) mContext.getSystemService(Context.CONNECTIVITY_SERVICE);
+ if (connectivityManager == null) {
+ connectivityManager =
+ (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
}
- return mConnectivityManager;
+ return connectivityManager;
}
@CallSuper
public void onFailed(String reason) {
VvmLog.d(TAG, "onFailed: " + reason);
- if (mCarrierConfigHelper.isCellularDataRequired()) {
- mCarrierConfigHelper.handleEvent(mStatus, OmtpEvents.DATA_NO_CONNECTION_CELLULAR_REQUIRED);
+ if (carrierConfigHelper.isCellularDataRequired()) {
+ carrierConfigHelper.handleEvent(status, OmtpEvents.DATA_NO_CONNECTION_CELLULAR_REQUIRED);
} else {
- mCarrierConfigHelper.handleEvent(mStatus, OmtpEvents.DATA_NO_CONNECTION);
+ carrierConfigHelper.handleEvent(status, OmtpEvents.DATA_NO_CONNECTION);
}
releaseNetwork();
}
diff --git a/java/com/android/voicemail/impl/utils/IndentingPrintWriter.java b/java/com/android/voicemail/impl/utils/IndentingPrintWriter.java
index bbc1d6601..b72aecebf 100644
--- a/java/com/android/voicemail/impl/utils/IndentingPrintWriter.java
+++ b/java/com/android/voicemail/impl/utils/IndentingPrintWriter.java
@@ -29,23 +29,23 @@ import java.util.Arrays;
*/
public class IndentingPrintWriter extends PrintWriter {
- private final String mSingleIndent;
- private final int mWrapLength;
+ private final String singleIndent;
+ private final int wrapLength;
/** Mutable version of current indent */
- private StringBuilder mIndentBuilder = new StringBuilder();
- /** Cache of current {@link #mIndentBuilder} value */
- private char[] mCurrentIndent;
+ private StringBuilder indentBuilder = new StringBuilder();
+ /** Cache of current {@link #indentBuilder} value */
+ private char[] currentIndent;
/** Length of current line being built, excluding any indent */
- private int mCurrentLength;
+ private int currentLength;
/**
* Flag indicating if we're currently sitting on an empty line, and that next write should be
* prefixed with the current indent.
*/
- private boolean mEmptyLine = true;
+ private boolean emptyLine = true;
- private char[] mSingleChar = new char[1];
+ private char[] singleChar = new char[1];
public IndentingPrintWriter(Writer writer, String singleIndent) {
this(writer, singleIndent, -1);
@@ -53,18 +53,18 @@ public class IndentingPrintWriter extends PrintWriter {
public IndentingPrintWriter(Writer writer, String singleIndent, int wrapLength) {
super(writer);
- mSingleIndent = singleIndent;
- mWrapLength = wrapLength;
+ this.singleIndent = singleIndent;
+ this.wrapLength = wrapLength;
}
public void increaseIndent() {
- mIndentBuilder.append(mSingleIndent);
- mCurrentIndent = null;
+ indentBuilder.append(singleIndent);
+ currentIndent = null;
}
public void decreaseIndent() {
- mIndentBuilder.delete(0, mSingleIndent.length());
- mCurrentIndent = null;
+ indentBuilder.delete(0, singleIndent.length());
+ currentIndent = null;
}
public void printPair(String key, Object value) {
@@ -86,8 +86,8 @@ public class IndentingPrintWriter extends PrintWriter {
@Override
public void write(int c) {
- mSingleChar[0] = (char) c;
- write(mSingleChar, 0, 1);
+ singleChar[0] = (char) c;
+ write(singleChar, 0, 1);
}
@Override
@@ -99,7 +99,7 @@ public class IndentingPrintWriter extends PrintWriter {
@Override
public void write(char[] buf, int offset, int count) {
- final int indentLength = mIndentBuilder.length();
+ final int indentLength = indentBuilder.length();
final int bufferEnd = offset + count;
int lineStart = offset;
int lineEnd = offset;
@@ -107,30 +107,30 @@ public class IndentingPrintWriter extends PrintWriter {
// March through incoming buffer looking for newlines
while (lineEnd < bufferEnd) {
char ch = buf[lineEnd++];
- mCurrentLength++;
+ currentLength++;
if (ch == '\n') {
maybeWriteIndent();
super.write(buf, lineStart, lineEnd - lineStart);
lineStart = lineEnd;
- mEmptyLine = true;
- mCurrentLength = 0;
+ emptyLine = true;
+ currentLength = 0;
}
// Wrap if we've pushed beyond line length
- if (mWrapLength > 0 && mCurrentLength >= mWrapLength - indentLength) {
- if (!mEmptyLine) {
+ if (wrapLength > 0 && currentLength >= wrapLength - indentLength) {
+ if (!emptyLine) {
// Give ourselves a fresh line to work with
super.write('\n');
- mEmptyLine = true;
- mCurrentLength = lineEnd - lineStart;
+ emptyLine = true;
+ currentLength = lineEnd - lineStart;
} else {
// We need more than a dedicated line, slice it hard
maybeWriteIndent();
super.write(buf, lineStart, lineEnd - lineStart);
super.write('\n');
- mEmptyLine = true;
+ emptyLine = true;
lineStart = lineEnd;
- mCurrentLength = 0;
+ currentLength = 0;
}
}
}
@@ -142,13 +142,13 @@ public class IndentingPrintWriter extends PrintWriter {
}
private void maybeWriteIndent() {
- if (mEmptyLine) {
- mEmptyLine = false;
- if (mIndentBuilder.length() != 0) {
- if (mCurrentIndent == null) {
- mCurrentIndent = mIndentBuilder.toString().toCharArray();
+ if (emptyLine) {
+ emptyLine = false;
+ if (indentBuilder.length() != 0) {
+ if (currentIndent == null) {
+ currentIndent = indentBuilder.toString().toCharArray();
}
- super.write(mCurrentIndent, 0, mCurrentIndent.length);
+ super.write(currentIndent, 0, currentIndent.length);
}
}
}