Remove instances of identical operands in binary expression

These are almost certainly all bugs. Removing them and enabling the
errorprone warning as an error going forward will hopefully avoid
further instances creeping in to the code base.

Bug: 217923092
Test: atest AdbDebuggingManagerTest AppTransitionControllerTest
      errorprone build
Change-Id: I51fb57024eb19f1b4c96b2033bbafdb610ef2ebb
This commit is contained in:
Michael Wright
2022-02-04 21:41:04 +00:00
parent 3cc84d0caa
commit 684f5a51b4
4 changed files with 4 additions and 4 deletions

View File

@@ -24,6 +24,7 @@ java_defaults {
"-Xep:ArrayHashCode:ERROR",
"-Xep:SelfAssignment:ERROR",
"-Xep:ArrayEquals:ERROR",
"-Xep:IdentityBinaryExpression:ERROR",
// NOTE: only enable to generate local patchfiles
// "-XepPatchChecks:refaster:frameworks/base/errorprone/refaster/EfficientXml.java.refaster",
// "-XepPatchLocation:/tmp/refaster/",

View File

@@ -249,7 +249,7 @@ public class AppTransitionController {
overrideWithRemoteAnimationIfSet(animLpActivity, transit, activityTypes);
}
final boolean voiceInteraction = containsVoiceInteraction(mDisplayContent.mOpeningApps)
final boolean voiceInteraction = containsVoiceInteraction(mDisplayContent.mClosingApps)
|| containsVoiceInteraction(mDisplayContent.mOpeningApps);
final int layoutRedo;

View File

@@ -635,7 +635,7 @@ public final class AdbDebuggingManagerTest {
long time = System.currentTimeMillis();
for (String key : testKeys) {
long connectionTime = adbKeyStore.getLastConnectionTime(key);
if (Math.abs(connectionTime - connectionTime) > epsilon) {
if (Math.abs(time - connectionTime) > epsilon) {
fail("The connection time for a previously untracked key, " + connectionTime
+ ", is beyond the current time of " + time);
}

View File

@@ -2048,8 +2048,7 @@ public abstract class BaseShortcutManagerTest extends InstrumentationTestCase {
protected List<ShortcutInfo> getShortcutAsLauncher(int targetUserId) {
final ShortcutQuery q = new ShortcutQuery();
q.setQueryFlags(ShortcutQuery.FLAG_MATCH_DYNAMIC | ShortcutQuery.FLAG_MATCH_DYNAMIC
| ShortcutQuery.FLAG_MATCH_PINNED);
q.setQueryFlags(ShortcutQuery.FLAG_MATCH_DYNAMIC | ShortcutQuery.FLAG_MATCH_PINNED);
return mLauncherApps.getShortcuts(q, UserHandle.of(targetUserId));
}