Hide the Default Notification Sound if enabling customized vibration

Flag:com.android.server.notification.notification_vibration_in_sound_uri
Test: atest NotificationRingtonePreferenceControllerTest
Bug: 358525376

Change-Id: Ic7517828df746700ceb6e0605a9d32066c7aed50
This commit is contained in:
yumeichen
2024-09-11 12:50:28 +00:00
parent 636e90be58
commit 23bba426b5
2 changed files with 53 additions and 2 deletions

View File

@@ -19,6 +19,7 @@ package com.android.settings.notification;
import android.content.Context;
import android.media.RingtoneManager;
import com.android.server.notification.Flags;
import com.android.settings.R;
public class NotificationRingtonePreferenceController extends RingtonePreferenceControllerBase {
@@ -31,6 +32,9 @@ public class NotificationRingtonePreferenceController extends RingtonePreference
@Override
public boolean isAvailable() {
if (isVibrationInSoundUriEnabled()) {
return false;
}
return mContext.getResources().getBoolean(R.bool.config_show_notification_ringtone);
}
@@ -43,4 +47,9 @@ public class NotificationRingtonePreferenceController extends RingtonePreference
public int getRingtoneType() {
return RingtoneManager.TYPE_NOTIFICATION;
}
private boolean isVibrationInSoundUriEnabled() {
return Flags.notificationVibrationInSoundUri() && mContext.getResources().getBoolean(
com.android.internal.R.bool.config_ringtoneVibrationSettingsSupported);
}
}