Skip to content
This repository has been archived by the owner on Nov 1, 2022. It is now read-only.

BrowserGestureDetector: Reflective access to mSpanSlop will throw an exception when targeting API 30 #10638

Closed
pocmo opened this issue Jul 19, 2021 · 3 comments
Assignees
Labels
Android 12 New functionality or breaking behaviour when targeting Android 12 ⌨️ code Technical debt, code clean up, small API change .. <toolbar> Components: browser-toolbar, concept-toolbar

Comments

@pocmo
Copy link
Contributor

pocmo commented Jul 19, 2021

Thew new lint is complaining:

android-components/components/browser/toolbar/src/main/java/mozilla/components/browser/toolbar/behavior/BrowserGestureDetector.kt:64: Error: Reflective access to mSpanSlop will throw an exception when targeting API 30 and above [SoonBlockedPrivateApi]
javaClass.getDeclaredField("mSpanSlop"),

┆Issue is synchronized with this Jira Task

@pocmo
Copy link
Contributor Author

pocmo commented Jul 19, 2021

This will be a problem.

CC @Mugurell

For now I'll suppress (compose) branch. But I guess we will have to address this somehow.

@pocmo pocmo added ⌨️ code Technical debt, code clean up, small API change .. <toolbar> Components: browser-toolbar, concept-toolbar labels Jul 19, 2021
@Mugurell
Copy link
Contributor

Mugurell commented Jul 20, 2021

We use that to favor a bit more identifying touches as zoom motions.
Those properties control the distance we wait for before trying to identify between zooming and panning gestures. The more distance, the greater the confidence.
Even with this right now we can see the toolbar moving just a little when actually doing a zooming gesture (a few pixels means panning, after more we can detect the zoom gesture).
Without halving these values but with otherwise the same code the toolbar will move just a little bit more and the effect would be more easy to spot.

To get past this issue if also moving to Compose with clean slates maybe we could use some state from GeckoView about scroll and overscroll distance.

@pocmo pocmo added the Android 12 New functionality or breaking behaviour when targeting Android 12 label Jul 20, 2021
Mugurell added a commit to Mugurell/android-components that referenced this issue Feb 18, 2022
…d "mMinSpan"

Removed reflective access to non-public SDK APIs controlling the sensitivity of
the gesture detector following which sparingly and for very short time a
pinch/spread to zoom gesture might be identified first as a scroll gesture and
move the toolbar a little before snapping to it's original position.
@Mugurell Mugurell self-assigned this Feb 18, 2022
@Mugurell
Copy link
Contributor

Mugurell commented Mar 2, 2022

Code landed. Closing the issue.

@Mugurell Mugurell closed this as completed Mar 2, 2022
Mugurell added a commit to Mugurell/android-components that referenced this issue Mar 10, 2022
…d "mMinSpan"

Removed reflective access to non-public SDK APIs controlling the sensitivity of
the gesture detector following which sparingly and for very short time a
pinch/spread to zoom gesture might be identified first as a scroll gesture and
move the toolbar a little before snapping to it's original position.
mergify bot pushed a commit that referenced this issue Mar 10, 2022
Removed reflective access to non-public SDK APIs controlling the sensitivity of
the gesture detector following which sparingly and for very short time a
pinch/spread to zoom gesture might be identified first as a scroll gesture and
move the toolbar a little before snapping to it's original position.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Android 12 New functionality or breaking behaviour when targeting Android 12 ⌨️ code Technical debt, code clean up, small API change .. <toolbar> Components: browser-toolbar, concept-toolbar
Projects
None yet
Development

No branches or pull requests

2 participants