You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
Merging using MainToDevVR
#rb integration [CL 4748914 by Ryan Vance in Dev-VR branch]
This commit is contained in:
@@ -121,6 +121,7 @@ import android.webkit.CookieSyncManager;
|
||||
import android.media.AudioManager;
|
||||
import android.util.DisplayMetrics;
|
||||
|
||||
import android.view.DisplayCutout;
|
||||
import android.view.InputDevice;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.Gravity;
|
||||
@@ -133,6 +134,7 @@ import android.view.ViewGroup.MarginLayoutParams;
|
||||
import android.view.Surface;
|
||||
import android.view.SurfaceHolder;
|
||||
import android.view.SurfaceView;
|
||||
import android.view.WindowInsets;
|
||||
import android.view.WindowManager;
|
||||
import android.view.Window;
|
||||
import android.widget.LinearLayout;
|
||||
@@ -412,6 +414,8 @@ public class GameActivity extends NativeActivity implements SurfaceHolder.Callba
|
||||
private String ForceExitUpdateButtonText = "";
|
||||
private String ForceExitLink = "";
|
||||
|
||||
private boolean SplashScreenLaunch = false;
|
||||
private boolean UseDisplayCutout = false;
|
||||
private boolean ShouldHideUI = false;
|
||||
|
||||
/** Whether this application is for distribution */
|
||||
@@ -1948,8 +1952,10 @@ public class GameActivity extends NativeActivity implements SurfaceHolder.Callba
|
||||
if (_extrasBundle != null)
|
||||
{
|
||||
ShouldHideUI = _extrasBundle.getString("ShouldHideUI") != null;
|
||||
UseDisplayCutout = _extrasBundle.getString("UseDisplayCutout") != null;
|
||||
if (_extrasBundle.getString("UseSplashScreen") != null)
|
||||
{
|
||||
SplashScreenLaunch = true;
|
||||
try {
|
||||
// try to get the splash theme (can't use R.style.UE4SplashTheme since we don't know the package name until runtime)
|
||||
int SplashThemeId = getResources().getIdentifier("UE4SplashTheme", "style", getPackageName());
|
||||
@@ -1990,6 +1996,14 @@ public class GameActivity extends NativeActivity implements SurfaceHolder.Callba
|
||||
catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
if (UseDisplayCutout)
|
||||
{
|
||||
// will not be true if not Android Pie or later
|
||||
WindowManager.LayoutParams params = getWindow().getAttributes();
|
||||
params.layoutInDisplayCutoutMode = WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES;
|
||||
getWindow().setAttributes(params);
|
||||
}
|
||||
}
|
||||
|
||||
//Check for target sdk. If 23 or higher then warn that permission handling may mean features don't work if user denies them.
|
||||
@@ -2299,7 +2313,7 @@ public class GameActivity extends NativeActivity implements SurfaceHolder.Callba
|
||||
VerifyOBBOnStartUp = false;
|
||||
Log.debug( "Did not find bVerifyOBBOnStartUp, using default.");
|
||||
}
|
||||
|
||||
|
||||
if(bundle.containsKey("com.epicgames.ue4.GameActivity.bShouldHideUI"))
|
||||
{
|
||||
ShouldHideUI = bundle.getBoolean("com.epicgames.ue4.GameActivity.bShouldHideUI");
|
||||
@@ -2309,6 +2323,20 @@ public class GameActivity extends NativeActivity implements SurfaceHolder.Callba
|
||||
{
|
||||
Log.debug( "UI hiding not found. Leaving as " + ShouldHideUI);
|
||||
}
|
||||
|
||||
if (SplashScreenLaunch == false && android.os.Build.VERSION.SDK_INT >= 28)
|
||||
{
|
||||
if(bundle.containsKey("com.epicgames.ue4.GameActivity.bUseDisplayCutout"))
|
||||
{
|
||||
UseDisplayCutout = bundle.getBoolean("com.epicgames.ue4.GameActivity.bUseDisplayCutout");
|
||||
Log.debug( "Display cutout set to " + UseDisplayCutout);
|
||||
}
|
||||
else
|
||||
{
|
||||
Log.debug( "Display cutout not found. Leaving as " + UseDisplayCutout);
|
||||
}
|
||||
}
|
||||
|
||||
if(bundle.containsKey("com.epicgames.ue4.GameActivity.BuildConfiguration"))
|
||||
{
|
||||
BuildConfiguration = bundle.getString("com.epicgames.ue4.GameActivity.BuildConfiguration");
|
||||
@@ -2797,6 +2825,18 @@ public class GameActivity extends NativeActivity implements SurfaceHolder.Callba
|
||||
});
|
||||
}
|
||||
|
||||
// only true if Android Pie or later
|
||||
if (UseDisplayCutout)
|
||||
{
|
||||
// only on Android Pie and later
|
||||
WindowManager.LayoutParams params = getWindow().getAttributes();
|
||||
if (params.layoutInDisplayCutoutMode != WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES)
|
||||
{
|
||||
params.layoutInDisplayCutoutMode = WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES;
|
||||
getWindow().setAttributes(params);
|
||||
}
|
||||
}
|
||||
|
||||
if(HasAllFiles)
|
||||
{
|
||||
Log.debug("==============> Resuming main init");
|
||||
@@ -2875,6 +2915,17 @@ public class GameActivity extends NativeActivity implements SurfaceHolder.Callba
|
||||
});
|
||||
}
|
||||
|
||||
// only true if Android Pie or later
|
||||
if (UseDisplayCutout)
|
||||
{
|
||||
WindowManager.LayoutParams params = getWindow().getAttributes();
|
||||
if (params.layoutInDisplayCutoutMode != WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES)
|
||||
{
|
||||
params.layoutInDisplayCutoutMode = WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES;
|
||||
getWindow().setAttributes(params);
|
||||
}
|
||||
}
|
||||
|
||||
// restore screensaver state
|
||||
AndroidThunkJava_KeepScreenOn(bKeepScreenOn);
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ import android.content.pm.ApplicationInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.pm.PackageManager.NameNotFoundException;
|
||||
import android.view.View;
|
||||
import android.view.WindowManager;
|
||||
|
||||
public class SplashActivity extends Activity
|
||||
{
|
||||
@@ -18,6 +19,7 @@ public class SplashActivity extends Activity
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
boolean ShouldHideUI = false;
|
||||
boolean UseDisplayCutout = false;
|
||||
try {
|
||||
ApplicationInfo ai = getPackageManager().getApplicationInfo(getPackageName(), PackageManager.GET_META_DATA);
|
||||
Bundle bundle = ai.metaData;
|
||||
@@ -26,6 +28,10 @@ public class SplashActivity extends Activity
|
||||
{
|
||||
ShouldHideUI = bundle.getBoolean("com.epicgames.ue4.GameActivity.bShouldHideUI");
|
||||
}
|
||||
if(bundle.containsKey("com.epicgames.ue4.GameActivity.bUseDisplayCutout"))
|
||||
{
|
||||
UseDisplayCutout = bundle.getBoolean("com.epicgames.ue4.GameActivity.bUseDisplayCutout");
|
||||
}
|
||||
}
|
||||
catch (NameNotFoundException e)
|
||||
{
|
||||
@@ -48,6 +54,27 @@ public class SplashActivity extends Activity
|
||||
}
|
||||
}
|
||||
|
||||
// for now only allow on one device manufacturer - fix up later
|
||||
if (!android.os.Build.MANUFACTURER.equals("HUAWEI"))
|
||||
{
|
||||
UseDisplayCutout = false;
|
||||
}
|
||||
|
||||
if (UseDisplayCutout)
|
||||
{
|
||||
// only do this on Android Pie and above
|
||||
if (android.os.Build.VERSION.SDK_INT >= 28)
|
||||
{
|
||||
WindowManager.LayoutParams params = getWindow().getAttributes();
|
||||
params.layoutInDisplayCutoutMode = WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES;
|
||||
getWindow().setAttributes(params);
|
||||
}
|
||||
else
|
||||
{
|
||||
UseDisplayCutout = false;
|
||||
}
|
||||
}
|
||||
|
||||
Intent intent = new Intent(this, GameActivity.class);
|
||||
intent.putExtras(getIntent());
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
|
||||
@@ -56,6 +83,10 @@ public class SplashActivity extends Activity
|
||||
{
|
||||
intent.putExtra("ShouldHideUI", "true");
|
||||
}
|
||||
if (UseDisplayCutout)
|
||||
{
|
||||
intent.putExtra("UseDisplayCutout", "true");
|
||||
}
|
||||
|
||||
//pass down any extras added to this Activity's intent to the GameActivity intent (GCM data, for example)
|
||||
Intent intentFromActivity = getIntent();
|
||||
|
||||
Reference in New Issue
Block a user