全志A20的文件管理源码移植到ns115上(1)

来源:互联网 发布:费玉清网络综艺节目 编辑:程序博客网 时间:2024/05/17 11:57
把A20的文件管理源码移植到ns115上;

全志A20的文件管理功能挺强大的,打算移植到新岸线ns115上去。

1.要把 framework 中的目录添加到编译环境中,修改build/core/pathmap.mk 文件

FRAMEWORKS_BASE_SUBDIRS := \
 $(addsuffix /java, \
     core \
     graphics \
     location \
     media \
     media/mca/effect \
     media/mca/filterfw \
     media/mca/filterpacks \
     drm \
     opengl \
     sax \
     telephony \
     wifi \
     keystore \
     icu4j \
     voip \
  ethernet\
  swextend/securefile \
  swextend/gpio \
  swextend/isomountmanager \
  swextend/os \
  swextend/systemmix \
  swextend/nfsmanager \
  )
并把 A20中的ethernet文件夹和swextend拷贝到ns115的相关目录下

2,编译 ethernet 时出现错误
修改:
(1),在/frameworks/base/core/java/android/content/Context.java
中添加
* @see ETHERNET_SERVICE

public static final String ETHERNET_SERVICE = "ethernet";


(2),在 framework/base目录下的Android.mk下添加
ethernet/java/android/net/ethernet/IEthernetManager.aidl \

3,至此,还有8个错误:

packages/apps/TvdFileManager/src/com/softwinner/TvdFileManager/EventHandler.java:702: cannot find symbol
symbol : variable BD_FOLDER_PLAY_MODE
location: class android.provider.Settings.System
                                Settings.System.BD_FOLDER_PLAY_MODE, 0) != 0?true:false;
                                               ^
packages/apps/TvdFileManager/src/com/softwinner/TvdFileManager/EventHandler.java:744: cannot find symbol
symbol : variable EXTRA_BD_FOLDER_PLAY_MODE
location: class android.provider.MediaStore
                bdIntent.putExtra(MediaStore.EXTRA_BD_FOLDER_PLAY_MODE , true);
                                            ^
packages/apps/TvdFileManager/src/com/softwinner/TvdFileManager/EventHandler.java:772: cannot find symbol
symbol : variable EXTRA_BD_FOLDER_PLAY_MODE
location: class android.provider.MediaStore
                  bdIntent.putExtra(MediaStore.EXTRA_BD_FOLDER_PLAY_MODE , true);
                                              ^
packages/apps/TvdFileManager/src/com/softwinner/TvdFileManager/EventHandler.java:810: cannot find symbol
symbol : variable PLAYLIST_TYPE
location: class android.provider.MediaStore
                movieIntent.putExtra(MediaStore.PLAYLIST_TYPE, MediaStore.PLAYLIST_TYPE_CUR_FOLDER);
                                               ^
packages/apps/TvdFileManager/src/com/softwinner/TvdFileManager/EventHandler.java:810: cannot find symbol
symbol : variable PLAYLIST_TYPE_CUR_FOLDER
location: class android.provider.MediaStore
                movieIntent.putExtra(MediaStore.PLAYLIST_TYPE, MediaStore.PLAYLIST_TYPE_CUR_FOLDER);
                                                                         ^
packages/apps/TvdFileManager/src/com/softwinner/TvdFileManager/EventHandler.java:812: cannot find symbol
symbol : variable EXTRA_BD_FOLDER_PLAY_MODE
location: class android.provider.MediaStore
                movieIntent.putExtra(MediaStore.EXTRA_BD_FOLDER_PLAY_MODE , false);
                                               ^
packages/apps/TvdFileManager/src/com/softwinner/TvdFileManager/MainUI.java:479: cannot find symbol
symbol : method enableScaleMode(boolean,int,int)
location: class android.media.MediaPlayer
                                player.enableScaleMode(true, w, h);
                                      ^
packages/apps/TvdFileManager/src/com/softwinner/TvdFileManager/MainUI.java:522: cannot find symbol
symbol : method setSubGate(boolean)
location: class android.media.MediaPlayer
                                if(player.setSubGate(false) != 0)
                                         ^
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
8 errors
100 warnings

在 android/frameworks/base/core/java/android/provider/Settings 中,添加:
在public static final  Srting[] SETTINGS_TO_BACKUP 中添加
BD_FOLDER_PLAY_MODE

在约2000多行处添加:
public static final String BD_FOLDER_PLAY_MODE = "bd_folder_play_mode";


在 android/frameworks/base/core/java/android/provider/MediaStore.java中,添加:
/*
 public static final String EXTRA_BD_FOLDER_PLAY_MODE = "android.intent.extra.bdfolderplaymode";

    public static final String PLAYLIST_TYPE = "android.intent.extra.playListType";
    public static final String PLAYLIST_TYPE_CUR_FOLDER = "curFolder";
    public static final String PLAYLIST_TYPE_MEDIA_PROVIDER = "mediaProvider";

编译出错:
out/target/common/obj/PACKAGING/public_api.txt:5441: error 5: Added public field android.content.Context.ETHERNET_SERVICE
out/target/common/obj/PACKAGING/public_api.txt:12939: error 2: Added package android.net.ethernet
out/target/common/obj/PACKAGING/public_api.txt:18481: error 5: Added public field android.provider.MediaStore.EXTRA_BD_FOLDER_PLAY_MODE
out/target/common/obj/PACKAGING/public_api.txt:18504: error 5: Added public field android.provider.MediaStore.PLAYLIST_TYPE
out/target/common/obj/PACKAGING/public_api.txt:18505: error 5: Added public field android.provider.MediaStore.PLAYLIST_TYPE_CUR_FOLDER 
out/target/common/obj/PACKAGING/public_api.txt:18506: error 5: Added public field android.provider.MediaStore.PLAYLIST_TYPE_MEDIA_PROVIDER
out/target/common/obj/PACKAGING/public_api.txt:18839: error 5: Added public field android.provider.Settings.BD_FOLDER_PLAY_MODE
Reading library jar [/home/wbl/nufront-new/tv-box_jb/android/out/target/common/obj/JAVA_LIBRARIES/core_intermediates/classes.jar]
******************************
You have tried to change the API from what has been previously approved.
To make these errors go away, you have two choices:
   1) You can add "@hide" javadoc comments to the methods, etc. listed in the
      errors above.
   2) You can update current.txt by executing the following command:
         make update-api
      To submit the revised current.txt to the main Android repository,
      you will need approval.
*****************************
根据提示解决问题。


4,编译还有2个错误;
packages/apps/TvdFileManager/src/com/softwinner/TvdFileManager/MainUI.java:479: cannot find symbol
symbol : method enableScaleMode(boolean,int,int)
location: class android.media.MediaPlayer
                                player.enableScaleMode(true, w, h);
                                      ^
packages/apps/TvdFileManager/src/com/softwinner/TvdFileManager/MainUI.java:522: cannot find symbol
symbol : method setSubGate(boolean)
location: class android.media.MediaPlayer
                                if(player.setSubGate(false) != 0)
                                         ^
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
2errors
100 warnings
这2个错误直接注释掉,估计视频预览那里可能有些问题。

这样源代码的编译就可以通过了。编译出来的apk放在原来A20的板子上运行没问题

5,问题:编译出来的so文件在symbol/system/lib目录下找得到,但是在/system/lib目录下没有。
解决:
LOCAL_MODULE_TAGS变量的值有user optional debug eng tests samples这几个值,在2.2里如果LOCAL_MODULE_TAGS变量的值为user那么系统直接就会将这个应用的apk安装到systm/app目录下,但是在2.3里将这个变量的值赋值为user系统会做一个处理,会根据LOCAL_MODULE的值于GRANDFATHERED_USER_MODULES变量的值进行比较,
如果LOCAL_MODULE变量的值在GRANDFATHERED_USER_MODULES变量里没有那么系统就会报错,默认情况下userdebug eng 都会被编译到系统里optional会根据要编译的模块是否在PRODUCT_PACKAGES这个变量中,如果在就会编译到系统里,如果没有那么就不会被编译到系统里,tests会根据编译的版本的vatiant来决定是否编译到系统里,而samples只是一个例子一般都不会被编译到系统里的。在Android里只有几个samples是可以被编译到系统里的,但是默认情况是没有被编译的。
是LOCAL_MODULE_TAGS的问题,如果是optional的话,就会直接输出到symbols目录下。这个得看编译整个系统的时候选的是eng,user还是userdebug了,LOCAL_MODULE_TAGS得根据这个来设置。

修改ns115编译脚本,把user改为eng
因为A20编译的是eng版本,optional  会编译进去

http://www.verydemo.com/demo_c89_i40406.html

6,在ns115上运行结果:
文件管理中的NFS功能用不了,插入U盘后会有提示发现U盘,但是不能再界面中显示出来。继续改。。。。。
@bolin




0 0
原创粉丝点击