Remove unnecessary allocation+unboxing of objects.

am: a09b4d2

* commit 'a09b4d2a611a7606e8fc8c73a24bd941b6fc173f':
  Remove unnecessary allocation+unboxing of objects.

Change-Id: Idfffa8fad0f6bcffa954752910524bdc879d65b7
This commit is contained in:
Narayan Kamath
2016-04-18 10:31:37 +00:00
committed by android-build-merger
26 changed files with 79 additions and 80 deletions

View File

@ -1790,7 +1790,7 @@ public class Am extends BaseCommand {
private void runStackStart() throws Exception {
String displayIdStr = nextArgRequired();
int displayId = Integer.valueOf(displayIdStr);
int displayId = Integer.parseInt(displayIdStr);
Intent intent = makeIntent(UserHandle.USER_CURRENT);
try {
@ -1804,9 +1804,9 @@ public class Am extends BaseCommand {
private void runStackMoveTask() throws Exception {
String taskIdStr = nextArgRequired();
int taskId = Integer.valueOf(taskIdStr);
int taskId = Integer.parseInt(taskIdStr);
String stackIdStr = nextArgRequired();
int stackId = Integer.valueOf(stackIdStr);
int stackId = Integer.parseInt(stackIdStr);
String toTopStr = nextArgRequired();
final boolean toTop;
if ("true".equals(toTopStr)) {
@ -1826,7 +1826,7 @@ public class Am extends BaseCommand {
private void runStackResize() throws Exception {
String stackIdStr = nextArgRequired();
int stackId = Integer.valueOf(stackIdStr);
int stackId = Integer.parseInt(stackIdStr);
final Rect bounds = getBounds();
if (bounds == null) {
System.err.println("Error: invalid input bounds");
@ -1837,7 +1837,7 @@ public class Am extends BaseCommand {
private void runStackResizeAnimated() throws Exception {
String stackIdStr = nextArgRequired();
int stackId = Integer.valueOf(stackIdStr);
int stackId = Integer.parseInt(stackIdStr);
final Rect bounds;
if ("null".equals(mArgs.peekNextArg())) {
bounds = null;
@ -1886,11 +1886,11 @@ public class Am extends BaseCommand {
private void runStackPositionTask() throws Exception {
String taskIdStr = nextArgRequired();
int taskId = Integer.valueOf(taskIdStr);
int taskId = Integer.parseInt(taskIdStr);
String stackIdStr = nextArgRequired();
int stackId = Integer.valueOf(stackIdStr);
int stackId = Integer.parseInt(stackIdStr);
String positionStr = nextArgRequired();
int position = Integer.valueOf(positionStr);
int position = Integer.parseInt(positionStr);
try {
mAm.positionTaskInStack(taskId, stackId, position);
@ -1911,7 +1911,7 @@ public class Am extends BaseCommand {
private void runStackInfo() throws Exception {
try {
String stackIdStr = nextArgRequired();
int stackId = Integer.valueOf(stackIdStr);
int stackId = Integer.parseInt(stackIdStr);
StackInfo info = mAm.getStackInfo(stackId);
System.out.println(info);
} catch (RemoteException e) {
@ -1920,12 +1920,12 @@ public class Am extends BaseCommand {
private void runStackRemove() throws Exception {
String stackIdStr = nextArgRequired();
int stackId = Integer.valueOf(stackIdStr);
int stackId = Integer.parseInt(stackIdStr);
mAm.removeStack(stackId);
}
private void runMoveTopActivityToPinnedStack() throws Exception {
int stackId = Integer.valueOf(nextArgRequired());
int stackId = Integer.parseInt(nextArgRequired());
final Rect bounds = getBounds();
if (bounds == null) {
System.err.println("Error: invalid input bounds");
@ -1943,10 +1943,10 @@ public class Am extends BaseCommand {
}
private void runStackSizeDockedStackTest() throws Exception {
final int stepSize = Integer.valueOf(nextArgRequired());
final int stepSize = Integer.parseInt(nextArgRequired());
final String side = nextArgRequired();
final String delayStr = nextArg();
final int delayMs = (delayStr != null) ? Integer.valueOf(delayStr) : 0;
final int delayMs = (delayStr != null) ? Integer.parseInt(delayStr) : 0;
Rect bounds;
try {
@ -2060,7 +2060,7 @@ public class Am extends BaseCommand {
if (taskIdStr.equals("stop")) {
mAm.stopLockTaskMode();
} else {
int taskId = Integer.valueOf(taskIdStr);
int taskId = Integer.parseInt(taskIdStr);
mAm.startLockTaskMode(taskId);
}
System.err.println("Activity manager is " + (mAm.isInLockTaskMode() ? "" : "not ") +
@ -2071,9 +2071,9 @@ public class Am extends BaseCommand {
private void runTaskResizeable() throws Exception {
final String taskIdStr = nextArgRequired();
final int taskId = Integer.valueOf(taskIdStr);
final int taskId = Integer.parseInt(taskIdStr);
final String resizeableStr = nextArgRequired();
final int resizeableMode = Integer.valueOf(resizeableStr);
final int resizeableMode = Integer.parseInt(resizeableStr);
try {
mAm.setTaskResizeable(taskId, resizeableMode);
@ -2083,7 +2083,7 @@ public class Am extends BaseCommand {
private void runTaskResize() throws Exception {
final String taskIdStr = nextArgRequired();
final int taskId = Integer.valueOf(taskIdStr);
final int taskId = Integer.parseInt(taskIdStr);
final Rect bounds = getBounds();
if (bounds == null) {
System.err.println("Error: invalid input bounds");
@ -2104,10 +2104,10 @@ public class Am extends BaseCommand {
}
private void runTaskDragTaskTest() {
final int taskId = Integer.valueOf(nextArgRequired());
final int stepSize = Integer.valueOf(nextArgRequired());
final int taskId = Integer.parseInt(nextArgRequired());
final int stepSize = Integer.parseInt(nextArgRequired());
final String delayStr = nextArg();
final int delay_ms = (delayStr != null) ? Integer.valueOf(delayStr) : 0;
final int delay_ms = (delayStr != null) ? Integer.parseInt(delayStr) : 0;
final StackInfo stackInfo;
Rect taskBounds;
try {
@ -2203,10 +2203,10 @@ public class Am extends BaseCommand {
}
private void runTaskSizeTaskTest() {
final int taskId = Integer.valueOf(nextArgRequired());
final int stepSize = Integer.valueOf(nextArgRequired());
final int taskId = Integer.parseInt(nextArgRequired());
final int stepSize = Integer.parseInt(nextArgRequired());
final String delayStr = nextArg();
final int delay_ms = (delayStr != null) ? Integer.valueOf(delayStr) : 0;
final int delay_ms = (delayStr != null) ? Integer.parseInt(delayStr) : 0;
final StackInfo stackInfo;
final Rect initialTaskBounds;
try {
@ -2550,13 +2550,13 @@ public class Am extends BaseCommand {
private Rect getBounds() {
String leftStr = nextArgRequired();
int left = Integer.valueOf(leftStr);
int left = Integer.parseInt(leftStr);
String topStr = nextArgRequired();
int top = Integer.valueOf(topStr);
int top = Integer.parseInt(topStr);
String rightStr = nextArgRequired();
int right = Integer.valueOf(rightStr);
int right = Integer.parseInt(rightStr);
String bottomStr = nextArgRequired();
int bottom = Integer.valueOf(bottomStr);
int bottom = Integer.parseInt(bottomStr);
if (left < 0) {
System.err.println("Error: bad left arg: " + leftStr);
return null;

View File

@ -8905,7 +8905,7 @@ public class Intent implements Parcelable, Cloneable {
} else if (ATTR_COMPONENT.equals(attrName)) {
intent.setComponent(ComponentName.unflattenFromString(attrValue));
} else if (ATTR_FLAGS.equals(attrName)) {
intent.setFlags(Integer.valueOf(attrValue, 16));
intent.setFlags(Integer.parseInt(attrValue, 16));
} else {
Log.e("Intent", "restoreFromXml: unknown attribute=" + attrName);
}

View File

@ -223,7 +223,7 @@ public final class CameraManager {
" currently connected camera device", cameraId));
}
int id = Integer.valueOf(cameraId);
int id = Integer.parseInt(cameraId);
/*
* Get the camera characteristics from the camera service directly if it supports it,

View File

@ -428,7 +428,7 @@ public final class NfcFCardEmulation {
return false;
}
try {
Integer.valueOf(systemCode, 16);
Integer.parseInt(systemCode, 16);
} catch (NumberFormatException e) {
Log.e(TAG, "System Code " + systemCode + " is not a valid System Code.");
return false;

View File

@ -1163,7 +1163,7 @@ public final class StrictMode {
}
String policyString = message.substring(7, spaceIndex);
try {
return Integer.valueOf(policyString).intValue();
return Integer.parseInt(policyString);
} catch (NumberFormatException e) {
return 0;
}
@ -1187,7 +1187,7 @@ public final class StrictMode {
}
String violationString = message.substring(numberStartIndex, numberEndIndex);
try {
return Integer.valueOf(violationString).intValue();
return Integer.parseInt(violationString);
} catch (NumberFormatException e) {
return 0;
}

View File

@ -378,7 +378,7 @@ public class ZenModeConfig implements Parcelable {
private static int tryParseInt(String value, int defValue) {
if (TextUtils.isEmpty(value)) return defValue;
try {
return Integer.valueOf(value);
return Integer.parseInt(value);
} catch (NumberFormatException e) {
return defValue;
}

View File

@ -972,7 +972,7 @@ public class InputMethodUtils {
private int getInt(final String key, final int defaultValue) {
if (mCopyOnWrite && mCopyOnWriteDataStore.containsKey(key)) {
final String result = mCopyOnWriteDataStore.get(key);
return result != null ? Integer.valueOf(result) : 0;
return result != null ? Integer.parseInt(result) : 0;
}
return Settings.Secure.getIntForUser(mResolver, key, defaultValue, mCurrentUserId);
}
@ -1273,7 +1273,7 @@ public class InputMethodUtils {
if (s.equals(subtypeHashCode)) {
// If both imeId and subtypeId are enabled, return subtypeId.
try {
final int hashCode = Integer.valueOf(subtypeHashCode);
final int hashCode = Integer.parseInt(subtypeHashCode);
// Check whether the subtype id is valid or not
if (isValidSubtypeId(imi, hashCode)) {
return s;

View File

@ -125,7 +125,7 @@ public class VpnProfile implements Cloneable, Parcelable {
VpnProfile profile = new VpnProfile(key);
profile.name = values[0];
profile.type = Integer.valueOf(values[1]);
profile.type = Integer.parseInt(values[1]);
if (profile.type < 0 || profile.type > TYPE_MAX) {
return null;
}

View File

@ -38,7 +38,7 @@ public class SpannableStringBuilderBenchmark {
@BeforeExperiment
protected void setUp() throws Exception {
clazz = Class.forName(paramType);
int strSize = Integer.valueOf(paramStringMult);
int strSize = Integer.parseInt(paramStringMult);
StringBuilder strBuilder = new StringBuilder();
for (int i = 0; i < strSize; i++) {
strBuilder.append(TEST_STRING);

View File

@ -30,7 +30,7 @@ public class SpannableStringInternalCopyBenchmark {
@BeforeExperiment
protected void setUp() throws Exception {
int strSize = Integer.valueOf(paramStringMult);
int strSize = Integer.parseInt(paramStringMult);
StringBuilder strBuilder = new StringBuilder();
for (int i = 0; i < strSize; i++) {
strBuilder.append(SpannableStringBuilderBenchmark.TEST_STRING);

View File

@ -49,7 +49,7 @@ public class LinkifyBenchmark {
@BeforeExperiment
protected void setUp() throws Exception {
int copyAmount = Integer.valueOf(mParamCopyAmount);
int copyAmount = Integer.parseInt(mParamCopyAmount);
StringBuilder strBuilder = new StringBuilder();
for (int i = 0; i < copyAmount; i++) {
strBuilder.append(mParamBasicText);

View File

@ -378,7 +378,7 @@ public class Camera2RecordingTest extends Camera2SurfaceViewTestCase {
Size maxPreviewSize = mOrderedPreviewSizes.get(0);
List<Range<Integer> > fpsRanges = Arrays.asList(
mStaticInfo.getAeAvailableTargetFpsRangesChecked());
int cameraId = Integer.valueOf(mCamera.getId());
int cameraId = Integer.parseInt(mCamera.getId());
int maxVideoFrameRate = -1;
for (int profileId : camcorderProfileList) {
if (!CamcorderProfile.hasProfile(cameraId, profileId) ||
@ -539,7 +539,7 @@ public class Camera2RecordingTest extends Camera2SurfaceViewTestCase {
int kFrameDrop_Tolerence = FRAMEDROP_TOLERANCE;
for (int profileId : mCamcorderProfileList) {
int cameraId = Integer.valueOf(mCamera.getId());
int cameraId = Integer.parseInt(mCamera.getId());
if (!CamcorderProfile.hasProfile(cameraId, profileId) ||
allowedUnsupported(cameraId, profileId)) {
continue;

View File

@ -1747,7 +1747,7 @@ public class ConnectivityService extends IConnectivityManager.Stub
if(restoreDefaultNetworkDelayStr != null &&
restoreDefaultNetworkDelayStr.length() != 0) {
try {
return Integer.valueOf(restoreDefaultNetworkDelayStr);
return Integer.parseInt(restoreDefaultNetworkDelayStr);
} catch (NumberFormatException e) {
}
}

View File

@ -106,7 +106,7 @@ final class DockObserver extends SystemService {
FileReader file = new FileReader(DOCK_STATE_PATH);
try {
int len = file.read(buffer, 0, 1024);
setActualDockStateLocked(Integer.valueOf((new String(buffer, 0, len)).trim()));
setActualDockStateLocked(Integer.parseInt((new String(buffer, 0, len)).trim()));
mPreviousDockState = mActualDockState;
} finally {
file.close();

View File

@ -2473,7 +2473,7 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
int subtypeId = NOT_A_SUBTYPE_ID;
if (lastIme != null && lastImi != null) {
final boolean imiIdIsSame = lastImi.getId().equals(mCurMethodId);
final int lastSubtypeHash = Integer.valueOf(lastIme.second);
final int lastSubtypeHash = Integer.parseInt(lastIme.second);
final int currentSubtypeHash = mCurrentSubtype == null ? NOT_A_SUBTYPE_ID
: mCurrentSubtype.hashCode();
// If the last IME is the same as the current IME and the last subtype is not
@ -2587,7 +2587,7 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
final InputMethodInfo lastImi = mMethodMap.get(lastIme.first);
if (lastImi == null) return null;
try {
final int lastSubtypeHash = Integer.valueOf(lastIme.second);
final int lastSubtypeHash = Integer.parseInt(lastIme.second);
final int lastSubtypeId =
InputMethodUtils.getSubtypeIdFromHashCode(lastImi, lastSubtypeHash);
if (lastSubtypeId < 0 || lastSubtypeId >= lastImi.getSubtypeCount()) {
@ -3437,7 +3437,7 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
if (subtypeHashCode != null) {
try {
lastSubtypeId = InputMethodUtils.getSubtypeIdFromHashCode(
imi, Integer.valueOf(subtypeHashCode));
imi, Integer.parseInt(subtypeHashCode));
} catch (NumberFormatException e) {
Slog.w(TAG, "HashCode for subtype looks broken: " + subtypeHashCode, e);
}
@ -3798,9 +3798,9 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
Slog.w(TAG, "IME uninstalled or not valid.: " + currentImiId);
continue;
}
final int icon = Integer.valueOf(
final int icon = Integer.parseInt(
parser.getAttributeValue(null, ATTR_ICON));
final int label = Integer.valueOf(
final int label = Integer.parseInt(
parser.getAttributeValue(null, ATTR_LABEL));
final String imeSubtypeLocale =
parser.getAttributeValue(null, ATTR_IME_SUBTYPE_LOCALE);
@ -3826,7 +3826,7 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
final String subtypeIdString =
parser.getAttributeValue(null, ATTR_IME_SUBTYPE_ID);
if (subtypeIdString != null) {
builder.setSubtypeId(Integer.valueOf(subtypeIdString));
builder.setSubtypeId(Integer.parseInt(subtypeIdString));
}
tempSubtypesArray.add(builder.build());
}

View File

@ -1110,7 +1110,7 @@ public class TextServicesManagerService extends ITextServicesManager.Stub {
private int getInt(final String key, final int defaultValue) {
if (mCopyOnWrite && mCopyOnWriteDataStore.containsKey(key)) {
final String result = mCopyOnWriteDataStore.get(key);
return result != null ? Integer.valueOf(result) : 0;
return result != null ? Integer.parseInt(result) : 0;
}
return Settings.Secure.getIntForUser(mResolver, key, defaultValue, mCurrentUserId);
}

View File

@ -330,7 +330,7 @@ final class WiredAccessoryManager implements WiredAccessoryCallbacks {
FileReader file = new FileReader(uei.getSwitchStatePath());
int len = file.read(buffer, 0, 1024);
file.close();
curState = Integer.valueOf((new String(buffer, 0, len)).trim());
curState = Integer.parseInt((new String(buffer, 0, len)).trim());
if (curState > 0) {
updateStateLocked(uei.getDevPath(), uei.getDevName(), curState);

View File

@ -1396,7 +1396,7 @@ final class ActivityRecord {
if (ATTR_ID.equals(attrName)) {
createTime = Long.valueOf(attrValue);
} else if (ATTR_LAUNCHEDFROMUID.equals(attrName)) {
launchedFromUid = Integer.valueOf(attrValue);
launchedFromUid = Integer.parseInt(attrValue);
} else if (ATTR_LAUNCHEDFROMPACKAGE.equals(attrName)) {
launchedFromPackage = attrValue;
} else if (ATTR_RESOLVEDTYPE.equals(attrName)) {
@ -1404,7 +1404,7 @@ final class ActivityRecord {
} else if (ATTR_COMPONENTSPECIFIED.equals(attrName)) {
componentSpecified = Boolean.valueOf(attrValue);
} else if (ATTR_USERID.equals(attrName)) {
userId = Integer.valueOf(attrValue);
userId = Integer.parseInt(attrValue);
} else if (attrName.startsWith(TaskDescription.ATTR_TASKDESCRIPTION_PREFIX)) {
taskDescription.restoreFromXml(attrName, attrValue);
} else {

View File

@ -529,7 +529,7 @@ public class TaskPersister {
if (taskIdEnd > 0) {
final int taskId;
try {
taskId = Integer.valueOf(filename.substring(0, taskIdEnd));
taskId = Integer.parseInt(filename.substring(0, taskIdEnd));
if (DEBUG) Slog.d(TAG, "removeObsoleteFiles: Found taskId=" + taskId);
} catch (Exception e) {
Slog.wtf(TAG, "removeObsoleteFiles: Can't parse file=" + file.getName());

View File

@ -1227,7 +1227,7 @@ final class TaskRecord {
if (TaskPersister.DEBUG) Slog.d(TaskPersister.TAG, "TaskRecord: attribute name=" +
attrName + " value=" + attrValue);
if (ATTR_TASKID.equals(attrName)) {
if (taskId == INVALID_TASK_ID) taskId = Integer.valueOf(attrValue);
if (taskId == INVALID_TASK_ID) taskId = Integer.parseInt(attrValue);
} else if (ATTR_REALACTIVITY.equals(attrName)) {
realActivity = ComponentName.unflattenFromString(attrValue);
} else if (ATTR_REALACTIVITY_SUSPENDED.equals(attrName)) {
@ -1246,13 +1246,13 @@ final class TaskRecord {
} else if (ATTR_ASKEDCOMPATMODE.equals(attrName)) {
askedCompatMode = Boolean.valueOf(attrValue);
} else if (ATTR_USERID.equals(attrName)) {
userId = Integer.valueOf(attrValue);
userId = Integer.parseInt(attrValue);
} else if (ATTR_USER_SETUP_COMPLETE.equals(attrName)) {
userSetupComplete = Boolean.valueOf(attrValue);
} else if (ATTR_EFFECTIVE_UID.equals(attrName)) {
effectiveUid = Integer.valueOf(attrValue);
effectiveUid = Integer.parseInt(attrValue);
} else if (ATTR_TASKTYPE.equals(attrName)) {
taskType = Integer.valueOf(attrValue);
taskType = Integer.parseInt(attrValue);
} else if (ATTR_FIRSTACTIVETIME.equals(attrName)) {
firstActiveTime = Long.valueOf(attrValue);
} else if (ATTR_LASTACTIVETIME.equals(attrName)) {
@ -1268,19 +1268,19 @@ final class TaskRecord {
} else if (attrName.startsWith(TaskDescription.ATTR_TASKDESCRIPTION_PREFIX)) {
taskDescription.restoreFromXml(attrName, attrValue);
} else if (ATTR_TASK_AFFILIATION.equals(attrName)) {
taskAffiliation = Integer.valueOf(attrValue);
taskAffiliation = Integer.parseInt(attrValue);
} else if (ATTR_PREV_AFFILIATION.equals(attrName)) {
prevTaskId = Integer.valueOf(attrValue);
prevTaskId = Integer.parseInt(attrValue);
} else if (ATTR_NEXT_AFFILIATION.equals(attrName)) {
nextTaskId = Integer.valueOf(attrValue);
nextTaskId = Integer.parseInt(attrValue);
} else if (ATTR_TASK_AFFILIATION_COLOR.equals(attrName)) {
taskAffiliationColor = Integer.valueOf(attrValue);
taskAffiliationColor = Integer.parseInt(attrValue);
} else if (ATTR_CALLING_UID.equals(attrName)) {
callingUid = Integer.valueOf(attrValue);
callingUid = Integer.parseInt(attrValue);
} else if (ATTR_CALLING_PACKAGE.equals(attrName)) {
callingPackage = attrValue;
} else if (ATTR_RESIZE_MODE.equals(attrName)) {
resizeMode = Integer.valueOf(attrValue);
resizeMode = Integer.parseInt(attrValue);
resizeMode = (resizeMode == RESIZE_MODE_CROP_WINDOWS)
? RESIZE_MODE_FORCE_RESIZEABLE : resizeMode;
} else if (ATTR_PRIVILEGED.equals(attrName)) {
@ -1288,9 +1288,9 @@ final class TaskRecord {
} else if (ATTR_NON_FULLSCREEN_BOUNDS.equals(attrName)) {
bounds = Rect.unflattenFromString(attrValue);
} else if (ATTR_MINIMAL_WIDTH.equals(attrName)) {
minimalWidth = Integer.valueOf(attrValue);
minimalWidth = Integer.parseInt(attrValue);
} else if (ATTR_MINIMAL_HEIGHT.equals(attrName)) {
minimalHeight = Integer.valueOf(attrValue);
minimalHeight = Integer.parseInt(attrValue);
} else {
Slog.w(TAG, "TaskRecord: Unknown attribute=" + attrName);
}

View File

@ -548,8 +548,7 @@ public class NetworkDiagnostics {
mMeasurement.description += " src{" + getSocketAddressString() + "}";
// This needs to be fixed length so it can be dropped into the pre-canned packet.
final String sixRandomDigits =
Integer.valueOf(mRandom.nextInt(900000) + 100000).toString();
final String sixRandomDigits = String.valueOf(mRandom.nextInt(900000) + 100000);
mMeasurement.description += " qtype{" + mQueryType + "}"
+ " qname{" + sixRandomDigits + "-android-ds.metric.gstatic.com}";

View File

@ -486,7 +486,7 @@ public class JobStore {
final List<JobStatus> jobs = new ArrayList<JobStatus>();
// Read in version info.
try {
int version = Integer.valueOf(parser.getAttributeValue(null, "version"));
int version = Integer.parseInt(parser.getAttributeValue(null, "version"));
if (version != JOBS_FILE_VERSION) {
Slog.d(TAG, "Invalid version number, aborting jobs file read.");
return null;
@ -534,14 +534,14 @@ public class JobStore {
try {
jobBuilder = buildBuilderFromXml(parser);
jobBuilder.setPersisted(true);
uid = Integer.valueOf(parser.getAttributeValue(null, "uid"));
uid = Integer.parseInt(parser.getAttributeValue(null, "uid"));
String val = parser.getAttributeValue(null, "priority");
if (val != null) {
jobBuilder.setPriority(Integer.valueOf(val));
jobBuilder.setPriority(Integer.parseInt(val));
}
val = parser.getAttributeValue(null, "sourceUserId");
sourceUserId = val == null ? -1 : Integer.valueOf(val);
sourceUserId = val == null ? -1 : Integer.parseInt(val);
} catch (NumberFormatException e) {
Slog.e(TAG, "Error parsing job's required fields, skipping");
return null;
@ -684,7 +684,7 @@ public class JobStore {
private JobInfo.Builder buildBuilderFromXml(XmlPullParser parser) throws NumberFormatException {
// Pull out required fields from <job> attributes.
int jobId = Integer.valueOf(parser.getAttributeValue(null, "jobid"));
int jobId = Integer.parseInt(parser.getAttributeValue(null, "jobid"));
String packageName = parser.getAttributeValue(null, "package");
String className = parser.getAttributeValue(null, "class");
ComponentName cname = new ComponentName(packageName, className);
@ -720,7 +720,7 @@ public class JobStore {
if (val != null) {
long initialBackoff = Long.valueOf(val);
val = parser.getAttributeValue(null, "backoff-policy");
int backoffPolicy = Integer.valueOf(val); // Will throw NFE which we catch higher up.
int backoffPolicy = Integer.parseInt(val); // Will throw NFE which we catch higher up.
jobBuilder.setBackoffCriteria(initialBackoff, backoffPolicy);
}
}

View File

@ -303,7 +303,7 @@ public class RankingHelper implements RankingConfig {
private static int tryParseInt(String value, int defValue) {
if (TextUtils.isEmpty(value)) return defValue;
try {
return Integer.valueOf(value);
return Integer.parseInt(value);
} catch (NumberFormatException e) {
return defValue;
}

View File

@ -252,7 +252,7 @@ public class DatabaseHelper extends SQLiteOpenHelper {
String[] usersStr = text.split(",");
int[] users = new int[usersStr.length];
for (int i = 0; i < usersStr.length; i++) {
users[i] = Integer.valueOf(usersStr[i]);
users[i] = Integer.parseInt(usersStr[i]);
}
return users;
}

View File

@ -135,8 +135,8 @@ public class NeighboringCellInfo implements Parcelable
mNetworkType = radioType;
// check if 0xFFFFFFFF for UNKNOWN_CID
if (!location.equalsIgnoreCase("FFFFFFFF")) {
mCid = Integer.valueOf(location.substring(4), 16);
mLac = Integer.valueOf(location.substring(0, 4), 16);
mCid = Integer.parseInt(location.substring(4), 16);
mLac = Integer.parseInt(location.substring(0, 4), 16);
}
break;
case NETWORK_TYPE_UMTS:
@ -144,7 +144,7 @@ public class NeighboringCellInfo implements Parcelable
case NETWORK_TYPE_HSUPA:
case NETWORK_TYPE_HSPA:
mNetworkType = radioType;
mPsc = Integer.valueOf(location, 16);
mPsc = Integer.parseInt(location, 16);
break;
}
} catch (NumberFormatException e) {

View File

@ -781,7 +781,7 @@ class TestWebServer implements HttpConstants {
if (testID.startsWith("test")) {
testNum = Integer.valueOf(testID.substring(4))-1;
testNum = Integer.parseInt(testID.substring(4))-1;
}
if ((testNum < 0) || (testNum > TestWebData.tests.length - 1)) {