A report published by Bloomberg offers additional details into Apple's ongoing battle with the FBI, including how the company has worked in private with government agencies in the past to provide access to court-ordered data.

The encryption issue started gaining traction following the launch of iOS 8, which altered the way data was encrypted, making it impossible for external agencies — and even Apple — to gain access to the device once a passcode was set. From Bloomberg:

Apple gave the Federal Bureau of Investigation early access to iOS 8 so it could study how the new system would change evidence-gathering techniques, according to people familiar with the software's development. The agency quickly realized Apple had closed an important access point used for years by agents to collect information about criminal suspects. Many in the FBI were stunned. Suddenly, photos, text messages, notes and dozens of other sources of information stored on phones were off-limits.

The new encryption protections set off a behind-the-scenes battle that ultimately spilled into the open last month, when a California judge granted the Justice Department an order requiring Apple to help the FBI unlock an iPhone used by one of the shooters who killed 14 people in San Bernardino, California.

At times, Apple and the White House enjoyed good ties, even working together to persuade China not to force phone makers to give authorities a key to unlock a handset's encryption. The administration also didn't give in to FBI lobbying for new legislation that would make it easier to unlock data on mobile devices with warrants.

According to the publication, the FBI was close to getting legislation passed that would've made it easier for the agency to access encrypted data on locked phones through court orders. However, Snowden's revelations in 2013 put a dent in its plans:

Officials were close to an agreement on legislation to update communications and privacy laws in 2013, but the Snowden revelations blew up the deal, according to a former U.S. official. After that, there was never again a serious effort to pass the legislation, the official said.

Even though new legislation did not come into effect regarding privacy, Apple continued to work with the FBI in private, including providing iCloud backups and sending engineers to assist in data recovery in the San Bernardino case:

Even as the behind-the-scenes debate simmered, Apple continued to work with FBI agents when issued a warrant for evidence that could be accessed on its servers. After the San Bernardino attacks in December, Apple pulled data backed up to its iCloud service from the iPhone used by the shooter, Syed Farook. The company also sent engineers to San Bernardino to help with the data-recovery effort. But when the FBI wanted to override the encryption on Farook's iPhone, the company said it didn't have a special key to unlock the device.

With Apple vehemently denying to create a software utility to unlock the iPhone 5c in question, the FBI decided to take things public:

On Feb. 16, a magistrate judge in Riverside, California, ordered Apple to help the FBI unlock the phone. Apple executives were shocked the agency had gone public. For years, they had worked closely with the agency in private. In at least two previous instances, including a case in Baltimore, the government had decided against seeking a court order forcing Apple to unlock a phone running iOS 8.

Apple officials will testify as part of an evidentiary hearing at 1 p.m. PT on March 22.