1
0
Fork 0
mirror of https://github.com/syncthing/syncthing-android.git synced 2024-11-26 06:11:19 +00:00

Add Constants#isRunningOnEmulator

This commit is contained in:
Catfriend1 2019-03-25 19:24:52 +01:00
parent e54cb80262
commit 90f9eccb64

View file

@ -3,6 +3,7 @@ package com.nutomic.syncthingandroid.service;
import android.content.Context; import android.content.Context;
import android.os.Build; import android.os.Build;
import android.os.Environment; import android.os.Environment;
import android.text.TextUtils;
import java.io.File; import java.io.File;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
@ -190,6 +191,16 @@ public class Constants {
return new File(context.getExternalFilesDir(null), "syncthing.log"); return new File(context.getExternalFilesDir(null), "syncthing.log");
} }
/**
* Checks if the app is running on an Android emulator (AVD).
*/
public static Boolean isRunningOnEmulator() {
return !TextUtils.isEmpty(Build.MANUFACTURER) &&
!TextUtils.isEmpty(Build.MODEL) &&
Build.MANUFACTURER.equals("Google") &&
Build.MODEL.equals("Android SDK built for x86");
}
/** /**
* Decide if we should enforce HTTPS when accessing the Web UI and REST API. * Decide if we should enforce HTTPS when accessing the Web UI and REST API.
* Android 4.4 and earlier don't have support for TLS 1.2 requiring us to * Android 4.4 and earlier don't have support for TLS 1.2 requiring us to