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

Commit 98951a99 authored by Jon Eckenrode's avatar Jon Eckenrode Committed by Automerger Merge Worker
Browse files

Merge "Reconciled description of WindowManager with description of...

Merge "Reconciled description of WindowManager with description of Context#createDisplayContext()." am: 92a4b54d

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

Change-Id: I894941a064dc61c68722036081f0617c47804c83
parents cc70fa74 92a4b54d
Loading
Loading
Loading
Loading
+15 −21
Original line number Diff line number Diff line
@@ -6451,30 +6451,24 @@ public abstract class Context {
            @NonNull Configuration overrideConfiguration);

    /**
     * Return a new Context object for the current Context but whose resources
     * are adjusted to match the metrics of the given Display.  Each call to this method
     * returns a new instance of a Context object; Context objects are not
     * shared, however common state (ClassLoader, other Resources for the
     * same configuration) may be so the Context itself can be fairly lightweight.
     *
     * To obtain an instance of a {@link WindowManager} (see {@link #getSystemService(String)}) that
     * is configured to show windows on the given display call
     * {@link #createWindowContext(int, Bundle)} on the returned display Context or use an
     * {@link android.app.Activity}.
     *
     * Returns a new <code>Context</code> object from the current context but with resources
     * adjusted to match the metrics of <code>display</code>. Each call to this method
     * returns a new instance of a context object. Context objects are not shared; however,
     * common state (such as the {@link ClassLoader} and other resources for the same
     * configuration) can be shared, so the <code>Context</code> itself is lightweight.
     * <p>
     * Note that invoking #createDisplayContext(Display) from an UI context is not regarded
     * as an UI context. In other words, it is not suggested to access UI components (such as
     * obtain a {@link WindowManager} by {@link #getSystemService(String)})
     * from the context created from #createDisplayContext(Display).
     * </p>
     *
     * @param display A {@link Display} object specifying the display for whose metrics the
     * Context's resources should be tailored.
     * To obtain an instance of {@link WindowManager} configured to show windows on the given
     * display, call {@link #createWindowContext(int, Bundle)} on the returned display context,
     * then call {@link #getSystemService(String)} or {@link #getSystemService(Class)} on the
     * returned window context.
     * <p>
     * <b>Note:</b> The context returned by <code>createDisplayContext(Display)</code> is not a UI
     * context. Do not access UI components or obtain a {@link WindowManager} from the context
     * created by <code>createDisplayContext(Display)</code>.
     *
     * @return A {@link Context} for the display.
     * @param display The display to which the current context's resources are adjusted.
     *
     * @see #getSystemService(String)
     * @return A context for the display.
     */
    @DisplayContext
    public abstract Context createDisplayContext(@NonNull Display display);
+9 −11
Original line number Diff line number Diff line
@@ -127,17 +127,15 @@ import java.util.function.Consumer;

/**
 * The interface that apps use to talk to the window manager.
 * </p><p>
 * Each window manager instance is bound to a particular {@link Display}.
 * To obtain a {@link WindowManager} for a different display, use
 * {@link Context#createDisplayContext} to obtain a {@link Context} for that
 * display, then use <code>Context.getSystemService(Context.WINDOW_SERVICE)</code>
 * to get the WindowManager.
 * </p><p>
 * The simplest way to show a window on another display is to create a
 * {@link Presentation}.  The presentation will automatically obtain a
 * {@link WindowManager} and {@link Context} for that display.
 * </p>
 * <p>
 * Each window manager instance is bound to a {@link Display}. To obtain the
 * <code>WindowManager</code> associated with a display,
 * call {@link Context#createWindowContext(Display, int, Bundle)} to get the display's UI context,
 * then call {@link Context#getSystemService(String)} or {@link Context#getSystemService(Class)} on
 * the UI context.
 * <p>
 * The simplest way to show a window on a particular display is to create a {@link Presentation},
 * which automatically obtains a <code>WindowManager</code> and context for the display.
 */
@SystemService(Context.WINDOW_SERVICE)
public interface WindowManager extends ViewManager {