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

Commit e2713225 authored by Louis Chang's avatar Louis Chang
Browse files

Refine the log for known TF operation failure

Activity may be resolved to be started on another Task. This should
not be a fatal error and is a known possible scenario. Update the
log to prevent misleading.

Bug: 389221710
Test: locally verified
Flag: EXEMPT bugfix
Change-Id: I7b8fb40a0a6d3fff642142e8db98fa478cc98ff0
parent 59fbf3ea
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;
@@ -3247,11 +3248,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: {
@@ -3271,7 +3275,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)