Search in sources :

Example 86 with Display

use of android.view.Display in project platform_frameworks_base by android.

the class WindowManagerService method startPositioningLocked.

private boolean startPositioningLocked(WindowState win, boolean resize, float startX, float startY) {
    if (DEBUG_TASK_POSITIONING)
        Slog.d(TAG_WM, "startPositioningLocked: " + "win=" + win + ", resize=" + resize + ", {" + startX + ", " + startY + "}");
    if (win == null || win.getAppToken() == null) {
        Slog.w(TAG_WM, "startPositioningLocked: Bad window " + win);
        return false;
    }
    if (win.mInputChannel == null) {
        Slog.wtf(TAG_WM, "startPositioningLocked: " + win + " has no input channel, " + " probably being removed");
        return false;
    }
    final DisplayContent displayContent = win.getDisplayContent();
    if (displayContent == null) {
        Slog.w(TAG_WM, "startPositioningLocked: Invalid display content " + win);
        return false;
    }
    Display display = displayContent.getDisplay();
    mTaskPositioner = new TaskPositioner(this);
    mTaskPositioner.register(display);
    mInputMonitor.updateInputWindowsLw(true);
    // We need to grab the touch focus so that the touch events during the
    // resizing/scrolling are not sent to the app. 'win' is the main window
    // of the app, it may not have focus since there might be other windows
    // on top (eg. a dialog window).
    WindowState transferFocusFromWin = win;
    if (mCurrentFocus != null && mCurrentFocus != win && mCurrentFocus.mAppToken == win.mAppToken) {
        transferFocusFromWin = mCurrentFocus;
    }
    if (!mInputManager.transferTouchFocus(transferFocusFromWin.mInputChannel, mTaskPositioner.mServerChannel)) {
        Slog.e(TAG_WM, "startPositioningLocked: Unable to transfer touch focus");
        mTaskPositioner.unregister();
        mTaskPositioner = null;
        mInputMonitor.updateInputWindowsLw(true);
        return false;
    }
    mTaskPositioner.startDragLocked(win, resize, startX, startY);
    return true;
}
Also used : Display(android.view.Display)

Example 87 with Display

use of android.view.Display in project platform_frameworks_base by android.

the class WindowManagerService method displayReady.

public void displayReady() {
    for (Display display : mDisplays) {
        displayReady(display.getDisplayId());
    }
    synchronized (mWindowMap) {
        final DisplayContent displayContent = getDefaultDisplayContentLocked();
        readForcedDisplayPropertiesLocked(displayContent);
        mDisplayReady = true;
    }
    try {
        mActivityManager.updateConfiguration(null);
    } catch (RemoteException e) {
    }
    synchronized (mWindowMap) {
        mIsTouchDevice = mContext.getPackageManager().hasSystemFeature(PackageManager.FEATURE_TOUCHSCREEN);
        configureDisplayPolicyLocked(getDefaultDisplayContentLocked());
    }
    try {
        mActivityManager.updateConfiguration(null);
    } catch (RemoteException e) {
    }
    updateCircularDisplayMaskIfNeeded();
}
Also used : RemoteException(android.os.RemoteException) Display(android.view.Display)

Example 88 with Display

use of android.view.Display in project platform_frameworks_base by android.

the class UiDevice method dumpWindowHierarchy.

/**
     * Helper method used for debugging to dump the current window's layout hierarchy.
     * The file root location is /data/local/tmp
     *
     * @param fileName
     * @since API Level 16
     */
public void dumpWindowHierarchy(String fileName) {
    Tracer.trace(fileName);
    AccessibilityNodeInfo root = getAutomatorBridge().getQueryController().getAccessibilityRootNode();
    if (root != null) {
        Display display = getAutomatorBridge().getDefaultDisplay();
        Point size = new Point();
        display.getSize(size);
        AccessibilityNodeInfoDumper.dumpWindowToFile(root, new File(new File(Environment.getDataDirectory(), "local/tmp"), fileName), display.getRotation(), size.x, size.y);
    }
}
Also used : AccessibilityNodeInfo(android.view.accessibility.AccessibilityNodeInfo) Point(android.graphics.Point) File(java.io.File) Display(android.view.Display)

Example 89 with Display

use of android.view.Display in project platform_frameworks_base by android.

the class UiDevice method getDisplaySizeDp.

/**
     * Returns the display size in dp (device-independent pixel)
     *
     * The returned display size is adjusted per screen rotation. Also this will return the actual
     * size of the screen, rather than adjusted per system decorations (like status bar).
     *
     * @return a Point containing the display size in dp
     */
public Point getDisplaySizeDp() {
    Tracer.trace();
    Display display = getAutomatorBridge().getDefaultDisplay();
    Point p = new Point();
    display.getRealSize(p);
    DisplayMetrics metrics = new DisplayMetrics();
    display.getRealMetrics(metrics);
    float dpx = p.x / metrics.density;
    float dpy = p.y / metrics.density;
    p.x = Math.round(dpx);
    p.y = Math.round(dpy);
    return p;
}
Also used : Point(android.graphics.Point) DisplayMetrics(android.util.DisplayMetrics) Display(android.view.Display)

Example 90 with Display

use of android.view.Display in project platform_frameworks_base by android.

the class UiDevice method getDisplayWidth.

/**
     * Gets the width of the display, in pixels. The width and height details
     * are reported based on the current orientation of the display.
     * @return width in pixels or zero on failure
     * @since API Level 16
     */
public int getDisplayWidth() {
    Tracer.trace();
    Display display = getAutomatorBridge().getDefaultDisplay();
    Point p = new Point();
    display.getSize(p);
    return p.x;
}
Also used : Point(android.graphics.Point) Display(android.view.Display)

Aggregations

Display (android.view.Display)697 Point (android.graphics.Point)356 WindowManager (android.view.WindowManager)349 DisplayMetrics (android.util.DisplayMetrics)126 View (android.view.View)57 TextView (android.widget.TextView)54 LinearLayout (android.widget.LinearLayout)45 SuppressLint (android.annotation.SuppressLint)43 Method (java.lang.reflect.Method)41 ImageView (android.widget.ImageView)39 Bitmap (android.graphics.Bitmap)38 Resources (android.content.res.Resources)36 Intent (android.content.Intent)34 Camera (android.hardware.Camera)31 Context (android.content.Context)26 Rect (android.graphics.Rect)25 IOException (java.io.IOException)24 ViewGroup (android.view.ViewGroup)23 Canvas (android.graphics.Canvas)22 RemoteException (android.os.RemoteException)22