类android.os.TransactionTooLargeException源码实例Demo

下面列出了怎么用android.os.TransactionTooLargeException的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: android_9.0.0_r45   文件: ActiveServices.java
final void performServiceRestartLocked(ServiceRecord r) {
    if (!mRestartingServices.contains(r)) {
        return;
    }
    if (!isServiceNeededLocked(r, false, false)) {
        // Paranoia: is this service actually needed?  In theory a service that is not
        // needed should never remain on the restart list.  In practice...  well, there
        // have been bugs where this happens, and bad things happen because the process
        // ends up just being cached, so quickly killed, then restarted again and again.
        // Let's not let that happen.
        Slog.wtf(TAG, "Restarting service that is not needed: " + r);
        return;
    }
    try {
        bringUpServiceLocked(r, r.intent.getIntent().getFlags(), r.createdFromFg, true, false);
    } catch (TransactionTooLargeException e) {
        // Ignore, it's been logged and nothing upstack cares.
    }
}
 
@Override
public void run() {
    // Tell activity manager we have been stopped.
    try {
        if (DEBUG_MEMORY_TRIM) Slog.v(TAG, "Reporting activity stopped: " + mActivity);
        // TODO(lifecycler): Use interface callback instead of AMS.
        ActivityManager.getService().activityStopped(
                mActivity.token, mState, mPersistentState, mDescription);
    } catch (RemoteException ex) {
        // Dump statistics about bundle to help developers debug
        final LogWriter writer = new LogWriter(Log.WARN, TAG);
        final IndentingPrintWriter pw = new IndentingPrintWriter(writer, "  ");
        pw.println("Bundle stats:");
        Bundle.dumpStats(pw, mState);
        pw.println("PersistableBundle stats:");
        Bundle.dumpStats(pw, mPersistentState);

        if (ex instanceof TransactionTooLargeException
                && mActivity.packageInfo.getTargetSdkVersion() < Build.VERSION_CODES.N) {
            Log.e(TAG, "App sent too much data in instance state, so it was ignored", ex);
            return;
        }
        throw ex.rethrowFromSystemServer();
    }
}
 
源代码3 项目: AcDisplay   文件: MyAppWidgetHost.java
@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);
        }
    }
}
 
源代码4 项目: android_9.0.0_r45   文件: ActiveServices.java
ComponentName startServiceInnerLocked(ServiceMap smap, Intent service, ServiceRecord r,
        boolean callerFg, boolean addToStarting) throws TransactionTooLargeException {
    ServiceState stracker = r.getTracker();
    if (stracker != null) {
        stracker.setStarted(true, mAm.mProcessStats.getMemFactorLocked(), r.lastActivity);
    }
    r.callStart = false;
    synchronized (r.stats.getBatteryStats()) {
        r.stats.startRunningLocked();
    }
    String error = bringUpServiceLocked(r, service.getFlags(), callerFg, false, false);
    if (error != null) {
        return new ComponentName("!!", error);
    }

    if (r.startRequested && addToStarting) {
        boolean first = smap.mStartingBackground.size() == 0;
        smap.mStartingBackground.add(r);
        r.startingBgTimeout = SystemClock.uptimeMillis() + mAm.mConstants.BG_START_TIMEOUT;
        if (DEBUG_DELAYED_SERVICE) {
            RuntimeException here = new RuntimeException("here");
            here.fillInStackTrace();
            Slog.v(TAG_SERVICE, "Starting background (first=" + first + "): " + r, here);
        } else if (DEBUG_DELAYED_STARTS) {
            Slog.v(TAG_SERVICE, "Starting background (first=" + first + "): " + r);
        }
        if (first) {
            smap.rescheduleDelayedStartsLocked();
        }
    } else if (callerFg || r.fgRequired) {
        smap.ensureNotStartingBackgroundLocked(r);
    }

    return r.name;
}
 
源代码5 项目: android_9.0.0_r45   文件: ActiveServices.java
private final void requestServiceBindingsLocked(ServiceRecord r, boolean execInFg)
        throws TransactionTooLargeException {
    for (int i=r.bindings.size()-1; i>=0; i--) {
        IntentBindRecord ibr = r.bindings.valueAt(i);
        if (!requestServiceBindingLocked(r, ibr, execInFg, false)) {
            break;
        }
    }
}
 
源代码6 项目: alpha-wallet-android   文件: ConfirmationRouter.java
public void open(Activity context, Web3Transaction transaction, String networkName, String requesterURL, int chainId) throws TransactionTooLargeException
{
    Intent intent = new Intent(context, ConfirmationActivity.class);
    intent.putExtra(C.EXTRA_WEB3TRANSACTION, transaction);
    intent.putExtra(C.EXTRA_AMOUNT, Convert.fromWei(transaction.value.toString(10), Convert.Unit.WEI).toString());
    intent.putExtra(C.TOKEN_TYPE, ConfirmationType.WEB3TRANSACTION.ordinal());
    intent.putExtra(C.EXTRA_NETWORK_NAME, networkName);
    intent.putExtra(C.EXTRA_ACTION_NAME, requesterURL);
    intent.putExtra(C.EXTRA_NETWORKID, chainId);
    intent.setFlags(Intent.FLAG_ACTIVITY_MULTIPLE_TASK);
    context.startActivityForResult(intent, C.REQUEST_TRANSACTION_CALLBACK);
}
 
源代码7 项目: prevent   文件: ActivityManagerService.java
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();
    }
}
 
源代码8 项目: prevent   文件: ActivityManagerService.java
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();
    }
}
 
源代码9 项目: delion   文件: CustomTabDelegateFactory.java
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;
    }
}
 
源代码10 项目: delion   文件: ExternalNavigationDelegateImpl.java
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;
    }
}
 
源代码11 项目: AndroidChromium   文件: IntentUtils.java
/**
 * 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;
    }
}
 
/**
 * アプリ一覧からデバイスプラグイン一覧を作成する.
 *
 * @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)) {
            addDevicePlugin(plugin);
        }
    }
}
 
源代码13 项目: 365browser   文件: IntentUtils.java
/**
 * 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;
    }
}
 
源代码14 项目: LB-Launcher   文件: LauncherAppWidgetHost.java
@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);
        }
    }
}
 
源代码15 项目: android_9.0.0_r45   文件: ActiveServices.java
void unbindFinishedLocked(ServiceRecord r, Intent intent, boolean doRebind) {
    final long origId = Binder.clearCallingIdentity();
    try {
        if (r != null) {
            Intent.FilterComparison filter
                    = new Intent.FilterComparison(intent);
            IntentBindRecord b = r.bindings.get(filter);
            if (DEBUG_SERVICE) Slog.v(TAG_SERVICE, "unbindFinished in " + r
                    + " at " + b + ": apps="
                    + (b != null ? b.apps.size() : 0));

            boolean inDestroying = mDestroyingServices.contains(r);
            if (b != null) {
                if (b.apps.size() > 0 && !inDestroying) {
                    // Applications have already bound since the last
                    // unbind, so just rebind right here.
                    boolean inFg = false;
                    for (int i=b.apps.size()-1; i>=0; i--) {
                        ProcessRecord client = b.apps.valueAt(i).client;
                        if (client != null && client.setSchedGroup
                                != ProcessList.SCHED_GROUP_BACKGROUND) {
                            inFg = true;
                            break;
                        }
                    }
                    try {
                        requestServiceBindingLocked(r, b, inFg, true);
                    } catch (TransactionTooLargeException e) {
                        // Don't pass this back to ActivityThread, it's unrelated.
                    }
                } else {
                    // Note to tell the service the next time there is
                    // a new client.
                    b.doRebind = true;
                }
            }

            serviceDoneExecutingLocked(r, inDestroying, false);
        }
    } finally {
        Binder.restoreCallingIdentity(origId);
    }
}
 
public void openConfirmation(Activity context, Web3Transaction transaction, String requesterURL, NetworkInfo networkInfo) throws TransactionTooLargeException
{
    confirmationRouter.open(context, transaction, networkInfo.name, requesterURL, networkInfo.chainId);
}
 
源代码17 项目: LaunchEnr   文件: Utilities.java
public static boolean isBinderSizeError(Exception e) {
    return e.getCause() instanceof TransactionTooLargeException
            || e.getCause() instanceof DeadObjectException;
}
 
源代码18 项目: prevent   文件: ActivityManagerService.java
public ComponentName startService$Pr(IApplicationThread caller, Intent service,
                                     String resolvedType, String callingPackage, int userId)
        throws TransactionTooLargeException {
    throw new UnsupportedOperationException();
}
 
源代码19 项目: prevent   文件: ActivityManagerService.java
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();
}
 
源代码20 项目: XPrivacy   文件: Util.java
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));
}
 
 类所在包
 同包方法