Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2f932434 authored by Louis Chang's avatar Louis Chang Committed by Android (Google) Code Review
Browse files

Merge "Refine the log for known TF operation failure" into main

parents 33b7ca76 e2713225
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -73,6 +73,7 @@ import android.os.Bundle;
import android.os.Handler;
import android.os.IBinder;
import android.os.Looper;
import android.os.OperationCanceledException;
import android.os.RemoteException;
import android.os.SystemProperties;
import android.util.ArrayMap;
@@ -1106,7 +1107,12 @@ public class SplitController implements JetpackTaskFragmentOrganizer.TaskFragmen
    void onTaskFragmentError(@NonNull WindowContainerTransaction wct,
            @Nullable IBinder errorCallbackToken, @Nullable TaskFragmentInfo taskFragmentInfo,
            @TaskFragmentOperation.OperationType int opType, @NonNull Throwable exception) {
        Log.e(TAG, "onTaskFragmentError=" + exception.getMessage());
        if (exception instanceof OperationCanceledException) {
            // This is a non-fatal error and the operation just canceled.
            Log.i(TAG, "operation canceled:" + exception.getMessage());
        } else {
            Log.e(TAG, "onTaskFragmentError=" + exception.getMessage(), exception);
        }
        switch (opType) {
            case OP_TYPE_START_ACTIVITY_IN_TASK_FRAGMENT:
            case OP_TYPE_REPARENT_ACTIVITY_TO_TASK_FRAGMENT: {
+7 −2
Original line number Diff line number Diff line
@@ -124,6 +124,7 @@ import android.os.Binder;
import android.os.Build;
import android.os.Bundle;
import android.os.IBinder;
import android.os.OperationCanceledException;
import android.os.RemoteException;
import android.os.Trace;
import android.os.UserHandle;
@@ -3246,11 +3247,14 @@ class ActivityStarter {
    private void sendCanNotEmbedActivityError(TaskFragment taskFragment,
            @EmbeddingCheckResult int result) {
        final String errMsg;
        boolean fatalError = true;
        switch (result) {
            case EMBEDDING_DISALLOWED_NEW_TASK: {
                errMsg = "Cannot embed " + mStartActivity + " that launched on another task"
                        + ",mLaunchMode=" + launchModeToString(mLaunchMode)
                        + ",mLaunchFlag=" + Integer.toHexString(mLaunchFlags);
                // This is a known possible scenario, which should not be a fatal error.
                fatalError = false;
                break;
            }
            case EMBEDDING_DISALLOWED_MIN_DIMENSION_VIOLATION: {
@@ -3270,7 +3274,8 @@ class ActivityStarter {
            mService.mWindowOrganizerController.sendTaskFragmentOperationFailure(
                    taskFragment.getTaskFragmentOrganizer(), mRequest.errorCallbackToken,
                    taskFragment, OP_TYPE_START_ACTIVITY_IN_TASK_FRAGMENT,
                    new SecurityException(errMsg));
                    fatalError ? new SecurityException(errMsg)
                            : new OperationCanceledException(errMsg));
        } else {
            // If the taskFragment is not organized, just dump error message as warning logs.
            Slog.w(TAG, errMsg);
+0 −1
Original line number Diff line number Diff line
@@ -842,7 +842,6 @@ public class TaskFragmentOrganizerController extends ITaskFragmentOrganizerContr
            return;
        }
        validateAndGetState(organizer);
        Slog.w(TAG, "onTaskFragmentError ", exception);
        addPendingEvent(new PendingTaskFragmentEvent.Builder(
                PendingTaskFragmentEvent.EVENT_ERROR, organizer)
                .setErrorCallbackToken(errorCallbackToken)