2 Kings 14:17 (ESV)

17 Amaziah the son of Joash, king of Judah, lived fifteen years after the death of Jehoash son of Jehoahaz, king of Israel.

It is likely that Amaziah lived the last fifteen years of his life as a free man. Possibly his son Azariah became co-regent when his father was taken prisoner (see also 2 Kings 14:21). Then that co-regency also lasted during those last fifteen years of Amaziah. It does not say literally that Amaziah still reigned fifteen years, but that he lived fifteen years. Also, notice the very long reign of Azariah—fifty-two years (2 Kings 15:2).

The writer therefore informs us that Amaziah was released from prison. There are exegetics who see the fifteen years of survival of his enemy Joash as a sign of God’s grace. But when you place 2 Chronicles 25:1–28 next to this, that does not seem likely. For a short discussion on 2 Chronicles 25:20, see the commentary on 2 Kings 14:10. And 2 Chronicles 25:27 says that Amaziah had become unfaithful toward the Lord, and that is why he was murdered; and it does not point to repentance at the end of his life.