background

I met the position of Android leader in Shanghai. I had a round of interview on Sunday, and I felt that my answers were all good.

And then you get an email and the interview is over and you say, “We were very impressed with your excellent knowledge and ability! After careful evaluation of your comprehensive situation and careful matching and balancing with the job needs, we are very sorry that we did not reach cooperation with you this time. But your information is already in the company’s talent pool.” It just means to hang up.

Later, I called HR and asked, but she didn’t tell me the reason. Then during the interview, there was something strange. Before the interview, the interviewer told me that I was in a strange position, and he didn’t tell me that it was strange.

### Interview process

Here are some questions that interviewers ask:

Interviewer: Click on an icon to go through the startup process of the application.

Answer:

After clicking the icon, call the activity to AMS remotely through startActivity. Ams pushes the newly started activity into the activity stack as activityRecord structure, and calls back to the original process by remote binder, making the original process enter pause state. When the original process is paused, ams is notified that I am paused. Ams then determines whether a new process needs to be started based on whether the flag in the intent of the activity to start contains the “new_task” label. The function startProcessXXX is used to start the new process. After the new process is started, the main function of ActivityThread is called by reflection. Looper. prepar and lopper.loop are called from main to start the message queue loop mechanism.

Finally, AMS was told remotely that I was up. Ams calls the handleLauncherAcitivyt to load the activity. In handlerLauncherActivity, the onCreate of the Application and the onCreate of the activity are called by reflection, and the onResume of the activity is called by reflection in handleResumeActivity. An application is launched.

Interviewer: Retrofit.

Answer:

It is primarily through dynamic proxies that interfaces are directly transformed into proxy objects. Dynamic proxies are different from static proxies. Dynamic proxies build bytecode objects directly at the virtual machine level.

Interviewer: View custom process, which methods to achieve.

Answer:

OnMeasure, onLayout,onDraw.

Continue to ask “What methods will be used in onMeasure?” (I think this question may not be very good, I wanted to answer in detail, but before the result was reached, he said, continue to the next question, I don’t know whether you agree or think my answer is too long, if you think too long can put forward ah…)

Two int values are passed in the onMeasure. The first two bits represent the mode and the last 30 bits represent the width and height. This is the limit that the outer container imposes on the inner view.

One mode is to give you whatever value the container gives you (match_parent), and the other mode is to give the inner view as much space as it wants. The third option is how much space the container should give the child view, and how much space the child view should take up, and choose the smaller one (wrap_content). At this point I was going to say that onMeasure will call measureChildwithmargin, and he said yes, and then on to the next problem.

Interviewer: How did you design the app?

Answer:

Basically MVC architecture. There was a project that used MVP. There were some other overall design questions, very piecemeal, but they all answered pretty well.

Interviewer :(the last question is the algorithm question, the interviewer’s expression is not very clear, so I did not understand his meaning at the beginning, I summarize the question)

I have 1,3,7 notes, and now I want n dollars. How to get the fewest number. 1 * a+3 * b+7 * c=n

Of course, I summed it up myself, and his description at the beginning made me want to cry.

Answer:

At the beginning of my brain, I did it as a logic problem. I thought for 5 minutes before I realized that it was a programming problem. Traversal, the value range of A (0 n), the value range of B (0 N /3), and the value range of C (0 to n/7) traversal is the minimum value. Of course, this situation is not efficient. I also told the interviewer at that time that I didn’t think much about efficiency. If necessary, I can change it again. I feel like he agrees. You just have to be right. I don’t remember any other bits and pieces, but that’s the main thing.

I think you should have seen a lot of experience sharing interview success, but according to the theory of survivor bias, there are also a lot of people to see where others failed in the interview, such as my failed interview, you can compare, find some of their answers will be more helpful to their own interview later.