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

Commit eefabdd0 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Make Task have type ActivityRecord children (55/n)"

parents 295e9700 3198da42
Loading
Loading
Loading
Loading
+2 −2
Original line number Original line Diff line number Diff line
@@ -1253,7 +1253,7 @@ final class ActivityRecord extends AppWindowToken {


    boolean setOccludesParent(boolean occludesParent) {
    boolean setOccludesParent(boolean occludesParent) {
        final boolean changed = super.setOccludesParent(occludesParent);
        final boolean changed = super.setOccludesParent(occludesParent);
        if (changed) {
        if (changed && task != null) {
            if (!occludesParent) {
            if (!occludesParent) {
                getActivityStack().convertActivityToTranslucent(this);
                getActivityStack().convertActivityToTranslucent(this);
            }
            }
@@ -3542,7 +3542,7 @@ final class ActivityRecord extends AppWindowToken {
            super.resolveOverrideConfiguration(newParentConfiguration);
            super.resolveOverrideConfiguration(newParentConfiguration);
            // If the activity has override bounds, the relative configuration (e.g. screen size,
            // If the activity has override bounds, the relative configuration (e.g. screen size,
            // layout) needs to be resolved according to the bounds.
            // layout) needs to be resolved according to the bounds.
            if (!matchParentBounds()) {
            if (task != null && !matchParentBounds()) {
                task.computeConfigResourceOverrides(getResolvedOverrideConfiguration(),
                task.computeConfigResourceOverrides(getResolvedOverrideConfiguration(),
                        newParentConfiguration);
                        newParentConfiguration);
            }
            }
+1 −1
Original line number Original line Diff line number Diff line
@@ -1420,7 +1420,7 @@ class AppWindowToken extends WindowToken implements WindowManagerService.AppFree
        mReparenting = true;
        mReparenting = true;


        getParent().removeChild(this);
        getParent().removeChild(this);
        task.addChild(this, position);
        task.addChild((ActivityRecord) this, position);


        mReparenting = false;
        mReparenting = false;


+12 −12
Original line number Original line Diff line number Diff line
@@ -58,7 +58,7 @@ import com.android.internal.annotations.VisibleForTesting;
import java.io.PrintWriter;
import java.io.PrintWriter;
import java.util.function.Consumer;
import java.util.function.Consumer;


class Task extends WindowContainer<AppWindowToken> implements ConfigurationContainerListener{
class Task extends WindowContainer<ActivityRecord> implements ConfigurationContainerListener{
    static final String TAG = TAG_WITH_CLASS_NAME ? "Task" : TAG_WM;
    static final String TAG = TAG_WITH_CLASS_NAME ? "Task" : TAG_WM;


    // TODO: Track parent marks like this in WindowContainer.
    // TODO: Track parent marks like this in WindowContainer.
@@ -170,14 +170,14 @@ class Task extends WindowContainer<AppWindowToken> implements ConfigurationConta
    }
    }


    @Override
    @Override
    void addChild(AppWindowToken wtoken, int position) {
    void addChild(ActivityRecord child, int position) {
        position = getAdjustedAddPosition(position);
        position = getAdjustedAddPosition(position);
        super.addChild(wtoken, position);
        super.addChild(child, position);
        mDeferRemoval = false;
        mDeferRemoval = false;
    }
    }


    @Override
    @Override
    void positionChildAt(int position, AppWindowToken child, boolean includingParents) {
    void positionChildAt(int position, ActivityRecord child, boolean includingParents) {
        position = getAdjustedAddPosition(position);
        position = getAdjustedAddPosition(position);
        super.positionChildAt(position, child, includingParents);
        super.positionChildAt(position, child, includingParents);
        mDeferRemoval = false;
        mDeferRemoval = false;
@@ -279,13 +279,13 @@ class Task extends WindowContainer<AppWindowToken> implements ConfigurationConta
    }
    }


    @Override
    @Override
    void removeChild(AppWindowToken token) {
    void removeChild(ActivityRecord child) {
        if (!mChildren.contains(token)) {
        if (!mChildren.contains(child)) {
            Slog.e(TAG, "removeChild: token=" + this + " not found.");
            Slog.e(TAG, "removeChild: token=" + this + " not found.");
            return;
            return;
        }
        }


        super.removeChild(token);
        super.removeChild(child);


        if (mChildren.isEmpty()) {
        if (mChildren.isEmpty()) {
            EventLog.writeEvent(WM_TASK_REMOVED, mTaskId, "removeAppToken: last token");
            EventLog.writeEvent(WM_TASK_REMOVED, mTaskId, "removeAppToken: last token");
@@ -674,18 +674,18 @@ class Task extends WindowContainer<AppWindowToken> implements ConfigurationConta
        return null;
        return null;
    }
    }


    void positionChildAtTop(AppWindowToken aToken) {
    void positionChildAtTop(ActivityRecord child) {
        positionChildAt(aToken, POSITION_TOP);
        positionChildAt(child, POSITION_TOP);
    }
    }


    void positionChildAt(AppWindowToken aToken, int position) {
    void positionChildAt(ActivityRecord child, int position) {
        if (aToken == null) {
        if (child == null) {
            Slog.w(TAG_WM,
            Slog.w(TAG_WM,
                    "Attempted to position of non-existing app");
                    "Attempted to position of non-existing app");
            return;
            return;
        }
        }


        positionChildAt(position, aToken, false /* includeParents */);
        positionChildAt(position, child, false /* includeParents */);
    }
    }


    void forceWindowsScaleable(boolean force) {
    void forceWindowsScaleable(boolean force) {
+1 −17
Original line number Original line Diff line number Diff line
@@ -215,23 +215,6 @@ class ActivityTestsBase extends SystemServiceTestsBase {
            return this;
            return this;
        }
        }


        static Pair<Intent, ActivityInfo> createIntentAndActivityInfo() {
            // TODO: Look into consolidating with dup. code in build() method below.
            final int id = sCurrentActivityId++;
            final ComponentName component = ComponentName.createRelative(
                    DEFAULT_COMPONENT_PACKAGE_NAME, DEFAULT_COMPONENT_CLASS_NAME + id);

            final Intent intent = new Intent();
            intent.setComponent(component);

            final ActivityInfo aInfo = new ActivityInfo();
            aInfo.applicationInfo = new ApplicationInfo();
            aInfo.applicationInfo.packageName = component.getPackageName();
            aInfo.applicationInfo.targetSdkVersion = Build.VERSION_CODES.CUR_DEVELOPMENT;
            aInfo.packageName = component.getPackageName();
            return new Pair<>(intent, aInfo);
        }

        ActivityRecord build() {
        ActivityRecord build() {
            if (mComponent == null) {
            if (mComponent == null) {
                final int id = sCurrentActivityId++;
                final int id = sCurrentActivityId++;
@@ -249,6 +232,7 @@ class ActivityTestsBase extends SystemServiceTestsBase {
            intent.setComponent(mComponent);
            intent.setComponent(mComponent);
            final ActivityInfo aInfo = new ActivityInfo();
            final ActivityInfo aInfo = new ActivityInfo();
            aInfo.applicationInfo = new ApplicationInfo();
            aInfo.applicationInfo = new ApplicationInfo();
            aInfo.applicationInfo.targetSdkVersion = Build.VERSION_CODES.CUR_DEVELOPMENT;
            aInfo.applicationInfo.packageName = mComponent.getPackageName();
            aInfo.applicationInfo.packageName = mComponent.getPackageName();
            aInfo.applicationInfo.uid = mUid;
            aInfo.applicationInfo.uid = mUid;
            aInfo.packageName = mComponent.getPackageName();
            aInfo.packageName = mComponent.getPackageName();
+1 −1
Original line number Original line Diff line number Diff line
@@ -57,7 +57,7 @@ public class AppChangeTransitionTests extends WindowTestsBase {


    private TaskStack mStack;
    private TaskStack mStack;
    private Task mTask;
    private Task mTask;
    private AppWindowToken mToken;
    private ActivityRecord mToken;


    public void setUpOnDisplay(DisplayContent dc) {
    public void setUpOnDisplay(DisplayContent dc) {
        mStack = createTaskStackOnDisplay(WINDOWING_MODE_UNDEFINED, ACTIVITY_TYPE_STANDARD, dc);
        mStack = createTaskStackOnDisplay(WINDOWING_MODE_UNDEFINED, ACTIVITY_TYPE_STANDARD, dc);
Loading