← Back to diary
September 12, 2026
A Bug In A Clock

v1.4.0

TL;DR aka I'm a lazy fuck who hates a good story, and I only want to know what was done:

Before I continue with today's dev diary, I want to clarify something because I didn't in the first entry: I talked about how I'm a member of the Treeleaf forum, mentioned the sangha and so on, but it would be great to mention that this project is my personal passion project and is in no way endorsed, sponsored, backed, or recommended by Treeleaf Zendo and Jundo Cohen. Just to keep the good folks out of this creative mess I'm working on.

After 1.0.0 went live on Google Play, I went in to do some real testing, like hardcore testing, trying to break the app. The first lesson I learned from this is to be hygienic from now on in all the other projects I eventually commit to: I'll test first, then upload to the whole world of 12 testers to see.

Which brings us to today's episode of 1.4.0, submitted for review in the Google Play Console. A sharp-eyed reader may ask: what about 1.2.0 or 1.3.0? Well, guess what? I did the testing! And those versions were shit, with problems which I'm about to discuss here.

My first problem with 1.0.0 is that I didn't want the screen light to be constantly on. I added a click-to-dim-screen mechanism which kinda works now. Kinda, because it dims the screen, but a grey bar is left over that stays no matter what. Dim does a nice job of hiding Android's top and bottom bars, but the grey bar remains, even when I rotate the phone into landscape mode.

If you just tried to reproduce that bug and see what such a miserable failure of a dev I am, I disabled screen rotation. I promise I'll get back to fixing this problem once that goes higher on my priority list.

For fuck sake, this clock thing

I know time is relative, but if you're meditating with an app you set to any amount of time, and the finishing bell doesn't sound, we do have a problem. And that problem is also stopping Za Zen from being an efficient kitchen timer, as one tester is actually using it for that.

Android has something called Doze mode, and it's a notorious nemesis of all the meditation apps. I'll explain this in wrestling terms. Doze mode applies a Stone Cold hard sleeper hold on the app, in this case, on the finishing bell, inside the steel cage, which is a metaphor for a locked phone. So the ending bell doesn't ring on time; it rings when the user unlocks the phone, aka exits the cage.

My first fix was the so-called wake lock, trying to reverse the sleeper hold. It fixed the problem when the screen was dimmed. However, the bell was still late. It went on and on, human vs. machine in a match where the human works with the machine, and then I asked, not so nicely, to put on a fucking sort of debug generator, so I could generate a report a robot can pick into and see what's going on under the hood.

Then we did a few hours of testing and wrote down the results.

You get the gist. This testing actually wasn't used for meditation time, unfortunately, because I am easily getting hooked on World of Warcraft Classic, which I never played, so I'm murdering down zombies and beasts in a windowed mode while the app does the ticking-away thing.

What I have learned about my own work, after exporting a few debug logs, is that there isn't just one clock, but two, happily racing to see who will create more problems for me. There's an internal app clock (with a wake lock), and there's the grand generale Android clock, throttling the app's own.

I handed the job to the phone's built-in alarm system, the one that is used for the actual Clock app in Android, to do the work. The result was a sneaky little fucking bug that got on my nerves; I heard only one finishing bell, but the debug said there were two, because one of them was kinda "melting" into another.

So some more work, and the true fix was introduced. Then I did a new series of tests with locked-phone meditations set to different timers. 3, 17, 29, 46 minutes, all random, on a locked phone.

As the first three bells to start zazen sounded, I started the timer on my Garmin watch to make sure the finishing bell is on time and working. And yes, it's done: verified against the Garmin stopwatch, the finishing bell rings exactly once, exactly on time, and the phone stayed locked the entire sit.

Not going against the grain

After some cleanup work, I removed the debug thingie from settings, and it occurred to me that while this whole thing works, I really don't want to be that dude who says, "it works on my machine."

My goal was to create an app that is as notifications-and-permissions-free as possible. After all the work so far, I realized not all notifications and permissions are bad; some are needed because that's the life of a low-skilled developer working on a niche app in a system and setting he chose to create in.

So I installed around 10 popular meditation apps, took a pen and paper, and went through the apps' permission screens.

Almost all of them have a persistent quiet notification during a session. I wanted to escape the notification hell, but then I learned that this notification is actually technically very useful. It signals a foreground service, your direct instruction to the Android system to trust an app and keep it alive.

The other thing I noticed is that almost all of them have battery optimization. This is due to some really aggressive battery managers by some brands (I'm looking at you, Xiaomi, you've fucked up so many scrobbles by disabling my Pano Scrobbler), and that is something that I wanted to avoid.

I added a persistent notification (only one) that starts when you're meditating and disappears when you save your session. I added a battery optimization toggle and a precise alarm toggle (to make the timer work precisely) to a new splash screen that appears once you start the app. If you click Continue without agreeing to these permissions, I can't guarantee the app will work as intended. Instead of shunning the disbeliever, I'm giving you a second chance and inviting you to Settings to give permissions. Once you give permission in Settings, those cards are gone to keep the app clutter-free.

The new build 1.4.0 was submitted to the Console. It is now live for everyone in closed testing, so if you want to join in, please let me know; email zazenapp@proton.me with your Gmail account so I can add you. It's free, and you're not submitting your soul to the horned, red-skinned dude.

What now?