Files
UnrealEngineUWP/Engine/Source/Developer/Android/AndroidTargetPlatform/Private/AndroidTargetPlatform.cpp
Joe Barnes 01a13f9d80 Copying //UE4/Dev-Console to //UE4/Dev-Main (Source: //UE4/Dev-Console @ 4362408)
#lockdown Nick.Penwarden
#rb none

============================
  MAJOR FEATURES & CHANGES
============================

Change 4125165 by Ben.Woodhouse

	[INTEGRATE] Integrate from //UE4/Main/...@4124306 to //UE4/Dev-Console/...

Change 4136060 by Marcin.Undak

	Editor: fixed device unclaiming

	#jira UE-58464

Change 4190321 by Marcin.Undak

	Linux: fixes for automation and RecordPerformance

	#jira UE-61053

Change 4199010 by Marcin.Undak

	Linux: remove unnecessary -g option

Change 4201876 by Marcin.Undak

	First implementation of WebM media player for Windows and Linux

Change 4201922 by Marcin.Undak

	Whitelisted WebMem plugin only for Windows and Linux

Change 4202203 by Marcin.Undak

	WebM build fixes

Change 4223102 by Marcin.Undak

	Vulkan: console commands for testing device lost

	#jira UE-61789

Change 4225028 by Marcin.Undak

	WebMMedia: disabled on Linux until fixed compilation issues

Change 4231444 by David.Harvey

	UI - Fixing where the virtual cursor renders.  It doesn't correctly take into account DPI scale, which isn't apparent except on the Xbox One.

	Integrate as edit from CL 4166648.

	#jira UE-62115

Change 4233057 by Marcin.Undak

	TestPAL: added new test for string allocation size

Change 4234649 by Marcin.Undak

	Linux: switched linux plaform to 16bit wide strings

Change 4235253 by Marcin.Undak

	TestPAL: compilation fix for platforms that don't use DirectoryWatcher

Change 4235477 by Marcin.Undak

	Linux: re-enabled WebMMedia plugin

Change 4242242 by Marcin.Undak

	WebMMediaPlayer: implemented proper format retrieving. MediaFrameworkTest now works.

Change 4243321 by Marcin.Undak

	WebMPlayer: static code analisys fix

Change 4243505 by Marcin.Undak

	MediaFrameworkTest: added WebM video for testing

Change 4244646 by Marcin.Undak

	WebMMedia: improved concurrency

Change 4244735 by Arciel.Rekman

	Vulkan: skip unnecessary transitions properly (UE-62348, merge).

	(Edigrating CL 4244274 from Release-4.20)

Change 4246685 by Arciel.Rekman

	PhysX: remove Cygwin from %PATH% on Windows as it confuses CMake (UE-62326).

Change 4247808 by Marcin.Undak

	WebMMediaPlayer: added support for seeking

Change 4254841 by Marcin.Undak

	WebM: module dependencies fix

Change 4255124 by laz.matech

	Updated UMG_AllPaletterWidgets' combo box to include options so that when selected, the dropdown presents 2 options instead of it appearing like it is broken

	#jira none

Change 4256415 by Marcin.Undak

	WebM: added missing editor module

Change 4256716 by Arciel.Rekman

	Make SetReuseAddr() also set SO_REUSEPORT where available (UE-57076).

	- Pull request #4617 by malavon.

	#jira UE-57076

Change 4266049 by Marcin.Undak

	Linux: UnrealLightmass and CrashReportClient compilation fixes

	#jira UE-62521
	#jira UE-62522

Change 4266678 by Arciel.Rekman

	Merge speculative commit to get aligned pointer on mmap().

	(Edigrating CL 4225330)

Change 4267998 by Anthony.Bills

	Fix DBufferC clear color due to bad merge.

	#jira UE-62649

Change 4269441 by Marcin.Undak

	GenericPlatformStrings::VarArgs() implemented %-*s, %lu, %z, %h formatting

	#jira UE-62582

Change 4269712 by Marcin.Undak

	WebMMediaPlayer: removed LibSimpleWebM

Change 4272849 by Marcin.Undak

	WebMMediaPlayer: fixed re-initialisation

Change 4277931 by Arciel.Rekman

	Linux: switch to Vulkan by default (UE-62807).

	- Default behavior: attempt Vulkan first, but in case of failure instead of quitting silently fall back to GL, unless -vulkan is passed.
	- Forcing GL is still possible.

Change 4277965 by Arciel.Rekman

	Fix standalone applications after the Vulkan switch.

Change 4277968 by Arciel.Rekman

	Linux: make CrashReportClient headful (UE-14089).

	- The -unattended flags keep even a headful CRC usable on the servers.
	- ldd did not change. Need to check Localization stuff to see if there are any deployment concerns.

	#jira UE-14089

Change 4279402 by Arciel.Rekman

	Merge from 4.20.1: Vulkan: log validation errors. Also fix handling of some message types (UE-62628).

	(Edigrating 4273516 from //UE4/Release-4.20/... to //UE4/Dev-Console/...)

Change 4279992 by Marcin.Undak

	Linux: fix SlateViewer compilation

	#jira UE-62831

Change 4285613 by Arciel.Rekman

	Vulkan: fix mismatched layout.

	- I tested with RecordPerformance on InfiltratorDemo and haven't found any impact.

Change 4285622 by Arciel.Rekman

	Merged from 4.20.2: Linux: do not refuse to start if system limits cannot be raised (UE-62515).

	- Too aggressive behavior, which can break cooking for no valid reason.
	- If a commandline argument is used, the engine will still treat inability to raise the limits as an error.

	(Edigrating 4273547 from //UE4/Release-4.20/... to //UE4/Dev-Console/...)

Change 4293083 by Arciel.Rekman

	Merging //UE4/Main@4291654 to //UE4/Dev-Console

Change 4295297 by Marcin.Undak

	Vulkan: temporary disable generic pipeline cache saving to prevent crashes

	#jira UE-62848

Change 4300191 by Arciel.Rekman

	Delete files added under lowercase directories.

Change 4300211 by Arciel.Rekman

	Re-add files deleted in previous commit under camel-cased paths.

Change 4300895 by Arciel.Rekman

	Linux: fix editor build

Change 4303543 by Ben.Marsh

	Fix compile error for FortGPUTestBed.

Change 4305659 by Marcin.Undak

	[Vulkan][Engine] Update the Vulkan RHI to obey r.VSync (and the vsync and novsync command-line arguments).

	Change 4222769 by Jason.Stewart@Jason.Stewart_AMD_Dev_Rendering_threadripper-win10 on 2018/07/19 10:55:48

		The original implementation ran into a latent thread hazard between the RHI thread and the rendering thread, where the rendering thread would try to use the backbuffer of the swap chain while the swap chain was being recreated (specifically after the swap chain recreation code had released and nulled out the back buffer, but before swap chain creation had actually happened to get a new back buffer). This implementation addresses that issue.

		This is Tim's code. I'm just submitting it as Tim is currently out of office.

Change 4305661 by Marcin.Undak

	Moved libwebm and libvpx inside WebMMediaPlayer directory

Change 4308659 by Marcin.Undak

	Linux: fixed LLDB visualizers

	#jira UE-52619

Change 4313650 by Marcin.Undak

	WebMMediaPlayer: implemented looping

Change 4321713 by David.Harvey

	removed hard-coded platform labels from device output log window in favour of ITargetPlatform::SupportsFeature + updated editor tooltip with correct platform list.

	https://ec-01.epicgames.net/commander/link/jobDetails/jobs/8641984?

Change 4321942 by Brandon.Schaefer

	Linux: Use the Target RHI list as the default ordering for which RHI is prefered

	Also update the RHI list in the project settings for our default list

	#jira UE-59487

	#review-4316134 @Arciel.Rekman

Change 4322230 by Brandon.Schaefer

	Treat %lf as %f in GenericWidePlatformString

	#jira UE-62582

Change 4322392 by Brandon.Schaefer

	Make sure our fmt size is large enough to check indexes

	#jira none

Change 4322895 by Brandon.Schaefer

	Actually get the current size of Src as it could have been moved down

	#jira none

Change 4327866 by Brandon.Schaefer

	Linux: Tell the platform misc what RHI we are using

	#jira none

Change 4328926 by Brandon.Schaefer

	Linux: Add haptic support for controllers

	Github PR #4167 (thanks maiself!)

	#jira UE-51681

Change 4328963 by Arciel.Rekman

	TestPAL: improve the test by randomizing allocation size.

	- The range will no longer be constrained to <=128KB at once, allocations can be as big as 16MB but they will unevenly distributed, with smaller sizes being more frequent.

Change 4329208 by Arciel.Rekman

	hlslcc: suppressed benign compiler warning during the Linux build (UE-43988).

Change 4329283 by Arciel.Rekman

	Linux: replace CachedOSPageAllocator with PooledVirtualMemoryAllocator for Linux.

	For the explanation of FPooledVirtualMemoryAllocator, see PooledVirtualMemoryAllocator.h
	For the details, test data and comparisons, message Arciel Rekman.

	Relevant command line args added:

	-vmapoolscale=<float> (defaults to 1.4)
	-vmapoolevict
	-novmapoolevict

	By default, freed memory will not be evicted from RAM (unless running on a server)

	Also changed:
	- Removed the fixed-size pool previously used by Linux (and supporting machinery like scaling it on start)
	- Replaced the way we manage free blocks from pointers to a bitmap to reduce memory footprint.

Change 4331946 by Luke.Thatcher

	[CONSOLE] [^] (merging CL 4162064) Implement new thread heart beat clock to solve the suspend/resume problem across all platforms.
	 - The hang and hitch detectors now maintain their own clocks which are ticked by their respective threads.
	 - If the title is suspended, the ticking thread will stop and the clock will stop advancing. On resume, the maximum delta in the clock is clamped to a small value, so we ignore all the time the thread was not ticking for (i.e. the duration of the title being suspended).
	 - As such, we don't need any logic for handling PLM suspend/resume in the hang and hitch detectors, so this change removes that too.

	#jira FORT-96886

Change 4331973 by Luke.Thatcher

	[CONSOLE] [^] (merging CL 4183499) Add frame-present-based hang detection.
	 - RHIs call FThreadHeartBeat::PresentFrame() whenever they present a frame to the swap chain.
	 - These calls form a separate heartbeat from the thread-based ones, allowing the hang detector to fire if, for example, the game thread is stuck in an async loading loop and is ticking the game thread heartbeat, but making no progress.
	 - Also refactored ThreadHeartBeat.cpp to move hang detection logging into a FORCENOINLINE function. This will put OnHang and OnPresentHang at the top of the callstack in retail crash dumps, making the bucketing easier to recognise.

Change 4332200 by Luke.Thatcher

	[CONSOLE] [+] (merging CL 4227517) Add PlatformDebugData to FShaderResource.
	 - We can use this to store platform specific shader symbols etc. The data gets serialized to the DDC and can be retrieved during a cook.
	 - Data is entirely discarded in cooked builds, and is a no-op on platforms which don't implement support for shader debug data.
	 - Bumped shader version to invalidate DDC keys.

Change 4332407 by Luke.Thatcher

	[CONSOLE] [CORE] [!] (merging CL 4279686) Fixed unaligned integer load macro inconsistencies.
	 - Renamed PLATFORM_SUPPORTS_UNALIGNED_INT_LOADS to PLATFORM_SUPPORTS_UNALIGNED_LOADS
	 - Merged it with REQUIRES_ALIGNED_ACCESS and REQUIRES_ALIGNED_INT_ACCESS
	 - Fixed Linux platform which had both the old macros defined to 1, which is wrong because they are mutually exclusive.

Change 4333386 by Luke.Thatcher

	[CONSOLE] [!] (merging CL 4317367) Fix compile error in AnimationCompression.h

Change 4334395 by Arciel.Rekman

	Corrected PLATFORM_DESKTOP definition.

Change 4336190 by Anthony.Bills

	(Original CL4314280) Use the debug file writer when using framepro. This buffers more data which should reduce stalls when writing out on certain platforms.

	#jira none

Change 4336291 by Anthony.Bills

	Use a clamped local clock when timing out the renderthread.

	- This prevents suspend and resume issues on platforms where suspend events may not occur or the system clock is not set to the process time.

	#jira none

Change 4336292 by Anthony.Bills

	(Orignal CL 4195778) Fix printing of the hang detector multiplier and other logging.

	"f" is the correct format specifier for a double.

	#jira none

Change 4336307 by Anthony.Bills

	(Orignal CL 4257875) Use the correct clock when printing the scoped hitch stat.

	- Needs to be the internal FGameThreadHitchHeartBeat clock incase FPlatformTime::Seconds becomes out of sync with FrameStartTime.

	#jira none

Change 4336321 by Anthony.Bills

	(Original CL 4258186) Add GetNoInit function to FGameThreadHitchHeartBeat.

	#jira none

Change 4336397 by Anthony.Bills

	Fix redefinition of macro.

	#jira none

Change 4336738 by Brandon.Schaefer

	Linux: Add options for ASan, TSan, and UBSan

	#jira UE-62784 UE-62803 UE-62804

Change 4336791 by Brandon.Schaefer

	Linux: Add missing xml comments

	#jira none

Change 4336957 by Joe.Barnes

	Integrate as edit CL#4218145:

	Convert some of our Vector macros to inline functions as thier names class with 3rd party functions.

	#jira ue-61733

Change 4338228 by Arciel.Rekman

	Switch to v12 Linux cross-toolchain (UE-63589).

	#jira UE-63589

Change 4339195 by Ben.Woodhouse

	Integrate-as-edit latest CSV profiler changes up to CL 4292187

Change 4339237 by Ben.Woodhouse

	Integrate-as-edit CL 4226269
	Add support for extern GPU stats, so we can use one stat across multiple CPPs
	Fix the Forward rendering GPUProjection stat

Change 4339239 by Ben.Woodhouse

	Integrate-as-edit CL 4292520

	Support different sized buffers for FArchiveFileWriterGeneric per-platform so we can tune per-platform as needed.
	No changes to existing defaults values of 1KB for read, 4KB for write:

	        #define PLATFORM_FILE_READER_BUFFER_SIZE 1024
	        #define PLATFORM_FILE_WRITER_BUFFER_SIZE 4096
	        #define PLATFORM_DEBUG_FILE_WRITER_BUFFER_SIZE 4096

Change 4339241 by Ben.Woodhouse

	Integrate-as-edit CL 4210462
	Comment out an assert while I investigate properly (doesn't appear to be fatal)

Change 4339265 by Anthony.Bills

	[Linux] Fix ContainerBuildThirdParty.sh to pick the first default interface.

	#jira none

Change 4339274 by Anthony.Bills

	[Linux] Cache the bundled toolchain when using git builds.

	- Also will not attempt to download the toolchain if AutoSDK or Multiarch root are specified.

	#jira UE-63394

Change 4339623 by Anthony.Bills

	[Linux] Update native toolchain buildscript to support clang 6.0.1

	- Main issue was due to libxml2 as an extra dependency of some test libraries, so needs to be disabled via DLLVM_ENABLE_LIBXML2.

	#jira UE-63588

Change 4339685 by Anthony.Bills

	[Linux] Update toolchain setup script to download v12 when it is available.

	#jira UE-63588

Change 4339833 by Ben.Woodhouse

	[INTEGRATE] Integrate from //UE4/Main/...@4339548 to //UE4/Dev-Console/...

Change 4339843 by Ben.Woodhouse

	Attempt to fix a weird possible bad merge issue

Change 4339890 by Ben.Woodhouse

	Fix a build issue
	#jira nojira

Change 4340314 by Anthony.Bills

	Fix mesh decal rendering when write mask is enabled and no deferred decals are in the scene.

	#jira UE-55159

Change 4341099 by Marcin.Undak

	Mediashader fix

	#jira UE-63650

Change 4341106 by Marcin.Undak

	QAGame: added MediaPlayer for Linux test

	#jira UE-59667
	#jira UE-62775
	#jira UE-62780

Change 4341107 by Marcin.Undak

	WebMMediaPlayer: blacklist all not supported platforms

	#jira UE-59667
	#jira UE-62775
	#jira UE-62780

Change 4341110 by Marcin.Undak

	WebMMediaPlayer: enable for Unix platforms

	#jira UE-59667
	#jira UE-62775
	#jira UE-62780

Change 4341804 by Luke.Thatcher

	[CONSOLE] [!] Fix memory scribble in black depth texture cube on platforms with 16-bit depth.
	 - Original code was writing a FColor into the locked texture data, which causes a 2 byte scribble if the PF_ShadowDepth format is 16-bits.

	[!] Also fixed GWhiteTextureCube being black. FColor::White is not a compile-time constant, so an initialization order problem meant the value of FColor::White is actually black when the GWhiteTextureCube constructor runs.

	#jira none

Change 4342244 by Anthony.Bills

	[Linux] Allow restarting the crashed application from the crash report client

	#jira UE-62903

Change 4342636 by Brandon.Schaefer

	Linux: Update LLVM libc++.a libc++abi.a with version 6.0.1

	#jira UE-63587

Change 4343420 by Marcin.Undak

	Fixed assert in console

	#jira UE-63643


Change 4345166 by Luke.Thatcher

	[CONSOLE] [!] (merging CL 4345072) Fix initialization order bug with FColor and FLinearColor constants.
	 - The original constants were dynamically initialized during startup. Using these constants from other global constructors may result in getting the wrong value (transparent black) if a given constructor runs before FColor/FLinearColor's constructor.
	 - Adding constexpr to the FColor/FLinearColor constructor makes these constants known at compile-time, and included in the readonly data section, so they don't require dynamic initialization.

	[~] Also restores the original constant color values in RenderUtils.cpp

	#jira none

Change 4345860 by Arciel.Rekman

	Make StompMalloc return 16-byte aligned memory on 64 bit platforms (UE-63743).

	#jira UE-63743

	(Edigrating 4345734 from Release-4.20)

Change 4345950 by Brandon.Schaefer

	Linux: Remove libelf/libdwarf fallback for symbolicating symbols during a crash

	#jira UE-63103

Change 4350249 by David.Harvey

	helper function to retrieve an LLM tag's name, including platform tags.

Change 4351184 by Ben.Woodhouse

	[INTEGRATE] Integrate from //UE4/Main/...@4348973 to //UE4/Dev-Console/...

Change 4351593 by Ben.Woodhouse

	Clean up aggressive batching (remove xbox specific #if and //TODO)
	#jira UE-46780

Change 4351734 by James.Cobbett

	Setting TM-ShaderModels_Niagara to always load

Change 4351984 by Marcin.Undak

	QAGame: restored platform media source in TM-ShaderModels map

Change 4353508 by Ben.Woodhouse

	[INTEGRATE] Integrate from //UE4/Main/...@4353110 to //UE4/Dev-Console/...

Change 4354237 by Anthony.Bills

	[Linux] Fix Linux compilation issues due to change over to TCHAR being char16_t.

	#jira UE-63544

Change 4354334 by Anthony.Bills

	[Linux] (Missing file from CL 4354237) Fix Linux compilation issues due to change over to TCHAR being char16_t.

	#jira UE-63544

Change 4355994 by Brandon.Schaefer

	Linux: Agree not Agreed

	#jira UE-63937

Change 4356068 by Joe.Barnes

	Replace a duplicate DEFINE_EXPRESSION_NODE_TYPE(bool,...) causing errors with iOS unity build compiles. Remove version in ExpressionParser.cpp and include TextFilterExpressionEvaluator.h.

	#jira ue-63877

Change 4357726 by David.Harvey

	[iOS] add clean support for device output log, after catchup.

	#jira none

Change 4357724 by Ben.Woodhouse

	[INTEGRATE] Integrate from //UE4/Main/...@4357176 to //UE4/Dev-Console/...

Change 4359634 by Ben.Woodhouse

	[INTEGRATE] Integrate from //UE4/Main/...@4359072 to //UE4/Dev-Console/...

Change 4359958 by Ben.Woodhouse

	Fix FortGPUTestbed merge issues via p4 copy (content files didn't get moved before for some reason)

Change 4361108 by Anthony.Bills

	Fix webm deprecation issues with DrawPrimitiveUp.

	#jira UE-64012

Change 4361896 by James.Cobbett

	Re-saving materials so that they render correctly outside of the editor.

Change 4362262 by Anthony.Bills

	Fix for WebM video decoder crash.

	#jira UE-64025

[CL 4362700 by Joe Barnes in Main branch]
2018-09-12 15:59:49 -04:00

822 lines
24 KiB
C++

// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
/*=============================================================================
AndroidTargetPlatform.inl: Implements the FAndroidTargetPlatform class.
=============================================================================*/
/* FAndroidTargetPlatform structors
*****************************************************************************/
#include "AndroidTargetPlatform.h"
#include "CoreTypes.h"
#include "Misc/AssertionMacros.h"
#include "Containers/Array.h"
#include "Containers/UnrealString.h"
#include "UObject/NameTypes.h"
#include "Logging/LogMacros.h"
#include "Stats/Stats.h"
#include "Serialization/Archive.h"
#include "Misc/FileHelper.h"
#include "Misc/SecureHash.h"
#include "HAL/FileManager.h"
#include "HAL/PlatformFilemanager.h"
#include "Interfaces/IAndroidDeviceDetectionModule.h"
#include "Interfaces/IAndroidDeviceDetection.h"
#include "Modules/ModuleManager.h"
#include "Misc/SecureHash.h"
#if WITH_ENGINE
#include "AudioCompressionSettings.h"
#endif
#define LOCTEXT_NAMESPACE "FAndroidTargetPlatform"
class Error;
class FAndroidTargetDevice;
class FConfigCacheIni;
class FModuleManager;
class FScopeLock;
class FStaticMeshLODSettings;
class FTargetDeviceId;
class FTicker;
class IAndroidDeviceDetectionModule;
class UTexture;
class UTextureLODSettings;
struct FAndroidDeviceInfo;
enum class ETargetPlatformFeatures;
template<typename TPlatformProperties> class TTargetPlatformBase;
static FString GetLicensePath()
{
auto &AndroidDeviceDetection = FModuleManager::LoadModuleChecked<IAndroidDeviceDetectionModule>("AndroidDeviceDetection");
IAndroidDeviceDetection* DeviceDetection = AndroidDeviceDetection.GetAndroidDeviceDetection();
FString ADBPath = DeviceDetection->GetADBPath();
if (!FPaths::FileExists(*ADBPath))
{
return TEXT("");
}
// strip off the adb.exe part
FString PlatformToolsPath;
FString Filename;
FString Extension;
FPaths::Split(ADBPath, PlatformToolsPath, Filename, Extension);
// remove the platform-tools part and point to licenses
FPaths::NormalizeDirectoryName(PlatformToolsPath);
FString LicensePath = PlatformToolsPath + "/../licenses";
FPaths::CollapseRelativeDirectories(LicensePath);
return LicensePath;
}
#if WITH_ENGINE
static bool GetLicenseHash(FSHAHash& LicenseHash)
{
bool bLicenseValid = false;
// from Android SDK Tools 25.2.3
FString LicenseFilename = FPaths::EngineDir() + TEXT("Source/ThirdParty/Android/package.xml");
// Create file reader
TUniquePtr<FArchive> FileReader(IFileManager::Get().CreateFileReader(*LicenseFilename));
if (FileReader)
{
// Create buffer for file input
uint32 BufferSize = FileReader->TotalSize();
uint8* Buffer = (uint8*)FMemory::Malloc(BufferSize);
FileReader->Serialize(Buffer, BufferSize);
uint8 StartPattern[] = "<license id=\"android-sdk-license\" type=\"text\">";
int32 StartPatternLength = strlen((char *)StartPattern);
uint8* LicenseStart = Buffer;
uint8* BufferEnd = Buffer + BufferSize - StartPatternLength;
while (LicenseStart < BufferEnd)
{
if (!memcmp(LicenseStart, StartPattern, StartPatternLength))
{
break;
}
LicenseStart++;
}
if (LicenseStart < BufferEnd)
{
LicenseStart += StartPatternLength;
uint8 EndPattern[] = "</license>";
int32 EndPatternLength = strlen((char *)EndPattern);
uint8* LicenseEnd = LicenseStart;
BufferEnd = Buffer + BufferSize - EndPatternLength;
while (LicenseEnd < BufferEnd)
{
if (!memcmp(LicenseEnd, EndPattern, EndPatternLength))
{
break;
}
LicenseEnd++;
}
if (LicenseEnd < BufferEnd)
{
int32 LicenseLength = LicenseEnd - LicenseStart;
FSHA1::HashBuffer(LicenseStart, LicenseLength, LicenseHash.Hash);
bLicenseValid = true;
}
}
FMemory::Free(Buffer);
}
return bLicenseValid;
}
#endif
static bool HasLicense()
{
#if WITH_ENGINE
FString LicensePath = GetLicensePath();
if (LicensePath.IsEmpty())
{
return false;
}
// directory must exist
IPlatformFile& PlatformFile = FPlatformFileManager::Get().GetPlatformFile();
if (!PlatformFile.DirectoryExists(*LicensePath))
{
return false;
}
// license file must exist
FString LicenseFilename = LicensePath + "/android-sdk-license";
if (!PlatformFile.FileExists(*LicenseFilename))
{
return false;
}
FSHAHash LicenseHash;
if (!GetLicenseHash(LicenseHash))
{
return false;
}
// contents must match hash of license text
FString FileData = "";
FFileHelper::LoadFileToString(FileData, *LicenseFilename);
TArray<FString> lines;
int32 lineCount = FileData.ParseIntoArray(lines, TEXT("\n"), true);
FString LicenseString = LicenseHash.ToString().ToLower();
for (FString &line : lines)
{
if (line.TrimStartAndEnd().Equals(LicenseString))
{
return true;
}
}
#endif
// doesn't match
return false;
}
FAndroidTargetPlatform::FAndroidTargetPlatform(bool bInIsClient )
: bIsClient(bInIsClient)
, DeviceDetection(nullptr)
{
#if WITH_ENGINE
FConfigCacheIni::LoadLocalIniFile(EngineSettings, TEXT("Engine"), true, *IniPlatformName());
TextureLODSettings = nullptr; // These are registered by the device profile system.
StaticMeshLODSettings.Initialize(EngineSettings);
#endif
TickDelegate = FTickerDelegate::CreateRaw(this, &FAndroidTargetPlatform::HandleTicker);
TickDelegateHandle = FTicker::GetCoreTicker().AddTicker(TickDelegate, 4.0f);
}
FAndroidTargetPlatform::~FAndroidTargetPlatform()
{
FTicker::GetCoreTicker().RemoveTicker(TickDelegateHandle);
}
FAndroidTargetDevicePtr FAndroidTargetPlatform::CreateTargetDevice(const ITargetPlatform& InTargetPlatform, const FString& InSerialNumber, const FString& InAndroidVariant) const
{
return MakeShareable(new FAndroidTargetDevice(InTargetPlatform, InSerialNumber, InAndroidVariant));
}
bool FAndroidTargetPlatform::SupportsES2() const
{
// default to support ES2
bool bBuildForES2 = true;
#if WITH_ENGINE
GConfig->GetBool(TEXT("/Script/AndroidRuntimeSettings.AndroidRuntimeSettings"), TEXT("bBuildForES2"), bBuildForES2, GEngineIni);
#endif
return bBuildForES2;
}
bool FAndroidTargetPlatform::SupportsES31() const
{
// default no support for ES31
bool bBuildForES31 = false;
#if WITH_ENGINE
GConfig->GetBool(TEXT("/Script/AndroidRuntimeSettings.AndroidRuntimeSettings"), TEXT("bBuildForES31"), bBuildForES31, GEngineIni);
#endif
return bBuildForES31;
}
bool FAndroidTargetPlatform::SupportsAEP() const
{
return false;
}
bool FAndroidTargetPlatform::SupportsVulkan() const
{
// default to not supporting Vulkan
bool bSupportsVulkan = false;
#if WITH_ENGINE
GConfig->GetBool(TEXT("/Script/AndroidRuntimeSettings.AndroidRuntimeSettings"), TEXT("bSupportsVulkan"), bSupportsVulkan, GEngineIni);
#endif
return bSupportsVulkan;
}
bool FAndroidTargetPlatform::SupportsSoftwareOcclusion() const
{
// default to not supporting
bool bSupportsSoftwareOcclusion = false;
#if WITH_ENGINE
int32 IntValue = 0;
GConfig->GetInt(TEXT("ConsoleVariables"), TEXT("r.Mobile.AllowSoftwareOcclusion"), IntValue, GEngineIni);
bSupportsSoftwareOcclusion = (IntValue != 0);
#endif
return bSupportsSoftwareOcclusion;
}
/* ITargetPlatform overrides
*****************************************************************************/
void FAndroidTargetPlatform::GetAllDevices( TArray<ITargetDevicePtr>& OutDevices ) const
{
OutDevices.Reset();
for (auto Iter = Devices.CreateConstIterator(); Iter; ++Iter)
{
OutDevices.Add(Iter.Value());
}
}
ECompressionFlags FAndroidTargetPlatform::GetBaseCompressionMethod( ) const
{
return COMPRESS_ZLIB;
}
ITargetDevicePtr FAndroidTargetPlatform::GetDefaultDevice( ) const
{
// return the first device in the list
if (Devices.Num() > 0)
{
auto Iter = Devices.CreateConstIterator();
if (Iter)
{
return Iter.Value();
}
}
return nullptr;
}
ITargetDevicePtr FAndroidTargetPlatform::GetDevice( const FTargetDeviceId& DeviceId )
{
if (DeviceId.GetPlatformName() == PlatformName())
{
return Devices.FindRef(DeviceId.GetDeviceName());
}
return nullptr;
}
bool FAndroidTargetPlatform::IsRunningPlatform( ) const
{
return false; // This platform never runs the target platform framework
}
bool FAndroidTargetPlatform::IsSdkInstalled(bool bProjectHasCode, FString& OutDocumentationPath) const
{
OutDocumentationPath = FString("Shared/Tutorials/SettingUpAndroidTutorial");
return true;
}
int32 FAndroidTargetPlatform::CheckRequirements(const FString& ProjectPath, bool bProjectHasCode, FString& OutTutorialPath, FString& OutDocumentationPath, FText& CustomizedLogMessage) const
{
OutDocumentationPath = TEXT("Platforms/Android/GettingStarted");
int32 bReadyToBuild = ETargetPlatformReadyStatus::Ready;
if (!IsSdkInstalled(bProjectHasCode, OutTutorialPath))
{
bReadyToBuild |= ETargetPlatformReadyStatus::SDKNotFound;
}
bool bEnableGradle;
GConfig->GetBool(TEXT("/Script/AndroidRuntimeSettings.AndroidRuntimeSettings"), TEXT("bEnableGradle"), bEnableGradle, GEngineIni);
if (bEnableGradle)
{
// need to check license was accepted
if (!HasLicense())
{
OutTutorialPath.Empty();
CustomizedLogMessage = LOCTEXT("AndroidLicenseNotAcceptedMessageDetail", "SDK License must be accepted in the Android project settings to deploy your app to the device.");
bReadyToBuild |= ETargetPlatformReadyStatus::LicenseNotAccepted;
}
}
return bReadyToBuild;
}
bool FAndroidTargetPlatform::SupportsFeature( ETargetPlatformFeatures Feature ) const
{
switch (Feature)
{
case ETargetPlatformFeatures::Packaging:
case ETargetPlatformFeatures::DeviceOutputLog:
return true;
case ETargetPlatformFeatures::LowQualityLightmaps:
case ETargetPlatformFeatures::MobileRendering:
return SupportsES31() || SupportsES2() || SupportsVulkan();
case ETargetPlatformFeatures::HighQualityLightmaps:
case ETargetPlatformFeatures::Tessellation:
case ETargetPlatformFeatures::DeferredRendering:
return SupportsAEP();
case ETargetPlatformFeatures::SoftwareOcclusion:
return SupportsSoftwareOcclusion();
default:
break;
}
return TTargetPlatformBase<FAndroidPlatformProperties>::SupportsFeature(Feature);
}
#if WITH_ENGINE
void FAndroidTargetPlatform::GetAllPossibleShaderFormats( TArray<FName>& OutFormats ) const
{
static FName NAME_OPENGL_ES2(TEXT("GLSL_ES2"));
static FName NAME_GLSL_310_ES_EXT(TEXT("GLSL_310_ES_EXT"));
static FName NAME_SF_VULKAN_ES31_ANDROID(TEXT("SF_VULKAN_ES31_ANDROID_NOUB"));
static FName NAME_GLSL_ES3_1_ANDROID(TEXT("GLSL_ES3_1_ANDROID"));
if (SupportsVulkan())
{
OutFormats.AddUnique(NAME_SF_VULKAN_ES31_ANDROID);
}
if (SupportsES2())
{
OutFormats.AddUnique(NAME_OPENGL_ES2);
}
if (SupportsES31())
{
OutFormats.AddUnique(NAME_GLSL_ES3_1_ANDROID);
}
if (SupportsAEP())
{
OutFormats.AddUnique(NAME_GLSL_310_ES_EXT);
}
}
void FAndroidTargetPlatform::GetAllTargetedShaderFormats( TArray<FName>& OutFormats ) const
{
GetAllPossibleShaderFormats(OutFormats);
}
const FStaticMeshLODSettings& FAndroidTargetPlatform::GetStaticMeshLODSettings( ) const
{
return StaticMeshLODSettings;
}
void FAndroidTargetPlatform::GetTextureFormats( const UTexture* InTexture, TArray<FName>& OutFormats ) const
{
check(InTexture);
// The order we add texture formats to OutFormats is important. When multiple formats are cooked
// and supported by the device, the first supported format listed will be used.
// eg, ETC1/uncompressed should always be last
bool bNoCompression = InTexture->CompressionNone // Code wants the texture uncompressed.
|| (InTexture->LODGroup == TEXTUREGROUP_ColorLookupTable) // Textures in certain LOD groups should remain uncompressed.
|| (InTexture->LODGroup == TEXTUREGROUP_Bokeh)
|| (InTexture->CompressionSettings == TC_EditorIcon)
|| (InTexture->Source.GetSizeX() < 4) // Don't compress textures smaller than the DXT block size.
|| (InTexture->Source.GetSizeY() < 4)
|| (InTexture->Source.GetSizeX() % 4 != 0)
|| (InTexture->Source.GetSizeY() % 4 != 0);
bool bIsNonPOT = false;
#if WITH_EDITORONLY_DATA
// is this texture not a power of 2?
bIsNonPOT = !InTexture->Source.IsPowerOfTwo();
#endif
// Determine the pixel format of the compressed texture.
if (InTexture->LODGroup == TEXTUREGROUP_Shadowmap)
{
// forward rendering only needs one channel for shadow maps
OutFormats.Add(AndroidTexFormat::NameG8);
}
else if (bNoCompression && InTexture->HasHDRSource())
{
OutFormats.Add(AndroidTexFormat::NameRGBA16F);
}
else if (bNoCompression)
{
OutFormats.Add(AndroidTexFormat::NameBGRA8);
}
else if (InTexture->CompressionSettings == TC_HDR
|| InTexture->CompressionSettings == TC_HDR_Compressed)
{
OutFormats.Add(AndroidTexFormat::NameRGBA16F);
}
else if (InTexture->CompressionSettings == TC_Normalmap)
{
AddTextureFormatIfSupports(AndroidTexFormat::NamePVRTC4, OutFormats, bIsNonPOT);
AddTextureFormatIfSupports(AndroidTexFormat::NameDXT5, OutFormats, bIsNonPOT);
AddTextureFormatIfSupports(AndroidTexFormat::NameATC_RGBA_I, OutFormats, bIsNonPOT);
AddTextureFormatIfSupports(AndroidTexFormat::NameETC2_RGB, OutFormats, bIsNonPOT);
AddTextureFormatIfSupports(AndroidTexFormat::NameAutoETC1a, OutFormats, bIsNonPOT);
AddTextureFormatIfSupports(AndroidTexFormat::NameAutoETC1, OutFormats, bIsNonPOT);
}
else if (InTexture->CompressionSettings == TC_Displacementmap)
{
OutFormats.Add(AndroidTexFormat::NameRGBA16F);
}
else if (InTexture->CompressionSettings == TC_VectorDisplacementmap)
{
OutFormats.Add(AndroidTexFormat::NameBGRA8);
}
else if (InTexture->CompressionSettings == TC_Grayscale)
{
OutFormats.Add(AndroidTexFormat::NameG8);
}
else if (InTexture->CompressionSettings == TC_Alpha)
{
OutFormats.Add(AndroidTexFormat::NameG8);
}
else if (InTexture->CompressionSettings == TC_DistanceFieldFont)
{
OutFormats.Add(AndroidTexFormat::NameG8);
}
else if (InTexture->bForcePVRTC4
|| InTexture->CompressionSettings == TC_BC7)
{
AddTextureFormatIfSupports(AndroidTexFormat::NamePVRTC4, OutFormats, bIsNonPOT);
AddTextureFormatIfSupports(AndroidTexFormat::NameDXT5, OutFormats, bIsNonPOT);
AddTextureFormatIfSupports(AndroidTexFormat::NameATC_RGBA_I, OutFormats, bIsNonPOT);
AddTextureFormatIfSupports(AndroidTexFormat::NameAutoETC2, OutFormats, bIsNonPOT);
AddTextureFormatIfSupports(AndroidTexFormat::NameAutoETC1a, OutFormats, bIsNonPOT);
AddTextureFormatIfSupports(AndroidTexFormat::NameAutoETC1, OutFormats, bIsNonPOT);
}
else if (InTexture->CompressionNoAlpha)
{
AddTextureFormatIfSupports(AndroidTexFormat::NamePVRTC2, OutFormats, bIsNonPOT);
AddTextureFormatIfSupports(AndroidTexFormat::NameDXT1, OutFormats, bIsNonPOT);
AddTextureFormatIfSupports(AndroidTexFormat::NameATC_RGB, OutFormats, bIsNonPOT);
AddTextureFormatIfSupports(AndroidTexFormat::NameETC2_RGB, OutFormats, bIsNonPOT);
AddTextureFormatIfSupports(AndroidTexFormat::NameAutoETC1a, OutFormats, bIsNonPOT);
AddTextureFormatIfSupports(AndroidTexFormat::NameETC1, OutFormats, bIsNonPOT);
}
else if (InTexture->bDitherMipMapAlpha)
{
AddTextureFormatIfSupports(AndroidTexFormat::NamePVRTC4, OutFormats, bIsNonPOT);
AddTextureFormatIfSupports(AndroidTexFormat::NameDXT5, OutFormats, bIsNonPOT);
AddTextureFormatIfSupports(AndroidTexFormat::NameATC_RGBA_I, OutFormats, bIsNonPOT);
AddTextureFormatIfSupports(AndroidTexFormat::NameAutoETC2, OutFormats, bIsNonPOT);
AddTextureFormatIfSupports(AndroidTexFormat::NameAutoETC1a, OutFormats, bIsNonPOT);
AddTextureFormatIfSupports(AndroidTexFormat::NameAutoETC1, OutFormats, bIsNonPOT);
}
else
{
AddTextureFormatIfSupports(AndroidTexFormat::NameAutoPVRTC, OutFormats, bIsNonPOT);
AddTextureFormatIfSupports(AndroidTexFormat::NameAutoDXT, OutFormats, bIsNonPOT);
AddTextureFormatIfSupports(AndroidTexFormat::NameAutoATC, OutFormats, bIsNonPOT);
AddTextureFormatIfSupports(AndroidTexFormat::NameAutoETC2, OutFormats, bIsNonPOT);
AddTextureFormatIfSupports(AndroidTexFormat::NameAutoETC1a, OutFormats, bIsNonPOT);
AddTextureFormatIfSupports(AndroidTexFormat::NameAutoETC1, OutFormats, bIsNonPOT);
}
}
void FAndroidTargetPlatform::GetAllTextureFormats(TArray<FName>& OutFormats) const
{
OutFormats.Add(AndroidTexFormat::NameG8);
OutFormats.Add(AndroidTexFormat::NameRGBA16F);
OutFormats.Add(AndroidTexFormat::NameBGRA8);
OutFormats.Add(AndroidTexFormat::NameRGBA16F);
OutFormats.Add(AndroidTexFormat::NameRGBA16F);
OutFormats.Add(AndroidTexFormat::NameBGRA8);
OutFormats.Add(AndroidTexFormat::NameG8);
OutFormats.Add(AndroidTexFormat::NameG8);
OutFormats.Add(AndroidTexFormat::NameG8);
auto AddAllTextureFormatIfSupports = [=, &OutFormats](bool bIsNonPOT)
{
AddTextureFormatIfSupports(AndroidTexFormat::NameAutoPVRTC, OutFormats, bIsNonPOT);
AddTextureFormatIfSupports(AndroidTexFormat::NamePVRTC2, OutFormats, bIsNonPOT);
AddTextureFormatIfSupports(AndroidTexFormat::NamePVRTC4, OutFormats, bIsNonPOT);
AddTextureFormatIfSupports(AndroidTexFormat::NameAutoDXT, OutFormats, bIsNonPOT);
AddTextureFormatIfSupports(AndroidTexFormat::NameDXT1, OutFormats, bIsNonPOT);
AddTextureFormatIfSupports(AndroidTexFormat::NameDXT5, OutFormats, bIsNonPOT);
AddTextureFormatIfSupports(AndroidTexFormat::NameATC_RGB, OutFormats, bIsNonPOT);
AddTextureFormatIfSupports(AndroidTexFormat::NameATC_RGBA_I, OutFormats, bIsNonPOT);
AddTextureFormatIfSupports(AndroidTexFormat::NameAutoETC1, OutFormats, bIsNonPOT);
AddTextureFormatIfSupports(AndroidTexFormat::NameAutoETC1a, OutFormats, bIsNonPOT);
AddTextureFormatIfSupports(AndroidTexFormat::NameAutoETC2, OutFormats, bIsNonPOT);
AddTextureFormatIfSupports(AndroidTexFormat::NameAutoATC, OutFormats, bIsNonPOT);
};
AddAllTextureFormatIfSupports(true);
AddAllTextureFormatIfSupports(false);
}
void FAndroidTargetPlatform::GetReflectionCaptureFormats( TArray<FName>& OutFormats ) const
{
if (SupportsAEP())
{
// use Full HDR with AEP
OutFormats.Add(FName(TEXT("FullHDR")));
}
// always emit encoded
OutFormats.Add(FName(TEXT("EncodedHDR")));
}
const UTextureLODSettings& FAndroidTargetPlatform::GetTextureLODSettings() const
{
return *TextureLODSettings;
}
FName FAndroidTargetPlatform::GetWaveFormat( const class USoundWave* Wave ) const
{
static bool formatRead = false;
static FName NAME_FORMAT;
if (!formatRead)
{
formatRead = true;
FString audioSetting;
if (!GConfig->GetString(TEXT("/Script/AndroidRuntimeSettings.AndroidRuntimeSettings"), TEXT("AndroidAudio"), audioSetting, GEngineIni))
{
audioSetting = TEXT("DEFAULT");
}
#if WITH_OGGVORBIS
if (audioSetting == TEXT("OGG") || audioSetting == TEXT("Default"))
{
static FName NAME_OGG(TEXT("OGG"));
NAME_FORMAT = NAME_OGG;
}
#else
if (audioSetting == TEXT("OGG"))
{
UE_LOG(LogAudio, Error, TEXT("Attemped to select Ogg Vorbis encoding when the cooker is built without Ogg Vorbis support."));
}
#endif
else
{
// Otherwise return ADPCM as it'll either be option '2' or 'default' depending on WITH_OGGVORBIS config
static FName NAME_ADPCM(TEXT("ADPCM"));
NAME_FORMAT = NAME_ADPCM;
}
}
return NAME_FORMAT;
}
void FAndroidTargetPlatform::GetAllWaveFormats(TArray<FName>& OutFormats) const
{
static FName NAME_OGG(TEXT("OGG"));
static FName NAME_ADPCM(TEXT("ADPCM"));
OutFormats.Add(NAME_OGG);
OutFormats.Add(NAME_ADPCM);
}
namespace
{
void CachePlatformAudioCookOverrides(FPlatformAudioCookOverrides& OutOverrides)
{
const TCHAR* CategoryName = TEXT("/Script/AndroidRuntimeSettings.AndroidRuntimeSettings");
GConfig->GetBool(CategoryName, TEXT("bResampleForDevice"), OutOverrides.bResampleForDevice, GEngineIni);
GConfig->GetFloat(CategoryName, TEXT("CompressionQualityModifier"), OutOverrides.CompressionQualityModifier, GEngineIni);
//Cache sample rate map.
OutOverrides.PlatformSampleRates.Reset();
float RetrievedSampleRate = -1.0f;
GConfig->GetFloat(CategoryName, TEXT("MaxSampleRate"), RetrievedSampleRate, GEngineIni);
OutOverrides.PlatformSampleRates.Add(ESoundwaveSampleRateSettings::Max, RetrievedSampleRate);
RetrievedSampleRate = -1.0f;
GConfig->GetFloat(CategoryName, TEXT("HighSampleRate"), RetrievedSampleRate, GEngineIni);
OutOverrides.PlatformSampleRates.Add(ESoundwaveSampleRateSettings::High, RetrievedSampleRate);
RetrievedSampleRate = -1.0f;
GConfig->GetFloat(CategoryName, TEXT("MedSampleRate"), RetrievedSampleRate, GEngineIni);
OutOverrides.PlatformSampleRates.Add(ESoundwaveSampleRateSettings::Medium, RetrievedSampleRate);
RetrievedSampleRate = -1.0f;
GConfig->GetFloat(CategoryName, TEXT("LowSampleRate"), RetrievedSampleRate, GEngineIni);
OutOverrides.PlatformSampleRates.Add(ESoundwaveSampleRateSettings::Low, RetrievedSampleRate);
RetrievedSampleRate = -1.0f;
GConfig->GetFloat(CategoryName, TEXT("MinSampleRate"), RetrievedSampleRate, GEngineIni);
OutOverrides.PlatformSampleRates.Add(ESoundwaveSampleRateSettings::Min, RetrievedSampleRate);
}
}
FPlatformAudioCookOverrides* FAndroidTargetPlatform::GetAudioCompressionSettings() const
{
static FPlatformAudioCookOverrides Settings;
#if !WITH_EDITOR
static bool bCachedPlatformSettings = false;
if (!bCachedPlatformSettings)
{
CachePlatformAudioCookOverrides(Settings);
bCachedPlatformSettings = true;
}
#else
CachePlatformAudioCookOverrides(Settings);
#endif
return &Settings;
}
#endif //WITH_ENGINE
bool FAndroidTargetPlatform::SupportsVariants() const
{
return true;
}
FText FAndroidTargetPlatform::GetVariantTitle() const
{
return LOCTEXT("AndroidVariantTitle", "Texture Format");
}
/* FAndroidTargetPlatform implementation
*****************************************************************************/
void FAndroidTargetPlatform::AddTextureFormatIfSupports( FName Format, TArray<FName>& OutFormats, bool bIsCompressedNonPOT ) const
{
if (SupportsTextureFormat(Format))
{
if (bIsCompressedNonPOT && SupportsCompressedNonPOT() == false)
{
OutFormats.Add(AndroidTexFormat::NamePOTERROR);
}
else
{
OutFormats.Add(Format);
}
}
}
void FAndroidTargetPlatform::InitializeDeviceDetection()
{
DeviceDetection = FModuleManager::LoadModuleChecked<IAndroidDeviceDetectionModule>("AndroidDeviceDetection").GetAndroidDeviceDetection();
DeviceDetection->Initialize(TEXT("ANDROID_HOME"),
#if PLATFORM_WINDOWS
TEXT("platform-tools\\adb.exe"),
#else
TEXT("platform-tools/adb"),
#endif
TEXT("shell getprop"), true);
}
/* FAndroidTargetPlatform callbacks
*****************************************************************************/
bool FAndroidTargetPlatform::HandleTicker( float DeltaTime )
{
QUICK_SCOPE_CYCLE_COUNTER(STAT_FAndroidTargetPlatform_HandleTicker);
if (DeviceDetection == nullptr)
{
InitializeDeviceDetection();
checkf(DeviceDetection != nullptr, TEXT("A target platform didn't create a device detection object in InitializeDeviceDetection()!"));
}
TArray<FString> ConnectedDeviceIds;
{
FScopeLock ScopeLock(DeviceDetection->GetDeviceMapLock());
auto DeviceIt = DeviceDetection->GetDeviceMap().CreateConstIterator();
for (; DeviceIt; ++DeviceIt)
{
ConnectedDeviceIds.Add(DeviceIt.Key());
const FAndroidDeviceInfo& DeviceInfo = DeviceIt.Value();
// see if this device is already known
if (Devices.Contains(DeviceIt.Key()))
{
FAndroidTargetDevicePtr TestDevice = Devices[DeviceIt.Key()];
// ignore if authorization didn't change
if (DeviceInfo.bAuthorizedDevice == TestDevice->IsAuthorized())
{
continue;
}
// remove it to add again
TestDevice->SetConnected(false);
Devices.Remove(DeviceIt.Key());
DeviceLostEvent.Broadcast(TestDevice.ToSharedRef());
}
// check if this platform is supported by the extensions and version
if (!SupportedByExtensionsString(DeviceInfo.GLESExtensions, DeviceInfo.GLESVersion))
{
continue;
}
// create target device
FAndroidTargetDevicePtr& Device = Devices.Add(DeviceInfo.SerialNumber);
Device = CreateTargetDevice(*this, DeviceInfo.SerialNumber, GetAndroidVariantName());
Device->SetConnected(true);
Device->SetModel(DeviceInfo.Model);
Device->SetDeviceName(DeviceInfo.DeviceName);
Device->SetAuthorized(DeviceInfo.bAuthorizedDevice);
Device->SetVersions(DeviceInfo.SDKVersion, DeviceInfo.HumanAndroidVersion);
DeviceDiscoveredEvent.Broadcast(Device.ToSharedRef());
}
}
// remove disconnected devices
for (auto Iter = Devices.CreateIterator(); Iter; ++Iter)
{
if (!ConnectedDeviceIds.Contains(Iter.Key()))
{
FAndroidTargetDevicePtr RemovedDevice = Iter.Value();
RemovedDevice->SetConnected(false);
Iter.RemoveCurrent();
DeviceLostEvent.Broadcast(RemovedDevice.ToSharedRef());
}
}
return true;
}
FAndroidTargetDeviceRef FAndroidTargetPlatform::CreateNewDevice(const FAndroidDeviceInfo &DeviceInfo)
{
return MakeShareable(new FAndroidTargetDevice(*this, DeviceInfo.SerialNumber, GetAndroidVariantName()));
}
#undef LOCTEXT_NAMESPACE