FileDocCategorySizeDatePackage
Somnambulator.javaAPI DocAndroid 5.1 API2249Thu Mar 12 22:22:42 GMT 2015com.android.systemui

Somnambulator

public class Somnambulator extends android.app.Activity
A simple activity that launches a dream.

Note: This Activity is special. If this class is moved to another package or renamed, be sure to update the component name in {@link Sandman}.

Fields Summary
Constructors Summary
public Somnambulator()

    
Methods Summary
public voidonStart()

        super.onStart();

        final Intent launchIntent = getIntent();
        final String action = launchIntent.getAction();
        if (Intent.ACTION_CREATE_SHORTCUT.equals(action)) {
            Intent shortcutIntent = new Intent(this, Somnambulator.class);
            shortcutIntent.setFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS
                    | Intent.FLAG_ACTIVITY_NEW_TASK);
            Intent resultIntent = new Intent();
            resultIntent.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE,
                    Intent.ShortcutIconResource.fromContext(this, R.mipmap.ic_launcher_dreams));
            resultIntent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, shortcutIntent);
            resultIntent.putExtra(Intent.EXTRA_SHORTCUT_NAME, getString(R.string.start_dreams));
            setResult(RESULT_OK, resultIntent);
        } else {
            boolean docked = launchIntent.hasCategory(Intent.CATEGORY_DESK_DOCK);
            if (docked) {
                Sandman.startDreamWhenDockedIfAppropriate(this);
            } else {
                Sandman.startDreamByUserRequest(this);
            }
        }
        finish();