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

Commit 77a7dd6b authored by Bryce Lee's avatar Bryce Lee
Browse files

Add temporary logging around Activity Manager NPE.

This changelist will dump additional details to the log before the
system encounters a NPE due to not finding an ActivityStack. These
additions should be reverted once the root cause has been discovered.

Bug: 71548119
Test: manual
Change-Id: Ide20ff9e7b5eeed5b7200e011c1d0afca69eb0b4
parent e8ffec16
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -676,6 +676,15 @@ class ActivityDisplay extends ConfigurationContainer<ActivityStack> {
        }
    }

    public void dumpStacks(PrintWriter pw) {
        for (int i = mStacks.size() - 1; i >= 0; --i) {
            pw.print(mStacks.get(i).mStackId);
            if (i > 0) {
                pw.print(",");
            }
        }
    }

    public void writeToProto(ProtoOutputStream proto, long fieldId) {
        final long token = proto.start(fieldId);
        super.writeToProto(proto, CONFIGURATION_CONTAINER, false /* trim */);
+11 −0
Original line number Diff line number Diff line
@@ -21468,6 +21468,17 @@ public class ActivityManagerService extends IActivityManager.Stub
    private void resizeStackWithBoundsFromWindowManager(int stackId, boolean deferResume) {
        final Rect newStackBounds = new Rect();
        final ActivityStack stack = mStackSupervisor.getStack(stackId);
        // TODO(b/71548119): Revert CL introducing below once cause of mismatch is found.
        if (stack == null) {
            final StringWriter writer = new StringWriter();
            final PrintWriter printWriter = new PrintWriter(writer);
            mStackSupervisor.dumpDisplays(printWriter);
            printWriter.flush();
            Log.wtf(TAG, "stack not found:" + stackId + " displays:" + writer);
        }
        stack.getBoundsForNewConfiguration(newStackBounds);
        mStackSupervisor.resizeStackLocked(
                stack, !newStackBounds.isEmpty() ? newStackBounds : null /* bounds */,
+9 −0
Original line number Diff line number Diff line
@@ -3752,6 +3752,15 @@ public class ActivityStackSupervisor extends ConfigurationContainer implements D
        }
    }

    public void dumpDisplays(PrintWriter pw) {
        for (int i = mActivityDisplays.size() - 1; i >= 0; --i) {
            final ActivityDisplay display = mActivityDisplays.valueAt(i);
            pw.print("[id:" + display.mDisplayId + " stacks:");
            display.dumpStacks(pw);
            pw.print("]");
        }
    }

    public void dump(PrintWriter pw, String prefix) {
        pw.print(prefix); pw.print("mFocusedStack=" + mFocusedStack);
                pw.print(" mLastFocusedStack="); pw.println(mLastFocusedStack);