Update 12.10.2017
In our Viper10 Thread we had multiple reports, that the Samsung Gear app force closes when trying to connect their device.
Seemed not just the HTC10 is affected though. From my google research I found also some logcats from other roms and devices posted with the same issue.
@Toni10 linked me to that thread today, opened by @kajos in the Samsung Gear S3 Forum..so it seems it's really a general issue.
Okay, so what is the issue:
Bad coding, or intended, no idea.
A framework class com.samsung.android.feature.FloatingFeature is not found on none samsung devices.
I took the effort to decompile the sams h i t app and digged in the code and backtraced the issue.
The source of the bug (or intended behavior) is the samsung device detection:
It also returns true even on none samsung devices.
Not sure why that fails. it checks if it can get android.permission.INSTALL_PACKAGES...that perm can be just granted to apps in /system.
So moving the app to /system should work too, to fix the issue for rooted users...still it should return falls and not true on none samsung devices that dont't have it on /system
The result of it is that causes the app to crash in LoggerUtil$Builder:
that tries to access an method in a class just available on a samsung device and its framework:
It's the only location where a call requires the samsung framework.
So how to fix it:
We just modify the device detection method to return always false:
...recompile, resign and it's done.
So far I got 4 reports that it indeed works...so it should also for others.
Since I had to resign the app, ensure you uninstall the original one before installing the fixed version.
When an update in playstore drops for the gear app, and it still force closes, uninstall it and install my fixed version again.
Since I won't monitor that thread...someone should shoot me a PM, so I can merge my fix to the new version from playstore.
Downloads:
Samsung Gear Apps
UPDATE
There is a new Gear S Plugin update available in PlayStore. They fixed the crashes, everything is working now.
Looks like even the modded gear app is not needed anymore. But I will check this later.
Sent from my HTC 10 using XDA Labs
Can confirm, updated to the latest Gear S Plugin and latest unmodded Gear App and everything is working properly on my HTC 10.
Gear App 2.2.17022862
Gear S Plugin 2.2.03.17101142N
In our Viper10 Thread we had multiple reports, that the Samsung Gear app force closes when trying to connect their device.
Seemed not just the HTC10 is affected though. From my google research I found also some logcats from other roms and devices posted with the same issue.
@Toni10 linked me to that thread today, opened by @kajos in the Samsung Gear S3 Forum..so it seems it's really a general issue.
Okay, so what is the issue:
Code:
-27 21:10:15.357 E/AndroidRuntime(6044): FATAL EXCEPTION: main
11-27 21:10:15.357 E/AndroidRuntime(6044): Process: com.samsung.android.app.watchmanager, PID: 6044
11-27 21:10:15.357 E/AndroidRuntime(6044): java.lang.NoClassDefFoundError: Failed resolution of: Lcom/samsung/android/feature/FloatingFeature;
11-27 21:10:15.357 E/AndroidRuntime(6044): at com.samsung.android.app.watchmanager.sdllibrary.FloatingFeature.getEnableStatus(FloatingFeature.java:11)
11-27 21:10:15.357 E/AndroidRuntime(6044): at com.samsung.android.app.twatchmanager.log.LoggerUtil$Builder.<clinit>(LoggerUtil.java:95)
11-27 21:10:15.357 E/AndroidRuntime(6044): at com.samsung.android.app.twatchmanager.util.HostManagerUtils.startPluginActivity(HostManagerUtils.java:551)
11-27 21:10:15.357 E/AndroidRuntime(6044): at com.samsung.android.app.watchmanager.setupwizard.HMConnectFragment.callPluginActivity(HMConnectFragment.java:377)
11-27 21:10:15.357 E/AndroidRuntime(6044): at com.samsung.android.app.watchmanager.setupwizard.HMConnectFragment.callPluginActivityWithDelay(HMConnectFragment.java:365)
11-27 21:10:15.357 E/AndroidRuntime(6044): at com.samsung.android.app.watchmanager.setupwizard.HMConnectFragment.access$200(HMConnectFragment.java:67)
11-27 21:10:15.357 E/AndroidRuntime(6044): at com.samsung.android.app.watchmanager.setupwizard.HMConnectFragment$1.handleMessage(HMConnectFragment.java:315)
11-27 21:10:15.357 E/AndroidRuntime(6044): at android.os.Handler.dispatchMessage(Handler.java)
11-27 21:10:15.357 E/AndroidRuntime(6044): at android.os.Looper.loop(Looper.java)
11-27 21:10:15.357 E/AndroidRuntime(6044): at android.app.ActivityThread.main(ActivityThread.java)
11-27 21:10:15.357 E/AndroidRuntime(6044): at java.lang.reflect.Method.invoke(Native Method)
11-27 21:10:15.357 E/AndroidRuntime(6044): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java)
11-27 21:10:15.357 E/AndroidRuntime(6044): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java)
11-27 21:10:15.357 E/AndroidRuntime(6044): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.samsung.android.feature.FloatingFeature" on path: DexPathList[[zip file "/data/app/com.samsung.android.app.watchmanager-1/base.apk"],nativeLibraryDirectories=[/data/app/com.samsung.android.app.watchmanager-1/lib/arm64, /system/fake-libs64, /data/app/com.samsung.android.app.watchmanager-1/base.apk!/lib/arm64-v8a, /system/lib64, /vendor/lib64]]
11-27 21:10:15.357 E/AndroidRuntime(6044): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
11-27 21:10:15.357 E/AndroidRuntime(6044): at java.lang.ClassLoader.loadClass(ClassLoader.java:380)
11-27 21:10:15.357 E/AndroidRuntime(6044): at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
11-27 21:10:15.357 E/AndroidRuntime(6044): ... 13 more
Bad coding, or intended, no idea.
A framework class com.samsung.android.feature.FloatingFeature is not found on none samsung devices.
I took the effort to decompile the sams h i t app and digged in the code and backtraced the issue.
The source of the bug (or intended behavior) is the samsung device detection:
Code:
.method public static isSamsungDevice()Z
.locals 1
invoke-static {}, Lcom/samsung/android/app/twatchmanager/TWatchManagerApplication;->getAppContext()Landroid/content/Context;
move-result-object v0
invoke-static {v0}, Lcom/samsung/android/app/twatchmanager/util/InstallationUtils;->hasInstallPermission(Landroid/content/Context;)Z
move-result v0
return v0
.end method
It also returns true even on none samsung devices.
Not sure why that fails. it checks if it can get android.permission.INSTALL_PACKAGES...that perm can be just granted to apps in /system.
So moving the app to /system should work too, to fix the issue for rooted users...still it should return falls and not true on none samsung devices that dont't have it on /system
The result of it is that causes the app to crash in LoggerUtil$Builder:
Code:
.method static constructor <clinit>()V
.locals 2
invoke-static {}, Lcom/samsung/android/app/twatchmanager/util/HostManagerUtils;->isSamsungDevice()Z
move-result v0
if-eqz v0, :cond_0
invoke-static {}, Lcom/samsung/android/app/twatchmanager/util/FloatingFeatureFactory;->get()Lcom/samsung/android/app/watchmanager/libinterface/FloatingFeatureInterface;
move-result-object v0
const-string v1, "SEC_FLOATING_FEATURE_CONTEXTSERVICE_ENABLE_SURVEY_MODE"
[COLOR="red"]invoke-interface {v0, v1}, Lcom/samsung/android/app/watchmanager/libinterface/FloatingFeatureInterface;->getEnableStatus(Ljava/lang/String;)Z[/COLOR]
move-result v0
if-eqz v0, :cond_0
const/4 v0, 0x1
:goto_0
sput-boolean v0, Lcom/samsung/android/app/twatchmanager/log/LoggerUtil$Builder;->SUPPORT_LOGGING:Z
return-void
:cond_0
const/4 v0, 0x0
goto :goto_0
.end method
that tries to access an method in a class just available on a samsung device and its framework:
Code:
.method public getEnableStatus(Ljava/lang/String;)Z
.locals 1
invoke-static {}, Lcom/samsung/android/feature/FloatingFeature;->getInstance()Lcom/samsung/android/feature/FloatingFeature;
move-result-object v0
[COLOR="red"]invoke-virtual {v0, p1}, Lcom/samsung/android/feature/FloatingFeature;->getEnableStatus(Ljava/lang/String;)Z[/COLOR]
move-result v0
return v0
.end method
It's the only location where a call requires the samsung framework.
So how to fix it:
We just modify the device detection method to return always false:
Code:
.method public static isSamsungDevice()Z
.locals 1
const/4 v0, 0x0
return v0
.end method
...recompile, resign and it's done.
So far I got 4 reports that it indeed works...so it should also for others.
Since I had to resign the app, ensure you uninstall the original one before installing the fixed version.
When an update in playstore drops for the gear app, and it still force closes, uninstall it and install my fixed version again.
Since I won't monitor that thread...someone should shoot me a PM, so I can merge my fix to the new version from playstore.
Code:
[B]Update 06.09.17[/B]
Samsung Gear to fix custom binary message on samsung devices
Gear S Plugin 2.2.03.17061361
Samsung Health 5.12.0.025
[B]Update 30.06.17[/B]
Accessory Service 3.1.51.70612
Gear S Plugin 2.2.03.17041441N
Samsung Health 5.9.1.003
[B]Update 02.04.17[/B]
Accessory Service 3.1.39_170322
[B]Update 01.04.17[/B]
Samsung Gear 2.2.17022862
Gear S Plugin v2.2.03.17032442N
[B]Update 08.02.17[/B]
Added modifications to new [URL="http://www.tizenexperts.com/2017/01/samsung-gear-manager-application-gear-smartwatches-updated-2-2-16121661/?utm_content=buffer51605&utm_medium=social&utm_source=twitter.com&utm_campaign=buffer"]Gear App 2.2.16121661[/URL]
[B]Update 03.02.17[/B]
The installation issue some people were having seems to got resolved by signing the Gear S Plugin and Samsung Accessory Service with the same signature as the resigned Gear App.
All three files are uploaded on Google Drive now (xda does not allow zips > 20mb, and no single apks > 8MB)
Downloads:
Samsung Gear Apps
Last edited: