8000 Android Migrate off mCursorDrawableRes (setting cursor color on TextView) as throws error in api 29 and higher · Issue #6240 · unoplatform/uno · GitHub
[go: up one dir, main page]

Skip to content

Android Migrate off mCursorDrawableRes (setting cursor color on TextView) as throws error in api 29 and higher #6240

@mitchcapper

Description

@mitchcapper

Current behavior

an exception thrown on access:
Accessing hidden field Landroid/widget/TextView;->mCursorDrawableRes:I (greylist-max-p, reflection, denied) **Java.Lang.NoSuchFieldException:** 'No field mCursorDrawableRes in class Landroid/widget/TextView; (declaration of 'android.widget.TextView' appears in /system/framework/framework.jar!classes3.dex)'

Summary

So

_cursorDrawableResField = textViewClass.GetDeclaredField("mCursorDrawableRes");
in EditTextCursorColorChanger accesses the mCursorDrawableRes field which is not supported. It was graylisted < 29 and per 29 it is blacklisted: https://developer.android.com/about/versions/10/non-sdk-q

This is referenced in #5491 however the PR does not remove the access to this field rather more error handling.

Officially I think the recommendation is: https://developer.android.com/reference/android/widget/TextView#setTextCursorDrawable(int) it was only added in v29 however I understand that is now the minimum version for uno anyway so could probably just swap over to using it exclusively.

Metadata

Metadata

Assignees

No one assigned

    Labels

    difficulty/medium 🤔Categorizes an issue for which the difficulty level is reachable with a good understanding of WinUIkind/bugSomething isn't workingplatform/android 🤖Categorizes an issue or PR as relevant to the Android platformproject/core-tools 🛠️Categorizes an issue or PR as relevant to core and tools

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0