Introduction to the Application Framework layer in Android Framework, androidframework
The four-layer architecture of Android is much clearer than everyone else. We often talk about the following: Linux2.6 kernel layer, core library layer, application framework layer, and application layer. Today, I will focus on introducing the Framework at the application Framework layer, which is actually my own learning experience.
The Framework layer provides a lot of APIS for developing applications. We call special APIs to construct our apps to meet our business needs. Everyone who writes apps knows that the first step to learning Android development is to learn a variety of APIS, activities, services, and notifications. These are provided by the framework, so I will explain in detail what role the Framework plays in the entire Android architecture.
Framework Functions
Framework can be simply understood as some API repositories. android Developers implement some basic functions and provide them with upper-layer calls through interfaces, which can be called repeatedly.
We can call the Framework layer exactly the layer implemented by the Java language. The APIS defined in this layer are all written in Java. However, because it contains the JNI method, JNI uses C/C ++ to write an interface and calls the underlying method in the core library Layer Based on the function Table query, and finally accesses the Linux kernel. Then there are two roles for the Framework layer.
1. compile some standardized modules in Java and encapsulate them into a framework for developers at the APP layer to call and develop mobile apps with special services.
2. Use Java Native Interface to call the local method of core lib layer. The JNI library is loaded when the Dalvik virtual machine starts. Dalvik will directly address the JNI method and then call it.
The combination of the two methods enables communication between the Java method and the operating system. Why does Android use Java to write the Framework layer? Is it better to use C or C ++ directly? Relevant experts give the following explanation:
C/C ++ is too low-layer. developers need to spend a lot of time studying the C/C ++ language. For example, C/C ++ memory mechanism. If you do not pay attention to it, you will forget to enable or release it. Java GC will automatically process this, saving a lot of time for developers to focus on their own business. Therefore, the underlying layer of C/C ++ is gradually changed to the JAVA development language, which interacts with the core Runtime Library layer through JNI.
In fact, these are also the reasons why Java can develop so rapidly, facing the advantages of object language. You don't have to pay too much attention to the memory, so you can create new things with confidence.
Framework API
Activity Manager
It is used to manage the application lifecycle and provides common navigation rollback functions.
Window Manager
We provide some methods to access the mobile phone screen. The transparency, brightness, and background of the screen.
Content Providers
This allows applications to access the data of another application (such as the contact database) or share their own data.
View System
It can be used to build applications, including Lists, Grids, Text boxes, Buttons, and even embedded web browsers.
Notification Manager
This allows the application to display custom prompts in the status bar.
Package Manager
Provides access to the system installation package. This includes installing and uninstalling applications, querying permission information, and Application-related information.
Telephony Manager
It mainly provides a series of methods for accessing the status and information related to mobile phone communication, and querying the status information of telecom networks and SIM cards.
Resource Manager
Provides access to non-code resources, such as local strings, graphs, and Layout files ).
Location Manager
You can obtain the address and location of a device. Obviously, GPS navigation can certainly use location services.
XMPP
Scalable communication and representation protocols. Formerly Jabber, it provides instant messaging services. For example, Google Talk. ... There are still many services provided by the Framework layer, so we will not list them one by one.
Summary
Starting from the overall Framework of Android, we will only detail the Framework layer, and briefly describe its functions and functions as well as the roles played in the layer-4 Framework. Then list some important services it provides to the upper layer. I have a simple understanding of the Application Framework and started with this. I will study each service in detail later. Thanks