String pkg = component.getPackageName(); Intent newShortcutIntent = new Intent(); newShortcutIntent.setClassName(getHostPkg(), Constants.SHORTCUT_PROXY_ACTIVITY_NAME); newShortcutIntent.addCategory(Intent.CATEGORY_DEFAULT); newShortcutIntent.putExtra("_VA_|_intent_", shortcut); if (icon != null && !TextUtils.equals(icon.packageName, getHostPkg())) { try { Resources resources = VirtualCore.get().getResources(pkg);
private void handleUninstallShortcutIntent(Intent intent) { Intent shortcut = intent.getParcelableExtra(Intent.EXTRA_SHORTCUT_INTENT); if (shortcut != null) { ComponentName componentName = shortcut.resolveActivity(getPM()); if (componentName != null) { Intent newShortcutIntent = new Intent(); newShortcutIntent.putExtra("_VA_|_uri_", shortcut.toUri(0)); newShortcutIntent.setClassName(getHostPkg(), Constants.SHORTCUT_PROXY_ACTIVITY_NAME); newShortcutIntent.removeExtra(Intent.EXTRA_SHORTCUT_INTENT); intent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, newShortcutIntent); } } }
private Intent handleIntent(final Intent intent) { final String action = intent.getAction(); if ("android.intent.action.CREATE_SHORTCUT".equals(action) || "com.android.launcher.action.INSTALL_SHORTCUT".equals(action)) { return VASettings.ENABLE_INNER_SHORTCUT ? handleInstallShortcutIntent(intent) : null; } else if ("com.android.launcher.action.UNINSTALL_SHORTCUT".equals(action)) { handleUninstallShortcutIntent(intent); } else if (BadgerManager.handleBadger(intent)) { return null; } else if (Intent.ACTION_MEDIA_SCANNER_SCAN_FILE.equals(action)) { // intent send to system, do not modify it's action(may have other same intent) return handleMediaScannerIntent(intent); } else { return ComponentUtils.redirectBroadcastIntent(intent, VUserHandle.myUserId()); } return intent; }
String pkg = component.getPackageName(); Intent newShortcutIntent = new Intent(); newShortcutIntent.setClassName(getHostPkg(), Constants.SHORTCUT_PROXY_ACTIVITY_NAME); newShortcutIntent.addCategory(Intent.CATEGORY_DEFAULT); newShortcutIntent.putExtra("_VA_|_intent_", shortcut); if (icon != null && !TextUtils.equals(icon.packageName, getHostPkg())) { try { Resources resources = VirtualCore.get().getResources(pkg);
String pkg = component.getPackageName(); Intent newShortcutIntent = new Intent(); newShortcutIntent.setClassName(getHostPkg(), Constants.SHORTCUT_PROXY_ACTIVITY_NAME); newShortcutIntent.addCategory(Intent.CATEGORY_DEFAULT); newShortcutIntent.putExtra("_VA_|_intent_", shortcut); if (icon != null && !TextUtils.equals(icon.packageName, getHostPkg())) { try { Resources resources = VirtualCore.get().getResources(pkg);
@Override public Object call(Object who, Method method, Object... args) throws Throwable { Intent intent = (Intent) args[1]; String type = (String) args[2]; intent.setDataAndType(intent.getData(), type); if (VirtualCore.get().getComponentDelegate() != null) { VirtualCore.get().getComponentDelegate().onSendBroadcast(intent); } Intent newIntent = handleIntent(intent); if (newIntent != null) { args[1] = newIntent; } else { return 0; } if (args[7] instanceof String || args[7] instanceof String[]) { // clear the permission args[7] = null; } return method.invoke(who, args); }
@Override public Object call(Object who, Method method, Object... args) throws Throwable { Intent intent = (Intent) args[1]; String type = (String) args[2]; intent.setDataAndType(intent.getData(), type); if (VirtualCore.get().getComponentDelegate() != null) { VirtualCore.get().getComponentDelegate().onSendBroadcast(intent); } Intent newIntent = handleIntent(intent); if (newIntent != null) { args[1] = newIntent; } else { return 0; } if (args[7] instanceof String || args[7] instanceof String[]) { // clear the permission args[7] = null; } return method.invoke(who, args); }
private Intent handleIntent(final Intent intent) { final String action = intent.getAction(); if ("android.intent.action.CREATE_SHORTCUT".equals(action) || "com.android.launcher.action.INSTALL_SHORTCUT".equals(action)) { return VASettings.ENABLE_INNER_SHORTCUT ? handleInstallShortcutIntent(intent) : null; } else if ("com.android.launcher.action.UNINSTALL_SHORTCUT".equals(action)) { handleUninstallShortcutIntent(intent); } else if (BadgerManager.handleBadger(intent)) { return null; } else if (Intent.ACTION_MEDIA_SCANNER_SCAN_FILE.equals(action)) { // intent send to system, do not modify it's action(may have other same intent) return handleMediaScannerIntent(intent); } else { return ComponentUtils.redirectBroadcastIntent(intent, VUserHandle.myUserId()); } return intent; }
@Override public boolean isEnable() { return isAppProcess(); } }
private void handleUninstallShortcutIntent(Intent intent) { Intent shortcut = intent.getParcelableExtra(Intent.EXTRA_SHORTCUT_INTENT); if (shortcut != null) { ComponentName componentName = shortcut.resolveActivity(getPM()); if (componentName != null) { Intent newShortcutIntent = new Intent(); newShortcutIntent.putExtra("_VA_|_uri_", shortcut.toUri(0)); newShortcutIntent.setClassName(getHostPkg(), Constants.SHORTCUT_PROXY_ACTIVITY_NAME); newShortcutIntent.removeExtra(Intent.EXTRA_SHORTCUT_INTENT); intent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, newShortcutIntent); } } }
private Intent handleIntent(final Intent intent) { final String action = intent.getAction(); if ("android.intent.action.CREATE_SHORTCUT".equals(action) || "com.android.launcher.action.INSTALL_SHORTCUT".equals(action)) { return VASettings.ENABLE_INNER_SHORTCUT ? handleInstallShortcutIntent(intent) : null; } else if ("com.android.launcher.action.UNINSTALL_SHORTCUT".equals(action)) { handleUninstallShortcutIntent(intent); } else if (BadgerManager.handleBadger(intent)) { return null; } else { return ComponentUtils.redirectBroadcastIntent(intent, VUserHandle.myUserId()); } return intent; }
private void handleUninstallShortcutIntent(Intent intent) { Intent shortcut = intent.getParcelableExtra(Intent.EXTRA_SHORTCUT_INTENT); if (shortcut != null) { ComponentName componentName = shortcut.resolveActivity(getPM()); if (componentName != null) { Intent newShortcutIntent = new Intent(); newShortcutIntent.putExtra("_VA_|_uri_", shortcut.toUri(0)); newShortcutIntent.setClassName(getHostPkg(), Constants.SHORTCUT_PROXY_ACTIVITY_NAME); newShortcutIntent.removeExtra(Intent.EXTRA_SHORTCUT_INTENT); intent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, newShortcutIntent); } } }
@Override public boolean isEnable() { return isAppProcess(); } }
@Override public Object call(Object who, Method method, Object... args) throws Throwable { Intent intent = (Intent) args[1]; String type = (String) args[2]; intent.setDataAndType(intent.getData(), type); if (VirtualCore.get().getComponentDelegate() != null) { VirtualCore.get().getComponentDelegate().onSendBroadcast(intent); } Intent newIntent = handleIntent(intent); if (newIntent != null) { args[1] = newIntent; } else { return 0; } if (args[7] instanceof String || args[7] instanceof String[]) { // clear the permission args[7] = null; } return method.invoke(who, args); }
@Override public boolean isEnable() { return isAppProcess(); } }