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

Commit 3bea7365 authored by William Escande's avatar William Escande Committed by Gerrit Code Review
Browse files

Merge "Follow error prone recommendation"

parents e4ca6c3e 2831ecf1
Loading
Loading
Loading
Loading
+3 −10
Original line number Diff line number Diff line
@@ -35,7 +35,6 @@ import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.RequiresPermission;
import android.annotation.SuppressLint;
import android.app.AppOpsManager;
import android.app.BroadcastOptions;
import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothDevice;
@@ -244,7 +243,6 @@ public final class Utils {
    public static ParcelUuid[] byteArrayToUuid(byte[] val) {
        int numUuids = val.length / BD_UUID_LEN;
        ParcelUuid[] puuids = new ParcelUuid[numUuids];
        UUID uuid;
        int offset = 0;

        ByteBuffer converter = ByteBuffer.wrap(val);
@@ -341,6 +339,7 @@ public final class Utils {
     * @throws SecurityException if the package name does not match the uid or the association
     *                           doesn't exist
     */
    @RequiresPermission("android.permission.MANAGE_COMPANION_DEVICES")
    public static boolean enforceCdmAssociation(CompanionDeviceManager cdm, Context context,
            String callingPackage, int callingUid, BluetoothDevice device) {
        if (!isPackageNameAccurate(context, callingPackage, callingUid)) {
@@ -852,14 +851,8 @@ public final class Utils {
        return true;
    }

    private static boolean isAppOppAllowed(AppOpsManager appOps, String op, String callingPackage,
            @NonNull String callingFeatureId) {
        return appOps.noteOp(op, Binder.getCallingUid(), callingPackage, callingFeatureId, null)
                == AppOpsManager.MODE_ALLOWED;
    }

    /**
     * Converts {@code millisecond} to unit. Each unit is 0.625 millisecond.
     * Converts {@code milliseconds} to unit. Each unit is 0.625 millisecond.
     */
    public static int millsToUnit(int milliseconds) {
        return (int) (TimeUnit.MILLISECONDS.toMicros(milliseconds) / MICROS_PER_UNIT);
@@ -993,9 +986,9 @@ public final class Utils {
     * Returns broadcast options.
     */
    public static @NonNull BroadcastOptions getTempBroadcastOptions() {
        final BroadcastOptions bOptions = BroadcastOptions.makeBasic();
        // Use the Bluetooth process identity to pass permission check when reading DeviceConfig
        final long ident = Binder.clearCallingIdentity();
        final BroadcastOptions bOptions = BroadcastOptions.makeBasic();
        try {
            final long durationMs = DeviceConfig.getLong(DeviceConfig.NAMESPACE_BLUETOOTH,
                    KEY_TEMP_ALLOW_LIST_DURATION_MS, DEFAULT_TEMP_ALLOW_LIST_DURATION_MS);