buffet: Fix state update notification to GCD cloud server

Device state notification from buffet's state manager are coming
with state property names in form "package_name.property_name" and
that's how they were reported to the GCD server instead of being
split in JSON as {"package_name": {"property_name": value}}.

Also added "buffet_client GetState" command to retrieve actual
internal device state from buffet bypassing the GCD server-dependent
GetDeviceInfo. This is useful for debugging and also in case of
local-only workflow (with no GCD server present).

Finally, modified "buffet_client UpdateState" to allow complex
non-string state properties to be set. Now this command expects
a property name followed by a properly formed json value for the
property. Strings now require double-quotes. Integers, Booleans,
lists and dictionaries can now be set too.

BUG=chromium:449250
TEST=FEATURES=test USE=examples emerge-link buffet
     Deployed and tested on device

Change-Id: Id2c97b422c56ec6648994ab37bb47284a6fb2041
Reviewed-on: https://chromium-review.googlesource.com/241955
Tested-by: Alex Vakulenko <avakulenko@chromium.org>
Reviewed-by: Anton Muhin <antonm@chromium.org>
Commit-Queue: Alex Vakulenko <avakulenko@chromium.org>
diff --git a/buffet/device_registration_info.cc b/buffet/device_registration_info.cc
index 0b95c90..fb59f3b 100644
--- a/buffet/device_registration_info.cc
+++ b/buffet/device_registration_info.cc
@@ -805,7 +805,11 @@
       if (!value) {
         return;
       }
-      changes->SetWithoutPathExpansion(pair.first, value.release());
+      // The key in |pair.first| is the full property name in format
+      // "package.property_name", so must use DictionaryValue::Set() instead of
+      // DictionaryValue::SetWithoutPathExpansion to recreate the JSON
+      // property tree properly.
+      changes->Set(pair.first, value.release());
     }
     patch->Set("patch", changes.release());