Android 11.0 blocks hearing protection dialog box
Recently I received customer feedback that when the volume of the device is raised to a certain level, a dialog box prompting to protect hearing will pop up, which affects the operation and use. It is necessary to block the pop-up dialog box prompting to protect hearing. The specific modifications are as follows:
/vendor/mediatek/proprietary/packages/apps/SystemUI/src/com/android/systemui/volume/VolumeDialogImpl.java
private void showSafetyWarningH(int flags) {
if ((flags & (AudioManager.FLAG_SHOW_UI | AudioManager.FLAG_SHOW_UI_WARNINGS)) != 0
|| mShowing) {
synchronized (mSafetyWarningLock) {
if (mSafetyWarning != null) {
return;
}
mSafetyWarning = new SafetyWarningDialog(mContext, mController.getAudioManager()) {
@Override
protected void cleanUp() {
synchronized (mSafetyWarningLock) {
mSafetyWarning = null;
}
recheckH(null);
}
};
- mSafetyWarning.show();
}
recheckH(null);
}
rescheduleTimeoutH();
}
Recompile and verify, the modification takes effect, and the dialog box prompting to protect hearing has been blocked.