Android概念點001(未完待寫)

AIDL:Android接口定義語言(Android Interface Definition Language)

IPC:進程間通信(Inter-Process Communication)

RPC:遠程過程調用(Remote Procedure Call)

RPC(Remote Procedure Call)—遠程過程調用,它是一種通過網絡從遠程計算機程序上請求服務,而不需要了解底層網絡技術的協議。RPC協議假定某些傳輸協議的存在,如TCP或UDP,爲通信程序之間攜帶信息數據。在OSI網絡通信模型中,RPC跨越了傳輸層應用層。RPC使得開發包括網絡分佈式多程序在內的應用程序更加容易。

RPC採用客戶機/服務器模式。請求程序就是一個客戶機,而服務提供程序就是一個服務器。首先,客戶機調用進程發送一個有進程參數的調用信息到服務進程,然後等待應答信息。在服務器端,進程保持睡眠狀態直到調用信息到達爲止。當一個調用信息到達,服務器獲得進程參數,計算結果,發送答覆信息,然後等待下一個調用信息,最後,客戶端調用進程接收答覆信息,獲得進程結果,然後調用執行繼續進行。

NDK:一種工具集可以支持使用C,C++

The Android NDK is a toolset that lets you implement parts of your app in native code, using languages such as C and C++. For certain types of apps, this can help you reuse code libraries written in those languages.

OOM

Out Of Memory   內存溢出

AMS

ActivityManagerService

assets目錄:

Android的一種特殊目錄,用於放置APP所需的固定文件,且該文件被打包到APK中時,不會被編碼到二進制文件。assets文件夾下的文件不會被映射到R.java中,調用assets目錄文件的方法請自行百度

 

bitmap位圖

是Drawable的一種,Drawable是Android處理圖像通用的類

AndroidBitamp指的就是一張圖片,一般是pngjpeg格式。

Bitmap類中有一個enum類型的Config,其中有4個值

  • ALPHA_8
    8位位圖;1 個字節,只有透明度,沒有顏色值

  • RGB_565
    16位位圖;2 個字節,r = 5,g = 6,b = 5,一個像素點 5+6+5 = 16

  • ARGB_4444
    16位位圖;2 個字節,a = 4,r = 4,g = 4,b = 4,一個像素點 4+4+4+4 = 16

  • ARGB_8888
    32 位位圖; 4個字節,a = 8,r = 8,g = 8, b = 8,一個像素點 8 + 8 + 8 + 8 = 32

每8位一個字節

 

Drawable

是一個抽象的可繪製類。一種可以在Canvas上進行繪製的抽象的概念

顏色、圖片等都可以是一個Drawable

Drawable可以通過XML定義,或者通過代碼創建

Android中Drawable是一個抽象類,每個具體的Drawable都是其子類

 

軟件覆蓋問題

一個看包名是否相同

一個是看build.gradle的

applicationId "com.example.administrator.testicon2"屬性是否相同

 應用圖標

現在Android推薦圓形和方形帶圓角兩種,不推薦透明背景的圖標,但透明背景也可以實現

ANR

Application Not Responding,也就是應用程序無響應

主線程進程耗時操作會導致ANR

ResolveInfo類

Information that is returned from resolving an intent against an IntentFilter. This partially corresponds to information collected from the AndroidManifest.xml's <intent> tags.

根據IntentFilter解析intent的一個匹配的結果(這部分對應於AndroidManifest<intent>標籤中註冊的信息)

例如 List<ResolveInfo> resInfoList = getPackageManager().queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY);查找所有intent匹配結果

NetWorkInfo類

Describes the status of a network interface.

Use ConnectivityManager.getActiveNetworkInfo() to get an instance that represents the current network connection.

用於描述網絡接口狀態的一個類

NetWork類

Identifies a Network. This is supplied to applications via ConnectivityManager.NetworkCallback in response to the active ConnectivityManager.requestNetwork(NetworkRequest, PendingIntent) or passiveConnectivityManager.registerNetworkCallback(NetworkRequest, PendingIntent) calls. It is used to direct traffic to the given Network, either on a Socket basis through a targeted SocketFactory or process-wide viaConnectivityManager.bindProcessToNetwork(Network).

識別網絡的一個類,沒怎麼用過不熟悉

NetWorkRequest類

Defines a request for a network, made through NetworkRequest.Builder

定義了一個對網絡的請求

LinkProperties類

Describes the properties of a network link. A link represents a connection to a network. It may have multiple addresses and multiple gateways, multiple dns servers but only one http proxy and one network interface. Note that this is just a holder of data. Modifying it does not affect live networks.

Android進程分類(按重要度分)

前臺進程:

用戶當前正在做的事情所必需的進程,符合以下條件視爲前臺進程

極其重要,手機上只會有幾個前臺進程,只有當內存極度不足纔會終止進程

可見進程:

可見進程正在做用戶當前知道的操作,終止該進程會造成很差的用戶體驗,符合以下條件視爲可見進程

  • It is running an Activity that is visible to the user on-screen but not in the foreground (its onPause()method has been called). This may occur, for example, if the foreground Activity is displayed as a dialog that allows the previous Activity to be seen behind it.
  • It has a Service that is running as a foreground service, through Service.startForeground() (which is asking the system to treat the service as something the user is aware of, or essentially visible to them).
  • It is hosting a service that the system is using for a particular feature that the user is aware, such as a live wallpaper, input method service, etc.

也很重要但低於前臺進程,不容易被系統終止 

服務進程:

含有一個正在執行的服務,會隨着服務執行的時間重要度降低,直到降爲cached LRU,這有助於避免內存泄露和使用過多的RAM 

系統一般會保證該進程的運行

緩存進程:

緩存進程是當前不需要的進程,一般系統會存在多個緩存進程,並根據內存需要定期從最老的緩存進程開始終止

例如Activity處於停止狀態(onStop已經調用)會進入緩存進程

緩存進程保存在pseudo-LRU list(僞最近最少使用列表)中,系統會第一個終止排在pseudo-LRU list中最後一個進程

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章