Remove unnecessary allocation+unboxing of objects.
Transforming String->int can be done with 0 allocations
using Integer.parseInt.
bug: 28078871
Change-Id: I8d9f322d7154728849dde61ef282046032858d60
diff --git a/cmds/am/src/com/android/commands/am/Am.java b/cmds/am/src/com/android/commands/am/Am.java
index 456be02..7d084dc 100644
--- a/cmds/am/src/com/android/commands/am/Am.java
+++ b/cmds/am/src/com/android/commands/am/Am.java
@@ -1790,7 +1790,7 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
}
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 @@
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 @@
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 @@
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 @@
}
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 @@
}
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 @@
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;
diff --git a/core/java/android/content/Intent.java b/core/java/android/content/Intent.java
index 831de4a..fb4dd84 100644
--- a/core/java/android/content/Intent.java
+++ b/core/java/android/content/Intent.java
@@ -8905,7 +8905,7 @@
} 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);
}
diff --git a/core/java/android/hardware/camera2/CameraManager.java b/core/java/android/hardware/camera2/CameraManager.java
index ffd9d89..3917bfa 100644
--- a/core/java/android/hardware/camera2/CameraManager.java
+++ b/core/java/android/hardware/camera2/CameraManager.java
@@ -223,7 +223,7 @@
" 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,
diff --git a/core/java/android/nfc/cardemulation/NfcFCardEmulation.java b/core/java/android/nfc/cardemulation/NfcFCardEmulation.java
index 42ccf20..a506504 100644
--- a/core/java/android/nfc/cardemulation/NfcFCardEmulation.java
+++ b/core/java/android/nfc/cardemulation/NfcFCardEmulation.java
@@ -428,7 +428,7 @@
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;
diff --git a/core/java/android/os/StrictMode.java b/core/java/android/os/StrictMode.java
index e4a76db..c36b488 100644
--- a/core/java/android/os/StrictMode.java
+++ b/core/java/android/os/StrictMode.java
@@ -1163,7 +1163,7 @@
}
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 @@
}
String violationString = message.substring(numberStartIndex, numberEndIndex);
try {
- return Integer.valueOf(violationString).intValue();
+ return Integer.parseInt(violationString);
} catch (NumberFormatException e) {
return 0;
}
diff --git a/core/java/android/service/notification/ZenModeConfig.java b/core/java/android/service/notification/ZenModeConfig.java
index 27315ee..3e25edb 100644
--- a/core/java/android/service/notification/ZenModeConfig.java
+++ b/core/java/android/service/notification/ZenModeConfig.java
@@ -378,7 +378,7 @@
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;
}
diff --git a/core/java/com/android/internal/inputmethod/InputMethodUtils.java b/core/java/com/android/internal/inputmethod/InputMethodUtils.java
index f3ae688..6dc0c60 100644
--- a/core/java/com/android/internal/inputmethod/InputMethodUtils.java
+++ b/core/java/com/android/internal/inputmethod/InputMethodUtils.java
@@ -972,7 +972,7 @@
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 @@
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;
diff --git a/core/java/com/android/internal/net/VpnProfile.java b/core/java/com/android/internal/net/VpnProfile.java
index 01349bb..5c92f3c 100644
--- a/core/java/com/android/internal/net/VpnProfile.java
+++ b/core/java/com/android/internal/net/VpnProfile.java
@@ -125,7 +125,7 @@
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;
}
diff --git a/core/tests/benchmarks/src/android/text/SpannableStringBuilderBenchmark.java b/core/tests/benchmarks/src/android/text/SpannableStringBuilderBenchmark.java
index 23f8810..96915f4 100644
--- a/core/tests/benchmarks/src/android/text/SpannableStringBuilderBenchmark.java
+++ b/core/tests/benchmarks/src/android/text/SpannableStringBuilderBenchmark.java
@@ -38,7 +38,7 @@
@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);
diff --git a/core/tests/benchmarks/src/android/text/SpannableStringInternalCopyBenchmark.java b/core/tests/benchmarks/src/android/text/SpannableStringInternalCopyBenchmark.java
index dc5fed0..1286bcc 100644
--- a/core/tests/benchmarks/src/android/text/SpannableStringInternalCopyBenchmark.java
+++ b/core/tests/benchmarks/src/android/text/SpannableStringInternalCopyBenchmark.java
@@ -30,7 +30,7 @@
@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);
diff --git a/core/tests/benchmarks/src/android/text/util/LinkifyBenchmark.java b/core/tests/benchmarks/src/android/text/util/LinkifyBenchmark.java
index a6e433f..24b20ca 100644
--- a/core/tests/benchmarks/src/android/text/util/LinkifyBenchmark.java
+++ b/core/tests/benchmarks/src/android/text/util/LinkifyBenchmark.java
@@ -49,7 +49,7 @@
@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);
diff --git a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/stress/Camera2RecordingTest.java b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/stress/Camera2RecordingTest.java
index a9b6bfd..5566b4e 100644
--- a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/stress/Camera2RecordingTest.java
+++ b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/stress/Camera2RecordingTest.java
@@ -378,7 +378,7 @@
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 @@
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;
diff --git a/services/core/java/com/android/server/ConnectivityService.java b/services/core/java/com/android/server/ConnectivityService.java
index e5fe03a..40d44b4 100644
--- a/services/core/java/com/android/server/ConnectivityService.java
+++ b/services/core/java/com/android/server/ConnectivityService.java
@@ -1747,7 +1747,7 @@
if(restoreDefaultNetworkDelayStr != null &&
restoreDefaultNetworkDelayStr.length() != 0) {
try {
- return Integer.valueOf(restoreDefaultNetworkDelayStr);
+ return Integer.parseInt(restoreDefaultNetworkDelayStr);
} catch (NumberFormatException e) {
}
}
diff --git a/services/core/java/com/android/server/DockObserver.java b/services/core/java/com/android/server/DockObserver.java
index 5388f10..07aa5656 100644
--- a/services/core/java/com/android/server/DockObserver.java
+++ b/services/core/java/com/android/server/DockObserver.java
@@ -106,7 +106,7 @@
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();
diff --git a/services/core/java/com/android/server/InputMethodManagerService.java b/services/core/java/com/android/server/InputMethodManagerService.java
index 544e645..79d16da 100644
--- a/services/core/java/com/android/server/InputMethodManagerService.java
+++ b/services/core/java/com/android/server/InputMethodManagerService.java
@@ -2473,7 +2473,7 @@
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 @@
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 @@
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 @@
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 @@
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());
}
diff --git a/services/core/java/com/android/server/TextServicesManagerService.java b/services/core/java/com/android/server/TextServicesManagerService.java
index 801d6e0..a628747 100644
--- a/services/core/java/com/android/server/TextServicesManagerService.java
+++ b/services/core/java/com/android/server/TextServicesManagerService.java
@@ -1110,7 +1110,7 @@
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);
}
diff --git a/services/core/java/com/android/server/WiredAccessoryManager.java b/services/core/java/com/android/server/WiredAccessoryManager.java
index e0e6070..fcda83d 100644
--- a/services/core/java/com/android/server/WiredAccessoryManager.java
+++ b/services/core/java/com/android/server/WiredAccessoryManager.java
@@ -330,7 +330,7 @@
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);
diff --git a/services/core/java/com/android/server/am/ActivityRecord.java b/services/core/java/com/android/server/am/ActivityRecord.java
index 48f87b6..aaf8301 100755
--- a/services/core/java/com/android/server/am/ActivityRecord.java
+++ b/services/core/java/com/android/server/am/ActivityRecord.java
@@ -1396,7 +1396,7 @@
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 @@
} 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 {
diff --git a/services/core/java/com/android/server/am/TaskPersister.java b/services/core/java/com/android/server/am/TaskPersister.java
index ceb7db6..a2472ac 100644
--- a/services/core/java/com/android/server/am/TaskPersister.java
+++ b/services/core/java/com/android/server/am/TaskPersister.java
@@ -529,7 +529,7 @@
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());
diff --git a/services/core/java/com/android/server/am/TaskRecord.java b/services/core/java/com/android/server/am/TaskRecord.java
index 08d2399..5a5f861 100644
--- a/services/core/java/com/android/server/am/TaskRecord.java
+++ b/services/core/java/com/android/server/am/TaskRecord.java
@@ -1227,7 +1227,7 @@
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 @@
} 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 @@
} 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 @@
} 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);
}
diff --git a/services/core/java/com/android/server/connectivity/NetworkDiagnostics.java b/services/core/java/com/android/server/connectivity/NetworkDiagnostics.java
index dc62609..5f9efe7 100644
--- a/services/core/java/com/android/server/connectivity/NetworkDiagnostics.java
+++ b/services/core/java/com/android/server/connectivity/NetworkDiagnostics.java
@@ -548,8 +548,7 @@
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}";
diff --git a/services/core/java/com/android/server/job/JobStore.java b/services/core/java/com/android/server/job/JobStore.java
index 55f37b8..35628a2 100644
--- a/services/core/java/com/android/server/job/JobStore.java
+++ b/services/core/java/com/android/server/job/JobStore.java
@@ -486,7 +486,7 @@
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 @@
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 @@
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 @@
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);
}
}
diff --git a/services/core/java/com/android/server/notification/RankingHelper.java b/services/core/java/com/android/server/notification/RankingHelper.java
index 4a41705..78b3f41 100644
--- a/services/core/java/com/android/server/notification/RankingHelper.java
+++ b/services/core/java/com/android/server/notification/RankingHelper.java
@@ -303,7 +303,7 @@
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;
}
diff --git a/services/voiceinteraction/java/com/android/server/voiceinteraction/DatabaseHelper.java b/services/voiceinteraction/java/com/android/server/voiceinteraction/DatabaseHelper.java
index 9c15f2b..0f68cca 100644
--- a/services/voiceinteraction/java/com/android/server/voiceinteraction/DatabaseHelper.java
+++ b/services/voiceinteraction/java/com/android/server/voiceinteraction/DatabaseHelper.java
@@ -252,7 +252,7 @@
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;
}
diff --git a/telephony/java/android/telephony/NeighboringCellInfo.java b/telephony/java/android/telephony/NeighboringCellInfo.java
index 0f9a3b9..25851e3 100644
--- a/telephony/java/android/telephony/NeighboringCellInfo.java
+++ b/telephony/java/android/telephony/NeighboringCellInfo.java
@@ -135,8 +135,8 @@
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 @@
case NETWORK_TYPE_HSUPA:
case NETWORK_TYPE_HSPA:
mNetworkType = radioType;
- mPsc = Integer.valueOf(location, 16);
+ mPsc = Integer.parseInt(location, 16);
break;
}
} catch (NumberFormatException e) {
diff --git a/tests/CoreTests/android/core/TestWebServer.java b/tests/CoreTests/android/core/TestWebServer.java
index f73e6ff..2a016cf 100644
--- a/tests/CoreTests/android/core/TestWebServer.java
+++ b/tests/CoreTests/android/core/TestWebServer.java
@@ -781,7 +781,7 @@
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)) {