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

Commit 5cac88f9 authored by Riddle Hsu's avatar Riddle Hsu
Browse files

Remove some dead code

- Shell transition no longer adds records into mClosingApps
  and mOpeningApps. But ActivityRecord#getOrientation still works
  so far. So legacy transition also doesn't need the condition.
  Ideally isVisibleRequested() should has the same meaning to
  identify "closing".
- labelRes/icon are used for legacy starting window in core.
  Now the fields are no longer read.
- Remove duplicated code in WindowState#prepareSync which is
  caused by merge error from downstream.
- info and info.applicationInfo are non-null. Other places always
  access them directly.

Bug: 163976519
Test: CtsWindowManagerDeviceActivity
Change-Id: I8c6a2709bfc6f300b94c149ba3577978c81719a5
parent b017819a
Loading
Loading
Loading
Loading
+12 −28
Original line number Diff line number Diff line
@@ -495,10 +495,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
    private final boolean componentSpecified;  // did caller specify an explicit component?
    final boolean rootVoiceInteraction;  // was this the root activity of a voice interaction?

    private CharSequence nonLocalizedLabel;  // the label information from the package mgr.
    private int labelRes;           // the label information from the package mgr.
    private int icon;               // resource identifier of activity's icon.
    private int theme;              // resource identifier of activity's theme.
    private final int theme;        // resource identifier of activity's theme.
    private Task task;              // the task this is in.
    private long createTime = System.currentTimeMillis();
    long lastVisibleTime;         // last time this activity became visible
@@ -506,7 +503,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
    long launchTickTime;          // base time for launch tick messages
    long topResumedStateLossTime; // last time we reported top resumed state loss to an activity
    // Last configuration reported to the activity in the client process.
    private MergedConfiguration mLastReportedConfiguration;
    private final MergedConfiguration mLastReportedConfiguration;
    private int mLastReportedDisplayId;
    boolean mLastReportedMultiWindowMode;
    boolean mLastReportedPictureInPictureMode;
@@ -1058,7 +1055,6 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
        pw.print(prefix); pw.print("taskAffinity="); pw.println(taskAffinity);
        pw.print(prefix); pw.print("mActivityComponent=");
                pw.println(mActivityComponent.flattenToShortString());
        if (info != null && info.applicationInfo != null) {
        final ApplicationInfo appInfo = info.applicationInfo;
        pw.print(prefix); pw.print("baseDir="); pw.println(appInfo.sourceDir);
        if (!Objects.equals(appInfo.sourceDir, appInfo.publicSourceDir)) {
@@ -1069,7 +1065,6 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
            pw.print(prefix); pw.print("splitDir=");
            pw.println(Arrays.toString(appInfo.splitSourceDirs));
        }
        }
        pw.print(prefix); pw.print("stateNotNeeded="); pw.print(stateNotNeeded);
                pw.print(" componentSpecified="); pw.print(componentSpecified);
                pw.print(" mActivityType="); pw.println(
@@ -1079,8 +1074,6 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
        }
        pw.print(prefix); pw.print("compat=");
        pw.print(mAtmService.compatibilityInfoForPackageLocked(info.applicationInfo));
                pw.print(" labelRes=0x"); pw.print(Integer.toHexString(labelRes));
                pw.print(" icon=0x"); pw.print(Integer.toHexString(icon));
                pw.print(" theme=0x"); pw.println(Integer.toHexString(theme));
        pw.println(prefix + "mLastReportedConfigurations:");
        mLastReportedConfiguration.dump(pw, prefix + "  ");
@@ -2157,14 +2150,6 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
            sConstrainDisplayApisConfig = new ConstrainDisplayApisConfig();
        }
        stateNotNeeded = (aInfo.flags & FLAG_STATE_NOT_NEEDED) != 0;
        nonLocalizedLabel = aInfo.nonLocalizedLabel;
        labelRes = aInfo.labelRes;
        if (nonLocalizedLabel == null && labelRes == 0) {
            ApplicationInfo app = aInfo.applicationInfo;
            nonLocalizedLabel = app.nonLocalizedLabel;
            labelRes = app.labelRes;
        }
        icon = aInfo.getIconResource();
        theme = aInfo.getThemeResource();
        if ((aInfo.flags & FLAG_MULTIPROCESS) != 0 && _caller != null
                && (aInfo.applicationInfo.uid == SYSTEM_UID
@@ -8079,8 +8064,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
        // The {@link ActivityRecord} should only specify an orientation when it is not closing.
        // Allowing closing {@link ActivityRecord} to participate can lead to an Activity in another
        // task being started in the wrong orientation during the transition.
        if (!getDisplayContent().mClosingApps.contains(this)
                && (isVisibleRequested() || getDisplayContent().mOpeningApps.contains(this))) {
        if (isVisibleRequested()) {
            return getOverrideOrientation();
        }

+0 −6
Original line number Diff line number Diff line
@@ -5641,12 +5641,6 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
            // Skip sync for invisible app windows which are not managed by activity lifecycle.
            return false;
        }
        if (mActivityRecord != null && mViewVisibility != View.VISIBLE
                && mWinAnimator.mAttrType != TYPE_BASE_APPLICATION
                && mWinAnimator.mAttrType != TYPE_APPLICATION_STARTING) {
            // Skip sync for invisible app windows which are not managed by activity lifecycle.
            return false;
        }
        // In the WindowContainer implementation we immediately mark ready
        // since a generic WindowContainer only needs to wait for its
        // children to finish and is immediately ready from its own
+1 −1
Original line number Diff line number Diff line
@@ -140,7 +140,7 @@ public class RootTaskTests extends WindowTestsBase {

        final WindowContainer parent = activity1.getTask().getParent();
        assertEquals(SCREEN_ORIENTATION_PORTRAIT, parent.getOrientation());
        mDisplayContent.mClosingApps.add(activity2);
        activity2.setVisibleRequested(false);
        assertEquals(SCREEN_ORIENTATION_LANDSCAPE, parent.getOrientation());
    }