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

Commit b63188de authored by Griff Hazen's avatar Griff Hazen Committed by Android (Google) Code Review
Browse files

Merge "Detect ranchu as emulator" into nyc-dev

parents 3eca3cd3 d3c454db
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -91,6 +91,12 @@ public class Build {
    /** The name of the hardware (from the kernel command line or /proc). */
    public static final String HARDWARE = getString("ro.hardware");

    /**
     * Whether this build was for an emulator device.
     * @hide
     */
    public static final boolean IS_EMULATOR = getString("ro.kernel.qemu").equals("1");

    /** A hardware serial number, if available.  Alphanumeric only, case-insensitive. */
    public static final String SERIAL = getString("ro.serialno");

+1 −8
Original line number Diff line number Diff line
package com.android.internal.util;

import android.content.res.Resources;
import android.content.res.TypedArray;
import android.os.Build;
import android.os.SystemProperties;
import android.util.DisplayMetrics;
import android.util.TypedValue;
import android.view.ViewRootImpl;

import com.android.internal.R;

/**
 * @hide
 */
public class ScreenShapeHelper {
    private static final boolean IS_EMULATOR = Build.HARDWARE.contains("goldfish");

    /**
     * Return the bottom pixel window outset of a window given its style attributes.
     * @return An outset dimension in pixels or 0 if no outset should be applied.
     */
    public static int getWindowOutsetBottomPx(Resources resources) {
        if (IS_EMULATOR) {
        if (Build.IS_EMULATOR) {
            return SystemProperties.getInt(ViewRootImpl.PROPERTY_EMULATOR_WIN_OUTSET_BOTTOM_PX, 0);
        } else {
            return resources.getInteger(com.android.internal.R.integer.config_windowOutsetBottom);
+2 −3
Original line number Diff line number Diff line
@@ -17,12 +17,12 @@
package com.android.server.display;

import android.content.res.Resources;
import android.os.Build;
import com.android.server.LocalServices;
import com.android.server.lights.Light;
import com.android.server.lights.LightsManager;

import android.content.Context;
import android.os.Build;
import android.os.Handler;
import android.os.IBinder;
import android.os.Looper;
@@ -31,7 +31,6 @@ import android.os.SystemProperties;
import android.os.Trace;
import android.util.Slog;
import android.util.SparseArray;
import android.util.SparseBooleanArray;
import android.view.Display;
import android.view.DisplayEventReceiver;
import android.view.Surface;
@@ -388,7 +387,7 @@ final class LocalDisplayAdapter extends DisplayAdapter {
                    mInfo.flags |= DisplayDeviceInfo.FLAG_DEFAULT_DISPLAY
                            | DisplayDeviceInfo.FLAG_ROTATES_WITH_CONTENT;
                    if (res.getBoolean(com.android.internal.R.bool.config_mainBuiltInDisplayIsRound)
                            || (Build.HARDWARE.contains("goldfish")
                            || (Build.IS_EMULATOR
                            && SystemProperties.getBoolean(PROPERTY_EMULATOR_CIRCULAR, false))) {
                        mInfo.flags |= DisplayDeviceInfo.FLAG_ROUND;
                    }
+1 −1
Original line number Diff line number Diff line
@@ -5736,7 +5736,7 @@ public class WindowManagerService extends IWindowManager.Stub
        if (mContext.getResources().getBoolean(
                com.android.internal.R.bool.config_windowEnableCircularEmulatorDisplayOverlay)
                && SystemProperties.getBoolean(PROPERTY_EMULATOR_CIRCULAR, false)
                && Build.HARDWARE.contains("goldfish")) {
                && Build.IS_EMULATOR) {
            mH.sendMessage(mH.obtainMessage(H.SHOW_EMULATOR_DISPLAY_OVERLAY));
        }
    }