Repository: AvaloniaUI/Avalonia
File: src/Android/Avalonia.Android/Platform/SkiaPlatform/TopLevelImpl.cs (C#)

Code before:
                    canvas.DrawColor(Color.Transparent, PorterDuff.Mode.Clear!);
                }

                base.DispatchDraw(canvas);
            }

            protected override bool DispatchGenericPointerEvent(MotionEvent? e)
            {
                var result = _tl._pointerHelper.DispatchMotionEvent(e, out var callBase);
                var baseResult = callBase && base.DispatchGenericPointerEvent(e);

                return result ?? baseResult;
            }

            public override bool DispatchTouchEvent(MotionEvent? e)
            {
                var result = _tl._pointerHelper.DispatchMotionEvent(e, out var callBase);
                var baseResult = callBase && base.DispatchTouchEvent(e);

                return result ?? baseResult;
            }

            public override bool DispatchKeyEvent(KeyEvent? e)
            {
                var res = _tl._keyboardHelper.DispatchKeyEvent(e, out var callBase);
                var baseResult = callBase && base.DispatchKeyEvent(e);

                return res ?? baseResult;
            }

            void ISurfaceHolderCallback.SurfaceChanged(ISurfaceHolder holder, Format format, int width, int height)
            {
                var newSize = new PixelSize(width, height).ToSize(_tl.RenderScaling);

                if (newSize != _oldSize)
                {
                    _oldSize = newSize;
                    _tl.OnResized(newSize);
                }

                base.SurfaceChanged(holder, format, width, height);
            }

            public sealed override bool OnCheckIsTextEditor()
            {
                return true;
            }

            private Func<TopLevelImpl, EditorInfo, IInputConnection>? _initEditorInfo;

            public void InitEditorInfo(Func<TopLevelImpl, EditorInfo, IInputConnection> init)

Review comment (suggestion):
I don't think that `RequestCompositionUpdate` is the best equivalent for "ImmediateRenderRequested, but async". But I think it's close enough for resizing and screen rotation.

Code after:
                var newSize = Size.ToSize(Scaling);
                var newScaling = Scaling;

                if (newSize != _oldSize)
                {
                    _oldSize = newSize;
                    _tl.OnResized(newSize);
                }
                // ReSharper disable once CompareOfFloatsByEqualityOperator
                if (newScaling != _oldScaling)
                {
                    _oldScaling =  newScaling;
                    _tl.ScalingChanged?.Invoke(newScaling);
                }
            }

            public override void SurfaceRedrawNeeded(ISurfaceHolder holder)
            {
                // Compositor Renderer handles Paint event in-sync, which is perfect for sync SurfaceRedrawNeeded
                _tl.Paint?.Invoke(new Rect(new Point(), Size.ToSize(Scaling)));
                base.SurfaceRedrawNeeded(holder);
            }

            public override void SurfaceRedrawNeededAsync(ISurfaceHolder holder, IRunnable drawingFinished)
            {
                _tl.Compositor.RequestCompositionUpdate(drawingFinished.Run);
                base.SurfaceRedrawNeededAsync(holder, drawingFinished);
            }

            public override bool OnCheckIsTextEditor()
            {
                return true;
            }

            private Func<TopLevelImpl, EditorInfo, IInputConnection>? _initEditorInfo;

            public void InitEditorInfo(Func<TopLevelImpl, EditorInfo, IInputConnection> init)
            {
                _initEditorInfo = init;
            }

            public override IInputConnection OnCreateInputConnection(EditorInfo? outAttrs)
            {
                return _initEditorInfo?.Invoke(_tl, outAttrs!)!;
            }
        }

        public IPopupImpl? CreatePopup() => null;

        public Action? LostFocus { get; set; }
        public Action<WindowTransparencyLevel>? TransparencyLevelChanged { get; set; }