Google's decision to partially cut off Huawei devices from its Android operating system has presented the Chinese tech titan with one of its most dramatic challenges yet: how to keep up with the competition if it cannot use the platform that powers nearly every other smartphone in the world?
It is a possibility for which the Shenzhen-based firm, the world's second-largest smartphone maker by sales, has been preparing for years -- reportedly since 2012 -- by building an operating system of its own.
Huawei has acknowledged its existence, but the platform remains shrouded in mystery.
"We have prepared our own operating system. If it should be the case that we can no longer use these systems (like Android)... we would therefore need to be well-armed," Richard Yu, CEO of Huawei's Consumer Business Group, told German newspaper Die Welt in an interview published in March.
"That is our Plan B. But we would of course prefer to work together with the ecosystems provided by Google and Microsoft."
That system could now become more important than ever to Huawei.
Washington last week imposed a ban on the sale or transfer of American technology to the firm -- which could impact hundreds of millions of Huawei phones and tablets around the world.
Google has said it will comply with the US restrictions, and bar Huawei from access to some core components of Android and its proprietary services.
While both Google and Huawei have reassured users that their phones will continue to function as normal, this could present major problems for Huawei, and apps on its phones could become unusable if it does not have access to code licensed by Google to phone makers.
And if the ban is not lifted, it could also run into trouble when the next version of Android is rolled out, because Huawei would not have the kind of access enjoyed by its rivals such as Samsung.
Its own platform, currently undergoing trials, is named "HongMeng" and "will gradually replace the Android system", China's state-owned Global Times said Monday, citing other local media reports without more details.
- 'Exceptionally difficult' -
In developing a possible successor to Android on its devices, Huawei is attempting something other industry behemoths like Microsoft and Samsung have failed to do: create a platform that attracts both users and app developers.
The technical development is just one aspect of the challenge, analysts say. It takes years to build trust and confidence among app makers to write and sell software on the platform, and to convince users to adopt it.
Building an operating system "is exceptionally difficult to do well and to do successfully", said Ryan Whalen, deputy director of the Law and Technology Centre at the University of Hong Kong.
"Just look to players like Nokia, BlackBerry and Microsoft that have all failed recently in similar endeavours," he told AFP, adding that Huawei would have to deal with a "competitive disadvantage" as its rivals will feature core Android services.
Without full access to Android and popular Google services, Huawei -- which has launched its products at glitzy ceremonies in major markets around the world -- could find it difficult to convince customers to choose its phones over those pushed by rivals.
Microsoft pulled the plug on its Windows Phone platform earlier this year, and Samsung's Tizen system is barely known compared with Android and Apple's iOS, which runs iPhones and iPads.
Huawei knows "that being a big telecom company, you have to have your own core technology eventually", Wong Kam Fai, a professor at the Chinese University of Hong Kong, told AFP.
"They have it, but they are not ready for production yet. It would have been better if this thing happened two or three years later, but it is happening now so they just have to speed up."