<meter id="pryje"><nav id="pryje"><delect id="pryje"></delect></nav></meter>
          <label id="pryje"></label>

          新聞中心

          Android 框架簡介

          作者: 時間:2016-09-12 來源:網(wǎng)絡(luò) 收藏

          ======================= 第一節(jié) ===========================

          本文引用地址:http://www.ex-cimer.com/article/201609/303971.htm

          這里簡單的介紹了的java環(huán)境基礎(chǔ),在后面一節(jié)中會結(jié)合具體的實例來理解這一節(jié)的內(nèi)容。

          一、Dalvik虛擬機

          Dalvik是的程序的java虛擬機,代碼在dalvik/下,

          ./

          |-- .mk

          |-- CleanSpec.mk

          |-- MODULE_LICENSE_APACHE2

          |-- NOTICE

          |-- README.txt

          |-- dalvikvm 虛擬機的實現(xiàn)庫

          |-- dexdump

          |-- dexlist

          |-- dexopt

          |-- docs

          |-- dvz

          |-- dx

          |-- hit

          |-- libcore

          |-- libcore-disabled

          |-- libdex

          |-- libnativehelper 使用JNI調(diào)用本地代碼時用到這個庫

          |-- run-core-tests.sh

          |-- tests

          |-- tools

          `-- vm

          二、Android的java框架

          Android層次中第3層是java框架,第四層就是java應(yīng)用程序。

          Android的java類代碼,主要是在frameworks/base/core/java/下,

          ./

          |-- Android

          |-- com

          |-- jarjar-rules.txt

          `-- overview.html

          我們再看一下frameworks/base/目錄

          ./

          |-- Android.mk

          |-- CleanSpec.mk

          |-- MODULE_LICENSE_APACHE2

          |-- NOTICE

          |-- api

          |-- awt

          |-- build

          |-- camera

          |-- cmds

          |-- common

          |-- core

          |-- data

          |-- docs

          |-- graphics

          |-- include

          |-- keystore

          |-- libs

          |-- location

          |-- media

          |-- native

          |-- obex

          |-- opengl

          |-- packages

          |-- preloaded-classes

          |-- sax

          |-- services

          |-- telephony

          |-- test-runner

          |-- tests

          |-- tools

          |-- vpn

          `-- wifi

          這里也有Android的java框架代碼。

          三、JNI

          在Android中,通過JNI,java可以調(diào)用C寫的代碼,主要的實現(xiàn)是在frameworks/base/core/jni,通過查看Android.mk,我們可以看到最后生成了libandroid_runtime.so,具體實現(xiàn)JNI功能需要上面我們介紹的libnativehelper.so,

          四、系統(tǒng)服務(wù)之java

          1、binder,提供Android的IPC功能

          2、servicemanager,服務(wù)管理的服務(wù)器端

          3、系統(tǒng)進程zygote,負責孵化所有的新應(yīng)用

          ======================= 第二節(jié) ==========================

          在我平時工作中主要是進行l(wèi)inux網(wǎng)絡(luò)子系統(tǒng)的模塊開發(fā)、linux應(yīng)用程序(C/C++)開發(fā)。在學習和從事驅(qū)動模塊開發(fā)的過程中,如果你對linux系統(tǒng)本身,包括應(yīng)用程序開發(fā)都不了解,那么讀內(nèi)核代碼就如同天書,毫無意義,所以我分析框架也是從基本系統(tǒng)api開始的,當然也不會太多涉及到應(yīng)用程序開發(fā)。

          好,開始這節(jié)主要是講一個簡單的adnroid應(yīng)用程序,從應(yīng)用程序出發(fā),到框架代碼。

          分析的應(yīng)用程序我們也奉行拿來主義:froyo/development/samples/HelloActivity

          ./

          |-- Android.mk

          |-- AndroidManifest.xml

          |-- res

          |-- src

          `-- tests

          其他的就多說了,看代碼

          /**

          * Copyright (C) 2006 The Android Open Source Project

          *

          * Licensed under the Apache License, Version 2.0 (the License);

          * you may not use this file except in compliance with the License.

          * You may obtain a copy of the License at

          *

          * http://www.apache.org/licenses/LICENSE-2.0

          *

          * Unless required by applicable law or agreed to in writing, software

          * distributed under the License is distributed on an AS IS BASIS,

          * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

          * See the License for the specific language governing permissions and

          * limitations under the License.

          */

          package Android.util;

          import com.Android.internal.os.RuntimeInit;

          import java.io.PrintWriter;

          import java.io.StringWriter;

          /**

          * API for sending log output.

          *

          *

          Generally, use the Log.v() Log.d() Log.i() Log.w() and Log.e()

          * methods.

          *

          *

          The order in terms of verbosity, from least to most is

          * ERROR, WARN, INFO, DEBUG, VERBOSE. Verbose should never be compiled

          * into an application except during development. Debug logs are compiled

          * in but stripped at runtime. Error, warning and info logs are always kept.

          *

          *

          Tip: A good convention is to declare a TAG constant

          * in your class:

          *

          *

          private static final String TAG = MyActivity;

          *

          * and use that in subsequent calls to the log methods.

          *

          *

          *

          Tip: Don't forget that when you make a call like

          *

          Log.v(TAG, index= + i);

          * that when you're building the string to pass into Log.d, the compiler uses a

          * StringBuilder and at least three allocations occur: the StringBuilder

          * itself, the buffer, and the String object. Realistically, there is also

          * another buffer allocation and copy, and even more pressure on the gc.

          * That means that if your log message is filtered out, you might be doing


          上一頁 1 2 3 4 下一頁

          關(guān)鍵詞: Android 框架簡介

          評論


          相關(guān)推薦

          技術(shù)專區(qū)

          關(guān)閉
          看屁屁www成人影院,亚洲人妻成人图片,亚洲精品成人午夜在线,日韩在线 欧美成人 (function(){ var bp = document.createElement('script'); var curProtocol = window.location.protocol.split(':')[0]; if (curProtocol === 'https') { bp.src = 'https://zz.bdstatic.com/linksubmit/push.js'; } else { bp.src = 'http://push.zhanzhang.baidu.com/push.js'; } var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(bp, s); })();