Pass saved parameters to boot action
Bug: http://b/65462981
Test: Parameters in next_boot.json are passed to
boot action; next_boot.json is moved to
last_boot.json to allow reading by
DeviceManagementService.
Change-Id: Ie290711ea48a3a221cfad2e9266215b76631ecbd
diff --git a/cmds/bootanimation/iot/BootAction.h b/cmds/bootanimation/iot/BootAction.h
index 495aa4f..d8bff75 100644
--- a/cmds/bootanimation/iot/BootAction.h
+++ b/cmds/bootanimation/iot/BootAction.h
@@ -17,16 +17,40 @@
#ifndef _BOOTANIMATION_BOOTACTION_H
#define _BOOTANIMATION_BOOTACTION_H
+#include <map>
#include <string>
+#include <base/json/json_value_converter.h>
#include <utils/RefBase.h>
+using base::JSONValueConverter;
+
namespace android {
class BootAction : public RefBase {
public:
+ struct BootParameter {
+ const char* key;
+ const char* value;
+ };
+
+ struct SavedBootParameters {
+ int brightness;
+ int volume;
+ ScopedVector<std::string> param_names;
+ ScopedVector<std::string> param_values;
+ static void RegisterJSONConverter(
+ JSONValueConverter<SavedBootParameters>* converter);
+ };
+
~BootAction();
+ // Rename next_boot.json to last_boot.json so that we don't repeat
+ // parameters if there is a crash before the framework comes up.
+ // TODO(b/65462981): Is this what we want to do? Should we swap in the
+ // framework instead?
+ static void swapBootConfigs();
+
// libraryPath is a fully qualified path to the target .so library.
bool init(const std::string& libraryPath);
@@ -41,7 +65,7 @@
void shutdown();
private:
- typedef bool (*libInit)();
+ typedef bool (*libInit)(const BootParameter* parameters, size_t num_parameters);
typedef void (*libStartPart)(int partNumber, int playNumber);
typedef void (*libShutdown)();