Writing Mat from AndroidBitmapGetPixels saves black image

I am trying to take Screenshot of android app screen using Bit map and passing the Bitmap to JNI. Then creating mat out of pixels got from AndroidBitmap_lockpixels. Black image was found while writing the mat to sdcard.
Below is my code snippet:
Java:

public Bitmap getPixesOfImage(){
	View view = MainActivityProvider.getTestActivity().getWindow().getDecorView().getRootView(); //Test app view
	Display display = view.getDisplay();
    Point size = new Point();
    display.getSize(size);
    int width = size.x;
    int height = size.y;
    view.setDrawingCacheEnabled(true);
    Bitmap bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
    view.setDrawingCacheEnabled(false);
    return bitmap;
}

JNI:

cv::Mat mat;
void * bitmapPixels;
AndroidBitmapInfo bitmapInfo;
int ret;
AndroidBitmap_getInfo(mCurrentJavaEnv, bitmapObj, &bitmapInfo); //mCurrentJavaEnv, bitmapObj values are skipped here. 
if ((ret = AndroidBitmap_lockPixels(mCurrentJavaEnv, bitmapObj, &bitmapPixels)) < 0) {
    LOGE("AndroidBitmap_lockPixels() failed ! error=%d", ret);
}
AndroidBitmap_unlockPixels(mCurrentJavaEnv, bitmapObj);
mat = cv::Mat(bitmapInfo.height, bitmapInfo.width, CV_8UC4, bitmapPixels);
bool imageStored = cv::imwrite("/storage/emulated/0/test.png", mat); //This returns true and can see image(black)

Anything wrong here other than exception handling?
I could see dimension and columns values of Mat are not matching with actual bitmap.width.

can you explain, how any actual pixels go into your bitmap ?
(it seems to be entirely empty in your java function already)

I was able to save it as png while running java code separately and image looks fine. Can you tell me what piece I am missing to not include pixels as part of bitmap? May be I am wrong