Commit 817aa173 authored by Luke Sorenson's avatar Luke Sorenson Committed by Commit Bot

Component Updater IDL interface for MPP

Bug: 780546
Change-Id: Ic363067d95e66f340f9c9425381d57eafd474980
Reviewed-on: https://chromium-review.googlesource.com/751285Reviewed-by: default avatarIlya Sherman <isherman@chromium.org>
Reviewed-by: default avatarToni Barzic <tbarzic@chromium.org>
Commit-Queue: Ilya Sherman <isherman@chromium.org>
Cr-Commit-Position: refs/heads/master@{#516010}
parent ddf12d1e
...@@ -216,6 +216,7 @@ mri::State::Status StateStatusIdlToProto(const State& state) { ...@@ -216,6 +216,7 @@ mri::State::Status StateStatusIdlToProto(const State& state) {
case STATUS_RESTARTING: case STATUS_RESTARTING:
return mri::State::RESTARTING; return mri::State::RESTARTING;
case STATUS_SERVICE_ERROR: case STATUS_SERVICE_ERROR:
case STATUS_STOPPED: // Process is stopped by MPP.
case STATUS_NONE: case STATUS_NONE:
return mri::State::STATUS_UNSPECIFIED; return mri::State::STATUS_UNSPECIFIED;
} }
......
...@@ -224,6 +224,10 @@ TEST(MediaPerceptionConversionUtilsTest, StateIdlToProto) { ...@@ -224,6 +224,10 @@ TEST(MediaPerceptionConversionUtilsTest, StateIdlToProto) {
state.status = media_perception::STATUS_RESTARTING; state.status = media_perception::STATUS_RESTARTING;
state_proto = StateIdlToProto(state); state_proto = StateIdlToProto(state);
EXPECT_EQ(state_proto.status(), mri::State::RESTARTING); EXPECT_EQ(state_proto.status(), mri::State::RESTARTING);
state.status = media_perception::STATUS_STOPPED;
state_proto = StateIdlToProto(state);
EXPECT_EQ(mri::State::STATUS_UNSPECIFIED, state_proto.status());
} }
} // namespace extensions } // namespace extensions
...@@ -87,4 +87,15 @@ void MediaPerceptionPrivateGetDiagnosticsFunction::GetDiagnosticsCallback( ...@@ -87,4 +87,15 @@ void MediaPerceptionPrivateGetDiagnosticsFunction::GetDiagnosticsCallback(
Respond(OneArgument(diagnostics.ToValue())); Respond(OneArgument(diagnostics.ToValue()));
} }
MediaPerceptionPrivateSetAnalyticsComponentFunction::
MediaPerceptionPrivateSetAnalyticsComponentFunction() {}
MediaPerceptionPrivateSetAnalyticsComponentFunction::
~MediaPerceptionPrivateSetAnalyticsComponentFunction() {}
ExtensionFunction::ResponseAction
MediaPerceptionPrivateSetAnalyticsComponentFunction::Run() {
return RespondNow(Error("Not implemented."));
}
} // namespace extensions } // namespace extensions
...@@ -66,6 +66,22 @@ class MediaPerceptionPrivateGetDiagnosticsFunction ...@@ -66,6 +66,22 @@ class MediaPerceptionPrivateGetDiagnosticsFunction
DISALLOW_COPY_AND_ASSIGN(MediaPerceptionPrivateGetDiagnosticsFunction); DISALLOW_COPY_AND_ASSIGN(MediaPerceptionPrivateGetDiagnosticsFunction);
}; };
class MediaPerceptionPrivateSetAnalyticsComponentFunction
: public UIThreadExtensionFunction {
public:
MediaPerceptionPrivateSetAnalyticsComponentFunction();
DECLARE_EXTENSION_FUNCTION("mediaPerceptionPrivate.setAnalyticsComponent",
MEDIAPERCEPTIONPRIVATE_SETANALYTICSCOMPONENT);
private:
~MediaPerceptionPrivateSetAnalyticsComponentFunction() override;
// ExtensionFunction:
ResponseAction Run() override;
DISALLOW_COPY_AND_ASSIGN(MediaPerceptionPrivateSetAnalyticsComponentFunction);
};
} // namespace extensions } // namespace extensions
#endif // EXTENSIONS_BROWSER_API_MEDIA_PERCEPTION_PRIVATE_MEDIA_PERCEPTION_PRIVATE_API_H_ #endif // EXTENSIONS_BROWSER_API_MEDIA_PERCEPTION_PRIVATE_MEDIA_PERCEPTION_PRIVATE_API_H_
...@@ -1260,6 +1260,7 @@ enum HistogramValue { ...@@ -1260,6 +1260,7 @@ enum HistogramValue {
ACCESSIBILITY_PRIVATE_SETNATIVECHROMEVOXARCSUPPORTFORCURRENTAPP, ACCESSIBILITY_PRIVATE_SETNATIVECHROMEVOXARCSUPPORTFORCURRENTAPP,
LANGUAGESETTINGSPRIVATE_SETENABLETRANSLATIONFORLANGUAGE, LANGUAGESETTINGSPRIVATE_SETENABLETRANSLATIONFORLANGUAGE,
LANGUAGESETTINGSPRIVATE_MOVELANGUAGE, LANGUAGESETTINGSPRIVATE_MOVELANGUAGE,
MEDIAPERCEPTIONPRIVATE_SETANALYTICSCOMPONENT,
// Last entry: Add new entries above, then run: // Last entry: Add new entries above, then run:
// python tools/metrics/histograms/update_extension_histograms.py // python tools/metrics/histograms/update_extension_histograms.py
ENUM_BOUNDARY ENUM_BOUNDARY
......
...@@ -29,13 +29,16 @@ namespace mediaPerceptionPrivate { ...@@ -29,13 +29,16 @@ namespace mediaPerceptionPrivate {
// the media processing pipeline is suspended. // the media processing pipeline is suspended.
SUSPENDED, SUSPENDED,
// Enum for restarting the media analytics process using upstart. // Enum for restarting the media analytics process using Upstart.
// Calling setState <code>RESTARTING</code> will restart the media process // Calling setState <code>RESTARTING</code> will restart the media process
// to the <code>SUSPENDED</code> state. The app has to set the state to // to the <code>SUSPENDED</code> state. The app has to set the state to
// <code>RUNNING</code> in order to start receiving media perception // <code>RUNNING</code> in order to start receiving media perception
// information again. // information again.
RESTARTING, RESTARTING,
// Stops the media analytics process via Upstart.
STOPPED,
// Indicates that a ServiceError has occurred. // Indicates that a ServiceError has occurred.
SERVICE_ERROR SERVICE_ERROR
}; };
...@@ -54,6 +57,33 @@ namespace mediaPerceptionPrivate { ...@@ -54,6 +57,33 @@ namespace mediaPerceptionPrivate {
SERVICE_BUSY_LAUNCHING SERVICE_BUSY_LAUNCHING
}; };
enum ComponentType {
// The smaller component with limited functionality (smaller size and
// limited models).
LIGHT,
// The fully-featured component with more functionality (larger size and
// more models).
FULL
};
// The status of the media analytics process component on the device.
enum ComponentStatus {
UNKNOWN,
// The component is successfully installed and the image is mounted.
INSTALLED,
// The component failed to download, install or load.
FAILED_TO_INSTALL
};
dictionary Component {
ComponentType type;
};
// The state of the media analytics downloadable component.
dictionary ComponentState {
ComponentStatus status;
};
// The system and configuration state of the analytics process. // The system and configuration state of the analytics process.
dictionary State { dictionary State {
Status status; Status status;
...@@ -192,6 +222,8 @@ namespace mediaPerceptionPrivate { ...@@ -192,6 +222,8 @@ namespace mediaPerceptionPrivate {
callback DiagnosticsCallback = void(Diagnostics diagnostics); callback DiagnosticsCallback = void(Diagnostics diagnostics);
callback ComponentStateCallback = void(ComponentState componentState);
interface Functions { interface Functions {
// Gets the status of the media perception process. // Gets the status of the media perception process.
// |callback| : The current state of the system. // |callback| : The current state of the system.
...@@ -208,6 +240,20 @@ namespace mediaPerceptionPrivate { ...@@ -208,6 +240,20 @@ namespace mediaPerceptionPrivate {
// Get a diagnostics buffer out of the video analytics process. // Get a diagnostics buffer out of the video analytics process.
// |callback| : Returns a Diagnostics dictionary object. // |callback| : Returns a Diagnostics dictionary object.
static void getDiagnostics(DiagnosticsCallback callback); static void getDiagnostics(DiagnosticsCallback callback);
// Attempts to download and load the media analytics component. This
// function should be called every time a client starts using this API. If
// the component is already loaded, the callback will simply return that
// information. The process must be <code>STOPPED</code> for this function
// to succeed.
// Note: If a different component type is desired, this function can
// be called with the new desired type and the new component will be
// downloaded and installed.
// |component| : The desired component to install and load.
// |callback| : Returns the state of the component.
static void setAnalyticsComponent(
Component component,
ComponentStateCallback callback);
}; };
interface Events { interface Events {
......
...@@ -14007,6 +14007,7 @@ Called by update_net_error_codes.py.--> ...@@ -14007,6 +14007,7 @@ Called by update_net_error_codes.py.-->
<int value="1198" <int value="1198"
label="LANGUAGESETTINGSPRIVATE_SETENABLETRANSLATIONFORLANGUAGE"/> label="LANGUAGESETTINGSPRIVATE_SETENABLETRANSLATIONFORLANGUAGE"/>
<int value="1199" label="LANGUAGESETTINGSPRIVATE_MOVELANGUAGE"/> <int value="1199" label="LANGUAGESETTINGSPRIVATE_MOVELANGUAGE"/>
<int value="1200" label="MEDIAPERCEPTIONPRIVATE_SETANALYTICSCOMPONENT"/>
</enum> </enum>
<enum name="ExtensionIconState"> <enum name="ExtensionIconState">
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment