Skip to content

Commit 97d6773

Browse files
author
程思敏
committed
add blog
Signed-off-by: 程思敏 <chengsimin@xiaomi.com>
1 parent e14a693 commit 97d6773

20 files changed

Lines changed: 255 additions & 214 deletions

‎_posts/.DS_Store‎

0 Bytes
Binary file not shown.

‎_posts/2015-10-01-小米10月工作记录.md‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,4 +67,12 @@ http://blog.csdn.net/qinjuning/article/details/7607214
6767

6868
一个诡异的现象查了半天,发现是加锁问题,有一个单例,在子线程 getInstance new 这个对象时,获得这个对象的锁,而这个对象的构造方法中会 bind Service,而且onServiceConnected没有回调时会一直循环bind。按理讲只要主线程有空就binder成功了,而恰好这个主线程也在尝试获取这个对象的单例,因为这个锁被子线程只持有者,所以就一直阻塞了。出现了死锁。
6969

70-
如何预防死锁问题。
70+
如何预防死锁问题。
71+
72+
----
73+
74+
几个聊的Application的初始化方法一定要判断进程名初始化,否则许多变量都跑到milink的remote进程中,占着内存。
75+
76+
----
77+
78+
使用 `adb shell meminfo com.milink.sdk.demo:remote` 查看发现
Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
---
2+
layout: post
3+
category : android开发
4+
tagline: "工作记录"
5+
tags : [工作,android,记录]
6+
---
7+
{% include JB/setup %}
8+
9+
<h4>{{page.title}}</h4>
10+
11+
---
12+
13+
2015.12.16
14+
15+
Valgrind 的使用
16+
17+
MAT android stduio等查heap内存泄露等工具的使用
18+
19+
am broadcast / forcestop 等 forcestop后无法被唤醒
20+
21+
0进程1服务的解决,引导用户到设置页关闭
22+
23+
暴风云直播
24+
25+
ffmpeg 直接获得 rtsp 地址 转到远端 rtmp 地址。
26+
27+
---
28+
29+
2015.12.22
30+
31+
adb shell am force-stop com.mi.vtalk
32+
33+
adb shell dumpsys meminfo com.mi.vtalk
34+
35+
android Systrace
36+
可以在开发者选项中打开Profile GPU rending选项,再用 `adb shell dumpsys gfxinfo com.mi.vtalk` 即可获得最近128帧消耗的时间
37+
38+
python ~/Desktop/android-sdk-macosx/platform-tools/systrace/systrace.py --h 列表流畅度
39+
40+
开发者选项查看过度绘制的问题
41+
透明 = no overdraw
42+
蓝色: 1倍过度绘制,即一个像素点绘制了2次
43+
绿色:2倍过度绘制,即一个像素点绘制了3次
44+
浅红色:3倍过度绘制,即一个像素点绘制了4次
45+
深红色:4倍过度绘制及以上,即一个像素点绘制了5次及以上
46+
47+
48+
android TraceView 查每个方法执行的时间
49+
50+
----
51+
52+
adb shell dumpsys alarm 查看定时器信息
53+
54+
adb shell dumpsys window com.mi.vtalk
55+
56+
adb shell dumpsys activity com.mi.vtalk
57+
58+
adb shell dumpsys dbinfo com.mi.vtalk 查看最近的数据库操作命令
59+
60+
adb shell service list 得到service,这些service都可以dump。
61+
62+
Get device IMEI
63+
`adb shell dumpsys iphonesubinfo`
64+
65+
66+
--------
67+
68+
2015.12.23
69+
70+
singleTask之谜
71+
72+
四中启动模式 stardard singleTop singleInstance singleTask
73+
74+
singleTask
75+
76+
1.找系统中 affinity 相同的Task启动,如果没有就会在新任务中启动。 2.如果不是在新任务中启动,他会找堆栈中是否已经存在实例,如果存在,就将它之上的 Activity 全部结束掉。
77+
78+
79+
------
80+
81+
2015.12.25
82+
83+
android版本信息等的获得,关注这个系统属性类
84+
85+
Class onwClass = Class.forName("android.os.SystemProperties");
86+
87+
原来就是所谓的匿名 Binder啊?
88+
89+
"并不是所有Binder都需要注册给ServiceManager广而告之的。Server端可以通过已经建立的Binder连接将创建的Binder实体传给 Client"
90+
原来不add到ServiceManager中,就不需要设置name,就叫匿名Binder啊。
91+
92+
Binder驱动会打点好一切。目前我只发现bindService这种方式能获取binder引用。
93+
94+
--------
95+
96+
2016.01.18
97+
98+
adb shell dump window
99+
100+
101+
--------
102+
103+
2016.01.24
104+
105+
mac 卸载 jdk7
106+
107+
`rm -rf /Library/Java/JavaVirtualMachines/jdk<major>.<minor>.<macro[_update]>.jdk`
108+
Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
---
2+
layout: post
3+
category : android开发
4+
tagline: "工作记录"
5+
tags : [工作,android,记录]
6+
---
7+
{% include JB/setup %}
8+
9+
<h4>{{page.title}}</h4>
10+
11+
---
12+
13+
2016.02.16
14+
15+
adb shell dumpsys activity com.mi.vtalk 好用,可以看出UI层级
16+
17+
adb shell dumpsys dbinfo com.mi.vtalk 查看最近的数据库操作命令
18+
19+
----
20+
21+
2016.02.17
22+
23+
GreenDAO ORM框架
24+
25+
RxAndroid
26+
27+
ExecutorService pool = Executors.newSingleThreadExecutor();
28+
newFixedThreadPool()
29+
newCachedThreadPool()
30+
newScheduledThreadPool()
31+
32+
33+
4个线程池都是通过下面的 ThreadPoolExecutor 创建,只是参数不同。
34+
35+
public ThreadPoolExecutor(int corePoolSize,
36+
int maximumPoolSize,
37+
long keepAliveTime,
38+
TimeUnit unit,
39+
BlockingQueue<Runnable> workQueue,
40+
ThreadFactory threadFactory,
41+
RejectedExecutionHandler handler)
42+
43+
corePoolSize - 池中所保存的线程数,包括空闲线程。
44+
45+
maximumPoolSize-池中允许的最大线程数。
46+
47+
keepAliveTime -当线程数大于核心时,此为终止前多余的空闲线程等待新任务的最长时间。
48+
49+
unit - keepAliveTime 参数的时间单位。
50+
51+
workQueue - 执行前用于保持任务的队列。此队列仅保持由execute方法提交的Runnable任务。
52+
53+
无界队列 LinkedBlockingQueue
54+
有界队列 ArrayBlockingQueue
55+
56+
threadFactory - 执行程序创建新线程时使用的工厂。
57+
58+
handler - 由于超出线程范围和队列容量而使执行被阻塞时所使用的处理程序。
59+
60+
----
61+
62+
ThreadPoolExecutor是Executors类的底层实现。
63+
64+
// 线程池示例
65+
ThreadPoolExecutor threadPool = new ThreadPoolExecutor(1, 2, 0, TimeUnit.SECONDS,new ArrayBlockingQueue<Runnable>(3),Executors.defaultThreadFactory(),new ThreadPoolExecutor.AbortPolicy());
66+
67+
------
68+
69+
2016.2.18
70+
71+
onBackpressureBuffer()方法将告诉Observable发射的数据如果比观察者消费的数据要更快的话,它必须把它们存储在缓存中并提供一个合适的时间给它们。
72+
73+
74+
------
75+
76+
2016.2.19
77+
78+
Fragment
79+
80+
在 fragment.setArguments(...)
81+
82+
然后在 onCreate() 获得参数
83+
84+
ViewPager
85+
86+
android.support.v4.app.FragmentPagerAdapter 不可见时Frament不会销毁
87+
88+
android.support.v4.app.FragmentStatePagerAdapter 会销毁
89+
90+
91+
少用 android:gravity 有坑!!!!
92+
93+
下面这个布局死也弄不出,中心对齐的效果。去掉gravity就行了。
94+
95+
<RelativeLayout
96+
android:layout_width="0dp"
97+
android:layout_height="match_parent"
98+
android:layout_weight="1"
99+
android:gravity="center_horizontal">
100+
101+
<ImageView
102+
android:id="@+id/weixin_iv"
103+
android:layout_width="wrap_content"
104+
android:layout_height="wrap_content"
105+
android:layout_centerVertical="true"
106+
android:src="@drawable/pay_icon_weixin_normal" />
107+
108+
<TextView
109+
android:id="@+id/weixin_tv"
110+
android:layout_width="wrap_content"
111+
android:layout_height="wrap_content"
112+
android:layout_below="@id/weixin_iv"
113+
android:layout_marginTop="13dp"
114+
android:gravity="center"
115+
android:text="@string/weixin"
116+
android:textColor="@color/color_black_trans_40"
117+
android:textSize="11sp" />
118+
119+
<ImageView
120+
android:id="@+id/weixin_selected_iv"
121+
android:layout_width="wrap_content"
122+
android:layout_height="wrap_content"
123+
android:layout_alignParentBottom="true"
124+
android:layout_alignParentRight="true"
125+
android:src="@drawable/pay_icon_jiao"
126+
android:visibility="gone" />
127+
</RelativeLayout>
128+
129+
----
130+
131+
2016.02.29
132+

0 commit comments

Comments
 (0)