Set OnePlus 3t alert slider to all/vibrate/silent

712 views Asked by At

I have a OnePlus 3t running on OOS Open Beta 15, Android 7.1.1. I want its alert slider to put my phone into all sounds/vibration only/silent mode respectively. After trying every possible combination of third party apps and Tasker profiles, I started looking into creating my own Magisk Module to change the slider's behavior.

I found out that all the alert slider logic is inside the package com.oneplus.threekey. Using

adb shell 'pm list packages' > C:\packages.txt

I go a list of all my installed packages and the only packages containing the word "oneplus" are the following ones:

package:com.oneplus
package:com.oneplus.aod
package:com.oneplus.applocker
package:com.oneplus.calculator
package:com.oneplus.camera
package:com.oneplus.camera.service
package:com.oneplus.config
package:com.oneplus.deskclock
package:com.oneplus.dirac.simplemanager
package:com.oneplus.gallery
package:com.oneplus.iconpack.dives
package:com.oneplus.iconpack.o2default
package:com.oneplus.iconpack.rifon
package:com.oneplus.ifaaservice
package:com.oneplus.opbackup
package:com.oneplus.opbugreport
package:com.oneplus.opbugreportlite
package:com.oneplus.oplocationservice
package:com.oneplus.screenshot
package:com.oneplus.sdcardservice
package:com.oneplus.security
package:com.oneplus.setupwizard
package:com.oneplus.simcontacts
package:com.oneplus.skin
package:com.oneplus.sms.smscplugger
package:com.oneplus.soundrecorder
package:com.oneplus.wallpaper
package:com.oneplus.wifiapsettings

After no getting anywhere this way, I decided to look further into my logcat output. Filtering it using "threekey" this is the output everytime I change the alert slider's position:

10-03 00:00:53.223 1407-1872/? D/ThreeKeyHw: OEM UEVENT: {SUBSYSTEM=switch, SEQNUM=11574, ACTION=change, SWITCH_STATE=3, SWITCH_NAME=tri-state-key, DEVPATH=/devices/virtual/switch/tri-state-key}
10-03 00:00:53.227 1407-1407/? D/ThreeKeyAudioPolicy: set mode ring, mVibrateFlag=false, mMuteMediaFlag=true
10-03 00:00:53.231 1407-1407/? D/ZenModeHelper: setConfigLocked reason=ThreeKeyAudioPolicy
                                                java.lang.Throwable
                                                    at com.android.server.notification.ZenModeHelper.setConfigLocked(ZenModeHelper.java:706)
                                                    at com.android.server.notification.ZenModeHelper.setManualZenMode(ZenModeHelper.java:543)
                                                    at com.android.server.notification.ZenModeHelper.setManualZenMode(ZenModeHelper.java:503)
                                                    at com.android.server.notification.NotificationManagerService$5.setZenMode(NotificationManagerService.java:2193)
                                                    at android.app.NotificationManager.setZenMode(NotificationManager.java:422)
                                                    at com.oneplus.threekey.ThreeKeyAudioPolicy.setRing(ThreeKeyAudioPolicy.java:177)
                                                    at com.oneplus.threekey.ThreeKeyAudioPolicy.setDown(ThreeKeyAudioPolicy.java:87)
                                                    at com.oneplus.threekey.ThreeKey.setDown(ThreeKey.java:46)
                                                    at com.oneplus.threekey.ThreeKeyBase.setSwitchState(ThreeKeyBase.java:54)
                                                    at com.oneplus.threekey.ThreeKeyBase$ThreeKeyBroadcastReceiver.onReceive(ThreeKeyBase.java:80)
                                                    at android.app.LoadedApk$ReceiverDispatcher$Args.run(LoadedApk.java:1163)
                                                    at android.os.Handler.handleCallback(Handler.java:751)
                                                    at android.os.Handler.dispatchMessage(Handler.java:95)
                                                    at android.os.Looper.loop(Looper.java:154)
                                                    at com.android.server.SystemServer.run(SystemServer.java:367)
                                                    at com.android.server.SystemServer.main(SystemServer.java:237)
                                                    at java.lang.reflect.Method.invoke(Native Method)
                                                    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
                                                    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
10-03 00:00:53.298 2002-2087/? I/vol.VolumeDialogControl: s updateZenModeW zen:0 threeKeySatus:3 mVibrateWhenMute:0
10-03 00:00:53.300 1407-1407/? D/ThreeKeyAudioPolicy: settings change selfChange=false uri=content://settings/global/zen_mode
10-03 00:00:53.301 1407-1407/? D/ThreeKeyAudioPolicy: zen mode was changed, zen mode=ZEN_MODE_OFF, three key status=3
10-03 00:00:53.302 2002-2087/? I/vol.VolumeDialogControl: s updateZenModeW zen:0 threeKeySatus:3 mVibrateWhenMute:0
10-03 00:00:53.306 2002-2002/? D/VolumeUI: mZenModeObserver:zenMode=3, threeKeyStatus=3, mLastThreeKeyStatus=2
10-03 00:00:53.314 2002-2002/? D/VolumeUI: mZenModeObserver:zenMode=3, threeKeyStatus=3, mLastThreeKeyStatus=3

Here I noticed in the Throwable part that the threekey class/service (I don't really know what that is tbh) calls setZenMode, which seems to be responsible for the notification sounds. But as it turns out the setZenMode method is not documented at Android Developers and can't be called after obtaining an instance of the NotificationManager class.

At this point I am beginning to run out of ideas what to try next or where else to look. Any help to get the slider to work like it used to would be great!

0

There are 0 answers