Search in sources :

Example 21 with WindowManager

use of android.view.WindowManager in project android_frameworks_base by ParanoidAndroid.

the class PhoneWindowManager method removeStartingWindow.

/** {@inheritDoc} */
public void removeStartingWindow(IBinder appToken, View window) {
    if (DEBUG_STARTING_WINDOW) {
        RuntimeException e = new RuntimeException("here");
        e.fillInStackTrace();
        Log.v(TAG, "Removing starting window for " + appToken + ": " + window, e);
    }
    if (window != null) {
        WindowManager wm = (WindowManager) mContext.getSystemService(Context.WINDOW_SERVICE);
        wm.removeView(window);
    }
}
Also used : IWindowManager(android.view.IWindowManager) WindowManager(android.view.WindowManager)

Example 22 with WindowManager

use of android.view.WindowManager in project android_frameworks_base by ParanoidAndroid.

the class KeyguardTargets method isScreenLarge.

public boolean isScreenLarge() {
    DisplayMetrics dm = new DisplayMetrics();
    WindowManager wm = (WindowManager) mContext.getSystemService(Context.WINDOW_SERVICE);
    Display display = wm.getDefaultDisplay();
    display.getMetrics(dm);
    int shortSize = Math.min(dm.heightPixels, dm.widthPixels);
    int shortSizeDp = shortSize * DisplayMetrics.DENSITY_DEFAULT / DisplayMetrics.DENSITY_DEVICE;
    if (shortSizeDp >= 600) {
        return true;
    }
    return false;
}
Also used : DisplayMetrics(android.util.DisplayMetrics) WindowManager(android.view.WindowManager) Display(android.view.Display)

Example 23 with WindowManager

use of android.view.WindowManager in project android_frameworks_base by ParanoidAndroid.

the class PhoneWindowManager method disablePointerLocation.

private void disablePointerLocation() {
    if (mPointerLocationInputEventReceiver != null) {
        mPointerLocationInputEventReceiver.dispose();
        mPointerLocationInputEventReceiver = null;
    }
    if (mPointerLocationInputChannel != null) {
        mPointerLocationInputChannel.dispose();
        mPointerLocationInputChannel = null;
    }
    if (mPointerLocationView != null) {
        WindowManager wm = (WindowManager) mContext.getSystemService(Context.WINDOW_SERVICE);
        wm.removeView(mPointerLocationView);
        mPointerLocationView = null;
    }
}
Also used : IWindowManager(android.view.IWindowManager) WindowManager(android.view.WindowManager)

Example 24 with WindowManager

use of android.view.WindowManager in project android_frameworks_base by ParanoidAndroid.

the class PhoneWindowManager method addStartingWindow.

/** {@inheritDoc} */
@Override
public View addStartingWindow(IBinder appToken, String packageName, int theme, CompatibilityInfo compatInfo, CharSequence nonLocalizedLabel, int labelRes, int icon, int windowFlags) {
    if (!SHOW_STARTING_ANIMATIONS) {
        return null;
    }
    if (packageName == null) {
        return null;
    }
    WindowManager wm = null;
    View view = null;
    try {
        Context context = mContext;
        if (DEBUG_STARTING_WINDOW)
            Slog.d(TAG, "addStartingWindow " + packageName + ": nonLocalizedLabel=" + nonLocalizedLabel + " theme=" + Integer.toHexString(theme));
        try {
            context = context.createPackageContext(packageName, 0);
            if (theme != context.getThemeResId()) {
                context.setTheme(theme);
            }
        } catch (PackageManager.NameNotFoundException e) {
        // Ignore
        }
        Window win = PolicyManager.makeNewWindow(context);
        final TypedArray ta = win.getWindowStyle();
        if (ta.getBoolean(com.android.internal.R.styleable.Window_windowDisablePreview, false) || ta.getBoolean(com.android.internal.R.styleable.Window_windowShowWallpaper, false)) {
            return null;
        }
        Resources r = context.getResources();
        win.setTitle(r.getText(labelRes, nonLocalizedLabel));
        win.setType(WindowManager.LayoutParams.TYPE_APPLICATION_STARTING);
        // Force the window flags: this is a fake window, so it is not really
        // touchable or focusable by the user.  We also add in the ALT_FOCUSABLE_IM
        // flag because we do know that the next window will take input
        // focus, so we want to get the IME window up on top of us right away.
        win.setFlags(windowFlags | WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE | WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM, windowFlags | WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE | WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM);
        if (!compatInfo.supportsScreen()) {
            win.addFlags(WindowManager.LayoutParams.FLAG_COMPATIBLE_WINDOW);
        }
        win.setLayout(WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.MATCH_PARENT);
        final WindowManager.LayoutParams params = win.getAttributes();
        params.token = appToken;
        params.packageName = packageName;
        params.windowAnimations = win.getWindowStyle().getResourceId(com.android.internal.R.styleable.Window_windowAnimationStyle, 0);
        params.privateFlags |= WindowManager.LayoutParams.PRIVATE_FLAG_FAKE_HARDWARE_ACCELERATED;
        params.privateFlags |= WindowManager.LayoutParams.PRIVATE_FLAG_SHOW_FOR_ALL_USERS;
        params.setTitle("Starting " + packageName);
        wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
        view = win.getDecorView();
        if (win.isFloating()) {
            // earlier.)
            return null;
        }
        if (DEBUG_STARTING_WINDOW)
            Slog.d(TAG, "Adding starting window for " + packageName + " / " + appToken + ": " + (view.getParent() != null ? view : null));
        wm.addView(view, params);
        // window manager... which we can tell by it having a parent.
        return view.getParent() != null ? view : null;
    } catch (WindowManager.BadTokenException e) {
        // ignore
        Log.w(TAG, appToken + " already running, starting window not displayed");
    } catch (RuntimeException e) {
        // don't crash if something else bad happens, for example a
        // failure loading resources because we are loading from an app
        // on external storage that has been unmounted.
        Log.w(TAG, appToken + " failed creating starting window", e);
    } finally {
        if (view != null && view.getParent() == null) {
            Log.w(TAG, "view not successfully added to wm, removing view");
            wm.removeViewImmediate(view);
        }
    }
    return null;
}
Also used : Context(android.content.Context) Window(android.view.Window) PackageManager(android.content.pm.PackageManager) TypedArray(android.content.res.TypedArray) LayoutParams(android.view.WindowManager.LayoutParams) Resources(android.content.res.Resources) PointerLocationView(com.android.internal.widget.PointerLocationView) View(android.view.View) IWindowManager(android.view.IWindowManager) WindowManager(android.view.WindowManager)

Example 25 with WindowManager

use of android.view.WindowManager in project android_frameworks_base by ParanoidAndroid.

the class AppWidgetServiceImpl method computeMaximumWidgetBitmapMemory.

void computeMaximumWidgetBitmapMemory() {
    WindowManager wm = (WindowManager) mContext.getSystemService(Context.WINDOW_SERVICE);
    Display display = wm.getDefaultDisplay();
    Point size = new Point();
    display.getRealSize(size);
    // Cap memory usage at 1.5 times the size of the display
    // 1.5 * 4 bytes/pixel * w * h ==> 6 * w * h
    mMaxWidgetBitmapMemory = 6 * size.x * size.y;
}
Also used : Point(android.graphics.Point) WindowManager(android.view.WindowManager) Display(android.view.Display)

Aggregations

WindowManager (android.view.WindowManager)394 Display (android.view.Display)177 Point (android.graphics.Point)121 DisplayMetrics (android.util.DisplayMetrics)100 View (android.view.View)42 IWindowManager (android.view.IWindowManager)37 Context (android.content.Context)34 Resources (android.content.res.Resources)25 ImageView (android.widget.ImageView)23 Configuration (android.content.res.Configuration)19 SuppressLint (android.annotation.SuppressLint)17 Camera (android.hardware.Camera)17 Intent (android.content.Intent)16 Rect (android.graphics.Rect)16 RemoteException (android.os.RemoteException)15 LayoutParams (android.view.WindowManager.LayoutParams)15 Dialog (android.app.Dialog)14 TextView (android.widget.TextView)14 Bitmap (android.graphics.Bitmap)10 PointerLocationView (com.android.internal.widget.PointerLocationView)10