Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(23)

Issue 2271413002: bluetooth: Implement RSSI indicator on android (Closed)

Created:
4 years, 3 months ago by ortuno
Modified:
3 years, 8 months ago
Reviewers:
Ted C, Ian Wen, juncai
CC:
chromium-reviews, darin-cc_chromium.org, jam, ortuno+watch_chromium.org, scheib+watch_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@bluetooth-impl-rssi-tx-power
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

bluetooth: Implement RSSI indicator on android This indicator gives an indication to users of how far their Bluetooth device is. Screenshot in: https://bugs.chromium.org/p/chromium/issues/detail?id=629689#c12 BUG=629689

Patch Set 1 #

Patch Set 2 : Fix failing CQ #

Patch Set 3 : Clean up #

Total comments: 24

Patch Set 4 : Address juncai's comments #

Patch Set 5 : Clean up #

Total comments: 6

Patch Set 6 : Address more comments #

Patch Set 7 : Use vector icons #

Patch Set 8 : Use vector graphics and all rows match the same format #

Patch Set 9 : Copyright and clean up #

Total comments: 18

Patch Set 10 : Draft of LevelListDrawable and StateListDrawable #

Total comments: 7
Unified diffs Side-by-side diffs Delta from patch set Stats (+532 lines, -98 lines) Patch
M build/android/lint/suppressions.xml View 1 2 3 4 5 6 7 8 9 1 chunk +10 lines, -0 lines 0 comments Download
A + chrome/android/java/res/drawable/ic_signal_cellular_0_bar_grey.xml View 1 2 3 4 5 6 7 8 9 1 chunk +5 lines, -5 lines 0 comments Download
A + chrome/android/java/res/drawable/ic_signal_cellular_0_bar_white.xml View 1 2 3 4 5 6 7 8 9 1 chunk +5 lines, -5 lines 0 comments Download
A + chrome/android/java/res/drawable/ic_signal_cellular_1_bar_grey.xml View 1 2 3 4 5 6 7 8 9 1 chunk +8 lines, -5 lines 0 comments Download
A + chrome/android/java/res/drawable/ic_signal_cellular_1_bar_white.xml View 1 2 3 4 5 6 7 8 9 1 chunk +8 lines, -5 lines 0 comments Download
A + chrome/android/java/res/drawable/ic_signal_cellular_2_bar_grey.xml View 1 2 3 4 5 6 7 8 9 1 chunk +8 lines, -5 lines 0 comments Download
A + chrome/android/java/res/drawable/ic_signal_cellular_2_bar_white.xml View 1 2 3 4 5 6 7 8 9 1 chunk +8 lines, -5 lines 0 comments Download
A + chrome/android/java/res/drawable/ic_signal_cellular_3_bar_grey.xml View 1 2 3 4 5 6 7 8 9 1 chunk +8 lines, -5 lines 0 comments Download
A + chrome/android/java/res/drawable/ic_signal_cellular_3_bar_white.xml View 1 2 3 4 5 6 7 8 9 1 chunk +8 lines, -5 lines 0 comments Download
A + chrome/android/java/res/drawable/ic_signal_cellular_4_bar_grey.xml View 1 2 3 4 5 6 7 8 9 1 chunk +4 lines, -5 lines 0 comments Download
A + chrome/android/java/res/drawable/ic_signal_cellular_4_bar_white.xml View 1 2 3 4 5 6 7 8 9 1 chunk +4 lines, -5 lines 0 comments Download
M chrome/android/java/res/layout/item_chooser_dialog_row.xml View 1 2 3 4 5 6 7 8 9 1 chunk +20 lines, -5 lines 0 comments Download
M chrome/android/java/src/org/chromium/chrome/browser/BluetoothChooserDialog.java View 1 2 3 4 5 6 7 8 9 5 chunks +79 lines, -3 lines 2 comments Download
M chrome/android/java/src/org/chromium/chrome/browser/ItemChooserDialog.java View 1 2 3 4 5 6 7 8 9 12 chunks +108 lines, -23 lines 5 comments Download
M chrome/android/java/src/org/chromium/chrome/browser/UsbChooserDialog.java View 1 2 3 4 5 6 7 1 chunk +1 line, -1 line 0 comments Download
M chrome/android/java/strings/android_chrome_strings.grd View 1 2 3 4 5 6 7 8 9 1 chunk +5 lines, -0 lines 0 comments Download
M chrome/android/javatests/src/org/chromium/chrome/browser/BluetoothChooserDialogTest.java View 1 2 3 4 5 6 7 2 chunks +21 lines, -2 lines 0 comments Download
M chrome/android/javatests/src/org/chromium/chrome/browser/ItemChooserDialogTest.java View 1 2 3 4 5 6 7 8 9 17 chunks +208 lines, -12 lines 0 comments Download
M chrome/browser/ui/android/bluetooth_chooser_android.cc View 1 2 3 4 5 6 7 1 chunk +2 lines, -1 line 0 comments Download
M content/browser/bluetooth/bluetooth_device_chooser_controller.h View 1 2 3 1 chunk +6 lines, -0 lines 0 comments Download
M content/browser/bluetooth/bluetooth_device_chooser_controller.cc View 1 2 3 4 5 6 5 chunks +6 lines, -1 line 0 comments Download

Depends on Patchset:

Messages

Total messages: 50 (32 generated)
ortuno
juncai: PTAL
4 years, 3 months ago (2016-08-25 22:02:00 UTC) #10
juncai
https://codereview.chromium.org/2271413002/diff/40001/chrome/android/java/res/layout/item_chooser_dialog_row_with_icon.xml File chrome/android/java/res/layout/item_chooser_dialog_row_with_icon.xml (right): https://codereview.chromium.org/2271413002/diff/40001/chrome/android/java/res/layout/item_chooser_dialog_row_with_icon.xml#newcode6 chrome/android/java/res/layout/item_chooser_dialog_row_with_icon.xml:6: <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" Since we already have an item_chooser_dialog_row.xml: https://cs.chromium.org/chromium/src/chrome/android/java/res/layout/item_chooser_dialog_row.xml ...
4 years, 3 months ago (2016-08-26 19:37:48 UTC) #15
ortuno
https://codereview.chromium.org/2271413002/diff/40001/chrome/android/java/res/layout/item_chooser_dialog_row_with_icon.xml File chrome/android/java/res/layout/item_chooser_dialog_row_with_icon.xml (right): https://codereview.chromium.org/2271413002/diff/40001/chrome/android/java/res/layout/item_chooser_dialog_row_with_icon.xml#newcode6 chrome/android/java/res/layout/item_chooser_dialog_row_with_icon.xml:6: <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" On 2016/08/26 at 19:37:48, juncai wrote: > ...
4 years, 3 months ago (2016-09-12 05:11:28 UTC) #16
juncai
https://codereview.chromium.org/2271413002/diff/40001/chrome/android/java/src/org/chromium/chrome/browser/BluetoothChooserDialog.java File chrome/android/java/src/org/chromium/chrome/browser/BluetoothChooserDialog.java (right): https://codereview.chromium.org/2271413002/diff/40001/chrome/android/java/src/org/chromium/chrome/browser/BluetoothChooserDialog.java#newcode52 chrome/android/java/src/org/chromium/chrome/browser/BluetoothChooserDialog.java:52: R.drawable.ic_signal_cellular_0_bar_black_48dp, On 2016/09/12 05:11:27, ortuno wrote: > On 2016/08/26 ...
4 years, 3 months ago (2016-09-12 20:05:49 UTC) #21
ortuno
https://codereview.chromium.org/2271413002/diff/80001/chrome/android/java/res/layout/item_chooser_dialog_row.xml File chrome/android/java/res/layout/item_chooser_dialog_row.xml (right): https://codereview.chromium.org/2271413002/diff/80001/chrome/android/java/res/layout/item_chooser_dialog_row.xml#newcode20 chrome/android/java/res/layout/item_chooser_dialog_row.xml:20: android:contentDescription="@null" On 2016/09/12 at 20:05:49, juncai wrote: > wondering ...
4 years, 3 months ago (2016-09-13 03:00:45 UTC) #22
juncai
LGTM. Thanks!
4 years, 3 months ago (2016-09-13 17:12:44 UTC) #27
ortuno
tedchoc: PTAL
4 years, 3 months ago (2016-09-13 23:09:51 UTC) #29
Ted C
Sorry for the delay, but looking at the number of assets we'd need to add ...
4 years, 3 months ago (2016-09-15 22:47:41 UTC) #31
Ian Wen
On 2016/09/15 22:47:41, Ted C wrote: > Sorry for the delay, but looking at the ...
4 years, 3 months ago (2016-09-16 21:30:06 UTC) #32
Ian Wen
On 2016/09/16 21:30:06, Ian Wen wrote: > On 2016/09/15 22:47:41, Ted C wrote: > > ...
4 years, 3 months ago (2016-09-16 23:37:23 UTC) #33
ortuno
juncai: PTAL again. I changed the Dialog so that user can specify if an icon ...
4 years, 2 months ago (2016-09-26 06:12:52 UTC) #38
Ian Wen
Thanks for using vector drawable! https://codereview.chromium.org/2271413002/diff/160001/build/android/lint/suppressions.xml File build/android/lint/suppressions.xml (right): https://codereview.chromium.org/2271413002/diff/160001/build/android/lint/suppressions.xml#newcode174 build/android/lint/suppressions.xml:174: <ignore regexp="chrome/android/java/res/drawable/ic_signal_cellular_0_bar_grey600_24dp.xml" /> Are ...
4 years, 2 months ago (2016-09-26 18:12:49 UTC) #43
juncai
https://codereview.chromium.org/2271413002/diff/160001/chrome/android/java/src/org/chromium/chrome/browser/ItemChooserDialog.java File chrome/android/java/src/org/chromium/chrome/browser/ItemChooserDialog.java (right): https://codereview.chromium.org/2271413002/diff/160001/chrome/android/java/src/org/chromium/chrome/browser/ItemChooserDialog.java#newcode68 chrome/android/java/src/org/chromium/chrome/browser/ItemChooserDialog.java:68: public static class ItemChooserRowIcon { On 2016/09/26 18:12:48, Ian ...
4 years, 2 months ago (2016-09-26 18:49:01 UTC) #44
Ian Wen
https://codereview.chromium.org/2271413002/diff/160001/chrome/android/java/src/org/chromium/chrome/browser/ItemChooserDialog.java File chrome/android/java/src/org/chromium/chrome/browser/ItemChooserDialog.java (right): https://codereview.chromium.org/2271413002/diff/160001/chrome/android/java/src/org/chromium/chrome/browser/ItemChooserDialog.java#newcode68 chrome/android/java/src/org/chromium/chrome/browser/ItemChooserDialog.java:68: public static class ItemChooserRowIcon { On 2016/09/26 18:49:01, juncai ...
4 years, 2 months ago (2016-09-26 21:39:33 UTC) #45
ortuno
I'm currently addressing the rest of the comments but I just wanted to reply before ...
4 years, 2 months ago (2016-09-26 23:34:48 UTC) #46
Ian Wen
https://codereview.chromium.org/2271413002/diff/160001/chrome/android/java/res/layout/item_chooser_dialog_row.xml File chrome/android/java/res/layout/item_chooser_dialog_row.xml (right): https://codereview.chromium.org/2271413002/diff/160001/chrome/android/java/res/layout/item_chooser_dialog_row.xml#newcode19 chrome/android/java/res/layout/item_chooser_dialog_row.xml:19: android:id="@+id/icon" 1. Instead of wrapping the image view with ...
4 years, 2 months ago (2016-09-27 04:22:42 UTC) #47
ortuno
juncai, tedchoc: WIP. Do not review. ianwen: After a week of struggling with Android UI ...
4 years, 2 months ago (2016-10-04 07:16:18 UTC) #49
Ian Wen
4 years, 2 months ago (2016-10-14 01:39:51 UTC) #50
Hello!

I wrote a small demo to show my ideas that could make code simpler. Check this
out: https://github.com/jollycopper/ListViewColorState

My main point is that since update is very frequent, we shouldn't create new
temporary object that adds GC burden to jvm. Instead we should refactor
ItemChooserDialog a bit to enable in-place update. Also this way we could get
rid of the complex equality check.

Let me know what you think and I am willing to help in every way. :)

https://codereview.chromium.org/2271413002/diff/200001/chrome/android/java/sr...
File
chrome/android/java/src/org/chromium/chrome/browser/BluetoothChooserDialog.java
(right):

https://codereview.chromium.org/2271413002/diff/200001/chrome/android/java/sr...
chrome/android/java/src/org/chromium/chrome/browser/BluetoothChooserDialog.java:122:
resources, R.drawable.ic_signal_cellular_0_bar_grey, null /* theme */));
Why not simply use mActivity.getTheme() here? Or if you don't care about theme I
would remove the comment as well.

https://codereview.chromium.org/2271413002/diff/200001/chrome/android/java/sr...
chrome/android/java/src/org/chromium/chrome/browser/BluetoothChooserDialog.java:417:
new ItemChooserDialog.ItemChooserRow(deviceId, deviceName, icon,
iconDescription),
IIRC this method will be called more than 10 times per second, right?

If so I would favor getting rid of the "new ItemChooserDialog...." statement
because that's too much GC burden to jvm. I see you already have an
ItemChooserRow object, how about we only modify it inplace, and not create new
objects?

https://codereview.chromium.org/2271413002/diff/200001/chrome/android/java/sr...
File chrome/android/java/src/org/chromium/chrome/browser/ItemChooserDialog.java
(right):

https://codereview.chromium.org/2271413002/diff/200001/chrome/android/java/sr...
chrome/android/java/src/org/chromium/chrome/browser/ItemChooserDialog.java:226:
public void addOrUpdate(ItemChooserRow item, boolean didUpdateOldDrawable) {
I see many equal checks here and above. Which leads me to thinking whether it's
even necessary to check equality. If we convert the dialog so that it gives out
the item row and let the client to update it, then the update logic will be
trivial, and we no longer need to care if anything has changed or not, because
the client will have a better idea.

Also this way we do not need to create temporary objects anymore, especially
when addOrUpdate is called very frequently.

https://codereview.chromium.org/2271413002/diff/200001/chrome/android/java/sr...
chrome/android/java/src/org/chromium/chrome/browser/ItemChooserDialog.java:356:
if (convertView instanceof RelativeLayout) {
Can the view be of a different type? If not I would simply check if convertView
is null. If so inflate it. Otherwise directly use it.

https://codereview.chromium.org/2271413002/diff/200001/chrome/android/java/sr...
chrome/android/java/src/org/chromium/chrome/browser/ItemChooserDialog.java:362:
if (mUsingIcon) {
Instead of using this boolean, shall we grab the corresponding itemrow and check
if there is icon in it?

https://codereview.chromium.org/2271413002/diff/200001/chrome/android/java/sr...
chrome/android/java/src/org/chromium/chrome/browser/ItemChooserDialog.java:373:
if (selected) {
The color manipulation could be simplified by color state list. Please refer to
the demo I sent you. :)

https://codereview.chromium.org/2271413002/diff/200001/chrome/android/java/sr...
chrome/android/java/src/org/chromium/chrome/browser/ItemChooserDialog.java:572:
addOrUpdateItem(item, false /* didUpdateOldDrawable */);
I would remove this comment.

Powered by Google App Engine
This is Rietveld 408576698