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

Commit f5cabd27 authored by menghanli's avatar menghanli
Browse files

Use default accessibility notification sound be accessibility volume key shortcut ringtone.

Root cause: The accessibility volume key shortcut plays notification ringtone would misleading the normal users to check notification list when hear this sound.
Solution: Use the default accessibility notification sound instead to avoid users confusing the new notification received. Point to the default notification sound if the sound does not exist.

Bug: 175879613
Test: Manual testing
Change-Id: I5885dcaa5254b6334a95f756bf53b51186c555f5
parent f562af0e
Loading
Loading
Loading
Loading
+11 −2
Original line number Diff line number Diff line
@@ -438,9 +438,18 @@ public class AccessibilityShortcutController {
                ? AudioAttributes.USAGE_ASSISTANCE_ACCESSIBILITY
                : AudioAttributes.USAGE_NOTIFICATION_EVENT;

        // Play a notification tone
        final Ringtone tone = mFrameworkObjectProvider.getRingtone(mContext,
        // Use the default accessibility notification sound instead to avoid users confusing the new
        // notification received. Point to the default notification sound if the sound does not
        // exist.
        final Uri ringtoneUri = Uri.parse("file://"
                + mContext.getString(R.string.config_defaultAccessibilityNotificationSound));
        Ringtone tone = mFrameworkObjectProvider.getRingtone(mContext, ringtoneUri);
        if (tone == null) {
            tone = mFrameworkObjectProvider.getRingtone(mContext,
                    Settings.System.DEFAULT_NOTIFICATION_URI);
        }

        // Play a notification tone
        if (tone != null) {
            tone.setAudioAttributes(new AudioAttributes.Builder()
                    .setUsage(audioAttributesUsage)
+3 −1
Original line number Diff line number Diff line
@@ -4072,7 +4072,9 @@
         exists on the device, the accessibility shortcut will be disabled by default. -->
    <string name="config_defaultAccessibilityService" translatable="false"></string>

    <!-- Flag indicates that whether escrow token API is enabled for TrustAgent -->
    <!-- URI for default Accessibility notification sound when to enable accessibility shortcut. -->
    <string name="config_defaultAccessibilityNotificationSound" translatable="false"></string>

    <!-- Warning: This API can be dangerous when not implemented properly. In particular,
         escrow token must NOT be retrievable from device storage. In other words, either
         escrow token is not stored on device or its ciphertext is stored on device while
+1 −0
Original line number Diff line number Diff line
@@ -3472,6 +3472,7 @@
  <java-symbol type="string" name="color_correction_feature_name" />
  <java-symbol type="string" name="reduce_bright_colors_feature_name" />
  <java-symbol type="string" name="config_defaultAccessibilityService" />
  <java-symbol type="string" name="config_defaultAccessibilityNotificationSound" />
  <java-symbol type="string" name="accessibility_shortcut_spoken_feedback" />

  <java-symbol type="string" name="accessibility_select_shortcut_menu_title" />