mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2026-10-05 19:28:25 +00:00
fix: suppress RestrictedApi false positive on NappletHostActivity.dispatchKeyEvent
Activity.dispatchKeyEvent is a public framework hook; lint flags the override only because androidx.core's intermediate override carries a library-group @RestrictTo. Scoped to the method so the check stays live for genuine restricted-API use. Makes :nappletHost:lintDebug pass. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HLfwhTdf72qFPnmPRYnzqu
This commit is contained in:
co-authored by
Claude Fable 5
parent
f1419377b7
commit
1e05a086ad
+7
@@ -20,6 +20,7 @@
|
||||
*/
|
||||
package com.vitorpamplona.amethyst.napplethost
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.app.AlertDialog
|
||||
import android.content.ComponentName
|
||||
import android.content.Intent
|
||||
@@ -430,7 +431,13 @@ class NappletHostActivity : ComponentActivity() {
|
||||
* Intercepts hardware-key combos the applet bound via `keys.registerAction` and turns them into a
|
||||
* `keys.action` push — the applet never sees raw key events, only its own named action. Unmatched
|
||||
* keys fall through to the WebView (so the applet's own text inputs still work normally).
|
||||
*
|
||||
* RestrictedApi is a false positive: `Activity.dispatchKeyEvent` is a public framework
|
||||
* hook; lint flags it only because androidx.core's intermediate override carries a
|
||||
* library-group `@RestrictTo`. Unmatched keys still reach `super`, so androidx's
|
||||
* KeyEventDispatcher routing is preserved.
|
||||
*/
|
||||
@SuppressLint("RestrictedApi")
|
||||
override fun dispatchKeyEvent(event: KeyEvent): Boolean {
|
||||
val actionId = keyActions.actionFor(event)
|
||||
if (actionId != null) {
|
||||
|
||||
Reference in New Issue
Block a user