FileDocCategorySizeDatePackage
UserHappinessSignals.javaAPI DocAndroid 5.1 API2651Thu Mar 12 22:22:48 GMT 2015com.android.common.userhappiness

UserHappinessSignals

public class UserHappinessSignals extends Object
Metrics for User Happiness are recorded here. Each app can define when to call these User Happiness metrics.

Fields Summary
private static boolean
mHasVoiceLoggingInfo
Constructors Summary
Methods Summary
public static voidsetHasVoiceLoggingInfo(boolean hasVoiceLogging)
Record whether or not there has been Voice-Input activity which needs to be logged. This is called with a value of true by the IME, when logging events (such as VoiceInputDelivered) occur, and is should be set to false after the logging broadcast is sent.


                                                        
         
        mHasVoiceLoggingInfo = hasVoiceLogging;
    
public static voiduserAcceptedImeText(android.content.Context context)
Log when a user "accepted" IME text. Each application can define what it means to "accept" text. In the case of Gmail, pressing the "Send" button indicates text acceptance. We broadcast this information to VoiceSearch LoggingEvents and use it to aggregate VoiceIME Happiness Metrics

        // Create a Voice IME Logging intent only if there are logging actions
        if (mHasVoiceLoggingInfo) {
            Intent i = new Intent(LoggingEvents.ACTION_LOG_EVENT);
            i.putExtra(LoggingEvents.EXTRA_APP_NAME, LoggingEvents.VoiceIme.APP_NAME);
            i.putExtra(LoggingEvents.EXTRA_EVENT, LoggingEvents.VoiceIme.IME_TEXT_ACCEPTED);
            i.putExtra(LoggingEvents.EXTRA_CALLING_APP_NAME, context.getPackageName());
            i.putExtra(LoggingEvents.EXTRA_TIMESTAMP, System.currentTimeMillis());
            context.sendBroadcast(i);
            setHasVoiceLoggingInfo(false);
        }