1 /* 2 * Copyright (C) 2024 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 17 package com.google.android.msdl.data.model 18 19 import android.os.VibrationEffect 20 21 /** 22 * A haptic composition as a list of [HapticCompositionPrimitive] and a [android.os.VibrationEffect] 23 * to use as a fallback. 24 */ 25 data class HapticComposition( 26 val primitives: List<HapticCompositionPrimitive>, 27 val fallbackEffect: VibrationEffect, 28 ) 29 30 /** 31 * An abstraction of a haptic primitive in a composition that includes: 32 * 33 * @param[primitiveId] The id of the primitive. 34 * @param[scale] The scale of the primitive. 35 * @param[delayMillis] The delay of the primitive relative to the end of a previous primitive. Given 36 * in milliseconds. 37 */ 38 data class HapticCompositionPrimitive( 39 val primitiveId: Int, 40 var scale: Float = 1f, 41 var delayMillis: Int = 0, 42 ) 43