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

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

Merge "Added support for window TYPE_PRESENTATION"

parents 6c8b93cf 5b6714c2
Loading
Loading
Loading
Loading
+18 −4
Original line number Original line Diff line number Diff line
@@ -16,13 +16,21 @@


package android.app;
package android.app;


import static android.content.Context.DISPLAY_SERVICE;
import static android.content.Context.WINDOW_SERVICE;
import static android.view.WindowManager.LayoutParams.TYPE_PRESENTATION;

import android.content.Context;
import android.content.Context;
import android.content.res.Resources;
import android.content.res.Resources;
import android.hardware.display.DisplayManager;
import android.hardware.display.DisplayManager;
import android.hardware.display.DisplayManager.DisplayListener;
import android.hardware.display.DisplayManager.DisplayListener;
import android.os.Binder;
import android.os.IBinder;
import android.view.ContextThemeWrapper;
import android.view.ContextThemeWrapper;
import android.view.Display;
import android.view.Display;
import android.view.Gravity;
import android.view.Gravity;
import android.view.Window;
import android.view.WindowManager;
import android.view.WindowManagerImpl;
import android.view.WindowManagerImpl;
import android.os.Handler;
import android.os.Handler;
import android.os.Message;
import android.os.Message;
@@ -145,6 +153,7 @@ public class Presentation extends Dialog {


    private final Display mDisplay;
    private final Display mDisplay;
    private final DisplayManager mDisplayManager;
    private final DisplayManager mDisplayManager;
    private final IBinder mToken = new Binder();


    /**
    /**
     * Creates a new presentation that is attached to the specified display
     * Creates a new presentation that is attached to the specified display
@@ -177,9 +186,14 @@ public class Presentation extends Dialog {
        super(createPresentationContext(outerContext, display, theme), theme, false);
        super(createPresentationContext(outerContext, display, theme), theme, false);


        mDisplay = display;
        mDisplay = display;
        mDisplayManager = (DisplayManager)getContext().getSystemService(Context.DISPLAY_SERVICE);
        mDisplayManager = (DisplayManager)getContext().getSystemService(DISPLAY_SERVICE);


        getWindow().setGravity(Gravity.FILL);
        final Window w = getWindow();
        final WindowManager.LayoutParams attr = w.getAttributes();
        attr.token = mToken;
        w.setAttributes(attr);
        w.setGravity(Gravity.FILL);
        w.setType(TYPE_PRESENTATION);
        setCanceledOnTouchOutside(false);
        setCanceledOnTouchOutside(false);
    }
    }


@@ -308,13 +322,13 @@ public class Presentation extends Dialog {
        // such as the parent window, which is important if the presentation uses
        // such as the parent window, which is important if the presentation uses
        // an application window type.
        // an application window type.
        final WindowManagerImpl outerWindowManager =
        final WindowManagerImpl outerWindowManager =
                (WindowManagerImpl)outerContext.getSystemService(Context.WINDOW_SERVICE);
                (WindowManagerImpl)outerContext.getSystemService(WINDOW_SERVICE);
        final WindowManagerImpl displayWindowManager =
        final WindowManagerImpl displayWindowManager =
                outerWindowManager.createPresentationWindowManager(displayContext);
                outerWindowManager.createPresentationWindowManager(displayContext);
        return new ContextThemeWrapper(displayContext, theme) {
        return new ContextThemeWrapper(displayContext, theme) {
            @Override
            @Override
            public Object getSystemService(String name) {
            public Object getSystemService(String name) {
                if (Context.WINDOW_SERVICE.equals(name)) {
                if (WINDOW_SERVICE.equals(name)) {
                    return displayWindowManager;
                    return displayWindowManager;
                }
                }
                return super.getSystemService(name);
                return super.getSystemService(name);
+93 −42
Original line number Original line Diff line number Diff line
@@ -249,48 +249,92 @@ public interface WindowManager extends ViewManager {
         * @see #TYPE_INPUT_METHOD_DIALOG
         * @see #TYPE_INPUT_METHOD_DIALOG
         */
         */
        @ViewDebug.ExportedProperty(mapping = {
        @ViewDebug.ExportedProperty(mapping = {
            @ViewDebug.IntToString(from = TYPE_BASE_APPLICATION, to = "TYPE_BASE_APPLICATION"),
                @ViewDebug.IntToString(from = TYPE_BASE_APPLICATION,
            @ViewDebug.IntToString(from = TYPE_APPLICATION, to = "TYPE_APPLICATION"),
                        to = "TYPE_BASE_APPLICATION"),
            @ViewDebug.IntToString(from = TYPE_APPLICATION_STARTING, to = "TYPE_APPLICATION_STARTING"),
                @ViewDebug.IntToString(from = TYPE_APPLICATION,
            @ViewDebug.IntToString(from = TYPE_DRAWN_APPLICATION, to = "TYPE_DRAWN_APPLICATION"),
                        to = "TYPE_APPLICATION"),
            @ViewDebug.IntToString(from = TYPE_APPLICATION_PANEL, to = "TYPE_APPLICATION_PANEL"),
                @ViewDebug.IntToString(from = TYPE_APPLICATION_STARTING,
            @ViewDebug.IntToString(from = TYPE_APPLICATION_MEDIA, to = "TYPE_APPLICATION_MEDIA"),
                        to = "TYPE_APPLICATION_STARTING"),
            @ViewDebug.IntToString(from = TYPE_APPLICATION_SUB_PANEL, to = "TYPE_APPLICATION_SUB_PANEL"),
                @ViewDebug.IntToString(from = TYPE_DRAWN_APPLICATION,
            @ViewDebug.IntToString(from = TYPE_APPLICATION_ABOVE_SUB_PANEL, to = "TYPE_APPLICATION_ABOVE_SUB_PANEL"),
                        to = "TYPE_DRAWN_APPLICATION"),
            @ViewDebug.IntToString(from = TYPE_APPLICATION_ATTACHED_DIALOG, to = "TYPE_APPLICATION_ATTACHED_DIALOG"),
                @ViewDebug.IntToString(from = TYPE_APPLICATION_PANEL,
            @ViewDebug.IntToString(from = TYPE_APPLICATION_MEDIA_OVERLAY, to = "TYPE_APPLICATION_MEDIA_OVERLAY"),
                        to = "TYPE_APPLICATION_PANEL"),
            @ViewDebug.IntToString(from = TYPE_STATUS_BAR, to = "TYPE_STATUS_BAR"),
                @ViewDebug.IntToString(from = TYPE_APPLICATION_MEDIA,
            @ViewDebug.IntToString(from = TYPE_SEARCH_BAR, to = "TYPE_SEARCH_BAR"),
                        to = "TYPE_APPLICATION_MEDIA"),
            @ViewDebug.IntToString(from = TYPE_PHONE, to = "TYPE_PHONE"),
                @ViewDebug.IntToString(from = TYPE_APPLICATION_SUB_PANEL,
            @ViewDebug.IntToString(from = TYPE_SYSTEM_ALERT, to = "TYPE_SYSTEM_ALERT"),
                        to = "TYPE_APPLICATION_SUB_PANEL"),
            @ViewDebug.IntToString(from = TYPE_TOAST, to = "TYPE_TOAST"),
                @ViewDebug.IntToString(from = TYPE_APPLICATION_ABOVE_SUB_PANEL,
            @ViewDebug.IntToString(from = TYPE_SYSTEM_OVERLAY, to = "TYPE_SYSTEM_OVERLAY"),
                        to = "TYPE_APPLICATION_ABOVE_SUB_PANEL"),
            @ViewDebug.IntToString(from = TYPE_PRIORITY_PHONE, to = "TYPE_PRIORITY_PHONE"),
                @ViewDebug.IntToString(from = TYPE_APPLICATION_ATTACHED_DIALOG,
            @ViewDebug.IntToString(from = TYPE_SYSTEM_DIALOG, to = "TYPE_SYSTEM_DIALOG"),
                        to = "TYPE_APPLICATION_ATTACHED_DIALOG"),
            @ViewDebug.IntToString(from = TYPE_KEYGUARD_DIALOG, to = "TYPE_KEYGUARD_DIALOG"),
                @ViewDebug.IntToString(from = TYPE_APPLICATION_MEDIA_OVERLAY,
            @ViewDebug.IntToString(from = TYPE_SYSTEM_ERROR, to = "TYPE_SYSTEM_ERROR"),
                        to = "TYPE_APPLICATION_MEDIA_OVERLAY"),
            @ViewDebug.IntToString(from = TYPE_INPUT_METHOD, to = "TYPE_INPUT_METHOD"),
                @ViewDebug.IntToString(from = TYPE_STATUS_BAR,
            @ViewDebug.IntToString(from = TYPE_INPUT_METHOD_DIALOG, to = "TYPE_INPUT_METHOD_DIALOG"),
                        to = "TYPE_STATUS_BAR"),
            @ViewDebug.IntToString(from = TYPE_WALLPAPER, to = "TYPE_WALLPAPER"),
                @ViewDebug.IntToString(from = TYPE_SEARCH_BAR,
            @ViewDebug.IntToString(from = TYPE_STATUS_BAR_PANEL, to = "TYPE_STATUS_BAR_PANEL"),
                        to = "TYPE_SEARCH_BAR"),
            @ViewDebug.IntToString(from = TYPE_SECURE_SYSTEM_OVERLAY, to = "TYPE_SECURE_SYSTEM_OVERLAY"),
                @ViewDebug.IntToString(from = TYPE_PHONE,
            @ViewDebug.IntToString(from = TYPE_DRAG, to = "TYPE_DRAG"),
                        to = "TYPE_PHONE"),
            @ViewDebug.IntToString(from = TYPE_STATUS_BAR_SUB_PANEL, to = "TYPE_STATUS_BAR_SUB_PANEL"),
                @ViewDebug.IntToString(from = TYPE_SYSTEM_ALERT,
            @ViewDebug.IntToString(from = TYPE_POINTER, to = "TYPE_POINTER"),
                        to = "TYPE_SYSTEM_ALERT"),
            @ViewDebug.IntToString(from = TYPE_NAVIGATION_BAR, to = "TYPE_NAVIGATION_BAR"),
                @ViewDebug.IntToString(from = TYPE_TOAST,
            @ViewDebug.IntToString(from = TYPE_VOLUME_OVERLAY, to = "TYPE_VOLUME_OVERLAY"),
                        to = "TYPE_TOAST"),
            @ViewDebug.IntToString(from = TYPE_BOOT_PROGRESS, to = "TYPE_BOOT_PROGRESS"),
                @ViewDebug.IntToString(from = TYPE_SYSTEM_OVERLAY,
            @ViewDebug.IntToString(from = TYPE_INPUT_CONSUMER, to = "TYPE_INPUT_CONSUMER"),
                        to = "TYPE_SYSTEM_OVERLAY"),
            @ViewDebug.IntToString(from = TYPE_DREAM, to = "TYPE_DREAM"),
                @ViewDebug.IntToString(from = TYPE_PRIORITY_PHONE,
            @ViewDebug.IntToString(from = TYPE_NAVIGATION_BAR_PANEL, to = "TYPE_NAVIGATION_BAR_PANEL"),
                        to = "TYPE_PRIORITY_PHONE"),
            @ViewDebug.IntToString(from = TYPE_DISPLAY_OVERLAY, to = "TYPE_DISPLAY_OVERLAY"),
                @ViewDebug.IntToString(from = TYPE_SYSTEM_DIALOG,
            @ViewDebug.IntToString(from = TYPE_MAGNIFICATION_OVERLAY, to = "TYPE_MAGNIFICATION_OVERLAY"),
                        to = "TYPE_SYSTEM_DIALOG"),
            @ViewDebug.IntToString(from = TYPE_PRIVATE_PRESENTATION, to = "TYPE_PRIVATE_PRESENTATION"),
                @ViewDebug.IntToString(from = TYPE_KEYGUARD_DIALOG,
            @ViewDebug.IntToString(from = TYPE_VOICE_INTERACTION, to = "TYPE_VOICE_INTERACTION"),
                        to = "TYPE_KEYGUARD_DIALOG"),
            @ViewDebug.IntToString(from = TYPE_VOICE_INTERACTION_STARTING, to = "TYPE_VOICE_INTERACTION_STARTING"),
                @ViewDebug.IntToString(from = TYPE_SYSTEM_ERROR,
            @ViewDebug.IntToString(from = TYPE_DOCK_DIVIDER, to = "TYPE_DOCK_DIVIDER"),
                        to = "TYPE_SYSTEM_ERROR"),
            @ViewDebug.IntToString(from = TYPE_QS_DIALOG, to = "TYPE_QS_DIALOG"),
                @ViewDebug.IntToString(from = TYPE_INPUT_METHOD,
            @ViewDebug.IntToString(from = TYPE_SCREENSHOT, to = "TYPE_SCREENSHOT")
                        to = "TYPE_INPUT_METHOD"),
                @ViewDebug.IntToString(from = TYPE_INPUT_METHOD_DIALOG,
                        to = "TYPE_INPUT_METHOD_DIALOG"),
                @ViewDebug.IntToString(from = TYPE_WALLPAPER,
                        to = "TYPE_WALLPAPER"),
                @ViewDebug.IntToString(from = TYPE_STATUS_BAR_PANEL,
                        to = "TYPE_STATUS_BAR_PANEL"),
                @ViewDebug.IntToString(from = TYPE_SECURE_SYSTEM_OVERLAY,
                        to = "TYPE_SECURE_SYSTEM_OVERLAY"),
                @ViewDebug.IntToString(from = TYPE_DRAG,
                        to = "TYPE_DRAG"),
                @ViewDebug.IntToString(from = TYPE_STATUS_BAR_SUB_PANEL,
                        to = "TYPE_STATUS_BAR_SUB_PANEL"),
                @ViewDebug.IntToString(from = TYPE_POINTER,
                        to = "TYPE_POINTER"),
                @ViewDebug.IntToString(from = TYPE_NAVIGATION_BAR,
                        to = "TYPE_NAVIGATION_BAR"),
                @ViewDebug.IntToString(from = TYPE_VOLUME_OVERLAY,
                        to = "TYPE_VOLUME_OVERLAY"),
                @ViewDebug.IntToString(from = TYPE_BOOT_PROGRESS,
                        to = "TYPE_BOOT_PROGRESS"),
                @ViewDebug.IntToString(from = TYPE_INPUT_CONSUMER,
                        to = "TYPE_INPUT_CONSUMER"),
                @ViewDebug.IntToString(from = TYPE_DREAM,
                        to = "TYPE_DREAM"),
                @ViewDebug.IntToString(from = TYPE_NAVIGATION_BAR_PANEL,
                        to = "TYPE_NAVIGATION_BAR_PANEL"),
                @ViewDebug.IntToString(from = TYPE_DISPLAY_OVERLAY,
                        to = "TYPE_DISPLAY_OVERLAY"),
                @ViewDebug.IntToString(from = TYPE_MAGNIFICATION_OVERLAY,
                        to = "TYPE_MAGNIFICATION_OVERLAY"),
                @ViewDebug.IntToString(from = TYPE_PRESENTATION,
                        to = "TYPE_PRESENTATION"),
                @ViewDebug.IntToString(from = TYPE_PRIVATE_PRESENTATION,
                        to = "TYPE_PRIVATE_PRESENTATION"),
                @ViewDebug.IntToString(from = TYPE_VOICE_INTERACTION,
                        to = "TYPE_VOICE_INTERACTION"),
                @ViewDebug.IntToString(from = TYPE_VOICE_INTERACTION_STARTING,
                        to = "TYPE_VOICE_INTERACTION_STARTING"),
                @ViewDebug.IntToString(from = TYPE_DOCK_DIVIDER,
                        to = "TYPE_DOCK_DIVIDER"),
                @ViewDebug.IntToString(from = TYPE_QS_DIALOG,
                        to = "TYPE_QS_DIALOG"),
                @ViewDebug.IntToString(from = TYPE_SCREENSHOT,
                        to = "TYPE_SCREENSHOT")
        })
        })
        public int type;
        public int type;


@@ -650,6 +694,13 @@ public interface WindowManager extends ViewManager {
         */
         */
        public static final int TYPE_SCREENSHOT = FIRST_SYSTEM_WINDOW + 36;
        public static final int TYPE_SCREENSHOT = FIRST_SYSTEM_WINDOW + 36;


        /**
         * Window type: Window for Presentation on an external display.
         * @see android.app.Presentation
         * @hide
         */
        public static final int TYPE_PRESENTATION = FIRST_SYSTEM_WINDOW + 37;

        /**
        /**
         * End of types of system windows.
         * End of types of system windows.
         */
         */
+4 −0
Original line number Original line Diff line number Diff line
@@ -81,6 +81,7 @@ import static android.view.WindowManager.LayoutParams.TYPE_NAVIGATION_BAR;
import static android.view.WindowManager.LayoutParams.TYPE_NAVIGATION_BAR_PANEL;
import static android.view.WindowManager.LayoutParams.TYPE_NAVIGATION_BAR_PANEL;
import static android.view.WindowManager.LayoutParams.TYPE_PHONE;
import static android.view.WindowManager.LayoutParams.TYPE_PHONE;
import static android.view.WindowManager.LayoutParams.TYPE_POINTER;
import static android.view.WindowManager.LayoutParams.TYPE_POINTER;
import static android.view.WindowManager.LayoutParams.TYPE_PRESENTATION;
import static android.view.WindowManager.LayoutParams.TYPE_PRIORITY_PHONE;
import static android.view.WindowManager.LayoutParams.TYPE_PRIORITY_PHONE;
import static android.view.WindowManager.LayoutParams.TYPE_PRIVATE_PRESENTATION;
import static android.view.WindowManager.LayoutParams.TYPE_PRIVATE_PRESENTATION;
import static android.view.WindowManager.LayoutParams.TYPE_QS_DIALOG;
import static android.view.WindowManager.LayoutParams.TYPE_QS_DIALOG;
@@ -2278,6 +2279,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
            case TYPE_DREAM:
            case TYPE_DREAM:
            case TYPE_INPUT_METHOD:
            case TYPE_INPUT_METHOD:
            case TYPE_WALLPAPER:
            case TYPE_WALLPAPER:
            case TYPE_PRESENTATION:
            case TYPE_PRIVATE_PRESENTATION:
            case TYPE_PRIVATE_PRESENTATION:
            case TYPE_VOICE_INTERACTION:
            case TYPE_VOICE_INTERACTION:
            case TYPE_ACCESSIBILITY_OVERLAY:
            case TYPE_ACCESSIBILITY_OVERLAY:
@@ -2382,6 +2384,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
            case TYPE_STATUS_BAR_SUB_PANEL:
            case TYPE_STATUS_BAR_SUB_PANEL:
            case TYPE_SYSTEM_DIALOG:
            case TYPE_SYSTEM_DIALOG:
            case TYPE_VOLUME_OVERLAY:
            case TYPE_VOLUME_OVERLAY:
            case TYPE_PRESENTATION:
            case TYPE_PRIVATE_PRESENTATION:
            case TYPE_PRIVATE_PRESENTATION:
            case TYPE_DOCK_DIVIDER:
            case TYPE_DOCK_DIVIDER:
                break;
                break;
@@ -2546,6 +2549,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
            return 2;
            return 2;
        }
        }
        switch (type) {
        switch (type) {
        case TYPE_PRESENTATION:
        case TYPE_PRIVATE_PRESENTATION:
        case TYPE_PRIVATE_PRESENTATION:
            return 2;
            return 2;
        case TYPE_WALLPAPER:
        case TYPE_WALLPAPER:
+2 −0
Original line number Original line Diff line number Diff line
@@ -61,6 +61,7 @@ import static android.view.WindowManager.LayoutParams.TYPE_NAVIGATION_BAR_PANEL;
import static android.view.WindowManager.LayoutParams.TYPE_PHONE;
import static android.view.WindowManager.LayoutParams.TYPE_PHONE;
import static android.view.WindowManager.LayoutParams.TYPE_POINTER;
import static android.view.WindowManager.LayoutParams.TYPE_POINTER;
import static android.view.WindowManager.LayoutParams.TYPE_PRIORITY_PHONE;
import static android.view.WindowManager.LayoutParams.TYPE_PRIORITY_PHONE;
import static android.view.WindowManager.LayoutParams.TYPE_PRESENTATION;
import static android.view.WindowManager.LayoutParams.TYPE_PRIVATE_PRESENTATION;
import static android.view.WindowManager.LayoutParams.TYPE_PRIVATE_PRESENTATION;
import static android.view.WindowManager.LayoutParams.TYPE_QS_DIALOG;
import static android.view.WindowManager.LayoutParams.TYPE_QS_DIALOG;
import static android.view.WindowManager.LayoutParams.TYPE_SCREENSHOT;
import static android.view.WindowManager.LayoutParams.TYPE_SCREENSHOT;
@@ -151,6 +152,7 @@ class TestWindowManagerPolicy implements WindowManagerPolicy {
            return 2;
            return 2;
        }
        }
        switch (type) {
        switch (type) {
            case TYPE_PRESENTATION:
            case TYPE_PRIVATE_PRESENTATION:
            case TYPE_PRIVATE_PRESENTATION:
                return 2;
                return 2;
            case TYPE_WALLPAPER:
            case TYPE_WALLPAPER: