Messaging: Further code improvements
* Remove redundant casts * getParcelable(ArrayList|Exra) without class argument is deprecated * ViewPager.setOnPageChangeListener -> addOnPageChangeListener * RecyclerView.setOnScrollListener -> addOnScrollListener * Remove unused initializations * Remove unused code Change-Id: I21beb6c90c675a4f2cfd7e3d5ebbd18b745f5911
This commit is contained in:
@@ -290,7 +290,7 @@ class DefaultApnSettingsLoader implements ApnSettingsLoader {
|
||||
} else {
|
||||
uri = Telephony.Carriers.CONTENT_URI;
|
||||
}
|
||||
Cursor cursor = null;
|
||||
Cursor cursor;
|
||||
try {
|
||||
for (; ; ) {
|
||||
// Try different combinations of queries. Some would work on some platforms.
|
||||
@@ -448,7 +448,7 @@ class DefaultApnSettingsLoader implements ApnSettingsLoader {
|
||||
return addr;
|
||||
}
|
||||
final StringBuilder builder = new StringBuilder(16);
|
||||
String result = null;
|
||||
String result;
|
||||
for (int i = 0; i < 4; i++) {
|
||||
try {
|
||||
if (octets[i].length() > 3) {
|
||||
|
||||
@@ -195,7 +195,7 @@ public class MmsHttpClient {
|
||||
final InputStream in = new BufferedInputStream(connection.getInputStream());
|
||||
final ByteArrayOutputStream byteOut = new ByteArrayOutputStream();
|
||||
final byte[] buf = new byte[4096];
|
||||
int count = 0;
|
||||
int count;
|
||||
while ((count = in.read(buf)) > 0) {
|
||||
byteOut.write(buf, 0, count);
|
||||
}
|
||||
@@ -438,7 +438,7 @@ public class MmsHttpClient {
|
||||
if (!TextUtils.isEmpty(naiSuffix)) {
|
||||
nai = nai + naiSuffix;
|
||||
}
|
||||
byte[] encoded = null;
|
||||
byte[] encoded;
|
||||
encoded = Base64.encode(nai.getBytes(StandardCharsets.UTF_8), Base64.NO_WRAP);
|
||||
return new String(encoded, StandardCharsets.UTF_8);
|
||||
}
|
||||
|
||||
@@ -131,7 +131,7 @@ public class MmsManager {
|
||||
* @return a Bundle containing the overrides
|
||||
*/
|
||||
private static Bundle getConfigOverrides(final int subId) {
|
||||
Bundle overrides = null;
|
||||
Bundle overrides;
|
||||
synchronized (sConfigOverridesMap) {
|
||||
overrides = sConfigOverridesMap.get(subId);
|
||||
if (overrides == null) {
|
||||
|
||||
@@ -220,7 +220,8 @@ public class MmsService extends Service {
|
||||
// embedded in the intent to make sure it is indeed from the
|
||||
// the current life of this service.
|
||||
if (fromThisProcess(intent)) {
|
||||
final MmsRequest request = intent.getParcelableExtra(EXTRA_REQUEST);
|
||||
final MmsRequest request = intent.getParcelableExtra(EXTRA_REQUEST,
|
||||
MmsRequest.class);
|
||||
if (request != null) {
|
||||
try {
|
||||
retainService(request, () -> {
|
||||
|
||||
@@ -72,13 +72,13 @@ public class Base64 {
|
||||
}
|
||||
|
||||
int numberQuadruple = base64Data.length / FOURBYTE;
|
||||
byte[] decodedData = null;
|
||||
byte b1 = 0, b2 = 0, b3 = 0, b4 = 0, marker0 = 0, marker1 = 0;
|
||||
byte[] decodedData;
|
||||
byte b1, b2, b3, b4, marker0, marker1;
|
||||
|
||||
// Throw away anything not in base64Data
|
||||
|
||||
int encodedIndex = 0;
|
||||
int dataIndex = 0;
|
||||
int dataIndex;
|
||||
{
|
||||
// this sizes the output array properly - rlw
|
||||
int lastData = base64Data.length;
|
||||
|
||||
@@ -22,7 +22,7 @@ public class GenericPdu {
|
||||
/**
|
||||
* The headers of pdu.
|
||||
*/
|
||||
PduHeaders mPduHeaders = null;
|
||||
PduHeaders mPduHeaders;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
|
||||
@@ -21,7 +21,7 @@ package android.support.v7.mms.pdu;
|
||||
import java.util.Vector;
|
||||
|
||||
public class PduBody {
|
||||
private Vector<PduPart> mParts = null;
|
||||
private Vector<PduPart> mParts;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
|
||||
@@ -323,7 +323,7 @@ public class PduHeaders {
|
||||
/**
|
||||
* The map contains the value of all headers.
|
||||
*/
|
||||
private SparseArray<Object> mHeaderMap = null;
|
||||
private SparseArray<Object> mHeaderMap;
|
||||
|
||||
/**
|
||||
* Constructor of PduHeaders.
|
||||
|
||||
@@ -73,7 +73,7 @@ public class PduParser {
|
||||
/**
|
||||
* The pdu data.
|
||||
*/
|
||||
private ByteArrayInputStream mPduDataStream = null;
|
||||
private ByteArrayInputStream mPduDataStream;
|
||||
|
||||
/**
|
||||
* Store pdu headers
|
||||
@@ -550,7 +550,7 @@ public class PduParser {
|
||||
* Value-length
|
||||
* (Address-present-token Encoded-string-value | Insert-address-token)
|
||||
*/
|
||||
EncodedStringValue from = null;
|
||||
EncodedStringValue from;
|
||||
parseValueLength(pduDataStream); /* parse value-length */
|
||||
|
||||
/* Address-present-token or Insert-address-token */
|
||||
@@ -1059,7 +1059,7 @@ public class PduParser {
|
||||
*/
|
||||
assert(null != pduDataStream);
|
||||
pduDataStream.mark(1);
|
||||
EncodedStringValue returnValue = null;
|
||||
EncodedStringValue returnValue;
|
||||
int charset = 0;
|
||||
int temp = pduDataStream.read();
|
||||
assert(-1 != temp);
|
||||
@@ -1392,7 +1392,7 @@ public class PduParser {
|
||||
assert(length > 0);
|
||||
|
||||
int startPos = pduDataStream.available();
|
||||
int tempPos = 0;
|
||||
int tempPos;
|
||||
int lastLen = length;
|
||||
while(0 < lastLen) {
|
||||
int param = pduDataStream.read();
|
||||
@@ -1561,7 +1561,7 @@ public class PduParser {
|
||||
*/
|
||||
assert(null != pduDataStream);
|
||||
|
||||
byte[] contentType = null;
|
||||
byte[] contentType;
|
||||
pduDataStream.mark(1);
|
||||
int temp = pduDataStream.read();
|
||||
assert(-1 != temp);
|
||||
@@ -1645,7 +1645,7 @@ public class PduParser {
|
||||
* contain the corresponding definitions.
|
||||
*/
|
||||
int startPos = pduDataStream.available();
|
||||
int tempPos = 0;
|
||||
int tempPos;
|
||||
int lastLen = length;
|
||||
while(0 < lastLen) {
|
||||
int header = pduDataStream.read();
|
||||
@@ -1700,7 +1700,7 @@ public class PduParser {
|
||||
int len = parseValueLength(pduDataStream);
|
||||
pduDataStream.mark(1);
|
||||
int thisStartPos = pduDataStream.available();
|
||||
int thisEndPos = 0;
|
||||
int thisEndPos;
|
||||
int value = pduDataStream.read();
|
||||
|
||||
if (value == PduPart.P_DISPOSITION_FROM_DATA ) {
|
||||
|
||||
@@ -106,7 +106,7 @@ public class PduPart {
|
||||
/**
|
||||
* Header of part.
|
||||
*/
|
||||
private SparseArray<Object> mPartHeader = null;
|
||||
private SparseArray<Object> mPartHeader;
|
||||
|
||||
/**
|
||||
* Data uri.
|
||||
|
||||
Reference in New Issue
Block a user