Replace com.android.internal.util.Predicate with java.util.function.Predicate

Bug: 35089332
Bug: 30188076
Test: make checkbuild
Change-Id: I0a5b4bf520fc39b59d8d790b01e9cff0d54e6d21
This commit is contained in:
Paul Duffin
2017-02-07 15:04:10 +00:00
parent 80f42edfc7
commit ca4964ccbe
11 changed files with 22 additions and 24 deletions

View File

@@ -32,8 +32,6 @@ import android.view.MotionEvent.PointerCoords;
import android.view.MotionEvent.PointerProperties;
import android.view.accessibility.AccessibilityEvent;
import com.android.internal.util.Predicate;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.TimeoutException;
@@ -261,7 +259,7 @@ class InteractionController {
}
/**
* Returns a Runnable for use in {@link #runAndWaitForEvents(Runnable, Predicate, long) to
* Returns a Runnable for use in {@link #runAndWaitForEvents(Runnable, AccessibilityEventFilter, long) to
* perform a click.
*
* @param x coordinate

View File

@@ -42,7 +42,6 @@ import android.view.accessibility.IAccessibilityInteractionConnectionCallback;
import com.android.internal.R;
import com.android.internal.os.SomeArgs;
import com.android.internal.util.Predicate;
import java.util.ArrayList;
import java.util.HashMap;
@@ -51,6 +50,7 @@ import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Queue;
import java.util.function.Predicate;
/**
* Class for managing accessibility interactions initiated from the system
@@ -1205,7 +1205,7 @@ final class AccessibilityInteractionController {
}
@Override
public boolean apply(View view) {
public boolean test(View view) {
if (view.getId() == mViewId && isShown(view)) {
mInfos.add(view.createAccessibilityNodeInfo());
}

View File

@@ -115,7 +115,6 @@ import android.widget.FrameLayout;
import android.widget.ScrollBarDrawable;
import com.android.internal.R;
import com.android.internal.util.Predicate;
import com.android.internal.view.TooltipPopup;
import com.android.internal.view.menu.MenuBuilder;
import com.android.internal.widget.ScrollBarUtils;
@@ -140,6 +139,7 @@ import java.util.Locale;
import java.util.Map;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.function.Predicate;
/**
* <p>
@@ -9325,7 +9325,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
final int id = mID;
return root.findViewByPredicateInsideOut(this, new Predicate<View>() {
@Override
public boolean apply(View t) {
public boolean test(View t) {
return t.mNextFocusForwardId == id;
}
});
@@ -20002,7 +20002,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
* @hide
*/
protected View findViewByPredicateTraversal(Predicate<View> predicate, View childToSkip) {
if (predicate.apply(this)) {
if (predicate.test(this)) {
return this;
}
return null;
@@ -24448,20 +24448,20 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
}
}
private class MatchIdPredicate implements Predicate<View> {
private static class MatchIdPredicate implements Predicate<View> {
public int mId;
@Override
public boolean apply(View view) {
public boolean test(View view) {
return (view.mID == mId);
}
}
private class MatchLabelForPredicate implements Predicate<View> {
private static class MatchLabelForPredicate implements Predicate<View> {
private int mLabeledId;
@Override
public boolean apply(View view) {
public boolean test(View view) {
return (view.mLabelForId == mLabeledId);
}
}

View File

@@ -57,7 +57,6 @@ import android.view.animation.LayoutAnimationController;
import android.view.animation.Transformation;
import com.android.internal.R;
import com.android.internal.util.Predicate;
import java.util.ArrayList;
import java.util.Arrays;
@@ -66,6 +65,7 @@ import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.function.Predicate;
/**
* <p>
@@ -4275,7 +4275,7 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
*/
@Override
protected View findViewByPredicateTraversal(Predicate<View> predicate, View childToSkip) {
if (predicate.apply(this)) {
if (predicate.test(this)) {
return this;
}

View File

@@ -21,10 +21,10 @@ import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import android.view.View;
import com.android.internal.util.Predicate;
import com.android.internal.widget.ViewPager;
import java.util.ArrayList;
import java.util.function.Predicate;
/**
* This displays a list of months in a calendar format with selectable days.
@@ -138,7 +138,7 @@ class DayPickerViewPager extends ViewPager {
@Override
protected View findViewByPredicateTraversal(Predicate<View> predicate, View childToSkip) {
if (predicate.apply(this)) {
if (predicate.test(this)) {
return this;
}

View File

@@ -49,12 +49,12 @@ import android.view.accessibility.AccessibilityNodeProvider;
import android.widget.RemoteViews.RemoteView;
import com.android.internal.R;
import com.android.internal.util.Predicate;
import com.google.android.collect.Lists;
import java.util.ArrayList;
import java.util.List;
import java.util.function.Predicate;
/*
* Implementation Notes:

View File

@@ -26,8 +26,7 @@ import android.widget.ListView;
import android.widget.HeaderViewListAdapter;
import java.util.ArrayList;
import com.android.internal.util.Predicate;
import java.util.function.Predicate;
public class WatchHeaderListView extends ListView {
private View mTopPanel;

View File

@@ -25,7 +25,6 @@ import android.os.MessageQueue;
import android.util.Slog;
import android.util.SparseArray;
import com.android.internal.util.IndentingPrintWriter;
import com.android.internal.util.Predicate;
import com.android.server.hdmi.HdmiAnnotations.IoThreadOnly;
import com.android.server.hdmi.HdmiAnnotations.ServiceThreadOnly;
import com.android.server.hdmi.HdmiControlService.DevicePollingCallback;
@@ -34,6 +33,7 @@ import java.util.ArrayList;
import java.util.Date;
import java.util.LinkedList;
import java.util.List;
import java.util.function.Predicate;
import java.util.concurrent.ArrayBlockingQueue;
import libcore.util.EmptyArray;
import sun.util.locale.LanguageTag;
@@ -77,7 +77,7 @@ final class HdmiCecController {
// Predicate for whether the given logical address is remote device's one or not.
private final Predicate<Integer> mRemoteDeviceAddressPredicate = new Predicate<Integer>() {
@Override
public boolean apply(Integer address) {
public boolean test(Integer address) {
return !isAllocatedLocalDeviceAddress(address);
}
};
@@ -85,7 +85,7 @@ final class HdmiCecController {
// Predicate whether the given logical address is system audio's one or not
private final Predicate<Integer> mSystemAudioAddressPredicate = new Predicate<Integer>() {
@Override
public boolean apply(Integer address) {
public boolean test(Integer address) {
return HdmiUtils.getTypeFromAddress(address) == Constants.ADDR_AUDIO_SYSTEM;
}
};
@@ -427,7 +427,7 @@ final class HdmiCecController {
switch (iterationStrategy) {
case Constants.POLL_ITERATION_IN_ORDER:
for (int i = Constants.ADDR_TV; i <= Constants.ADDR_SPECIFIC_USE; ++i) {
if (pickPredicate.apply(i)) {
if (pickPredicate.test(i)) {
pollingCandidates.add(i);
}
}
@@ -435,7 +435,7 @@ final class HdmiCecController {
case Constants.POLL_ITERATION_REVERSE_ORDER:
default: // The default is reverse order.
for (int i = Constants.ADDR_SPECIFIC_USE; i >= Constants.ADDR_TV; --i) {
if (pickPredicate.apply(i)) {
if (pickPredicate.test(i)) {
pollingCandidates.add(i);
}
}

View File

@@ -21,6 +21,7 @@ import java.util.Arrays;
/**
* Predicates contains static methods for creating the standard set of
* {@code Predicate} objects.
* @hide
*/
public class Predicates {