Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 338b49e1 authored by Juan Sebastian Martinez's avatar Juan Sebastian Martinez
Browse files

Introducing the MSDL library and its MSDLRepository

The initial setup for the Soong build system is added with the
Android.bp and AndroidManifest.xml files. The first part of the library
(the MSDLRepository) is also introduced.

Test: atest MSDLRepositoryImplTest
Test: m msdl
Flag: NONE Usage of the library will be guarded by its own flag
Bug: 344654090
Change-Id: I962e3033754699e0b1a87add4404be6d9f3f79cc
parent acfcd1d7
Loading
Loading
Loading
Loading

msdllib/Android.bp

0 → 100644
+72 −0
Original line number Diff line number Diff line
// Copyright (C) 2024 The Android Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package {
    default_team: "trendy_team_motion",
    default_applicable_licenses: ["Android-Apache-2.0"],
}

android_library {
    name: "msdl",
    manifest: "AndroidManifest.xml",
    sdk_version: "system_current",
    min_sdk_version: "31",
    static_libs: [
        "kotlinx_coroutines_android",
    ],
    srcs: [
        "src/**/*.java",
        "src/**/*.kt",
    ],
    kotlincflags: ["-Xjvm-default=all"],
}

android_library {
    name: "msdl-tests-base",
    libs: [
        "android.test.base",
        "androidx.test.core",
    ],
    static_libs: [
        "msdl",
        "androidx.test.ext.junit",
        "androidx.test.rules",
        "testables",
        "truth",
        "kotlinx_coroutines_test",
        "kotlin-test",
    ],
}

android_app {
    name: "TestMSDLApp",
    platform_apis: true,
    static_libs: [
        "msdl-tests-base",
    ],
}

android_test {
    name: "msdl_tests",
    manifest: "tests/AndroidManifest.xml",

    static_libs: [
        "msdl-tests-base",
    ],
    srcs: [
        "tests/src/**/*.kt",
    ],
    kotlincflags: ["-Xjvm-default=all"],
    test_suites: ["general-tests"],
}
+20 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
     Copyright (C) 2024 The Android Open Source Project

     Licensed under the Apache License, Version 2.0 (the "License");
     you may not use this file except in compliance with the License.
     You may obtain a copy of the License at

          http://www.apache.org/licenses/LICENSE-2.0

     Unless required by applicable law or agreed to in writing, software
     distributed under the License is distributed on an "AS IS" BASIS,
     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     See the License for the specific language governing permissions and
     limitations under the License.
-->

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.google.android.msdl">
</manifest>

msdllib/TEST_MAPPING

0 → 100644
+7 −0
Original line number Diff line number Diff line
{
  "postsubmit": [
    {
      "name": "msdl_tests"
    }
  ]
}
+33 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2024 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.google.android.msdl.data.model

/** A haptic composition as a list of [HapticCompositionPrimitive] */
data class HapticComposition(val primitives: List<HapticCompositionPrimitive>? = null)

/**
 * An abstraction of a haptic primitive in a composition that includes:
 *
 * @param[primitiveId] The id of the primitive.
 * @param[scale] The scale of the primitive.
 * @param[delay] The delay of the primitive relative to the end of a previous primitive.
 */
data class HapticCompositionPrimitive(
    val primitiveId: Int,
    var scale: Float = 1f,
    var delay: Int = 0,
)
+38 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2024 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.google.android.msdl.data.model

/** Haptic tokens from the Multi-sensory Design Language (MSDL) */
enum class HapticToken {
    NEGATIVE_CONFIRMATION_HIGH_EMPHASIS,
    NEGATIVE_CONFIRMATION_MEDIUM_EMPHASIS,
    POSITIVE_CONFIRMATION_HIGH_EMPHASIS,
    POSITIVE_CONFIRMATION_MEDIUM_EMPHASIS,
    POSITIVE_CONFIRMATION_LOW_EMPHASIS,
    NEUTRAL_CONFIRMATION_HIGH_EMPHASIS,
    LONG_PRESS,
    SWIPE_THRESHOLD_INDICATOR,
    TAP_HIGH_EMPHASIS,
    TAP_MEDIUM_EMPHASIS,
    DRAG_THRESHOLD_INDICATOR,
    DRAG_INDICATOR,
    TAP_LOW_EMPHASIS,
    KEYPRESS_STANDARD,
    KEYPRESS_SPACEBAR,
    KEYPRESS_RETURN,
    KEYPRESS_DELETE,
}
Loading