Android 11.0 删除振动功能

Posted 王睿丶

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Android 11.0 删除振动功能相关的知识,希望对你有一定的参考价值。

一丶去除:设置->声音->其他提示音->:触摸提示音选项
packages/apps/Settings/res/xml/sound_settings.xml
去除选项:设置->声音->其他提示音->:触摸提示音选项

++ <!--        &lt;!&ndash; Touch sounds &ndash;&gt;-->
++ <!--        <SwitchPreference-->
++ <!--          android:key="touch_sounds"-->
++ <!--          android:title="@string/touch_sounds_title"/>-->

packages/apps/Settings/res/xml/other_sound_settings.xml
去除选项:设置->声音->其他提示音->:触摸提示音选项

++ <!-- Touch sounds -->
++ <!--    <SwitchPreference-->
++ <!--            android:key="touch_sounds"-->
++ <!--            android:title="@string/touch_sounds_title" />-->

packages/apps/Settings/res/values/strings.xml
去除选项:设置->声音->其他提示音->:触摸提示音选项

 ++   <!-- Sound: Other sounds: Title for the option enabling touch sounds. [CHAR LIMIT=30] -->
 ++   <!--    <string name="touch_sounds_title">Touch sounds</string>-->

packages/apps/Settings/res/values-zu/strings.xml
去除选项:设置->声音->其他提示音->:触摸提示音选项

++ <!--    <string name="touch_sounds_title" msgid="2200734041857425078">"Imisindo yokuthinta"</string>-->

packages/apps/Settings/res/values-zh-rTW/strings.xml
packages/apps/Settings/res/values-zh-rHK/strings.xml
packages/apps/Settings/res/values-zh-rCN/strings.xml
同理

二丶去除:设置->声音->其他提示音->:充电提示音和振动 改为 充电提示音
packages/apps/Settings/res/values/strings.xml
修改字样:设置->声音->其他提示音->:充电提示音和振动 改为 充电提示音

++    <string name="charging_sounds_title">Charging sounds</string>

packages/apps/Settings/res/values-zu/strings.xml
修改字样:设置->声音->其他提示音->:充电提示音和振动 改为 充电提示音

++    <string name="charging_sounds_title" msgid="5261683808537783668">"Imisindo yokushaja"</string>
++    <string name="docking_sounds_title" msgid="5341616179210436159">"Imisindo yokudokha"</string>

packages/apps/Settings/res/values-zh-rTW/strings.xml
packages/apps/Settings/res/values-zh-rHK/strings.xml
packages/apps/Settings/res/values-zh-rCN/strings.xml
同理

三丶去除:振动和触感强度选项
packages/apps/Settings/res/xml/accessibility_settings.xml
去除振动和触感强度选项

++ <!--        <Preference-->
++ <!--            android:fragment="com.android.settings.accessibility.VibrationSettings"-->
++ <!--            android:key="vibration_preference_screen"-->
++ <!--            android:persistent="false"-->
++ <!--            android:title="@string/accessibility_vibration_settings_title"-->
++ <!--            settings:controller="com.android.settings.accessibility.VibrationPreferenceController"/>-->

四丶去除:振动相关选项
packages/apps/Settings/res/xml/other_sound_settings.xml
去除选项:振动相关选项

++ <!--        &lt;!&ndash; Vibrate on touch &ndash;&gt;-->
++ <!--        <SwitchPreference-->
++ <!--          android:key="vibrate_on_touch"-->
++ <!--          android:title="@string/vibrate_on_touch_title"-->
++ <!--          android:summary="@string/vibrate_on_touch_summary"-->
++ <!--          settings:keywords="@string/keywords_vibrate_on_touch"/>-->

packages/apps/Settings/res/xml/other_sound_settings.xml
去除选项:振动相关选项

++    <!-- Vibrate on touch -->
++ <!--    <SwitchPreference-->
++ <!--            android:key="vibrate_on_touch"-->
++ <!--            android:title="@string/vibrate_on_touch_title"-->
++ <!--            android:summary="@string/vibrate_on_touch_summary" />-->

packages/apps/Settings/res/values/strings.xml
去除振动字样

++    <string name="other_sound_category_preference_title">Other sounds</string>

packages/apps/Settings/res/values-zu/strings.xml
去除振动字样

++    <string name="other_sound_category_preference_title" msgid="8182757473602586634">"Eminye imisindo"</string>

packages/apps/Settings/res/values-zh-rTW/strings.xml
packages/apps/Settings/res/values-zh-rHK/strings.xml
packages/apps/Settings/res/values-zh-rCN/strings.xml
同理

五丶去除:设置->声音->阻止响铃的快捷方式->:有振动和静音两个选项,去除振动选项

packages/apps/Settings/src/com/android/settings/gestures/PreventRingingParentPreferenceController.java

 @Override
    public CharSequence getSummary() 
        int value = Settings.Secure.getInt(
                mContext.getContentResolver(), SECURE_KEY, VOLUME_HUSH_VIBRATE);
        int summary;
        switch (value) 
++ //            case VOLUME_HUSH_VIBRATE:
++ //                summary = R.string.prevent_ringing_option_vibrate_summary;
++ //                break;
            case VOLUME_HUSH_MUTE:
                summary = R.string.prevent_ringing_option_mute_summary;
                break;
            default:
                summary = R.string.prevent_ringing_option_none_summary;
        
        return mContext.getText(summary);
    

packages/apps/Settings/src/com/android/settings/gestures/PreventRingingGesturePreferenceController.java

 @Override
    public void displayPreference(PreferenceScreen screen) 
        super.displayPreference(screen);
        if (!isAvailable()) 
            return;
        
        mPreferenceCategory = screen.findPreference(getPreferenceKey());
        mVibratePref = makeRadioPreference(KEY_VIBRATE, R.string.prevent_ringing_option_vibrate);
        mMutePref = makeRadioPreference(KEY_MUTE, R.string.prevent_ringing_option_mute);


++        mPreferenceCategory.removePreference(mVibratePref);
        
        if (mPreferenceCategory != null) 
            mSettingObserver = new SettingObserver(mPreferenceCategory);
        

        mVideoPreference = screen.findPreference(getVideoPrefKey());
    

packages/apps/Settings/res/xml/other_sound_settings.xml
packages/apps/Settings/res/xml/accessibility_settings.xml
packages/apps/Settings/res/values/strings.xml
packages/apps/Settings/res/values-zu/strings.xml
packages/apps/Settings/res/values-zh-rTW/strings.xml
packages/apps/Settings/res/values-zh-rHK/strings.xml
packages/apps/Settings/res/values-zh-rCN/strings.xml
同理

以上是关于Android 11.0 删除振动功能的主要内容,如果未能解决你的问题,请参考以下文章

如何在 react-native android 应用程序中单击时将铃声模式更改为静音/响铃/振动?

Android Settings 去除振动功能

没有 Pushkit / Callkit 的 Swift 电话呼叫,如响铃 / 闹钟 / 振动通知

求解安卓手机如何实现夜间自动震动,白天自动响铃,类似以前的情景模

Android 11.0 删除状态栏的自动旋转功能

如何在Android中设置铃声+震动