Goal: I upgraded my app to Android 13 and updated code for the permissions as per: https://developer.android.com/about/versions/13/behavior-changes-13#granular-media-permissions

Problem: QA noticed that the app is crashing for him (although it isnt for me on the same phone. we both have Android 13)

Error:

Input dispatching timed out (fa80852 .ImageCropperActivity (server)
is not responding. Waited 10005ms for FocusEvent(hasFocus=false))

When it happens: Going from UserInfoActivity to ImageCropperActivity, and clicking the Save button to save the image to the profile.

What I've tried:

  • The only thing I saw that hasfocus code is the UserInfoActivity has a TextView that has a .FocusChange. I put it in a RunOnUiThread but it doesnt help
  • I have looked into multiple factors, but can't seem to resolve this. I have looked to make sure that the setup for bitmap is done with async before actually adding it to the imageview in the RunOnUiThread.
  • I believe I have any data calls done in async Tasks
  • Added try/catch. It stops it from crashing but the error is still the same
  • Ive tried removing the ConfigureAwait in some areas but that didnt help

UserInfoActivity:

    protected override async void OnActivityResult(int requestCode, Result resultCode, Intent intent)
    {
        base.OnActivityResult(requestCode, resultCode, intent);

        if (resultCode == Result.Ok && requestCode == SELECT_FILE)
        {
            Android.Net.Uri selectedImageUri = intent.Data;

            Intent cropper = new Intent(this, typeof(PApp.ImageCropperActivity));
            cropper.PutExtra("uri", selectedImageUri.ToString());
            StartActivityForResult(cropper, PROFILE_IMAGE_SAVED);
        }
    }

ImageCropperActivity:

    public override async void OnRequestPermissionsResult(int requestCode, string[] permissions, [GeneratedEnum] Permission[] grantResults)
    {
        switch (requestCode)
        {
            case 1:
                {
                    if (grantResults.Length > 0 && grantResults[0] == Permission.Granted)
                    {
                        await System.Threading.Tasks.Task.Run(() => SaveBitmap());
                    }
                    else
                    {
                    }
                    return;
                }
        }
    }
0

There are 0 best solutions below