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

Commit a828c7aa authored by Chris Li's avatar Chris Li
Browse files

Cleanup unused remote exception catch

Fix: 323801078
Flag: EXEMPT flag cleanup
Test: flag cleanup
Change-Id: Ibfbfad07730c77e294fa952b782a3eaceaf410cb
parent 97eb18e9
Loading
Loading
Loading
Loading
+2 −15
Original line number Diff line number Diff line
@@ -1127,14 +1127,7 @@ class ActivityClientController extends IActivityClientController.Stub {
        }

        final EnterPipRequestedItem item = new EnterPipRequestedItem(r.token);
        try {
        return mService.getLifecycleManager().scheduleTransactionItem(r.app.getThread(), item);
        } catch (RemoteException e) {
            // TODO(b/323801078): remove Exception when cleanup
            Slog.w(TAG, "Failed to send enter pip requested item: "
                    + r.intent.getComponent(), e);
            return false;
        }
    }

    /**
@@ -1143,13 +1136,7 @@ class ActivityClientController extends IActivityClientController.Stub {
    void onPictureInPictureUiStateChanged(@NonNull ActivityRecord r,
            PictureInPictureUiState pipState) {
        final PipStateTransactionItem item = new PipStateTransactionItem(r.token, pipState);
        try {
        mService.getLifecycleManager().scheduleTransactionItem(r.app.getThread(), item);
        } catch (RemoteException e) {
            // TODO(b/323801078): remove Exception when cleanup
            Slog.w(TAG, "Failed to send pip state transaction item: "
                    + r.intent.getComponent(), e);
        }
    }

    @Override
+31 −106
Original line number Diff line number Diff line
@@ -1362,12 +1362,7 @@ final class ActivityRecord extends WindowToken {

        final MoveToDisplayItem item =
                new MoveToDisplayItem(token, displayId, config, activityWindowInfo);
        try {
        mAtmService.getLifecycleManager().scheduleTransactionItem(app.getThread(), item);
        } catch (RemoteException e) {
            // TODO(b/323801078): remove Exception when cleanup
            // If process died, whatever.
        }
    }

    private void scheduleConfigurationChanged(@NonNull Configuration config,
@@ -1382,12 +1377,7 @@ final class ActivityRecord extends WindowToken {

        final ActivityConfigurationChangeItem item =
                new ActivityConfigurationChangeItem(token, config, activityWindowInfo);
        try {
        mAtmService.getLifecycleManager().scheduleTransactionItem(app.getThread(), item);
        } catch (RemoteException e) {
            // TODO(b/323801078): remove Exception when cleanup
            // If process died, whatever.
        }
    }

    boolean scheduleTopResumedActivityChanged(boolean onTop) {
@@ -1404,14 +1394,7 @@ final class ActivityRecord extends WindowToken {
                this, onTop);

        final TopResumedActivityChangeItem item = new TopResumedActivityChangeItem(token, onTop);
        try {
        return mAtmService.getLifecycleManager().scheduleTransactionItem(app.getThread(), item);
        } catch (RemoteException e) {
            // TODO(b/323801078): remove Exception when cleanup
            // If process died, whatever.
            Slog.w(TAG, "Failed to send top-resumed=" + onTop + " to " + this, e);
            return false;
        }
    }

    void updateMultiWindowMode() {
@@ -2609,15 +2592,8 @@ final class ActivityRecord extends WindowToken {
        mTransferringSplashScreenState = TRANSFER_SPLASH_SCREEN_ATTACH_TO_CLIENT;
        final TransferSplashScreenViewStateItem item =
                new TransferSplashScreenViewStateItem(token, parcelable, windowAnimationLeash);
        boolean isSuccessful;
        try {
            isSuccessful = mAtmService.getLifecycleManager().scheduleTransactionItem(
        final boolean isSuccessful = mAtmService.getLifecycleManager().scheduleTransactionItem(
                app.getThread(), item);
        } catch (RemoteException e) {
            // TODO(b/323801078): remove Exception when cleanup
            Slog.w(TAG, "onCopySplashScreenComplete fail: " + this);
            isSuccessful = false;
        }
        if (isSuccessful) {
            scheduleTransferSplashScreenTimeout();
        } else {
@@ -3951,20 +3927,15 @@ final class ActivityRecord extends WindowToken {
            boolean skipDestroy = false;

            if (DEBUG_SWITCH) Slog.i(TAG_SWITCH, "Destroying: " + this);
            boolean isSuccessful;
            final boolean isSuccessful;
            final IApplicationThread client = app.getThread();
            if (client == null) {
                Slog.w(TAG_WM, "Failed to schedule DestroyActivityItem because client is inactive");
                isSuccessful = false;
            } else {
                final DestroyActivityItem item = new DestroyActivityItem(token, finishing);
                try {
                isSuccessful = mAtmService.getLifecycleManager().scheduleTransactionItem(
                        client, item);
                } catch (RemoteException e) {
                    // TODO(b/323801078): remove Exception when cleanup
                    isSuccessful = false;
                }
            }
            if (!isSuccessful) {
                // We can just ignore exceptions here...  if the process has crashed, our death
@@ -4877,16 +4848,11 @@ final class ActivityRecord extends WindowToken {
            final ArrayList<ResultInfo> list = new ArrayList<>();
            list.add(new ResultInfo(resultWho, requestCode, resultCode, data, callerToken));
            final ActivityResultItem item = new ActivityResultItem(token, list);
            try {
            final boolean isSuccessful = mAtmService.getLifecycleManager()
                    .scheduleTransactionItem(app.getThread(), item);
            if (isSuccessful) {
                return;
            }
            } catch (RemoteException e) {
                // TODO(b/323801078): remove Exception when cleanup
                Slog.w(TAG, "Exception thrown sending result to " + this, e);
            }
        }

        // Schedule sending results now for Media Projection setup.
@@ -4900,7 +4866,6 @@ final class ActivityRecord extends WindowToken {
            // Since the activity is only resumed so the result can be immediately delivered,
            // return it to its original lifecycle state.
            final ActivityLifecycleItem lifecycleItem = getLifecycleItemForCurrentStateForResult();
            try {
            if (lifecycleItem != null) {
                mAtmService.getLifecycleManager().scheduleTransactionItems(
                        app.getThread(), activityResultItem, lifecycleItem);
@@ -4910,10 +4875,6 @@ final class ActivityRecord extends WindowToken {
                mAtmService.getLifecycleManager().scheduleTransactionItem(
                        app.getThread(), activityResultItem);
            }
            } catch (RemoteException e) {
                // TODO(b/323801078): remove Exception when cleanup
                Slog.w(TAG, "Exception thrown sending result to " + this, e);
            }
            // We return here to ensure that result for media projection setup is not stored as a
            // pending result after being scheduled. This is to prevent this stored result being
            // sent again when the destination component is resumed.
@@ -4998,16 +4959,11 @@ final class ActivityRecord extends WindowToken {
            // so only if activity is currently RESUMED. Otherwise, client may have extra
            // life-cycle calls to RESUMED (and PAUSED later).
            final NewIntentItem item = new NewIntentItem(token, ar, mState == RESUMED /* resume */);
            try {
            final boolean isSuccessful = mAtmService.getLifecycleManager()
                    .scheduleTransactionItem(app.getThread(), item);
            if (isSuccessful) {
                return;
            }
            } catch (RemoteException e) {
                // TODO(b/323801078): remove Exception when cleanup
                Slog.w(TAG, "Exception thrown sending new intent to " + this, e);
            }
        }

        // Didn't send.
@@ -5992,12 +5948,7 @@ final class ActivityRecord extends WindowToken {
                    shortComponentName, "userLeaving=false", "make-active");
            final PauseActivityItem item = new PauseActivityItem(token, finishing,
                    false /* userLeaving */, false /* dontReport */, mAutoEnteringPip);
            try {
            mAtmService.getLifecycleManager().scheduleTransactionItem(app.getThread(), item);
            } catch (RemoteException e) {
                // TODO(b/323801078): remove Exception when cleanup
                Slog.w(TAG, "Exception thrown sending pause: " + intent.getComponent(), e);
            }
        } else if (shouldStartActivity()) {
            if (DEBUG_VISIBILITY) {
                Slog.v(TAG_VISIBILITY, "Start visible activity, " + this);
@@ -6005,12 +5956,7 @@ final class ActivityRecord extends WindowToken {
            setState(STARTED, "makeActiveIfNeeded");

            final StartActivityItem item = new StartActivityItem(token, takeSceneTransitionInfo());
            try {
            mAtmService.getLifecycleManager().scheduleTransactionItem(app.getThread(), item);
            } catch (RemoteException e) {
                // TODO(b/323801078): remove Exception when cleanup
                Slog.w(TAG, "Exception thrown sending start: " + intent.getComponent(), e);
            }
            // The activity may be waiting for stop, but that is no longer appropriate if we are
            // starting the activity again
            mTaskSupervisor.mStoppingActivities.remove(this);
@@ -6300,17 +6246,8 @@ final class ActivityRecord extends WindowToken {
        EventLogTags.writeWmStopActivity(
                mUserId, System.identityHashCode(this), shortComponentName);
        final StopActivityItem item = new StopActivityItem(token);
        boolean isSuccessful;
        try {
            isSuccessful = mAtmService.getLifecycleManager().scheduleTransactionItem(
        final boolean isSuccessful = mAtmService.getLifecycleManager().scheduleTransactionItem(
                app.getThread(), item);
        } catch (RemoteException e) {
            // TODO(b/323801078): remove Exception when cleanup
            // Maybe just ignore exceptions here...  if the process has crashed, our death
            // notification will clean things up.
            Slog.w(TAG, "Exception thrown during pause", e);
            isSuccessful = false;
        }
        if (isSuccessful) {
            final int lastReportedWinMode = mLastReportedConfiguration.getMergedConfiguration()
                    .windowConfiguration.getWindowingMode();
@@ -8720,15 +8657,8 @@ final class ActivityRecord extends WindowToken {
        } else {
            lifecycleItem = new PauseActivityItem(token);
        }
        boolean isSuccessful;
        try {
            isSuccessful = mAtmService.getLifecycleManager().scheduleTransactionItems(
        final boolean isSuccessful = mAtmService.getLifecycleManager().scheduleTransactionItems(
                app.getThread(), callbackItem, lifecycleItem);
        } catch (RemoteException e) {
            // TODO(b/323801078): remove Exception when cleanup
            Slog.w(TAG, "Failed to relaunch " + this + ": " + e);
            isSuccessful = false;
        }
        if (isSuccessful) {
            startRelaunching();
            // Note: don't need to call pauseIfSleepingLocked() here, because the caller will only
@@ -8818,12 +8748,7 @@ final class ActivityRecord extends WindowToken {
        // The process will be killed until the activity reports stopped with saved state (see
        // {@link ActivityTaskManagerService.activityStopped}).
        final StopActivityItem item = new StopActivityItem(token);
        try {
        mAtmService.getLifecycleManager().scheduleTransactionItem(app.getThread(), item);
        } catch (RemoteException e) {
            // TODO(b/323801078): remove Exception when cleanup
            Slog.w(TAG, "Exception thrown during restart " + this, e);
        }
        mTaskSupervisor.scheduleRestartTimeout(this);
    }

+3 −8
Original line number Diff line number Diff line
@@ -25,7 +25,6 @@ import android.app.servertransaction.RefreshCallbackItem;
import android.app.servertransaction.ResumeActivityItem;
import android.content.res.Configuration;
import android.os.Handler;
import android.os.RemoteException;

import com.android.internal.protolog.ProtoLog;
import com.android.internal.util.ArrayUtils;
@@ -88,13 +87,9 @@ class ActivityRefresher {
                new RefreshCallbackItem(activity.token, cycleThroughStop ? ON_STOP : ON_PAUSE);
        final ResumeActivityItem resumeActivityItem = new ResumeActivityItem(
                activity.token, /* isForward */ false, /* shouldSendCompatFakeFocus */ false);
        boolean isSuccessful;
        try {
            isSuccessful = activity.mAtmService.getLifecycleManager().scheduleTransactionItems(
                    activity.app.getThread(), refreshCallbackItem, resumeActivityItem);
        } catch (RemoteException e) {
            isSuccessful = false;
        }
        final boolean isSuccessful = activity.mAtmService.getLifecycleManager()
                .scheduleTransactionItems(activity.app.getThread(), refreshCallbackItem,
                        resumeActivityItem);
        if (isSuccessful) {
            mHandler.postDelayed(() -> {
                synchronized (mWmService.mGlobalLock) {
+6 −12
Original line number Diff line number Diff line
@@ -1047,18 +1047,12 @@ public class ActivityTaskSupervisor implements RecentTasks.Callbacks {
            // transaction.
            mService.getLifecycleManager().dispatchPendingTransaction(proc.getThread());
        }
        final boolean isSuccessful;
        try {
            isSuccessful = mService.getLifecycleManager().scheduleTransactionItems(
        final boolean isSuccessful = mService.getLifecycleManager().scheduleTransactionItems(
                proc.getThread(),
                // Immediately dispatch the transaction, so that if it fails, the server can
                // restart the process and retry now.
                true /* shouldDispatchImmediately */,
                launchActivityItem, lifecycleItem);
        } catch (RemoteException e) {
            // TODO(b/323801078): remove Exception when cleanup
            return e;
        }
        if (!isSuccessful) {
            return new DeadObjectException("Failed to dispatch the ClientTransaction to dead"
                    + " process. See earlier log for more details.");
+4 −4
Original line number Diff line number Diff line
@@ -89,7 +89,7 @@ class ClientLifecycleManager {
     * @see WindowProcessController#setReportedProcState(int)
     */
    boolean scheduleTransactionItemNow(@NonNull IApplicationThread client,
            @NonNull ClientTransactionItem transactionItem) throws RemoteException {
            @NonNull ClientTransactionItem transactionItem) {
        final ClientTransaction clientTransaction = new ClientTransaction(client);
        clientTransaction.addTransactionItem(transactionItem);
        return scheduleTransaction(clientTransaction);
@@ -104,7 +104,7 @@ class ClientLifecycleManager {
     * @see ClientTransactionItem
     */
    boolean scheduleTransactionItem(@NonNull IApplicationThread client,
            @NonNull ClientTransactionItem item) throws RemoteException {
            @NonNull ClientTransactionItem item) {
        // Wait until RootWindowContainer#performSurfacePlacementNoTrace to dispatch all pending
        // transactions at once.
        final ClientTransaction clientTransaction = getOrCreatePendingTransaction(client);
@@ -123,7 +123,7 @@ class ClientLifecycleManager {
     * @see ClientTransactionItem
     */
    boolean scheduleTransactionItems(@NonNull IApplicationThread client,
            @NonNull ClientTransactionItem... items) throws RemoteException {
            @NonNull ClientTransactionItem... items) {
        return scheduleTransactionItems(client, false /* shouldDispatchImmediately */, items);
    }

@@ -143,7 +143,7 @@ class ClientLifecycleManager {
     */
    boolean scheduleTransactionItems(@NonNull IApplicationThread client,
            boolean shouldDispatchImmediately,
            @NonNull ClientTransactionItem... items) throws RemoteException {
            @NonNull ClientTransactionItem... items) {
        // Wait until RootWindowContainer#performSurfacePlacementNoTrace to dispatch all pending
        // transactions at once.
        final ClientTransaction clientTransaction = getOrCreatePendingTransaction(client);
Loading