Search in sources :

Example 26 with IntentSender

use of android.content.IntentSender in project android_packages_apps_Settings by SudaMod.

the class NotificationStation method formatPendingIntent.

private static String formatPendingIntent(PendingIntent pi) {
    final StringBuilder sb = new StringBuilder();
    final IntentSender is = pi.getIntentSender();
    sb.append("Intent(pkg=").append(is.getCreatorPackage());
    try {
        final boolean isActivity = ActivityManager.getService().isIntentSenderAnActivity(is.getTarget());
        if (isActivity)
            sb.append(" (activity)");
    } catch (RemoteException ex) {
    }
    sb.append(")");
    return sb.toString();
}
Also used : SpannableStringBuilder(android.text.SpannableStringBuilder) IntentSender(android.content.IntentSender) RemoteException(android.os.RemoteException)

Example 27 with IntentSender

use of android.content.IntentSender in project android_packages_apps_Settings by DirtyUnicorns.

the class NotificationStation method formatPendingIntent.

private static String formatPendingIntent(PendingIntent pi) {
    final StringBuilder sb = new StringBuilder();
    final IntentSender is = pi.getIntentSender();
    sb.append("Intent(pkg=").append(is.getCreatorPackage());
    try {
        final boolean isActivity = ActivityManager.getService().isIntentSenderAnActivity(is.getTarget());
        if (isActivity)
            sb.append(" (activity)");
    } catch (RemoteException ex) {
    }
    sb.append(")");
    return sb.toString();
}
Also used : SpannableStringBuilder(android.text.SpannableStringBuilder) IntentSender(android.content.IntentSender) RemoteException(android.os.RemoteException)

Example 28 with IntentSender

use of android.content.IntentSender in project android_packages_apps_Settings by DirtyUnicorns.

the class ChooseLockSettingsHelper method copyOptionalExtras.

private void copyOptionalExtras(Intent inIntent, Intent outIntent) {
    IntentSender intentSender = inIntent.getParcelableExtra(Intent.EXTRA_INTENT);
    if (intentSender != null) {
        outIntent.putExtra(Intent.EXTRA_INTENT, intentSender);
    }
    int taskId = inIntent.getIntExtra(Intent.EXTRA_TASK_ID, -1);
    if (taskId != -1) {
        outIntent.putExtra(Intent.EXTRA_TASK_ID, taskId);
    }
    // TODO: Remove once that bug is fixed.
    if (intentSender != null || taskId != -1) {
        outIntent.addFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
        outIntent.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
    }
}
Also used : IntentSender(android.content.IntentSender)

Example 29 with IntentSender

use of android.content.IntentSender in project android_packages_apps_Settings by DirtyUnicorns.

the class ConfirmDeviceCredentialBaseFragment method checkForPendingIntent.

protected void checkForPendingIntent() {
    int taskId = getActivity().getIntent().getIntExtra(Intent.EXTRA_TASK_ID, -1);
    if (taskId != -1) {
        try {
            IActivityManager activityManager = ActivityManager.getService();
            final ActivityOptions options = ActivityOptions.makeBasic();
            options.setLaunchStackId(ActivityManager.StackId.INVALID_STACK_ID);
            activityManager.startActivityFromRecents(taskId, options.toBundle());
            return;
        } catch (RemoteException e) {
        // Do nothing.
        }
    }
    IntentSender intentSender = getActivity().getIntent().getParcelableExtra(Intent.EXTRA_INTENT);
    if (intentSender != null) {
        try {
            getActivity().startIntentSenderForResult(intentSender, -1, null, 0, 0, 0);
        } catch (IntentSender.SendIntentException e) {
        /* ignore */
        }
    }
}
Also used : RemoteException(android.os.RemoteException) IntentSender(android.content.IntentSender) Point(android.graphics.Point) IActivityManager(android.app.IActivityManager) ActivityOptions(android.app.ActivityOptions)

Example 30 with IntentSender

use of android.content.IntentSender in project platform_packages_apps_Settings by BlissRoms.

the class ChooseLockSettingsHelper method copyOptionalExtras.

private void copyOptionalExtras(Intent inIntent, Intent outIntent) {
    IntentSender intentSender = inIntent.getParcelableExtra(Intent.EXTRA_INTENT);
    if (intentSender != null) {
        outIntent.putExtra(Intent.EXTRA_INTENT, intentSender);
    }
    int taskId = inIntent.getIntExtra(Intent.EXTRA_TASK_ID, -1);
    if (taskId != -1) {
        outIntent.putExtra(Intent.EXTRA_TASK_ID, taskId);
    }
    // TODO: Remove once that bug is fixed.
    if (intentSender != null || taskId != -1) {
        outIntent.addFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
        outIntent.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
    }
}
Also used : IntentSender(android.content.IntentSender)

Aggregations

IntentSender (android.content.IntentSender)94 Intent (android.content.Intent)48 IIntentSender (android.content.IIntentSender)46 PendingIntent (android.app.PendingIntent)40 RemoteException (android.os.RemoteException)30 UserHandle (android.os.UserHandle)14 ActivityOptions (android.app.ActivityOptions)13 KeyguardManager (android.app.KeyguardManager)10 UserInfo (android.content.pm.UserInfo)10 Bundle (android.os.Bundle)10 IActivityManager (android.app.IActivityManager)8 ComponentName (android.content.ComponentName)8 ActivityInfo (android.content.pm.ActivityInfo)8 ResolveInfo (android.content.pm.ResolveInfo)8 HeavyWeightSwitcherActivity (com.android.internal.app.HeavyWeightSwitcherActivity)8 AccountManager (android.accounts.AccountManager)7 Activity (android.app.Activity)7 PackageManager (android.content.pm.PackageManager)7 Point (android.graphics.Point)7 SpannableStringBuilder (android.text.SpannableStringBuilder)7