New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 773043 link

Starred by 4 users

Issue metadata

Status: Assigned
Owner:
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Android
Pri: 3
Type: Bug

Blocking:
issue 773009



Sign in to add a comment

BluetoothChooserDialogTest#testSelectItem failing

Project Member Reported by gsennton@chromium.org, Oct 9 2017

Issue description

Link to one of the failing runs:
https://build.chromium.org/p/chromium.android.fyi/builders/Nougat%20Phone%20Tester/builds/3953

Link to failure output:
https://luci-logdog.appspot.com/v/?s=chromium%2Fbb%2Fchromium.android.fyi%2FNougat_Phone_Tester%2F3953%2F%2B%2Frecipes%2Fsteps%2Fchrome_public_test_apk_on_Android%2F0%2Flogs%2Forg.chromium.chrome.browser.BluetoothChooserDialogTest_testSelectItem%2F0


Failure output:

java.lang.AssertionError
	at org.junit.Assert.fail(Assert.java:86)
	at org.junit.Assert.assertTrue(Assert.java:41)
	at org.junit.Assert.assertTrue(Assert.java:52)
	at org.chromium.chrome.browser.BluetoothChooserDialogTest.testSelectItem(BluetoothChooserDialogTest.java:253)
	at java.lang.reflect.Method.invoke(Native Method)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:52)
	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
	at org.chromium.base.test.ScreenshotOnFailureStatement.evaluate(ScreenshotOnFailureStatement.java:37)
	at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
	at org.chromium.chrome.test.ChromeActivityTestRule$1.evaluate(ChromeActivityTestRule.java:65)
	at android.support.test.internal.statement.UiThreadStatement.evaluate(UiThreadStatement.java:55)
	at android.support.test.rule.ActivityTestRule$ActivityStatement.evaluate(ActivityTestRule.java:270)
	at org.junit.rules.RunRules.evaluate(RunRules.java:20)
	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
	at org.chromium.base.test.BaseJUnit4ClassRunner.runChild(BaseJUnit4ClassRunner.java:184)
	at org.chromium.base.test.BaseJUnit4ClassRunner.runChild(BaseJUnit4ClassRunner.java:41)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
	at org.chromium.base.test.BaseJUnit4ClassRunner.run(BaseJUnit4ClassRunner.java:166)
	at org.junit.runners.Suite.runChild(Suite.java:128)
	at org.junit.runners.Suite.runChild(Suite.java:27)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
	at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
	at org.junit.runner.JUnitCore.run(JUnitCore.java:115)
	at android.support.test.internal.runner.TestExecutor.execute(TestExecutor.java:59)
	at android.support.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:262)
	at org.chromium.base.test.BaseChromiumAndroidJUnitRunner.onStart(BaseChromiumAndroidJUnitRunner.java:100)
	at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1932)
 
Status: Available (was: Unconfirmed)
Cc: jyasskin@chromium.org ortuno@chromium.org yolandyan@chromium.org
Components: Blink>Bluetooth
After adding some logging it looks like the state that is mismatching is icon.getConstantState:

10-09 21:19:22.990  5364  5380 E ItemChooserRow: icon.getConstantState doesn't match android.support.graphics.drawable.VectorDrawableCompat$VectorDrawableDelegateState@54c15a8 android.support.graphics.drawable.VectorDrawableCompat$VectorDrawableDelegateState@7ee98c1

my guess is that this is caused by the following code, which changes behaviour for API level 24 (Nougat):

https://cs.corp.google.com/android/frameworks/support/graphics/drawable/static/src/main/java/android/support/graphics/drawable/VectorDrawableCompat.java?l=268&rcl=cbe8b1ac8098092913b67efe64f5e78f0b13023c

i.e. VectorDrawableCompat.java:

@Override
public ConstantState getConstantState() {
    if (mDelegateDrawable != null && Build.VERSION.SDK_INT >= 24) {
        // Such that the configuration can be refreshed.
        return new VectorDrawableDelegateState(mDelegateDrawable.getConstantState());
    }
    mVectorState.mChangingConfigurations = getChangingConfigurations();
    return mVectorState;
}

It seems kinda weird to be comparing a pair of object using object.equals when that method is not implemented for the class of objects you are comparing (that will just result in comparing the addresses of the objects).
Comparing the addresses of the objects is what we want. We want to make sure they are the same object.
Right, but that won't work on Nougat and above because of the implementation of getConstantState() as shown in comment #4. So ItemChooserRow.hasSameContents(..) is just wrong on N and above (at least whenever you use VectorDrawableCompat as your Drawable icon).
Blocking: 784331
Android sheriff Ping. Any updates here?
Not that I know of, maybe we could add a method ItemChooserDialog$ItemChooserRow.hasSameContentsForTesting that is the same as hasSameContents except it would avoid checking mIcon.getConstantState() on API level 24 and above. ortuno@ WDYT?
Cc: estevenson@chromium.org
Owner: ortuno@chromium.org
Assigning to ortuno@ to respond when they're back in office.
Labels: Type-Bug
Checking for getConstantState() was the only way to be sure that the implementation was correct i.e. that the icon being shown was the correct icon. I think removing that check would make it really easy to change the chooser behavior and not notice.

Is there no way to make sure two images are the same in 24?

Comment 14 by donnd@chromium.org, Feb 20 2018

This test is consistently failing on Oreo, maybe we can disable it for that platform until the underlying problem can be identified.
https://test-results.appspot.com/dashboards/flakiness_dashboard.html#testType=chrome_public_test_apk&tests=BluetoothChooserDialogTest%23testSelectItem

Comment 15 by donnd@chromium.org, Feb 20 2018

Mailed this CL to disable on Oreo: https://chromium-review.googlesource.com/c/chromium/src/+/927685
Owner: reillyg@chromium.org
Status: Assigned (was: Available)
Thanks for the patch.

re the problem: I think this affects more than just the test. We update the chooser items based on ItemChooserDialog$ItemChooserRow.hasSameContents. If that function is always returning false (because of the Oreo change), then we are updating every item for every new update (100s per second in a busy environment). This is probably making the chooser unusable in busy environments.

So even if we introduced hasSameContentForTesting the implementation would still be broken.

I no longer work on the project so assigning to reillyg for triage.
Project Member

Comment 17 by bugdroid1@chromium.org, Feb 22 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/1e5e511ceb3adf6fea402c6219be3854fec371b2

commit 1e5e511ceb3adf6fea402c6219be3854fec371b2
Author: Donn Denman <donnd@google.com>
Date: Thu Feb 22 01:43:18 2018

Disable BlueToothChooserDialogTest.testSelectItem

Disable this test on Android-Oreo since it is consistently
failing on that platform.

BUG=773043

Change-Id: Ifccc9b6ef76d13b312fecb3956eb4198e7d11ce5
Reviewed-on: https://chromium-review.googlesource.com/927685
Reviewed-by: Maria Khomenko <mariakhomenko@chromium.org>
Reviewed-by: Giovanni Ortuño Urquidi <ortuno@chromium.org>
Commit-Queue: Donn Denman <donnd@chromium.org>
Cr-Commit-Position: refs/heads/master@{#538303}
[modify] https://crrev.com/1e5e511ceb3adf6fea402c6219be3854fec371b2/chrome/android/java/src/org/chromium/chrome/browser/ItemChooserDialog.java

Blocking: -784331

Sign in to add a comment