1/*
2 * Copyright (C) 2020 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17syntax = "proto2";
18package com.android.server.vibrator;
19
20option java_multiple_files = true;
21
22import "frameworks/base/core/proto/android/privacy.proto";
23
24message StepSegmentProto {
25   option (.android.msg_privacy).dest = DEST_AUTOMATIC;
26   optional int32 duration = 1;
27   optional float amplitude = 2;
28   optional float frequency = 3;
29}
30
31message RampSegmentProto {
32    option (.android.msg_privacy).dest = DEST_AUTOMATIC;
33    optional int32 duration = 1;
34    optional float startAmplitude = 2;
35    optional float endAmplitude = 3;
36    optional float startFrequency = 4;
37    optional float endFrequency = 5;
38}
39
40message PrebakedSegmentProto {
41    option (.android.msg_privacy).dest = DEST_AUTOMATIC;
42    optional int32 effect_id = 1;
43    optional int32 effect_strength = 2;
44    optional int32 fallback = 3;
45}
46
47message PrimitiveSegmentProto {
48    option (.android.msg_privacy).dest = DEST_AUTOMATIC;
49    optional int32 primitive_id = 1;
50    optional float scale = 2;
51    optional int32 delay = 3;
52}
53
54message SegmentProto {
55    option (.android.msg_privacy).dest = DEST_AUTOMATIC;
56    optional PrebakedSegmentProto prebaked = 1;
57    optional PrimitiveSegmentProto primitive = 2;
58    optional StepSegmentProto step = 3;
59    optional RampSegmentProto ramp = 4;
60}
61
62// A com.android.os.VibrationEffect object.
63message VibrationEffectProto {
64    option (.android.msg_privacy).dest = DEST_AUTOMATIC;
65    optional SegmentProto segments = 1;
66    required int32 repeat = 2;
67}
68
69message SyncVibrationEffectProto {
70    option (.android.msg_privacy).dest = DEST_AUTOMATIC;
71    repeated VibrationEffectProto effects = 1;
72    repeated int32 vibrator_ids = 2;
73}
74
75// A com.android.os.CombinedVibrationEffect object.
76message CombinedVibrationEffectProto {
77    option (.android.msg_privacy).dest = DEST_AUTOMATIC;
78    repeated SyncVibrationEffectProto effects = 1;
79    repeated int32 delays = 2;
80}
81
82// Next Tag: 5
83message VibrationAttributesProto {
84    option (.android.msg_privacy).dest = DEST_AUTOMATIC;
85    optional int32 usage = 1;
86    optional int32 audio_usage = 2;
87    optional int32 flags = 3;
88    optional int32 category = 4;
89}
90
91// Next Tag: 4
92message VibrationParamProto {
93    option (.android.msg_privacy).dest = DEST_AUTOMATIC;
94    optional VibrationScaleParamProto scale = 1;
95    optional int64 create_time = 2;
96    optional bool is_from_request = 3;
97}
98
99// Next Tag: 3
100message VibrationScaleParamProto {
101    option (.android.msg_privacy).dest = DEST_AUTOMATIC;
102    optional int32 types_mask = 1;
103    optional float scale = 2;
104}
105
106// Next Tag: 9
107message VibrationProto {
108    option (.android.msg_privacy).dest = DEST_AUTOMATIC;
109    optional int64 start_time = 1;
110    optional int64 end_time = 2;
111    optional CombinedVibrationEffectProto played_effect = 3;
112    optional CombinedVibrationEffectProto original_effect = 4;
113    optional VibrationAttributesProto attributes = 5;
114    optional int64 duration_ms = 7;
115    optional Status status = 8;
116    reserved 6; // prev int32 status
117
118    // Also used by VibrationReported from frameworks/proto_logging/stats/atoms.proto.
119    // Next Tag: 29
120    enum Status {
121        UNKNOWN = 0;
122        RUNNING = 1;
123        FINISHED = 2;
124        FINISHED_UNEXPECTED = 3;  // Didn't terminate in the usual way.
125        FORWARDED_TO_INPUT_DEVICES = 4;
126        CANCELLED_BINDER_DIED = 5;
127        CANCELLED_BY_SCREEN_OFF = 6;
128        CANCELLED_BY_SETTINGS_UPDATE = 7;
129        CANCELLED_BY_USER = 8;
130        CANCELLED_BY_UNKNOWN_REASON = 9;
131        CANCELLED_SUPERSEDED = 10;
132        IGNORED_ERROR_APP_OPS = 11;
133        IGNORED_ERROR_CANCELLING = 12;
134        IGNORED_ERROR_SCHEDULING = 13;
135        IGNORED_ERROR_TOKEN= 14;
136        IGNORED_APP_OPS = 15;
137        IGNORED_BACKGROUND = 16;
138        IGNORED_UNSUPPORTED = 18;
139        IGNORED_FOR_EXTERNAL = 19;
140        IGNORED_FOR_HIGHER_IMPORTANCE = 20;
141        IGNORED_FOR_ONGOING = 21;
142        IGNORED_FOR_POWER = 22;
143        IGNORED_FOR_RINGER_MODE = 23;
144        IGNORED_FOR_SETTINGS = 24;
145        IGNORED_SUPERSEDED = 25;
146        IGNORED_FROM_VIRTUAL_DEVICE = 26;
147        IGNORED_ON_WIRELESS_CHARGER = 27;
148        IGNORED_MISSING_PERMISSION = 28;
149        reserved 17; // prev IGNORED_UNKNOWN_VIBRATION
150    }
151}
152
153// Next Tag: 29
154message VibratorManagerServiceDumpProto {
155    option (.android.msg_privacy).dest = DEST_AUTOMATIC;
156    repeated int32 vibrator_ids = 1;
157    optional VibrationProto current_vibration = 2;
158    optional bool is_vibrating = 3;
159    optional int32 is_vibrator_controller_registered = 27;
160    optional VibrationProto current_external_vibration = 4;
161    optional bool vibrator_under_external_control = 5;
162    optional bool low_power_mode = 6;
163    optional bool vibrate_on = 24;
164    optional bool keyboard_vibration_on = 25;
165    optional int32 default_vibration_amplitude = 26;
166    optional int32 alarm_intensity = 18;
167    optional int32 alarm_default_intensity = 19;
168    optional int32 haptic_feedback_intensity = 7;
169    optional int32 haptic_feedback_default_intensity = 8;
170    optional int32 hardware_feedback_intensity = 22;
171    optional int32 hardware_feedback_default_intensity = 23;
172    optional int32 media_intensity = 20;
173    optional int32 media_default_intensity = 21;
174    optional int32 notification_intensity = 9;
175    optional int32 notification_default_intensity = 10;
176    optional int32 ring_intensity = 11;
177    optional int32 ring_default_intensity = 12;
178    repeated VibrationProto previous_ring_vibrations = 13;
179    repeated VibrationProto previous_notification_vibrations = 14;
180    repeated VibrationProto previous_alarm_vibrations = 15;
181    repeated VibrationProto previous_vibrations = 16;
182    repeated VibrationParamProto previous_vibration_params = 28;
183    reserved 17; // prev previous_external_vibrations
184}