[Samsung Gear Fit] tiagobt:
Hey bronxgsi,

Could you explain what code modifications you made to get the media controls working? I have the same problem, but the APK you shared doesn't work on my HTC One M8 (doesn't connect). lollipop-gearfitmanager.apk works for me, so maybe I could patch it myself.

The error I'm having is the following:

I/SessionManager(18828): mBinderMap.get action:com.samsung.android.wms.communication.session_manager_for_interanalbinder:146687471
I/SessionManager(18828): listener.onDataReceived is called
V/DataExchangeManager(18828): SessionManagerEventListener onDataReceived
V/MediaController(18828): Data Received : Control
E/WifiTrafficPoller( 1084): packet count Tx=15353 Rx=21192
W/MediaController(18828): keyEvent - KeyEvent { action=ACTION_DOWN, keyCode=KEYCODE_MEDIA_PLAY_PAUSE, scanCode=0, metaState=0, flags=0x0, repeatCount=0, eventTime=0, downTime=0, deviceId=-1, source=0x0 }
E/AndroidRuntime(18828): FATAL EXCEPTION: main
E/AndroidRuntime(18828): Process: com.samsung.android.wms, PID: 18828
E/AndroidRuntime(18828): java.lang.NoSuchMethodError: No interface method dispatchMediaKeyEvent(Landroid/view/KeyEvent;)V in class Landroid/media/IAudioService; or its super classes (declaration of 'android.media.IAudioService' appears in /system/framework/framework.jar:classes2.dex)
E/AndroidRuntime(18828): at com.samsung.android.wms.service.MediaController.handleMediaKeyEvent(MediaController.java:334)
E/AndroidRuntime(18828): at com.samsung.android.wms.service.MediaController.triggerKeyEvent(MediaController.java:323)
E/AndroidRuntime(18828): at com.samsung.android.wms.service.MediaController.controlMediaPlayer(MediaController.java:281)
E/AndroidRuntime(18828): at com.samsung.android.wms.service.MediaController.onDataReceived(MediaController.java:228)
E/AndroidRuntime(18828): at com.samsung.android.wms.service.communication.DataExchangeManager$InternalHandler.handleMessage(DataExchangeManager.java:126)
E/AndroidRuntime(18828): at android.os.Handler.dispatchMessage(Handler.java:102)
E/AndroidRuntime(18828): at android.os.Looper.loop(Looper.java:155)
E/AndroidRuntime(18828): at android.app.ActivityThread.main(ActivityThread.java:5696)
E/AndroidRuntime(18828): at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime(18828): at java.lang.reflect.Method.invoke(Method.java:372)
E/AndroidRuntime(18828): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1028)
E/AndroidRuntime(18828): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:823)
E/ActivityManager( 1084): App crashed! Process: com.samsung.android.wms

I guess the relevant code is the following:

.method private handleMediaKeyEvent(Landroid/view/KeyEvent;)V
.registers 7
.param p1, "keyEvent" # Landroid/view/KeyEvent;

.prologue
.line 330
const-string v2, "audio"

invoke-static {v2}, Landroid/os/ServiceManager;->checkService(Ljava/lang/String;)Landroid/os/IBinder;

move-result-object v2

.line 329
invoke-static {v2}, Landroid/media/IAudioService$Stub;->asInterface(Landroid/os/IBinder;)Landroid/media/IAudioService;

move-result-object v0

.line 331
.local v0, "audioService":Landroid/media/IAudioService;
if-eqz v0, :cond_2d

.line 333
:try_start_c
sget-object v2, Lcom/samsung/android/wms/service/MediaController;->TAG:Ljava/lang/String;

new-instance v3, Ljava/lang/StringBuilder;

const-string v4, "keyEvent - "

invoke-direct {v3, v4}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

invoke-virtual {p1}, Landroid/view/KeyEvent;->toString()Ljava/lang/String;

move-result-object v4

invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

move-result-object v3

invoke-virtual {v3}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

move-result-object v3

invoke-static {v2, v3}, Lcom/samsung/android/wms/util/Logger;->w(Ljava/lang/String;Ljava/lang/String;)V

.line 334
invoke-interface {v0, p1}, Landroid/media/IAudioService;->dispatchMediaKeyEvent(Landroid/view/KeyEvent;)V
:try_end_27
.catch Landroid/os/RemoteException; {:try_start_c .. :try_end_27} :catch_28

.line 341
:goto_27
return-void

.line 335
:catch_28
move-exception v1

.line 336
.local v1, "e":Landroid/os/RemoteException;
invoke-virtual {v1}, Landroid/os/RemoteException;->printStackTrace()V

goto :goto_27

.line 339
.end local v1 # "e":Landroid/os/RemoteException;
:cond_2d
sget-object v2, Lcom/samsung/android/wms/service/MediaController;->TAG:Ljava/lang/String;

const-string v3, "audioService is null"

invoke-static {v2, v3}, Lcom/samsung/android/wms/util/Logger;->w(Ljava/lang/String;Ljava/lang/String;)V

goto :goto_27
.end method

Thanks a lot!