Rewrite isRunningOnEmulator()

The new version should be more resilient to future changes in the
emulator's Build.PRODUCT string.