Category Archives: Help & How To

pulseaudio wasting CPU time because of speech-dispatcher

Disable speech-dispatcher on Debian 12

I’m running Debian 12 “Bookworm” on a HP ProBook x360 G1 EE. This “beast” is serving as a Jenkins node running an automated test suite on attached Android devices for GSM Signal Monitor. It also runs xRDP and XFCE as the desktop environment. I’m remoting into the machine from time to time for device management and configuration using scrcpy.

One thing I noticed when running htop and using Firefox to visit sites such as stackoverflow.com was the abnormal CPU utilization by PulseAudio.

After a bit of research, the issue was pinpointed to speech dispatcher auto spawning on demand when called by certain applications.

I don’t use speech synthesis or software synthesizers on this machine (or anywhere, to be fair) and would rather waste CPU cycles on something more useful—such as running complete regression test suites against GSM Signal Monitor when a build is merged into the dev branch, or pre-release testing on 24 devices attached to the little beast.

To prevent speech-dispatcher from auto-spawning on demand, open a terminal and run:

sudo nano /etc/speech-dispatcher/speechd.conf

Locate the “DisableAutoSpawn” option near the bottom of the file and uncomment it. Save the file and restart speech-dispatcher.

sudo systemctl restart speech-dispatcher

Optionally restart Firefox if it’s running.

Now speech-dispatcher should no longer spawn on demand by applications. You can verify that by navigating to a topic on Stack Overflow, for example.

speech-dispatcher disabled, firefox complaining

Firefox should complain that it can’t use speech synthesis.

Managing SSL for Jenkins with Sectigo Certificates

At VMSoft, I manage a Jenkins instance that uses SSL. To configure SSL using a certificate issued by Sectigo (in my case), the supplied .crt and .key files must be imported into a keystore, which is then passed as a Jenkins startup parameter.

The process of creating a keystore from the .crt and .key files involves using the openssl command-line utility to create a PKCS#12 file:

openssl pkcs12 -export -in <file_name>.crt -inkey <file_name>.key -out jenkins.p12

Next, convert the resulting .p12 file to a .jks file using the keytool utility, which comes bundled with the JDK:

keytool -importkeystore -srckeystore jenkins.p12 -srcstoretype PKCS12 -destkeystore jenkins.jks -deststoretype JKS

Finally, make Jenkins aware that you want to use HTTPS by editing the jenkins.xml configuration file. Modify the jenkins.war command-line arguments by appending the following:

--httpPort=-1 --httpsPort=8443 --httpsKeyStore=<path_to_key_store_file> --httpsKeyStorePassword=<key_store_password>

Note: If your Jenkins instance fails to start, check the error log. If you see an error like:

java.security.UnrecoverableKeyException: Cannot recover key

ensure that the password you provided during the creation of both the PKCS#12 file and the .jks file is the same. Inconsistent passwords can cause this error.

Automating Google Play Store reports with ‘gsutil’ and Windows PowerShell

Why (feel free to skip)

As Android developer I have various mobile devices (phones, tablets, watches) with all Android version starting 4.0 (Ice Cream Sandwich, API 14) up to Android 12 (L, API 31). Those devices accompanied by very detailed test scenarios help me ensure best possible user experience 🙂

Android test devices

As Android developer I have various mobile devices (phones, tablets, watches) with all Android version starting 4.0 (Ice Cream Sandwich, API 14) up to Android 12 (L, API 31).

When prepping release for an app, all test cases for that particular app are performed on each device. For each Android version I keep track of active installs and user rating. Applying that data in the test scenario. This helps me focus more on particular set of for ex. unhappy users running specific OS version.

Below is a screenshot of a test scenario for one of my apps: GSM Signal Monitor & SIM Card Info.

GSM Signal Monitor & SIM Card Info test scenario

GSM Signal Monitor & SIM Card Info test scenario

Each Android version has number of active installs and rating. Going to Google Play Store dev console and collecting this information by hand is somehow tedious job, so I decided to automate it using ‘Google Cloud Storage Util‘ and a bit of Windows PowerShell scripting.

How

Our task is to fetch Google Play store monthly reports for app installs and ratings by OS version, filter them and get data that can easily be copy pasted in the ‘Active Installs‘ tab of the test scenario.

1. Cloud Storage bucket ID

Google Play reports, beside dev console can also be accessed via Google Cloud Storage bucket associated with your developer account. You can go to “Download reports”, pick the report type you want and select “Copy Cloud Storage URI” next to it.

Google Play Cloud Storage URI

The url will look like this

gs://< bucket_id >/stats/installs/

where < bucket_id > will be your actual developer account cloud storage bucket. Remember this bucket id. We will be using it later.

2. Install gsutil

Google provides GSUtil for using cloud storage from the command line. Head over to https://cloud.google.com/storage/docs/gsutil_install#expandable-1 and follow the installation instructions.

We will be utilizing the gsutil.cmd assuming that the script is available in system PATH.

Next we need to authorize gsutil to access our cloud storage data. Follow the instructions on how to Authenticate stand-alone gsutil. For ‘project-id’ use the project ID of the app you want to get reports for. I’m interested in retrieving reports for GSM Signal Monitor & SIM Card Info app so I will be using it’s Cloud Storage project id.

Cloud Storage Project ID

If everything is setup correctly, opening command prompt and typing “gsutil help” should produce result similar to the screenshot below:

gsutil help command output

3. PowerShell magic 🙂

Script below will fetch installs and ratings reports from Google Play for specific app for the current month. Will get the last date available in the install report, filter both install and rating reports by ‘last available date’ and strip the reports from rows / columns we are not interested in. It will iterate over the active installs and will try to match installs with the ratings.

Replace $bucketId and $appPackageName with your cloud storage bucket id and your app package name.

Reports fetched from Google Play and the final output will be saved in the current working directory.

Upon execution you will get a report for your app active users/ratings by Android version, based on the data for the last date available in the install report nicely opened in your default text editor.

Script output: Active users and ratings.

P.S: Enable column selection mode in Notepad++ to get only the numbers. Use the arrow keys or your mouse while holding Shift + Alt.

P.S1: More info on how to retrieve various reports with gsutil here.

Feel free to modify the script to suit your reporting needs 🙂

How to Reset MAC OS X DOCK to DEFAULT SETTINGS

First launch the Terminal app, located in the Utilities folder under Applications, or just hit Cmd + Space and type “Terminal“.

Type (copy & paste) the command below:

defaults delete com.apple.dock; killall Dock

Then hit return.

Your Dock will now be new as the day it shipped. You are free to mess it up again 🙂