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

Commit 9b2f9b60 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Block activity launching if DWPC does not allow" into tm-dev am: 033fcafa

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/17164726

Change-Id: I815f511bf61d54ca7dcc802b07074082784b6892
parents b2f0c740 033fcafa
Loading
Loading
Loading
Loading
+22 −0
Original line number Original line Diff line number Diff line
@@ -135,6 +135,7 @@ import com.android.server.wm.LaunchParamsController.LaunchParams;


import java.io.PrintWriter;
import java.io.PrintWriter;
import java.text.DateFormat;
import java.text.DateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.Date;


/**
/**
@@ -2010,6 +2011,27 @@ class ActivityStarter {
            return START_PERMISSION_DENIED;
            return START_PERMISSION_DENIED;
        }
        }


        // Do not start the activity if target display's DWPC does not allow it.
        // We can't return fatal error code here because it will crash the caller of
        // startActivity() if they don't catch the exception. We don't expect 3P apps to make
        // changes.
        if (mPreferredTaskDisplayArea != null) {
            final DisplayContent displayContent = mRootWindowContainer.getDisplayContentOrCreate(
                    mPreferredTaskDisplayArea.getDisplayId());
            if (displayContent != null && displayContent.mDwpcHelper.hasController()) {
                final ArrayList<ActivityInfo> activities = new ArrayList<>();
                activities.add(r.info);
                final int targetWindowingMode = (targetTask != null)
                        ? targetTask.getWindowingMode() : displayContent.getWindowingMode();
                if (!displayContent.mDwpcHelper
                        .canContainActivities(activities, targetWindowingMode)) {
                    Slog.w(TAG, "Abort to launch " + r.info.getComponentName()
                            + " on display area " + mPreferredTaskDisplayArea);
                    return START_ABORTED;
                }
            }
        }

        return START_SUCCESS;
        return START_SUCCESS;
    }
    }