https://rootmygalaxy.net/bypass-pattern-unlock-on-android-via-adb-commands/

USB Debugging must be Enable

  1. Ensure that Unknown Sources is enabled previously on your Android device. Also, make sure you have the proper ADB software installed on your PC, alongside the drivers.

  2. Connect your Android device to your computer, and launch ADB in the CMD window.

  3. Next, issue the following commands :

    adb shell
    cd /data/data/com.android.providers.settings/databases
    sqlite3 settings.db
    update system set value=0 where name='lock_pattern_autolock';
    update system set value=0 where name='lockscreen.lockedoutpermanently';
    .quit
    
  4. Reboot your Android device, and your pattern unlock should still be there, but you can unlock your device with any pattern you like, so you can disable it or set a new one later on.

  5. If the above command doesn’t work for you, issue the following command instead :

    adb shell rm /data/system/gesture.key
    
  6. Even in this case, after rebooting, whichever pattern you decide to put in will be registered, and you can either disable or set a new one.