Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
AdamVe committed Mar 19, 2024
1 parent 74702f4 commit 9e46581
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,7 @@ private static void registerPermissionsReceiver(Context context, PermissionBroad
* @return UsbDevice from intent's parcelable
*/
@Nullable
@SuppressWarnings("deprecation")
private static UsbDevice getUsbManagerExtraDevice(Intent intent) {
return (Build.VERSION.SDK_INT > Build.VERSION_CODES.TIRAMISU)
? intent.getParcelableExtra(UsbManager.EXTRA_DEVICE, UsbDevice.class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public UsbYubiKeyDevice(UsbManager usbManager, UsbDevice usbDevice)
this.usbManager = usbManager;
}

/** @noinspection BooleanMethodIsAlwaysInverted*/
@SuppressWarnings("BooleanMethodIsAlwaysInverted")
public boolean hasPermission() {
return usbManager.hasPermission(usbDevice);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@

import org.slf4j.LoggerFactory;

import java.lang.reflect.InvocationTargetException;
import java.util.Objects;

import javax.annotation.Nullable;
Expand Down Expand Up @@ -212,16 +213,18 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
allowNfc = args.getBoolean(ARG_ALLOW_NFC, true);

// Get the action to perform on YubiKey connected
@SuppressWarnings("deprecation")
Class<?> actionType = (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU)
? (Class<?>) args.getSerializable(ARG_ACTION_CLASS, Class.class)
: (Class<?>) args.getSerializable(ARG_ACTION_CLASS);
try {
if (actionType != null && YubiKeyPromptAction.class.isAssignableFrom(actionType)) {
action = (YubiKeyPromptAction) actionType.newInstance();
action = (YubiKeyPromptAction) actionType.getDeclaredConstructor().newInstance();
} else {
throw new IllegalStateException("Missing or invalid ConnectionAction class");
}
} catch (IllegalStateException | IllegalAccessException | InstantiationException e) {
} catch (IllegalStateException | IllegalAccessException | InstantiationException |
NoSuchMethodException | InvocationTargetException e) {
Logger.error(logger, "Unable to instantiate ConnectionAction", e);
finish();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
/**
* Used internally in YubiKit, don't use from applications.
*/
@SuppressWarnings("unused")
@SuppressWarnings({"unused", "deprecation"})
public final class Logger {

@Nullable
Expand Down

0 comments on commit 9e46581

Please sign in to comment.