ScreenShapeHelper.java revision 2217f61e51ba4b19c56b19297c1e9cf74d7d860f
1package com.android.internal.util;
2
3import android.content.res.Resources;
4import android.content.res.TypedArray;
5import android.os.Build;
6import android.os.SystemProperties;
7import android.util.DisplayMetrics;
8import android.util.TypedValue;
9import android.view.ViewRootImpl;
10
11import com.android.internal.R;
12
13/**
14 * @hide
15 */
16public class ScreenShapeHelper {
17    private static final boolean IS_EMULATOR = Build.HARDWARE.contains("goldfish");
18
19    /**
20     * Return the bottom pixel window outset of a window given its style attributes.
21     * @return An outset dimension in pixels or 0 if no outset should be applied.
22     */
23    public static int getWindowOutsetBottomPx(Resources resources) {
24        if (IS_EMULATOR) {
25            return SystemProperties.getInt(ViewRootImpl.PROPERTY_EMULATOR_WIN_OUTSET_BOTTOM_PX, 0);
26        } else {
27            return resources.getInteger(com.android.internal.R.integer.config_windowOutsetBottom);
28        }
29    }
30}
31