Improve Watermark#detect execution performance

Since Watermark#detect used 4 layers loops to match if
the captured screenshot exists the given keyboard bitmap
to idendify the soft-keyboard visiblity.

This may take a lot of time when the device has disabled
Jit compilation.

Follow https://developer.android.com/training/articles/perf-tips#Loops
tips to improve Watermark#robustMatch by using the local
variable or inline the method implementation to prevent the cost when
invoking methods in loops.

Bug: 191111111
Test: 0) Disable Jit compilation with
      - setprop dalvik.vm.usejit false
      - setprop dalvik.vm.usejitprofiles false
      - restart device
      1) testing ImeInsetsVisibilityTest#\
      testEditTextPositionAndPersistWhenAboveImeWindowShown
         to see if TestTimedOutException happens
Change-Id: I78a4775788f2711a017586783d84fb13a3905848
1 file changed