有人說,想學好英文者,先把這444句簡短英語學會!(真的嗎?試試看吧!)
1. I see.我明白了
2. I quit! 我不幹了!
3. Let go! 放手!
4. Me too.我也是。
5. My god! 天哪!
6. No way! 不行!
7. Come on.來吧(趕快)
8. Hold on.等一等。
9. I agree。我同意。
10. Not bad.還不錯。
11. Not yet.還沒。
12. See you.再見。
13. Shut up! 閉嘴!
14. So long.再見。
15. Why not? 好呀! (為什麼不呢?)
16. Allow me.讓我來。
17. Be quiet! 安靜點!
18. Cheer up! 振作起來!
19. Good job! 做得好!
20. Have fun! 玩得開心!
21. How much? 多少錢?
22. I'm full.我飽了。
23. I'm home.我回來了。
24. I'm lost.我迷路了。
25. My treat.我請客。
26. So do I.我也一樣。
27. This way。這邊請。
28. After you.您先。
29. Bless you! 祝福你!
30. Follow me.跟我來。
31. Forget it! 休想! (算了!)
32. Good luck! 祝好運!
33. I decline! 我拒絕!
34. I promise.我保證。
35. Of course! 當然了!
36. Slow down! 慢點!
37. Take care! 保重!
38. They hurt. (傷口)疼。
39. Try again.再試試。
40. Watch out! 當心。
41. What's up? 有什麼事嗎?
42. Be careful! 注意!
43. Bottoms up! 乾杯(見底)!
44. Don't move! 不許動!
45. Guess what? 猜猜看?
46. I doubt it 我懷疑。
47. I think so.我也這麼想。
48. I'm single.我是單身貴族。
49. Keep it up! 堅持下去!
50. Let me see.讓我想想。
51. Never mind.不要緊。
52. No problem! 沒問題!
53. That's all! 就這樣!
54. Time is up.時間快到了。
55. What's new? 有什麼新鮮事嗎?
56. Count me on 算上我。
57. Don't worry.別擔心。
58. Feel better? 好點了嗎?
59. I love you! 我愛你!
60. I'm his fan。我是他的影迷。
61. Is it yours? 這是你的嗎?
62. That's neat.這很好。
63. Are you sure? 你肯定嗎?
64. Do l have to 非做不可嗎?
65. He is my age.他和我同歲。
66. Here you are.給你。
67. No one knows.沒有人知道。
68. Take it easy.別緊張。
69. What a pity! 太遺憾了!
70. Any thing else? 還要別的嗎?
71. To be careful! 一定要小心!
72. Do me a favor? 幫個忙,好嗎?
73. Help yourself.別客氣。
74. I'm on a diet.我在節食。
75. Keep in Touch.保持聯絡。
76. Time is money.時間就是金錢。
77. Who's calling? 是哪一位?
78. You did right.你做得對。
79. You set me up! 你出賣我!
80. Can I help you? 我能幫你嗎?
81. Enjoy yourself! 祝你玩得開心!
82. Excuse me,Sir.先生,對不起。
83. Give me a hand! 幫幫我!
84. How's it going? 怎麼樣?
85. I have no idea.我沒有頭緒。
86. I just made it! 我做到了!
87. I'll see to it 我會留意的。
88. I'm in a hurry! 我在趕時間!
89. It's her field.這是她的本行。
90. It's up to you.由你決定。
91. Just wonderful! 簡直太棒了!
92. What about you? 你呢?
93. You owe me one.你欠我一個人情。
94. You're welcome.不客氣。
95. Any day will do.哪一天都行夕
96. Are you kidding? 你在開玩笑吧!
97. Congratulations! 祝賀你!
98. T can't help it. 我情不自禁。
99. I don't mean it. 我不是故意的。
100. I'll fix you Up.我會幫你打點的
101. It sounds great!.聽起來很不錯。
102. It's a fine day。今天是個好天。
103. So far,So good.目前還不錯。
104. What time is it? 幾點了?
105. You can make it! 你能做到!
106. Control yourself! 克制一下!
107. He came by train.他乘火車來。
108. He is ill in bed.他臥病在床。
109. He lacks courage.他缺乏勇氣。
110. How's everything? 一切還好吧?
111. I have no choice.我別無選擇。
112. I like ice-cream.我喜歡吃冰淇淋。
113. I love this game.我鍾愛這項運動。
114. I'll try my best.我盡力而為。
115. I'm On your side.我全力支持你。
116. Long time no see! 好久不見!
117. No pain,no gain.不勞無獲。
118. Well,it depends 噢,這得看情況。
119. We're all for it.我們全都同意。
120. What a good deal! 真便宜!
121. What should I do? 我該怎麼辦?
122. You asked for it! 你自討苦吃!
123. You have my word.我保證。
124. Believe it or not! 信不信由你!
125. Don't count on me.別指望我。
126. Don't fall for it! 別上當!
127. Don't let me down.別讓我失望。
128. Easy come easy go.來得容易,去得快。
129. I beg your pardon.請你原諒。
130. I beg your pardon? 請您再說一遍(我沒有聽清)。
131. I'll be back soon.我馬上回來。
132. I'll check it out.我去查查看。
133. It’s a long story.說來話長。
134. It’s Sunday today.今天是星期天。
135. Just wait and see! 等著瞧!
136. Make up your mind.做個決定吧。
137. That's all I need.我就要這些。
138. The view is great.景色多麼漂亮!
139. The wall has ears.隔牆有耳。
140. There comes a bus.汽車來了。
141. What day is today? 今天星期幾?
142. What do you think? 你怎麼認為?
143. Who told you that? 誰告訴你的?
144. Who's kicking off? 現在是誰在開球?
145. Yes, I suppose So.是的,我也這麼認為。
146. You can't miss it 你一定能找到的。
147. Any messages for me? 有我的留言嗎?
148. Don't be so modest.別謙虛了。
149. Don't give me that! 少來這套!
150. He is a smart boy.他是個小機靈鬼。
151. He is just a child.他只是個孩子。
152. I can't follow you.我不懂你說的。
153. I felt sort of ill. 我感覺有點不適。
154. I have a good idea! 我有一個好主意。
155. It is growing cool.天氣漸漸涼爽起來。
156. It seems all right.看來這沒問題。
157. It's going too far.太離譜了。
158. May I use your pen? 我可以用你的筆嗎?
159. She had a bad cold.她患了重感冒。
160. That's a good idea.這個主意真不錯。
161. The answer is zero.白忙了。
162. What does she like? 她喜歡什麼?
163. As soon as possible! 越快越好!
164. He can hardly speak.他幾乎說不出話來。
165. He always talks big.他總是吹牛。
166. He won an election.他在選舉中獲勝。
167. I am a football fan.我是個足球迷。
168. If only I could fly.要是我能飛就好了。
169. I'll be right there.我馬上就到。
170. I'll see you at six.我六點鐘見你。
171. IS it true or false? 這是對的還是錯的?
172. Just read it for me.就讀給我聽好了。
173. Knowledge is power.知識就是力量。
174. Move out of my way! 讓開!
175. Time is running out.沒時間了。
176. We are good friends.我們是好朋友。
177. What's your trouble? 你哪兒不舒服?
178. You did fairly well.你幹得相當不錯。
179. Clothes make the man.人要衣裝。
180. Did you miss the bus? 你錯過公共汽車了?
181. Don't lose your head。不要驚慌失措。
182. He can't take a joke.他開不得玩笑。
183. He owes my uncle $100.他欠我叔叔100美元。
184. How are things going? 事情進展得怎樣?
185. How are you recently? 最近怎麼樣?
186. I know all about it.我知道有關它的一切。
187. It really takes time.這樣太耽誤時間了。
188. It's against the law.這是違法的。
189. Love me,love my dog. (諺語)愛屋及烏。
190. My mouth is watering.我要流口水了。
191. Speak louder,please.說話請大聲點兒。
192. This boy has no job.這個男孩沒有工作。
193. This house is my own.這所房子是我自己的。
194. What happened to you? 你怎麼了?
195. You are just in time. 你來得正是時候。
196. You need to workout.你需要去運動鍛煉一下。
197. Your hand feels cold.你的手摸起來很冷。 。
198. Don't be so childish. 別這麼孩子氣。
199. Don't trust to chance! 不要碰運氣。
200. Fasten your seat belt.係好你的安全帶。
201. He has a large income.他有很高的收入。
202. He looks very healthy.他看來很健康。
203. He paused for a reply.他停下來等著•回答。
204. He repaired his house.他修理了他的房子。
205. He suggested a picnic. 他建議搞一次野餐。
206. Here's a gift for you.這裡有個禮物送給你。
207. How much does it cost? 多少錢?
208. I caught the last bus. 我趕上了最後一班車。
209. I could hardly speak.我簡直說不出話來。
210. I'll have to try that.我得試試這麼做。
211. I'm very proud of you.我為你感到非常驕傲。
212. It doesn't make sense.這沒有意義(不合常理)。
213. Make yourself at home.請不要拘禮。
214. My car needs washing.我的車需要洗一洗。
215. None of your business! 與你無關!
216. Not a sound was heard. 一點聲音也沒有。
217. That's always the case.習以為常了。
218. The road divides here.這條路在這里分岔。
219. Those are watermelons.那些是西瓜。
220. What a nice day it is! 今天天氣真好!
221. What's wrong with you? 你哪裡不對勁?
222. You are a chicken.你是個膽小鬼。
223. A lovely day,isn't it? 好天氣,是嗎?
224. He is collecting money.他在籌集資金。
225. He was born in New York.他出生在紐約。
226. He was not a bit tired.他一點也不累。
227. I will be more careful.我會小心一些的,
228. I will never forget it.我會記著的。
229. It is Just what I need.這正是我所需要的。
230. It rather surprised me.那事使我頗感驚訝。
231. Just around the comer.就在附近。
232. Just for entertainment.只是為了消遣一下。
233. Let bygones be bygones.過去的,就讓它過去吧。
234. Mother doesn't make up.媽媽不化妝。
235. Oh,you are kidding me.哦,你別拿我開玩笑了。
236. She has been to school. 她上學去了。
237. Skating is interesting.滑冰很有趣。
238. Supper is ready at six.晚餐六點鐘就好了。
239. That's a terrific idea! 真是好主意!
240. What horrible weather! 這鬼天氣!
241. Which would you prefer? 你要選哪個?
242. Does she like ice-cream? 她喜歡吃冰淇淋嗎?
243. First come first served.先到先得。
244. Great minds think alike.英雄所見略同。
245. He has a sense of humor.他有幽默感。
246. He is acting an old man.他正扮演一個老人。
247. He is looking for a job.他正在找工作。
248. He doesn't care about me.他並不在乎我。
249. I develop films myself.我自己沖洗照片。
250. I felt no regret for it.對這件事我不覺得後悔。
251. I get up at six o'clock.我六點起床。
252. I meet the boss himself.我見到了老闆本人。
253. I owe you for my dinner.我欠你晚餐的錢。
254. I really enjoyed myself.我玩得很開心。
255. I'm fed up with my work! 我對工作煩死了!
256. It's no use complaining.發牢騷沒什麼用。
257. She's under the weather.她心情•不好。
258. The child sobbed sadly.小孩傷心地抽泣著。
259. The rumor had no basis.那謠言沒有•根據。
260. They praised him highly.他們大大地表揚了他。
261. Winter is a cold season.冬天是一個,寒冷的季節。
262. You can call me any time.你可以隨時打電話給我。
263. 15 divided by3 equals 5. 15除以3等於5。
264. All for one,one for all.我為人人,人人為我。
265. East, west, home is best.金窩,銀窩,不如自己的草窩。
266. He grasped both my hands.他緊握住我的雙手。
267. He is physically mature.他身體己發育成熟。
268. I am so sorry about this.對此我非常抱歉(遺憾)。
269. I can't afford a new car.我買不起一部新車。
270. I do want to see him now.我現在確實很想去見他。
271. I have the right to know.我有權知道。
272. I heard some one laughing.我聽見有人在笑。
273. I suppose you dance much.我想你常常跳舞吧。
274. I walked across the park.我穿過了公園。
275. I'll just play it by ear.我到時隨機應變。
276. I'm not sure I can do it.恐怕這事我幹不了。
277. I'm not used to drinking.我不習慣喝酒。
278. Is the cut still painful? 傷口還在痛嗎?
279. It's too good to be true! 好得難以置信。
280. Jean is a blue-eyed girl.珍是個藍眼睛的女孩。
281. Let's not waste our time.咱們別浪費時間了。
282. May I ask some questions? 我可以問幾個問題嗎?
283. Money is not everything.金錢不是一切。
284. Neither of the men spoke.兩個人都沒說過話。
285. Stop making such a noise.別吵了。
286. That makes no difference.沒什麼區別。
287. The price is reasonable.價格還算合理。
288. They crowned him king.他們擁立他為國王。
289. They're in red and white.他們穿著紅白相間的衣服。
290. We all desire happiness.我們都想要幸福。
291. We just caught the plane.我們剛好趕上了飛機。
292. What shall we do tonight? 我們今天晚上去干點兒什麼呢?
293. What's your goal in life? 你的人生目標是什麼?
294. When was the house built? 這幢房子是什麼時候建造的?
295. Why did you stay at home? 為什麼呆在家裡?
296. Would you like some help? 需要幫忙嗎?
297. You mustn't aim too high.你不可好高騖遠。
298. You're really killing me! 真是笑死我了!
299. You've got a point there.你說得挺有道理的。
300. Bein301. Did you enter the contest? 你參加比賽了嗎?
302. Do you accept credit cards? 你們收信用卡嗎?
303. Don't cry over spilt milk.不要做無益的後悔。
304. Don't let chances pass by.不要讓機遇從我們身邊溜走。
305. He owned himself defeated.他承認自己失敗了。
306. He seems at little nervous.他顯得有點緊張。
307. He strolls about the town.他在鎮上四處遛達。
308. Her tooth ached all night.她牙疼了一整夜。
309. How about a drink tonight? 今晚喝一杯怎樣?
310. I can do nothing but that. 我只會做那件事。
311. I get hold of you at last.我終於找到你了。
312. I have a surprise for you.我有一個意想不到的東西給你看。
313. I like all kinds of fruit.我喜歡各種各樣的水果。
314. I saw it with my own eyes.我親眼所見。
315. I will arrange everything.我會安排一切的。
316. I wish I knew my neighbor.我很想認識我的鄰居。
317. I would like to check out.我想結帳。
318. It has be come much cooler.天氣變得涼爽多了。
319. It's time you went to bed.你早就該睡覺了。
320. No spitting on the street.禁止在大街上吐痰。
321. She was totally exhausted.她累垮了。
322. Show your tickets,please.請出示你的票。
323. Thank you for your advice.謝謝你的建議。
324. That's the latest fashion.這是最流行的款式。
325. The train arrived on time.火車準時到達。
326. There go the house lights.劇院的燈光滅了。
327. They are paid by the hour.他們按時取酬。
328. Things are getting better.情況正在好轉。
329. Wake me up at five thirty.請在五點半叫醒我。
330. We are all busy with work.我們都忙於工作。
331. Where do you want to meet? 你想在哪兒見面?
332. You can get what you want.你能得到你想要的。
333. A barking dog doesn't bite! 吠犬不咬人。
334. Are you free this Saturday? 你這個星期六有空嗎?
335. Be careful not to fall ill.注意不要生病了。
336. Being a mother is not easy.做一個母親是不容易的。
337. Brevity is the soul of wit.簡潔是智慧的精華。
338. Cancer is a deadly disease.癌症是一種致命的疾病。
339. Did you fight with others? 你又和別人打架了嗎?
340. Don't dream away your time.不要虛度光陰。
341. Don't keep me waiting long.不要讓我等得太久。
342. He has a remarkable memory.他有驚人的記憶力。
343. He has completed the task.他完成了這個任務。
344. He has quite a few friends.他有不少的朋友。
345. He is capable of any crime.他什麼樣的壞事都能幹得出來。
346. He walks with a quick pace.他快步走路。
347. He was not a little tired.他很累。
348. His looks are always funny.他的樣子總是滑稽可笑。
349. How about going to a movie? 去看場電影怎麼樣?
350. I think I've caught a cold.我想我得了感冒。
351. I was taking care of Sally.我在照顧薩莉。
352. I wish I lived in NEWYORK.我希望住在紐約。
353. I'm very glad to hear that.很高興聽你這樣說。
354. I'm your lucky fellow then.我就是你的幸運舞伴啦!
355. It's none of your business.這不關你的事兒!
356. No littering on the campus.在校園內不准亂丟廢物。
357. She is a good-looking girl.她是一個漂亮女孩。
358. She mended the broken doll.她修補了破了的洋娃娃。
359. So I just take what I want.那麼我只拿我所需要的東西。
360. Spring is a pretty season.春天是一個好季節。
361. The figure seems all Right.數目看起來是對的。
362. The stars are too far away.星星太遙遠了。
363. The whole world knows that.全世界都知道。
364. Tomorrow will be a holiday.明天放假。
365. We walk on the garden path.我們走在花園小徑上。
366. What you need is just rest.你需要的就是休息。
367. What’s your favorite steps? 你最喜歡跳什麼舞?
368. You'd better let her alone.你們最好是讓她一個人呆會兒。
369. A lost chance never returns.錯過的機會永不再來。
370. Don't let this get you down.不要為此灰心喪氣。
371. He shot the lion with a gun.他用槍把獅子打死了。
372. I don't think you are right.我認為你是不對的。
373. I have never seen the movie.我從未看過那部電影。
374. I haven't seen you for ages.我好久沒見到你了。
375. I was alone,but not lonely.我獨自一人,但並不覺得寂寞。
376. I went there three days ago.我三天前去過那兒。
377. It's a friendly competition.這是一場友誼賽。
378. It's very thoughtful of you.你想得真周到。
379. May I speak to Lora,please? 我能和勞拉說話嗎?
380. Mr. Wang is fixing his bike.王先生在修他的自行車。
381. My brother is seeking a job.我弟弟正在找工作。
382. Nancy will retire next year.南希明年就退休了。
383. Neither you nor he is wrong.你沒錯,他也沒錯。
384. Opportunity knocks but once.機不可失,時不再來。
385. She dressed herself hastily.她匆忙穿上衣服。
386. She hired a car by the hour.她租了一輛按鐘點計費的汽車。
387. Someone is ringing the bell.有人在按門鈴。
388. The Smiths are my neighbors. 史密斯一家是我的鄰居。
389. These shoes don't fit right.這雙鞋不太合適。
390. This is only the first half.這才是上半場呢。
391. This pen doesn't write well.這鋼筆不好寫。
392. Would you like a cup of tea? 你想喝杯茶嗎?
393. You really look sharp today.你今天真漂亮。
394. Another cat came to my house.又有一隻貓來到我家了。
395. Check your answers with mine.把你的答案跟我的核對一下。
396. Don't keep the truth from me.別瞞著我事實真相。
397. Everything has its beginning.凡事都有開端。
398. He came to the point at once.他一下子就說到了點子上。
399. He fell behind with his work.他工作落後了。
400. He is the happiest man alive.他是世界上最快樂的人。
401. He neither smokes nor drinks.他既不抽煙也不喝酒。
402. He ran his horse up the hill.他策馬跑上小山。
403. He reminds me of his brother. 他使我想起了他的弟弟。
404. He was efficient in his work.他工作效率高。
405. He will do anything but work.只要不是乾活,他幹什麼都行。
406. His father runs a restaurant.他的父親經營一家餐館。
407. I have something to tell you.我有事要告訴你。
408. I smelled a smell of cooking.我聞到了燒菜做飯的味道。
409. I want to see the film again.我真想再看一遍。
410. I've got too much work to do.我要做的工作太多了。
411. Let's go for a walk,shall we? 咱們出去走走,好嗎?
412. Please let me check the bill.請讓我核對一下帳單。
413. Plenty of sleep is healthful.充足的睡眠有益於健康。
414. The sun comes up in the east.太陽從東方升起。
415. This is because we feel pain.這是因為我們能感到疼痛。
416. What do you desire me to do? 你想要我做什麼?
417. What you said was quite true.你所說的完全符合事實。
418. You can either stay or leave.你或者留下或者離開。
419. Your life is your own affair.你的生活是你自己的事。
420. All that glitters is not gold.發閃光的不全是黃金。
421. Are you going to have a party? 你要舉行聚會嗎?
422. Aren't you concerned about it? 難道你不擔心嗎?
423. Don't forget to keep in touch.別忘了保持聯繫。
424. He broke his words once again. 他又一次違背了諾言。
425. He is in his everyday clothes.他穿著平常的衣服。
426. He is taller than I by ahead.他比我高一頭。
427. He led them down the mountain.他帶他們下山。
428. He was trained to be a lawyer.他被培養成一名律師。
429. I am afraid that l have to go.我要走了。
430. I don't have any cash with me.我身上沒帶現金。
431. I have been putting on weight.我開始發胖了。
432. I have just finished the book.我剛剛讀完這本書。
433. I was late for work yesterday.我昨天上班遲到了。
434. It appears to be a true story.這故事似乎是真的。
435. I've got to start working out.我必須開始做健身運動了。
436. Japan is to the east of China.日本在中國的東部。
437. John asked Grace to marry him.約翰向格雷斯求婚。
438. My watch is faster than yours.我的表比你的表快。
439. New China was founded in l949. 1949年新中國成立。
440. Thanks for your flattering me.多謝你的誇獎。
441. They charged the fault on him.他們把過失歸咎於他。
442. This car is in good condition.這車性能很好。
443. This work itself is very easy.這件工作本身很容易。
444. Truth is the daughter of time.時間見真理(時間證明一切)。
2015年5月16日 星期六
2014年10月11日 星期六
[Android Telephony]框架結構簡析
原文出處: http://fanli7.net/a/JAVAbiancheng/shejimoshi/20130218/308209.html
Android Telephony涉及的框架結構如圖1所示。
![]()
圖1 Android Telephony框架結構
通過圖1可以發現Android Telephony框架結構的一些規律,具體如下。
1 系統運行庫層的HAL層
HAL(Hardware Abstraction Layer,硬件抽象層)在Linux和Windows操作系統平台下有不同的實現方式。
Windows下的HAL位於操作系統的最底層,它直接操作物理硬件設備,使用抽象接口來隔離不同硬件的具體實現,为上層的操作系統和設備驅動程序提供一個統一接口,起到對硬件的抽象作用。這样更換硬件時,編寫硬件的驅動只要實現符合HAL定義的標准接口即可,而上層應用並不會受到影響,不必關心具體來實現的是什麼硬件。
Linux 下的HAL與Windows下的HAL不太一样,HAL並不是位於操作系統的最底層直接操作硬件,相反,它位於操作系統核心層和驅動程序之上,是一個運行在User Space用戶空間中的服務程序。
2 簡析HAL結構
通過前面的學習,我們知道Android是基於Linux Kernel的開源智能手機操作系統,所以在這裏重點介紹Linux下的HAL,就不單獨介紹Windows下的HAL結構了。
要想知道HAL結構,先看看來自於HAL 0.4.0 Specification的框架圖吧,如圖1-4所示(引用自http://people.redhat.com/davidz/hal-spec/hal-spec.html)。
![]()
圖2 HAL 0.4.0 Specification框架結構
HAL是一個位於操作系統和驅動程序之上,運行在用戶空間中的服務程序。其目的是为上層應用提供一個統一的查詢硬件設備的接口。我們都知道,抽象就是为了隔離變化,那麼這裏的HAL可以帶给我們什麼?首先,有了HAL接口,可以提前開始應用的開發,而不必關心具體實現的是什麼硬件;其次,硬件廠家如果需要更改硬件設備,只要按照HAL接口規範和標准提供對應的硬件驅動,而不需要改變應用;最後,HAL簡化了應用程序查詢硬件的邏輯,把這一部分的复雜性轉移给HAL統一處理,這样當一些應用程序使用HAL時,可以把對不同硬件的實際操作的复雜性也交给不同硬件廠家提供的庫函數來處理。
總之,HAL所謂的抽象並不提供對硬件的實際操作,對硬件的操作仍然由具體的驅動程序來完成。
3 Android为什麼引入HAL
HAL的一些優勢在前面章節已經提到,這裏回顧一下。Android引入HAL不僅因为其自身的優勢,而且還有一個非常重要的原因,就是为了保障在Android平台基於Linux開發的硬件驅動和應用程序不必遵循GPL(General Public License)許可而保持封閉,這保障了更多廠家的利益。我們都知道,Linux Kernel是開源的而且遵循GPL許可證,根據GPL許可證規定,對源碼的任何修改都必須向社會開源。
那麼Android是如何做到的呢?Linux Kernel和Android的許可證不一样,Linux Kernel是GPL許可證,Android是ASL(Apache Software License)許可證。ASL許可證規定,可以隨意使用源碼,不必開源,所以建立在Android之上的硬件驅動和應用程序都可以保持封閉。也就是說,只要把關鍵的驅動處理相關的主要邏輯轉移到Android平台內,在LinuxKernel中僅保留基礎的通信功能,即使開源一部分代碼,對廠家來講也不會有什麼損失。
Google選擇了這样做,並且特意修改Kernel,原本應該包括在Linux Kernel中的某些驅動關鍵處理邏輯,被轉移到了HAL層之中而達到了不必開源的目的。
4 Android中HAL的運行結構
Android源碼中實現了一部分HAL,包括Wi-Fi、GPS、RIL、Sensor等,這些代碼主要儲存於以下目錄:
在Android中,HAL的運行機制是什麼样的呢?它有兩種運行機制,老式HAL和新式HAL,如圖3所示。
![]()
圖3 Android中HAL兩種運行結構
從圖3中不難看出,左邊是老的HAL結構,應用或框架通過so動態鏈接庫調用而達到對硬件驅動的訪問。在so動態鏈接庫裏,實現了對驅動的訪問邏輯處理。我們重點學習和理解HAL Stub方式, RIL也采用了此方式的設計思想。
HAL Stub 是一種Proxy代理概念,Stub雖然仍是以 *.so 的形式存在,但 HAL 已經將 *.so 的具體實現隱藏了起來。 Stub 向 HAL 提供operations方法,Runtime通過Stub提供的so獲取它的 operations方法,並告知Runtime的callback方法。這样Runtime和Stub都有對方調用的方法,一個應用的請求通過Runtime調用Stub的operations方法,而Stub響應operations方法並完成後,再調用Runtime的callback方法進行返回。這裏可能有一點繞,根據前面的描述再結合圖4所示會更容易理解。
![]()
圖4 HAL Stub結構
上層通過HAL提供的functions調用底層硬件,而底層硬件處理完成上層請求後或硬件狀態發生變化後,HAL層通過Runtime提供的callback接口回調上層應用。
HAL Stub 有一種包含關系,即 HAL 裏包含了很多的 Stub。 Runtime 只要說明請求類型,就可以取得並操作Stub對應的operations。其實現主要在 hardware.c 和 hardware.h 文件中,實質也是通過dlopen方法加載 .so動態鏈接庫,從而呼叫 *.so 裏的符號( symbol )實現。
------------------------------
本文節選自《深入理解Android : Telephony原理剖析與最佳實踐》,作者:楊青平。
|
2014年10月4日 星期六
[Telecom] UICC 架構
UICC的架構圖如下:

從圖中可以看出,UiccController是用來控制所有與卡相關的操作,通過UiccController,我們可以訪問IccRecords(SIM卡相關), CatService(STK相關),IccFileHandle(讀取SIM卡文件)。
[Android] 手機應用介面大全
Android手機應用介面大全
顯示網頁:
1. Uri uri = Uri.parse("http://www.google.com");
2. Intent it = new Intent(Intent.ACTION_VIEW,uri);
3. startActivity(it);
顯示地圖:
1. Uri uri = Uri.parse("geo:38.899533,-77.036476");
2. Intent it = new Intent(Intent.Action_VIEW,uri);
3. startActivity(it);
路徑規劃:
1. Uri uri = Uri.parse("http://maps.google.com/maps?f=d&saddr=startLat%20startLng&daddr=endLat%20endLng&hl=en");
2. Intent it = new Intent(Intent.ACTION_VIEW,URI);
3. startActivity(it);
撥打電話:
調用撥號程式
1. Uri uri = Uri.parse("tel:xxxxxx");
2. Intent it = new Intent(Intent.ACTION_DIAL, uri);
3. startActivity(it);
1. Uri uri = Uri.parse("tel.xxxxxx");
2. Intent it =new Intent(Intent.ACTION_CALL,uri);
3. 要使用這個必須在設定檔中加入
調用發送短信的程式
1. Intent it = new Intent(Intent.ACTION_VIEW);
2. it.putExtra("sms_body", "The SMS text");
3. it.setType("vnd.android-dir/mms-sms");
4. startActivity(it);
發送短信
1. Uri uri = Uri.parse("smsto:0800000123");
2. Intent it = new Intent(Intent.ACTION_SENDTO, uri);
3. it.putExtra("sms_body", "The SMS text");
4. startActivity(it);
發送彩信
1. Uri uri = Uri.parse("content://media/external/images/media/23");
2. Intent it = new Intent(Intent.ACTION_SEND);
3. it.putExtra("sms_body", "some text");
4. it.putExtra(Intent.EXTRA_STREAM, uri);
5. it.setType("image/png");
6. startActivity(it);
發送Email
1.
2. Uri uri = Uri.parse("mailto:xxx@abc.com");
3. Intent it = new Intent(Intent.ACTION_SENDTO, uri);
4. startActivity(it);
1. Intent it = new Intent(Intent.ACTION_SEND);
2. it.putExtra(Intent.EXTRA_EMAIL, "me@abc.com");
3. it.putExtra(Intent.EXTRA_TEXT, "The email body text");
4. it.setType("text/plain");
5. startActivity(Intent.createChooser(it, "Choose Email Client"));
1. Intent it=new Intent(Intent.ACTION_SEND);
2. String[] tos={"me@abc.com"};
3. String[] ccs={"you@abc.com"};
4. it.putExtra(Intent.EXTRA_EMAIL, tos);
5. it.putExtra(Intent.EXTRA_CC, ccs);
6. it.putExtra(Intent.EXTRA_TEXT, "The email body text");
7. it.putExtra(Intent.EXTRA_SUBJECT, "The email subject text");
8. it.setType("message/rfc822");
9. startActivity(Intent.createChooser(it, "Choose Email Client"));
添加附件
1. Intent it = new Intent(Intent.ACTION_SEND);
2. it.putExtra(Intent.EXTRA_SUBJECT, "The email subject text");
3. it.putExtra(Intent.EXTRA_STREAM, "file:///sdcard/mysong.mp3");
4. sendIntent.setType("audio/mp3");
5. startActivity(Intent.createChooser(it, "Choose Email Client"));
播放多媒體
1.
2. Intent it = new Intent(Intent.ACTION_VIEW);
3. Uri uri = Uri.parse("file:///sdcard/song.mp3");
4. it.setDataAndType(uri, "audio/mp3");
5. startActivity(it);
1. Uri uri = Uri.withAppendedPath(MediaStore.Audio.Media.INTERNAL_CONTENT_URI, "1");
2. Intent it = new Intent(Intent.ACTION_VIEW, uri);
3. startActivity(it);
Uninstall 程式
1. Uri uri = Uri.fromParts("package", strPackageName, null);
2. Intent it = new Intent(Intent.ACTION_DELETE, uri);
3. startActivity(it);
Android 源碼分析-打電話和發短信
1. ITelephony介面和ISms介面以及AIDL
在我們的Android應用中,當需要實現電話撥號時,我們需要進行如下調用
ITelephony phone = (ITelephony)ITelephony.Stub.asInterface(ServiceManager.getService("phon"))
phone.dial("10086");
對於短信應用,我們需要的是調用SmsManager,代碼如下
SmsManager manager = SmsManager.getDefault();
manager.sendTextMessage("10086",null,"hi,this is sms",null,null);
這裡,SmsManager對ISms做了一層包裝,實質上是通過調用
ISms simISms = ISms.Stub.asInterface(ServiceManager.getService("isms"));
simISms.sendRawPdu....
可以看到,應用都是採用AIDL來實現IPC的跨進程調度。
對於AIDL應用,調用進程方存在的是一個實現介面的Proxy物件,通過Proxy物件與被調用進程中的Stub物件進行
通訊來實現IPC的跨進程調度,所以,在被調用進程一端必定有一個ITelephony.Stub類以及ISms.Stub類的實現。
2. PhoneInterfaceManager和SimSmsInterfaceManager
ITelephony.Stub 的實現類為com.android.phone.PhoneInterfaceManager
ISms.Stub的實現類為com.android.internal.telephony.gsm.SimSmsInterfaceManager
從這兩個類的構造器的調用代碼裡可以很清楚的看到進行了Service的註冊工作
ServiceManager.addService("phone",this);
ServiceManager.addService("isms",this);
3. PhoneApp,InCallScreen,PhoneUtils及其他相關類
從SimSmsInteferManager的相關方法實現中可以看到,具體就是調用GSMPhone的SmsDispatcher實例來進行相關操作的。
從PhoneInterfaceManager會維持一個Phone物件的引用,當撥號應用時,PhoneInterfaceManager會將構造好的Intent傳遞
給PhoneApp應用,該Intent的className指定則為InCallScreen,從中我們可以看到InCallScreen具體是通過PhoneUtils調用Phone的
相關方法來實現。
PhoneInterfaceManager怎麼獲取到對應的Phone物件,然後又怎麼將Phone物件傳遞到InCallScreen中呢?
具體這裡涉及到了PhoneApp這個類,從這個類維護了一個 PhoneInterfaceManager的引用(phoneMgr)以及一個Phone引用(phone),
從該類的onCreate方法中我們可以清楚的看到,PhoneApp通過PhoneFactory獲取了一個Phone實例,並通過該實例實現了PhoneInterfaceManager物件。
因此,我們現在只需要關注PhoneFactory具體提供的是一個什麼樣的Phone實例了。
另外,PhoneApp類還提供了一個靜態方法getInstance供InCallScreen調用,InCallScreen正是通過調用該方法獲得PhoneApp實例從而
獲得對應的Phone實例的。
接下來,我們通過查看PhoneFactory的方法可以看到,Phone物件對應的就是一個GSMPhone實例。
4。GSMPhone與RIL
從GSM的構造器可以看出,他依賴一個CommandInterface介面實例,通過PhoneFactory的makeDefaultPhones方法,我們可以看到,根據系統環境變數
ro.radio.noril來判斷是否需要採用RIL框架實現,如果該參數不為空,則採用Simultedcommands(主要是為了測試需要提供的類比實現).否則,採用RIL。
通過Google才知道,RIL其實是智慧手機上實現AP與BP之間通信的一種設計思想,具體大家可以參見這篇文章http://www.eetchina.com/ARTICLES ... DF?SOURCES=DOWNLOAD
在RIL.java 中我們很驚喜的看到,RIL對對消息的處理是將消息通過LocalSocket發送到以rild為名稱的有名埠。這個有名Socket的創建在ril.cpp代碼中。
s_fdListen = android_get_control_socket(SOCKET_NAME_RIL)
原來Android通話和發短信的應用是JAVA與C++代碼之間透過Socket連接來傳輸消息來實現的。
5.關於C代碼與硬體之間的交互
這部分工作其實就是C代碼通過串口發送AT指令來撥號,收發短信。
[Android] Android Manifest 詳解
文章來源:https://code.google.com/p/androidbmi/wiki/AndroidManifest
在執行「startActivity」函式時,應用程式並不是直接呼叫另一個 Activity,而是將「Intent」(意圖)傳進 Android 框架中。 Android 框架會查看 「startActivity」 呼叫所傳入的動作與 Intent 內容是否在註冊表中,如果符合,就啟動對應的服務或 Activity。
Android 系統中的每一個應用程式,在安裝的過程裡,都得事先在 Android 框架中註冊、登記這個應用程式所建立的 Activity,並事先註明會使用到的服務。譬如當我們在 Android 上安裝我們撰寫的 BMI 應用程式時,BMI 應用程式就會向 Android 框架登記相關資訊:BMI 應用程式將會用到 「Bmi」這個 Activity。
這份訊息存在於每個 Android 應用程式專案根目錄下的「AndroidManifest.xml」檔案中。如果我們在程式裡,要用到其他應用程式或服務所提供的功能,也需一併在此列出。
在安裝應用程式的時候,Android 框架會根據應用程式提供的這份清單,將資訊註冊於 Android 框架的註冊表中。
備註:
這麼說其實是不太精確的。Android 應用程式的運作流程,存在於四種載體中:
- Activity (活動)
- Broadcast Intent Receiver
- Service
- Content Provider
各種載體的相關內容會在後續章節提到時作解說。
預設的 Activity 清單
我們使用 eclipse Android 開發工具打開「BMI/AndroidManifest.xml」檔案。切換到「AndroidManifest.xml」分頁標籤,查看預設的 「BMI/AndroidManifest.xml」檔案原始碼:
1 xml version="1.0" encoding="utf-8"?> 2 <manifest xmlns:android="http://schemas.android.com/apk/res/android" 3 package="com.demo.android.bmi" 4 android:versionCode="1" 5 android:versionName="1.0"> 6 <application android:icon="@drawable/icon"> 7 <activity android:name=".Bmi" android:label="@string/app_name"> 8 <intent-filter> 9 <action android:name="android.intent.action.MAIN" /> 10 <category android:name="android.intent.category.LAUNCHER" /> 11 </intent-filter> 12 </activity> 13 </application> 14> 15 </manifest>
我們分行講解如下:
xml version="1.0" encoding="utf-8"?>
xmlns:android="http://schemas.android.com/apk/res/android"
....>
....
「AndroidManifest.xml」這個檔案也是以 XML 格式描述,每個 Android 應用程式都需要一個「AndroidManifest.xml」檔案,每份「AndroidManifest.xml」檔案的開頭都會出現這段敘述。而整個「AndroidManifest.xml」檔案的敘述,都包含在「manifest」(清單)這個主要標籤中。
package="com.demo.android.bmi"
「package」 是「manifest」(清單)標籤的一個特別屬性,範例中的內容可用來標明,這個應用程式的進入點存在於「com.demo.android.bmi」這個名稱空間/路徑中。
android:versionCode="1" android:versionName="1.0"
「android:versionCode」和「android:versionName」是應用程式版本號。 這兩個屬性是可選的(非必要)。 「android:versionName」是給使用者看的版本號,如「1.0」、「2.0」。「android:versionCode」則是開發者用的內部版本號,一般使用流水號。
android:icon="@drawable/icon" android:label="@string/app_name">
...
「manifest」標籤中主要包含一個「application」標籤(備註1)。「application」標籤裡面,定義了所有這個應用程式用到的 Activity、服務等資訊。「application」標籤中的「android:icon」屬性,定義了這個應用程式將顯示在 Android 主畫面中的應用程式圖示。「android:icon="@drawable/icon"」表示應用程式圖示的資源檔存在於 「res/drawable/icon」 中。圖示的大小必須超過 64x64 像素(Pixel)。「application」標籤中的「android:label」屬性可用來指定應用程式將顯示在 Home 主畫面上的名稱。也就是預設剛開好機時,可以從桌面下方拉出的應用程式列表。
android:name=".Bmi" android:label="@string/app_name">
...
「application」標籤中所有用到的 Activity ,都要包含在一個個「activity」標籤中(備註2)。 Activity 是 Android 應用程式與使用者互動的主要元素,當使用者開啟一個應用程式,第一個看到的畫面就是一個 Activity。若是一個應用程式中包含多個畫面時,會定義多個不同的 Activity,我們也必須在「application」標籤中,使用多個「activity」標籤,為不同的 Activity 添加描述。如果我們已經在程式碼中定義好了 Activity ,卻忘了在「AndroidManifest.xml」檔案中加入對應的「activity」標籤,那麼在執行中呼叫到這個 Activity 的時候,將無法開啟這個 Activity。
「activity」標籤的「android:name」屬性,指出了這個 Activity 所對應的類別(class)。「activity」標籤中的「android:label」屬性可用來指定應用程式將顯示在 Activity 畫面上方的名稱。也可以在程式碼中透過「setTitle(“名稱”)」來動態修改。
因為在上一層「Manifest」標籤屬性中已經定義了「package="com.demo.android.bmi"」,因此在「activity」標籤的 「android:name」屬性中,「.Bmi」代表著「com.demo.android.bmi.Bmi」的簡寫。也可以寫成「Bmi」,一樣是代表「com.demo.android.bmi.Bmi」這個類別。
android:name="android.intent.action.MAIN" /> android:name="android.intent.category.LAUNCHER" />
「intent-filter」標籤定義了這個「activity」的性質。 「intent-filter」中主要包含了兩個標籤:「action」跟「category」標籤。 「action」標籤中的「android:name」屬性,其內容「android.intent.action.MAIN」表示:這個 Activity 是此應用程式的進入點(就像程式中常見的 main 主程式),開啟這個應用程式時,應先執行這個 Activity。 。常見的還有「android.intent.action.EDIT」等標籤,會在之後章節用上的時候講解。「category」標籤中的「android:name」屬性,其內容「android.intent.category.LAUNCHER」表示:這個 Activity 將顯示在 Launcher 的應用程式列表中。
我們把整個檔案合到一起看,可以總結出這個檔案所傳達的訊息:在「com.demo.android.bmi」路徑下的「Bmi.java」這個檔案中,已定義了一個主要的 Activity; 當我們打開 Android 的時候,顯示的是位於「res/drawable/icon」的圖示。一旦我們按下圖示來啟動這個應用程式,Android 應用程式框架會去尋找到定義了「android.intent.action.MAIN」內容的 「.Bmi」activity,並呼叫執行。
android:minSdkVersion="X" />
Android SDK 1.1 版之後引入了這條敘述,「X」代表了目標版本代號。透過指定這個參數,系統可以依此辨別應用程式是否使用相容的 SDK 版本,好決定能否在這台機器上安裝執行。這也是一個可選填的選項。但如果我們的應用程式要發佈出去,一些強勢的通路如 Google Android Market 已規定所有新發佈的應用程式必須指定「android:minSdkVersion」這個參數。
訂閱:
文章 (Atom)



