1

我一直在尝试在启动时添加声音,以便在运行 Froyo 2.2 ROM 的机器人上运行启动动画。

这是我到目前为止所尝试的:

添加到 init.rc

###Bootsound - Safe to Delete: Start ###

service bootsound /system/bin/bootsound
        user media
        group audio
        disabled
        oneshot

on property:init.svc.bootanim=running   # to correct timing
        start bootsound

on property:dev.bootcomplete=1
        stop bootsound
### Bootsound - Safe to Delete: End ###

在 /system/bin 中创建 bootsound

#!/system/bin/sh
#bootsound - plays a sound at boot

bprop=/system/build.prop
grepprop() { x=`grep "^$1=" $bprop | head -n 1`; echo $x | cut -d = -f 2; }

play=`grepprop "ro.config.play.bootsound"`

if [ "$play" = "1" ]; then
        stagefright -a -o /system/media/android_audio.mp3
fi
exit 0

添加到 build.prop

### Safe to Delete: Start ###
ro.config.play.bootsound=1
### Safe to Delete: End ###

当然,将 android_audio.mp3 文件添加到 /system/media

不走运,谁能发现我可能错过的东西?

谢谢

4

1 回答 1

1

第一位英文翻译,我为使用单点表示歉意。在尝试查看您的帖子应用于 Android 2.3 GingerBread bootsound 时,发现问题确实是有机发生的。Bootsound在Boot Device的过程中,遇到了如下错误。

bootsound:12:语法错误:文件结尾意外(期待“then”)

设备当前使用的是 LG Optimus Black(Android 2.3 Gingerbread)

于 2012-01-27T14:07:13.540 回答