Remove use of internal gradle OperatingSystem class.
Remove use of internal gradle OperatingSystem class.

This CL copies the logic out of OperatingSystem and just
uses it directly to avoid calling into an internal gradle class.

Test: ./gradlew clean still works on ubuntu and my macbook
Change-Id: I47c3af9f8f7d66e050723ee97ff22b799d719b13

aosp-mirror/platform_frameworks_support,aosp-mirror/platform_frameworks_support,androidx/androidx,androidx/androidx,androidx/androidx,AndroidX/androidx,AndroidX/androidx,androidx/androidx,androidx/androidx,aosp-mirror/platform_frameworks_support,androidx/androidx,AndroidX/androidx,androidx/androidx,androidx/androidx,AndroidX/androidx,AndroidX/androidx,aosp-mirror/platform_frameworks_support,AndroidX/androidx,AndroidX/androidx,androidx/androidx,AndroidX/androidx,aosp-mirror/platform_frameworks_support,androidx/androidx,AndroidX/androidx,AndroidX/androidx