如果下载已经修过的源码,只要进行3、4、8步骤就应该可以了。
eclipse版本:adt-bundle-windows (Android Developer Tools Build: v21.0.0-519525)
1.从android4.0系统的代码中拷贝一份浏览器的代码,到本地文件夹,并重命名为BrowserEclipse:
<android4.0源码>/package/apps/Browser --> <本地目录>/BrowserEclipse
2.在eclipse中导入工程BrowserEclipse。
菜单File-import,选择Android-Existing Android Code Into Workspace。
浏览文件夹,并选择工程的根目录:<本地目录>/BrowserEclipse。
去掉tests工程的勾选按钮,暂时不管tests工程。
重命名工程:选择工程,鼠标右键菜单-Refactor-Rename,输入BrowserEclipse。
此时,工程中会有很多错误,暂时不用理睬。
3.添加库文件。
从编译通过的android4.0源码的out目录中拷贝相应的文件到BrowserEclipse的systemlib路径下,文件如下:
BrowserEclipse\systemlib\out\target\common\obj\JAVA_LIBRARIES\android-common_intermediates\classes.jar
BrowserEclipse\systemlib\out\target\common\obj\JAVA_LIBRARIES\android-support-v13_intermediates\classes.jar
BrowserEclipse\systemlib\out\target\common\obj\JAVA_LIBRARIES\android-support-v4_intermediates\classes.jar
BrowserEclipse\systemlib\out\target\common\obj\JAVA_LIBRARIES\core_intermediates\classes.jar
BrowserEclipse\systemlib\out\target\common\obj\JAVA_LIBRARIES\framework_intermediates\classes.jar
在eclispe中刷新下工程,再选择工程,鼠标右键菜单-Build Path-Configure Build Path,
在Libraries页面中,选择Add Library-User Libraries-New,输入库名称systemlib,并勾选输入框下面的“System Library”。
回到User Libraries窗口,选择新建立的systemlib,点击按钮“Add JARs”,把systemlib\文件夹下面的五个classes.jar都添加进去。
一路OK按钮,回到Java Build Path界面,选择Order and Export页面,选择新建立systemlib,点击Top按钮,顶到第一位,OK。
4.设置Java Compiler版本为1.6。
再选择工程,鼠标右键菜单-Properties-Java Compiler,选择1.6
5.屏蔽一些代码。
经过第3步骤,回到eclipse编辑界面,刷新工程,此时大部分的错误已经解决,仅剩少数几个错误,把这些错误地方屏蔽掉,即可:
屏蔽EventLogTags相关的行:
BrowserEclipse\src\com\android\browser\LogTag.java;
屏蔽VisibleForTesting相关的行:
BrowserEclipse\src\com\android\browser\BrowserActivity.java
BrowserEclipse\src\com\android\browser\provider\BrowserProvider2.java
BrowserEclipse\src\com\android\browser\autocomplete\SuggestedTextController.java
此时,应该没有编译错误了。
6.增加一个java文件,避免运行时错误:
BrowserEclipse\src\com\android\common\content\SyncStateContentProviderHelper.java
来自android4.0源码:
frameworks\ex\common\java\com\android\common\content\SyncStateContentProviderHelper.java
7.修改BrowserEclipse\AndroidManifest.xml,增加<uses-sdk android:minSdkVersion="14"/>
修改BrowserEclipse\project.properties中的target属性值,设置为target=android-14
8.卸载系统应用Broser.apk,安装BrowserEclipse.apk。
这里需要先把机器root,才能进行,这个apk只能在android4.0的系统中运行正常,在4.1中不能运行。
先备份/system/app/Browser.apk和Browser.odex,拷贝到/sdcard即可。
删除/system/app/Browser.apk和Browser.odex,重启机器。
安装BrowserEclipse.apk,查看效果。
`environ' is defined in d:\linux\linuxkernel\WORKING_DIRECTORY\android-omap-20111108-gingerbread\bionic\libc\bionic\libc_init_common.c:
char **environ;
but due to some reason, it's not working. I conduct a test for this. if I change environ to environ1, it's working, but not for environ. It's also different in the object file(.o) when I change the name of environ. So change the definition in java_lang_ProcessManager.cpp:
//extern char **environ;
char **environ;
http://msdn.microsoft.com/en-us/library/stxk41x1(v=VS.71).aspx
http://msdn.microsoft.com/zh-cn/vstudio/stxk41x1
redis set 是string类型对象的无序集合,set不管存储多少对象,对存储对象的add,remove和test操作的时间复杂度是O(1)。set最多能包含 232 - 1 个member。
1、增加
语法:sadd key member[member...]
解释:对特定key的set增加一个或多个值,返回是增加元素的个数。注意:对同一个member多次add,set中只会保留一份。
[root@xsf001 ~]# redis-cli redis 127.0.0.1:6379> sadd stu zhangsan lisi wangwu #新增 (integer) 3 redis 127.0.0.1:6379> smembers stu #得到set的所有member 1) "wangwu" 2) "lisi" 3) "zhangsan" redis 127.0.0.1:6379> sadd stu zhangsan #增加存在的member (integer) 0 redis 127.0.0.1:6379> smembers stu 1) "wangwu" 2) "lisi" 3) "zhangsan" redis 127.0.0.1:6379> sadd tech wangwu liming joe (integer) 3 redis 127.0.0.1:6379> sadd tech jim (integer) 1 redis 127.0.0.1:6379> smembers tech 1) "jim" 2) "liming" 3) "wangwu" 4) "joe"
2、查询
a)smembers
语法:smembers key
解释:获取set中的所有member
redis 127.0.0.1:6379> smembers stu 1) "wangwu" 2) "lisi" 3) "zhangsan" redis 127.0.0.1:6379> smembers tech 1) "jim" 2) "liming" 3) "wangwu" 4) "joe"
b)sismember
语法:sismember key member
解释:判断值是否是set的member。如果值是set的member返回1,否则,返回0
redis 127.0.0.1:6379> sismember tech jim #jim 是set的member (integer) 1 redis 127.0.0.1:6379> sismember tech jim001 #jim001 不是set的member (integer) 0c)scard
语法:scard key
解释:返回set的member个数,如果set不存在,返回0
redis 127.0.0.1:6379> scard tech # tech 存在 (integer) 4 redis 127.0.0.1:6379> scard stud #stud 不存在 (integer) 0 redis 127.0.0.1:6379> scard stu (integer) 4d)srandmember
语法:srandmember key
解释:从set中返回一个随机member
redis 127.0.0.1:6379> srandmember stu "zhangsan" redis 127.0.0.1:6379> srandmember stu "zhangsan" redis 127.0.0.1:6379> srandmember stu "wangwu" redis 127.0.0.1:6379> srandmember stu "zhangsan01"
3、删除
a)spop
语法:spop key
解释:移除并返回一个随机member
redis 127.0.0.1:6379> smembers stu #pop前 1) "zhangsan01" 2) "wangwu" 3) "lisi" 4) "zhangsan" redis 127.0.0.1:6379> spop stu #移除一个随机member "lisi" redis 127.0.0.1:6379> smembers stu #pop后 1) "zhangsan01" 2) "wangwu" 3) "zhangsan"b)srem
语法:srem key member [member ...]
解释:移除一个或多个member
redis 127.0.0.1:6379> smembers tech 1) "jim" 2) "liming" 3) "wangwu" 4) "joe" redis 127.0.0.1:6379> srem tech jim #移除jim (integer) 1 redis 127.0.0.1:6379> smembers tech 1) "liming" 2) "wangwu" 3) "joe" redis 127.0.0.1:6379> srem tech liming joe #移除多个member (integer) 2 redis 127.0.0.1:6379> smembers tech 1) "wangwu"c)smove
语法:smove source destination member
解释:将source中的member移动到destination
redis 127.0.0.1:6379> smembers tech #smove前 1) "wangwu" redis 127.0.0.1:6379> smembers stu 1) "zhangsan01" 2) "wangwu" 3) "zhangsan" redis 127.0.0.1:6379> smove stu tech zhangsan #将zhangsan 从stu移动到tech (integer) 1 redis 127.0.0.1:6379> smembers stu #smove后 1) "zhangsan01" 2) "wangwu" redis 127.0.0.1:6379> smembers tech 1) "wangwu" 2) "zhangsan"
4、其他
a)并集
语法:sunion key[key...]
解释:多个set的并集
redis 127.0.0.1:6379> smembers stu 1) "zhangsan01" 2) "wangwu" redis 127.0.0.1:6379> sunion stu 1) "zhangsan01" 2) "wangwu" redis 127.0.0.1:6379> smembers tech 1) "wangwu" 2) "zhangsan" redis 127.0.0.1:6379> sunion stu tech 1) "zhangsan01" 2) "wangwu" 3) "zhangsan"
b)把并集结果存储到set
语法:sunionstore destination key [key ...]
解释:求多个set并集,并把结果存储到destination
redis 127.0.0.1:6379> sunionstore same stu tech #把stu tech并集结果存储在union (integer) 3 redis 127.0.0.1:6379> smembers union 1) "zhangsan01" 2) "wangwu" 3) "zhangsan"
c)交集
语法:sinter key[key...]
解释:多个set的交集
redis 127.0.0.1:6379> smembers stu 1) "zhangsan01" 2) "wangwu" redis 127.0.0.1:6379> smembers tech 1) "wangwu" 2) "zhangsan" redis 127.0.0.1:6379> sinter stu tech 1) "wangwu"
d)把交集结果存储到指定set
语法:sinterstore destination key [key ...]
解释:把多个set的交集结果存储到destination
redis 127.0.0.1:6379> sinterstore inter stu tech (integer) 1 redis 127.0.0.1:6379> smembers inter 1) "wangwu"
e) set中在其他set中不存在member
语法:sdiff key[key ...]
redis 127.0.0.1:6379> redis 127.0.0.1:6379> smembers stu 1) "zhangsan01" 2) "wangwu" redis 127.0.0.1:6379> smembers tech 1) "wangwu" 2) "zhangsan" redis 127.0.0.1:6379> sdiff stu tech 1) "zhangsan01" redis 127.0.0.1:6379> sdiff tech stu 1) "zhangsan"
f)把set中在其他set中不存在的member存储到新的set
语法:sdiffstore key[key...]
redis 127.0.0.1:6379> sdiffstore diff stu tech (integer) 1 redis 127.0.0.1:6379> smembers diff 1) "zhangsan01"