1

I can detect whether vibrator is vibrating or not with adb logcat -b system on Android 12 emulator. However Android 13 emulator doesn't show anything. So I cannot assure the vibrator is working or not on Android 13.

For example:

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
        val vibratorManager = getSystemService(Context.VIBRATOR_MANAGER_SERVICE) as VibratorManager
        val vibePattern: LongArray =
            longArrayOf(0, 10, 200, 500, 700, 1000, 300, 200, 50, 10)

        vibratorManager.defaultVibrator.vibrate(VibrationEffect.createWaveform(vibePattern, 0))
        

If I use above code, logcat on Android 12 shows

2022-09-11 20:53:55.792 364-364/? I/android.hardware.vibrator-service.example: Vibrator set amplitude: 0.11
2022-09-11 20:53:55.793 364-5472/? I/android.hardware.vibrator-service.example: Notifying on complete
2022-09-11 20:53:55.802 364-364/? I/android.hardware.vibrator-service.example: Vibrator off

However, on Android 13 emulator, nothing comes out.

Also, I tried to vibrate with Pixel genuine alarm app. Then Android 12 shows:

2022-09-11 20:59:33.424 364-5809/? I/android.hardware.vibrator-service.example: Notifying perform complete
2022-09-11 20:59:33.424 364-364/? I/android.hardware.vibrator-service.example: Vibrator off
2022-09-11 20:59:34.337 364-364/? I/android.hardware.vibrator-service.example: Vibrator perform

Android 13 genuine alarm shows:

2022-09-11 21:03:00.074 6616-6616/com.google.android.deskclock I/AlarmClock: MusicModel: Starting vibration due to PlayMusicRequest {uri=content://settings/system/alarm_alert, dataType=ALARM, connection=FIRE, resume=false, vibration=PATTERN, crescendo=0ms, canFallback=true, isFallback=false}
2022-09-11 21:03:18.218 6616-6668/com.google.android.deskclock I/AlarmClock: Created new alarm instance: AlarmInstance{alarmId=2, id=2, state=SCHEDULED, time=09-17-2022 21:03, wakeup=false, vibrate=true, ringtone=content://settings/system/alarm_alert, labelLength=0}
2022-09-11 21:03:18.251 6616-6616/com.google.android.deskclock I/AlarmClock: MusicModel: Stopping vibration

It looks like Google is changing how to vibrate. But vibratorManager is not deprecated.

Also, notifications with vibration on any apps don't show on logcat either. I tried Android studio chipmunk and Electric Eel both, but results were the same.

The question is that how I can detect all vibrations on Android 13 emulator.

Thank you.

Tieria
  • 333
  • 3
  • 11

0 Answers0