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

Commit ad6ae43e authored by Roman Kiryanov's avatar Roman Kiryanov Committed by Automerger Merge Worker
Browse files

Merge "Use Build.IS_EMULATOR to detect if a device is emulator" into main am: 596613a9

parents db71bc07 596613a9
Loading
Loading
Loading
Loading
+2 −6
Original line number Diff line number Diff line
@@ -27,7 +27,7 @@ import static com.google.android.setupcompat.util.WizardManagerHelper.SETTINGS_S
import android.content.ClipData;
import android.content.ClipboardManager;
import android.content.Context;
import android.os.SystemProperties;
import android.os.Build;
import android.provider.Settings;
import android.util.Log;

@@ -87,7 +87,7 @@ public class ClipboardListener implements
        String clipSource = mClipboardManager.getPrimaryClipSource();
        ClipData clipData = mClipboardManager.getPrimaryClip();

        if (shouldSuppressOverlay(clipData, clipSource, isEmulator())) {
        if (shouldSuppressOverlay(clipData, clipSource, Build.IS_EMULATOR)) {
            Log.i(TAG, "Clipboard overlay suppressed.");
            return;
        }
@@ -141,10 +141,6 @@ public class ClipboardListener implements
        return true;
    }

    private static boolean isEmulator() {
        return SystemProperties.getBoolean("ro.boot.qemu", false);
    }

    private boolean isUserSetupComplete() {
        return Settings.Secure.getInt(mContext.getContentResolver(),
                SETTINGS_SECURE_USER_SETUP_COMPLETE, 0) == 1;
+2 −2
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@ import android.content.Intent;
import android.content.IntentFilter;
import android.debug.IAdbManager;
import android.hardware.usb.UsbManager;
import android.os.Build;
import android.os.Bundle;
import android.os.IBinder;
import android.os.ServiceManager;
@@ -69,8 +70,7 @@ public class UsbDebuggingActivity extends AlertActivity
        super.onCreate(icicle);

        // Emulator does not support reseating the usb cable to reshow the dialog.
        boolean isEmulator = SystemProperties.get("ro.boot.qemu").equals("1");
        if (SystemProperties.getInt("service.adb.tcp.port", 0) == 0 && !isEmulator) {
        if (SystemProperties.getInt("service.adb.tcp.port", 0) == 0 && !Build.IS_EMULATOR) {
            mDisconnectedReceiver = new UsbDisconnectedReceiver(this);
            IntentFilter filter = new IntentFilter(UsbManager.ACTION_USB_STATE);
            mBroadcastDispatcher.registerReceiver(mDisconnectedReceiver, filter);
+2 −4
Original line number Diff line number Diff line
@@ -54,6 +54,7 @@ import android.graphics.drawable.Drawable;
import android.hardware.display.DisplayManager;
import android.net.Uri;
import android.os.Binder;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.HandlerThread;
@@ -65,7 +66,6 @@ import android.os.Parcel;
import android.os.RemoteCallbackList;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.os.SystemProperties;
import android.os.UserHandle;
import android.os.UserManager;
import android.provider.DeviceConfig;
@@ -114,8 +114,6 @@ import java.util.function.Consumer;
public class ClipboardService extends SystemService {

    private static final String TAG = "ClipboardService";
    private static final boolean IS_EMULATOR =
            SystemProperties.getBoolean("ro.boot.qemu", false);

    @VisibleForTesting
    public static final long DEFAULT_CLIPBOARD_TIMEOUT_MILLIS = 3600000;
@@ -190,7 +188,7 @@ public class ClipboardService extends SystemService {
        mAutofillInternal = LocalServices.getService(AutofillManagerInternal.class);
        final IBinder permOwner = mUgmInternal.newUriPermissionOwner("clipboard");
        mPermissionOwner = permOwner;
        if (IS_EMULATOR) {
        if (Build.IS_EMULATOR) {
            mEmulatorClipboardMonitor = new EmulatorClipboardMonitor((clip) -> {
                synchronized (mLock) {
                    setPrimaryClipInternalLocked(getClipboardLocked(0, DEVICE_ID_DEFAULT), clip,
+1 −3
Original line number Diff line number Diff line
@@ -1460,8 +1460,6 @@ public final class SystemServer implements Dumpable {
        boolean disableCameraService = SystemProperties.getBoolean("config.disable_cameraservice",
                false);

        boolean isEmulator = SystemProperties.get("ro.boot.qemu").equals("1");

        boolean isWatch = context.getPackageManager().hasSystemFeature(
                PackageManager.FEATURE_WATCH);

@@ -2270,7 +2268,7 @@ public final class SystemServer implements Dumpable {
            if (mPackageManager.hasSystemFeature(PackageManager.FEATURE_USB_HOST)
                    || mPackageManager.hasSystemFeature(
                    PackageManager.FEATURE_USB_ACCESSORY)
                    || isEmulator) {
                    || Build.IS_EMULATOR) {
                // Manage USB host and device support
                t.traceBegin("StartUsbService");
                mSystemServiceManager.startService(USB_SERVICE_CLASS);