Android Device Magnification 3 Taps Automation Issue

Enabled the Touch Zoom in Accessibility Settings. I am able to get the zoom by tapping 3 times manually on the screen. However unable to Automate the same thing with the following code.

        TouchAction action = new TouchAction(getDriver());
        action.press(x,y).release();
        action.press(x,y).release();
        action.press(x,y).release();
        action.perform();

Please suggest any other code snippet that works in this case.