• <li id="00i08"><input id="00i08"></input></li>
  • <sup id="00i08"><tbody id="00i08"></tbody></sup>
    <abbr id="00i08"></abbr>
  • 新聞中心

    EEPW首頁 > 嵌入式系統 > 設計應用 > Android 框架簡介

    Android 框架簡介

    作者: 時間:2016-09-12 來源:網絡 收藏

    ======================= 第一節 ===========================

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

    這里簡單的介紹了的java環境基礎,在后面一節中會結合具體的實例來理解這一節的內容。

    一、Dalvik虛擬機

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

    ./

    |-- .mk

    |-- CleanSpec.mk

    |-- MODULE_LICENSE_APACHE2

    |-- NOTICE

    |-- README.txt

    |-- dalvikvm 虛擬機的實現庫

    |-- dexdump

    |-- dexlist

    |-- dexopt

    |-- docs

    |-- dvz

    |-- dx

    |-- hit

    |-- libcore

    |-- libcore-disabled

    |-- libdex

    |-- libnativehelper 使用JNI調用本地代碼時用到這個庫

    |-- run-core-tests.sh

    |-- tests

    |-- tools

    `-- vm

    二、Android的java框架

    Android層次中第3層是java框架,第四層就是java應用程序。

    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可以調用C寫的代碼,主要的實現是在frameworks/base/core/jni,通過查看Android.mk,我們可以看到最后生成了libandroid_runtime.so,具體實現JNI功能需要上面我們介紹的libnativehelper.so,

    四、系統服務之java

    1、binder,提供Android的IPC功能

    2、servicemanager,服務管理的服務器端

    3、系統進程zygote,負責孵化所有的新應用

    ======================= 第二節 ==========================

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

    好,開始這節主要是講一個簡單的adnroid應用程序,從應用程序出發,到框架代碼。

    分析的應用程序我們也奉行拿來主義: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 下一頁

    關鍵詞: Android 框架簡介

    評論


    相關推薦

    技術專區

    關閉
    主站蜘蛛池模板: 临湘市| 凤台县| 新和县| 伊宁市| 台南县| 广灵县| 湘潭市| 咸阳市| 藁城市| 肃南| 神木县| 三门峡市| 贵南县| 惠水县| 贵港市| 延吉市| 婺源县| 怀柔区| 罗平县| 桂东县| 蓬溪县| 新津县| 疏附县| 石景山区| 宣武区| 漳浦县| 光山县| 北川| 临高县| 闻喜县| 西林县| 精河县| 安福县| 金沙县| 磴口县| 盱眙县| 光泽县| 阿克苏市| 乌兰察布市| 临邑县| 永福县|