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

Commit 072123f6 authored by Yeabkal Wubshit's avatar Yeabkal Wubshit
Browse files

Allow Custom Default Ringer Vibrations

This change allows devices to define and use custom VibrationEffects as
the default vibration used in Ringer. Before this change, devices were
only able to choose between simple and pulse-based vibration, and their
choice was read in Ringer which creates its own effect. With this
change, devices can have full control of the default vibration via a
config resource overlay.

This will allow different devices/form-factors to specify their own
default Ringer vibrations, without having to modify the Ringer code.

Bug: 282113261
Test: atest RingerTest
Change-Id: I63bfa506b357ee5586ca55d7103bb66b7f57ae87
parent 7f80950c
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -28,6 +28,7 @@ android_app {
    static_libs: [
        "androidx.annotation_annotation",
        "androidx.core_core",
        "telecom_flags-lib",
    ],
    libs: [
        "services",
@@ -50,6 +51,7 @@ android_test {
    name: "TelecomUnitTests",
    static_libs: [
        "android-ex-camera2",
        "flag-junit",
        "guava",
        "mockito-target-extended",
        "androidx.test.rules",
@@ -60,6 +62,7 @@ android_test {
        "androidx.fragment_fragment",
        "androidx.test.ext.junit",
        "platform-compat-test-rules",
        "telecom_flags-lib",
    ],
    srcs: [
        "tests/src/**/*.java",

flags/Android.bp

0 → 100644
+32 −0
Original line number Diff line number Diff line
//
// Copyright (C) 2023 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_applicable_licenses: ["Android-Apache-2.0"],
}

aconfig_declarations {
    name: "telecom_flags",
    package: "com.android.server.telecom.flags",
    srcs: [
      "telecom_ringer_flag_declarations.aconfig",
    ],
}

java_aconfig_library {
    name: "telecom_flags-lib",
    aconfig_declarations: "telecom_flags"
}
 No newline at end of file
+8 −0
Original line number Diff line number Diff line
package: "com.android.server.telecom.flags"

flag {
  name: "use_device_provided_serialized_ringer_vibration"
  namespace: "android_platform_telecom"
  description: "Gates whether to use a serialized, device-specific ring vibration."
  bug: "282113261"
}
 No newline at end of file
+4 −2
Original line number Diff line number Diff line
@@ -49,8 +49,10 @@
    <bool name="grant_location_permission_enabled">false</bool>

    <!-- When true, a simple full intensity on/off vibration pattern will be used when calls ring.
         When false, a fancy vibration pattern which ramps up and down will be used.
         Devices should overlay this value based on the type of vibration hardware they employ. -->

         When false, the vibration effect serialized in the raw `default_ringtone_vibration_effect`
         resource (under `frameworks/base/core/res/res/raw/`) is used. Devices should overlay this
         value based on the type of vibration hardware they employ. -->
    <bool name="use_simple_vibration_pattern">false</bool>

    <!-- Threshold for the X+Y component of gravity needed for the device orientation to be
+4 −2
Original line number Diff line number Diff line
@@ -132,6 +132,7 @@ import com.android.server.telecom.callfiltering.IncomingCallFilterGraph;
import com.android.server.telecom.callredirection.CallRedirectionProcessor;
import com.android.server.telecom.components.ErrorDialogActivity;
import com.android.server.telecom.components.TelecomBroadcastReceiver;
import com.android.server.telecom.flags.FeatureFlags;
import com.android.server.telecom.stats.CallFailureCause;
import com.android.server.telecom.ui.AudioProcessingNotification;
import com.android.server.telecom.ui.CallRedirectionTimeoutDialogActivity;
@@ -577,7 +578,8 @@ public class CallsManager extends Call.ListenerBase
            TransactionManager transactionManager,
            EmergencyCallDiagnosticLogger emergencyCallDiagnosticLogger,
            CallAudioCommunicationDeviceTracker communicationDeviceTracker,
            CallStreamingNotification callStreamingNotification) {
            CallStreamingNotification callStreamingNotification,
            FeatureFlags featureFlags) {

        mContext = context;
        mLock = lock;
@@ -643,7 +645,7 @@ public class CallsManager extends Call.ListenerBase
                ringtoneFactory, systemVibrator,
                new Ringer.VibrationEffectProxy(), mInCallController,
                mContext.getSystemService(NotificationManager.class),
                accessibilityManagerAdapter);
                accessibilityManagerAdapter, featureFlags);
        mCallRecordingTonePlayer = new CallRecordingTonePlayer(mContext, audioManager,
                mTimeoutsAdapter, mLock);
        mCallAudioManager = new CallAudioManager(callAudioRouteStateMachine,
Loading