Drop (no longer referenced) metadata libraries.
Metadata libraries were formerly used by gce_init, gce_mount_handler
and few other components that no longer are included on cuttlefish.
Change-Id: Ife50e1af1a71f80717ca6a20cf0d7c8f0dbad24b
diff --git a/common/libs/metadata/BUILD b/common/libs/metadata/BUILD
deleted file mode 100644
index d25db5f..0000000
--- a/common/libs/metadata/BUILD
+++ /dev/null
@@ -1,106 +0,0 @@
-cc_library(
- name = "constants",
- visibility = [ "//visibility:public" ],
- srcs = [
- "gce_metadata_attributes.cpp",
- "gce_metadata_attributes.h",
- "gce_resource_location.cpp",
- "gce_resource_location.h",
- ],
- hdrs = [
- "gce_metadata_attributes.h",
- "gce_resource_location.h",
- ],
-)
-
-cc_library(
- name = "initial_metadata_reader",
- visibility = [ "//visibility:public" ],
- srcs = [
- "display_properties.cpp",
- "display_properties.h",
- "initial_metadata_reader.h",
- "initial_metadata_reader_impl.cpp",
- "initial_metadata_reader_impl.h",
- "metadata_query.cpp",
- "metadata_query.h",
- ],
- hdrs = [
- "display_properties.h",
- "initial_metadata_reader.h",
- "metadata_query.h",
- ],
- copts = [
- "-I/usr/include/jsoncpp",
- ],
- linkopts = [
- "-ljsoncpp",
- ],
- deps = [
- ":constants",
- "//common/libs/auto_resources",
- "//common/libs/glog:cuttlefish_logging",
- "//common/libs/fs",
- ],
-)
-
-cc_library(
- name = "initial_metadata_reader-static",
- visibility = [ "//visibility:public" ],
- srcs = [
- "display_properties.cpp",
- "display_properties.h",
- "initial_metadata_reader.h",
- "initial_metadata_reader_impl.cpp",
- "initial_metadata_reader_impl.h",
- "metadata_query.cpp",
- "metadata_query.h",
- ],
- hdrs = [
- "display_properties.h",
- "initial_metadata_reader.h",
- "metadata_query.h",
- ],
- copts = [
- "-I/usr/include/jsoncpp",
- ],
- linkopts = [
- "-Wl,-Bstatic -ljsoncpp",
- ],
- linkstatic = 1,
- deps = [
- "@glog_repo//:glog",
- ":constants",
- "//common/libs/auto_resources",
- "//common/libs/fs",
- ],
-)
-
-
-cc_library(
- name = "partitions",
- visibility = [ "//visibility:public" ],
- srcs = [
- "get_partition_num.cpp",
- "get_partition_num.h",
- ],
- hdrs = [
- "get_partition_num.h",
- ],
- deps = [
- "//common/libs/auto_resources",
- ],
-)
-
-cc_test(
- name = "initial_metadata_reader_test",
- srcs = [
- "initial_metadata_reader_test.cpp",
- ],
- copts = [
- "-I/usr/include/jsoncpp",
- ],
- deps = [
- ":initial_metadata_reader",
- ],
-)
diff --git a/common/libs/metadata/display_properties.cpp b/common/libs/metadata/display_properties.cpp
deleted file mode 100644
index 587daff..0000000
--- a/common/libs/metadata/display_properties.cpp
+++ /dev/null
@@ -1,46 +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.
- */
-#include "common/libs/metadata/display_properties.h"
-
-#include <stdio.h>
-
-namespace avd {
-void DisplayProperties::Parse(const char* value) {
- if (!value) {
- return;
- }
- int xres, yres, unused_bits_per_pixel, dpi;
- int rval = sscanf(
- value, "%dx%dx%dx%d", &xres, &yres, &unused_bits_per_pixel, &dpi);
- // bits_per_pixel isn't really controllable, so do something sensible
- // if people stop setting it.
- if (rval == 3) {
- dpi = unused_bits_per_pixel;
- } else if (rval != 4) {
- return;
- }
- if ((xres < 0) || (yres < 0) || (dpi < 0)) {
- return;
- }
- x_res_ = xres;
- y_res_ = yres;
- // Bits per pixel is fixed at 32 in our devices.
- // bits_per_pixel_ = bits_per_pixel;
- dpi_ = dpi;
- default_ = false;
- config_.SetToString(value);
-}
-} // namespace avd
diff --git a/common/libs/metadata/display_properties.h b/common/libs/metadata/display_properties.h
deleted file mode 100644
index 0d02445..0000000
--- a/common/libs/metadata/display_properties.h
+++ /dev/null
@@ -1,59 +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 CUTTLEFISH_COMMON_COMMON_LIBS_METADATA_DISPLAY_PROPERTIES_H_
-#define CUTTLEFISH_COMMON_COMMON_LIBS_METADATA_DISPLAY_PROPERTIES_H_
-
-#include "common/libs/auto_resources/auto_resources.h"
-
-namespace avd {
-
-class DisplayProperties {
- public:
- DisplayProperties() :
- x_res_(1280),
- y_res_(720),
- bits_per_pixel_(32),
- dpi_(160),
- default_(true) {
- config_.SetToString("1280x720x32x160");
- }
-
- void Parse(const char* value);
-
- int GetXRes() const { return x_res_; }
- int GetYRes() const { return y_res_; }
- int GetBitsPerPixel() const { return bits_per_pixel_; }
- int GetDpi() const { return dpi_; }
- bool IsDefault() const { return default_; }
- const char* GetConfig() const { return config_.data(); }
-
- private:
- // Screen width in pixels
- int x_res_;
- // Screen height in pixels
- int y_res_;
- // Depth of the screen (obsolete)
- int bits_per_pixel_;
- // Pixels per inch
- int dpi_;
- // Default
- bool default_;
- // Unparsed configuration
- AutoFreeBuffer config_;
-};
-
-} // namespace avd
-#endif // CUTTLEFISH_COMMON_COMMON_LIBS_METADATA_DISPLAY_PROPERTIES_H_
diff --git a/common/libs/metadata/gce_metadata_attributes.cpp b/common/libs/metadata/gce_metadata_attributes.cpp
deleted file mode 100644
index 7ee5ac6..0000000
--- a/common/libs/metadata/gce_metadata_attributes.cpp
+++ /dev/null
@@ -1,268 +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.
- */
-#include "common/libs/metadata/gce_metadata_attributes.h"
-
-const char* const GceMetadataAttributes::kTestingPath = "testing/attributes/";
-
-const char* const GceMetadataAttributes::kInstancePath = "instance/attributes/";
-
-const char* const GceMetadataAttributes::kProjectPath = "project/attributes/";
-
-// Version of Android to boot on multiboot images.
-// Updates at boot time.
-// Example: 23_gce_x86_64_phone
-// When in doubt leave blank or use default
-const char* const GceMetadataAttributes::kAndroidVersionKey = "android_version";
-
-// Configuration of the back camera.
-// *** OBSOLETE ***
-// Updates at boot time.
-// Example: 1,768,1024,checker-sliding
-// NOTE: To escape the commas with gcloud use
-// --metadata-from-file camera_back=<(echo 1,768,1024,checker-sliding)
-const char* const GceMetadataAttributes::kBackCameraConfigKey = "camera_back";
-
-// Content of (not a path to) an extra init file
-// Updates at boot time.
-const char* const GceMetadataAttributes::kCustomInitFileKey =
- "custom_init_file";
-
-// Configuration of the display
-// *** OBSOLETE ***
-// Updates at boot time.
-// Example: 800x1280x16x213
-// Format is ${x_res}x${y_res}x${depth}x${dpi}
-// Note: depth is currently ignored. 32 is the forward-compatible value.
-const char* const GceMetadataAttributes::kDisplayConfigurationKey =
- "cfg_sta_display_resolution";
-
-// Configuration of the front camera.
-// Updates at boot time.
-// Example: 1,768,1024,checker-sliding
-// Note: To escape the commas with gcloud use
-// --metadata-from-file camera_front=<(echo 1,768,1024,checker-sliding)
-const char* const GceMetadataAttributes::kFrontCameraConfigKey = "camera_front";
-
-// Current GPS location.
-// Updates at runtime.
-// Example: -122.0840859,37.4224504,0,0,0,10
-// The fields are:
-// Logitude in degress with decimal subdegrees
-// Latitude in degress with decimal subdegrees
-// Altitude in meters
-// Heading in degress
-// Speed in meters per second
-// Precision in meters
-const char* const GceMetadataAttributes::kGpsCoordinatesKey = "gps_coordinates";
-
-// Initial locale of the device.
-// Updates at boot time.
-// Example: en_US
-// If this attribute is set any existing locale is forgotten and the new
-// one is set.
-// If no value is set then the existing locale, if any, remains.
-const char* const GceMetadataAttributes::kInitialLocaleKey =
- "cfg_sta_initial_locale";
-
-// State of Wireless LAN.
-// Updates at runtime.
-// Example: ENABLED
-// Accepted values are: ( ENABLED, DISABLED ). If value is neither of these, the
-// handler falls back to default state, DISABLED.
-const char* const GceMetadataAttributes::kWlanStateKey = "cfg_sta_wlan_state";
-
-// Configuration of the physical keyboard (if any).
-// Updates at boot time.
-// If the attribute is not specified will enable physical keyboard.
-// Values accepted:
-// 1: Use a physical keyboard.
-// All other values: disable the physical keyboard.
-const char* const GceMetadataAttributes::kPhysicalKeyboardKey =
- "physical_keyboard";
-
-// Configuration of hardware buttons.
-// *** OBSOLETE ***
-// Updates at boot time.
-// If the attribute is not specified will enable all hardware buttons.
-// Values accepted:
-// Empty string: disable all hardware buttons.
-// MENU: enable only the menu button.
-// BACK: enable only the back button.
-// HOME: enable only the home button.
-// Any combinion of the above values delimited by commas.
-const char* const GceMetadataAttributes::kPhysicalNavigationButtonsKey =
- "physical_navigation_buttons";
-
-// Path to the device node to mount as a system overlay.
-// Updates at boot time.
-// If absent no overlay is mounted.
-// Example: /dev/block/sdb1
-const char* const GceMetadataAttributes::kSystemOverlayDeviceKey =
- "system_overlay_device";
-
-// Device personality definition in JSON format.
-// Allows custom device features to be set.
-// If absent - not used.
-const char* const GceMetadataAttributes::kDevicePersonalityDefinitionKey =
- "device_personality_definition";
-
-// Device personality name.
-// Holds name (without path or extension) of the file describing device
-// features. File describing features should be located in
-// GceResourceLocation::kDevicePersonalityPath.
-// If empty, not present, or invalid falls back to 'default'.
-const char* const GceMetadataAttributes::kDevicePersonalityNameKey =
- "device_personality_name";
-
-// Controls which streaming protocol will be used by the remoter.
-// Values include:
-// appstreaming
-// vnc
-// If nothing is set the remoter behaves as if vnc is selected.
-const char* const GceMetadataAttributes::kRemotingModeKey =
- "cfg_sta_remoting_mode";
-
-// Controls the scaling used in the VNC backend. The the device is
-// configured to 320 dpi but this is set to 160, the result will be
-// as if a scaling factor of 0.5 were used.
-const char* const GceMetadataAttributes::kConsoleDpiScalingDpiKey =
- "cfg_sta_console_scaling_dpi";
-
-// Controls how the pixels will be scaled before they are sent over VNC.
-// Numbers are floating point and must be <= 1.0 If nothing is set then
-// 1.0 is assumed.
-// Note: VNC doesn't cope well with unusual scaling factors: it tends to
-// clip the right / bottom off the screen. 0.5 and 0.25 appear to be safe.
-// If nothing is set then 1.0 is assumed.
-const char* const GceMetadataAttributes::kConsoleScalingFactorKey =
- "cfg_sta_console_scaling_factor";
-
-// Controls whether metadata attribute injections are permitted from
-// within Android.
-// The only legitimate purpose of this attribute is testing.
-// Not all attributes are permitted.
-const char* const GceMetadataAttributes::kTestAllowMetadataInjectionsKey =
- "cfg_test_allow_metadata_injections";
-
-// Controls which RIL implementation will be used during next boot.
-// Values include:
-// - TESTING = use testing version of GCE RIL (if available).
-// - DEPRECATED = use previous version of GCE RIL (if available).
-// - DEFAULT / unset / other = use current version of GCE RIL.
-const char* const GceMetadataAttributes::kRilVersionKey = "ril_version";
-
-// Controls which Hardware composer implementation will be used during next
-// boot.
-// Values include:
-// - TESTING = use testing version of GCE Hardware Composer (if available).
-// - DEPRECATED = use previous version of GCE Hardware Composer (if available).
-// - DEFAULT / unset / other = use current version of GCE Hardware Composer.
-const char* const GceMetadataAttributes::kHWComposerVersionKey = "hwc_version";
-
-// Controls which VNC implementation will be used during next boot
-// Values include:
-// - TESTING = use testing version of the GCE VNC server (if available)
-// - DEPRECATED = use previous version of the GCE VNC server (if available).
-// - DEFAULT / unset / other = use current version of the GCE VNC server
-const char* const GceMetadataAttributes::kVncServerVersionKey =
- "vnc_server_version";
-
-const char* const GceMetadataAttributes::kSshKeysInstancePath =
- "instance/attributes/sshKeys";
-const char* const GceMetadataAttributes::kSshKeysProjectPath =
- "project/attributes/sshKeys";
-
-const char* const GceMetadataAttributes::kInjectedIntentInstancePath =
- "instance/attributes/t_force_intent";
-const char* const GceMetadataAttributes::kInjectedIntentProjectPath =
- "project/attributes/t_force_intent";
-
-const char* const GceMetadataAttributes::kForceCoarseOrientationChangeInstancePath =
- "instance/attributes/t_force_orientation";
-const char* const GceMetadataAttributes::kForceCoarseOrientationChangeProjectPath =
- "project/attributes/t_force_orientation";
-const char* const GceMetadataAttributes::kForceCoarseOrientationChangeTestingPath =
- "testing/attributes/t_force_orientation";
-
-const char* const GceMetadataAttributes::kPropertyMapperInstancePath =
- "instance/attributes/cfg_sta_pmap_";
-const char* const GceMetadataAttributes::kPropertyMapperProjectPath =
- "project/attributes/cfg_sta_pmap_";
-
-const char* const GceMetadataAttributes::kAccelerometerSensorInstancePath =
- "instance/attributes/t_sensor_accelerometer";
-const char* const GceMetadataAttributes::kAccelerometerSensorProjectPath =
- "project/attributes/t_sensor_accelerometer";
-
-const char* const GceMetadataAttributes::kGyroscopeSensorInstancePath =
- "instance/attributes/t_sensor_gyroscope";
-const char* const GceMetadataAttributes::kGyroscopeSensorProjectPath =
- "project/attributes/t_sensor_gyroscope";
-
-const char* const GceMetadataAttributes::kLightSensorInstancePath =
- "instance/attributes/t_sensor_light";
-const char* const GceMetadataAttributes::kLightSensorProjectPath =
- "project/attributes/t_sensor_light";
-
-const char* const GceMetadataAttributes::kMagneticFieldSensorInstancePath =
- "instance/attributes/t_sensor_magnetic_field";
-const char* const GceMetadataAttributes::kMagneticFieldSensorProjectPath =
- "project/attributes/t_sensor_magnetic_field";
-
-const char* const GceMetadataAttributes::kPressureSensorInstancePath =
- "instance/attributes/t_sensor_pressure";
-const char* const GceMetadataAttributes::kPressureSensorProjectPath =
- "project/attributes/t_sensor_pressure";
-
-const char* const GceMetadataAttributes::kProximitySensorInstancePath =
- "instance/attributes/t_sensor_proximity";
-const char* const GceMetadataAttributes::kProximitySensorProjectPath =
- "project/attributes/t_sensor_proximity";
-
-const char* const GceMetadataAttributes::kAmbientTemperatureSensorInstancePath =
- "instance/attributes/t_sensor_ambient_temperature";
-const char* const GceMetadataAttributes::kAmbientTemperatureSensorProjectPath =
- "project/attributes/t_sensor_ambient_temperature";
-
-const char* const GceMetadataAttributes::kDeviceTemperatureSensorInstancePath =
- "instance/attributes/t_sensor_device_temperature";
-const char* const GceMetadataAttributes::kDeviceTemperatureSensorProjectPath =
- "project/attributes/t_sensor_device_temperature";
-
-const char* const GceMetadataAttributes::kRelativeHumiditySensorInstancePath =
- "instance/attributes/t_sensor_relative_humidity";
-const char* const GceMetadataAttributes::kRelativeHumiditySensorProjectPath =
- "project/attributes/t_sensor_relative_humidity";
-const char* const GceMetadataAttributes::kAutoScreenshotFrequencyInstancePath =
- "instance/attributes/t_auto_screenshot_frequency";
-const char* const GceMetadataAttributes::kAutoScreenshotPrefixInstancePath =
- "instance/attributes/t_auto_screenshot_prefix";
-const char* const GceMetadataAttributes::kRebootIfMissingInstancePath =
- "instance/attributes/t_reboot_if_missing_path";
-
-const char* const GceMetadataAttributes::kPowerBatteryConfigPath =
- "instance/attributes/power_battery_config";
-
-const char* const GceMetadataAttributes::kMobileDataNetworkingConfigPath =
- "instance/attributes/mobile_data_networking_config";
-// IMEI value which must be set before the system starts to boot. If not,
-// a randomly generated value will be used by the GCE RIL module.
-const char* const GceMetadataAttributes::kIMEIConfigKey = "imei";
-
-const char* const GceMetadataAttributes::kScreenshotsDirectoryInstancePath =
- "instance/attributes/t_screenshot_dir_path";
-const char* const GceMetadataAttributes::kScreenshotsDirectoryProjectPath =
- "project/attributes/t_screenshot_dir_path";
diff --git a/common/libs/metadata/gce_metadata_attributes.h b/common/libs/metadata/gce_metadata_attributes.h
deleted file mode 100644
index ee65735..0000000
--- a/common/libs/metadata/gce_metadata_attributes.h
+++ /dev/null
@@ -1,95 +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 CUTTLEFISH_COMMON_COMMON_LIBS_METADATA_GCE_METADATA_ATTRIBUTES_H_
-#define CUTTLEFISH_COMMON_COMMON_LIBS_METADATA_GCE_METADATA_ATTRIBUTES_H_
-
-// Constant string declarations for GCE metadata attributes used by the Remoter.
-class GceMetadataAttributes {
-public:
- static const char* const kTestingPath;
- static const char* const kInstancePath;
- static const char* const kProjectPath;
-
- // The InitialMetadataReader reasons in terms of keys, while the
- // MetadataService uses full paths.
- // A key represents two paths, one for the instance and one for the project.
- // When both paths are present the instance value takes precedence.
- //
- // TODO(ghartman): Refactor the MetadataService to use keys as well.
- static const char* const kAndroidVersionKey;
- static const char* const kBackCameraConfigKey;
- static const char* const kConsoleDpiScalingDpiKey;
- static const char* const kConsoleScalingFactorKey;
- static const char* const kCustomInitFileKey;
- static const char* const kDevicePersonalityDefinitionKey;
- static const char* const kDevicePersonalityNameKey;
- static const char* const kDisplayConfigurationKey;
- static const char* const kFrontCameraConfigKey;
- static const char* const kGpsCoordinatesKey;
- static const char* const kInitialLocaleKey;
- static const char* const kWlanStateKey;
- static const char* const kPhysicalKeyboardKey;
- static const char* const kPhysicalNavigationButtonsKey;
- static const char* const kRemotingModeKey;
- static const char* const kSystemOverlayDeviceKey;
- static const char* const kRilVersionKey;
- static const char* const kHWComposerVersionKey;
- static const char* const kVncServerVersionKey;
-
- static const char* const kTestAllowMetadataInjectionsKey;
-
- static const char* const kSshKeysInstancePath;
- static const char* const kSshKeysProjectPath;
- static const char* const kInjectedIntentInstancePath;
- static const char* const kInjectedIntentProjectPath;
- static const char* const kForceCoarseOrientationChangeTestingPath;
- static const char* const kForceCoarseOrientationChangeInstancePath;
- static const char* const kForceCoarseOrientationChangeProjectPath;
- static const char* const kPropertyMapperInstancePath;
- static const char* const kPropertyMapperProjectPath;
-
- static const char* const kAccelerometerSensorInstancePath;
- static const char* const kAccelerometerSensorProjectPath;
- static const char* const kGyroscopeSensorInstancePath;
- static const char* const kGyroscopeSensorProjectPath;
- static const char* const kLightSensorInstancePath;
- static const char* const kLightSensorProjectPath;
- static const char* const kMagneticFieldSensorInstancePath;
- static const char* const kMagneticFieldSensorProjectPath;
- static const char* const kPressureSensorInstancePath;
- static const char* const kPressureSensorProjectPath;
- static const char* const kProximitySensorInstancePath;
- static const char* const kProximitySensorProjectPath;
- static const char* const kDeviceTemperatureSensorInstancePath;
- static const char* const kDeviceTemperatureSensorProjectPath;
- static const char* const kAmbientTemperatureSensorInstancePath;
- static const char* const kAmbientTemperatureSensorProjectPath;
- static const char* const kRelativeHumiditySensorInstancePath;
- static const char* const kRelativeHumiditySensorProjectPath;
- static const char* const kAutoScreenshotFrequencyInstancePath;
- static const char* const kAutoScreenshotPrefixInstancePath;
- static const char* const kRebootIfMissingInstancePath;
-
- static const char* const kPowerBatteryConfigPath;
-
- static const char* const kMobileDataNetworkingConfigPath;
- static const char* const kIMEIConfigKey;
-
- static const char* const kScreenshotsDirectoryInstancePath;
- static const char* const kScreenshotsDirectoryProjectPath;
-};
-
-#endif // CUTTLEFISH_COMMON_COMMON_LIBS_METADATA_GCE_METADATA_ATTRIBUTES_H_
diff --git a/common/libs/metadata/gce_resource_location.cpp b/common/libs/metadata/gce_resource_location.cpp
deleted file mode 100644
index b9405a9..0000000
--- a/common/libs/metadata/gce_resource_location.cpp
+++ /dev/null
@@ -1,29 +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.
- */
-#include "common/libs/metadata/gce_resource_location.h"
-
-// Location of the file containing initial metadata.
-// Contains device configuration acquired from metadata server in json format.
-const char* const GceResourceLocation::kInitialMetadataPath =
- "/initial.metadata";
-
-// Location of the fstab file.
-const char* const GceResourceLocation::kInitialFstabPath = "/fstab.gce_x86";
-
-// Location of the folder containing device personality files.
-const char* const GceResourceLocation::kDevicePersonalitiesPath =
- "/system/etc/device_personalities";
-
diff --git a/common/libs/metadata/gce_resource_location.h b/common/libs/metadata/gce_resource_location.h
deleted file mode 100644
index 5b7f38a..0000000
--- a/common/libs/metadata/gce_resource_location.h
+++ /dev/null
@@ -1,26 +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 CUTTLEFISH_COMMON_COMMON_LIBS_METADATA_GCE_RESOURCE_LOCATION_H_
-#define CUTTLEFISH_COMMON_COMMON_LIBS_METADATA_GCE_RESOURCE_LOCATION_H_
-
-class GceResourceLocation {
- public:
- static const char* const kInitialMetadataPath;
- static const char* const kInitialFstabPath;
- static const char* const kDevicePersonalitiesPath;
-};
-
-#endif // CUTTLEFISH_COMMON_COMMON_LIBS_METADATA_GCE_RESOURCE_LOCATION_H_
diff --git a/common/libs/metadata/get_partition_num.cpp b/common/libs/metadata/get_partition_num.cpp
deleted file mode 100644
index 891b9c8..0000000
--- a/common/libs/metadata/get_partition_num.cpp
+++ /dev/null
@@ -1,67 +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.
- */
-#include "common/libs/metadata/get_partition_num.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <string.h>
-#include <unistd.h>
-
-#include "common/libs/auto_resources/auto_resources.h"
-
-namespace {
-const char kDefaultPartitionsPath[] = "/partitions";
-} // namespace
-
-// Looks up the partition number for a given name.
-// Returns -1 if the partition number cannot be found for any reason.
-long GetPartitionNum(const char* name, const char* path) {
- if (!path) {
- path = kDefaultPartitionsPath;
- }
- size_t name_len = strlen(name);
- AutoCloseFILE f(fopen(path, "r"));
- if (f.IsError()) {
- printf("%s: fopen(%s) failed %s:%d (%s)", __FUNCTION__,
- path, __FILE__, __LINE__, strerror(errno));
- return -1;
- }
- char line[160];
- while (!f.IsEOF()) {
- if (!fgets(line, sizeof(line), f)) {
- if (!f.IsEOF()) {
- printf("%s: fgets failed %s:%d (%s)", __FUNCTION__,
- __FILE__, __LINE__, strerror(errno));
- }
- return -1;
- }
- if (!strncmp(name, line, name_len) && (line[name_len] == ' ')) {
- char* end;
- const char* base = line + name_len + 1;
- long rval = strtol(base, &end, 10);
- if (base != end) {
- return rval;
- } else {
- printf("%s: parse failed line=%s %s:%d", __FUNCTION__,
- line, __FILE__, __LINE__);
- }
- }
- }
- printf("%s: Could not find name=%s %s:%d", __FUNCTION__, name,
- __FILE__, __LINE__);
- return -1;
-}
diff --git a/common/libs/metadata/get_partition_num.h b/common/libs/metadata/get_partition_num.h
deleted file mode 100644
index c8dc1e6..0000000
--- a/common/libs/metadata/get_partition_num.h
+++ /dev/null
@@ -1,25 +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 CUTTLEFISH_COMMON_COMMON_LIBS_METADATA_GET_PARTITION_NUM_H_
-#define CUTTLEFISH_COMMON_COMMON_LIBS_METADATA_GET_PARTITION_NUM_H_
-
-// Looks up the partition number for a given name.
-// Path can be a full path to a partition number file. If null is provided the
-// system default partition file is used.
-// Returns -1 if the partition number cannot be found for any reason.
-long GetPartitionNum(const char* name, const char* path = 0);
-
-#endif // CUTTLEFISH_COMMON_COMMON_LIBS_METADATA_GET_PARTITION_NUM_H_
diff --git a/common/libs/metadata/initial_metadata_reader.h b/common/libs/metadata/initial_metadata_reader.h
deleted file mode 100644
index 5c10dde..0000000
--- a/common/libs/metadata/initial_metadata_reader.h
+++ /dev/null
@@ -1,44 +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 CUTTLEFISH_COMMON_COMMON_LIBS_METADATA_INITIAL_METADATA_READER_H_
-#define CUTTLEFISH_COMMON_COMMON_LIBS_METADATA_INITIAL_METADATA_READER_H_
-
-namespace avd {
-
-class DisplayProperties;
-
-// See the comments in MetadataService.h for the rules that apply to
-// project and instance values.
-class InitialMetadataReader {
- public:
- // Describes the configuration of a screen. This is here because it is shared
- // with gce_init, which can't handle some of the dependencies in the full
- // framebuffer configuration.
- static InitialMetadataReader* getInstance();
- virtual const DisplayProperties& GetDisplay() const = 0;
- virtual const char* GetInstanceHostname() const = 0;
- virtual const char* GetValueForKey(const char* key) const = 0;
-
- protected:
- InitialMetadataReader() {}
- virtual ~InitialMetadataReader() {}
- InitialMetadataReader(const InitialMetadataReader&);
- InitialMetadataReader& operator= (const InitialMetadataReader&);
-};
-
-}
-
-#endif // CUTTLEFISH_COMMON_COMMON_LIBS_METADATA_INITIAL_METADATA_READER_H_
diff --git a/common/libs/metadata/initial_metadata_reader_impl.cpp b/common/libs/metadata/initial_metadata_reader_impl.cpp
deleted file mode 100644
index f191d27..0000000
--- a/common/libs/metadata/initial_metadata_reader_impl.cpp
+++ /dev/null
@@ -1,112 +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.
- */
-#include "common/libs/metadata/initial_metadata_reader_impl.h"
-
-#include <errno.h>
-#include <stdio.h>
-#include <iostream>
-#include <fstream>
-#include <map>
-#include <string>
-
-#include <json/json.h>
-
-#include "common/libs/glog/logging.h"
-#include "common/libs/metadata/gce_metadata_attributes.h"
-#include "common/libs/metadata/gce_resource_location.h"
-
-namespace avd {
-
-InitialMetadataReaderImpl::InitialMetadataReaderImpl()
- : is_initialized_(false) {}
-
-static std::string ValueToString(Json::Value value) {
- if (value.isString()) {
- return value.asString();
- } else {
- Json::FastWriter writer;
- return writer.write(value);
- }
-}
-
-void StoreValues(Json::Value source, MetadataReaderValueMap* dest) {
- if (!source.isObject()) {
- return;
- }
- Json::Value::Members members = source.getMemberNames();
- for (Json::Value::Members::const_iterator it = members.begin();
- it != members.end(); ++it) {
- (*dest)[*it] = ValueToString(source[*it]);
- }
-}
-
-bool InitialMetadataReaderImpl::Init(const char* config_path) {
- std::ifstream ifs(config_path);
-
- if (!ifs.good()) {
- LOG(ERROR) << "Couldn't open initial metadata file.";
- return false;
- }
- // Skip over the headers.
- std::string response_line;
- while (getline(ifs, response_line, '\n')) {
- if (response_line == "\r") {
- // End of headers.
- break;
- }
- }
- // Now parse the JSON payload.
- Json::Reader reader;
- Json::Value root;
- is_initialized_ = reader.parse(ifs, root);
- // Now we need to convert the values to strings. We do this because we need
- // stable pointers to return, and libjsoncpp deallocates strings when the
- // corresponding Value goes out of scope.
- if (is_initialized_) {
- Json::Value empty(Json::objectValue);
- Json::Value source = root.get("project", empty).get("attributes", empty);
- StoreValues(source, &values_);
- source = root.get("instance", empty).get("attributes", empty);
- StoreValues(source, &values_);
- instance_hostname_ = ValueToString(
- root.get("instance", empty).get("hostname", Json::stringValue));
- } else {
- LOG(ERROR) << "Failed to parse metadata: "
- << reader.getFormattedErrorMessages();
- }
- display_.Parse(GetValueForKey(
- GceMetadataAttributes::kDisplayConfigurationKey));
- return is_initialized_;
-}
-
-const char* InitialMetadataReaderImpl::GetValueForKey(const char* key) const {
- MetadataReaderValueMap::const_iterator it = values_.find(key);
- if (it == values_.end()) {
- return NULL;
- }
- return it->second.c_str();
-}
-
-InitialMetadataReader* InitialMetadataReader::getInstance() {
- static InitialMetadataReaderImpl* instance;
- if (!instance) {
- instance = new InitialMetadataReaderImpl();
- instance->Init(GceResourceLocation::kInitialMetadataPath);
- }
- return instance;
-}
-
-}
diff --git a/common/libs/metadata/initial_metadata_reader_impl.h b/common/libs/metadata/initial_metadata_reader_impl.h
deleted file mode 100644
index ad67d45..0000000
--- a/common/libs/metadata/initial_metadata_reader_impl.h
+++ /dev/null
@@ -1,50 +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 CUTTLEFISH_COMMON_COMMON_LIBS_METADATA_INITIAL_METADATA_READER_IMPL_H_
-#define CUTTLEFISH_COMMON_COMMON_LIBS_METADATA_INITIAL_METADATA_READER_IMPL_H_
-
-#include <map>
-#include <string>
-
-#include "common/libs/metadata/display_properties.h"
-#include "common/libs/metadata/initial_metadata_reader.h"
-
-namespace avd {
-
-typedef std::map<std::string, std::string> MetadataReaderValueMap;
-
-class InitialMetadataReaderImpl : public InitialMetadataReader {
- public:
- InitialMetadataReaderImpl();
-
- const DisplayProperties& GetDisplay() const {
- return display_;
- }
-
- const char* GetValueForKey(const char* key) const;
- const char* GetInstanceHostname() const { return instance_hostname_.c_str(); }
- bool Init(const char* path);
-
- protected:
- bool is_initialized_;
- MetadataReaderValueMap values_;
- std::string instance_hostname_;
- DisplayProperties display_;
-};
-
-} // namespace avd
-
-#endif // CUTTLEFISH_COMMON_COMMON_LIBS_METADATA_INITIAL_METADATA_READER_IMPL_H_
diff --git a/common/libs/metadata/initial_metadata_reader_test.cpp b/common/libs/metadata/initial_metadata_reader_test.cpp
deleted file mode 100644
index ed543cd..0000000
--- a/common/libs/metadata/initial_metadata_reader_test.cpp
+++ /dev/null
@@ -1,284 +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.
- */
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-#include "common/libs/metadata/initial_metadata_reader_impl.h"
-#include "common/libs/metadata/gce_metadata_attributes.h"
-
-#include <json/json.h>
-
-// TODO(ghartman): Adopt external/gtest.
-
-const char* instance_value = "i_value";
-const char* project_value = "p_value";
-
-extern "C" {
-// Host builds have trouble because these symbols are not defined.
-// TODO(ghartman) Come up with better stubs. #include <atomic> created issues,
-// but perhaps there is something more portable than the gcc built-ins.
-int32_t android_atomic_inc(volatile int32_t* addr) {
- return __sync_fetch_and_add(addr, 1);
-}
-
-int32_t android_atomic_dec(volatile int32_t* addr) {
- return __sync_fetch_and_sub(addr, 1);
-}
-}
-
-void ExpectEqual(
- const char* test,
- const char* left_desc, const char* left,
- const char* right_desc, const char* right,
- const char* file, int line) {
- if (left == right) {
- return;
- }
- if (left && right && !strcmp(left, right)) {
- return;
- }
- if (!left) {
- left = "(NULL)";
- }
- if (!right) {
- right = "(NULL)";
- }
- fprintf(stderr, "%s: FAIL: strings not equal at %s:%d\n"
- " %s=\"%s\"\n"
- " %s=\"%s\"\n", test, file, line, left_desc, left, right_desc,
- right);
- exit(1);
-}
-
-#define EXPECT_EQUAL(TEST, LEFT, RIGHT) ExpectEqual(TEST, #LEFT, (LEFT), #RIGHT, (RIGHT), __FILE__, __LINE__)
-
-void ExpectNotEqual(
- const char* test,
- const char* left_desc, const char* left,
- const char* right_desc, const char* right,
- const char* file, int line) {
- if (left != right) {
- return;
- }
- if (left && right && strcmp(left, right)) {
- return;
- }
- if (!left) {
- left = "(NULL)";
- }
- if (!right) {
- right = "(NULL)";
- }
- fprintf(stderr, "%s: FAIL: strings are equal at %s:%d\n"
- " %s=\"%s\"\n"
- " %s=\"%s\"\n", test, file, line, left_desc, left, right_desc,
- right);
- exit(1);
-}
-
-void ExpectNotEqual(
- const char* test,
- const char* left_desc, int left,
- const char* right_desc, int right,
- const char* file, int line) {
- if (left != right) {
- return;
- }
- fprintf(stderr, "%s: FAIL: ints are equal at %s:%d\n"
- " %s=\"%d\"\n"
- " %s=\"%d\"\n", test, file, line, left_desc, left, right_desc,
- right);
- exit(1);
-}
-
-#define EXPECT_NOT_EQUAL(TEST, LEFT, RIGHT) ExpectNotEqual(TEST, #LEFT, (LEFT), #RIGHT, (RIGHT), __FILE__, __LINE__)
-
-void ExpectNotNull(
- const char* test, const char* left_desc, void *left,
- const char* file, int line) {
- if (left) {
- return;
- }
- fprintf(stderr, "%s: FAIL: null for %s at %s:%d\n",
- test, left_desc, file, line);
- exit(1);
-}
-
-#define EXPECT_NOT_NULL(TEST, LEFT) ExpectNotNull(TEST, #LEFT, (LEFT), __FILE__, __LINE__)
-
-class TestMetadataReader : public avd::InitialMetadataReaderImpl {
- public:
- TestMetadataReader(const char* path) : InitialMetadataReaderImpl() {
- Init(path);
- }
-};
-
-struct TestLine {
- const char* path;
- const char* key;
- const char* value;
-};
-
-struct TestCase {
- const char* expected_value;
- const char* key;
- const TestLine * lines;
-};
-
-TestLine EmptyFileLines[] = {
- {NULL, NULL, NULL},
-};
-
-const char* some_key = "some_key";
-
-TestCase EmptyFile = {
- NULL,
- some_key,
- EmptyFileLines
-};
-
-TestLine InstanceFileLines[] = {
- {GceMetadataAttributes::kInstancePath, some_key, instance_value},
- {NULL, NULL, NULL},
-};
-
-TestCase InstanceFile = {
- instance_value,
- some_key,
- InstanceFileLines
-};
-
-TestLine ProjectFileLines[] = {
- {GceMetadataAttributes::kProjectPath, some_key, project_value},
- {NULL, NULL, NULL},
-};
-
-TestCase ProjectFile = {
- project_value,
- some_key,
- ProjectFileLines
-};
-
-TestLine InstanceBeforeProjectLines[] = {
- {GceMetadataAttributes::kInstancePath, some_key, instance_value},
- {GceMetadataAttributes::kProjectPath, some_key, project_value},
- {NULL, NULL, NULL},
-};
-
-TestCase InstanceBeforeProject = {
- instance_value,
- some_key,
- InstanceBeforeProjectLines
-};
-
-TestLine ProjectBeforeInstanceLines[] = {
- {GceMetadataAttributes::kProjectPath, some_key, project_value},
- {GceMetadataAttributes::kInstancePath, some_key, instance_value},
- {NULL, NULL, NULL},
-};
-
-TestCase ProjectBeforeInstance = {
- instance_value,
- some_key,
- ProjectBeforeInstanceLines
-};
-
-TestLine ProjectSetInstanceSetEmptyLines[] = {
- {GceMetadataAttributes::kProjectPath, some_key, project_value},
- {GceMetadataAttributes::kInstancePath, some_key, ""},
- {NULL, NULL, NULL},
-};
-
-TestCase ProjectSetInstanceSetEmpty = {
- "",
- some_key,
- ProjectSetInstanceSetEmptyLines
-};
-
-void WriteLines(const char* name, const TestLine* data, int fd) {
- Json::Value root(Json::objectValue);
- while (data->path && data->key && data->value) {
- if (data->path == GceMetadataAttributes::kProjectPath) {
- root["project"]["attributes"][data->key] = data->value;
- } else if (data->path == GceMetadataAttributes::kInstancePath) {
- root["instance"]["attributes"][data->key] = data->value;
- } else {
- root[data->path][data->key] = data->value;
- }
- ++data;
- }
- int my_fd = dup(fd);
- EXPECT_NOT_EQUAL(name, my_fd, -1);
- FILE * dest = fdopen(my_fd, "w");
- EXPECT_NOT_NULL(name, dest);
- fputs("Metadata-Flavor: Google\r\n\r\n", dest);
- fputs(Json::FastWriter().write(root).c_str(), dest);
- EXPECT_NOT_EQUAL(name, fclose(dest), EOF);
-}
-
-void RunTest(const char* name, const TestCase& test) {
- char *filename = strdup("/tmp/testXXXXXX");
- EXPECT_NOT_NULL(name, filename);
- int fd = mkstemp(filename);
- EXPECT_NOT_EQUAL(name, fd, -1);
- WriteLines(name, test.lines, fd);
- TestMetadataReader* reader = new TestMetadataReader(filename);
- EXPECT_NOT_NULL(name, reader);
- EXPECT_EQUAL(name, reader->GetValueForKey(test.key), test.expected_value);
- delete reader;
- EXPECT_NOT_EQUAL(name, close(fd), -1);
- EXPECT_NOT_EQUAL(name, unlink(filename), -1);
- free(filename);
- printf("%s: PASS\n", name);
- fflush(stdout);
-}
-
-#define RUN_TEST(CONFIG) RunTest(#CONFIG, (CONFIG))
-
-TestLine SpuriousPathLines[] = {
- {"spurious_path", some_key, instance_value},
- {NULL, NULL, NULL},
-};
-
-TestCase SpuriousPath = {
- NULL,
- some_key,
- SpuriousPathLines
-};
-
-TestLine SpuriousKeyLines[] = {
- {GceMetadataAttributes::kInstancePath, "spurious", instance_value},
- {NULL, NULL, NULL},
-};
-
-TestCase SpuriousKey = {
- NULL,
- some_key,
- SpuriousKeyLines
-};
-
-int main(int /*argc*/, char* /*argv*/[]) {
- RUN_TEST(EmptyFile);
- RUN_TEST(InstanceFile);
- RUN_TEST(ProjectFile);
- RUN_TEST(InstanceBeforeProject);
- RUN_TEST(ProjectBeforeInstance);
- RUN_TEST(ProjectSetInstanceSetEmpty);
- RUN_TEST(SpuriousPath);
- RUN_TEST(SpuriousKey);
- return 0;
-}
diff --git a/common/libs/metadata/metadata_query.cpp b/common/libs/metadata/metadata_query.cpp
deleted file mode 100644
index 7f3acf3..0000000
--- a/common/libs/metadata/metadata_query.cpp
+++ /dev/null
@@ -1,63 +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.
- */
-#include "common/libs/fs/shared_fd.h"
-
-#include "common/libs/glog/logging.h"
-#include "common/libs/metadata/metadata_query.h"
-
-namespace {
-class MetadataQueryImpl : public MetadataQuery {
- public:
- MetadataQueryImpl() {
- }
-
- ~MetadataQueryImpl() {}
-
- bool QueryServer(AutoFreeBuffer* buffer) {
- if (!client_->IsOpen()) {
- client_ = avd::SharedFD::SocketLocalClient(
- "gce_metadata", true, SOCK_STREAM);
-
- if (!client_->IsOpen()) {
- LOG(ERROR) << "Couldn't connect to metadata proxy.";
- return false;
- }
- }
-
- int32_t length;
- client_->Read(&length, sizeof(length));
-
- if ((length < 0) || (length > (1 << 20))) {
- LOG(ERROR) << "Invalid metadata length: " << length;
- client_->Close();
- return false;
- }
-
- buffer->Resize(length);
- client_->Read(buffer->data(), length);
- buffer->Resize(length + 1);
- return true;
- }
-
- private:
- avd::SharedFD client_;
-};
-} // namespace
-
-MetadataQuery* MetadataQuery::New() {
- return new MetadataQueryImpl();
-}
-
diff --git a/common/libs/metadata/metadata_query.h b/common/libs/metadata/metadata_query.h
deleted file mode 100644
index 77ceeb3..0000000
--- a/common/libs/metadata/metadata_query.h
+++ /dev/null
@@ -1,34 +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 CUTTLEFISH_COMMON_COMMON_LIBS_METADATA_METADATA_QUERY_H_
-#define CUTTLEFISH_COMMON_COMMON_LIBS_METADATA_METADATA_QUERY_H_
-
-#include "common/libs/auto_resources/auto_resources.h"
-
-static const int kMaxMetadataResponseBufferSize = 65536;
-
-class MetadataQuery {
- public:
- virtual ~MetadataQuery() {}
-
- // Request metadata from the server.
- // On success returns true, and current metadata in supplied buffer.
- virtual bool QueryServer(AutoFreeBuffer* buffer) = 0;
-
- static MetadataQuery* New();
-};
-
-#endif // CUTTLEFISH_COMMON_COMMON_LIBS_METADATA_METADATA_QUERY_H_
diff --git a/guest/ril/vsoc_ril.cpp b/guest/ril/vsoc_ril.cpp
index a1bd926..2479c34 100644
--- a/guest/ril/vsoc_ril.cpp
+++ b/guest/ril/vsoc_ril.cpp
@@ -499,8 +499,7 @@
pp_calls[i] = &(p_calls[i]);
}
- // TODO(ender): This should be built from calls requested via RequestDial
- // and calls simulated via metadata or command line.
+ // TODO(ender): This should be built from calls requested via RequestDial.
for (std::map<int, CallState>::iterator iter = gActiveCalls.begin();
iter != gActiveCalls.end(); ++iter, ++p_calls) {
p_calls->state = iter->second.state;