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

Commit 365ddc9d authored by William Escande's avatar William Escande Committed by Gerrit Code Review
Browse files

Merge changes I4192dc4d,I8c89dcd1,Ia91447d1,Icaa256a7 into main

* changes:
  AndroidFrameworkEfficientStrings: dynamic message
  AndroidFrameworkEfficientStrings: append
  AndroidFrameworkEfficientStrings: StringBuilder
  AndroidFrameworkEfficientStrings: formatSimple x
parents f4a9f7d8 db575a74
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -323,6 +323,7 @@ android_app {
        enabled: true,
        javacflags: [
            "-Xep:AlmostJavadoc:ERROR",
            "-Xep:AndroidFrameworkEfficientStrings:ERROR",
            "-Xep:AndroidFrameworkRequiresPermission:ERROR",
            "-Xep:BadImport:ERROR",
            "-Xep:ClassCanBeStatic:ERROR",
+11 −9
Original line number Diff line number Diff line
@@ -335,7 +335,7 @@ public final class Utils {
            if (idx != 0) {
                sb.append(" ");
            }
            sb.append(String.format("%02x", valueBuf[idx]));
            sb.append(formatSimple("%02x", valueBuf[idx]));
        }
        return sb.toString();
    }
@@ -1206,20 +1206,20 @@ public final class Utils {
     * @return String value representing CCC state
     */
    public static String cccIntToStr(Short cccValue) {
        String string = "";

        if (cccValue == 0) {
            return string += "NO SUBSCRIPTION";
            return "NO SUBSCRIPTION";
        }

        if (BigInteger.valueOf(cccValue).testBit(0) && BigInteger.valueOf(cccValue).testBit(1)) {
            return "NOTIFICATION|INDICATION";
        }
        if (BigInteger.valueOf(cccValue).testBit(0)) {
            string += "NOTIFICATION";
            return "NOTIFICATION";
        }
        if (BigInteger.valueOf(cccValue).testBit(1)) {
            string += string.isEmpty() ? "INDICATION" : "|INDICATION";
            return "INDICATION";
        }

        return string;
        return "";
    }

    /**
@@ -1336,7 +1336,7 @@ public final class Utils {
     *   <li>{@code %d} for {@code int} or {@code long}
     *   <li>{@code %f} for {@code float} or {@code double}
     *   <li>{@code %s} for {@code String}
     *   <li>{@code %x} for hex representation of {@code int} or {@code long}
     *   <li>{@code %x} for hex representation of {@code int} or {@code long} or {@code byte}
     *   <li>{@code %%} for literal {@code %}
     *   <li>{@code %04d} style grammar to specify the argument width, such as {@code %04d} to
     *       prefix an {@code int} with zeros or {@code %10b} to prefix a {@code boolean} with
@@ -1401,6 +1401,8 @@ public final class Utils {
                            repl = Integer.toHexString((int) arg);
                        } else if (arg instanceof Long) {
                            repl = Long.toHexString((long) arg);
                        } else if (arg instanceof Byte) {
                            repl = Integer.toHexString(Byte.toUnsignedInt((byte) arg));
                        } else {
                            throw new IllegalArgumentException(
                                    "Unsupported hex type " + arg.getClass());
+1 −1
Original line number Diff line number Diff line
@@ -920,7 +920,7 @@ public class A2dpService extends ProfileService {

    // Handle messages from native (JNI) to Java
    void messageFromNative(A2dpStackEvent stackEvent) {
        requireNonNull(stackEvent.device, "Device should never be null, event: " + stackEvent);
        requireNonNull(stackEvent.device);
        synchronized (mStateMachines) {
            BluetoothDevice device = stackEvent.device;
            A2dpStateMachine sm = mStateMachines.get(device);
+4 −4
Original line number Diff line number Diff line
@@ -54,11 +54,11 @@ public class A2dpStackEvent {
    public String toString() {
        // event dump
        StringBuilder result = new StringBuilder();
        result.append("A2dpStackEvent {type:" + eventTypeToString(type));
        result.append(", device:" + device);
        result.append(", value1:" + eventTypeValueIntToString(type, valueInt));
        result.append("A2dpStackEvent {type:").append(eventTypeToString(type));
        result.append(", device:").append(device);
        result.append(", value1:").append(eventTypeValueIntToString(type, valueInt));
        if (codecStatus != null) {
            result.append(", codecStatus:" + codecStatus);
            result.append(", codecStatus:").append(codecStatus);
        }
        result.append("}");
        return result.toString();
+10 −11
Original line number Diff line number Diff line
@@ -47,27 +47,26 @@ final class StackEvent {

    @Override
    public String toString() {
        String s = "StackEvent<device=" + mDevice + ", type =";
        StringBuilder sb = new StringBuilder("StackEvent<device=" + mDevice + ", type =");
        switch (mType) {
            case EVENT_TYPE_CONNECTION_STATE_CHANGED:
                s += "EVENT_TYPE_CONNECTION_STATE_CHANGED, state=" + mState;
                sb.append("EVENT_TYPE_CONNECTION_STATE_CHANGED, state=").append(mState);
                break;
            case EVENT_TYPE_AUDIO_STATE_CHANGED:
                s += "EVENT_TYPE_AUDIO_STATE_CHANGED, state=" + mState;
                sb.append("EVENT_TYPE_AUDIO_STATE_CHANGED, state=").append(mState);
                break;
            case EVENT_TYPE_AUDIO_CONFIG_CHANGED:
                s +=
                        "EVENT_TYPE_AUDIO_CONFIG_CHANGED, sampleRate="
                                + mSampleRate
                                + ", channelCount="
                                + mChannelCount;
                sb.append("EVENT_TYPE_AUDIO_CONFIG_CHANGED, sampleRate=")
                        .append(mSampleRate)
                        .append(", channelCount=")
                        .append(mChannelCount);
                break;
            default:
                s += "Unknown";
                sb.append("Unknown");
                break;
        }
        s += ">";
        return s;
        sb.append(">");
        return sb.toString();
    }

    static StackEvent connectionStateChanged(BluetoothDevice device, int state) {
Loading