2

Samsung started using WearOS in their latest smartwatches, e.g. in Galaxy 4 watch, and I need to test bezel functionality since the latter model does have it. However I didn't find any WearOS devices in AVD supporting bezel.

I've also tried creating a new h/w profile, but didn't find a bezel option there either. All navigation options they have are below. None of them is related to bezel.

enter image description here

I've also tried to find a skin for Galaxy 4, but with no luck so far. The code that doesn't work according to a Galaxy4 owner is below. You can suggest how to fix the code of course, but I still want to know how to test it without buying a watch

    view.setOnGenericMotionListener { v, ev ->
        if (ev.action == MotionEvent.ACTION_SCROLL &&
                ev.isFromSource(InputDeviceCompat.SOURCE_ROTARY_ENCODER)
        ) {
            
            val delta = -ev.getAxisValue(MotionEventCompat.AXIS_SCROLL) *
                    ViewConfigurationCompat.getScaledVerticalScrollFactor(
                            ViewConfiguration.get(this), this
                    )

            if (Math.abs(delta) > 2f) {
                val np = if (delta > 0) Util.nextAccount(mAccount) else Util.prevAccount(mAccount)
                Util.d(TAG, mAccount + np.toString())
                switchAccount(np)

            }
            true
        } else {
            false
        }
    }

nextAccount and prevAccount are some custom functions that switch the view. None of them is called according to a user.

Here is a Tizen Studio emulator with a bezel that can be rotated by dragging the white dot:

enter image description here

Oleg Gryb
  • 5,122
  • 1
  • 28
  • 40

1 Answers1

4

I've finally fixed the problem. In a view's layout that is supposed to process the rotary event I've added requestFocus tag:

<ScrollView
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fillViewport="true"
    android:scrollbars="vertical"
    android:fadeScrollbars="false"
    android:id="@+id/token_scroll"
    >
    <requestFocus />
    ...

To test the bezel, I've used menu on the right of the emulator as shown on the picture below. Bezel events are processed correctly at least in the emulator. I'll let you know if it works in real Galaxy 4 smartwatch when hear from the user.

UPDATE A Galaxy 4 smartwatch user has just confirmed that bezel works after the fix. It confirms that both the fix and the testing method were correct and achieved their goals.

enter image description here

Oleg Gryb
  • 5,122
  • 1
  • 28
  • 40
  • By "bezel" are you referring to the crown? The bezel is the space around the screen. The crown is the dial on the side. – Ryan M Sep 23 '21 at 05:31
  • 1
    Yes, bezel is around the screen, but the described control simulates it and that's all I need to test. – Oleg Gryb Sep 23 '21 at 06:40
  • 1
    @RyanM: FYI, the Watch4 Classic has [a physical rotating bezel](https://www.samsung.com/us/watches/galaxy-watch4-classic/#design). The Watch4 non-Classic has [a strip around the screen edge that amounts to a touch-sensitive bezel](https://www.androidpolice.com/2021/09/09/samsungs-latest-galaxy-watch4-update-makes-the-non-classic-touch-bezel-a-little-more-usable/) (as bizarre as that sounds). From Oleg's description, Samsung wired up both to be equivalent to rotating a crown on other Wear OS devices. – CommonsWare Sep 23 '21 at 13:39
  • Looking at above fix, this problem is probably not specific to Galaxy Watch 4, but any Wear OS watch with recent system version. On the official [dev site about rotary input](https://developer.android.com/training/wearables/user-input/rotary-input) there is a note: `Having focus is an important prerequisite, because on Android 9 (API level 28) and higher, views don't implicitly receive focus.` So, it seems that focus behavior changed in Wear OS H MR1 version (which is based on Android 9) unless some OEMs decided to revert this change. – revanmj Nov 01 '21 at 06:22
  • Focus was a secondary issue for me. The primary one was about testing the bezel in simulator. I agree that focus related issue is common for all smartwatches – Oleg Gryb Nov 02 '21 at 14:49