In late 2011, Facebook found itself in a terrifying position for a soon-to-be-public tech company: It was behind.

After months of planning, Facebook had just wrapped up its annual F8 developer conference, a chance to show off new products and features to a room full of partners and press. The unveiling, which came on the heels of a company-wide “lockdown” following the unexpected announcement from earlier that summer that Google was building its own social network, was well received. Facebook demoed a newly designed user profile — they called it “Timeline” — and comedian Andy Samberg kicked off the event with a Saturday Night Live-style impersonation of CEO Mark Zuckerberg, complete with signature black zip-up hoodie.

But as the dust settled on F8 and Facebook executives started to look ahead to what was next, the company’s problem was suddenly obvious: While Facebook had been heads-down for nine months building and preparing for its big conference, the rest of the world was rapidly moving toward smartphones and mobile devices. Facebook, too, was growing quickly on mobile phones, but wasn’t prioritizing them at all internally. Facebook still thought of itself primarily as a desktop service, and nearly everything it unveiled at F8 was built for the web.

Facebook had mobile apps for iPhones and Android phones, but they were built using the technology known as HTML5 — a relatively new software language good for building web pages but not for building apps native to iOS and Android devices. Facebook had universalized its code, using the same technology for all of its services instead of building apps specifically designed for each operating system. As a result, the apps were buggy, slow, and prone to crashes.

As Zuckerberg would admit two years later: “We took a bad bet.”

What happened next has gone down in Facebook lore. In early 2012, Zuckerberg redirected the entire company to focus on mobile. He all but abandoned his laptop and started working primarily from a mobile device. Product managers disabled their own desktop versions of Facebook, forcing themselves to use the mobile version instead. In meetings, Zuckerberg expected employees to present the mobile version of new products first. If they didn’t, the meeting was over. Facebook hired new iOS and Android engineers, held week-long bootcamps to get their existing employees up to speed, and embedded mobile engineers onto every product team at the company.

Zuckerberg even wrote the shareholder letter for the company’s IPO filing — all 2,000-plus words of it — on his phone. Facebook was all in on mobile.

That company-wide pivot — despite the bad timing, considering the then-looming IPO — is widely considered the most important move in Facebook’s history. It was a recognition by Zuckerberg that mobile, not desktop computers, was the next great platform. If Facebook wanted to survive, it would have to do so by riding that mobile wave. Today, with a market cap over $500 billion and more than 2.3 billion users worldwide, it has been a sweet ride.

Eight years later, Facebook is going through another pivot. Mobile devices are still far and away the most popular way people use Facebook services, but after two years of privacy debacles, misinformation campaigns, and political polarization, how they interact with those services is starting to change

Private messages and disappearing Stories — popular on Facebook-owned Instagram and WhatsApp — are in. The mostly public, mostly permanent, social network on which Facebook built its empire is reaching a plateau. The Facebook app is no longer growing in the US or Europe. Some estimate that the social network’s user base is actually shrinking. Zuckerberg’s recent announcement that the company is shifting toward private, encrypted messaging is the most striking sign yet that Facebook and News Feed are no longer the company’s future.

“If you look at the ways that people are interacting now online that are growing the fastest, it’s messages, it’s small groups, and it’s ephemeral stories. And these all have the property that they’re more private than these digital town square-type equivalents,” Zuckerberg said in an interview with Axel Springer CEO Mathias Döpfner that was published in April. “So I don’t know whether you call this a pivot ... but it’s clear that this is the next big thing people want to get built.”

Facebook’s core social network isn’t going away anytime soon, but there’s a good chance — probably a great chance — that the way you use Facebook’s products in 10 years will look and feel very different from the way you use them today. The device you use it on? That may change too.

Zuckerberg isn’t just thinking about that reality, he’s already betting on it. He acquired the virtual reality headset maker Oculus for $3 billion back in 2014. He’s building augmented reality glasses, and Facebook launched a video chat device for the living room last November meant to rival other in-home devices, like Amazon’s Echo and Google’s Home. CNBC reported this month that Facebook is even building its own voice assistant, and the company has a blockchain team working on secure payments through digital tokens, presumably akin to bitcoin.

Zuckerberg has even talked openly about the idea that, one day, you may be able to type messages using only your thoughts — no keyboard necessary. “That’s going to be an interesting thing down the line,” he said rather casually of the mind-reading technology during a conversation at Harvard in February.

Most of this technology is still unavailable to consumers, and the stuff that is available — Oculus and Portal — you likely use sparingly if at all. It’s clear that nailing private messaging is Facebook’s current challenge, but if the company is still relevant a decade from now, messaging will probably just be one of multiple pivots the company has to make. It’s possible the physical technology people use Facebook on will change, too. You might connect with friends through a VR headset or through AR glasses. Maybe voice commands will be the dominant way people interact online, through devices like in-home speakers. If so, Facebook will need to adjust accordingly.

It’s anybody’s guess which technology platform will dominate, but Facebook and Zuckerberg are trying to avoid another mad scramble.

“The one advantage Facebook has, and it’s the same advantage Google had, is they just have a really profitable business, tons of cash, so they can really experiment in a way that very few other companies can,” says Mark Mahaney, a Wall Street analyst covering the tech industry for the investment bank RBC Capital Markets. “They can throw a lot more stuff up against the wall. They can easily afford to do that. God, that’s a good position [to be in].”

Project Oxygen

Facebook employees use a lot of code names. Most new projects and initiatives have one — the new wireless virtual reality headset Oculus unveiled last September was previously codenamed “Santa Cruz.” Other hardware projects at Facebook have used code names like “Ripley,” “Sequoia,” and “Aloha.”

Project “Oxygen,” though, isn’t code for a fun new hardware device. It’s Facebook’s plan to protect itself against Google.

Located less than seven miles south down the freeway from Facebook’s sprawling Menlo Park, Calif., campus, Google has been Facebook’s greatest threat for the better part of the company’s existence, especially in the social network’s early days. In fact, Facebook employees still use Microsoft Outlook for email and Quip for document sharing, instead of Gmail and the suite of Google document services the company used to use until around 2012 because, former employees say, Facebook executives never trusted Google. (Though it sounds as though the company is finally considering a return to Google products.)

In 2011, when Google announced Google Plus, its own social network intended to kill off Facebook, Zuckerberg immediately called the company together and told them “Carthago delenda est,” Latin for, “Carthage must be destroyed,” according to Chaos Monkeys, a book by former Facebook ad exec Antonio Garcia Martinez. It was a call to arms credited to ancient Roman senator Cato the Elder, who inspired his countrymen to crush Rome’s rival in battle.

(Zuckerberg’s war cry must have worked. Within a few years, Google Plus was all but forgotten. It formally shut down earlier this month.)

But Oxygen, according to four sources familiar with the plan, is intended as a defense against a bigger, longer-term issue that Google created for Facebook: As the owner of the Android operating system — and thus the Google Play store where billions of people around the world can download Facebook’s products — Google has a virtual chokehold over Facebook’s distribution. Oxygen is the “break glass in case of emergency” plan Facebook put in place in case Google ever decides to suck all the oxygen out of the room.

The plan was created around 2013, sources say, a time when Facebook was still very much transitioning to mobile and worried about Google’s leverage. It’s unclear how necessary Oxygen is today, though in the past the plan included ways to ensure people can access the Facebook app on Android phones outside the Google Play Store, according to former employees. That includes strategies like sideloading, which would let people download an Android app from a mobile web browser instead of the Play Store, for example.

The mere fact Oxygen existed at all is a reminder that, as dominant as Facebook has been on mobile, the company’s original sin is that it has never owned the phone or the operating system necessary to deliver its services to people. Facebook is, essentially, reliant on Google and Apple.

“There’s a duopoly in mobile, and they control distribution,” explained one former Facebook exec. “If they wanna pull you off the App Store, they can do that. That’s a lot of control.”

Zuckerberg acknowledged this weakness as recently as last spring.

“One of my great regrets in how we’ve run the company so far is I feel like we didn’t get to shape the way that mobile platforms developed as much as would be good,” he said on a company earnings call last April. “IOS and Android, they came out around 2007, we were a really small company at that point — so that just wasn’t a thing that we were working on.”

Numerous executives who have worked with Zuckerberg say he can be paranoid about the competition — a paranoia that can be felt among the rest of Facebook’s employees. Before Facebook’s IPO, Zuckerberg left a book on every employee’s desk full of inspirational quotes, according to Wired. One near the back of the book read, “If we don’t create the thing that kills Facebook, someone else will.” Like any successful business executive, Zuckerberg is constantly looking for leverage over potential competitors, especially Google and Apple.

The Slayer Phone

Facebook’s leverage today is its size. Its apps and products are simply too popular for Google or Apple to mess with. They need Facebook’s services on their respective platforms, otherwise users won’t want to use them. Given the current regulatory environment, it’s also hard to imagine Apple or Google would ever pull Facebook from their respective stores; it would look very anti-competitive. (Apple did, however, fire a shot across the bow: In January, after revelations that a Facebook “research program” was collecting data — a violation of Apple’s terms of service — it revoked Facebook’s special access to publish internal app versions, basically shutting the company down for a day.)

But back in 2010, before Facebook had that leverage, its dependence on Apple and especially Google started to grow and worry Facebook’s executives. The company tried to gain leverage in another way: It decided to build its own phone and operating system to compete.

Codenamed “Slayer,” a portmanteau of the phrase “social layer” and later renamed “Buffy” (as in Buffy the Vampire Slayer), Facebook set out to build an all-in-one smartphone device. Imagine iPhone, but from Facebook. The effort, led by Chamath Palihapitiya — then a Facebook product and growth executive and now a well-known venture capitalist — quickly ran into engineering challenges and barely made it past the prototype stage. The hardware wasn’t in Facebook’s wheelhouse and the operating system was a bigger lift than expected. Perhaps wisely, Facebook decided that competing with incumbents like Google and Apple on mobile operating systems was a tall order. “You don’t bring a knife to a gun fight,” explained one former employee.

So Facebook decided instead to work with HTC to try and build a phone with the Facebook’s social features built in. What Facebook ultimately launched was a drastically scaled-down version of the original phone plan: a software program called Facebook Home that brought Facebook pictures and status updates directly to the phone’s home screen on Android phones. It came pre-loaded on one type of HTC phone but never gained any traction. It was a monumental flop.

The experience, though, left a lasting impression on Facebook’s executive team. The fact that Facebook did not own the core device on which its app is accessed was seen as a serious problem, one it didn’t want to encounter the next time around. It was a major reason Zuckerberg decided to buy Oculus well before virtual reality was an established, mainstream platform, according to those who have worked with him.

“We still have a lot of work to do on mobile, but at this point we feel strong enough in our position that strategically we also want to start focusing on building the next major computing platform that will come after mobile,” Zuckerberg said on a 2014 analyst call announcing the purchase of Oculus. “Today’s acquisition is a long-term bet on the future of computing.”

Finding the next smartphone

Four years in, it’s clear that virtual reality is not the next big platform Zuckerberg once believed it might be. At least not yet. Market research company IDC estimates that 8.9 million AR and VR headsets will ship globally in 2019. For comparison, IDC also expects 1.8 billion smartphones to ship this year. VR clearly has a long way to go.

But Zuckerberg has learned his lesson from Facebook’s early mobile struggles. Even if Oculus turns out to be the hardware equivalent of Facebook’s early HTML5 mobile apps, it’s far from the only bet Zuckerberg is making.

In addition to Oculus, which has unveiled four different iterations of its virtual reality headset, Facebook has a number of other hardware projects in the works. Last October, it launched an in-home video chat device, Portal, meant to compete with Amazon’s Echo and Google’s Home. The company is also building some kind of video-calling device for your TV; a digital projector code-named “Sequoia,” according to Cheddar; and has talked publicly about its research into converting human thoughts directly into text on a screen. That last one might be a bit far off.

But one of the most nascent, and perhaps most important, of these bets is a pair of augmented reality glasses that Facebook first announced last spring. The public has yet to see a working prototype, but what augmented reality offers that virtual reality doesn’t is mobility. Virtual reality is great for immersing yourself in another world while while sitting on your couch. Augmented reality, however, would be able to overlay digital objects onto the physical world around you. The thinking is that, like your mobile phone, augmented reality glasses will be portable enough to become a near-constant part of your everyday life.

For Facebook, betting on virtual reality is a stepping stone of sorts to augmented reality.

“We can’t build the AR product that we want today, so building VR is the path to getting to those AR glasses,” Zuckerberg told Recode last April.

AR glasses have been a dream for a lot of companies, not just Facebook. Google tried and failed to gain any traction with Google Glass. Microsoft is building its own AR glasses called HoloLens, and Magic Leap, which has taken investment from Google, is also building glasses. They aren’t very fashionable.

But imagine walking into a party wearing your Facebook AR glasses. They’ll be able to recognize the people around you using facial recognition technology — even people you’ve never met — and will display their Facebook profile next to their face, hovering for you to see through the glasses but completely invisible to anyone else.

It’s the kind of creepy science-fiction scenario that doesn’t yet exist, but certainly could one day. And if it does, Facebook wants to own those glasses. And better yet, the software that powers the glasses. And you can bet that glasses made by Google (or Amazon or Apple or Microsoft) would likely display something very different from a Facebook profile.

That reality and who will control it are still a long way off.

“We’re kind of driving blind in a sense right now, at least in my opinion, in terms of what’s going to happen with interfaces past the touchscreen devices that we have,” says Michael Sayman, a former Facebook product manager who spent three years helping the company better understand and build products for young people before leaving for Google in late 2017. “It’ll take one of those [moments like], “Oh my gosh, we had no idea this was going to be a thing but now it’s obvious.” I think that kind of a moment will have to happen at some point in the next 10, 15 years.”

At Facebook’s annual F8 conference in 2016, Zuckerberg laid out a 10-year roadmap for the company that he’s referenced numerous times since. The roadmap lists AR and VR as part of the long term plan — the part that’s 10 years out — and mentions them in the same category as Facebook’s internet connectivity efforts. Still, it’s possible that AR or VR never materialize in any mainstream way.

“I don’t know exactly when it’s going to be a big deal,” Zuckerberg said of virtual reality last April. “I think the reality is Facebook needs to be investing before it is a big thing in order to build some of the muscles to be competitive.”

Can Facebook get out of its own way?

Mark Zuckerberg is known as one of the greatest product builders in Silicon Valley history. A more apt description, perhaps, may be that Zuckerberg is one of the best product thinkers.

Many of Facebook’s most valuable products weren’t invented by Facebook or Zuckerberg; the company merely perfected them. Instagram, for example, was a $1 billion purchase back in 2012 with just 30 million users. It now has over 1 billion users, and SunTrust estimates it will bring in almost $16 billion in revenue this year.

WhatsApp, the encrypted messaging service that suddenly looks like the blueprint for Facebook’s future, was a $19 billion acquisition back in 2014 with 450 million active users. Now it has more than 1.5 billion users. Stories, the disappearing photo and video product that Facebook built into all of its apps, was originally invented by Snapchat. On Facebook’s apps, hundreds of millions of people use Stories every day.

Knowing what to buy and what to copy takes skill, and Zuckerberg has proven to be the best fast follower in tech. If private messaging is indeed the next big wave of communication — and who’s to say it won’t be? — Zuckerberg laid the groundwork for that four years ago when he acquired WhatsApp and spun out Facebook Messenger into its own standalone product, a signal that it was important enough to exist outside of the core app. Now he’s trying to link all of the company’s messaging features to combine their respective user bases into one massive network.

“When we bought WhatsApp for $19 billion I was like, ‘Really?’ And, “We [already] have a messaging system,’” jokes Mike Rognlien, who spent seven years at Facebook working on human resources projects like new hire orientation and employee onboarding. “But that’s one of the things that’s really brilliant about Mark [Zuckerberg] and the leaders that he surrounds himself with. He can see around corners that you don’t even know exist.”

Even if Zuckerberg has identified the next big wave, having a plan is different from executing a plan — and Facebook has two major obstacles working against it.

The first is that Facebook has lost an incredible amount of user trust in the past two years. Between Facebook’s role in the 2016 US presidential election, the Cambridge Analytica scandal, and the near-constant privacy and user-data mishaps, Facebook doesn’t look like the kind of company you want controlling the screens and devices you use on a daily basis.

Public criticisms of Facebook have even come from former employees who built their fortunes thanks to the company’s success. Brian Acton, the WhatsApp co-founder who made billions on the acquisition, encouraged people to “#deletefacebook” last spring. And Palihapitiya, the same Palihapitiya who worked on the Facebook phone, told a group at Stanford that social media was “ripping apart the social fabric of how society works.”

Burghardt Tenderich spent over a decade doing public relations for tech companies primarily in Silicon Valley before joining the University of Southern California as a PR professor in 2010. He teaches his students about corporate communications, and says Facebook comes up “on a daily basis” in his teachings and research. Tenderich says he’s noticed a dramatic change in public perception for Facebook and its tech peers since the 2016 US presidential election.

“By default, tech companies and web companies were a good thing,” he says, referencing the public perception from a few years ago. “But then we’ve seen a complete turnaround where trust has completely eroded.”

Tenderich believes Facebook’s trust issues are so deep they could have a “tremendously negative impact” on the company’s ability to sell hardware devices moving forward.

“When you told me you were writing a story about Facebook entering the hardware market, I instinctively thought and felt right away: ‘Oh my God, I would be scared of that,’” he said in an interview with Recode. “They will now be physically in my home or in my hands. And they will probably be able to encroach on my privacy even more.

“They would be met with fear, cynicism, anger, and would create a very tremendous PR problem.”

The second potential obstacle for Facebook is that it has become Washington’s favorite big-tech punching bag. Facebook is being sued or investigated by nearly every three-letter government agency you can think of. The FTC is investigating Facebook’s data policies, and so are the DOJ and the FBI. HUD, meanwhile, is suing Facebook for allegedly perpetuating housing discrimination through its targeted advertising products. And a slate of politicians are dreaming up ways to hold Facebook and its data-powered ad business to account.

So far, Facebook has taken the punches in stride, and Zuckerberg is even leaning into the idea. He published an op-ed in the Washington Post in March outlining areas he actually wants Facebook to be regulated — areas like harmful content, election integrity, privacy, and data portability.

The goal seems to be to shape the regulation rather than fight it, a move that might even give Facebook a competitive advantage.

“We view this move as very shrewd and positive for Facebook over time,” wrote SunTrust analyst Youssef Squali after Zuckerberg’s op-ed. “It puts the onus of resolving these issues on regulators, [and] Facebook has clearly invested the most time, effort and money trying to address these issues.

“As a result it is likely best positioned to comply with the rules once set up by regulators,” he continued.

Squali pointed out GDPR, the new European privacy laws meant to hold big tech companies to account for their data practices, has been a non-factor for Facebook — despite a lot of buildup and concern for its potential impact. “GDPR has had virtually no negative affect on Facebook so far in terms of user growth or monetization,” Squali concludes.

Facebook’s data practices aren’t the only part of the business drawing scrutiny from Washington, though. There are some who believe Facebook is too big. When Zuckerberg testified before Congress last April, he was asked multiple times if Facebook was a monopoly. He had trouble even naming a single Facebook competitor. Sen. Elizabeth Warren, who is running for president, wants to break up Facebook and unravel its different apps and businesses. Ben Thompson, founder of the influential tech newsletter Stratechery, called Facebook’s acquisition of Instagram the “greatest regulatory failure of the last ten years.”

Doug Melamed spent five years at the Department of Justice in the antirust division in the late ’90s under President Bill Clinton, then served as the general counsel at Intel before joining Stanford’s Law School as a professor back in 2014. He believes it would be a “real long shot” that regulators would dismantle Facebook entirely the way Warren and others might hope, though he does believe tech mergers like Facebook’s acquisition of Instagram will get more attention than before.

“I would certainly hope, frankly, that the agencies would be more aggressive,” Melamed said in an interview with Recode. “And if they find the right case would go into court to try and push the boundaries of the law a little bit there.”

What will be harder to measure will be the deals that don’t materialize at all. Facebook has stayed on top over the years thanks to shrewd acquisitions. Facebook may be able to hold onto Instagram and WhatsApp, but more scrutiny from antitrust regulators may make it harder to do deals moving forward.

“Both buyers and sellers will look at this as a longer, more problematic road and may pull back a little bit from some deals they otherwise would have pursued,” Melamed added.

But even if regulatory efforts don’t hurt Facebook’s business today, they could have consequences down the road. Writing op-eds, assisting government investigations, and constantly explaining data and security mishaps take a lot of time and attention. In the fast-paced world of consumer tech, those distractions could hurt Facebook in ways it doesn’t even realize until it’s too late.

“The absolute sheer, utter level of distraction that they have going on,” said one former executive, “what are they gonna miss?”

At the end of Zuckerberg’s keynote at F8 2011, he talked about Moore’s Law, the idea that computing power will grow exponentially, and said that Facebook was preparing for a future where the amount that people share grows exponentially, too. “We can look into the future, and we can see what might exist, and it’s going to be really really good,” he said.

When Zuckerberg took the stage at F8 2018 nearly seven years later, he spoke not just about preparing for the future, but about building it in a way that aligns with Facebook’s products.

“When I look out today, it still surprises me how little of the technology that our industry produces is designed to put people first. Our phones are designed around apps, and that’s not how people think,” he said. “I believe that we need to design technology to help bring people closer together. And I believe that that’s not going to happen on its own.”

“The world,” he continued, “isn’t moving in this direction by itself. So that is what we are all here to do.”

Recode and Vox have joined forces to uncover and explain how our digital world is changing — and changing us. Subscribe to Recode podcasts to hear Kara Swisher and Peter Kafka lead the tough conversations the technology industry needs today.