@Override public void startListening() { try { super.startListening(); } catch (Exception e) { if (e.getCause() instanceof TransactionTooLargeException || e.getCause() instanceof DeadObjectException) { // We're willing to let this slide. The exception is being caused by the list of // RemoteViews which is being passed back. The startListening relationship will // have been established by this point, and we will end up populating the // widgets upon bind anyway. See issue 14255011 for more context. } else { throw new RuntimeException(e); } } }
@Override public void startListening() { try { super.startListening(); } catch (Exception e) { //noinspection StatementWithEmptyBody if (e.getCause() instanceof TransactionTooLargeException) { // We're willing to let this slide. The exception is being caused by the list of // RemoteViews which is being passed back. The startListening relationship will // have been established by this point, and we will end up populating the // widgets upon bind anyway. See issue 14255011 for more context. } else { throw new RuntimeException(e); } } }
/** * Given an exception, check whether it wrapped a {@link TransactionTooLargeException}. If it * does, then log the underlying error. If not, throw the original exception again. * * @param e The caught RuntimeException. * @param intent The intent that triggered the RuntimeException to be thrown. */ public static void logTransactionTooLargeOrRethrow(RuntimeException e, Intent intent) { // See http://crbug.com/369574. if (e.getCause() instanceof TransactionTooLargeException) { Log.e(TAG, "Could not resolve Activity for intent " + intent.toString(), e); } else { throw e; } }
public ComponentName startService(IApplicationThread caller, Intent service, String resolvedType, String callingPackage, int userId) throws TransactionTooLargeException { try { PreventRunningUtils.setSender(caller); if (PreventRunningUtils.hookStartService(caller, service)) { return startService$Pr(caller, service, resolvedType, callingPackage, userId); } return null; } finally { PreventRunningUtils.clearSender(); } }
public int bindService(IApplicationThread caller, IBinder token, Intent service, String resolvedType, IServiceConnection connection, int flags, String callingPackage, int userId) throws TransactionTooLargeException { try { PreventRunningUtils.setSender(caller); if (PreventRunningUtils.hookBindService(caller, token, service)) { return bindService$Pr(caller, token, service, resolvedType, connection, flags, callingPackage, userId); } else { return 0; } } finally { PreventRunningUtils.clearSender(); } }
public WidgetsModel updateAndClone(Context context) { Preconditions.assertWorkerThread(); try { final ArrayList<WidgetItem> widgetsAndShortcuts = new ArrayList<>(); // Widgets AppWidgetManagerCompat widgetManager = AppWidgetManagerCompat.getInstance(context); for (AppWidgetProviderInfo widgetInfo : widgetManager.getAllProviders()) { widgetsAndShortcuts.add(new WidgetItem( LauncherAppWidgetProviderInfo.fromProviderInfo(context, widgetInfo), widgetManager)); } // Shortcuts PackageManager pm = context.getPackageManager(); for (ResolveInfo info : pm.queryIntentActivities(new Intent(Intent.ACTION_CREATE_SHORTCUT), 0)) { widgetsAndShortcuts.add(new WidgetItem(info, pm)); } setWidgetsAndShortcuts(widgetsAndShortcuts); } catch (Exception e) { if (!ProviderConfig.IS_DOGFOOD_BUILD && (e.getCause() instanceof TransactionTooLargeException || e.getCause() instanceof DeadObjectException)) { // the returned value may be incomplete and will not be refreshed until the next // time Launcher starts. // TODO: after figuring out a repro step, introduce a dirty bit to check when // onResume is called to refresh the widget provider list. } else { throw e; } } return clone(); }
@Override public void startListening() { try { super.startListening(); } catch (Exception e) { if (e.getCause() instanceof TransactionTooLargeException) { // We're willing to let this slide. The exception is being caused by the list of // RemoteViews which is being passed back. The startListening relationship will // have been established by this point, and we will end up populating the // widgets upon bind anyway. See issue 14255011 for more context. } else { throw new RuntimeException(e); } } }
private static void logTransactionTooLargeOrRethrow(RuntimeException e, Intent intent) { // See http://crbug.com/369574. if (e.getCause() instanceof TransactionTooLargeException) { Log.e(TAG, "Could not resolve Activity for intent " + intent.toString(), e); } else { throw e; } }
/** * アプリ一覧からデバイスプラグイン一覧を作成する. * * @throws PluginDetectionException アプリケーション一覧のサイズが大きすぎて取得できなかった場合 */ public void createDevicePluginList() throws PluginDetectionException { PackageManager pkgMgr = mContext.getPackageManager(); Map<String, List<DevicePlugin>> allPlugins; try { allPlugins = getInstalledPlugins(pkgMgr); } catch (Exception e) { PluginDetectionException.Reason reason; if (Build.VERSION.SDK_INT >= 15) { if (e.getClass() == TransactionTooLargeException.class) { reason = PluginDetectionException.Reason.TOO_MANY_PACKAGES; } else { reason = PluginDetectionException.Reason.OTHER; } } else { reason = PluginDetectionException.Reason.OTHER; } throw new PluginDetectionException(e, reason); } for (Map.Entry<String, List<DevicePlugin>> entry : allPlugins.entrySet()) { List<DevicePlugin> pluginListPerPackage = entry.getValue(); // 重複したプラグインを除外 for (DevicePlugin plugin : filterPlugin(pluginListPerPackage)) { mPlugins.put(plugin.getPluginId(), plugin); notifyFound(plugin); } } }
public WidgetsModel updateAndClone(Context context) { Utilities.assertWorkerThread(); try { final ArrayList<Object> widgetsAndShortcuts = new ArrayList<>(); // Widgets for (AppWidgetProviderInfo widgetInfo : AppWidgetManagerCompat.getInstance(context).getAllProviders()) { widgetsAndShortcuts.add(LauncherAppWidgetProviderInfo .fromProviderInfo(context, widgetInfo)); } // Shortcuts widgetsAndShortcuts.addAll(context.getPackageManager().queryIntentActivities( new Intent(Intent.ACTION_CREATE_SHORTCUT), 0)); setWidgetsAndShortcuts(widgetsAndShortcuts); } catch (Exception e) { if (!LauncherAppState.isDogfoodBuild() && (e.getCause() instanceof TransactionTooLargeException || e.getCause() instanceof DeadObjectException)) { // the returned value may be incomplete and will not be refreshed until the next // time Launcher starts. // TODO: after figuring out a repro step, introduce a dirty bit to check when // onResume is called to refresh the widget provider list. } else { throw e; } } return clone(); }
public static boolean isBinderSizeError(Exception e) { return e.getCause() instanceof TransactionTooLargeException || e.getCause() instanceof DeadObjectException; }
public ComponentName startService$Pr(IApplicationThread caller, Intent service, String resolvedType, String callingPackage, int userId) throws TransactionTooLargeException { throw new UnsupportedOperationException(); }
public int bindService$Pr(IApplicationThread caller, IBinder token, Intent service, String resolvedType, IServiceConnection connection, int flags, String callingPackage, int userId) throws TransactionTooLargeException { throw new UnsupportedOperationException(); }
public static void bug(XHook hook, Throwable ex) { if (ex instanceof InvocationTargetException) { InvocationTargetException exex = (InvocationTargetException) ex; if (exex.getTargetException() != null) ex = exex.getTargetException(); } int priority; if (ex instanceof ActivityShare.AbortException) priority = Log.WARN; else if (ex instanceof ActivityShare.ServerException) priority = Log.WARN; else if (ex instanceof ConnectTimeoutException) priority = Log.WARN; else if (ex instanceof FileNotFoundException) priority = Log.WARN; else if (ex instanceof HttpHostConnectException) priority = Log.WARN; else if (ex instanceof NameNotFoundException) priority = Log.WARN; else if (ex instanceof NoClassDefFoundError) priority = Log.WARN; else if (ex instanceof OutOfMemoryError) priority = Log.WARN; else if (ex instanceof RuntimeException) priority = Log.WARN; else if (ex instanceof SecurityException) priority = Log.WARN; else if (ex instanceof SocketTimeoutException) priority = Log.WARN; else if (ex instanceof SSLPeerUnverifiedException) priority = Log.WARN; else if (ex instanceof StackOverflowError) priority = Log.WARN; else if (ex instanceof TransactionTooLargeException) priority = Log.WARN; else if (ex instanceof UnknownHostException) priority = Log.WARN; else if (ex instanceof UnsatisfiedLinkError) priority = Log.WARN; else priority = Log.ERROR; boolean xprivacy = false; for (StackTraceElement frame : ex.getStackTrace()) if (frame.getClassName() != null && frame.getClassName().startsWith("biz.bokhorst.xprivacy")) { xprivacy = true; break; } if (!xprivacy) priority = Log.WARN; log(hook, priority, ex.toString() + " uid=" + Process.myUid() + "\n" + Log.getStackTraceString(ex)); }