void logIfOutboundPass(final String tag, final Intent intent, final @Nullable String target_pkg, final CondomEvent event) { if (target_pkg != null && ! mBase.getPackageName().equals(target_pkg)) log(tag, event, target_pkg, intent.toString()); }
public static void sendIntentExplicitly(Context context, Intent intent) throws ShortcutBadgeException { List<ResolveInfo> resolveInfos = resolveBroadcast(context, intent); if (resolveInfos.size() == 0) { throw new ShortcutBadgeException("unable to resolve intent: " + intent.toString()); } for (ResolveInfo info : resolveInfos) { Intent actualIntent = new Intent(intent); if (info != null) { actualIntent.setPackage(info.resolvePackageName); context.sendBroadcast(actualIntent); } } }
public class NetworkService extends IntentService { Handler mMainThreadHandler = null; public NetworkService() { super(NetworkService.class.getName()); mMainThreadHandler = new Handler(); } @Override protected void onHandleIntent(Intent arg) { System.out.printf("Network service intent handling: %s\n", arg.toString()); mMainThreadHandler.post(new Runnable() { @Override public void run() { Toast.makeText(getApplicationContext(), "BusyBox updated", Toast.LENGTH_LONG).show(); } }); } }
@Override public int onStartCommand(Intent intent, int flags, int startId) { LogManager.i(TAG, intent == null ? "starting with null intent" : "starting with intent " + intent.toString() ); return super.onStartCommand(intent, flags, startId); }
@Override public boolean onControlRequest(Intent i, ControlRequestCallback cb) { if (i.hasCategory(MediaControlIntent.CATEGORY_REMOTE_PLAYBACK)) { if (MediaControlIntent.ACTION_PLAY.equals(i.getAction())) { return(onPlayRequest(i, cb)); } else if (MediaControlIntent.ACTION_PAUSE.equals(i.getAction())) { return(onPauseRequest(i, cb)); } else if (MediaControlIntent.ACTION_RESUME.equals(i.getAction())) { return(onResumeRequest(i, cb)); } else if (MediaControlIntent.ACTION_STOP.equals(i.getAction())) { return(onStopRequest(i, cb)); } else if (MediaControlIntent.ACTION_GET_STATUS.equals(i.getAction())) { return(onGetStatusRequest(i, cb)); } else if (MediaControlIntent.ACTION_SEEK.equals(i.getAction())) { return(onSeekRequest(i, cb)); } } Log.w(getClass().getSimpleName(), "unexpected control request" + i.toString()); return(false); }
@Override public boolean onControlRequest(Intent i, ControlRequestCallback cb) { if (i.hasCategory(MediaControlIntent.CATEGORY_REMOTE_PLAYBACK)) { if (MediaControlIntent.ACTION_PLAY.equals(i.getAction())) { return(onPlayRequest(i, cb)); } else if (MediaControlIntent.ACTION_PAUSE.equals(i.getAction())) { return(onPauseRequest(i, cb)); } else if (MediaControlIntent.ACTION_RESUME.equals(i.getAction())) { return(onResumeRequest(i, cb)); } else if (MediaControlIntent.ACTION_STOP.equals(i.getAction())) { return(onStopRequest(i, cb)); } else if (MediaControlIntent.ACTION_GET_STATUS.equals(i.getAction())) { return(onGetStatusRequest(i, cb)); } else if (MediaControlIntent.ACTION_SEEK.equals(i.getAction())) { return(onSeekRequest(i, cb)); } } Log.w(getClass().getSimpleName(), "unexpected control request" + i.toString()); return(false); }
@Override public void executeBadge(Context context, ComponentName componentName, int badgeCount) throws ShortcutBadgeException { Intent intent1 = new Intent(INTENT_SET_NOTIFICATION); boolean intent1Success; intent1.putExtra(EXTRA_COMPONENT, componentName.flattenToShortString()); intent1.putExtra(EXTRA_COUNT, badgeCount); Intent intent = new Intent(INTENT_UPDATE_SHORTCUT); boolean intentSuccess; intent.putExtra(PACKAGENAME, componentName.getPackageName()); intent.putExtra(COUNT, badgeCount); try { BroadcastHelper.sendIntentExplicitly(context, intent1); intent1Success = true; } catch (ShortcutBadgeException e) { intent1Success = false; } try { BroadcastHelper.sendIntentExplicitly(context, intent); intentSuccess = true; } catch (ShortcutBadgeException e) { intentSuccess = false; } if (!intent1Success && !intentSuccess) { throw new ShortcutBadgeException("unable to resolve intent: " + intent.toString()); } }
@Nullable ResolveInfo filterCandidates(final OutboundType type, final Intent original_intent, final @Nullable List<ResolveInfo> candidates, final String tag, final boolean remove) { if (candidates == null || candidates.isEmpty()) return null; final int my_uid = Process.myUid(); BackgroundUidFilter bg_uid_filter = null; ResolveInfo match = null; for (final Iterator<ResolveInfo> iterator = candidates.iterator(); iterator.hasNext(); match = null) { final ResolveInfo candidate = iterator.next(); final ApplicationInfo app_info = candidate.serviceInfo.applicationInfo; final int uid = app_info.uid; if (uid == my_uid) match = candidate; // Self UID is always allowed else if (mOutboundJudge == null || mOutboundJudge.shouldAllow(type, original_intent, app_info.packageName)) { if (mExcludeBackgroundServices) { if (bg_uid_filter == null) bg_uid_filter = new BackgroundUidFilter(); if (bg_uid_filter.isUidNotBackground(uid)) match = candidate; } else match = candidate; } if (match == null) log(tag, CondomEvent.FILTER_BG_SERVICE, app_info.packageName, original_intent.toString()); if (mDryRun) return candidate; // Always touch nothing and return the first candidate in dry-run mode. if (remove) { if (match == null) iterator.remove(); } else if (match != null) return match; } return null; }
/** * if mContentIntent is null delete our notification, * else assign it to the notification onClick */ private void finishNotification() { if(mContentIntent==null){ Logger.debug("deleting notifications"); mNotificationManager.cancel(NOTIFICATION_ID); } else { Logger.debug("assign '"+mContentIntent.toString()+"'to notification"); mBuilder.setContentIntent(PendingIntent.getActivity(this, CLICK_CODE, mContentIntent, 0)) .setProgress(0,0,false) .setAutoCancel(true) .setDeleteIntent(PendingIntent.getActivity(this, 0, new Intent(), 0)) .setChannelId(getBaseContext().getString(R.string.csploitChannelId)); mNotificationManager.notify(NOTIFICATION_ID, mBuilder.build()); } if(mReceiver!=null) unregisterReceiver(mReceiver); mReceiver = null; mBuilder = null; mNotificationManager = null; }
private boolean openFileChooserAboveL(WebView webView, ValueCallback<Uri[]> valueCallbacks, FileChooserParams fileChooserParams) { LogUtils.i(TAG, "fileChooserParams:" + fileChooserParams.getAcceptTypes() + " getTitle:" + fileChooserParams.getTitle() + " accept:" + Arrays.toString(fileChooserParams.getAcceptTypes()) + " length:" + fileChooserParams.getAcceptTypes().length + " :" + fileChooserParams.isCaptureEnabled() + " " + fileChooserParams.getFilenameHint() + " intent:" + fileChooserParams.createIntent().toString() + " mode:" + fileChooserParams.getMode()); Activity mActivity = this.mActivityWeakReference.get(); if (mActivity == null || mActivity.isFinishing()) { return false; } return AgentWebUtils.showFileChooserCompat(mActivity, mWebView, valueCallbacks, fileChooserParams, this.mPermissionInterceptor, null, null, null ); }
/** * if mContentIntent is null delete our notification, * else assign it to the notification onClick */ private void finishNotification() { boolean errorOccurred; Intent contentIntent; errorOccurred = mCurrentTask.errorOccurred; contentIntent = mCurrentTask.haveIntent() ? mCurrentTask.buildIntent() : null; if(errorOccurred || contentIntent==null){ Logger.debug("deleting notifications"); if(mNotificationManager!=null) mNotificationManager.cancel(NOTIFICATION_ID); } else { Logger.debug("assign '"+contentIntent.toString()+"' to notification"); if(mBuilder!=null&&mNotificationManager!=null) { mBuilder.setContentIntent(PendingIntent.getActivity(this, DOWNLOAD_COMPLETE_CODE, contentIntent, 0)) .setChannelId(getBaseContext().getString(R.string.csploitChannelId)); mNotificationManager.notify(NOTIFICATION_ID, mBuilder.build()); } } if(mReceiver!=null) unregisterReceiver(mReceiver); mReceiver = null; mBuilder = null; mNotificationManager = null; }
setContentView(R.layout.progress_bar); Intent intent = getIntent(); Timber.v(intent.toString()); Intent reloadIntent = new Intent(this, DeckPicker.class); reloadIntent.setDataAndType(getIntent().getData(), getIntent().getType());
@Override public void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); Log.d("Activity result"," "+requestCode+" "+resultCode+" "+data.toString()); Session.getActiveSession().onActivityResult(this, requestCode, resultCode, data); }
assertEquals("Condom." + TAG, data[1]); assertEquals(intent.getPackage(), data[2]); assertEquals(intent.toString(), data[3]); assertEquals("Condom." + TAG, data[1]); assertEquals(intent.getPackage(), data[2]); assertEquals(intent.toString(), data[3]); assertEquals("Condom." + TAG, data[1]); assertEquals("bg.service.1", data[2]); final String expected_intent = new Intent(intent).toString(); // Flags altered assertEquals(expected_intent, data[3]); data = (Object[]) events.get(1).getData(); assertEquals("Condom", data[1]); assertEquals(intent.getComponent().getPackageName(), data[2]); assertEquals(intent.toString(), data[3]); assertEquals("Condom", data[1]); assertEquals(intent.getComponent().getPackageName(), data[2]); assertEquals(intent.toString(), data[3]);
void logIfOutboundPass(final String tag, final Intent intent, final @Nullable String target_pkg, final CondomEvent event) { if (target_pkg != null && ! mBase.getPackageName().equals(target_pkg)) log(tag, event, target_pkg, intent.toString()); }
@Nullable ResolveInfo filterCandidates(final OutboundType type, final Intent original_intent, final @Nullable List<ResolveInfo> candidates, final String tag, final boolean remove) { if (candidates == null || candidates.isEmpty()) return null; final int my_uid = Process.myUid(); BackgroundUidFilter bg_uid_filter = null; ResolveInfo match = null; for (final Iterator<ResolveInfo> iterator = candidates.iterator(); iterator.hasNext(); match = null) { final ResolveInfo candidate = iterator.next(); final ApplicationInfo app_info = candidate.serviceInfo.applicationInfo; final int uid = app_info.uid; if (uid == my_uid) match = candidate; // Self UID is always allowed else if (mOutboundJudge == null || mOutboundJudge.shouldAllow(type, original_intent, app_info.packageName)) { if (mExcludeBackgroundServices) { if (bg_uid_filter == null) bg_uid_filter = new BackgroundUidFilter(); if (bg_uid_filter.isUidNotBackground(uid)) match = candidate; } else match = candidate; } if (match == null) log(tag, CondomEvent.FILTER_BG_SERVICE, app_info.packageName, original_intent.toString()); if (mDryRun) return candidate; // Always touch nothing and return the first candidate in dry-run mode. if (remove) { if (match == null) iterator.remove(); } else if (match != null) return match; } return null; }
LogUtil.v("未匹配到插件Intent, 说明目标不是插件,也可能是插件未正确安装", packageName, intent.toString()); } else { LogUtil.v(packageName, "插件Intent匹配成功");
String orignalIntent = intent.toString(); throw new ClassNotFoundException("className : " + className + ", intent : " + intent.toString(), new Throwable()); ", currentCl : " + cl.toString() + ", currentClassName : " + className + ", currentIntent : " + intent.toString() + ", process : " + ProcessUtil.isPluginProcess() + ", isStubActivity : " + PluginManagerProviderClient.isStub(orginalClassName) +
assertEquals("Condom." + TAG, data[1]); assertEquals(intent.getPackage(), data[2]); assertEquals(intent.toString(), data[3]); assertEquals("Condom." + TAG, data[1]); assertEquals(intent.getPackage(), data[2]); assertEquals(intent.toString(), data[3]); assertEquals("Condom." + TAG, data[1]); assertEquals("bg.service.1", data[2]); final String expected_intent = new Intent(intent).toString(); // Flags altered assertEquals(expected_intent, data[3]); data = (Object[]) events.get(1).getData(); assertEquals("Condom", data[1]); assertEquals(intent.getComponent().getPackageName(), data[2]); assertEquals(intent.toString(), data[3]); assertEquals("Condom", data[1]); assertEquals(intent.getComponent().getPackageName(), data[2]); assertEquals(intent.toString(), data[3]);
@Override public boolean activityStarting(Intent intent, String pkg) throws RemoteException { Log.v(TAG, "activityStarting: " + pkg + " " + intent.toString()); // allow all activities to start return true; }