Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 28532d00 authored by Tobias Thierer's avatar Tobias Thierer
Browse files

frameworks/base: Avoid Long object allocations in Long.valueOf()

Replace usages where the Long is immediately unboxed or thrown
away with Long.parseLong().
In TaskRecord.java, I also fixed up similar uses of
{Boolean,Integer}.valueOf()

Tested: built frameworks/base successfully.

Bug: 28289401
(cherry picked from commit 4bd017d6)

Change-Id: Icfa4708946e774f4a1bacf185c3fd11a7087017e
parent 28b1df3b
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -128,15 +128,15 @@ public class RequestSync {
            } else if (opt.equals("--el") || opt.equals("--extra-long")) {
                final String key = nextArgRequired();
                final String value = nextArgRequired();
                mExtras.putLong(key, Long.valueOf(value));
                mExtras.putLong(key, Long.parseLong(value));
            } else if (opt.equals("--ef") || opt.equals("--extra-float")) {
                final String key = nextArgRequired();
                final String value = nextArgRequired();
                mExtras.putFloat(key, Long.valueOf(value));
                mExtras.putFloat(key, Long.parseLong(value));
            } else if (opt.equals("--ed") || opt.equals("--extra-double")) {
                final String key = nextArgRequired();
                final String value = nextArgRequired();
                mExtras.putFloat(key, Long.valueOf(value));
                mExtras.putFloat(key, Long.parseLong(value));
            } else if (opt.equals("--ez") || opt.equals("--extra-bool")) {
                final String key = nextArgRequired();
                final String value = nextArgRequired();
+1 −1
Original line number Diff line number Diff line
@@ -453,7 +453,7 @@ public final class NfcFCardEmulation {
            return false;
        }
        try {
            Long.valueOf(nfcid2, 16);
            Long.parseLong(nfcid2, 16);
        } catch (NumberFormatException e) {
            Log.e(TAG, "NFCID2 " + nfcid2 + " is not a valid NFCID2.");
            return false;
+1 −1
Original line number Diff line number Diff line
@@ -387,7 +387,7 @@ public class ZenModeConfig implements Parcelable {
    private static long tryParseLong(String value, long defValue) {
        if (TextUtils.isEmpty(value)) return defValue;
        try {
            return Long.valueOf(value);
            return Long.parseLong(value);
        } catch (NumberFormatException e) {
            return defValue;
        }
+1 −1
Original line number Diff line number Diff line
@@ -1748,7 +1748,7 @@ public class ExifInterface {
            String subSecs = getAttribute(TAG_SUBSEC_TIME);
            if (subSecs != null) {
                try {
                    long sub = Long.valueOf(subSecs);
                    long sub = Long.parseLong(subSecs);
                    while (sub > 1000) {
                        sub /= 10;
                    }
+1 −1
Original line number Diff line number Diff line
@@ -560,7 +560,7 @@ final class SettingsState {
        }

        public Setting(String name, String value, String packageName, String id) {
            mNextId = Math.max(mNextId, Long.valueOf(id) + 1);
            mNextId = Math.max(mNextId, Long.parseLong(id) + 1);
            init(name, value, packageName, id);
        }

Loading