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
This commit is contained in:
menghanli
2022-10-04 17:52:16 +08:00
parent f562af0e99
commit f5cabd27ec
3 changed files with 15 additions and 3 deletions

View File

@@ -438,9 +438,18 @@ public class AccessibilityShortcutController {
? AudioAttributes.USAGE_ASSISTANCE_ACCESSIBILITY
: AudioAttributes.USAGE_NOTIFICATION_EVENT;
// 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
final Ringtone tone = mFrameworkObjectProvider.getRingtone(mContext,
Settings.System.DEFAULT_NOTIFICATION_URI);
if (tone != null) {
tone.setAudioAttributes(new AudioAttributes.Builder()
.setUsage(audioAttributesUsage)

View File

@@ -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

View File

@@ -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" />