Example usage for android.content Intent getSourceBounds

List of usage examples for android.content Intent getSourceBounds

Introduction

In this page you can find the example usage for android.content Intent getSourceBounds.

Prototype

public @Nullable Rect getSourceBounds() 

Source Link

Document

Get the bounds of the sender of this intent, in screen coordinates.

Usage

From source file:com.android.contacts.activities.PhotoSelectionActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.photoselection_activity);
    if (savedInstanceState != null) {
        mCurrentPhotoUri = savedInstanceState.getParcelable(KEY_CURRENT_PHOTO_URI);
        mSubActivityInProgress = savedInstanceState.getBoolean(KEY_SUB_ACTIVITY_IN_PROGRESS);
    }/*from  w ww.  j a v a2 s  .  c o  m*/

    // Pull data out of the intent.
    final Intent intent = getIntent();
    mPhotoUri = intent.getParcelableExtra(PHOTO_URI);
    mState = (RawContactDeltaList) intent.getParcelableExtra(ENTITY_DELTA_LIST);
    mIsProfile = intent.getBooleanExtra(IS_PROFILE, false);
    mIsDirectoryContact = intent.getBooleanExtra(IS_DIRECTORY_CONTACT, false);
    mExpandPhoto = intent.getBooleanExtra(EXPAND_PHOTO, false);

    // Pull out photo expansion properties from resources
    mExpandedPhotoSize = getResources().getDimensionPixelSize(R.dimen.detail_contact_photo_expanded_size);
    mHeightOffset = getResources().getDimensionPixelOffset(R.dimen.expanded_photo_height_offset);

    mBackdrop = findViewById(R.id.backdrop);
    mPhotoView = (ImageView) findViewById(R.id.photo);
    mSourceBounds = intent.getSourceBounds();

    // Fade in the background.
    animateInBackground();

    // Dismiss the dialog on clicking the backdrop.
    mBackdrop.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            finish();
        }
    });

    // Wait until the layout pass to show the photo, so that the source bounds will match up.
    SchedulingUtils.doAfterLayout(mBackdrop, new Runnable() {
        @Override
        public void run() {
            displayPhoto();
        }
    });
}

From source file:com.piusvelte.sonet.core.StatusDialog.java

@Override
protected void onResume() {
    super.onResume();
    Intent intent = getIntent();
    if (intent != null) {
        if (intent.hasExtra(Widgets.INSTANT_UPLOAD)) {
            mFilePath = intent.getStringExtra(Widgets.INSTANT_UPLOAD);
            Log.d(TAG, "upload photo?" + mFilePath);
        } else {/*from  w  w  w . j  a  v a2  s  .  co  m*/
            mData = intent.getData();
            if (mData != null) {
                mData = intent.getData();
                if (intent.hasExtra(LauncherIntent.Extra.Scroll.EXTRA_SOURCE_BOUNDS))
                    mRect = intent.getParcelableExtra(LauncherIntent.Extra.Scroll.EXTRA_SOURCE_BOUNDS);
                else
                    mRect = intent.getSourceBounds();
                Log.d(TAG, "data:" + mData.toString());
                // need to use a thread here to avoid anr
                mLoadingDialog = new ProgressDialog(this);
                mLoadingDialog.setMessage(getString(R.string.status_loading));
                mLoadingDialog.setCancelable(true);
                mLoadingDialog.setOnCancelListener(new OnCancelListener() {
                    @Override
                    public void onCancel(DialogInterface arg0) {
                        if (mStatusLoader != null)
                            mStatusLoader.cancel(true);
                        finish();
                    }
                });
                mLoadingDialog.setButton(ProgressDialog.BUTTON_NEGATIVE, getString(android.R.string.cancel),
                        new OnClickListener() {
                            @Override
                            public void onClick(DialogInterface dialog, int which) {
                                dialog.cancel();
                                finish();
                            }
                        });
                mLoadingDialog.show();
                mStatusLoader = new StatusLoader();
                mStatusLoader.execute();
            }
        }
    }
    if (mFilePath != null) {
        mDialog = (new AlertDialog.Builder(this)).setTitle(R.string.uploadprompt)
                .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        startActivityForResult(
                                Sonet.getPackageIntent(getApplicationContext(), SonetCreatePost.class)
                                        .putExtra(Widgets.INSTANT_UPLOAD, mFilePath),
                                RESULT_REFRESH);
                        dialog.dismiss();
                    }
                }).setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        dialog.dismiss();
                        StatusDialog.this.finish();
                    }
                }).create();
        mDialog.show();
    } else {
        // check if the dialog is still loading
        if (mFinish)
            finish();
        else if ((mLoadingDialog == null) || !mLoadingDialog.isShowing())
            showDialog();
    }
}

From source file:com.shafiq.myfeedle.core.StatusDialog.java

@Override
protected void onResume() {
    super.onResume();
    Intent intent = getIntent();
    if (intent != null) {
        if (intent.hasExtra(Widgets.INSTANT_UPLOAD)) {
            mFilePath = intent.getStringExtra(Widgets.INSTANT_UPLOAD);
            Log.d(TAG, "upload photo?" + mFilePath);
        } else {//from ww w .  j  a  v a 2 s. co  m
            mData = intent.getData();
            if (mData != null) {
                mData = intent.getData();
                if (intent.hasExtra(LauncherIntent.Extra.Scroll.EXTRA_SOURCE_BOUNDS))
                    mRect = intent.getParcelableExtra(LauncherIntent.Extra.Scroll.EXTRA_SOURCE_BOUNDS);
                else
                    mRect = intent.getSourceBounds();
                Log.d(TAG, "data:" + mData.toString());
                // need to use a thread here to avoid anr
                mLoadingDialog = new ProgressDialog(this);
                mLoadingDialog.setMessage(getString(R.string.status_loading));
                mLoadingDialog.setCancelable(true);
                mLoadingDialog.setOnCancelListener(new OnCancelListener() {
                    @Override
                    public void onCancel(DialogInterface arg0) {
                        if (mStatusLoader != null)
                            mStatusLoader.cancel(true);
                        finish();
                    }
                });
                mLoadingDialog.setButton(ProgressDialog.BUTTON_NEGATIVE, getString(android.R.string.cancel),
                        new OnClickListener() {
                            @Override
                            public void onClick(DialogInterface dialog, int which) {
                                dialog.cancel();
                                finish();
                            }
                        });
                mLoadingDialog.show();
                mStatusLoader = new StatusLoader();
                mStatusLoader.execute();
            }
        }
    }
    if (mFilePath != null) {
        mDialog = (new AlertDialog.Builder(this)).setTitle(R.string.uploadprompt)
                .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        startActivityForResult(
                                Myfeedle.getPackageIntent(getApplicationContext(), MyfeedleCreatePost.class)
                                        .putExtra(Widgets.INSTANT_UPLOAD, mFilePath),
                                RESULT_REFRESH);
                        dialog.dismiss();
                    }
                }).setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        dialog.dismiss();
                        StatusDialog.this.finish();
                    }
                }).create();
        mDialog.show();
    } else {
        // check if the dialog is still loading
        if (mFinish)
            finish();
        else if ((mLoadingDialog == null) || !mLoadingDialog.isShowing())
            showDialog();
    }
}

From source file:com.silentcircle.contacts.quickcontact.QuickContactActivity.java

@Override
protected void onCreate(Bundle icicle) {
    super.onCreate(icicle);

    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB_MR1) {
        Log.i(TAG, "QuickContact only available for API >= HONEYCOMB_MR1");
        finish();/* ww  w.j  a  v  a2 s. c  o m*/
        return;
    }

    if (TRACE_LAUNCH)
        android.os.Debug.startMethodTracing(TRACE_TAG);

    // Parse intent
    final Intent intent = getIntent();

    Uri lookupUri = intent.getData();

    mLookupUri = Preconditions.checkNotNull(lookupUri, "missing lookupUri");

    mExcludeMimes = intent.getStringArrayExtra(QuickContact.EXTRA_EXCLUDE_MIMES);

    mContactLoader = (ContactLoader) getSupportLoaderManager().initLoader(LOADER_ID, null, mLoaderCallbacks);

    // Show QuickContact in front of soft input
    getWindow().setFlags(WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM,
            WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM);

    setContentView(R.layout.quickcontact_activity);

    mFloatingLayout = (FloatingChildLayout) findViewById(R.id.floating_layout);
    mTrack = (ViewGroup) findViewById(R.id.track);
    mTrackScroller = (HorizontalScrollView) findViewById(R.id.track_scroller);
    mOpenDetailsImage = (ImageView) findViewById(R.id.contact_details_image);
    mOpenDetailsPushLayerButton = (ImageButton) findViewById(R.id.open_details_push_layer);
    mListPager = (ViewPager) findViewById(R.id.item_list_pager);
    mSelectedTabRectangle = findViewById(R.id.selected_tab_rectangle);
    mLineAfterTrack = findViewById(R.id.line_after_track);

    mFloatingLayout.setOnOutsideTouchListener(new View.OnTouchListener() {
        @Override
        public boolean onTouch(View v, MotionEvent event) {
            handleOutsideTouch();
            return true;
        }
    });

    final OnClickListener openDetailsClickHandler = new OnClickListener() {
        @Override
        public void onClick(View v) {
            final Intent intent = new Intent(Intent.ACTION_VIEW, mLookupUri);
            mContactLoader.cacheResult();
            intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
            startActivity(intent);
            close(false);
        }
    };
    mOpenDetailsPushLayerButton.setOnClickListener(openDetailsClickHandler);
    mListPager.setAdapter(new ViewPagerAdapter(getSupportFragmentManager()));
    mListPager.setOnPageChangeListener(new PageChangeListener());

    final Rect sourceBounds = intent.getSourceBounds();
    if (sourceBounds != null) {
        mFloatingLayout.setChildTargetScreen(sourceBounds);
    }

    // find and prepare correct header view
    mPhotoContainer = findViewById(R.id.photo_container);
    setHeaderNameText(R.id.name, R.string.missing_name);

    SchedulingUtils.doAfterLayout(mFloatingLayout, new Runnable() {
        @Override
        public void run() {
            mFloatingLayout.fadeInBackground();
        }
    });
}

From source file:com.android.leanlauncher.LauncherTransitionable.java

boolean startActivity(View v, Intent intent, Object tag) {
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    try {/*from  ww  w  .j  av a  2 s  .c  o  m*/
        // Only launch using the new animation if the shortcut has not opted out (this is a
        // private contract between launcher and may be ignored in the future).
        boolean useLaunchAnimation = (v != null) && !intent.hasExtra(INTENT_EXTRA_IGNORE_LAUNCH_ANIMATION);
        LauncherAppsCompat launcherApps = LauncherAppsCompat.getInstance(this);
        UserManagerCompat userManager = UserManagerCompat.getInstance(this);

        UserHandleCompat user = null;
        if (intent.hasExtra(AppInfo.EXTRA_PROFILE)) {
            long serialNumber = intent.getLongExtra(AppInfo.EXTRA_PROFILE, -1);
            user = userManager.getUserForSerialNumber(serialNumber);
        }

        Bundle optsBundle = null;
        if (useLaunchAnimation) {
            ActivityOptions opts = Utilities.isLmpOrAbove()
                    ? ActivityOptions.makeCustomAnimation(this, R.anim.task_open_enter, R.anim.no_anim)
                    : ActivityOptions.makeScaleUpAnimation(v, 0, 0, v.getMeasuredWidth(),
                            v.getMeasuredHeight());
            optsBundle = opts.toBundle();
        }

        if (user == null || user.equals(UserHandleCompat.myUserHandle())) {
            // Could be launching some bookkeeping activity
            startActivity(intent, optsBundle);
        } else {
            // TODO Component can be null when shortcuts are supported for secondary user
            launcherApps.startActivityForProfile(intent.getComponent(), user, intent.getSourceBounds(),
                    optsBundle);
        }
        return true;
    } catch (SecurityException e) {
        Toast.makeText(this, R.string.activity_not_found, Toast.LENGTH_SHORT).show();
        Log.e(TAG, "Launcher does not have the permission to launch " + intent
                + ". Make sure to create a MAIN intent-filter for the corresponding activity "
                + "or use the exported attribute for this activity. " + "tag=" + tag + " intent=" + intent, e);
    }
    return false;
}

From source file:com.android.launcher3.Launcher.java

private void startShortcutIntentSafely(Intent intent, Bundle optsBundle, ItemInfo info) {
    try {//from ww w  .  j  a v  a 2s. c o  m
        StrictMode.VmPolicy oldPolicy = StrictMode.getVmPolicy();
        try {
            // Temporarily disable deathPenalty on all default checks. For eg, shortcuts
            // containing file Uri's would cause a crash as penaltyDeathOnFileUriExposure
            // is enabled by default on NYC.
            StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder().detectAll().penaltyLog().build());

            if (info.itemType == LauncherSettings.Favorites.ITEM_TYPE_DEEP_SHORTCUT) {
                String id = ((ShortcutInfo) info).getDeepShortcutId();
                String packageName = intent.getPackage();
                LauncherAppState.getInstance().getShortcutManager().startShortcut(packageName, id,
                        intent.getSourceBounds(), optsBundle, info.user);
            } else {
                // Could be launching some bookkeeping activity
                startActivity(intent, optsBundle);
            }
        } finally {
            StrictMode.setVmPolicy(oldPolicy);
        }
    } catch (SecurityException e) {
        // Due to legacy reasons, direct call shortcuts require Launchers to have the
        // corresponding permission. Show the appropriate permission prompt if that
        // is the case.
        if (intent.getComponent() == null && Intent.ACTION_CALL.equals(intent.getAction())
                && checkSelfPermission(Manifest.permission.CALL_PHONE) != PackageManager.PERMISSION_GRANTED) {

            setWaitingForResult(PendingRequestArgs.forIntent(REQUEST_PERMISSION_CALL_PHONE, intent, info));
            requestPermissions(new String[] { Manifest.permission.CALL_PHONE }, REQUEST_PERMISSION_CALL_PHONE);
        } else {
            // No idea why this was thrown.
            throw e;
        }
    }
}

From source file:com.android.launcher3.Launcher.java

public boolean startActivitySafely(View v, Intent intent, ItemInfo item) {
    if (mIsSafeModeEnabled && !Utilities.isSystemApp(this, intent)) {
        Toast.makeText(this, R.string.safemode_shortcut_error, Toast.LENGTH_SHORT).show();
        return false;
    }//w ww  . j av  a2s . com
    // Only launch using the new animation if the shortcut has not opted out (this is a
    // private contract between launcher and may be ignored in the future).
    boolean useLaunchAnimation = (v != null) && !intent.hasExtra(INTENT_EXTRA_IGNORE_LAUNCH_ANIMATION);
    Bundle optsBundle = useLaunchAnimation ? getActivityLaunchOptions(v) : null;

    UserHandleCompat user = null;
    if (intent.hasExtra(AppInfo.EXTRA_PROFILE)) {
        long serialNumber = intent.getLongExtra(AppInfo.EXTRA_PROFILE, -1);
        user = UserManagerCompat.getInstance(this).getUserForSerialNumber(serialNumber);
    }

    // Prepare intent
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    if (v != null) {
        intent.setSourceBounds(getViewBounds(v));
    }
    try {
        if (Utilities.ATLEAST_MARSHMALLOW && item != null
                && (item.itemType == Favorites.ITEM_TYPE_SHORTCUT
                        || item.itemType == Favorites.ITEM_TYPE_DEEP_SHORTCUT)
                && ((ShortcutInfo) item).promisedIntent == null) {
            // Shortcuts need some special checks due to legacy reasons.
            startShortcutIntentSafely(intent, optsBundle, item);
        } else if (user == null || user.equals(UserHandleCompat.myUserHandle())) {
            // Could be launching some bookkeeping activity
            startActivity(intent, optsBundle);
            if (isAllAppsVisible()) {
                predictiveAppsProvider.updateComponentCount(intent.getComponent());
            }
        } else {
            LauncherAppsCompat.getInstance(this).startActivityForProfile(intent.getComponent(), user,
                    intent.getSourceBounds(), optsBundle);
        }
        return true;
    } catch (ActivityNotFoundException | SecurityException e) {
        Toast.makeText(this, R.string.activity_not_found, Toast.LENGTH_SHORT).show();
        Log.e(TAG, "Unable to launch. tag=" + item + " intent=" + intent, e);
    }
    return false;
}

From source file:com.klinker.android.launcher.launcher3.Launcher.java

private boolean startActivity(View v, Intent intent, Object tag) {
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    try {//ww w  .  jav  a 2s.c  om
        // Only launch using the new animation if the shortcut has not opted out (this is a
        // private contract between launcher and may be ignored in the future).
        boolean useLaunchAnimation = (v != null) && !intent.hasExtra(INTENT_EXTRA_IGNORE_LAUNCH_ANIMATION);
        LauncherAppsCompat launcherApps = LauncherAppsCompat.getInstance(this);
        UserManagerCompat userManager = UserManagerCompat.getInstance(this);

        UserHandleCompat user = null;
        if (intent.hasExtra(AppInfo.EXTRA_PROFILE)) {
            long serialNumber = intent.getLongExtra(AppInfo.EXTRA_PROFILE, -1);
            user = userManager.getUserForSerialNumber(serialNumber);
        }

        Bundle optsBundle = null;
        if (useLaunchAnimation) {
            ActivityOptions opts = null;
            if (sClipRevealMethod != null) {
                // TODO: call method directly when Launcher3 can depend on M APIs
                int left = 0, top = 0;
                int width = v.getMeasuredWidth(), height = v.getMeasuredHeight();
                if (v instanceof TextView) {
                    // Launch from center of icon, not entire view
                    Drawable icon = Workspace.getTextViewIcon((TextView) v);
                    if (icon != null) {
                        Rect bounds = icon.getBounds();
                        left = (width - bounds.width()) / 2;
                        top = v.getPaddingTop();
                        width = bounds.width();
                        height = bounds.height();
                    }
                }
                try {
                    opts = (ActivityOptions) sClipRevealMethod.invoke(null, v, left, top, width, height);
                } catch (IllegalAccessException e) {
                    Log.d(TAG, "Could not call makeClipRevealAnimation: " + e);
                    sClipRevealMethod = null;
                } catch (InvocationTargetException e) {
                    Log.d(TAG, "Could not call makeClipRevealAnimation: " + e);
                    sClipRevealMethod = null;
                }
            }
            if (opts == null && !Utilities.isLmpOrAbove()) {
                // Below L, we use a scale up animation
                opts = ActivityOptions.makeScaleUpAnimation(v, 0, 0, v.getMeasuredWidth(),
                        v.getMeasuredHeight());
            } else if (opts == null && Utilities.isLmpMR1()) {
                // On L devices, we use the device default slide-up transition.
                // On L MR1 devices, we a custom version of the slide-up transition which
                // doesn't have the delay present in the device default.
                opts = ActivityOptions.makeCustomAnimation(this, R.anim.task_open_enter, R.anim.no_anim);
            }
            optsBundle = opts != null ? opts.toBundle() : null;
        }

        if (user == null || user.equals(UserHandleCompat.myUserHandle())) {
            // Could be launching some bookkeeping activity
            startActivity(intent, optsBundle);
        } else {
            // TODO Component can be null when shortcuts are supported for secondary user
            launcherApps.startActivityForProfile(intent.getComponent(), user, intent.getSourceBounds(),
                    optsBundle);
        }
        return true;
    } catch (SecurityException e) {
        Toast.makeText(this, R.string.activity_not_found, Toast.LENGTH_SHORT).show();
        Log.e(TAG, "Launcher does not have the permission to launch " + intent
                + ". Make sure to create a MAIN intent-filter for the corresponding activity "
                + "or use the exported attribute for this activity. " + "tag=" + tag + " intent=" + intent, e);
    }
    return false;
}

From source file:xyz.klinker.blur.launcher3.Launcher.java

private boolean startActivity(View v, Intent intent, Object tag) {
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    try {/*from   w w w .ja v a2s. co m*/
        // Only launch using the new animation if the shortcut has not opted out (this is a
        // private contract between launcher and may be ignored in the future).
        boolean useLaunchAnimation = (v != null) && !intent.hasExtra(INTENT_EXTRA_IGNORE_LAUNCH_ANIMATION);
        LauncherAppsCompat launcherApps = LauncherAppsCompat.getInstance(this);
        UserManagerCompat userManager = UserManagerCompat.getInstance(this);

        UserHandleCompat user = null;
        if (intent.hasExtra(AppInfo.EXTRA_PROFILE)) {
            long serialNumber = intent.getLongExtra(AppInfo.EXTRA_PROFILE, -1);
            user = userManager.getUserForSerialNumber(serialNumber);
        }

        Bundle optsBundle = null;
        if (useLaunchAnimation) {
            ActivityOptions opts = null;
            if (Utilities.ATLEAST_MARSHMALLOW) {
                int left = 0, top = 0;
                int width = v.getMeasuredWidth(), height = v.getMeasuredHeight();
                if (v instanceof TextView) {
                    // Launch from center of icon, not entire view
                    Drawable icon = Workspace.getTextViewIcon((TextView) v);
                    if (icon != null) {
                        Rect bounds = icon.getBounds();
                        left = (width - bounds.width()) / 2;
                        top = v.getPaddingTop();
                        width = bounds.width();
                        height = bounds.height();
                    }
                }
                opts = ActivityOptions.makeClipRevealAnimation(v, left, top, width, height);
            } else if (!Utilities.ATLEAST_LOLLIPOP) {
                // Below L, we use a scale up animation
                opts = ActivityOptions.makeScaleUpAnimation(v, 0, 0, v.getMeasuredWidth(),
                        v.getMeasuredHeight());
            } else if (Utilities.ATLEAST_LOLLIPOP_MR1) {
                // On L devices, we use the device default slide-up transition.
                // On L MR1 devices, we a custom version of the slide-up transition which
                // doesn't have the delay present in the device default.
                opts = ActivityOptions.makeCustomAnimation(this, R.anim.task_open_enter, R.anim.no_anim);
            }
            optsBundle = opts != null ? opts.toBundle() : null;
        }

        if (user == null || user.equals(UserHandleCompat.myUserHandle())) {
            StrictMode.VmPolicy oldPolicy = StrictMode.getVmPolicy();
            try {
                // Temporarily disable deathPenalty on all default checks. For eg, shortcuts
                // containing file Uris would cause a crash as penaltyDeathOnFileUriExposure
                // is enabled by default on NYC.
                StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder().detectAll().penaltyLog().build());
                // Could be launching some bookkeeping activity
                startActivity(intent, optsBundle);
            } finally {
                StrictMode.setVmPolicy(oldPolicy);
            }
        } else {
            // TODO Component can be null when shortcuts are supported for secondary user
            launcherApps.startActivityForProfile(intent.getComponent(), user, intent.getSourceBounds(),
                    optsBundle);
        }
        return true;
    } catch (SecurityException e) {
        if (Utilities.ATLEAST_MARSHMALLOW && tag instanceof ItemInfo) {
            // Due to legacy reasons, direct call shortcuts require Launchers to have the
            // corresponding permission. Show the appropriate permission prompt if that
            // is the case.
            if (intent.getComponent() == null && Intent.ACTION_CALL.equals(intent.getAction())
                    && checkSelfPermission(
                            Manifest.permission.CALL_PHONE) != PackageManager.PERMISSION_GRANTED) {
                // TODO: Rename sPendingAddItem to a generic name.
                sPendingAddItem = preparePendingAddArgs(REQUEST_PERMISSION_CALL_PHONE, intent, 0,
                        (ItemInfo) tag);
                requestPermissions(new String[] { Manifest.permission.CALL_PHONE },
                        REQUEST_PERMISSION_CALL_PHONE);
                return false;
            }
        }
        Toast.makeText(this, R.string.activity_not_found, Toast.LENGTH_SHORT).show();
        Log.e(TAG, "Launcher does not have the permission to launch " + intent
                + ". Make sure to create a MAIN intent-filter for the corresponding activity "
                + "or use the exported attribute for this activity. " + "tag=" + tag + " intent=" + intent, e);
    }
    return false;
}