• andrdoid内置视频文件


    这种方法仅仅适合有内置存储的情况,至于和平分区的不在考虑之列

    1 在vendor/sprd下新建一个目录built_in_video 里边放置要内置的视频文件及copy脚步

    脚步例如以下:internal_media.mk


    LOCAL_PATH:= vendor/sprd/built_in_video

    PRODUCT_COPY_FILES +=
        $(LOCAL_PATH)/media/Girs_Gee_0.mp4:system/preloadvideo/Girs_Gee_0.mp4


    把这个internal_media.mk include到主mk中

    include vendor/sprd/built_in_video/internal_media.mk


    2  在vendor/sprd/open-source/tools新建目录preloadvideo里边放置载入内置U盘后把system/preloadvideo/Girs文件拷贝到内置U盘中

    Android.mk例如以下

    LOCAL_PATH:= $(call my-dir)

    include $(CLEAR_VARS)
    LOCAL_MODULE_TAGS := optional
    LOCAL_MODULE := preloadvideo.sh
    LOCAL_MODULE_CLASS := EXECUTABLES
    LOCAL_MODULE_PATH := $(TARGET_OUT_OPTIONAL_EXECUTABLES)
    LOCAL_SRC_FILES := preloadvideo.sh
    include $(BUILD_PREBUILT)

    #!/system/bin/sh
    PRELOAD_DEST=/storage/sdcard0/Movies
    PRELOAD_FLAG=${PRELOAD_DEST}/preloadvideo
    PRELOAD_SOURCE=/system/preloadvideo

    if [ ! -d ${PRELOAD_DEST} ]
    then
        mkdir -p ${PRELOAD_DEST}
    fi

    if [ ! -f ${PRELOAD_FLAG} ]
    then
        files=$(ls ${PRELOAD_SOURCE}/)
        for i in ${files};do
            cat  ${PRELOAD_SOURCE}/${i} > ${PRELOAD_DEST}/${i}
        done
        echo "abcd" > ${PRELOAD_FLAG}
    fi

    在主project主mk中加入

     PRODUCT_PACKAGES +=

    preloadvideo.sh


    3   在和projectmk同样的目录下的init.board.rc


    service preloadvideo /system/bin/logwrapper /system/xbin/preloadvideo.sh
            class main
            disabled
            oneshot

     preloadvideo.sh


    4   frameworks/base/services/java/com/android/server/MountService.java

    在方法notifyVolumeStateChange

    else if (newState == VolumeState.Mounted) {
                if (DEBUG_EVENTS) Slog.i(TAG, "updating volume state mounted");
                updatePublicVolumeState(volume, Environment.MEDIA_MOUNTED);
                action = Intent.ACTION_MEDIA_MOUNTED;
                android.os.SystemProperties.set("ctl.start", "preloadvideo");

    这个是载入内置存储的时候执行service   preloadvideo把视频拷贝到内置存储中


  • 相关阅读:
    二叉树遍历
    NO.35 2021/12/13(06:50)[周一]
    NO.29 2021/11/30(06:30)[周二]
    NO.22 2021/11/19(06:15) [周五]
    The .NET ORM Architec
    C#格式字符串
    C# Attribute
    .net DLL反编译文件
    【Beta】Scrum meeting1
    【Alpha】Scrum meeting 6
  • 原文地址:https://www.cnblogs.com/slgkaifa/p/6723156.html
Copyright © 2020-2023  润新知