Does Android always use the latest API to launch an application?

I came across MeasureSpec when I came across this bit of text:

Note. At API level 17 and below, the implementation of makeMeasureSpec was such that the order of the arguments did not matter, and an overflow in any value could affect the resulting MeasureSpec. This error has been affected by RelativeLayout. API-oriented app-oriented tiers greater than 17 will get fixed, more stringent behavior.

So I was wondering: if I create an application for API 14, but I ran it on an API 22 device, will it fix the error or will <API error 17 still exist on device 22?

+6
source share
1 answer

makeMeasureSpec (API 17 <), the implementation of the method is as follows:

public static int makeMeasureSpec(int size, int mode) { if (sUseBrokenMakeMeasureSpec) { return size + mode; } else { return (size & ~MODE_MASK) | (mode & MODE_MASK); } } 

As you can see, the return value depends on the value of sUseBrokenMakeMeasureSpec , which is assigned a value in the constructor of the View class:

  sUseBrokenMakeMeasureSpec = targetSdkVersion <= JELLY_BEAN_MR1; 

Thus, only application behavior will determine behavior. Thus, the new system can maintain compatibility with an older application that accelerates old behavior.

+4
source

All Articles