BlackBerry's first Android smartphone, the Priv, is doing wonders for the company's stock price.

The stock price popped 7% on news that Walmart and Best Buy sold out of the device online earlier this week.

Best Buy (BBY) did not comment on sales figures, and Walmart (WMT) did not immediately respond to request for comment. But both retailers seemed to have restocked by Friday.

The BlackBerry Priv is a surprise hit given how poorly the rest of BlackBerry's handsets have sold over the past few years.

BlackBerry only has a sliver of the global smartphone market, which is dominated by Android devices and Apple (AAPL) iPhones.

The fact that the BlackBerry Priv runs on Android is probably a huge factor in why the new devices are selling so well.

People who own the Priv get access to many more apps, but they also get to use a slide-out keyboard, which BlackBerry fans love.

Selling a phone that runs on another operating system would have been unthinkable a few years ago. BlackBerry (BBRY) had always vowed to stick to its own software.

Now that the Priv seems to be doing well, BlackBerry might have a chance to keep going. Otherwise, the company may pull out of the smartphone hardware business for good.

"Anyone who has been watching closely at what I've been trying to do at BlackBerry has surely heard me say that we would not stay in the device business if we were not profitable," CEO John Chen wrote in a blog post earlier this year. "That said, we are doing everything possible to make our devices profitable."

-- CNNMoney's Paul La Monica contributed to this report.