diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..9f11b755 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.idea/ diff --git a/flutter-hms-account/android/build.gradle b/flutter-hms-account/android/build.gradle index fb162693..8dd81973 100644 --- a/flutter-hms-account/android/build.gradle +++ b/flutter-hms-account/android/build.gradle @@ -26,6 +26,11 @@ apply plugin: 'com.android.library' android { compileSdkVersion 33 buildToolsVersion "31.0.0" + + if (project.android.hasProperty("namespace")) { + namespace 'com.huawei.hms.flutter.account' + } + defaultConfig { minSdkVersion 19 targetSdkVersion 33 diff --git a/flutter-hms-ads/android/build.gradle b/flutter-hms-ads/android/build.gradle index e1efbfef..77f2602b 100644 --- a/flutter-hms-ads/android/build.gradle +++ b/flutter-hms-ads/android/build.gradle @@ -26,6 +26,11 @@ apply plugin: 'com.android.library' android { compileSdkVersion 33 buildToolsVersion "31.0.0" + + if (project.android.hasProperty("namespace")) { + namespace 'com.huawei.hms.flutter.ads' + } + defaultConfig { minSdkVersion 19 targetSdkVersion 33 @@ -48,4 +53,4 @@ dependencies { implementation 'com.huawei.hms:ads-installreferrer:3.4.62.300' implementation 'com.huawei.hms:stats:6.12.0.300' implementation 'com.huawei.agconnect:agconnect-core:1.9.1.301' -} \ No newline at end of file +} diff --git a/flutter-hms-adsprime/android/build.gradle b/flutter-hms-adsprime/android/build.gradle index 3d7051d5..a45af5f9 100644 --- a/flutter-hms-adsprime/android/build.gradle +++ b/flutter-hms-adsprime/android/build.gradle @@ -26,6 +26,11 @@ apply plugin: 'com.android.library' android { compileSdkVersion 33 buildToolsVersion "31.0.0" + + if (project.android.hasProperty("namespace")) { + namespace 'com.huawei.hms.flutter.ads' + } + defaultConfig { minSdkVersion 19 targetSdkVersion 33 diff --git a/flutter-hms-analytics/android/build.gradle b/flutter-hms-analytics/android/build.gradle index 39c9e610..b3b3da32 100644 --- a/flutter-hms-analytics/android/build.gradle +++ b/flutter-hms-analytics/android/build.gradle @@ -27,6 +27,10 @@ android { compileSdkVersion 33 buildToolsVersion "31.0.0" + if (project.android.hasProperty("namespace")) { + namespace 'com.huawei.hms.flutter.analytics' + } + defaultConfig { minSdkVersion 19 targetSdkVersion 33 diff --git a/flutter-hms-ar/android/build.gradle b/flutter-hms-ar/android/build.gradle index d9bc88ea..12cde8df 100644 --- a/flutter-hms-ar/android/build.gradle +++ b/flutter-hms-ar/android/build.gradle @@ -27,6 +27,10 @@ android { compileSdkVersion 30 buildToolsVersion "30.0.3" + if (project.android.hasProperty("namespace")) { + namespace 'com.huawei.hms.flutter.ar' + } + defaultConfig { minSdkVersion 26 targetSdkVersion 30 diff --git a/flutter-hms-availability/android/build.gradle b/flutter-hms-availability/android/build.gradle index 2e9963ee..6286c71c 100644 --- a/flutter-hms-availability/android/build.gradle +++ b/flutter-hms-availability/android/build.gradle @@ -26,7 +26,11 @@ apply plugin: 'com.android.library' android { compileSdkVersion 33 buildToolsVersion "31.0.0" - + + if (project.android.hasProperty("namespace")) { + namespace 'com.huawei.hms.flutter.hmsavailability' + } + defaultConfig { minSdkVersion 19 targetSdkVersion 33 diff --git a/flutter-hms-awareness/android/build.gradle b/flutter-hms-awareness/android/build.gradle index d2a15639..e87dfbc5 100644 --- a/flutter-hms-awareness/android/build.gradle +++ b/flutter-hms-awareness/android/build.gradle @@ -26,6 +26,11 @@ apply plugin: 'com.android.library' android { compileSdkVersion 33 buildToolsVersion "31.0.0" + + if (project.android.hasProperty("namespace")) { + namespace 'com.huawei.hms.flutter.awareness' + } + defaultConfig { minSdkVersion 24 targetSdkVersion 33 diff --git a/flutter-hms-contact-shield/android/build.gradle b/flutter-hms-contact-shield/android/build.gradle index 11631029..1ae4d2bf 100644 --- a/flutter-hms-contact-shield/android/build.gradle +++ b/flutter-hms-contact-shield/android/build.gradle @@ -27,6 +27,10 @@ android { compileSdkVersion 30 buildToolsVersion '30.0.3' + if (project.android.hasProperty("namespace")) { + namespace 'com.huawei.hms.flutter.contactshield' + } + defaultConfig { minSdkVersion 24 targetSdkVersion 30 diff --git a/flutter-hms-drive/android/build.gradle b/flutter-hms-drive/android/build.gradle index 05b8485d..7d1de580 100644 --- a/flutter-hms-drive/android/build.gradle +++ b/flutter-hms-drive/android/build.gradle @@ -27,6 +27,10 @@ android { compileSdkVersion 30 buildToolsVersion "30.0.3" + if (project.android.hasProperty("namespace")) { + namespace 'com.huawei.hms.flutter.drive' + } + defaultConfig { minSdkVersion 27 targetSdkVersion 30 diff --git a/flutter-hms-dtm/android/build.gradle b/flutter-hms-dtm/android/build.gradle index dea1e989..45b26a62 100644 --- a/flutter-hms-dtm/android/build.gradle +++ b/flutter-hms-dtm/android/build.gradle @@ -27,6 +27,10 @@ android { compileSdkVersion 30 buildToolsVersion '30.0.3' + if (project.android.hasProperty("namespace")) { + namespace 'com.huawei.hms.flutter.dtm' + } + defaultConfig { minSdkVersion 19 targetSdkVersion 30 diff --git a/flutter-hms-fido/android/build.gradle b/flutter-hms-fido/android/build.gradle index d732dba8..bd704554 100644 --- a/flutter-hms-fido/android/build.gradle +++ b/flutter-hms-fido/android/build.gradle @@ -27,6 +27,10 @@ android { compileSdkVersion 30 buildToolsVersion "30.0.3" + if (project.android.hasProperty("namespace")) { + namespace 'com.huawei.hms.flutter.fido' + } + defaultConfig { minSdkVersion 19 targetSdkVersion 30 diff --git a/flutter-hms-gameservice/android/build.gradle b/flutter-hms-gameservice/android/build.gradle index a54be87c..87a14db4 100644 --- a/flutter-hms-gameservice/android/build.gradle +++ b/flutter-hms-gameservice/android/build.gradle @@ -27,6 +27,10 @@ android { compileSdkVersion 30 buildToolsVersion "30.0.3" + if (project.android.hasProperty("namespace")) { + namespace 'com.huawei.hms.flutter.huawei_gameservice' + } + defaultConfig { minSdkVersion 19 targetSdkVersion 30 diff --git a/flutter-hms-health/android/build.gradle b/flutter-hms-health/android/build.gradle index 616047ea..56a4cc4f 100644 --- a/flutter-hms-health/android/build.gradle +++ b/flutter-hms-health/android/build.gradle @@ -27,6 +27,10 @@ android { compileSdkVersion 33 buildToolsVersion "31.0.0" + if (project.android.hasProperty("namespace")) { + namespace 'com.huawei.hms.flutter.health' + } + defaultConfig { minSdkVersion 21 targetSdkVersion 33 diff --git a/flutter-hms-iap/android/build.gradle b/flutter-hms-iap/android/build.gradle index b02ba9b5..ebd9c235 100644 --- a/flutter-hms-iap/android/build.gradle +++ b/flutter-hms-iap/android/build.gradle @@ -26,6 +26,11 @@ apply plugin: 'com.android.library' android { compileSdkVersion 33 buildToolsVersion "31.0.0" + + if (project.android.hasProperty("namespace")) { + namespace 'com.huawei.hms.flutter.iap' + } + defaultConfig { minSdkVersion 19 targetSdkVersion 33 diff --git a/flutter-hms-location/android/build.gradle b/flutter-hms-location/android/build.gradle index c24238f2..3201270c 100644 --- a/flutter-hms-location/android/build.gradle +++ b/flutter-hms-location/android/build.gradle @@ -27,6 +27,10 @@ android { compileSdkVersion 33 buildToolsVersion "31.0.0" + if (project.android.hasProperty("namespace")) { + namespace 'com.huawei.hms.flutter.location' + } + defaultConfig { minSdkVersion 21 targetSdkVersion 33 diff --git a/flutter-hms-map/android/build.gradle b/flutter-hms-map/android/build.gradle index c4bcdfbe..91ca74ac 100644 --- a/flutter-hms-map/android/build.gradle +++ b/flutter-hms-map/android/build.gradle @@ -27,6 +27,10 @@ android { compileSdkVersion 33 buildToolsVersion "31.0.0" + if (project.android.hasProperty("namespace")) { + namespace 'com.huawei.hms.flutter.map' + } + defaultConfig { minSdkVersion 20 targetSdkVersion 33 diff --git a/flutter-hms-map/android/src/main/java/com/huawei/hms/flutter/map/HmsMap.java b/flutter-hms-map/android/src/main/java/com/huawei/hms/flutter/map/HmsMap.java index da1a263d..47c7586c 100644 --- a/flutter-hms-map/android/src/main/java/com/huawei/hms/flutter/map/HmsMap.java +++ b/flutter-hms-map/android/src/main/java/com/huawei/hms/flutter/map/HmsMap.java @@ -92,7 +92,7 @@ public void onAttachedToActivity(@NonNull ActivityPluginBinding activityPluginBi flutterPluginBinding.getPlatformViewRegistry() .registerViewFactory(Channel.CHANNEL, new MapFactory(state, flutterPluginBinding.getBinaryMessenger(), activityPluginBinding.getActivity(), - lifecycle, null, activityPluginBinding.getActivity().hashCode())); + lifecycle, activityPluginBinding.getActivity().hashCode())); } @Override diff --git a/flutter-hms-map/android/src/main/java/com/huawei/hms/flutter/map/map/MapBuilder.java b/flutter-hms-map/android/src/main/java/com/huawei/hms/flutter/map/map/MapBuilder.java index cf49059e..89281275 100644 --- a/flutter-hms-map/android/src/main/java/com/huawei/hms/flutter/map/map/MapBuilder.java +++ b/flutter-hms-map/android/src/main/java/com/huawei/hms/flutter/map/map/MapBuilder.java @@ -98,9 +98,9 @@ class MapBuilder implements MapMethods { MapController build(final int id, @NonNull final Context context, final Activity mActivity, final AtomicInteger state, final BinaryMessenger binaryMessenger, final Application application, - final Lifecycle lifecycle, final PluginRegistry.Registrar registrar, final int activityHashCode) { + final Lifecycle lifecycle, final int activityHashCode) { final MapController controller = new MapController(id, context, mActivity, state, binaryMessenger, application, - lifecycle, registrar, activityHashCode, options); + lifecycle, activityHashCode, options); controller.init(); controller.setAllGesturesEnabled(allGesturesEnabled); controller.setScrollGesturesEnabledDuringRotateOrZoom(scrollGesturesEnabledDuringRotateOrZoom); diff --git a/flutter-hms-map/android/src/main/java/com/huawei/hms/flutter/map/map/MapController.java b/flutter-hms-map/android/src/main/java/com/huawei/hms/flutter/map/map/MapController.java index 3ba1f1a6..8b99f5ae 100644 --- a/flutter-hms-map/android/src/main/java/com/huawei/hms/flutter/map/map/MapController.java +++ b/flutter-hms-map/android/src/main/java/com/huawei/hms/flutter/map/map/MapController.java @@ -82,8 +82,6 @@ final class MapController private final Application mApplication; - private final PluginRegistry.Registrar registrar; - private final MapView mapView; private HuaweiMap huaweiMap; @@ -154,7 +152,7 @@ final class MapController MapController(final int id, final Context context, final Activity mActivity, final AtomicInteger activityState, final BinaryMessenger binaryMessenger, final Application application, final Lifecycle lifecycle, - final PluginRegistry.Registrar registrar, final int registrarActivityHashCode, final HuaweiMapOptions options) { + final int registrarActivityHashCode, final HuaweiMapOptions options) { this.context = context; this.activityState = activityState; mapView = new MapView(mActivity, options); @@ -164,7 +162,6 @@ final class MapController methodChannel.setMethodCallHandler(this); mApplication = application; this.lifecycle = lifecycle; - this.registrar = registrar; activityHashCode = registrarActivityHashCode; mapUtils = new MapUtils(methodChannel, compactness, application); mapListenerHandler = new MapListenerHandler(id, mapUtils, methodChannel, application); @@ -952,22 +949,10 @@ private void updateMyLocationSettings() { } private int getActivityHashCode() { - if (registrar != null) { - Activity activity = registrar.activity(); - if (activity != null) { - return activity.hashCode(); - } - } return activityHashCode; } private Application getApplication() { - if (registrar != null) { - Activity activity = registrar.activity(); - if (activity != null) { - return activity.getApplication(); - } - } return mApplication; } diff --git a/flutter-hms-map/android/src/main/java/com/huawei/hms/flutter/map/map/MapFactory.java b/flutter-hms-map/android/src/main/java/com/huawei/hms/flutter/map/map/MapFactory.java index eae399c3..9f923e1c 100644 --- a/flutter-hms-map/android/src/main/java/com/huawei/hms/flutter/map/map/MapFactory.java +++ b/flutter-hms-map/android/src/main/java/com/huawei/hms/flutter/map/map/MapFactory.java @@ -51,17 +51,14 @@ public class MapFactory extends PlatformViewFactory { private final Lifecycle lifecycle; - private final PluginRegistry.Registrar registrar; - public MapFactory(final AtomicInteger state, final BinaryMessenger binaryMessenger, final Activity mActivity, - final Lifecycle lifecycle, final PluginRegistry.Registrar registrar, final int activityHashCode) { + final Lifecycle lifecycle, final int activityHashCode) { super(StandardMessageCodec.INSTANCE); mActivityState = state; this.binaryMessenger = binaryMessenger; this.application = mActivity.getApplication(); this.activityHashCode = activityHashCode; this.lifecycle = lifecycle; - this.registrar = registrar; this.mActivity = mActivity; } @@ -96,7 +93,6 @@ public PlatformView create(final Context context, final int id, final Object arg if (params.containsKey(Param.HEAT_MAPS_TO_INSERT)) { builder.setHeatMaps((List>) params.get(Param.HEAT_MAPS_TO_INSERT)); } - return builder.build(id, context, mActivity, mActivityState, binaryMessenger, application, lifecycle, registrar, - activityHashCode); + return builder.build(id, context, mActivity, mActivityState, binaryMessenger, application, lifecycle, activityHashCode); } } diff --git a/flutter-hms-map/android/src/main/java/com/huawei/hms/flutter/map/utils/Convert.java b/flutter-hms-map/android/src/main/java/com/huawei/hms/flutter/map/utils/Convert.java index d90b1540..baab562c 100644 --- a/flutter-hms-map/android/src/main/java/com/huawei/hms/flutter/map/utils/Convert.java +++ b/flutter-hms-map/android/src/main/java/com/huawei/hms/flutter/map/utils/Convert.java @@ -74,7 +74,7 @@ import io.flutter.plugin.common.BinaryMessenger; import io.flutter.plugin.common.MethodChannel; -import io.flutter.view.FlutterMain; +import io.flutter.FlutterInjector; import org.json.JSONArray; import org.json.JSONException; @@ -197,15 +197,15 @@ private static BitmapDescriptor toBitmapDescriptor(final Object o) { case Param.FROM_ASSET: if (data.size() == 2) { return BitmapDescriptorFactory.fromAsset( - FlutterMain.getLookupKeyForAsset(Convert.toString(data.get(1)))); + FlutterInjector.instance().flutterLoader().getLookupKeyForAsset(Convert.toString(data.get(1)))); } else { return BitmapDescriptorFactory.fromAsset( - FlutterMain.getLookupKeyForAsset(Convert.toString(data.get(1)), Convert.toString(data.get(2)))); + FlutterInjector.instance().flutterLoader().getLookupKeyForAsset(Convert.toString(data.get(1)), Convert.toString(data.get(2)))); } case Param.FROM_ASSET_IMAGE: if (data.size() == 3) { return BitmapDescriptorFactory.fromAsset( - FlutterMain.getLookupKeyForAsset(Convert.toString(data.get(1)))); + FlutterInjector.instance().flutterLoader().getLookupKeyForAsset(Convert.toString(data.get(1)))); } else { throw new IllegalArgumentException(Param.ERROR); } diff --git a/flutter-hms-ml/android/build.gradle b/flutter-hms-ml/android/build.gradle index 9bdbd13c..fc741acc 100644 --- a/flutter-hms-ml/android/build.gradle +++ b/flutter-hms-ml/android/build.gradle @@ -26,6 +26,11 @@ apply plugin: 'com.android.library' android { compileSdkVersion 29 buildToolsVersion "29.0.3" + + if (project.android.hasProperty("namespace")) { + namespace 'com.huawei.hms.flutter.ml' + } + defaultConfig { minSdkVersion 19 targetSdkVersion 29 diff --git a/flutter-hms-mlbody/android/build.gradle b/flutter-hms-mlbody/android/build.gradle index f3d45808..8cd00251 100644 --- a/flutter-hms-mlbody/android/build.gradle +++ b/flutter-hms-mlbody/android/build.gradle @@ -27,6 +27,10 @@ android { compileSdkVersion 31 buildToolsVersion "31.0.0" + if (project.android.hasProperty("namespace")) { + namespace 'com.huawei.hms.flutter.mlbody' + } + defaultConfig { minSdkVersion 19 targetSdkVersion 31 diff --git a/flutter-hms-mlimage/android/build.gradle b/flutter-hms-mlimage/android/build.gradle index 1f91f146..03179552 100644 --- a/flutter-hms-mlimage/android/build.gradle +++ b/flutter-hms-mlimage/android/build.gradle @@ -27,6 +27,10 @@ android { compileSdkVersion 31 buildToolsVersion "31.0.0" + if (project.android.hasProperty("namespace")) { + namespace 'com.huawei.hms.flutter.mlimage' + } + defaultConfig { minSdkVersion 19 targetSdkVersion 31 diff --git a/flutter-hms-mllanguage/android/build.gradle b/flutter-hms-mllanguage/android/build.gradle index 43555b57..86206353 100644 --- a/flutter-hms-mllanguage/android/build.gradle +++ b/flutter-hms-mllanguage/android/build.gradle @@ -27,6 +27,10 @@ android { compileSdkVersion 33 buildToolsVersion "31.0.0" + if (project.android.hasProperty("namespace")) { + namespace 'com.huawei.hms.flutter.mllanguage' + } + defaultConfig { minSdkVersion 19 targetSdkVersion 33 diff --git a/flutter-hms-mltext/android/build.gradle b/flutter-hms-mltext/android/build.gradle index e9efc0d8..c613fb5a 100644 --- a/flutter-hms-mltext/android/build.gradle +++ b/flutter-hms-mltext/android/build.gradle @@ -27,6 +27,10 @@ android { compileSdkVersion 31 buildToolsVersion "31.0.0" + if (project.android.hasProperty("namespace")) { + namespace 'com.huawei.hms.flutter.mltext' + } + defaultConfig { minSdkVersion 19 targetSdkVersion 31 diff --git a/flutter-hms-modeling/android/build.gradle b/flutter-hms-modeling/android/build.gradle index f390fc86..73b60bc2 100644 --- a/flutter-hms-modeling/android/build.gradle +++ b/flutter-hms-modeling/android/build.gradle @@ -27,6 +27,10 @@ android { compileSdkVersion 30 buildToolsVersion "30.0.3" + if (project.android.hasProperty("namespace")) { + namespace 'com.huawei.hms.flutter.modeling3d' + } + defaultConfig { minSdkVersion 26 targetSdkVersion 30 diff --git a/flutter-hms-nearbyservice/android/build.gradle b/flutter-hms-nearbyservice/android/build.gradle index 02389d00..b0cfb1ce 100644 --- a/flutter-hms-nearbyservice/android/build.gradle +++ b/flutter-hms-nearbyservice/android/build.gradle @@ -27,6 +27,10 @@ android { compileSdkVersion 33 buildToolsVersion "31.0.0" + if (project.android.hasProperty("namespace")) { + namespace 'com.huawei.hms.flutter.nearbyservice' + } + compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 diff --git a/flutter-hms-push/android/build.gradle b/flutter-hms-push/android/build.gradle index 2bc03c80..7ff9d493 100644 --- a/flutter-hms-push/android/build.gradle +++ b/flutter-hms-push/android/build.gradle @@ -9,7 +9,7 @@ buildscript { } dependencies { - classpath "com.android.tools.build:gradle:3.6.0" + classpath 'com.android.tools.build:gradle:7.4.2' } } @@ -27,6 +27,10 @@ android { compileSdkVersion 33 buildToolsVersion '31.0.0' + if (project.android.hasProperty("namespace")) { + namespace 'com.huawei.hms.flutter.push' + } + defaultConfig { minSdkVersion 19 targetSdkVersion 33 diff --git a/flutter-hms-push/android/gradle/wrapper/gradle-wrapper.properties b/flutter-hms-push/android/gradle/wrapper/gradle-wrapper.properties index ed8c93de..5a6b73d6 100644 --- a/flutter-hms-push/android/gradle/wrapper/gradle-wrapper.properties +++ b/flutter-hms-push/android/gradle/wrapper/gradle-wrapper.properties @@ -2,4 +2,4 @@ zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.3-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip diff --git a/flutter-hms-push/android/src/main/java/com/huawei/hms/flutter/push/backgroundmessaging/BackgroundMessagingService.java b/flutter-hms-push/android/src/main/java/com/huawei/hms/flutter/push/backgroundmessaging/BackgroundMessagingService.java index f518c7ae..516b18d9 100644 --- a/flutter-hms-push/android/src/main/java/com/huawei/hms/flutter/push/backgroundmessaging/BackgroundMessagingService.java +++ b/flutter-hms-push/android/src/main/java/com/huawei/hms/flutter/push/backgroundmessaging/BackgroundMessagingService.java @@ -24,8 +24,6 @@ import androidx.annotation.NonNull; import androidx.core.app.JobIntentService; -import io.flutter.plugin.common.PluginRegistry.PluginRegistrantCallback; - import java.util.Collections; import java.util.LinkedList; import java.util.List; @@ -44,11 +42,6 @@ private synchronized void setBackgroundRunner(FlutterBackgroundRunner bgRunner) BackgroundMessagingService.backgroundRunner = bgRunner; } - // For Backwards Compatibility with V1 Plugin registration. - public static void setPluginRegistrantCallback(final PluginRegistrantCallback callback) { - FlutterBackgroundRunner.setPluginRegistrantCallback(callback); - } - public static void setUserCallback(final Context context, final long userCallback) { FlutterBackgroundRunner.setUserCallback(context, userCallback); } diff --git a/flutter-hms-push/android/src/main/java/com/huawei/hms/flutter/push/backgroundmessaging/FlutterBackgroundRunner.java b/flutter-hms-push/android/src/main/java/com/huawei/hms/flutter/push/backgroundmessaging/FlutterBackgroundRunner.java index 01659045..945437ff 100644 --- a/flutter-hms-push/android/src/main/java/com/huawei/hms/flutter/push/backgroundmessaging/FlutterBackgroundRunner.java +++ b/flutter-hms-push/android/src/main/java/com/huawei/hms/flutter/push/backgroundmessaging/FlutterBackgroundRunner.java @@ -38,13 +38,11 @@ import io.flutter.embedding.engine.dart.DartExecutor; import io.flutter.embedding.engine.dart.DartExecutor.DartCallback; import io.flutter.embedding.engine.loader.FlutterLoader; -import io.flutter.embedding.engine.plugins.shim.ShimPluginRegistry; import io.flutter.plugin.common.BinaryMessenger; import io.flutter.plugin.common.MethodCall; import io.flutter.plugin.common.MethodChannel; import io.flutter.plugin.common.MethodChannel.MethodCallHandler; import io.flutter.plugin.common.MethodChannel.Result; -import io.flutter.plugin.common.PluginRegistry.PluginRegistrantCallback; import io.flutter.view.FlutterCallbackInformation; import java.util.Arrays; @@ -60,9 +58,6 @@ public class FlutterBackgroundRunner implements MethodCallHandler { public static final String USER_CALLBACK_KEY = "push_background_message_callback"; - // Deprecated, Support for backwards compatibility with V1 embedding. - private static PluginRegistrantCallback pluginRegistrantCallback; - private final AtomicBoolean isCallbackDispatcherReady = new AtomicBoolean(false); private MethodChannel bgMethodChannel; @@ -71,11 +66,6 @@ public class FlutterBackgroundRunner implements MethodCallHandler { private long bgMessagingCallback; - // For Backwards Compatibility with V1 Plugin registration. - public static void setPluginRegistrantCallback(final PluginRegistrantCallback callback) { - pluginRegistrantCallback = callback; - } - public static void setCallBackDispatcher(final Context context, final long callbackHandle) { final SharedPreferences prefs = context.getSharedPreferences(Core.PREFERENCE_NAME, Context.MODE_PRIVATE); prefs.edit().putLong(CALLBACK_DISPATCHER_KEY, callbackHandle).apply(); @@ -123,17 +113,11 @@ public void startBgIsolate(final Context context, final long callbackHandle) { flutterEngine = new FlutterEngine(context); final FlutterCallbackInformation flutterCallbackInfo - = FlutterCallbackInformation.lookupCallbackInformation(callbackHandle); + = FlutterCallbackInformation.lookupCallbackInformation(callbackHandle); final DartExecutor executor = flutterEngine.getDartExecutor(); initializeMethodChannel(executor); final DartCallback dartCallback = new DartCallback(assets, appBundlePath, flutterCallbackInfo); executor.executeDartCallback(dartCallback); - - // For V1 Embedding - if (pluginRegistrantCallback != null) { - pluginRegistrantCallback.registerWith(new ShimPluginRegistry(flutterEngine)); - } - } }); }; @@ -168,7 +152,7 @@ public void onMethodCall(@NonNull final MethodCall call, @NonNull final Result r public void executeDartCallbackInBgIsolate(final Intent intent, final CountDownLatch latch) { if (flutterEngine == null) { Log.i(TAG, - "A background message could not be handled in Dart as no onBackgroundLocation handler has been registered"); + "A background message could not be handled in Dart as no onBackgroundLocation handler has been registered"); return; } Result result = null; diff --git a/flutter-hms-pushfcm/android/build.gradle b/flutter-hms-pushfcm/android/build.gradle index b64bd34b..ea241d0e 100644 --- a/flutter-hms-pushfcm/android/build.gradle +++ b/flutter-hms-pushfcm/android/build.gradle @@ -26,6 +26,11 @@ apply plugin: 'com.android.library' android { compileSdkVersion 30 buildToolsVersion "30.0.3" + + if (project.android.hasProperty("namespace")) { + namespace 'com.huawei.hms.flutter.pushfcm' + } + defaultConfig { minSdkVersion 17 targetSdkVersion 30 @@ -42,4 +47,4 @@ android { dependencies { implementation 'com.huawei.hms:push-fcm:6.3.0.304' -} \ No newline at end of file +} diff --git a/flutter-hms-safetydetect/android/build.gradle b/flutter-hms-safetydetect/android/build.gradle index 5c1fecdb..d2a9d738 100644 --- a/flutter-hms-safetydetect/android/build.gradle +++ b/flutter-hms-safetydetect/android/build.gradle @@ -27,6 +27,10 @@ android { compileSdkVersion 30 buildToolsVersion "30.0.3" + if (project.android.hasProperty("namespace")) { + namespace 'com.huawei.hms.flutter.safetydetect' + } + defaultConfig { minSdkVersion 19 targetSdkVersion 30 diff --git a/flutter-hms-scan/android/build.gradle b/flutter-hms-scan/android/build.gradle index f8498c46..4885f7e0 100644 --- a/flutter-hms-scan/android/build.gradle +++ b/flutter-hms-scan/android/build.gradle @@ -27,6 +27,10 @@ android { compileSdkVersion 33 buildToolsVersion "31.0.0" + if (project.android.hasProperty("namespace")) { + namespace 'com.huawei.hms.flutter.scan' + } + defaultConfig { minSdkVersion 19 targetSdkVersion 33 diff --git a/flutter-hms-site/android/build.gradle b/flutter-hms-site/android/build.gradle index 0decb6e5..80cd731c 100644 --- a/flutter-hms-site/android/build.gradle +++ b/flutter-hms-site/android/build.gradle @@ -27,6 +27,10 @@ android { compileSdkVersion 33 buildToolsVersion "31.0.0" + if (project.android.hasProperty("namespace")) { + namespace 'com.huawei.hms.flutter.site' + } + defaultConfig { minSdkVersion 19 targetSdkVersion 33 diff --git a/flutter-hms-wallet/android/build.gradle b/flutter-hms-wallet/android/build.gradle index 0be5170b..b51a18a5 100644 --- a/flutter-hms-wallet/android/build.gradle +++ b/flutter-hms-wallet/android/build.gradle @@ -27,6 +27,10 @@ android { compileSdkVersion 30 buildToolsVersion "30.0.3" + if (project.android.hasProperty("namespace")) { + namespace 'com.huawei.hms.flutter.wallet' + } + defaultConfig { minSdkVersion 19 targetSdkVersion 30