Home button not working after flashing to Android Marshmallow

Did a “dirty flash” (without clearing cache or data) of a new build of Android 6.0.1 (Marshmallow) for my phone yesterday and the home button stopped working. At first I thought it was a problem with the ROM build itself, so I reflashed the previous ROM that had been running fine but the problem persisted.

An Internet search showed others had the same problem and even a solution. I verified that my problem was the same by looking at logcat and seeing the same “Not starting activity because user setup is in progress” message. But the solution did not work for me, likely because I don’t run Google Play Services on my phone.

It seems that AOSP runs a provisioning app that should clear the user setup flag but I could not figure out a way to force it to run on the owner of the phone. I could setup shared users and setup would run and the home button worked for them, but I did not figure out a way to force it to run on the owner user.

Poking around in the source code, it seems that flag is a setting (not a property) and it is considered a “secure” setting, that is one that only a few privileged apps residing in the /system partition can set though all apps can read it. Finally figured out a way for me to set that for the owner user:

> adb root
> adb shell
# settings --user 0 put secure user_setup_complete 1

Using user 0 was a calculated guess as I was too lazy to figure out from the code the mapping between named users and the integer index needed but it seemed likely they would have used zero based indexing and that the owner user would be the first one.

Using a root adb shell probably is not needed, but I was already in root so that I could poke around in /system and /data to see what was happening.