use of android.content.IntentSender in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class ConfirmDeviceCredentialUtils method checkForPendingIntent.
public static void checkForPendingIntent(Activity activity) {
// See Change-Id I52c203735fa9b53fd2f7df971824747eeb930f36 for context
int taskId = activity.getIntent().getIntExtra(Intent.EXTRA_TASK_ID, -1);
if (taskId != -1) {
try {
IActivityManager activityManager = ActivityManager.getService();
final ActivityOptions options = ActivityOptions.makeBasic();
activityManager.startActivityFromRecents(taskId, options.toBundle());
return;
} catch (RemoteException e) {
// Do nothing.
}
}
IntentSender intentSender = activity.getIntent().getParcelableExtra(Intent.EXTRA_INTENT);
if (intentSender != null) {
try {
activity.startIntentSenderForResult(intentSender, -1, null, 0, 0, 0);
} catch (IntentSender.SendIntentException e) {
/* ignore */
}
}
}
use of android.content.IntentSender in project Resurrection_packages_apps_Settings by ResurrectionRemix.
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();
}
use of android.content.IntentSender in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class AccountSyncSettings method requestAccountAccessIfNeeded.
private boolean requestAccountAccessIfNeeded(String packageName) {
if (packageName == null) {
return false;
}
final int uid;
try {
uid = getContext().getPackageManager().getPackageUidAsUser(packageName, mUserHandle.getIdentifier());
} catch (PackageManager.NameNotFoundException e) {
Log.e(TAG, "Invalid sync ", e);
return false;
}
AccountManager accountManager = getContext().getSystemService(AccountManager.class);
if (!accountManager.hasAccountAccess(mAccount, packageName, mUserHandle)) {
IntentSender intent = accountManager.createRequestAccountAccessIntentSenderAsUser(mAccount, packageName, mUserHandle);
if (intent != null) {
try {
startIntentSenderForResult(intent, uid, null, 0, 0, 0, null);
return true;
} catch (IntentSender.SendIntentException e) {
Log.e(TAG, "Error requesting account access", e);
}
}
}
return false;
}
use of android.content.IntentSender in project VirtualApp by asLody.
the class VPackageInstallerService method uninstall.
@Override
public void uninstall(String packageName, String callerPackageName, int flags, IntentSender statusReceiver, int userId) throws RemoteException {
boolean success = VAppManagerService.get().uninstallPackage(packageName);
if (statusReceiver != null) {
final Intent fillIn = new Intent();
fillIn.putExtra(PackageInstaller.EXTRA_PACKAGE_NAME, packageName);
fillIn.putExtra(PackageInstaller.EXTRA_STATUS, success ? PackageInstaller.STATUS_SUCCESS : PackageInstaller.STATUS_FAILURE);
fillIn.putExtra(PackageInstaller.EXTRA_STATUS_MESSAGE, PackageHelper.deleteStatusToString(success));
fillIn.putExtra("android.content.pm.extra.LEGACY_STATUS", success ? 1 : -1);
try {
statusReceiver.sendIntent(mContext, 0, fillIn, null, null);
} catch (IntentSender.SendIntentException e) {
e.printStackTrace();
}
}
}
Aggregations