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

Commit 6f90a1e3 authored by Felipe Leme's avatar Felipe Leme
Browse files

Fixed ErrorProne violations (FormatStringAnnotation and CompileTimeConstant).

Bug: 410953467
Test: export RUN_ERROR_PRONE=true && m # with commit 63adb6681eaa9cbcf23e1167978839be345cc7bc
Flag: EXEMPT minor bug fix

Change-Id: Id1506ce1f68512df30258742324f9d2b54895666
parent 22e6a226
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -119,9 +119,9 @@ public class SerialService extends ISerialManager.Stub {
                @NonNull Supplier<ParcelFileDescriptor> supplier) {
            synchronized (mSerialPorts) {
                Preconditions.checkState(!mSerialPorts.containsKey(name),
                        "Port " + name + " already defined");
                        "Port %s already defined", name);
                Preconditions.checkArgument(name.startsWith(PREFIX_VIRTUAL),
                        "Port " + name + " must be under " + PREFIX_VIRTUAL);
                        "Port %s must be under %s", name, PREFIX_VIRTUAL);
                mSerialPorts.put(name, supplier);
            }
        }
@@ -130,9 +130,9 @@ public class SerialService extends ISerialManager.Stub {
        public void removeVirtualSerialPortForTest(@NonNull String name) {
            synchronized (mSerialPorts) {
                Preconditions.checkState(mSerialPorts.containsKey(name),
                        "Port " + name + " not yet defined");
                        "Port %s not yet defined", name);
                Preconditions.checkArgument(name.startsWith(PREFIX_VIRTUAL),
                        "Port " + name + " must be under " + PREFIX_VIRTUAL);
                        "Port %s must be under %s", name, PREFIX_VIRTUAL);
                mSerialPorts.remove(name);
            }
        }
+1 −1
Original line number Diff line number Diff line
@@ -1079,7 +1079,7 @@ final class ActivityManagerShellCommand extends ShellCommand {
        final int result = mInterface.broadcastIntentWithFeature(null, null, intent, null,
                receiver, 0, null, null, requiredPermissions, null, null,
                android.app.AppOpsManager.OP_NONE, bundle, true, false, mUserId);
        Slogf.i(TAG, "Enqueued broadcast %s: " + result, intent);
        Slogf.i(TAG, "Enqueued broadcast %s: %d", intent, result);
        if (result == ActivityManager.BROADCAST_SUCCESS && !mAsync) {
            receiver.waitForFinish();
        }
+1 −1
Original line number Diff line number Diff line
@@ -360,7 +360,7 @@ public final class CpuInfoReader {
        if (numCpuFreqPolicyDirs == 0 || numCpuFreqPolicyDirs != numStaticPolicyInfos) {
            Slogf.e(TAG, "Failed to set CPU frequency directory to %s. Total CPU frequency "
                            + "policies (%d) under new path is either 0 or not equal to initial "
                            + "total CPU frequency policies. Clearing CPU frequency policy "
                            + "total CPU frequency policies (%d). Clearing CPU frequency policy "
                            + "directories", cpuFreqDir.getAbsolutePath(), numCpuFreqPolicyDirs,
                    numStaticPolicyInfos);
            mCpuFreqPolicyDirsById.clear();
+2 −0
Original line number Diff line number Diff line
@@ -5751,6 +5751,8 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl.
            }
        }

        // String is not constant because it's using TextUtils.formatSimple
        @SuppressWarnings("CompileTimeConstant")
        @Override
        public void setVirtualDeviceInputMethodForAllUsers(int deviceId, @Nullable String imeId) {
            Preconditions.checkArgument(deviceId != DEVICE_ID_DEFAULT,
+6 −12
Original line number Diff line number Diff line
@@ -847,8 +847,7 @@ public class LocationManagerService extends ILocationManager.Stub implements
        request = validateLocationRequest(provider, request, identity);

        LocationProviderManager manager = getLocationProviderManager(provider);
        Preconditions.checkArgument(manager != null,
                "provider \"" + provider + "\" does not exist");
        Preconditions.checkArgument(manager != null, "provider \"%s\" does not exist", provider);

        return manager.getCurrentLocation(request, identity, permissionLevel, consumer);
    }
@@ -890,8 +889,7 @@ public class LocationManagerService extends ILocationManager.Stub implements
        request = validateLocationRequest(provider, request, identity);

        LocationProviderManager manager = getLocationProviderManager(provider);
        Preconditions.checkArgument(manager != null,
                "provider \"" + provider + "\" does not exist");
        Preconditions.checkArgument(manager != null, "provider \"%s\" does not exist", provider);

        manager.registerLocationRequest(request, identity, permissionLevel, listener);
    }
@@ -939,8 +937,7 @@ public class LocationManagerService extends ILocationManager.Stub implements
        request = validateLocationRequest(provider, request, identity);

        LocationProviderManager manager = getLocationProviderManager(provider);
        Preconditions.checkArgument(manager != null,
                "provider \"" + provider + "\" does not exist");
        Preconditions.checkArgument(manager != null, "provider \"%s\" does not exist", provider);

        manager.registerLocationRequest(request, identity, permissionLevel, pendingIntent);
    }
@@ -1024,8 +1021,7 @@ public class LocationManagerService extends ILocationManager.Stub implements
    @Override
    public void requestListenerFlush(String provider, ILocationListener listener, int requestCode) {
        LocationProviderManager manager = getLocationProviderManager(provider);
        Preconditions.checkArgument(manager != null,
                "provider \"" + provider + "\" does not exist");
        Preconditions.checkArgument(manager != null, "provider \"%s\" does not exist", provider);

        manager.flush(Objects.requireNonNull(listener), requestCode);
    }
@@ -1034,8 +1030,7 @@ public class LocationManagerService extends ILocationManager.Stub implements
    public void requestPendingIntentFlush(String provider, PendingIntent pendingIntent,
            int requestCode) {
        LocationProviderManager manager = getLocationProviderManager(provider);
        Preconditions.checkArgument(manager != null,
                "provider \"" + provider + "\" does not exist");
        Preconditions.checkArgument(manager != null, "provider \"%s\" does not exist", provider);

        manager.flush(Objects.requireNonNull(pendingIntent), requestCode);
    }
@@ -1309,8 +1304,7 @@ public class LocationManagerService extends ILocationManager.Stub implements
    @Override
    public ProviderProperties getProviderProperties(String provider) {
        LocationProviderManager manager = getLocationProviderManager(provider);
        Preconditions.checkArgument(manager != null,
                "provider \"" + provider + "\" does not exist");
        Preconditions.checkArgument(manager != null, "provider \"%s\" does not exist", provider);
        return manager.getProperties();
    }

Loading