Skip to content

Commit

Permalink
improve android configChanges
Browse files Browse the repository at this point in the history
update android AppLovinQualityServiceGradlePlugin 5.6.1
fix android finalizeMonitorConnectivityStatusAndConnectionMetering
update android applovin 13.0.1
fix android AndroidEnvironmentService_log
  • Loading branch information
irov committed Nov 10, 2024
1 parent 6a7af70 commit 923be1a
Show file tree
Hide file tree
Showing 8 changed files with 163 additions and 37 deletions.
2 changes: 1 addition & 1 deletion gradle/app/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
android:exported="true"
android:launchMode="singleTop"
android:keepScreenOn="true"
android:configChanges="layoutDirection|locale|orientation|uiMode|screenLayout|screenSize|smallestScreenSize|keyboard|keyboardHidden|navigation">
android:configChanges="mcc|mnc|fontScale|touchscreen|density|layoutDirection|locale|orientation|uiMode|screenLayout|screenSize|smallestScreenSize|keyboard|keyboardHidden|navigation">

<intent-filter>
<action android:name="android.intent.action.MAIN" />
Expand Down
2 changes: 1 addition & 1 deletion gradle/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ buildscript {
}

if (Utils.existAppPlugin(project, "MENGINE_APP_PLUGIN_APPLOVIN") == true) {
classpath 'com.applovin.quality:AppLovinQualityServiceGradlePlugin:5.5.2'
classpath 'com.applovin.quality:AppLovinQualityServiceGradlePlugin:5.6.1'
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@
import android.Manifest;
import android.content.Context;
import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.LocaleList;
import android.os.Looper;
import android.os.Parcelable;
import android.view.KeyEvent;
Expand All @@ -36,6 +38,7 @@
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
import java.util.List;
import java.util.concurrent.CountDownLatch;
Expand Down Expand Up @@ -75,14 +78,16 @@ public class MengineActivity extends AppCompatActivity {
public static native void AndroidPlatform_stopEvent();
public static native void AndroidPlatform_startEvent();
public static native void AndroidPlatform_clipboardChangedEvent();
public static native void AndroidPlatform_windowFocusChangedEvent( boolean focus );
public static native void AndroidPlatform_windowFocusChangedEvent(boolean focus);
public static native void AndroidPlatform_quitEvent();
public static native void AndroidPlatform_lowMemory();
public static native void AndroidPlatform_changeLocale(String locale);

private boolean m_initializePython;
private boolean m_destroy;

private Object m_nativeApplication;
private Locale m_currentLocale;

private static final Map<String, Integer> m_requestCodes = new HashMap<>();

Expand Down Expand Up @@ -325,7 +330,7 @@ protected void onCreate(Bundle savedInstanceState) {
return;
}

MengineLog.logMessageRelease(TAG, "onCreate");
MengineLog.logMessageRelease(TAG, "onCreate: %s", savedInstanceState);

this.setState("activity.lifecycle", "create");
this.setState("activity.init", "begin");
Expand All @@ -342,6 +347,57 @@ protected void onCreate(Bundle savedInstanceState) {
Resources resources = this.getResources();
int orientation = resources.getInteger(R.integer.app_screen_orientation);

switch(orientation) {
case ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE:
MengineLog.logMessage(TAG, "setRequestedOrientation SCREEN_ORIENTATION_LANDSCAPE");
break;
case ActivityInfo.SCREEN_ORIENTATION_PORTRAIT:
MengineLog.logMessage(TAG, "setRequestedOrientation SCREEN_ORIENTATION_PORTRAIT");
break;
case ActivityInfo.SCREEN_ORIENTATION_USER:
MengineLog.logMessage(TAG, "setRequestedOrientation SCREEN_ORIENTATION_USER");
break;
case ActivityInfo.SCREEN_ORIENTATION_BEHIND:
MengineLog.logMessage(TAG, "setRequestedOrientation SCREEN_ORIENTATION_BEHIND");
break;
case ActivityInfo.SCREEN_ORIENTATION_SENSOR:
MengineLog.logMessage(TAG, "setRequestedOrientation SCREEN_ORIENTATION_SENSOR");
break;
case ActivityInfo.SCREEN_ORIENTATION_NOSENSOR:
MengineLog.logMessage(TAG, "setRequestedOrientation SCREEN_ORIENTATION_NOSENSOR");
break;
case ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE:
MengineLog.logMessage(TAG, "setRequestedOrientation SCREEN_ORIENTATION_SENSOR_LANDSCAPE");
break;
case ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT:
MengineLog.logMessage(TAG, "setRequestedOrientation SCREEN_ORIENTATION_SENSOR_PORTRAIT");
break;
case ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE:
MengineLog.logMessage(TAG, "setRequestedOrientation SCREEN_ORIENTATION_REVERSE_LANDSCAPE");
break;
case ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT:
MengineLog.logMessage(TAG, "setRequestedOrientation SCREEN_ORIENTATION_REVERSE_PORTRAIT");
break;
case ActivityInfo.SCREEN_ORIENTATION_FULL_SENSOR:
MengineLog.logMessage(TAG, "setRequestedOrientation SCREEN_ORIENTATION_FULL_SENSOR");
break;
case ActivityInfo.SCREEN_ORIENTATION_USER_LANDSCAPE:
MengineLog.logMessage(TAG, "setRequestedOrientation SCREEN_ORIENTATION_USER_LANDSCAPE");
break;
case ActivityInfo.SCREEN_ORIENTATION_USER_PORTRAIT:
MengineLog.logMessage(TAG, "setRequestedOrientation SCREEN_ORIENTATION_USER_PORTRAIT");
break;
case ActivityInfo.SCREEN_ORIENTATION_FULL_USER:
MengineLog.logMessage(TAG, "setRequestedOrientation SCREEN_ORIENTATION_FULL_USER");
break;
case ActivityInfo.SCREEN_ORIENTATION_LOCKED:
MengineLog.logMessage(TAG, "setRequestedOrientation SCREEN_ORIENTATION_LOCKED");
break;
default:
MengineLog.logWarning(TAG, "setRequestedOrientation UNKNOWN: %d", orientation);
break;
}

this.setRequestedOrientation(orientation);

this.setState("activity.init", "setup_relativelayout");
Expand Down Expand Up @@ -386,9 +442,9 @@ protected void onCreate(Bundle savedInstanceState) {
String nativeLibraryDir = applicationInfo.nativeLibraryDir;
String options = application.getApplicationOptions();

String[] optinsArgs = options.split(" ");
String[] optionsArgs = options.split(" ");

m_nativeApplication = AndroidMain_bootstrap(nativeLibraryDir, optinsArgs);
m_nativeApplication = AndroidMain_bootstrap(nativeLibraryDir, optionsArgs);

this.setState("activity.init", "plugin_create");

Expand Down Expand Up @@ -468,7 +524,7 @@ private void syncFullscreenWindow() {
View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY |
View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN |
View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION |
View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.INVISIBLE;
View.SYSTEM_UI_FLAG_LAYOUT_STABLE;

View decorView = window.getDecorView();
decorView.setSystemUiVisibility(flags);
Expand Down Expand Up @@ -892,6 +948,23 @@ public void onConfigurationChanged(@NonNull Configuration newConfig) {

l.onConfigurationChanged(this, newConfig);
}

Locale newLocale;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
LocaleList locales = newConfig.getLocales();

newLocale = locales.get(0);
} else {
newLocale = newConfig.locale;
}

if (m_currentLocale == null || m_currentLocale.equals(newLocale) == false) {
m_currentLocale = newLocale;

String language = m_currentLocale.getLanguage();

MengineActivity.AndroidPlatform_changeLocale(language);
}
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ public boolean hasMetaData(String name) {
return true;
}

private Bundle assertMetaDataBundle(String name) {
private Bundle assertMetaDataBundle(String name) throws RuntimeException{
Bundle bundle = this.getMetaDataBundle();

if (bundle == null) {
Expand Down Expand Up @@ -392,6 +392,10 @@ private String getSecureAndroidId() {
ContentResolver resolver = context.getContentResolver();
String androidId = Settings.Secure.getString(resolver, Settings.Secure.ANDROID_ID);

if (androidId == null) {
return "0000000000000000";
}

return androidId;
}

Expand Down Expand Up @@ -860,7 +864,7 @@ private void finalizeMonitorConnectivityStatusAndConnectionMetering() {
Context context = this.getApplicationContext();

ConnectivityManager connectivityManager = context.getSystemService(ConnectivityManager.class);
connectivityManager.registerDefaultNetworkCallback(m_networkCallback);
connectivityManager.unregisterNetworkCallback(m_networkCallback);

m_networkCallback = null;
}
Expand Down
48 changes: 24 additions & 24 deletions gradle/plugins/AppLovin/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -102,107 +102,107 @@ android {
}

dependencies {
implementation 'com.applovin:applovin-sdk:13.0.0'
implementation 'com.applovin:applovin-sdk:13.0.1'

if (MENGINE_APP_PLUGIN_APPLOVIN_CONSENT_FLOW) {
implementation 'com.google.android.ump:user-messaging-platform:3.0.0'
}

if (MENGINE_APP_PLUGIN_APPLOVIN_MEDIATION_ADMOB == true) {
implementation 'com.applovin.mediation:google-adapter:23.4.0.0'
implementation 'com.applovin.mediation:google-adapter:23.5.0.0'
}

if (MENGINE_APP_PLUGIN_APPLOVIN_MEDIATION_AMAZON == true) {
implementation 'com.applovin.mediation:amazon-tam-adapter:9.10.3.0'
implementation 'com.applovin.mediation:amazon-tam-adapter:9.10.3.2'
}

if (MENGINE_APP_PLUGIN_APPLOVIN_MEDIATION_BIDMACHINE == true) {
implementation 'com.applovin.mediation:bidmachine-adapter:3.0.1.2'
implementation 'com.applovin.mediation:bidmachine-adapter:3.1.0.0'
}

if (MENGINE_APP_PLUGIN_APPLOVIN_MEDIATION_CHARTBOOST == true) {
implementation 'com.applovin.mediation:chartboost-adapter:9.7.0.3'
implementation 'com.applovin.mediation:chartboost-adapter:9.8.0.1'
}

if (MENGINE_APP_PLUGIN_APPLOVIN_MEDIATION_DTEXCHANGE == true) {
implementation 'com.applovin.mediation:fyber-adapter:8.3.1.1'
implementation 'com.applovin.mediation:fyber-adapter:8.3.3.0'
}

if (MENGINE_APP_PLUGIN_APPLOVIN_MEDIATION_GOOGLEADMANAGER == true) {
implementation 'com.applovin.mediation:google-ad-manager-adapter:23.4.0.0'
implementation 'com.applovin.mediation:google-ad-manager-adapter:23.5.0.0'
}

if (MENGINE_APP_PLUGIN_APPLOVIN_MEDIATION_HYPRMX == true) {
implementation 'com.applovin.mediation:hyprmx-adapter:6.4.2.1'
implementation 'com.applovin.mediation:hyprmx-adapter:6.4.2.2'
}

if (MENGINE_APP_PLUGIN_APPLOVIN_MEDIATION_INMOBI == true) {
implementation 'com.applovin.mediation:inmobi-adapter:10.7.7.2'
implementation 'com.applovin.mediation:inmobi-adapter:10.7.8.1'
implementation 'com.squareup.picasso:picasso:2.71828'
implementation 'androidx.recyclerview:recyclerview:1.1.0'
}

if (MENGINE_APP_PLUGIN_APPLOVIN_MEDIATION_IRONSOURCE == true) {
implementation 'com.applovin.mediation:ironsource-adapter:8.4.0.0.0'
implementation 'com.applovin.mediation:ironsource-adapter:8.4.0.0.1'
}

if (MENGINE_APP_PLUGIN_APPLOVIN_MEDIATION_LIFTOFF == true) {
implementation 'com.applovin.mediation:vungle-adapter:7.4.1.2'
implementation 'com.applovin.mediation:vungle-adapter:7.4.2.1'
}

if (MENGINE_APP_PLUGIN_APPLOVIN_MEDIATION_LINE == true) {
implementation 'com.applovin.mediation:line-adapter:2024.8.27.1'
}

if (MENGINE_APP_PLUGIN_APPLOVIN_MEDIATION_MAIO == true) {
implementation 'com.applovin.mediation:maio-adapter:1.1.16.3'
implementation 'com.applovin.mediation:maio-adapter:2.0.1.1'
}

if (MENGINE_APP_PLUGIN_APPLOVIN_MEDIATION_META == true) {
implementation 'com.applovin.mediation:facebook-adapter:6.18.0.0'
implementation 'com.applovin.mediation:facebook-adapter:6.18.0.1'
}

if (MENGINE_APP_PLUGIN_APPLOVIN_MEDIATION_MINTEGRAL == true) {
implementation 'com.applovin.mediation:mintegral-adapter:16.8.51.2'
implementation 'com.applovin.mediation:mintegral-adapter:16.8.81.0'
}

if (MENGINE_APP_PLUGIN_APPLOVIN_MEDIATION_MOBILEFUSE == true) {
implementation 'com.applovin.mediation:mobilefuse-adapter:1.8.0.0'
implementation 'com.applovin.mediation:mobilefuse-adapter:1.8.0.1'
}

if (MENGINE_APP_PLUGIN_APPLOVIN_MEDIATION_MOLOCO == true) {
implementation 'com.applovin.mediation:moloco-adapter:3.2.0.0'
implementation 'com.applovin.mediation:moloco-adapter:3.3.0.0'
}

if (MENGINE_APP_PLUGIN_APPLOVIN_MEDIATION_OGURY == true) {
implementation 'com.applovin.mediation:ogury-presage-adapter:5.8.0.0'
implementation 'com.applovin.mediation:ogury-presage-adapter:6.0.0.1'
}

if (MENGINE_APP_PLUGIN_APPLOVIN_MEDIATION_PANGLE == true) {
implementation 'com.applovin.mediation:bytedance-adapter:6.2.0.7.0'
implementation 'com.applovin.mediation:bytedance-adapter:6.3.0.4.0'
}

if (MENGINE_APP_PLUGIN_APPLOVIN_MEDIATION_SMAATO == true) {
implementation 'com.applovin.mediation:smaato-adapter:22.7.0.1'
implementation 'com.applovin.mediation:smaato-adapter:22.7.1.1'
}

if (MENGINE_APP_PLUGIN_APPLOVIN_MEDIATION_UNITYADS == true) {
implementation 'com.applovin.mediation:unityads-adapter:4.12.3.0'
implementation 'com.applovin.mediation:unityads-adapter:4.12.4.0'
}

if (MENGINE_APP_PLUGIN_APPLOVIN_MEDIATION_VERVE == true) {
implementation 'com.applovin.mediation:verve-adapter:3.1.0.0'
implementation 'com.applovin.mediation:verve-adapter:3.2.0.0'
}

if (MENGINE_APP_PLUGIN_APPLOVIN_MEDIATION_VK == true) {
implementation 'com.applovin.mediation:mytarget-adapter:5.22.1.1'
implementation 'com.applovin.mediation:mytarget-adapter:5.23.0.0'
}

if (MENGINE_APP_PLUGIN_APPLOVIN_MEDIATION_YANDEX == true) {
implementation 'com.applovin.mediation:yandex-adapter:7.5.0.1'
implementation 'com.applovin.mediation:yandex-adapter:7.6.0.1'
}

if (MENGINE_APP_PLUGIN_APPLOVIN_MEDIATION_YSO == true) {
implementation 'com.applovin.mediation:yso-network-adapter:1.2.6.0'
implementation 'com.applovin.mediation:yso-network-adapter:1.2.7.0'
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,6 @@ namespace Mengine
public:
virtual void androidNativeQuitEvent() = 0;
virtual void androidNativeLowMemoryEvent() = 0;
virtual void androidNativeChangeLocale( const Mengine::Char * _language ) = 0;
};
}
Loading

0 comments on commit 923be1a

Please sign in to comment.