ArrayList<Intent> getIntents() { ArrayList<Intent> intentList = new ArrayList<>(); for (WeakReference<Activity> activityWeakReference : mRunningActivities) { if (activityWeakReference == null) continue; Activity tmpActivity = activityWeakReference.get(); if (tmpActivity == null) continue; intentList.add((Intent) tmpActivity.getIntent().clone()); } return intentList; }
private static Intent actionIntent(Context context, Intent notificationIntent, Message message, int index) { Intent intent; if (notificationIntent == null) { intent = context.getPackageManager().getLaunchIntentForPackage(context.getPackageName()); } else { intent = (Intent) notificationIntent.clone(); } Bundle bundle = new Bundle(); bundle.putParcelable(EXTRA_MESSAGE, message); intent.putExtra(EXTRA_MESSAGE, bundle); intent.putExtra(EXTRA_ACTION_INDEX, index); return intent; }
@Override public void onReceive(Context context, Intent intent) { context.unregisterReceiver(this); PowerManager pm = (PowerManager)context.getSystemService(Context.POWER_SERVICE); PowerManager.WakeLock wakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "MMS DownloadReceiver"); wakeLock.acquire(60 * 1000); Intent newIntent = (Intent) intent.clone(); newIntent.setAction(MmsReceivedReceiver.MMS_RECEIVED); BroadcastUtils.sendExplicitBroadcast(context, newIntent, MmsReceivedReceiver.MMS_RECEIVED); } }
ArrayList<Intent> getIntents() { ArrayList<Intent> intentList = new ArrayList<>(); for (WeakReference<Activity> activityWeakReference : mRunningActivities) { if (activityWeakReference == null) continue; Activity tmpActivity = activityWeakReference.get(); if (tmpActivity == null) continue; intentList.add((Intent) tmpActivity.getIntent().clone()); } return intentList; }
public Intent generateTorrentIntent(Context context, String action, Intent intent) { final PackageManager packageManager = context.getPackageManager(); List<ResolveInfo> resolveInfo = packageManager.queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY); if (resolveInfo.size() > 0) { List<Intent> targetedShareIntents = new ArrayList<Intent>(); for (ResolveInfo r : resolveInfo) { Intent progIntent = (Intent)intent.clone(); String packageName = r.activityInfo.packageName; progIntent.setPackage(packageName); if (r.activityInfo.packageName.contains("torrent")) targetedShareIntents.add(progIntent); } if (targetedShareIntents.size() > 0) { Intent chooserIntent = Intent.createChooser(targetedShareIntents.remove(0), "Select app to share"); chooserIntent.putExtra(Intent.EXTRA_INITIAL_INTENTS, targetedShareIntents.toArray(new Parcelable[] {})); return chooserIntent; } } return null; }
/** * Search and return filtered intent from all of activities * * @param context * @param intent * @param filter * @return */ public static Intent filter(Context context, Intent intent, String filter) { if(context == null || intent == null) { return null; } List<ResolveInfo> resInfos = context.getPackageManager().queryIntentActivities(intent, 0); if(resInfos == null || resInfos.isEmpty()) { return null; } Intent resultIntent = (Intent)intent.clone(); ActivityInfo activityInfo; for (ResolveInfo info : resInfos) { activityInfo = info.activityInfo; if (activityInfo.packageName.toLowerCase().contains(filter) || activityInfo.name.toLowerCase().contains(filter) ) { resultIntent.setComponent(new ComponentName(activityInfo.packageName, activityInfo.name)); return resultIntent; } } return null; }
private static Intent screenshotPermission = null; protected static void getScreenshotPermission() { try { if (hasScreenshotPermission()) { if(null != mediaProjection) { mediaProjection.stop(); mediaProjection = null; } mediaProjection = mediaProjectionManager.getMediaProjection(Activity.RESULT_OK, (Intent) screenshotPermission.clone()); } else { openScreenshotPermissionRequester(); } } catch (final RuntimeException ignored) { openScreenshotPermissionRequester(); } } protected static void openScreenshotPermissionRequester(){ final Intent intent = new Intent(context, AcquireScreenshotPermissionIntent.class); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(intent); } protected static void setScreenshotPermission(final Intent permissionIntent) { screenshotPermission = permissionIntent; }
@RequiresApi(api = Build.VERSION_CODES.M) @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == REQUEST_MEDIA_PROJECTION) { if (resultCode != Activity.RESULT_OK) { Toast.makeText(this, R.string.toast_must_give_permission, Toast.LENGTH_SHORT).show(); if (mRecorderRunning) { stopScreenRecorder(); } setImageViews(false, true); return; } Log.i(TAG, "Starting screen capture"); startScreenRecorder(resultCode, (Intent) data.clone()); mRecorderRunning = true; } }
Intent targetedShareIntent = (Intent) prototype.clone(); targetedShareIntent.setPackage(metaInfo.get("packageName")); targetedShareIntent.setClassName(metaInfo.get("packageName"), metaInfo.get("className"));
Intent targetedShareIntent = (Intent) prototype.clone(); targetedShareIntent.setPackage(metaInfo.get("packageName")); targetedShareIntent.setClassName(metaInfo.get("packageName"), metaInfo.get("className"));
public int executeBatch(Intent... intents) { if(intents.length == 0) { return -1; } ArrayList<Intent> intentList = new ArrayList<Intent>(); Intent batchIntent = new Intent(OperationService.ACTION_BATCH); ComponentName c = intents[0].getComponent(); batchIntent.setClassName(c.getPackageName(), c.getClassName()); batchIntent.putExtra(OperationService.EXTRA_BRIDGE_MESSENGER, messenger); int id = createRequestId(); for(Intent intent : intents) { Intent clonedIntent = (Intent) intent.clone(); intentList.add(clonedIntent); } batchIntent.putExtra(OperationService.EXTRA_REQUEST_ID, id); batchIntent.putExtra(OperationService.EXTRA_BATCH, intentList); if(mPaused) { mPausedRequests.put(id, batchIntent); } else { mPendingRequests.put(id, batchIntent); Mechanoid.startService(batchIntent); } return id; }
Intent targetedShareIntent = (Intent) prototype.clone(); targetedShareIntent.setPackage(metaInfo.get("packageName")); targetedShareIntent.setClassName(
Intent targetedShareIntent = (Intent) prototype.clone(); targetedShareIntent.setPackage(metaInfo.get("packageName")); targetedShareIntent.setClassName(
Intent targetedShareIntent = (Intent) prototype.clone(); if (metaInfo.get("packageName").equals(CLIPBOARD)) { targetedShareIntent.setPackage(metaInfo.get("packageName"));
Intent clonedIntent = (Intent) intent.clone();
@RequiresApi(api = Build.VERSION_CODES.M) @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == REQUEST_INITIAL_SETUP){ if (resultCode == RESULT_OK){ if (!initIfConfigured()){ startSetup(); } } else { finish(); } return; } if (requestCode == REQUEST_MEDIA_PROJECTION) { if (resultCode != Activity.RESULT_OK) { Toast.makeText(this, R.string.toast_must_give_permission, Toast.LENGTH_SHORT).show(); if (mRecorderRunning) { stopScreenRecorder(); } setImageViews(false, true); return; } Log.i(TAG, "Starting screen capture"); startScreenRecorder(resultCode, (Intent) data.clone()); mRecorderRunning = true; } }
/** * Adds the apps, which are able to handle a specific intent, as items to the bottom sheet. This * causes all previously added items to be removed. When an item is clicked, the corresponding * app is started. * * @param activity * The activity, the bottom sheet belongs to, as an instance of the class {@link * Activity}. The activity may not be null * @param intent * The intent as an instance of the class {@link Intent}. The intent may not be null */ public final void setIntent(@NonNull final Activity activity, @NonNull final Intent intent) { Condition.INSTANCE.ensureNotNull(activity, "The activity may not be null"); Condition.INSTANCE.ensureNotNull(intent, "The intent may not be null"); removeAllItems(); PackageManager packageManager = activity.getPackageManager(); List<ResolveInfo> resolveInfos = packageManager.queryIntentActivities(intent, 0); for (int i = 0; i < resolveInfos.size(); i++) { ResolveInfo resolveInfo = resolveInfos.get(i); addItem(i, resolveInfo.loadLabel(packageManager), resolveInfo.loadIcon(packageManager)); } setOnItemClickListener( createIntentClickListener(activity, (Intent) intent.clone(), resolveInfos)); }
@Override public void run() { RecoveryStore.getInstance().putActivity(activity); Object o = activity.getIntent().clone(); RecoveryStore.getInstance().setIntent((Intent) o); } });
@Override public void run() { RecoveryStore.getInstance().putActivity(activity); Object o = activity.getIntent().clone(); RecoveryStore.getInstance().setIntent((Intent) o); } });
Intent actionIntent = (Intent) proxy.clone(); actionIntent.putExtra(CountlyMessaging.EXTRA_ACTION_INDEX, button.index); builder.addAction(0, button.title, PendingIntent.getActivity(getApplicationContext(), button.index, actionIntent, PendingIntent.FLAG_UPDATE_CURRENT));