Android Settings 去除振动功能

Posted 王睿丶

tags:

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

一丶去除:设置->声音->其他提示音->:触摸提示音选项

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;
            //end
            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);
        //end

        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 Settings 去除振动功能的主要内容,如果未能解决你的问题,请参考以下文章

Android Settings 去除自动旋转屏幕

[RK3568][Android11]勿扰模式系统流程

Delphi xe7 up1 调用android振动功能

Android - 如何让手机随着音乐播放而振动

如何彻底去除手机浏览器长按震动?

Android 振动服务(振动器)长时间不工作