当前位置: 首页 > news >正文

Android 8.1 设置--声音中增加通话音量

Android 8.1 设置--声音中增加通话音量

近来收到项目需求,想要在设置--声音中增加一项通话音量调节,具体修改参照如下:

/vendor/mediatek/proprietary/packages/apps/MtkSettings/res/values/strings.xml

+    <!-- Sound: Title for the option managing call volume. [CHAR LIMIT=30] -->
+    <string name="call_volume_option_title">Call volume</string>

/vendor/mediatek/proprietary/packages/apps/MtkSettings/res/values-zh-rCN/strings.xml

+    <string name="call_volume_option_title">"通话音量"</string>

/vendor/mediatek/proprietary/packages/apps/MtkSettings/res/drawable/ic_volume_voice.xml

<!--Copyright (C) 2015 The Android Open Source ProjectLicensed under the Apache License, Version 2.0 (the "License");you may not use this file except in compliance with the License.You may obtain a copy of the License athttp://www.apache.org/licenses/LICENSE-2.0Unless required by applicable law or agreed to in writing, softwaredistributed under the License is distributed on an "AS IS" BASIS,WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.See the License for the specific language governing permissions andlimitations under the License.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"android:height="24.0dp"android:viewportHeight="48.0"android:viewportWidth="48.0"android:width="24.0dp"android:tint="?android:attr/colorControlNormal" ><pathandroid:fillColor="#FFFFFF"android:pathData="M13.25,21.59c2.88,5.66 7.51,10.29 13.18,13.17l4.4,-4.41c0.55,-0.55 1.34,-0.71 2.03,-0.49C35.1,30.6 37.51,31.0 40.0,31.0c1.11,0.0 2.0,0.89 2.0,2.0l0.0,7.0c0.0,1.11 -0.89,2.0 -2.0,2.0C21.22,42.0 6.0,26.78 6.0,8.0c0.0,-1.1 0.9,-2.0 2.0,-2.0l7.0,0.0c1.11,0.0 2.0,0.89 2.0,2.0 0.0,2.4 0.4,4.9 1.14,7.1 0.2,0.6 0.06,1.48 -0.49,2.03l-4.4,4.42z" /></vector>

/vendor/mediatek/proprietary/packages/apps/MtkSettings/res/xml/sound_settings.xml

+        <!-- Call volume -->
+        <com.android.settings.notification.VolumeSeekBarPreference
+                android:key="call_volume"
+                android:icon="@drawable/ic_volume_voice"
+                android:title="@string/call_volume_option_title" />

/vendor/mediatek/proprietary/packages/apps/MtkSettings/src/com/android/settings/notification/CallVolumePreferenceController.java

/** Copyright (C) 2016 The Android Open Source Project** Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at**      http://www.apache.org/licenses/LICENSE-2.0** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.* See the License for the specific language governing permissions and* limitations under the License.*/package com.android.settings.notification;import android.content.Context;
import android.media.AudioManager;import com.android.internal.annotations.VisibleForTesting;
import com.android.settings.notification.VolumeSeekBarPreference.Callback;
import com.android.settingslib.core.lifecycle.Lifecycle;
import com.android.settings.R;public class CallVolumePreferenceController extendsVolumeSeekBarPreferenceController {private static final String KEY_CALL_VOLUME = "call_volume";private AudioHelper mHelper;public CallVolumePreferenceController(Context context, Callback callback,Lifecycle lifecycle) {this(context, callback, lifecycle, new AudioHelper(context));}@VisibleForTestingCallVolumePreferenceController(Context context, Callback callback, Lifecycle lifecycle,AudioHelper helper) {super(context, callback, lifecycle);mHelper = helper;}@Overridepublic boolean isAvailable() {return !mHelper.isSingleVolume();}@Overridepublic String getPreferenceKey() {return KEY_CALL_VOLUME;}@Overridepublic int getAudioStream() {return AudioManager.STREAM_VOICE_CALL;}@Overridepublic int getMuteIcon() {return R.drawable.ic_volume_voice;}}

/vendor/mediatek/proprietary/packages/apps/MtkSettings/src/com/android/settings/notification/SoundSettings.java

    private static List<AbstractPreferenceController> buildPreferenceControllers(Context context,SoundSettings fragment, VolumeSeekBarPreference.Callback callback,Lifecycle lifecycle) {final List<AbstractPreferenceController> controllers = new ArrayList<>();controllers.add(new ZenModePreferenceController(context));controllers.add(new EmergencyBroadcastPreferenceController(context, KEY_CELL_BROADCAST_SETTINGS));controllers.add(new VibrateWhenRingPreferenceController(context));// === Volumes ===controllers.add(new AlarmVolumePreferenceController(context, callback, lifecycle));
+        controllers.add(new CallVolumePreferenceController(context, callback, lifecycle));

重新编译验证,修改生效,设置--声音中已增加通话音量调节项

http://www.lryc.cn/news/293610.html

相关文章:

  • C#中使用OpenCvSharp4绘制直线、矩形、圆、文本
  • Qt程序设计-自定义控件(提升法)
  • 计算机网络基础知识笔记
  • 【iOS ARKit】2D肢体动作捕捉
  • MAC word删除空白页
  • 字面跳动前端面试题:React Hook为什么不能放在if/循环/嵌套函数里面?
  • 【SpringBoot】SpringBoot的web开发
  • houdini 入门指南-参考自用,内有翻译错误
  • 【笔记】SPN和PLMN 运营商网络名称显示
  • Selenium处理Alert弹窗
  • FCIS 2023:洞悉网络安全新前沿,引领未来安全创新狂潮
  • 4个最佳的免费全磁盘加密程序,总有一款适合你
  • SQL语句创建数据库
  • 【lesson38】让minishell支持重定向
  • 【安装指南】maven下载、安装与配置详细教程
  • matplotlib-中文乱码问题解决方案
  • Redis(十一)单线程VS多线程
  • 【微服务】Spring Boot集成ELK实用案例
  • 已解决: ImportError: cannot import name ‘relu‘ from ‘keras.layers‘ 问题
  • python-产品篇-火车票分析助手
  • 设计一个可以智能训练神经网络的流程
  • 自然语言处理(02/10):自然语言处理任务和应用程序
  • Jmeter学习系列之三:测试计划详细介绍
  • mermaid使用指南+notion使用实例-持续更新中
  • Pytroch 自写训练模板适合入门版 包含十五种经典的自己复现的一维模型 1D CNN
  • 【30秒看懂大数据】变量
  • Redis - 多集群数据源配置
  • 五大架构风格之四-虚拟机架构风格
  • 在 C# 中 checked 和 unchecked 关键字
  • 【算法分析与设计】跳跃游戏