Thanks to visit codestin.com
Credit goes to github.com

Skip to content

WIP: road to pair my TicWatch#3204

Draft
deadYokai wants to merge 21 commits intomicrog:masterfrom
deadYokai:wearable_tos
Draft

WIP: road to pair my TicWatch#3204
deadYokai wants to merge 21 commits intomicrog:masterfrom
deadYokai:wearable_tos

Conversation

@deadYokai
Copy link
Contributor

@deadYokai deadYokai commented Dec 25, 2025

Just trying to make a pair with my watch, no more

Many parts of code is just stubs, or workarounds, needed proper implementation

After 465f5f0 requires merging PR microg/Wearable#3 and pushing to maven (not relevant after 63a77a0)

P.S. maybe needed code cleanup

Added some callbacks

Added feature list to WearableService.java

Added android:exported="true", required by android 12, for TOS only, cuz i don't know if in other needed true or false
@deadYokai deadYokai changed the title Added bare layout for wearable TOS WIP: wearable TOS Dec 26, 2025
@deadYokai deadYokai marked this pull request as draft December 27, 2025 05:30
@deadYokai
Copy link
Contributor Author

deadYokai commented Dec 28, 2025

now maybe fixes #2444 ,

at least my Mobvoi Health going to pair screen (after TOS)

but code in rough state for now

@deadYokai
Copy link
Contributor Author

now, my device is trying to pair via Mobvoi Health

@deadYokai deadYokai changed the title WIP: wearable TOS WIP: road to pair my TicWatch Dec 29, 2025
…dRequest`, `sendMessage`

prepairing ConnectionConfiguration to bluetooth stuff, to proper pair devices

filled some Parcable classes
and handshake

some bluetooth stuff
@deadYokai
Copy link
Contributor Author

deadYokai commented Dec 31, 2025

now need to implement openChannel method (wip)

for now only rfcomm client supported

ble, network, server is not implemented

still failed to pair
@ale5000-git
Copy link
Member

@deadYokai
Copy link
Contributor Author

@ale5000-git as i mentioned before

After 465f5f0 requires merging PR microg/Wearable#3 and pushing to maven

@deadYokai
Copy link
Contributor Author

or i can try to move https://github.com/microg/Wearable/ into GmsCore repo and get rid of dependence

https://mvnrepository.com/artifact/org.microg/wearable/0.1.1

@ale5000-git
Copy link
Member

Sorry I missed that point, then we have to wait for @mar-v-in for the decision of this thing.
In the meanwhile go ahead with the other parts you are working, thanks.

@mar-v-in
Copy link
Member

mar-v-in commented Jan 5, 2026

I'd suggest to entirely move the content of the microg/Wearable repo into play-services-wearable/core module in this repo and then we can archive the microg/Wearable repo entirely.

and some bluetooth changes
@deadYokai
Copy link
Contributor Author

deadYokai commented Jan 5, 2026

just sharing with good looking logs, in my opinion (logcat)

P.s. still not paired yet

image

some Bluetooth changes

moved some functions from WearableImpl to MessageHandler
- and some DataItem changes
@deadYokai
Copy link
Contributor Author

i cannot pinpoint why connection closing when channel tries to open

can anybody help me? like some logs maybe logs from watch (i cannot capture from my)?

@teccheck
Copy link

teccheck commented Feb 27, 2026

Just looked at your code quickly, and you're the first who even got the Bluetooth UUID right. Looks very promising, keep it up. 👍

I'll try to test your code, as soon as I can with my Pixel Watch.

EDIT: If you need more information about the protocol, hit me up. I'm happy to help :)

@deadYokai
Copy link
Contributor Author

deadYokai commented Feb 28, 2026

@teccheck i can change my flash of ticwatch, but developer options is locked by function checkDebuggingDisallowed() in ClockworkSettings.apk and i dont know how to resign or/and replace it without bootloop

function content

    private boolean checkDebuggingDisallowed() {
        RestrictedLockUtils.EnforcedAdmin enforcedAdmin = getEnforcedAdmin();
        if (enforcedAdmin != null) {
            RestrictedLockUtils.sendShowAdminSupportDetailsIntent(getActivity(), enforcedAdmin);
            return true;
        }
        if (!isUserBuild() || isSetupWizardCompleted()) {
            return isUserBuild() && isOemDebugRequired() && !isOemDebugEnabled();
        }
        return true;
    }

    RestrictedLockUtils.EnforcedAdmin getEnforcedAdmin() {
        return RestrictedLockUtilsInternal.checkIfRestrictionEnforced(getActivity(), "no_debugging_features", UserHandle.myUserId());
    }

    boolean isUserBuild() {
        return Build.IS_USER;
    }

    boolean isSetupWizardCompleted() {
        return Settings.System.getInt(getContext().getContentResolver(), "setup_wizard_has_run", 0) == 1;
    }

    boolean isOemDebugRequired() {
        return getContext().getResources().getBoolean(R.bool.config_requireOemDebug);
    }

    boolean isOemDebugEnabled() {
        return SystemProperties.getBoolean("ro.boot.oemdebug", false);
    }

i tried changing init.rc params, but still cannot enable adb in setup

Edit:
when I bought TicWatch, it had WearOS 3, and there I could open the developer settings and adb,
but i updated to WearOS 4 and developer settings is locked and i cant find any ota with wearos3

maybe pixelwatch has some ota with wearos3

@teccheck
Copy link

Unfortunately, my Pixel Watch 1 died, so I have a Pixel Watch 2 now. In Theory, I could unlock the bootloader and flash anything I want, but that seems a bit too risky to me. I have found a problem where the Watch App on my phone tries to open a channel, but the watch doesn't ack that. I'll see what I can do about that. Maybe that's the solution or at least one part of it...

@teccheck
Copy link

teccheck commented Mar 1, 2026

I'm relatively sure now that the disconnects have something to do with opening a channel:
grafik

The socket is always closed as soon as the channelRequest is sent. I don't think, there's anything wrong with the proto, but perhaps the values of the request are invalid somehow?

@deadYokai
Copy link
Contributor Author

managed unlock developer options by changing
ro.build.type=user -> ro.build.type=userdebug in system's build.prop

@deadYokai
Copy link
Contributor Author

what i managed to get from watch, maybe in other day will read logs in detail

03-01 15:15:47.734  2193  5560 D BluetoothSocket: Creating new Private BluetoothSocket of type: 1
03-01 15:15:47.734  2193  5560 D BluetoothSocket: acceptSocket: socket fd passed by stack fds:[java.io.FileDescriptor@634c532], mServiceName=WearableBt
03-01 15:15:47.735  2193  5560 I MigratingBTServer: setConnectable(false)
03-01 15:15:47.751  2079  2220 D AdapterProperties: Scan Mode:20
03-01 15:15:47.751  1426  1426 D WearBluetooth: *** BluetoothScanModeEnforcer-v01.3: Scan mode update Ignored by BluetoothScanModeEnforcer
03-01 15:15:47.753  2193  5560 I MigratingBTServer: Starting a connection with incoming address CE:02:46:3C:71:CC, addressMatchesNonMigratingConfig true, matched preexisting config: ConnectionConfiguration[ Name=server, Address=CE:02:46:3C:71:CC, Type=1, Role=2, Enabled=true, IsConnected=false, PeerNodeId=null, BtlePriority=true, NodeId=71d2e1a0-2694-4b4d-a8f7-1f29f139c3c5, PackageName=null, ConnectionRetryStrategy=0, allowedConfigPackages=[], Migrating=false, DataItemSyncEnabled=true, NodeConnectionRestrictions=null, removeConnectionWhenBondRemovedByUser=true, maxSupportedRemoteAndroidSdkVersion=0]
03-01 15:15:47.754  2193  5560 I MigratingBTServer: This is a main config from addr CE:02:46:3C:71:CC, config: ConnectionConfiguration[ Name=server, Address=CE:02:46:3C:71:CC, Type=1, Role=2, Enabled=true, IsConnected=false, PeerNodeId=null, BtlePriority=true, NodeId=71d2e1a0-2694-4b4d-a8f7-1f29f139c3c5, PackageName=null, ConnectionRetryStrategy=0, allowedConfigPackages=null, Migrating=false, DataItemSyncEnabled=true, NodeConnectionRestrictions=null, removeConnectionWhenBondRemovedByUser=true, maxSupportedRemoteAndroidSdkVersion=0]
03-01 15:15:47.759  2079  4452 D BtGatt.AdvertiseManager: stopAdvertisingSet() android.os.BinderProxy@e4cc9fd
03-01 15:15:47.759  2079  4452 I bt_stack: [INFO:le_advertising_manager.cc(70)] Unregister in shim layer
03-01 15:15:47.761  2193  5721 I WearBTServerConn: Connected to CE:02:46:3C:71:CC.
03-01 15:15:47.761  2193  5721 I Wear_Transport: handleConnection (enablePhoneSwitching: true) config: ConnectionConfiguration[ Name=server, Address=CE:02:46:3C:71:CC, Type=1, Role=2, Enabled=true, IsConnected=false, PeerNodeId=null, BtlePriority=true, NodeId=71d2e1a0-2694-4b4d-a8f7-1f29f139c3c5, PackageName=null, ConnectionRetryStrategy=0, allowedConfigPackages=null, Migrating=false, DataItemSyncEnabled=true, NodeConnectionRestrictions=null, removeConnectionWhenBondRemovedByUser=true, maxSupportedRemoteAndroidSdkVersion=0]
03-01 15:15:47.762  2193  5721 I Wear_Transport: Connection continuing after step: auth/encryption
03-01 15:15:47.762  2193  5721 I Wear_Transport: Performing handshake with peer
03-01 15:15:47.817  2193  5721 I Wear_Transport: ClientNodeId = 71d2e1a0-2694-4b4d-a8f7-1f29f139c3c5 connectNodeId = 71d2e1a0-2694-4b4d-a8f7-1f29f139c3c5
03-01 15:15:47.819  2193  5721 I Wear_Transport: Connection continuing after step: handshake
03-01 15:15:47.819  2193  5721 I Wear_Transport: Setting 71d2e1a0-2694-4b4d-a8f7-1f29f139c3c5 as nodeId connected to ConnectionConfiguration[ Name=server, Address=CE:02:46:3C:71:CC, Type=1, Role=2, Enabled=true, IsConnected=false, PeerNodeId=null, BtlePriority=true, NodeId=71d2e1a0-2694-4b4d-a8f7-1f29f139c3c5, PackageName=null, ConnectionRetryStrategy=0, allowedConfigPackages=null, Migrating=false, DataItemSyncEnabled=true, NodeConnectionRestrictions=null, removeConnectionWhenBondRemovedByUser=true, maxSupportedRemoteAndroidSdkVersion=0]
03-01 15:15:47.822  2193  5721 I Wear_Transport: Connecting to config
03-01 15:15:47.844  2193  5721 V datatransport: doInitialDataSync: node=15f63c96, peer=71d2e1a0-2694-4b4d-a8f7-1f29f139c3c5, sendingSyncStart=receivedSeqId=-1, syncTable={(15f63c96:208)}, version=2, restrictions=[]
03-01 15:15:47.845  2193  5721 I Wear_Transport: Connection continuing after step: connecting control plane to new node
03-01 15:15:47.849  2193  3019 I CloudSync: Disabling cloud sync.
03-01 15:15:47.852   910  2402 I [email protected]_handler: ProcessIbsCmd: Received IBS_SLEEP_IND: 0xFE
03-01 15:15:47.884   910  2402 I [email protected]_handler: ProcessIbsCmd: Received IBS_WAKE_IND: 0xFD
03-01 15:15:47.885   910  2402 I [email protected]_handler: ProcessIbsCmd: Writing IBS_WAKE_ACK
03-01 15:15:47.942   910  2402 I [email protected]_handler: ProcessIbsCmd: Received IBS_SLEEP_IND: 0xFE
03-01 15:15:47.973   910  2402 I [email protected]_handler: ProcessIbsCmd: Received IBS_WAKE_IND: 0xFD
03-01 15:15:47.974   910  2402 I [email protected]_handler: ProcessIbsCmd: Writing IBS_WAKE_ACK
03-01 15:15:48.057   910  2402 I [email protected]_handler: ProcessIbsCmd: Received IBS_SLEEP_IND: 0xFE
03-01 15:15:48.543   910  2402 I [email protected]_handler: ProcessIbsCmd: Received IBS_WAKE_IND: 0xFD
03-01 15:15:48.543   910  2402 I [email protected]_handler: ProcessIbsCmd: Writing IBS_WAKE_ACK
03-01 15:15:48.555  2193  5723 V datatransport: respondToRemoteSyncStart: node=15f63c96, peer=71d2e1a0-2694-4b4d-a8f7-1f29f139c3c5, remoteSyncStart=receivedSeqId=-1, syncTable={(71d2e1a0-2694-4b4d-a8f7-1f29f139c3c5:33)}, version=2, restrictions=[]
03-01 15:15:48.586   910  2402 I [email protected]_handler: ProcessIbsCmd: Received IBS_SLEEP_IND: 0xFE
03-01 15:15:48.586   910  2402 I [email protected]_handler: ProcessIbsCmd: Received IBS_WAKE_IND: 0xFD
03-01 15:15:48.586   910  2402 I [email protected]_handler: ProcessIbsCmd: Writing IBS_WAKE_ACK
03-01 15:15:48.627   910  2402 I [email protected]_handler: ProcessIbsCmd: Received IBS_SLEEP_IND: 0xFE
03-01 15:15:48.652  2193  5724 V datatransport: handleSyncStart(SyncStartV2-71d2e1a0-2694-4b4d-a8f7-1f29f139c3c5): node=15f63c96, peer=71d2e1a0-2694-4b4d-a8f7-1f29f139c3c5, version=2, sent=78, synced={15f63c96=208, 71d2e1a0-2694-4b4d-a8f7-1f29f139c3c5=33}, restrictions=[]
03-01 15:15:48.652  2193  5724 V datatransport: SyncStartV2-71d2e1a0-2694-4b4d-a8f7-1f29f139c3c5 Completed sending data items in 87ms
03-01 15:15:48.669   910  2402 I [email protected]_handler: ProcessIbsCmd: Received IBS_WAKE_IND: 0xFD
03-01 15:15:48.669   910  2402 I [email protected]_handler: ProcessIbsCmd: Writing IBS_WAKE_ACK
03-01 15:15:48.734   910  2402 I [email protected]_handler: ProcessIbsCmd: Received IBS_SLEEP_IND: 0xFE
03-01 15:15:48.748   910  2402 I [email protected]_handler: ProcessIbsCmd: Received IBS_WAKE_IND: 0xFD
03-01 15:15:48.748   910  2402 I [email protected]_handler: ProcessIbsCmd: Writing IBS_WAKE_ACK
03-01 15:15:48.879   910  2402 I [email protected]_handler: ProcessIbsCmd: Received IBS_SLEEP_IND: 0xFE
03-01 15:15:48.910   910  2402 I [email protected]_handler: ProcessIbsCmd: Received IBS_WAKE_IND: 0xFD
03-01 15:15:48.910   910  2402 I [email protected]_handler: ProcessIbsCmd: Writing IBS_WAKE_ACK
03-01 15:15:48.987   910  2402 I [email protected]_handler: ProcessIbsCmd: Received IBS_SLEEP_IND: 0xFE
03-01 15:15:49.008   910  2402 I [email protected]_handler: ProcessIbsCmd: Received IBS_WAKE_IND: 0xFD
03-01 15:15:49.008   910  2402 I [email protected]_handler: ProcessIbsCmd: Writing IBS_WAKE_ACK
03-01 15:15:49.074   910  2402 I [email protected]_handler: ProcessIbsCmd: Received IBS_SLEEP_IND: 0xFE
03-01 15:15:49.093   910  2402 I [email protected]_handler: ProcessIbsCmd: Received IBS_WAKE_IND: 0xFD
03-01 15:15:49.093   910  2402 I [email protected]_handler: ProcessIbsCmd: Writing IBS_WAKE_ACK
03-01 15:15:49.159   910  2402 I [email protected]_handler: ProcessIbsCmd: Received IBS_SLEEP_IND: 0xFE
03-01 15:15:49.183   910  2402 I [email protected]_handler: ProcessIbsCmd: Received IBS_WAKE_IND: 0xFD
03-01 15:15:49.183   910  2402 I [email protected]_handler: ProcessIbsCmd: Writing IBS_WAKE_ACK
03-01 15:15:49.244   910  2402 I [email protected]_handler: ProcessIbsCmd: Received IBS_SLEEP_IND: 0xFE
03-01 15:15:49.253   910  2402 I [email protected]_handler: ProcessIbsCmd: Received IBS_WAKE_IND: 0xFD
03-01 15:15:49.256   910  2402 I [email protected]_handler: ProcessIbsCmd: Writing IBS_WAKE_ACK
03-01 15:15:49.258   910  2402 I [email protected]_handler: ProcessIbsCmd: Received IBS_WAKE_IND: 0xFD
03-01 15:15:49.258   910  2402 I [email protected]_handler: ProcessIbsCmd: Writing IBS_WAKE_ACK
03-01 15:15:49.308   910  2402 I [email protected]_handler: ProcessIbsCmd: Received IBS_SLEEP_IND: 0xFE
03-01 15:15:49.357   910  2402 I [email protected]_handler: ProcessIbsCmd: Received IBS_WAKE_IND: 0xFD
03-01 15:15:49.358   910  2402 I [email protected]_handler: ProcessIbsCmd: Writing IBS_WAKE_ACK
03-01 15:15:49.452   910  2402 I [email protected]_handler: ProcessIbsCmd: Received IBS_SLEEP_IND: 0xFE
03-01 15:15:50.284   910  2403 I [email protected]_handler: DeviceSleep: TX Awake, Sending SLEEP_IND
03-01 15:15:50.284   910  2403 D [email protected]_handler: SerialClockVote: vote for UART CLK OFF
03-01 15:15:50.284   910  2403 D [email protected]_transport: ClockOperation: USERIAL_OP_CLK_OFF - after sys fs write-ret:4
03-01 15:15:50.435   910  2396 D [email protected]_lock: Release wakelock is released 
03-01 15:15:51.263  2079  2409 I bt_btm_pm: packages/modules/Bluetooth/system/stack/acl/btm_pm.cc:286 BTM_SetPowerMode: Setting power mode for peer:xx:xx:xx:xx:71:cc current_mode:immediate:active[0] new_mode:forced:sniff[2]
03-01 15:15:51.263  2079  2409 I bt_btm_pm: packages/modules/Bluetooth/system/stack/acl/btm_pm.cc:592 btm_pm_snd_md_req: Switching from immediate:active[0x00] to immediate:sniff[0x02]
03-01 15:15:51.264   910   910 D [email protected]_handler: SerialClockVote: vote for UART CLK ON
03-01 15:15:51.278   910   910 D [email protected]_transport: ClockOperation: USERIAL_OP_CLK_ON - after sys fs write-ret:4
03-01 15:15:51.278   910   910 D [email protected]_lock: Acquire wakelock is acquired 
03-01 15:15:51.278   910   910 I [email protected]_handler: DeviceWakeUp: Writing IBS_WAKE_IND
03-01 15:15:51.279   910  2402 I [email protected]_handler: ProcessIbsCmd: Received IBS_WAKE_ACK: 0xFC
03-01 15:15:51.279   910  2402 I [email protected]_handler: ProcessIbsCmd: Signal wack_cond_
03-01 15:15:51.279   910   910 D [email protected]_handler: DeviceWakeUp: Unblocked from waiting for FC, pthread_cond_timedwait ret = 0
03-01 15:15:51.281   910  2402 I [email protected]_handler: ProcessIbsCmd: Received IBS_WAKE_IND: 0xFD
03-01 15:15:51.281   910  2402 I [email protected]_handler: ProcessIbsCmd: Writing IBS_WAKE_ACK
03-01 15:15:51.282  2079  2409 I bt_btm_pm: packages/modules/Bluetooth/system/stack/acl/btm_pm.cc:706 btm_pm_proc_cmd_status: Clearing pending power mode link state:immediate:pending
03-01 15:15:51.282  2079  2409 E bluetooth: packages/modules/Bluetooth/system/bta/dm/bta_dm_pm.cc:1081 bta_dm_pm_btm_status: Received unknown power mode status event:5
03-01 15:15:51.298  2079  2386 I bluetooth: packages/modules/Bluetooth/system/gd/hci/hci_layer.cc:114 drop: Dropping event MAX_SLOTS_CHANGE
03-01 15:15:51.303  2079  2409 I bt_btm_pm: packages/modules/Bluetooth/system/stack/acl/btm_pm.cc:746 btm_pm_proc_mode_change: Power mode switched from immediate:pending[5] to immediate:sniff[2]
03-01 15:15:51.343   910  2402 I [email protected]_handler: ProcessIbsCmd: Received IBS_SLEEP_IND: 0xFE
03-01 15:15:52.283   910  2403 I [email protected]_handler: DeviceSleep: TX Awake, Sending SLEEP_IND
03-01 15:15:52.283   910  2403 D [email protected]_handler: SerialClockVote: vote for UART CLK OFF
03-01 15:15:52.284   910  2403 D [email protected]_transport: ClockOperation: USERIAL_OP_CLK_OFF - after sys fs write-ret:4
03-01 15:15:52.436   910  2396 D [email protected]_lock: Release wakelock is released 
03-01 15:15:56.003  2172  2172 D ActionBatteryChangeController: onReceive mBatteryReceiver
03-01 15:15:56.015  2172  2172 D ActionBatteryChangeController: onReceive mBatteryReceiver
03-01 15:16:02.577   910  2402 I [email protected]_handler: ProcessIbsCmd: Received IBS_WAKE_IND: 0xFD
03-01 15:16:02.577   910  2402 D [email protected]_handler: SerialClockVote: vote for UART CLK ON
03-01 15:16:02.578   910  2402 D [email protected]_transport: ClockOperation: USERIAL_OP_CLK_ON - after sys fs write-ret:4
03-01 15:16:02.578   910  2402 D [email protected]_lock: Acquire wakelock is acquired 
03-01 15:16:02.578   910  2402 I [email protected]_handler: ProcessIbsCmd: Writing IBS_WAKE_ACK
03-01 15:16:02.578   910  2402 I [email protected]_handler: ProcessIbsCmd: Received IBS_WAKE_IND: 0xFD
03-01 15:16:02.578   910  2402 I [email protected]_handler: ProcessIbsCmd: Writing IBS_WAKE_ACK
03-01 15:16:02.592  2193  5721 I Wear_Transport: Threads terminated for node 71d2e1a0-2694-4b4d-a8f7-1f29f139c3c5
03-01 15:16:02.592  2193  5721 D BluetoothSocket: close() this: XX:XX:XX:3C:71:CC, channel: 6, mSocketIS: android.net.LocalSocketImpl$SocketInputStream@bdbc88a, mSocketOS: android.net.LocalSocketImpl$SocketOutputStream@86a9efb, mSocket: android.net.LocalSocket@2f85b18 impl:android.net.LocalSocketImpl@c104971 fd:java.io.FileDescriptor@634c532, mSocketState: CONNECTED, mServiceName=WearableBt
03-01 15:16:02.592  2193  5721 D BluetoothSocket: Closing mSocket: android.net.LocalSocket@2f85b18 impl:android.net.LocalSocketImpl@c104971 fd:java.io.FileDescriptor@634c532
03-01 15:16:02.593  2193  5721 D BluetoothSocket: close() this: XX:XX:XX:3C:71:CC, channel: 6, mSocketIS: android.net.LocalSocketImpl$SocketInputStream@bdbc88a, mSocketOS: android.net.LocalSocketImpl$SocketOutputStream@86a9efb, mSocket: null, mSocketState: CLOSED, mServiceName=WearableBt

@teccheck
Copy link

teccheck commented Mar 1, 2026

Very nice! But no worries. I fixed some messages, and it seems to get a step further now:

image

EDIT: Now it seems to do a big portion of the setup process over and over. I guess some listener is not called in the companion app, so it tries again and again. Who knows, I hope, I can figure it out

@teccheck
Copy link

teccheck commented Mar 1, 2026

managed unlock developer options by changing ro.build.type=user -> ro.build.type=userdebug in system's build.prop

With that you should be able to run adb root to get full access to anything

@deadYokai
Copy link
Contributor Author

managed unlock developer options by changing ro.build.type=user -> ro.build.type=userdebug in system's build.prop

With that you should be able to run adb root to get full access to anything

adbd cannot run as root in production builds
i cannot

@deadYokai
Copy link
Contributor Author

Very nice! But no worries. I fixed some messages, and it seems to get a step further now:
image

EDIT: Now it seems to do a big portion of the setup process over and over. I guess some listener is not called in the companion app, so it tries again and again. Who knows, I hope, I can figure it out

seems like some proto errors

03-01 18:55:03.579 10430 11750 E WearableConnection: Connection error
03-01 18:55:03.579 10430 11750 E WearableConnection: java.net.ProtocolException: Expected VARINT or LENGTH_DELIMITED but was 1
03-01 18:55:03.579 10430 11750 E WearableConnection: 	at com.squareup.wire.ProtoReader.readVarint64(ProtoReader.kt:383)
03-01 18:55:03.579 10430 11750 E WearableConnection: 	at com.squareup.wire.ProtoAdapterKt$commonInt64$1.decode(ProtoAdapter.kt:1008)
03-01 18:55:03.579 10430 11750 E WearableConnection: 	at com.squareup.wire.ProtoAdapterKt$commonInt64$1.decode(ProtoAdapter.kt:988)
03-01 18:55:03.579 10430 11750 E WearableConnection: 	at org.microg.gms.wearable.proto.ChannelControlRequest$ProtoAdapter_ChannelControlRequest.decode(ChannelControlRequest.java:295)
03-01 18:55:03.579 10430 11750 E WearableConnection: 	at org.microg.gms.wearable.proto.ChannelControlRequest$ProtoAdapter_ChannelControlRequest.decode(ChannelControlRequest.java:242)
03-01 18:55:03.579 10430 11750 E WearableConnection: 	at org.microg.gms.wearable.proto.ChannelRequest$ProtoAdapter_ChannelRequest.decode(ChannelRequest.java:217)
03-01 18:55:03.579 10430 11750 E WearableConnection: 	at org.microg.gms.wearable.proto.ChannelRequest$ProtoAdapter_ChannelRequest.decode(ChannelRequest.java:174)
03-01 18:55:03.579 10430 11750 E WearableConnection: 	at org.microg.gms.wearable.proto.Request$ProtoAdapter_Request.decode(Request.java:393)
03-01 18:55:03.579 10430 11750 E WearableConnection: 	at org.microg.gms.wearable.proto.Request$ProtoAdapter_Request.decode(Request.java:321)
03-01 18:55:03.579 10430 11750 E WearableConnection: 	at org.microg.gms.wearable.proto.RootMessage$ProtoAdapter_RootMessage.decode(RootMessage.java:351)
03-01 18:55:03.579 10430 11750 E WearableConnection: 	at org.microg.gms.wearable.proto.RootMessage$ProtoAdapter_RootMessage.decode(RootMessage.java:280)
03-01 18:55:03.579 10430 11750 E WearableConnection: 	at com.squareup.wire.ProtoAdapter.decode(ProtoAdapter.kt:457)
03-01 18:55:03.579 10430 11750 E WearableConnection: 	at com.squareup.wire.ProtoAdapter.decode(ProtoAdapter.kt:456)
03-01 18:55:03.579 10430 11750 E WearableConnection: 	at org.microg.gms.wearable.WearableConnection.readMessage(WearableConnection.java:77)
03-01 18:55:03.579 10430 11750 E WearableConnection: 	at org.microg.gms.wearable.WearableConnection.run(WearableConnection.java:134)
03-01 18:55:03.579 10430 11750 E WearableConnection: 	at org.microg.gms.wearable.bluetooth.BluetoothWearableConnection.run(BluetoothWearableConnection.java:194)
03-01 18:55:03.579 10430 11750 E WearableConnection: 	at org.microg.gms.wearable.bluetooth.BluetoothConnectionThread.connect(BluetoothConnectionThread.java:216)
03-01 18:55:03.579 10430 11750 E WearableConnection: 	at org.microg.gms.wearable.bluetooth.BluetoothConnectionThread.run(BluetoothConnectionThread.java:143)

@teccheck
Copy link

teccheck commented Mar 1, 2026

seems like some proto errors

03-01 18:55:03.579 10430 11750 E WearableConnection: Connection error
03-01 18:55:03.579 10430 11750 E WearableConnection: java.net.ProtocolException: Expected VARINT or LENGTH_DELIMITED but was 1
03-01 18:55:03.579 10430 11750 E WearableConnection: 	at com.squareup.wire.ProtoReader.readVarint64(ProtoReader.kt:383)
03-01 18:55:03.579 10430 11750 E WearableConnection: 	at com.squareup.wire.ProtoAdapterKt$commonInt64$1.decode(ProtoAdapter.kt:1008)
03-01 18:55:03.579 10430 11750 E WearableConnection: 	at com.squareup.wire.ProtoAdapterKt$commonInt64$1.decode(ProtoAdapter.kt:988)
03-01 18:55:03.579 10430 11750 E WearableConnection: 	at org.microg.gms.wearable.proto.ChannelControlRequest$ProtoAdapter_ChannelControlRequest.decode(ChannelControlRequest.java:295)
03-01 18:55:03.579 10430 11750 E WearableConnection: 	at org.microg.gms.wearable.proto.ChannelControlRequest$ProtoAdapter_ChannelControlRequest.decode(ChannelControlRequest.java:242)
03-01 18:55:03.579 10430 11750 E WearableConnection: 	at org.microg.gms.wearable.proto.ChannelRequest$ProtoAdapter_ChannelRequest.decode(ChannelRequest.java:217)
03-01 18:55:03.579 10430 11750 E WearableConnection: 	at org.microg.gms.wearable.proto.ChannelRequest$ProtoAdapter_ChannelRequest.decode(ChannelRequest.java:174)
03-01 18:55:03.579 10430 11750 E WearableConnection: 	at org.microg.gms.wearable.proto.Request$ProtoAdapter_Request.decode(Request.java:393)
03-01 18:55:03.579 10430 11750 E WearableConnection: 	at org.microg.gms.wearable.proto.Request$ProtoAdapter_Request.decode(Request.java:321)
03-01 18:55:03.579 10430 11750 E WearableConnection: 	at org.microg.gms.wearable.proto.RootMessage$ProtoAdapter_RootMessage.decode(RootMessage.java:351)
03-01 18:55:03.579 10430 11750 E WearableConnection: 	at org.microg.gms.wearable.proto.RootMessage$ProtoAdapter_RootMessage.decode(RootMessage.java:280)
03-01 18:55:03.579 10430 11750 E WearableConnection: 	at com.squareup.wire.ProtoAdapter.decode(ProtoAdapter.kt:457)
03-01 18:55:03.579 10430 11750 E WearableConnection: 	at com.squareup.wire.ProtoAdapter.decode(ProtoAdapter.kt:456)
03-01 18:55:03.579 10430 11750 E WearableConnection: 	at org.microg.gms.wearable.WearableConnection.readMessage(WearableConnection.java:77)
03-01 18:55:03.579 10430 11750 E WearableConnection: 	at org.microg.gms.wearable.WearableConnection.run(WearableConnection.java:134)
03-01 18:55:03.579 10430 11750 E WearableConnection: 	at org.microg.gms.wearable.bluetooth.BluetoothWearableConnection.run(BluetoothWearableConnection.java:194)
03-01 18:55:03.579 10430 11750 E WearableConnection: 	at org.microg.gms.wearable.bluetooth.BluetoothConnectionThread.connect(BluetoothConnectionThread.java:216)
03-01 18:55:03.579 10430 11750 E WearableConnection: 	at org.microg.gms.wearable.bluetooth.BluetoothConnectionThread.run(BluetoothConnectionThread.java:143)

That should be fixed. Did you recompile the protos? (I mean it should happen automatically). The problem was that channelId is sfixed64

@deadYokai
Copy link
Contributor Author

seems like some proto errors

03-01 18:55:03.579 10430 11750 E WearableConnection: Connection error
03-01 18:55:03.579 10430 11750 E WearableConnection: java.net.ProtocolException: Expected VARINT or LENGTH_DELIMITED but was 1
03-01 18:55:03.579 10430 11750 E WearableConnection: 	at com.squareup.wire.ProtoReader.readVarint64(ProtoReader.kt:383)
03-01 18:55:03.579 10430 11750 E WearableConnection: 	at com.squareup.wire.ProtoAdapterKt$commonInt64$1.decode(ProtoAdapter.kt:1008)
03-01 18:55:03.579 10430 11750 E WearableConnection: 	at com.squareup.wire.ProtoAdapterKt$commonInt64$1.decode(ProtoAdapter.kt:988)
03-01 18:55:03.579 10430 11750 E WearableConnection: 	at org.microg.gms.wearable.proto.ChannelControlRequest$ProtoAdapter_ChannelControlRequest.decode(ChannelControlRequest.java:295)
03-01 18:55:03.579 10430 11750 E WearableConnection: 	at org.microg.gms.wearable.proto.ChannelControlRequest$ProtoAdapter_ChannelControlRequest.decode(ChannelControlRequest.java:242)
03-01 18:55:03.579 10430 11750 E WearableConnection: 	at org.microg.gms.wearable.proto.ChannelRequest$ProtoAdapter_ChannelRequest.decode(ChannelRequest.java:217)
03-01 18:55:03.579 10430 11750 E WearableConnection: 	at org.microg.gms.wearable.proto.ChannelRequest$ProtoAdapter_ChannelRequest.decode(ChannelRequest.java:174)
03-01 18:55:03.579 10430 11750 E WearableConnection: 	at org.microg.gms.wearable.proto.Request$ProtoAdapter_Request.decode(Request.java:393)
03-01 18:55:03.579 10430 11750 E WearableConnection: 	at org.microg.gms.wearable.proto.Request$ProtoAdapter_Request.decode(Request.java:321)
03-01 18:55:03.579 10430 11750 E WearableConnection: 	at org.microg.gms.wearable.proto.RootMessage$ProtoAdapter_RootMessage.decode(RootMessage.java:351)
03-01 18:55:03.579 10430 11750 E WearableConnection: 	at org.microg.gms.wearable.proto.RootMessage$ProtoAdapter_RootMessage.decode(RootMessage.java:280)
03-01 18:55:03.579 10430 11750 E WearableConnection: 	at com.squareup.wire.ProtoAdapter.decode(ProtoAdapter.kt:457)
03-01 18:55:03.579 10430 11750 E WearableConnection: 	at com.squareup.wire.ProtoAdapter.decode(ProtoAdapter.kt:456)
03-01 18:55:03.579 10430 11750 E WearableConnection: 	at org.microg.gms.wearable.WearableConnection.readMessage(WearableConnection.java:77)
03-01 18:55:03.579 10430 11750 E WearableConnection: 	at org.microg.gms.wearable.WearableConnection.run(WearableConnection.java:134)
03-01 18:55:03.579 10430 11750 E WearableConnection: 	at org.microg.gms.wearable.bluetooth.BluetoothWearableConnection.run(BluetoothWearableConnection.java:194)
03-01 18:55:03.579 10430 11750 E WearableConnection: 	at org.microg.gms.wearable.bluetooth.BluetoothConnectionThread.connect(BluetoothConnectionThread.java:216)
03-01 18:55:03.579 10430 11750 E WearableConnection: 	at org.microg.gms.wearable.bluetooth.BluetoothConnectionThread.run(BluetoothConnectionThread.java:143)

That should be fixed. Did you recompile the protos? (I mean it should happen automatically). The problem was that channelId is sfixed64

oh, i tested still with int64, but in commit i set to sfixed64

@deadYokai
Copy link
Contributor Author

deadYokai commented Mar 1, 2026

@teccheck i think problem is missing implementation of NodeMigration, but i'm not sure

@teccheck
Copy link

teccheck commented Mar 1, 2026

@teccheck i think problem is missing implementation of NodeMigration, but i'm not sure

Hm, I don't know…

One other thing: Could you add my commits directly to your branch instead of a squashed commit? That would keep things clean and my involvement visible. That would be awesome :)

EDIT: Two things for context:

  1. There's a bounty on WearOS support, which is why I'd like my work to be visible. That should be interesting to you as well, as you did a lot, so I'd say you deserve to have it
  2. More importantly, I'd like to be able to pull your commits into my branch and keep working atop them, which is much easier if the history is preserved

Comment on lines +473 to +524
private RootMessage buildRootMessage(ChannelStateMachine ch, ChannelControlRequest ctrl) {
ChannelRequest cr = new ChannelRequest.Builder()
.channelControlRequest(ctrl)
.version(0)
.origin(0)
.build();

Request req = new Request.Builder()
.requestId(requestIdCounter.getAndIncrement())
.targetNodeId(ch.token.nodeId)
.sourceNodeId(localNodeId)
.packageName(ch.token.appKey.packageName)
.signatureDigest(ch.token.appKey.signatureDigest)
.path(ch.channelPath)
.request(cr)
.unknown5(0)
.generation(generationCounter.get())
.build();

return new RootMessage.Builder().channelRequest(req).build();
}

private RootMessage buildDataRootMessage(ChannelStateMachine ch, ChannelDataRequest dataReq) {
ChannelRequest cr = new ChannelRequest.Builder()
.channelDataRequest(dataReq).version(1).origin(0).build();
Request req = new Request.Builder()
.requestId(requestIdCounter.getAndIncrement())
.targetNodeId(ch.token.nodeId)
.sourceNodeId(localNodeId)
.packageName(ch.token.appKey.packageName)
.signatureDigest(ch.token.appKey.signatureDigest)
.request(cr)
.generation(generationCounter.get())
.build();
return new RootMessage.Builder().channelRequest(req).build();
}

private RootMessage buildAckRootMessage(ChannelStateMachine ch, ChannelDataAckRequest ack) {
ChannelRequest cr = new ChannelRequest.Builder()
.channelDataAckRequest(ack).version(1).origin(0).build();
Request req = new Request.Builder()
.requestId(requestIdCounter.getAndIncrement())
.targetNodeId(ch.token.nodeId)
.sourceNodeId(localNodeId)
.packageName(ch.token.appKey.packageName)
.signatureDigest(ch.token.appKey.signatureDigest)
.request(cr)
.generation(generationCounter.get())
.build();
return new RootMessage.Builder().channelRequest(req).build();
}

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I specifically merged all of those builders into one single method to avoid having redundant code. You could make this into

  • buildRootMessage, just for the root message
  • buildAckMessage, uses buildRootMessage and builds the ack
  • buildDataMessage, same as ack for data
  • buildControlMessage, sames as ack for control

I think that would be a better option

@deadYokai
Copy link
Contributor Author

@teccheck check if okay, because i dont know git much

@deadYokai
Copy link
Contributor Author

deadYokai commented Mar 2, 2026

discovered some proto differences
for example, reversed from GMS

message RootMessage {
    optional int32 version = 1;
    optional SetAsset setAsset = 4;
    optional AckAsset ackAsset = 5;
    optional FetchAsset fetchAsset = 6;
    optional Connect connect = 7;
    optional SyncStart syncStart = 8;
    optional SetDataItem setDataItem = 9;
    optional Request rpcRequest = 10;
    optional Heartbeat heartbeat = 11;
    optional FilePiece filePiece = 12;
    optional bool hasAsset = 13;
    optional Request channelRequest = 16;
    optional EncryptionHandshake encryption_handshake = 17;
    optional Request rpcWithResponseId = 18;
    // IosMultiAppAuth - 19
    optional ControlMessage control_message = 20;
}

message Request {
    optional int32 requestId = 1;
    optional string packageName = 2;
    optional string signatureDigest = 3;
    optional string targetNodeId = 4;
    optional int32 unknown5 = 5; // always has to be 0, same in gms
    optional string path = 6;
    optional bytes rawData = 7;
    optional string sourceNodeId = 8;
    optional ChannelRequest request = 9;
    optional int32 generation = 10;
    optional bool requiresResponse = 11;
    optional int32 senderRequestId = 12;
    optional int32 priority = 13; // 0 - Low, 1 - Default, 2 - High
}

message Connect {
    optional string id = 1;
    optional string name = 2;
    optional int64 peerAndroidId = 3;
    optional int32 peerVersion = 4;
    optional int32 peerMinimumVersion = 5;
    optional int32 capabilities = 6;
    optional string networkId = 7;
    optional string packageName = 8;
    optional bool migrating = 9;
    optional string migratingFromNodeId = 10;
    optional int32 androidSdkVersion = 11;
}

message ChannelOpenRequest {
    optional int32 type = 1;
    optional sfixed64 channelId = 2;
    optional bool isEncrypted = 3;
    optional string sourceNodeId = 4;
    optional string targetNodeId = 5;
    optional string path = 6;
    optional int32 flags = 7;
    optional bool isReliable = 8;
    optional bytes payload = 9;
}

message ChannelTransferInfo {
    optional int64 offset = 1;
    optional bool  is_last_chunk = 2;
    optional int64 total_size = 3;
}

message ChannelTransferRequest {
    optional ChannelTransferInfo transfer_info = 1;
    optional bytes payload = 2;
    optional bool isFinal = 3;
}

message ChannelCloseRequest {
    optional ChannelTransferInfo transfer_info = 1;
    optional bool isCancelled = 2;
}


message ChannelRequest {
    optional ChannelTransferRequest channelControlRequest = 2;
    optional ChannelOpenRequest channelDataRequest = 3;
    optional ChannelCloseRequest channelDataAckRequest = 4;
    optional int32 status_code = 6;
    optional int32 error_code = 7;
}

@teccheck
Copy link

teccheck commented Mar 2, 2026

@teccheck check if okay, because i dont know git much

First, thanks for making the effort! Though it's not completely clean, I'd say that should do.

However, there's an easier solution to this:

You can add my repo as a remote using git remote add teccheck https://github.com/teccheck/GmsCore.git. I chose teccheck as a name, but you can use whatever you like. (I guess you did that already)

Now every time you want to incorporate my changes, you can do git pull teccheck weareable --rebase. Again teccheck is the remote name, change it to what you picked. If you do this, all commits that I don't have in my branch but are in yours, will be put after the commits I have in my branch that you don't. That also has the benefit of my commit signature staying intact.

If you have already pushed some commits to GitHub, you might need to do a force push. You can use git push --force-with-lease so you don't accidentally overwrite some else's changes (will probably not happen as it's your branch, but better safe than sorry).

In general, git rebase can help you reorder your commits which allows you to clean up your history.

@teccheck
Copy link

teccheck commented Mar 2, 2026

discovered some proto differences for example, reversed from GMS

Nice!

@teccheck
Copy link

teccheck commented Mar 2, 2026

I've made a clean version of the history in my branch. If you want, you can use that. If you want, you can even resign your last two commits (the code update commit is just your code update + fixes by @teccheck but without my edits)

@deadYokai
Copy link
Contributor Author

I've made a clean version of the history in my branch. If you want, you can use that. If you want, you can even resign your last two commits (the code update commit is just your code update + fixes by @teccheck but without my edits)

hopefully i made it correct

@teccheck
Copy link

teccheck commented Mar 2, 2026

Yes, almost. I think the last two commits are not needed. The revert commit is definitely not needed, as the commit it reverts does not exist in the history anymore.

I'm not sure what Clean history does. Did you make any changes after node migration update?

If not, try git reset HEAD~2 --hard. This removes the last two commits from the history completely and resets your working directory to node migration update. This will require a force push

Also, I'm sorry for causing all this trouble. I hope this is ok for you…

@deadYokai
Copy link
Contributor Author

deadYokai commented Mar 2, 2026

Yes, almost. I think the last two commits are not needed. The revert commit is definitely not needed, as the commit it reverts does not exist in the history anymore.

I'm not sure what Clean history does. Did you make any changes after node migration update?

If not, try git reset HEAD~2 --hard. This removes the last two commits from the history completely and resets your working directory to node migration update. This will require a force push

Also, I'm sorry for causing all this trouble. I hope this is ok for you…

its ok, i just not good at git

Edit: maybe i need take courses on git

@teccheck
Copy link

teccheck commented Mar 2, 2026

its ok, i just not good at git

That is totally fine. Thanks a bunch for doing the work anyway! Also, if you need help, I'm glad to help. I only learned a lot of my git skills because a friend showed me recently :)

@deadYokai
Copy link
Contributor Author

@teccheck check if this makes sense

https://pastebin.com/KKDJtd4y

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants