// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// Next MinVersion: 37
module arc.mojom;
import "ash/components/arc/mojom/bitmap.mojom";
import "ash/components/arc/mojom/gfx.mojom";
// These values must be matched with the NOTIFICATION_EVENT_* constants in
// com.android.server.ArcNotificationListenerService.
[Extensible]
enum ArcNotificationEvent {
BODY_CLICKED = 0,
CLOSED = 1,
// Deprecated: Five button events
DEPRECATED_BUTTON_1_CLICKED = 2,
DEPRECATED_BUTTON_2_CLICKED = 3,
DEPRECATED_BUTTON_3_CLICKED = 4,
DEPRECATED_BUTTON_4_CLICKED = 5,
DEPRECATED_BUTTON_5_CLICKED = 6,
// expand/collapse the bundled notification
[MinVersion=10] TOGGLE_EXPANSION = 7,
// The notification is activated/deactivated. Please note that they are sent
// only in limited instances e.g. when remote input opens, or when spoken
// feedback is enabled.
[MinVersion=24] ACTIVATED = 8,
[MinVersion=24] DEACTIVATED = 9,
};
[Extensible]
enum ArcNotificationType {
SIMPLE = 0,
DEPRECATED_IMAGE = 1,
DEPRECATED_PROGRESS = 2,
DEPRECATED_LIST = 3,
BUNDLED = 4,
};
// These values are corresponding to the priorities or importance of Android
// notification.
[Extensible]
enum ArcNotificationPriority {
NONE = -3,
MIN = -2,
LOW = -1,
DEFAULT = 0,
HIGH = 1,
MAX = 2,
};
// Action buttons when the ARC notification is rendered in Chrome
struct ArcNotificationButton {
// Title
string label;
// Reply button placeholder, if exist.
[MinVersion=31]
string? buttonPlaceholder;
};
[Extensible]
enum ArcNotificationExpandState {
FIXED_SIZE = 0,
COLLAPSED = 1,
EXPANDED = 2,
};
[Extensible]
enum ArcNotificationRemoteInputState {
CLOSED = 0,
OPENED = 1,
};
// These values represent what shows in an ARC custom notification.
[Extensible]
enum ArcNotificationShownContents {
// The normal notification contents are shown.
CONTENTS_SHOWN = 0,
// The notification settings view is shown.
SETTINGS_SHOWN = 1,
// The notification snooze settings view is shown.
[MinVersion=17]
SNOOZE_SHOWN = 2,
};
// Flag for various feature of ARC notifications.
struct ArcNotificationFlags {
// Bits for features.
const uint32 SUPPORT_SNOOZE = 1; // 1 << 0
// Bit-masked value.
uint32 value;
};
// These values represent the styles for large-format notifications.
// These values are persisted to logs. Entries should not be renumbered and
// numeric values should never be reused.
[Extensible]
enum ArcNotificationStyle {
NO_STYLE = 0,
BIG_PICTURE_STYLE = 1,
BIG_TEXT_STYLE = 2,
MESSAGING_STYLE = 3,
INBOX_STYLE = 4,
MEDIA_STYLE = 5,
DECORATED_CUSTOM_VIEW_STYLE = 6,
DECORATED_MEDIA_CUSTOM_VIEW_STYLE = 7,
[MinVersion=33] CALL_STYLE = 8,
};
struct ArcNotificationData {
// Identifier of notification
string key;
// Type of notification
ArcNotificationType type;
// Body message of notification
string message;
// Title of notification
string title;
// The app name of the notification. Displayed when the notification is
// rendered in ChromeOS and is expanded.
string? app_display_name;
// DEPRECATED: Binary data of the icon
array<uint8>? deprecated_icon_data;
// Priority of notification
ArcNotificationPriority priority;
// Timestamp related to the notification
int64 time;
// The current value of progress. If in progress, the value must be in
// [0, progress_max]. Set to -1 for indeterminate progress.
int32 progress_current;
// The maximum value of progress. Set to -1 when the progress does not exist
// or ended.
int32 progress_max;
// Action buttons, provided when the notification is action enabled and
// rendered on Chrome.
array<ArcNotificationButton>? buttons;
// Flag if the notification has FLAG_NO_CLEAR.
[MinVersion=1]
bool no_clear;
// Flag if the notification has FLAG_ONGOING_EVENT.
[MinVersion=1]
bool ongoing_event;
// Subtexts for list notifications. Provided when the notification style is
// inbox.
[MinVersion=3]
array<string>? texts;
// Image for image notifications.
[MinVersion=3]
ArcBitmap? big_picture;
// Flag if a notification is a custom notification backed by a
// notification surface.
[MinVersion=5]
bool is_custom_notification;
[MinVersion=6]
ArcBitmap? small_icon;
// A snapshot image to show before the notification window is created.
[MinVersion=7]
ArcBitmap? snapshot_image;
[MinVersion=7]
float snapshot_image_scale;
// Accessibility text
[MinVersion=8]
string? accessible_name;
// Flag if the notification is expandable
[MinVersion=10]
ArcNotificationExpandState expand_state;
// Flag for what shows in a notification.
[MinVersion=11]
ArcNotificationShownContents shown_contents;
[MinVersion=12]
ArcNotificationRemoteInputState remote_input_state;
// Indicates a rect for which Android wants to handle swipe events for by
// itself. The coordinates in this Rect are in Android pixels and represent
// a sub-rectangle of the notification, with the origin being the top left
// of the notification.
[MinVersion=14]
Rect? swipe_input_rect;
[MinVersion=15]
string? package_name;
[MinVersion=17]
ArcNotificationFlags? flags;
// Flag if a notification progress is indeterminate.
[MinVersion=21]
bool indeterminate_progress;
[MinVersion=21]
ArcBitmap? snapshot_image_public;
[MinVersion=23]
bool is_media_notification;
[MinVersion=26]
ArcNotificationStyle style;
// True if there's at least one action button enabled for the notification.
[MinVersion=26]
bool is_action_enabled;
// True if there's at least one action button on the notification that's
// available for the user to trigger remote input.
[MinVersion=27]
bool is_inline_reply_enabled;
// True if rendering should be done on the Chrome side
[MinVersion=28]
bool render_on_chrome;
[MinVersion=29]
// Identifier of the group to which the notification is assigned
string? group_key;
// The index of reply button among all actions, if exist. Otherwise set to -1.
[MinVersion=30]
int32 reply_button_index;
[MinVersion=34]
array<ArcNotificationData>? children_data;
// Array of extra messages for messaging style notifications.
[MinVersion=35]
array<ArcNotificationMessage>? messages;
};
struct ArcDoNotDisturbStatus {
bool enabled;
};
struct ArcNotificationUserActionData {
// Unique action id for this user action.
uint32 action_id;
// DEPRECATED: Notification key of top-level notification which contains
// the notification which is initiating this action.
string top_level_notification_key_deprecated;
// True if the task should be executed on the unlocked state.
bool defer_until_unlock;
// True if the notification view should be focused after unlock. This is
// effective only when |defer_until_unlock| is true.
bool to_be_focused_after_unlock;
};
struct ArcLockScreenNotificationSetting {
// Flag whether to show the notifications on the lock screen.
bool show_notification;
// Flag whether to show the private content on the lock screen.
bool show_private_notification;
};
struct NotificationConfiguration {
// Flag to enable notification expansion animations on arc.
// See b/35786193.
bool expansion_animation;
};
// These values represent an visibility of MessageCenter on Chrome OS.
[Extensible]
enum MessageCenterVisibility {
// When nothing or just toast popups are being displayed.
VISIBILITY_TRANSIENT = 0,
// When the message center view is being displayed.
VISIBILITY_MESSAGE_CENTER = 1,
};
struct ArcNotificationMessage {
// Message that was sent in the notification.
string? message;
// Name of the message sender that should be displayed above message.
string? sender_name;
// Profile icon of the message sender that needs to be displayed on the left
// of message.
ArcBitmap? sender_icon;
};
// Next Method ID: 12
interface NotificationsHost {
// Set the Do-Not-Disturb status on Chrome side from Android side.
[MinVersion=18]
OnDoNotDisturbStatusUpdated@7(ArcDoNotDisturbStatus status);
// Tells the Chrome that a notification is posted (created or updated) on
// Android. If you know that the notification exists, please consider to use
// OnNotificationUpdate instead.
// |notification_data| is the data of notification (id, texts, icon and ...).
OnNotificationPosted@0(ArcNotificationData notification_data);
// Notifies that a notification is removed on Android.
// |key| is the identifier of the notification.
OnNotificationRemoved@1(string key);
[MinVersion=13]
// Notifies that an existing notiication is updated on Android.
OnNotificationUpdated@5(ArcNotificationData notification_data);
[MinVersion=16]
// Opens the Chrome OS message center.
OpenMessageCenter@6();
[MinVersion=20]
// Closes the Chrome OS message center.
CloseMessageCenter@8();
[MinVersion=21]
// Processes the user action initiated from Android side on Chrome side.
ProcessUserAction@9(ArcNotificationUserActionData data);
[MinVersion=21]
// Sets the lock screen setting on Chrome side from Android side. Usually
// invoked when the setting on Android side is chagned.
OnLockScreenSettingUpdated@10(ArcLockScreenNotificationSetting setting);
[MinVersion=27]
// Triggers Chrome to log that inline reply is sent for a notification.
LogInlineReplySent@11(string key);
};
// Deprecated method IDs: 0
// Next Method ID: 15
interface NotificationsInstance {
// Establishes full-duplex communication with the host.
[MinVersion=14] Init@5(pending_remote<NotificationsHost> host_remote) => ();
// Sends an event from Chrome notification UI to Android.
// |event| is a type of occured event.
SendNotificationEventToAndroid@1(string key, ArcNotificationEvent event);
// Requests to Android side to create the notification window.
// |key| is the identifier of the notification which is generated by Android
// side.
[MinVersion=7]
CreateNotificationWindow@2(string key);
// Requests to Android side to close the notification window.
// |key| is the identifier of the notification which is generated by Android
// side.
[MinVersion=7]
CloseNotificationWindow@3(string key);
// Requests to Android side to open notification settings.
// |key| is the identifier of the notification which is generated by Android
// side.
[MinVersion=9]
OpenNotificationSettings@4(string key);
// Requests to Android side to open snooze settings.
// |key| is the identifier of the notification which is generated by Android
// side.
[MinVersion=17]
OpenNotificationSnoozeSettings@6(string key);
// Sets the Do-Not-Disturb status on Android side from Chrome side.
[MinVersion=18]
SetDoNotDisturbStatusOnAndroid@7(ArcDoNotDisturbStatus status);
// Cancels the current press operation even during touching the view. This
// should be called when the on-going gesture is recognized not as a normal
// touch event but as a scroll event, and the on-going touch events should be
// cancelled.
[MinVersion=19]
CancelPress@8(string key);
// Performs the user action being deferred in Android.
[MinVersion=21]
PerformDeferredUserAction@9(uint32 action_id);
// Cancels the user action being deferred in Android.
[MinVersion=21]
CancelDeferredUserAction@10(uint32 action_id);
// Sets the lock screen notification setting on Android side from Chrome side.
[MinVersion=21]
SetLockScreenSettingOnAndroid@11(ArcLockScreenNotificationSetting setting);
// Set configuration variables for notifications.
[MinVersion=22]
SetNotificationConfiguration@12(NotificationConfiguration configuration);
// Reports that Message Center visibility has changed.
[MinVersion=25]
OnMessageCenterVisibilityChanged@13(MessageCenterVisibility visibility);
// Sends notification button click event from Chrome notification UI to
// Android. |key| is the identifier of the notification which is generated
// by Android side. |action_button_index| is the index of the action button
// clicked among the buttons array originally passed in ArcNotificationData.
// |input| contains user-supplied text, if the notification allows inline
// reply. Otherwise it is empty string.
[MinVersion=32]
SendNotificationButtonClickToAndroid@14(
string key,
uint32 action_button_index,
string input);
// Pops up the notification settings page for a specific application. This is
// called when the user clicks 'turn off notifications' button in inline
// settings view from the Chrome side in Chrome rendered ARC notifications.
// |key| is the identifier of the notification which is generated by Android
// side.
[MinVersion=36]
PopUpAppNotificationSettings@15(string key);
};