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

Commit da4767be authored by Andrii Kulian's avatar Andrii Kulian Committed by Android (Google) Code Review
Browse files

Merge "Return correct value for Activity#releaseInstance()"

parents 84bb2740 f49a58c0
Loading
Loading
Loading
Loading
+6 −3
Original line number Diff line number Diff line
@@ -1935,7 +1935,10 @@ final class ActivityRecord extends ConfigurationContainer {
     * HistoryRecord.
     * Normally the server-side record will be removed when the client reports back after
     * destruction. If, however, at this point there is no client process attached, the record will
     * removed immediately.
     * be removed immediately.
     *
     * @return {@code true} if activity was immediately removed from history, {@code false}
     * otherwise.
     */
    boolean destroyImmediately(boolean removeFromApp, String reason) {
        if (DEBUG_SWITCH || DEBUG_CLEANUP) {
@@ -3429,8 +3432,8 @@ final class ActivityRecord extends ConfigurationContainer {
            return false;
        }
        final ActivityStack stack = getActivityStack();
        if (stack == null || this == stack.getResumedActivity() || this == stack.mPausingActivity
                || !mHaveState || !stopped) {
        if (isState(RESUMED) || stack == null || this == stack.mPausingActivity || !mHaveState
                || !stopped) {
            // We're not ready for this kind of thing.
            return false;
        }
+6 −3
Original line number Diff line number Diff line
@@ -82,6 +82,8 @@ import static com.android.server.am.ActivityManagerServiceDumpProcessesProto.PRE
import static com.android.server.am.ActivityManagerServiceDumpProcessesProto.SCREEN_COMPAT_PACKAGES;
import static com.android.server.am.ActivityManagerServiceDumpProcessesProto.ScreenCompatPackage.MODE;
import static com.android.server.am.ActivityManagerServiceDumpProcessesProto.ScreenCompatPackage.PACKAGE;
import static com.android.server.wm.ActivityStack.ActivityState.DESTROYED;
import static com.android.server.wm.ActivityStack.ActivityState.DESTROYING;
import static com.android.server.wm.ActivityStack.REMOVE_TASK_MODE_DESTROYING;
import static com.android.server.wm.ActivityStackSupervisor.DEFER_RESUME;
import static com.android.server.wm.ActivityStackSupervisor.ON_TOP;
@@ -3237,11 +3239,12 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
        synchronized (mGlobalLock) {
            final long origId = Binder.clearCallingIdentity();
            try {
                ActivityRecord r = ActivityRecord.isInStackLocked(token);
                if (r == null) {
                final ActivityRecord r = ActivityRecord.isInStackLocked(token);
                if (r == null || !r.isDestroyable()) {
                    return false;
                }
                return r.safelyDestroy("app-req");
                r.destroyImmediately(true /* removeFromApp */, "app-req");
                return r.isState(DESTROYING, DESTROYED);
            } finally {
                Binder.restoreCallingIdentity(origId);
            }