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

Commit db575a74 authored by William Escande's avatar William Escande
Browse files

AndroidFrameworkEfficientStrings: dynamic message

Resolve the following:
[AndroidFrameworkEfficientStrings] Building dynamic messages is
discouraged, since they always allocate a transparent StringBuilder,
even in the successful case

And finally enforce AndroidFrameworkEfficientStrings

Bug: 344658662
Test: None
Flag: Exempt refactor
Change-Id: I4192dc4dd8a8e4d1878f1cb5c9b939043a793299
parent 6b138496
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",
+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);
+1 −1
Original line number Diff line number Diff line
@@ -612,7 +612,7 @@ public class AdapterService extends Service {
    }

    final @NonNull <T> T getNonNullSystemService(@NonNull Class<T> clazz) {
        return requireNonNull(getSystemService(clazz), clazz.getSimpleName() + " cannot be null");
        return requireNonNull(getSystemService(clazz));
    }

    @Override
+2 −2
Original line number Diff line number Diff line
@@ -818,7 +818,7 @@ public class CsipSetCoordinatorService extends ProfileService {
        Intent intent = null;
        int groupId = stackEvent.valueInt1;
        if (stackEvent.type == CsipSetCoordinatorStackEvent.EVENT_TYPE_DEVICE_AVAILABLE) {
            Objects.requireNonNull(device, "Device should never be null, event: " + stackEvent);
            Objects.requireNonNull(device);

            intent = new Intent(BluetoothCsipSetCoordinator.ACTION_CSIS_DEVICE_AVAILABLE);
            intent.putExtra(BluetoothDevice.EXTRA_DEVICE, stackEvent.device);
@@ -836,7 +836,7 @@ public class CsipSetCoordinatorService extends ProfileService {
                    stackEvent.valueInt2);
        } else if (stackEvent.type
                == CsipSetCoordinatorStackEvent.EVENT_TYPE_SET_MEMBER_AVAILABLE) {
            Objects.requireNonNull(device, "Device should never be null, event: " + stackEvent);
            Objects.requireNonNull(device);
            if (!mFoundSetMemberToGroupId.containsKey(device)) {
                mFoundSetMemberToGroupId.put(device, groupId);
            }
+1 −2
Original line number Diff line number Diff line
@@ -610,8 +610,7 @@ public class HearingAidService extends ProfileService {
    }

    void messageFromNative(HearingAidStackEvent stackEvent) {
        Objects.requireNonNull(
                stackEvent.device, "Device should never be null, event: " + stackEvent);
        Objects.requireNonNull(stackEvent.device);

        if (stackEvent.type == HearingAidStackEvent.EVENT_TYPE_DEVICE_AVAILABLE) {
            BluetoothDevice device = stackEvent.device;
Loading