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
82message VibrationAttributesProto {
83    option (.android.msg_privacy).dest = DEST_AUTOMATIC;
84    optional int32 usage = 1;
85    optional int32 audio_usage = 2;
86    optional int32 flags = 3;
87}
88
89// Next Tag: 9
90message VibrationProto {
91    option (.android.msg_privacy).dest = DEST_AUTOMATIC;
92    optional int64 start_time = 1;
93    optional int64 end_time = 2;
94    optional CombinedVibrationEffectProto effect = 3;
95    optional CombinedVibrationEffectProto original_effect = 4;
96    optional VibrationAttributesProto attributes = 5;
97    optional int64 duration_ms = 7;
98    optional Status status = 8;
99    reserved 6; // prev int32 status
100
101    // Also used by VibrationReported from frameworks/proto_logging/stats/atoms.proto.
102    // Next Tag: 26
103    enum Status {
104        UNKNOWN = 0;
105        RUNNING = 1;
106        FINISHED = 2;
107        FINISHED_UNEXPECTED = 3;  // Didn't terminate in the usual way.
108        FORWARDED_TO_INPUT_DEVICES = 4;
109        CANCELLED_BINDER_DIED = 5;
110        CANCELLED_BY_SCREEN_OFF = 6;
111        CANCELLED_BY_SETTINGS_UPDATE = 7;
112        CANCELLED_BY_USER = 8;
113        CANCELLED_BY_UNKNOWN_REASON = 9;
114        CANCELLED_SUPERSEDED = 10;
115        IGNORED_ERROR_APP_OPS = 11;
116        IGNORED_ERROR_CANCELLING = 12;
117        IGNORED_ERROR_SCHEDULING = 13;
118        IGNORED_ERROR_TOKEN= 14;
119        IGNORED_APP_OPS = 15;
120        IGNORED_BACKGROUND = 16;
121        IGNORED_UNKNOWN_VIBRATION = 17;
122        IGNORED_UNSUPPORTED = 18;
123        IGNORED_FOR_EXTERNAL = 19;
124        IGNORED_FOR_HIGHER_IMPORTANCE = 20;
125        IGNORED_FOR_ONGOING = 21;
126        IGNORED_FOR_POWER = 22;
127        IGNORED_FOR_RINGER_MODE = 23;
128        IGNORED_FOR_SETTINGS = 24;
129        IGNORED_SUPERSEDED = 25;
130        IGNORED_FROM_VIRTUAL_DEVICE = 26;
131    }
132}
133
134// Next Tag: 25
135message VibratorManagerServiceDumpProto {
136    option (.android.msg_privacy).dest = DEST_AUTOMATIC;
137    repeated int32 vibrator_ids = 1;
138    optional VibrationProto current_vibration = 2;
139    optional bool is_vibrating = 3;
140    optional VibrationProto current_external_vibration = 4;
141    optional bool vibrator_under_external_control = 5;
142    optional bool low_power_mode = 6;
143    optional bool vibrate_on = 24;
144    optional int32 alarm_intensity = 18;
145    optional int32 alarm_default_intensity = 19;
146    optional int32 haptic_feedback_intensity = 7;
147    optional int32 haptic_feedback_default_intensity = 8;
148    optional int32 hardware_feedback_intensity = 22;
149    optional int32 hardware_feedback_default_intensity = 23;
150    optional int32 media_intensity = 20;
151    optional int32 media_default_intensity = 21;
152    optional int32 notification_intensity = 9;
153    optional int32 notification_default_intensity = 10;
154    optional int32 ring_intensity = 11;
155    optional int32 ring_default_intensity = 12;
156    repeated VibrationProto previous_ring_vibrations = 13;
157    repeated VibrationProto previous_notification_vibrations = 14;
158    repeated VibrationProto previous_alarm_vibrations = 15;
159    repeated VibrationProto previous_vibrations = 16;
160    repeated VibrationProto previous_external_vibrations = 17;
161}