Update chreGetPlatformId to TARGET_PLATFORM_ID

Also removes related helper functions that are no longer needed.

Bug: 116507498
Test: ./load_chre.sh and verify platform ID via dumpsys
Change-Id: Ib888e411ff7703fa6116dc454b4e1534637f4351
diff --git a/platform/include/chre/platform/platform_id.h b/platform/include/chre/platform/platform_id.h
deleted file mode 100644
index c4c7ce8..0000000
--- a/platform/include/chre/platform/platform_id.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (C) 2016 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * @file
- * Provides platform IDs and versions for implementations of CHRE.
- */
-
-#ifndef CHRE_PLATFORM_PLATFORM_ID_H_
-#define CHRE_PLATFORM_PLATFORM_ID_H_
-
-#include "chre/util/id_from_string.h"
-
-#include <stdint.h>
-
-namespace chre {
-
-//! The vendor ID for Google.
-constexpr uint64_t kVendorIdGoogle = createIdFromString("Googl");
-
-//! The vendor platform ID of the Linux variant is one. All other
-//  Google implementations will be greater than one. Zero is reserved.
-constexpr uint32_t kGoogleLinuxPlatformId = 0x001;
-
-//! The vendor platform ID of the Qualcomm SLPI variant.
-constexpr uint32_t kGoogleSlpiPlatformId = 0x002;
-
-//! Patch level of the current CHRE implementation, defined by the build system
-//! and reported in chreGetVersion().
-constexpr uint16_t kPatchVersion = CHRE_PATCH_VERSION;
-static_assert(CHRE_PATCH_VERSION <= UINT16_MAX,
-              "Patch version must fit in 16 bits");
-
-}  // namespace chre
-
-#include "chre/target_platform/platform_id_impl.h"
-
-#endif  // CHRE_PLATFORM_PLATFORM_ID_H_
diff --git a/platform/linux/include/chre/target_platform/platform_id_impl.h b/platform/linux/include/chre/target_platform/platform_id_impl.h
deleted file mode 100644
index cb7e7cd..0000000
--- a/platform/linux/include/chre/target_platform/platform_id_impl.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Copyright (C) 2016 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef CHRE_PLATFORM_LINUX_PLATFORM_ID_IMPL_H_
-#define CHRE_PLATFORM_LINUX_PLATFORM_ID_IMPL_H_
-
-#include "chre/platform/platform_id.h"
-
-namespace chre {
-
-//! The vendor ID of the Google-provided SLPI platform.
-constexpr uint64_t kVendorId = kVendorIdGoogle;
-
-//! The platform ID of the Google-provided SLPI platform.
-constexpr uint32_t kPlatformId = kGoogleLinuxPlatformId;
-
-}  // namespace chre
-
-#endif  // CHRE_PLATFORM_LINUX_PLATFORM_ID_IMPL_H_
diff --git a/platform/shared/chre_api_version.cc b/platform/shared/chre_api_version.cc
index 83cfe5e..d39704a 100644
--- a/platform/shared/chre_api_version.cc
+++ b/platform/shared/chre_api_version.cc
@@ -16,18 +16,25 @@
 
 #include "chre_api/chre/version.h"
 
-#include "chre/platform/platform_id.h"
 #include "chre/util/macros.h"
 
+static_assert(CHRE_API_VERSION <= UINT32_MAX,
+              "API version must fit in 32 bits");
+
+static_assert(CHRE_PATCH_VERSION <= UINT16_MAX,
+              "Patch version must fit in 16 bits");
+
+static_assert(CHRE_PLATFORM_ID <= UINT64_MAX,
+              "Platform ID must fit in 64 bits");
+
 DLL_EXPORT uint32_t chreGetApiVersion(void) {
   return CHRE_API_VERSION;
 }
 
 DLL_EXPORT uint32_t chreGetVersion(void) {
-  return chreGetApiVersion() | chre::kPatchVersion;
+  return chreGetApiVersion() | CHRE_PATCH_VERSION;
 }
 
 DLL_EXPORT uint64_t chreGetPlatformId(void) {
-  return chre::createPlatformIdFromVendorPlatform(chre::kVendorId,
-                                                  chre::kPlatformId);
+  return CHRE_PLATFORM_ID;
 }
diff --git a/platform/slpi/include/chre/target_platform/platform_id_impl.h b/platform/slpi/include/chre/target_platform/platform_id_impl.h
deleted file mode 100644
index 55d0d52..0000000
--- a/platform/slpi/include/chre/target_platform/platform_id_impl.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Copyright (C) 2016 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef CHRE_PLATFORM_SLPI_PLATFORM_ID_IMPL_H_
-#define CHRE_PLATFORM_SLPI_PLATFORM_ID_IMPL_H_
-
-#include "chre/platform/platform_id.h"
-
-namespace chre {
-
-//! The vendor ID of the Google-provided SLPI platform.
-constexpr uint64_t kVendorId = kVendorIdGoogle;
-
-//! The platform ID of the Google-provided SLPI platform.
-constexpr uint32_t kPlatformId = kGoogleSlpiPlatformId;
-
-}  // namespace chre
-
-#endif  // CHRE_PLATFORM_SLPI_PLATFORM_ID_IMPL_H_
diff --git a/util/include/chre/util/id_from_string.h b/util/include/chre/util/id_from_string.h
deleted file mode 100644
index 5529cd6..0000000
--- a/util/include/chre/util/id_from_string.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright (C) 2016 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef CHRE_UTIL_ID_FROM_STRING_H_
-#define CHRE_UTIL_ID_FROM_STRING_H_
-
-namespace chre {
-
-/**
- * Formats a string into a CHRE platform version uint64_t.
- *
- * @param str the string to format
- * @return the formatted platform version id
- */
-constexpr uint64_t createIdFromString(const char str[5]);
-
-/**
- * Formats a vendor ID and platform ID into one platform ID value. This function
- * does not handle bit shifting. It is expected that the vendor ID be in the
- * correct position as created by the  createIdFromString function.
- *
- * @param vendorId The vendor ID of the platform.
- * @param platformId The platform ID of the platform.
- */
-constexpr uint64_t createPlatformIdFromVendorPlatform(uint64_t vendorId,
-                                                      uint32_t platformId);
-
-}  // namespace chre
-
-#include "chre/util/id_from_string_impl.h"
-
-#endif  // CHRE_UTIL_ID_FROM_STRING_H_
diff --git a/util/include/chre/util/id_from_string_impl.h b/util/include/chre/util/id_from_string_impl.h
deleted file mode 100644
index 9fdfe04..0000000
--- a/util/include/chre/util/id_from_string_impl.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright (C) 2016 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef CHRE_UTIL_ID_FROM_STRING_IMPL_H_
-#define CHRE_UTIL_ID_FROM_STRING_IMPL_H_
-
-#include "chre/util/id_from_string.h"
-
-namespace chre {
-
-constexpr uint64_t createIdFromString(const char str[5]) {
-  return (static_cast<uint64_t>(str[0]) << 56)
-      | (static_cast<uint64_t>(str[1]) << 48)
-      | (static_cast<uint64_t>(str[2]) << 40)
-      | (static_cast<uint64_t>(str[3]) << 32)
-      | (static_cast<uint64_t>(str[4]) << 24);
-}
-
-constexpr uint64_t createPlatformIdFromVendorPlatform(uint64_t vendorId,
-                                                      uint32_t platformId) {
-  // Ensure that only the vendor ID can occupy the top 5 bytes and the
-  // platform ID can only occupy the bottom 3 bytes.
-  return (vendorId & 0xffffffffff000000) | (platformId & 0xffffff);
-}
-
-}  // namespace chre
-
-#endif  // CHRE_UTIL_ID_FROM_STRING_IMPL_H_