Clarificaton question would be if the question refers to Google's Android mobile OS or devices such as the Pixel 2 that are manufactured by Google.
The reason why google was in the Android mobile business to begin with was to protect its primary revenue source which is search & advertizing. Google has dominated the search space for over a decade in the PC and desktop environment. With the proliferation of smart phones search for products and purchase decisons are being made more often on consumer mobile devices as opposed to traditional PCs.
Looking at Porter’s 5 forces, Google wanted to avoid a supplier such as Apple completely dominating the mobile OEM market and potentially controlling Google's access to consumers and advertisers. Hence as a defensive move Google entered the Android OS market and was giving it away for free and making up for it mobile-advertising dollars.
However, with a wide range of OEM manufacturers for Android OS based mobile devices, there is a fragmentation in quality for consumers, and experience for developers. Also, many OEM manufacturers default their own applications popularly called bloatware on the devices they build further diluting customer experience and impacting the prominence of Google's applications. Hence, Google has made its own devices such as the Pixel 2 to further control a portion of the mobile market. This might also be a move to establish a complete ecosystem of devices with the Google Home, Chrome books, and Chromecast devices.