|
|
Chromium Code Reviews
Descriptionbluetooth: Update the item's description on android.
For example when a device changes names we want to show the new name.
BUG=634366
Committed: https://crrev.com/54227ff72da835d9c6f6d9a46d299fb3cdb79d7f
Cr-Commit-Position: refs/heads/master@{#413622}
Patch Set 1 #Patch Set 2 : slight optimization #
Total comments: 11
Patch Set 3 : Address juncai's comments #
Total comments: 4
Patch Set 4 : Address tedchoc's feedback #
Messages
Total messages: 27 (17 generated)
The CQ bit was checked by ortuno@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: This issue passed the CQ dry run.
ortuno@chromium.org changed reviewers: + juncai@chromium.org
juncai: PTAL
https://codereview.chromium.org/2256893003/diff/20001/chrome/android/java/src... File chrome/android/java/src/org/chromium/chrome/browser/ItemChooserDialog.java (right): https://codereview.chromium.org/2256893003/diff/20001/chrome/android/java/src... chrome/android/java/src/org/chromium/chrome/browser/ItemChooserDialog.java:166: ItemChooserRow old_item = mKeyToItemMap.get(item.mKey); s/old_item/oldItem Java local variable uses lowerCamelCase. https://codereview.chromium.org/2256893003/diff/20001/chrome/android/java/src... chrome/android/java/src/org/chromium/chrome/browser/ItemChooserDialog.java:177: notifyDataSetChanged(); Move notifyDataSetChanged(); inside the above if statement? https://codereview.chromium.org/2256893003/diff/20001/chrome/android/javatest... File chrome/android/javatests/src/org/chromium/chrome/browser/ItemChooserDialogTest.java (right): https://codereview.chromium.org/2256893003/diff/20001/chrome/android/javatest... chrome/android/javatests/src/org/chromium/chrome/browser/ItemChooserDialogTest.java:206: public void testAddOrUpdateItemAndRemoveItemFromList() throws InterruptedException { In general, I am wondering if it needs to test the button enabled/disabled state when the selected item is removed/updated? Will the "PAIR" button get disabled if a selected item is removed? If so, can do it in a separate CL. https://codereview.chromium.org/2256893003/diff/20001/chrome/android/javatest... chrome/android/javatests/src/org/chromium/chrome/browser/ItemChooserDialogTest.java:268: mChooserDialog.removeItemFromList(item1); Here it needs to pass |item1_again| instead of |item1| since its description was changed. The |mKeyToItemMap| is updated, but |mItemDescriptionMap| isn't updated correctly.
The CQ bit was checked by ortuno@chromium.org to run a CQ dry run
Thanks! https://codereview.chromium.org/2256893003/diff/20001/chrome/android/java/src... File chrome/android/java/src/org/chromium/chrome/browser/ItemChooserDialog.java (right): https://codereview.chromium.org/2256893003/diff/20001/chrome/android/java/src... chrome/android/java/src/org/chromium/chrome/browser/ItemChooserDialog.java:166: ItemChooserRow old_item = mKeyToItemMap.get(item.mKey); On 2016/08/17 at 23:55:35, juncai wrote: > s/old_item/oldItem > Java local variable uses lowerCamelCase. Done. https://codereview.chromium.org/2256893003/diff/20001/chrome/android/java/src... chrome/android/java/src/org/chromium/chrome/browser/ItemChooserDialog.java:177: notifyDataSetChanged(); On 2016/08/17 at 23:55:35, juncai wrote: > Move notifyDataSetChanged(); inside the above if statement? I was thinking that this code would eventually look like the following: if (oldItem != null) { if (oldItem.equals(item)) { return; } if (!oldItem.mDescription.equals(item.mDescription)) { // Update description. } if (!oldItem.mIsPaired.equals(item.mIsPaired)) { // Update paired. } if (!oldItem.mIcon.equals(item.mIcon)) { // Update rssi. } notifyDataSetChanged(); } That's why I just kept that call outside of the if statement. https://codereview.chromium.org/2256893003/diff/20001/chrome/android/javatest... File chrome/android/javatests/src/org/chromium/chrome/browser/ItemChooserDialogTest.java (right): https://codereview.chromium.org/2256893003/diff/20001/chrome/android/javatest... chrome/android/javatests/src/org/chromium/chrome/browser/ItemChooserDialogTest.java:206: public void testAddOrUpdateItemAndRemoveItemFromList() throws InterruptedException { On 2016/08/17 at 23:55:35, juncai wrote: > In general, I am wondering if it needs to test the button enabled/disabled state when the selected item is removed/updated? Will the "PAIR" button get disabled if a selected item is removed? > > If so, can do it in a separate CL. Opened issue http://crbug.com/639057 https://codereview.chromium.org/2256893003/diff/20001/chrome/android/javatest... chrome/android/javatests/src/org/chromium/chrome/browser/ItemChooserDialogTest.java:268: mChooserDialog.removeItemFromList(item1); On 2016/08/17 at 23:55:35, juncai wrote: > Here it needs to pass |item1_again| instead of |item1| since its description was changed. The |mKeyToItemMap| is updated, but |mItemDescriptionMap| isn't updated correctly. Actually item1.mDescription is "desc1_again" because we don't replace the previous item with the new item we just update its fields. But we wouldn't have caught a bug in which mDescription was incorrect. I've changed remove() to remove the item by using only the key and changed IsEmpty to assert that if the ArrayAdapter is empty all the other data structures are empty and vice versa.
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: This issue passed the CQ dry run.
LGTM. https://codereview.chromium.org/2256893003/diff/20001/chrome/android/java/src... File chrome/android/java/src/org/chromium/chrome/browser/ItemChooserDialog.java (right): https://codereview.chromium.org/2256893003/diff/20001/chrome/android/java/src... chrome/android/java/src/org/chromium/chrome/browser/ItemChooserDialog.java:177: notifyDataSetChanged(); On 2016/08/18 20:48:37, ortuno wrote: > On 2016/08/17 at 23:55:35, juncai wrote: > > Move notifyDataSetChanged(); inside the above if statement? > > I was thinking that this code would eventually look like the following: > > if (oldItem != null) { > if (oldItem.equals(item)) { > return; > } > if (!oldItem.mDescription.equals(item.mDescription)) { > // Update description. > } > if (!oldItem.mIsPaired.equals(item.mIsPaired)) { > // Update paired. > } > if (!oldItem.mIcon.equals(item.mIcon)) { > // Update rssi. > } > notifyDataSetChanged(); > } > > That's why I just kept that call outside of the if statement. I see. Acknowledged. https://codereview.chromium.org/2256893003/diff/20001/chrome/android/javatest... File chrome/android/javatests/src/org/chromium/chrome/browser/ItemChooserDialogTest.java (right): https://codereview.chromium.org/2256893003/diff/20001/chrome/android/javatest... chrome/android/javatests/src/org/chromium/chrome/browser/ItemChooserDialogTest.java:206: public void testAddOrUpdateItemAndRemoveItemFromList() throws InterruptedException { On 2016/08/18 20:48:37, ortuno wrote: > On 2016/08/17 at 23:55:35, juncai wrote: > > In general, I am wondering if it needs to test the button enabled/disabled > state when the selected item is removed/updated? Will the "PAIR" button get > disabled if a selected item is removed? > > > > If so, can do it in a separate CL. > > Opened issue http://crbug.com/639057 Acknowledged. https://codereview.chromium.org/2256893003/diff/20001/chrome/android/javatest... chrome/android/javatests/src/org/chromium/chrome/browser/ItemChooserDialogTest.java:268: mChooserDialog.removeItemFromList(item1); On 2016/08/18 20:48:37, ortuno wrote: > On 2016/08/17 at 23:55:35, juncai wrote: > > Here it needs to pass |item1_again| instead of |item1| since its description > was changed. The |mKeyToItemMap| is updated, but |mItemDescriptionMap| isn't > updated correctly. > > Actually item1.mDescription is "desc1_again" because we don't replace the > previous item with the new item we just update its fields. But we wouldn't have > caught a bug in which mDescription was incorrect. I've changed remove() to > remove the item by using only the key and changed IsEmpty to assert that if the > ArrayAdapter is empty all the other data structures are empty and vice versa. Acknowledged.
ortuno@chromium.org changed reviewers: + tedchoc@chromium.org
tedchoc: PTAL
lgtm https://codereview.chromium.org/2256893003/diff/40001/chrome/android/java/src... File chrome/android/java/src/org/chromium/chrome/browser/ItemChooserDialog.java (right): https://codereview.chromium.org/2256893003/diff/40001/chrome/android/java/src... chrome/android/java/src/org/chromium/chrome/browser/ItemChooserDialog.java:167: if (super.isEmpty()) { I would cache super.isEmpty() before this and return it at the end. https://codereview.chromium.org/2256893003/diff/40001/chrome/android/java/src... chrome/android/java/src/org/chromium/chrome/browser/ItemChooserDialog.java:204: return; in java, you can put the condition and statement all on a single line if it fits
The CQ bit was checked by ortuno@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: This issue passed the CQ dry run.
The CQ bit was checked by ortuno@chromium.org
Thanks! https://codereview.chromium.org/2256893003/diff/40001/chrome/android/java/src... File chrome/android/java/src/org/chromium/chrome/browser/ItemChooserDialog.java (right): https://codereview.chromium.org/2256893003/diff/40001/chrome/android/java/src... chrome/android/java/src/org/chromium/chrome/browser/ItemChooserDialog.java:167: if (super.isEmpty()) { On 2016/08/19 at 21:04:47, Ted C wrote: > I would cache super.isEmpty() before this and return it at the end. Done. https://codereview.chromium.org/2256893003/diff/40001/chrome/android/java/src... chrome/android/java/src/org/chromium/chrome/browser/ItemChooserDialog.java:204: return; On 2016/08/19 at 21:04:47, Ted C wrote: > in java, you can put the condition and statement all on a single line if it fits Done.
The patchset sent to the CQ was uploaded after l-g-t-m from tedchoc@chromium.org, juncai@chromium.org Link to the patchset: https://codereview.chromium.org/2256893003/#ps60001 (title: "Address tedchoc's feedback")
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
Message was sent while issue was closed.
Committed patchset #4 (id:60001)
Message was sent while issue was closed.
Description was changed from ========== bluetooth: Update the item's description on android. For example when a device changes names we want to show the new name. BUG=634366 ========== to ========== bluetooth: Update the item's description on android. For example when a device changes names we want to show the new name. BUG=634366 Committed: https://crrev.com/54227ff72da835d9c6f6d9a46d299fb3cdb79d7f Cr-Commit-Position: refs/heads/master@{#413622} ==========
Message was sent while issue was closed.
Patchset 4 (id:??) landed as https://crrev.com/54227ff72da835d9c6f6d9a46d299fb3cdb79d7f Cr-Commit-Position: refs/heads/master@{#413622} |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
