android.os.TransactionTooLargeException Java Examples

The following examples show how to use android.os.TransactionTooLargeException. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ActiveServices.java    From android_9.0.0_r45 with Apache License 2.0 6 votes vote down vote up
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.
    }
}
 
Example #2
Source File: PendingTransactionActions.java    From android_9.0.0_r45 with Apache License 2.0 6 votes vote down vote up
@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();
    }
}
 
Example #3
Source File: MyAppWidgetHost.java    From AcDisplay with GNU General Public License v2.0 6 votes vote down vote up
@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);
        }
    }
}
 
Example #4
Source File: ActiveServices.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
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;
        }
    }
}
 
Example #5
Source File: ConfirmationRouter.java    From alpha-wallet-android with MIT License 5 votes vote down vote up
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);
}
 
Example #6
Source File: LauncherAppWidgetHost.java    From LB-Launcher with Apache License 2.0 5 votes vote down vote up
@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);
        }
    }
}
 
Example #7
Source File: ActivityManagerService.java    From prevent with Do What The F*ck You Want To Public License 5 votes vote down vote up
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();
    }
}
 
Example #8
Source File: ActivityManagerService.java    From prevent with Do What The F*ck You Want To Public License 5 votes vote down vote up
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();
    }
}
 
Example #9
Source File: ActiveServices.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
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;
}
 
Example #10
Source File: IntentUtils.java    From 365browser with Apache License 2.0 5 votes vote down vote up
/**
 * 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;
    }
}
 
Example #11
Source File: CustomTabDelegateFactory.java    From delion with Apache License 2.0 5 votes vote down vote up
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;
    }
}
 
Example #12
Source File: ExternalNavigationDelegateImpl.java    From delion with Apache License 2.0 5 votes vote down vote up
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;
    }
}
 
Example #13
Source File: IntentUtils.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
/**
 * 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;
    }
}
 
Example #14
Source File: DevicePluginManager.java    From DeviceConnect-Android with MIT License 5 votes vote down vote up
/**
 * アプリ一覧からデバイスプラグイン一覧を作成する.
 *
 * @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);
        }
    }
}
 
Example #15
Source File: ActivityManagerService.java    From prevent with Do What The F*ck You Want To Public License 4 votes vote down vote up
public ComponentName startService$Pr(IApplicationThread caller, Intent service,
                                     String resolvedType, String callingPackage, int userId)
        throws TransactionTooLargeException {
    throw new UnsupportedOperationException();
}
 
Example #16
Source File: Util.java    From XPrivacy with GNU General Public License v3.0 4 votes vote down vote up
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));
}
 
Example #17
Source File: ActivityManagerService.java    From prevent with Do What The F*ck You Want To Public License 4 votes vote down vote up
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();
}
 
Example #18
Source File: Utilities.java    From LaunchEnr with GNU General Public License v3.0 4 votes vote down vote up
public static boolean isBinderSizeError(Exception e) {
    return e.getCause() instanceof TransactionTooLargeException
            || e.getCause() instanceof DeadObjectException;
}
 
Example #19
Source File: DappBrowserViewModel.java    From alpha-wallet-android with MIT License 4 votes vote down vote up
public void openConfirmation(Activity context, Web3Transaction transaction, String requesterURL, NetworkInfo networkInfo) throws TransactionTooLargeException
{
    confirmationRouter.open(context, transaction, networkInfo.name, requesterURL, networkInfo.chainId);
}
 
Example #20
Source File: ActiveServices.java    From android_9.0.0_r45 with Apache License 2.0 4 votes vote down vote up
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);
    }
}