• Android12---Alarm 闹钟去除重复铃声(MTK平台)


    问题

    客户提出需求说闹钟里面有三对重复的铃声,需要我们去除。

    代码位置

    具体代码

    1. diff --git a/alps/frameworks/base/data/sounds/AllAudio.mk b/alps/frameworks/base/data/sounds/AllAudio.mk
    2. index c185198..b23d07f 100755 (executable)
    3. --- a/alps/frameworks/base/data/sounds/AllAudio.mk
    4. +++ b/alps/frameworks/base/data/sounds/AllAudio.mk
    5. @@ -25,14 +25,11 @@ PRODUCT_COPY_FILES += \
    6. $(LOCAL_PATH)/alarms/ogg/Barium.ogg:$(TARGET_COPY_OUT_PRODUCT)/media/audio/alarms/Barium.ogg \
    7. $(LOCAL_PATH)/alarms/ogg/Carbon.ogg:$(TARGET_COPY_OUT_PRODUCT)/media/audio/alarms/Carbon.ogg \
    8. $(LOCAL_PATH)/alarms/ogg/Fermium.ogg:$(TARGET_COPY_OUT_PRODUCT)/media/audio/alarms/Fermium.ogg \
    9. - $(LOCAL_PATH)/alarms/ogg/Hassium.ogg:$(TARGET_COPY_OUT_PRODUCT)/media/audio/alarms/Hassium.ogg \
    10. $(LOCAL_PATH)/alarms/ogg/Helium.ogg:$(TARGET_COPY_OUT_PRODUCT)/media/audio/alarms/Helium.ogg \
    11. $(LOCAL_PATH)/alarms/ogg/Krypton.ogg:$(TARGET_COPY_OUT_PRODUCT)/media/audio/alarms/Krypton.ogg \
    12. - $(LOCAL_PATH)/alarms/ogg/Neon.ogg:$(TARGET_COPY_OUT_PRODUCT)/media/audio/alarms/Neon.ogg \
    13. $(LOCAL_PATH)/alarms/ogg/Neptunium.ogg:$(TARGET_COPY_OUT_PRODUCT)/media/audio/alarms/Neptunium.ogg \
    14. $(LOCAL_PATH)/alarms/ogg/Nobelium.ogg:$(TARGET_COPY_OUT_PRODUCT)/media/audio/alarms/Nobelium.ogg \
    15. $(LOCAL_PATH)/alarms/ogg/Osmium.ogg:$(TARGET_COPY_OUT_PRODUCT)/media/audio/alarms/Osmium.ogg \
    16. - $(LOCAL_PATH)/alarms/ogg/Oxygen.ogg:$(TARGET_COPY_OUT_PRODUCT)/media/audio/alarms/Oxygen.ogg \
    17. $(LOCAL_PATH)/alarms/ogg/Plutonium.ogg:$(TARGET_COPY_OUT_PRODUCT)/media/audio/alarms/Plutonium.ogg \
    18. $(LOCAL_PATH)/alarms/ogg/Promethium.ogg:$(TARGET_COPY_OUT_PRODUCT)/media/audio/alarms/Promethium.ogg \
    19. $(LOCAL_PATH)/alarms/ogg/Scandium.ogg:$(TARGET_COPY_OUT_PRODUCT)/media/audio/alarms/Scandium.ogg \
    20. diff --git a/alps/frameworks/base/data/sounds/AudioPackage10.mk b/alps/frameworks/base/data/sounds/AudioPackage10.mk
    21. index 8198f50..39923dc 100755 (executable)
    22. --- a/alps/frameworks/base/data/sounds/AudioPackage10.mk
    23. +++ b/alps/frameworks/base/data/sounds/AudioPackage10.mk
    24. @@ -12,8 +12,6 @@ PRODUCT_COPY_FILES += \
    25. $(LOCAL_PATH)/alarms/ogg/Carbon.ogg:$(TARGET_COPY_OUT_PRODUCT)/media/audio/alarms/Carbon.ogg \
    26. $(LOCAL_PATH)/alarms/ogg/Helium.ogg:$(TARGET_COPY_OUT_PRODUCT)/media/audio/alarms/Helium.ogg \
    27. $(LOCAL_PATH)/alarms/ogg/Krypton.ogg:$(TARGET_COPY_OUT_PRODUCT)/media/audio/alarms/Krypton.ogg \
    28. - $(LOCAL_PATH)/alarms/ogg/Neon.ogg:$(TARGET_COPY_OUT_PRODUCT)/media/audio/alarms/Neon.ogg \
    29. - $(LOCAL_PATH)/alarms/ogg/Oxygen.ogg:$(TARGET_COPY_OUT_PRODUCT)/media/audio/alarms/Oxygen.ogg \
    30. $(LOCAL_PATH)/alarms/ogg/Osmium.ogg:$(TARGET_COPY_OUT_PRODUCT)/media/audio/alarms/Osmium.ogg \
    31. $(LOCAL_PATH)/effects/ogg/Effect_Tick_48k.ogg:$(TARGET_COPY_OUT_PRODUCT)/media/audio/ui/Effect_Tick.ogg \
    32. $(LOCAL_PATH)/effects/ogg/KeypressStandard_48k.ogg:$(TARGET_COPY_OUT_PRODUCT)/media/audio/ui/KeypressStandard.ogg \
    33. diff --git a/alps/frameworks/base/data/sounds/AudioPackage11.mk b/alps/frameworks/base/data/sounds/AudioPackage11.mk
    34. index 3288296..ff63251 100755 (executable)
    35. --- a/alps/frameworks/base/data/sounds/AudioPackage11.mk
    36. +++ b/alps/frameworks/base/data/sounds/AudioPackage11.mk
    37. @@ -12,8 +12,6 @@ PRODUCT_COPY_FILES += \
    38. $(LOCAL_PATH)/alarms/ogg/Carbon.ogg:$(TARGET_COPY_OUT_PRODUCT)/media/audio/alarms/Carbon.ogg \
    39. $(LOCAL_PATH)/alarms/ogg/Helium.ogg:$(TARGET_COPY_OUT_PRODUCT)/media/audio/alarms/Helium.ogg \
    40. $(LOCAL_PATH)/alarms/ogg/Krypton.ogg:$(TARGET_COPY_OUT_PRODUCT)/media/audio/alarms/Krypton.ogg \
    41. - $(LOCAL_PATH)/alarms/ogg/Neon.ogg:$(TARGET_COPY_OUT_PRODUCT)/media/audio/alarms/Neon.ogg \
    42. - $(LOCAL_PATH)/alarms/ogg/Oxygen.ogg:$(TARGET_COPY_OUT_PRODUCT)/media/audio/alarms/Oxygen.ogg \
    43. $(LOCAL_PATH)/alarms/ogg/Osmium.ogg:$(TARGET_COPY_OUT_PRODUCT)/media/audio/alarms/Osmium.ogg \
    44. $(LOCAL_PATH)/effects/ogg/Effect_Tick_48k.ogg:$(TARGET_COPY_OUT_PRODUCT)/media/audio/ui/Effect_Tick.ogg \
    45. $(LOCAL_PATH)/effects/ogg/KeypressStandard_48k.ogg:$(TARGET_COPY_OUT_PRODUCT)/media/audio/ui/KeypressStandard.ogg \
    46. diff --git a/alps/frameworks/base/data/sounds/AudioPackage7.mk b/alps/frameworks/base/data/sounds/AudioPackage7.mk
    47. index 607493d..a650167 100755 (executable)
    48. --- a/alps/frameworks/base/data/sounds/AudioPackage7.mk
    49. +++ b/alps/frameworks/base/data/sounds/AudioPackage7.mk
    50. @@ -9,7 +9,6 @@ LOCAL_PATH:= frameworks/base/data/sounds
    51. PRODUCT_COPY_FILES += \
    52. $(LOCAL_PATH)/alarms/ogg/Fermium.ogg:$(TARGET_COPY_OUT_PRODUCT)/media/audio/alarms/Fermium.ogg \
    53. - $(LOCAL_PATH)/alarms/ogg/Hassium.ogg:$(TARGET_COPY_OUT_PRODUCT)/media/audio/alarms/Hassium.ogg \
    54. $(LOCAL_PATH)/alarms/ogg/Neptunium.ogg:$(TARGET_COPY_OUT_PRODUCT)/media/audio/alarms/Neptunium.ogg \
    55. $(LOCAL_PATH)/alarms/ogg/Nobelium.ogg:$(TARGET_COPY_OUT_PRODUCT)/media/audio/alarms/Nobelium.ogg \
    56. $(LOCAL_PATH)/alarms/ogg/Plutonium.ogg:$(TARGET_COPY_OUT_PRODUCT)/media/audio/alarms/Plutonium.ogg \
    57. diff --git a/alps/frameworks/base/data/sounds/AudioPackage7alt.mk b/alps/frameworks/base/data/sounds/AudioPackage7alt.mk
    58. old mode 100644 (file)
    59. new mode 100755 (executable)
    60. index a0f4d89..7ff9386
    61. --- a/alps/frameworks/base/data/sounds/AudioPackage7alt.mk
    62. +++ b/alps/frameworks/base/data/sounds/AudioPackage7alt.mk
    63. @@ -12,8 +12,6 @@ PRODUCT_COPY_FILES += \
    64. $(LOCAL_PATH)/alarms/ogg-jp/Carbon.ogg:$(TARGET_COPY_OUT_PRODUCT)/media/audio/alarms/Carbon.ogg \
    65. $(LOCAL_PATH)/alarms/ogg-jp/Helium.ogg:$(TARGET_COPY_OUT_PRODUCT)/media/audio/alarms/Helium.ogg \
    66. $(LOCAL_PATH)/alarms/ogg-jp/Krypton.ogg:$(TARGET_COPY_OUT_PRODUCT)/media/audio/alarms/Krypton.ogg \
    67. - $(LOCAL_PATH)/alarms/ogg-jp/Neon.ogg:$(TARGET_COPY_OUT_PRODUCT)/media/audio/alarms/Neon.ogg \
    68. - $(LOCAL_PATH)/alarms/ogg-jp/Oxygen.ogg:$(TARGET_COPY_OUT_PRODUCT)/media/audio/alarms/Oxygen.ogg \
    69. $(LOCAL_PATH)/effects/ogg/Effect_Tick.ogg:$(TARGET_COPY_OUT_PRODUCT)/media/audio/ui/Effect_Tick.ogg \
    70. $(LOCAL_PATH)/effects/ogg/KeypressStandard_120.ogg:$(TARGET_COPY_OUT_PRODUCT)/media/audio/ui/KeypressStandard.ogg \
    71. $(LOCAL_PATH)/effects/ogg/KeypressSpacebar_120.ogg:$(TARGET_COPY_OUT_PRODUCT)/media/audio/ui/KeypressSpacebar.ogg \
    72. diff --git a/alps/frameworks/base/data/sounds/AudioPackage8.mk b/alps/frameworks/base/data/sounds/AudioPackage8.mk
    73. index cf1d840..46b3474 100755 (executable)
    74. --- a/alps/frameworks/base/data/sounds/AudioPackage8.mk
    75. +++ b/alps/frameworks/base/data/sounds/AudioPackage8.mk
    76. @@ -9,7 +9,6 @@ LOCAL_PATH:= frameworks/base/data/sounds
    77. PRODUCT_COPY_FILES += \
    78. $(LOCAL_PATH)/alarms/ogg/Fermium.ogg:$(TARGET_COPY_OUT_PRODUCT)/media/audio/alarms/Fermium.ogg \
    79. - $(LOCAL_PATH)/alarms/ogg/Hassium.ogg:$(TARGET_COPY_OUT_PRODUCT)/media/audio/alarms/Hassium.ogg \
    80. $(LOCAL_PATH)/alarms/ogg/Neptunium.ogg:$(TARGET_COPY_OUT_PRODUCT)/media/audio/alarms/Neptunium.ogg \
    81. $(LOCAL_PATH)/alarms/ogg/Nobelium.ogg:$(TARGET_COPY_OUT_PRODUCT)/media/audio/alarms/Nobelium.ogg \
    82. $(LOCAL_PATH)/alarms/ogg/Osmium.ogg:$(TARGET_COPY_OUT_PRODUCT)/media/audio/alarms/Osmium.ogg \
    83. diff --git a/alps/frameworks/base/data/sounds/AudioPackage9.mk b/alps/frameworks/base/data/sounds/AudioPackage9.mk
    84. index d250c53..f82751d 100755 (executable)
    85. --- a/alps/frameworks/base/data/sounds/AudioPackage9.mk
    86. +++ b/alps/frameworks/base/data/sounds/AudioPackage9.mk
    87. @@ -12,8 +12,6 @@ PRODUCT_COPY_FILES += \
    88. $(LOCAL_PATH)/alarms/ogg/Carbon.ogg:$(TARGET_COPY_OUT_PRODUCT)/media/audio/alarms/Carbon.ogg \
    89. $(LOCAL_PATH)/alarms/ogg/Helium.ogg:$(TARGET_COPY_OUT_PRODUCT)/media/audio/alarms/Helium.ogg \
    90. $(LOCAL_PATH)/alarms/ogg/Krypton.ogg:$(TARGET_COPY_OUT_PRODUCT)/media/audio/alarms/Krypton.ogg \
    91. - $(LOCAL_PATH)/alarms/ogg/Neon.ogg:$(TARGET_COPY_OUT_PRODUCT)/media/audio/alarms/Neon.ogg \
    92. - $(LOCAL_PATH)/alarms/ogg/Oxygen.ogg:$(TARGET_COPY_OUT_PRODUCT)/media/audio/alarms/Oxygen.ogg \
    93. $(LOCAL_PATH)/alarms/ogg/Osmium.ogg:$(TARGET_COPY_OUT_PRODUCT)/media/audio/alarms/Osmium.ogg \
    94. $(LOCAL_PATH)/effects/ogg/Effect_Tick.ogg:$(TARGET_COPY_OUT_PRODUCT)/media/audio/ui/Effect_Tick.ogg \
    95. $(LOCAL_PATH)/effects/ogg/KeypressStandard.ogg:$(TARGET_COPY_OUT_PRODUCT)/media/audio/ui/KeypressStandard.ogg \
    96. diff --git a/alps/frameworks/base/data/sounds/AudioPackageGo.mk b/alps/frameworks/base/data/sounds/AudioPackageGo.mk
    97. index f7f52ef..5892e0c 100755 (executable)
    98. --- a/alps/frameworks/base/data/sounds/AudioPackageGo.mk
    99. +++ b/alps/frameworks/base/data/sounds/AudioPackageGo.mk
    100. @@ -39,7 +39,6 @@ PRODUCT_COPY_FILES += \
    101. $(LOCAL_PATH)/alarms/ogg/Argon.ogg:$(TARGET_COPY_OUT_PRODUCT)/media/audio/alarms/Argon.ogg \
    102. $(LOCAL_PATH)/Alarm_Beep_03.ogg:$(TARGET_COPY_OUT_PRODUCT)/media/audio/alarms/Alarm_Beep_03.ogg \
    103. $(LOCAL_PATH)/alarms/ogg/Helium.ogg:$(TARGET_COPY_OUT_PRODUCT)/media/audio/alarms/Helium.ogg \
    104. - $(LOCAL_PATH)/alarms/ogg/Oxygen.ogg:$(TARGET_COPY_OUT_PRODUCT)/media/audio/alarms/Oxygen.ogg \
    105. $(LOCAL_PATH)/effects/ogg/Effect_Tick.ogg:$(TARGET_COPY_OUT_PRODUCT)/media/audio/ui/Effect_Tick.ogg \
    106. $(LOCAL_PATH)/effects/ogg/KeypressStandard.ogg:$(TARGET_COPY_OUT_PRODUCT)/media/audio/ui/KeypressStandard.ogg \
    107. $(LOCAL_PATH)/effects/ogg/KeypressSpacebar.ogg:$(TARGET_COPY_OUT_PRODUCT)/media/audio/ui/KeypressSpacebar.ogg \

    代码分析

    Android手机的默认铃声在system/media/audio/下面。一共有四种,分别是notifications,alarms,ringtones,ui

    但这些铃声是从哪加载来的了

    在源码中,这些铃声是保存在frameworks/base/data/sounds/下面

    通过相应的.mk文件将音频文件放到手机的相应目录下面

    通过查看,发现是在frameworks/base/data/sounds/下面的AllAudio.mk里定义的

    只要把相同的铃声去掉即可
     

  • 相关阅读:
    全新力作—C++ string类的模拟实现
    CesiumJS 2022^ 原理[4] - 最复杂的地球皮肤 影像与地形的渲染与下载过程
    基于Spring MVC + Spring + MyBatis的【超市会员管理系统】
    一周总结(回溯:组合问题&切割问题)
    I/O性能与可靠性
    学习强化学习该具备的技能和环境
    Java学习——Servlet服务器请求响应程序
    第10章 MyBatisPlus实现分页检索
    Excel显示列号
    三、GoLang字符串的基本操作
  • 原文地址:https://blog.csdn.net/m0_66587877/article/details/133162689