[JAVA] How to capture Android GameActivity mainView (screen capture)?

I’m trying to implement screen shot sharing on Android device through Android Intent feature. But I’m stuck on making in-game screenshot.
I want this feature to be working in shipping build so can not use UE High Resolution Screenshot feature. Also it’s required to have flexible control under all steps in one place (java code).

My way to make screenshot is to draw GameActivity mainView to Canvas and save it to file. But any attempt to make view.draw(canvas) provides black screen.
I’ve tried to do this in main thread, in UI thread, tried every accessible view in the GameActivity.java class but there is always one result - black screen.

My UPL extension:

<gameActivityClassAdditions>
        <insert>
            <![CDATA[
    public void AndroidThunkJava_ShareSheet(String text, boolean shouldMakeScreenshot)
    {
              ...
              Bitmap bitmap = Bitmap.createBitmap(300, 300, Bitmap.Config.ARGB_8888);
              Canvas canvas = new Canvas(bitmap);
              // canvas.drawColor(Color.WHITE);
             mainView.getRootView().draw(canvas);

             File mPath = new File(getExternalFilesDir(Environment.DIRECTORY_PICTURES), "score.png");
             FileOutputStream fOut = new FileOutputStream(mPath);
             int quality = 100;
             bitmap.compress(Bitmap.CompressFormat.PNG, quality, fOut);
             fOut.flush();
             fOut.close();

             Uri pictureUri = FileProvider.getUriForFile(_activity, "com.example.app.provider", mPath);
             ...
    }]]>
        </insert>
    </gameActivityClassAdditions>

Without drawing view into canvas everything works right: App is sending picture with default color. So I think the problem is in the view.draw() method.
Have anyone tried to capture unreal engine GameActivity view to file (make screenshot)? I have no idea what is going wrong…