How to unlock the pattern locked device through appium?

have tried this but it did not unlock my android phone:

@Test
public void Tc3_Unlock_Pattern() throws Exception {
System.out.print(“TC3:Unlock pattern”);
Runtime.getRuntime().exec(“adb shell input swipe 257 1235 572 1235”);
Thread.sleep(500);
Runtime.getRuntime().exec(“adb shell input swipe 572 1235 260 1564”);
Thread.sleep(500);
Runtime.getRuntime().exec(“adb shell input swipe 260 1564 532 1504”);
Thread.sleep(500);
System.out.print(“TC3:Executed Successfully”);
}

.I even tried this but it did not work:

Integer x_topLeftCorner=257;
Integer y_topLeftCorner=1235;

Integer x_topRightCorner=572;
Integer y_topRightCorner=1235;

Integer x_bottomLeftCorner= 260;
Integer y_bottomLeftCorner=1438;

Integer x_bottomRightCorner=532;
Integer y_bottomRightCorner=1504;

//Use coordinates to draw the security pattern and unlock the screen 
TouchAction obj = new TouchAction(MBase.getDriver()); 
obj.press(x_topLeftCorner,y_topLeftCorner).moveTo(x_topRightCorner,y_topRightCorner).moveTo(x_bottomLeftCor