Byte 5 faces, 4 rounds, let me analyze the source code of the Android Framework layer! Is this deliberately embarrassing me?

Author: Huang

Every March and April is the peak season for interviews. The Internet is commonly known as the term **"Golden Three Silver Four"**. At this stage, many companies are recruiting talents, and many interviewers and incumbents want to use this time for job-hopping interviews. .

I used to come here like this. The most memorable section of my sutra was the beating of bytes. Now it makes me feel cold on my back. It is simply too uncomfortable to be tortured by the interviewer. Although I have been working for seven years, I am only writing about the business, and I don’t have a deep understanding of the bottom layer. The interview experience directly made me feel the gap between me and those first-line manufacturers. To be honest, it is really uncomfortable.

I don't want to talk too much nonsense. I will give you a bit of interview experience back and forth. There are 5 rounds of interviews in total. As for the reason why I have interviewed 5 rounds, maybe the interviewer still wants to try my skill level;

Byte Feishu client side
  • Talk about the Android boot process

I talked a lot, among them, the ServiceManager process is used to manage system services. The interviewer said you are sure? Isn't it the SystemServer process to manage system services? After some discussion, the interviewer was stunned, mentioned SystemUI service, mentioned the desktop process, and asked how to replace the boot-up animation?

  • How did the system help us start to find the desktop application

I said through the intent, he said how to find which intent? I said that PMS will parse the AndroidManifest.xml of all apks. If it is parsed, it will be stored in package.xml and will not be parsed repeatedly. PMS can find it with it.

  • Talk about the loading of the dynamic status page, why do you do it this way?

I said that in order to reduce the time for xml parsing and reflection to create objects, and to avoid creating multiple unusable objects at the same time, I wrote a framework to dynamically add them with code. At this time, the interviewer misunderstood what I meant, thinking that all the interfaces were written in code. That would be too much trouble, and I explained it clearly later.

  • Talking about the page refresh mechanism, what do the color values ​​of the GPU debugging tool represent?

Talking about the underlying management of Surface is actually IBPQ, talking about the origin of the asynchronous signal is SurfaceFlinger issued by the hardware and software mechanism, and talking about how the content drawn on our app interface is submitted and passed to SurfaceFlinger. The meaning of the several colors of the GPU debugging tool is also probably discussed.

  • Why does the transfer of objects between activities need to be serialized?

  • Do you know how okhttp reuses connections?

This is a network optimization problem. The same ip and the same port can multiplex a connection. Later, I asked about the multiplexing of http 2.0. I said that a tcp can have multiple requests. What is the principle? I said I don't know. Let me talk about https later.

  • Quick sorting and recursion (algorithm problems)

Generally speaking, on the one hand, I did a good job. Perhaps the interviewer thought I was underestimated. The next four rounds of interviews seemed to be severely cracked down on me.

Two Sides of Byte Feishu Client
  • Talk about dynamic registration and static registration

Static registration is to find the method through the package name and function name, and dynamic registration is through the registration method table. Among them, I was asked which function was called to register the method table.

  • What is the loading process of so and what is the life cycle?

This is to look at the source code analysis from the java layer. It is loaded from the PathList of the ClassLoader to find the target path. At the same time, so is loaded and mapped to the virtual space through mmap. The JNI_OnLoad and JNI_OnUnload() methods are called when the library is loaded and unloaded during the life cycle.

  • How to detect memory leaks in the native layer

I said that it is reasonable to hook the function, the number of times of memory creation and memory release should be the same, if they are not the same, memory leaks can be suspected. The interviewer then asked if there are any third-party tools or libraries that can be tested? I said that I actually didn't write much in the company. I don't know what framework the engine group integrates. I am mainly good at application layer development.

  • Please briefly describe the startup process of Zygote
  • Please analyze the role of the init process
  • Please analyze the source code of Zygote
  • The principle of eakcanary, which objects can be used as gc-root

Okay, you said that you are mainly good at application layer development. How do you detect memory leaks in the Java layer? Let me talk about the principle of the leakcanary we use. After the principle, I asked me whether all object leaks can be detected. How is his citation chain managed? I asked later that you just said that weak reference objects will be released during gc. When will they not be released? I was confused at this time. In fact, it will not be released when there is a memory leak. My brain was short-circuited and I didn't react.

Three sides of Byte Feishu client
  • Service running thread
    (all life cycle methods are in the main thread)

  • On which thread does the callback method in ServiceConnection run?

  • Briefly describe the mechanism of process keep-alive

  • Are you familiar with plug-inization? Talk about the idea of ​​implementing a plug-in framework

  • Talk about the disadvantages of the Bander mechanism

  • Handwriting a simple hot fix framework

  • Please analyze how AMS and PMS communicate?

  • Shredded algorithm

Byte Feishu Client Four Sides
  • What are the development advantages of Jetpack?
  • Source code analysis of LiveData and Databinding
  • Single-phase bonding and two-way bonding
  • The design idea of ​​Recycleview recycling pool
  • Source code analysis of HandlerThread
  • Multiple Handlers add data to the MessageQueue, how does the internal guarantee that the thread is safe?
  • Final Algorithm Problem
Five Sides of Byte Feishu Client
  • Why is the maximum data transfer between activities 4M?
  • Briefly describe Looper's transaction swap?
  • A simple question? Then you talk about the drawing process of ViewGroup?
  • Kotlin和Flutter
  • Final Algorithm Problem

At last

**I didn't get the offer in the end, but this interview experience gave me a more intuitive understanding of the gap between me and the Android development of major manufacturers, which is quite profitable. **The overall interview situation feels good; almost, the byte asked this.

After this failure, I used my spare time to conduct in-depth study to make up for the technical insufficiency in this interview. I also compiled a PDF learning document of "Android Knowledge Point", which recorded some big factories. Some common interview questions from various companies in previous years. Due to the length of the article, I have shown them in the form of pictures. If you want to learn the complete knowledge points, you can visit my GitHub address: https://github.com /733gh/Android-T3 for reference.

If you want to learn the complete knowledge points, you can visit my GitHub address: https://github.com/733gh/Android-T3 for reference.

Guess you like

Origin blog.csdn.net/u012165769/article/details/114605263