Loading play-services-fido/core/src/main/kotlin/org/microg/gms/fido/core/transport/nfc/NfcTransportHandler.kt +13 −1 Original line number Diff line number Diff line Loading @@ -6,12 +6,14 @@ package org.microg.gms.fido.core.transport.nfc import android.app.Activity import android.app.ActivityOptions import android.app.PendingIntent import android.content.Intent import android.content.IntentFilter import android.nfc.NfcAdapter import android.nfc.Tag import android.nfc.tech.IsoDep import android.os.Build.VERSION.SDK_INT import android.util.Log import androidx.core.app.OnNewIntentProvider import androidx.core.app.PendingIntentCompat Loading Loading @@ -39,7 +41,17 @@ class NfcTransportHandler(private val activity: Activity, callback: TransportHan private suspend fun waitForNewNfcTag(adapter: NfcAdapter): Tag { val intent = Intent(activity, activity.javaClass).apply { addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP) } val pendingIntent: PendingIntent = PendingIntentCompat.getActivity(activity, 0, intent, 0, true)!! val piOptions = if (SDK_INT >= 34) { ActivityOptions.makeBasic().apply { pendingIntentCreatorBackgroundActivityStartMode = ActivityOptions.MODE_BACKGROUND_ACTIVITY_START_ALLOWED }.toBundle() } else null val pendingIntent: PendingIntent = PendingIntentCompat.getActivity( activity, 0, intent, 0, piOptions, true)!! adapter.enableForegroundDispatch( activity, pendingIntent, Loading play-services-fido/core/src/main/kotlin/org/microg/gms/fido/core/transport/usb/UsbDevicePermissionManager.kt +3 −3 Original line number Diff line number Diff line Loading @@ -5,15 +5,15 @@ package org.microg.gms.fido.core.transport.usb import android.app.PendingIntent import android.content.BroadcastReceiver import android.content.Context import android.content.Intent import android.content.IntentFilter import android.hardware.usb.UsbDevice import android.hardware.usb.UsbManager import android.os.Build.VERSION.SDK_INT import androidx.core.app.PendingIntentCompat import androidx.core.content.ContextCompat import androidx.core.content.ContextCompat.RECEIVER_NOT_EXPORTED import kotlinx.coroutines.CompletableDeferred private val Context.usbPermissionCallbackAction Loading @@ -25,7 +25,7 @@ private object UsbDevicePermissionReceiver : BroadcastReceiver() { fun register(context: Context) = synchronized(this) { if (!registered) { context.registerReceiver(this, IntentFilter(context.usbPermissionCallbackAction)) ContextCompat.registerReceiver(context, this, IntentFilter(context.usbPermissionCallbackAction), RECEIVER_NOT_EXPORTED) registered = true } } Loading play-services-fido/core/src/main/kotlin/org/microg/gms/fido/core/transport/usb/UsbTransportHandler.kt +3 −7 Original line number Diff line number Diff line Loading @@ -17,20 +17,16 @@ import android.os.Bundle import android.util.Base64 import android.util.Log import androidx.annotation.RequiresApi import androidx.core.content.ContextCompat import androidx.core.content.ContextCompat.RECEIVER_NOT_EXPORTED import com.google.android.gms.fido.fido2.api.common.* import com.upokecenter.cbor.CBORObject import kotlinx.coroutines.CancellationException import kotlinx.coroutines.CompletableDeferred import kotlinx.coroutines.delay import org.microg.gms.fido.core.* import org.microg.gms.fido.core.protocol.* import org.microg.gms.fido.core.protocol.msgs.* import org.microg.gms.fido.core.transport.CtapConnection import org.microg.gms.fido.core.transport.Transport import org.microg.gms.fido.core.transport.TransportHandler import org.microg.gms.fido.core.transport.TransportHandlerCallback import org.microg.gms.fido.core.transport.usb.ctaphid.CtapHidConnection import org.microg.gms.fido.core.transport.usb.ctaphid.CtapHidMessageStatusException import org.microg.gms.utils.toBase64 @RequiresApi(21) Loading Loading @@ -112,7 +108,7 @@ class UsbTransportHandler(private val context: Context, callback: TransportHandl deferred.complete(device) } } context.registerReceiver(receiver, IntentFilter(UsbManager.ACTION_USB_DEVICE_ATTACHED)) ContextCompat.registerReceiver(context, receiver, IntentFilter(UsbManager.ACTION_USB_DEVICE_ATTACHED), RECEIVER_NOT_EXPORTED) invokeStatusChanged(TransportHandlerCallback.STATUS_WAITING_FOR_DEVICE) val device = deferred.await() context.unregisterReceiver(receiver) Loading Loading
play-services-fido/core/src/main/kotlin/org/microg/gms/fido/core/transport/nfc/NfcTransportHandler.kt +13 −1 Original line number Diff line number Diff line Loading @@ -6,12 +6,14 @@ package org.microg.gms.fido.core.transport.nfc import android.app.Activity import android.app.ActivityOptions import android.app.PendingIntent import android.content.Intent import android.content.IntentFilter import android.nfc.NfcAdapter import android.nfc.Tag import android.nfc.tech.IsoDep import android.os.Build.VERSION.SDK_INT import android.util.Log import androidx.core.app.OnNewIntentProvider import androidx.core.app.PendingIntentCompat Loading Loading @@ -39,7 +41,17 @@ class NfcTransportHandler(private val activity: Activity, callback: TransportHan private suspend fun waitForNewNfcTag(adapter: NfcAdapter): Tag { val intent = Intent(activity, activity.javaClass).apply { addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP) } val pendingIntent: PendingIntent = PendingIntentCompat.getActivity(activity, 0, intent, 0, true)!! val piOptions = if (SDK_INT >= 34) { ActivityOptions.makeBasic().apply { pendingIntentCreatorBackgroundActivityStartMode = ActivityOptions.MODE_BACKGROUND_ACTIVITY_START_ALLOWED }.toBundle() } else null val pendingIntent: PendingIntent = PendingIntentCompat.getActivity( activity, 0, intent, 0, piOptions, true)!! adapter.enableForegroundDispatch( activity, pendingIntent, Loading
play-services-fido/core/src/main/kotlin/org/microg/gms/fido/core/transport/usb/UsbDevicePermissionManager.kt +3 −3 Original line number Diff line number Diff line Loading @@ -5,15 +5,15 @@ package org.microg.gms.fido.core.transport.usb import android.app.PendingIntent import android.content.BroadcastReceiver import android.content.Context import android.content.Intent import android.content.IntentFilter import android.hardware.usb.UsbDevice import android.hardware.usb.UsbManager import android.os.Build.VERSION.SDK_INT import androidx.core.app.PendingIntentCompat import androidx.core.content.ContextCompat import androidx.core.content.ContextCompat.RECEIVER_NOT_EXPORTED import kotlinx.coroutines.CompletableDeferred private val Context.usbPermissionCallbackAction Loading @@ -25,7 +25,7 @@ private object UsbDevicePermissionReceiver : BroadcastReceiver() { fun register(context: Context) = synchronized(this) { if (!registered) { context.registerReceiver(this, IntentFilter(context.usbPermissionCallbackAction)) ContextCompat.registerReceiver(context, this, IntentFilter(context.usbPermissionCallbackAction), RECEIVER_NOT_EXPORTED) registered = true } } Loading
play-services-fido/core/src/main/kotlin/org/microg/gms/fido/core/transport/usb/UsbTransportHandler.kt +3 −7 Original line number Diff line number Diff line Loading @@ -17,20 +17,16 @@ import android.os.Bundle import android.util.Base64 import android.util.Log import androidx.annotation.RequiresApi import androidx.core.content.ContextCompat import androidx.core.content.ContextCompat.RECEIVER_NOT_EXPORTED import com.google.android.gms.fido.fido2.api.common.* import com.upokecenter.cbor.CBORObject import kotlinx.coroutines.CancellationException import kotlinx.coroutines.CompletableDeferred import kotlinx.coroutines.delay import org.microg.gms.fido.core.* import org.microg.gms.fido.core.protocol.* import org.microg.gms.fido.core.protocol.msgs.* import org.microg.gms.fido.core.transport.CtapConnection import org.microg.gms.fido.core.transport.Transport import org.microg.gms.fido.core.transport.TransportHandler import org.microg.gms.fido.core.transport.TransportHandlerCallback import org.microg.gms.fido.core.transport.usb.ctaphid.CtapHidConnection import org.microg.gms.fido.core.transport.usb.ctaphid.CtapHidMessageStatusException import org.microg.gms.utils.toBase64 @RequiresApi(21) Loading Loading @@ -112,7 +108,7 @@ class UsbTransportHandler(private val context: Context, callback: TransportHandl deferred.complete(device) } } context.registerReceiver(receiver, IntentFilter(UsbManager.ACTION_USB_DEVICE_ATTACHED)) ContextCompat.registerReceiver(context, receiver, IntentFilter(UsbManager.ACTION_USB_DEVICE_ATTACHED), RECEIVER_NOT_EXPORTED) invokeStatusChanged(TransportHandlerCallback.STATUS_WAITING_FOR_DEVICE) val device = deferred.await() context.unregisterReceiver(receiver) Loading