@Override
  public OverlayData createOverlayData(ComponentName remoteApp) {
    final OverlayData original = mOriginal.createOverlayData(remoteApp);
    if (original.isValid() || mFixInvalid) {
      final int backgroundLuminance = luminance(original.getPrimaryColor());
      final int diff = backgroundLuminance - luminance(original.getPrimaryTextColor());
      if (mRequiredTextColorDiff > Math.abs(diff)) {
        if (backgroundLuminance > GRAY_LUM) {
          // closer to white, text will be black
          original.setPrimaryTextColor(Color.BLACK);
          original.setSecondaryTextColor(Color.DKGRAY);
        } else {
          original.setPrimaryTextColor(Color.WHITE);
          original.setSecondaryTextColor(Color.LTGRAY);
        }
      }
    }
    return original;
  }
@Test
  public void testReturnsOriginalIfAllOkay() {
    OverlayData original = setupOriginal(Color.GRAY, Color.DKGRAY, Color.WHITE);
    final OverlayData fixed = mUnderTest.createOverlayData(mTestComponent);
    Assert.assertSame(original, fixed);
    Assert.assertTrue(fixed.isValid());
    Assert.assertEquals(Color.GRAY, fixed.getPrimaryColor());
    Assert.assertEquals(Color.DKGRAY, fixed.getPrimaryDarkColor());
    Assert.assertEquals(Color.WHITE, fixed.getPrimaryTextColor());
  }