Use median of border brightness as rotation background color

It was optimized in [1] to use "mode" to avoid sorting a big array
and deal with with some corner cases of distribution.

However, it may be more common to have an area with the same color
on one side of screen, e.g. a popup panel. Then its color may
dominate the result while other sides are evenly distributed.
So this restores the calculation to [2] by a more efficient way to
calculate the median by histogram, because the range of data is small.

[1]: Ieca9968e843b68d733e178edd725b628c542e872
[2]: I87bc87930aff48f90f271fc1783e70caf61dc7f4

Bug: 336255901
Test: adb shell wm size 2200x1600.
      Enable home rotation and auto rotation.
      Set a complex wallpaper which has various color at edges.
      Open AllApps drawer of home and rotate.
      The background color shouldn't be too bright (by the drawer).
Change-Id: I027ede52b5884de2dd6ad27243a0de3bf9316a09
1 file changed