https://kotlinlang.org logo
#compose-wear
Title
# compose-wear
f

florent

10/18/2023, 3:15 PM
Hi, with android 13 on the Samsung watch now, if you want to disable non the touch mode, it calls bixby (that nobody uses btw) and doesn't exit the non touch mode 😞. Do they have a specific command now for the wet mode? The only doc I know about from google is that https://developer.android.com/training/wearables/overlays/wet-mode?hl=zh-cn (No you can't change the lang)
f

Flyfish233

10/19/2023, 5:10 AM
I can read Chinese and have found a wrapper for this mode https://github.com/SimpleAppProjects/TouchLockHelper/releases However it seems an exclusive for Wear OS 2 and not working on my Galaxy Watch
I may find the solution for Galaxy Watch with Android 13+, exclusively
Copy code
com.samsung.android.clockwork.settings.permission.CHANGE_WATER_LOCK
Still working on it...
f

florent

10/23/2023, 9:07 AM
ok I had another look at it I found that : • with that permission I downloaded https://www.apkmirror.com/apk/samsung-electronics-co-ltd/samsung-health-wear-os/samsu[…]nload/download/?key=0d16c52d69d7d4b68927a8d33084b58e641ad550 apk • I decompiled it, and had a look at the smali code, I found one w0 that look promising • I used jadx to retransform that class to java :
Copy code
package oe;

import android.content.Intent;
import android.os.Build;
import android.provider.Settings;
import com.samsung.android.app.shealth.app.helper.ContextHolder;
import com.samsung.android.app.shealth.config.FeatureManager;
import ml.c;

/* loaded from: /tmp/jadx-9820642705711894328.dex */
public final class w0 {
    public static final w0 a = new w0();

    public final boolean a() {
        return Settings.Global.getInt(ContextHolder.getContext().getContentResolver(), "setting_water_lock_on", 0) > 0;
    }

    public final void b() {
        if (!a() && !FeatureManager.getInstance().isSupported("exercise_disable_water_lock_for_swimming")) {
            c.b("SHW - WaterLockUtil", "turn on WaterLock");
            int i = Build.VERSION.SDK_INT;
            Intent intent = i >= 33 ? new Intent("com.samsung.android.clockwork.settings.ACTION_MSG_ID_ENABLE_WATER_LOCK") : new Intent("com.google.android.wearable.action.ENABLE_WET_MODE");
            String str = i >= 33 ? "com.samsung.android.clockwork.settings.permission.CHANGE_WATER_LOCK" : "com.google.android.clockwork.settings.permission.SEC_CHANGE_WATERLOCK";
            intent.addFlags(32);
            intent.addFlags(16777216);
            ContextHolder.getContext().sendBroadcast(intent, str);
        }
    }
}
But I haven't managed to have it working
That the other end of it:
Copy code
public class StWaterLockListenerService extends Service {
    private final BroadcastReceiver mWaterLockReceiver = new 1(this);

    @Override // android.app.Service
    public IBinder onBind(Intent intent) {
        return null;
    }

    @Override // android.app.Service
    public int onStartCommand(Intent intent, int i, int i2) {
        Log.i("StWaterLockListenerService", "onStartCommand()");
        registerReceiver(this.mWaterLockReceiver, new IntentFilter("com.samsung.android.clockwork.settings.ACTION_MSG_ID_ENABLE_WATER_LOCK"), "com.samsung.android.clockwork.settings.permission.CHANGE_WATER_LOCK", null);
        startService(new Intent(getApplicationContext(), StWaterLockService.class).putExtra("INITIALIZE", true));
        return 1;
    }

    /* access modifiers changed from: private */
    public void startWaterLockService(Context context) {
        Log.i("StWaterLockListenerService", "startWaterLockService()");
        context.startService(new Intent(context, StWaterLockService.class));
    }
}
from https://www.apkmirror.com/apk/samsung-electronics-co-ltd/settings-wear-os/settings-we[…]nload/download/?key=62d6ba8ac7a5ebab85a3c51c32514c0ea490ff54
And of course, I have tried to send
Copy code
context.sendBroadcast(
            Intent("com.samsung.android.clockwork.settings.ACTION_MSG_ID_ENABLE_WATER_LOCK").apply {
                addFlags(32)
                addFlags(16777216)
            }, "com.samsung.android.clockwork.settings.permission.CHANGE_WATER_LOCK")
But it didn't do anything
ah I got a permission denied "2023-10-23 104609.347 530-628 BroadcastQueue system_server W Permission Denial: broadcasting Intent { act=com.samsung.android.clockwork.settings.ACTION_MSG_ID_ENABLE_WATER_LOCK flg=0x1000030 } from com.pascap.connectedBody (pid=5479, uid=10163) requires com.samsung.android.clockwork.settings.permission.CHANGE_WATER_LOCK due to registered receiver BroadcastFilter{1ae41b1 1000/u0 ReceiverList{36e0c58 3266 com.google.android.apps.wearable.settings/1000/u0 remote:7cf4d3b}}"
I am not sure there is a way to get that permission
2 Views