Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
ade8dfac
Unverified
Commit
ade8dfac
authored
Nov 01, 2019
by
Emmanuel Garcia
Committed by
GitHub
Nov 01, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move the plugin registrant to io.flutter.plugins and add the @Keep annotation (#44011)
parent
93ab9e64
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
23 additions
and
30 deletions
+23
-30
MainActivity.kt
...m/example/android_embedding_v2_smoke_test/MainActivity.kt
+1
-1
MainActivity.java
...ng/app/src/main/java/io/flutter/add2app/MainActivity.java
+1
-1
MainActivity.java
...g/app/src/main/java/io/flutter/addtoapp/MainActivity.java
+1
-1
MainActivity.java
...g/app/src/main/java/io/flutter/addtoapp/MainActivity.java
+1
-1
plugins.dart
packages/flutter_tools/lib/src/plugins.dart
+11
-18
MainActivity.java.tmpl
...pp/src/main/java/androidIdentifier/MainActivity.java.tmpl
+1
-1
MainActivity.kt.tmpl
...pp/src/main/kotlin/androidIdentifier/MainActivity.kt.tmpl
+1
-1
MainActivity.java.tmpl
...c/main/java/androidIdentifier/host/MainActivity.java.tmpl
+1
-1
plugins_test.dart
packages/flutter_tools/test/general.shard/plugins_test.dart
+5
-5
No files found.
dev/integration_tests/android_embedding_v2_smoke_test/android/app/src/main/kotlin/com/example/android_embedding_v2_smoke_test/MainActivity.kt
View file @
ade8dfac
package
com.example.android_embedding_v2_smoke_test
package
com.example.android_embedding_v2_smoke_test
import
androidx.annotation.NonNull;
import
androidx.annotation.NonNull;
import
dev.flutter.plugins.GeneratedPluginRegistrant
import
io.flutter.embedding.android.FlutterActivity
import
io.flutter.embedding.android.FlutterActivity
import
io.flutter.embedding.engine.FlutterEngine
import
io.flutter.embedding.engine.FlutterEngine
import
io.flutter.plugins.GeneratedPluginRegistrant
class
MainActivity
:
FlutterActivity
()
{
class
MainActivity
:
FlutterActivity
()
{
override
fun
configureFlutterEngine
(
@NonNull
flutterEngine
:
FlutterEngine
)
{
override
fun
configureFlutterEngine
(
@NonNull
flutterEngine
:
FlutterEngine
)
{
...
...
dev/integration_tests/android_host_app_v2_embedding/app/src/main/java/io/flutter/add2app/MainActivity.java
View file @
ade8dfac
package
io
.
flutter
.
add2app
;
package
io
.
flutter
.
add2app
;
import
androidx.annotation.NonNull
;
import
androidx.annotation.NonNull
;
import
dev.flutter.plugins.GeneratedPluginRegistrant
;
import
io.flutter.embedding.android.FlutterActivity
;
import
io.flutter.embedding.android.FlutterActivity
;
import
io.flutter.embedding.engine.FlutterEngine
;
import
io.flutter.embedding.engine.FlutterEngine
;
import
io.flutter.plugins.GeneratedPluginRegistrant
;
public
class
MainActivity
extends
FlutterActivity
{
public
class
MainActivity
extends
FlutterActivity
{
@Override
@Override
...
...
dev/integration_tests/android_module_host_with_custom_build_v2_embedding/app/src/main/java/io/flutter/addtoapp/MainActivity.java
View file @
ade8dfac
package
io
.
flutter
.
add2app
;
package
io
.
flutter
.
add2app
;
import
androidx.annotation.NonNull
;
import
androidx.annotation.NonNull
;
import
dev.flutter.plugins.GeneratedPluginRegistrant
;
import
io.flutter.embedding.android.FlutterActivity
;
import
io.flutter.embedding.android.FlutterActivity
;
import
io.flutter.embedding.engine.FlutterEngine
;
import
io.flutter.embedding.engine.FlutterEngine
;
import
io.flutter.plugins.GeneratedPluginRegistrant
;
public
class
MainActivity
extends
FlutterActivity
{
public
class
MainActivity
extends
FlutterActivity
{
@Override
@Override
...
...
dev/integration_tests/module_host_with_custom_build_v2_embedding/app/src/main/java/io/flutter/addtoapp/MainActivity.java
View file @
ade8dfac
package
io
.
flutter
.
add2app
;
package
io
.
flutter
.
add2app
;
import
androidx.annotation.NonNull
;
import
androidx.annotation.NonNull
;
import
dev.flutter.plugins.GeneratedPluginRegistrant
;
import
io.flutter.embedding.android.FlutterActivity
;
import
io.flutter.embedding.android.FlutterActivity
;
import
io.flutter.embedding.engine.FlutterEngine
;
import
io.flutter.embedding.engine.FlutterEngine
;
import
io.flutter.plugins.GeneratedPluginRegistrant
;
public
class
MainActivity
extends
FlutterActivity
{
public
class
MainActivity
extends
FlutterActivity
{
@Override
@Override
...
...
packages/flutter_tools/lib/src/plugins.dart
View file @
ade8dfac
...
@@ -311,12 +311,14 @@ public final class GeneratedPluginRegistrant {
...
@@ -311,12 +311,14 @@ public final class GeneratedPluginRegistrant {
}
}
'''
;
'''
;
const
String
_androidPluginRegistryTemplateNewEmbedding
=
'''package
dev
.flutter.plugins;
const
String
_androidPluginRegistryTemplateNewEmbedding
=
'''package
io
.flutter.plugins;
{{#androidX}}
{{#androidX}}
import androidx.annotation.Keep;
import androidx.annotation.NonNull;
import androidx.annotation.NonNull;
{{/androidX}}
{{/androidX}}
{{^androidX}}
{{^androidX}}
import android.support.annotation.Keep;
import android.support.annotation.NonNull;
import android.support.annotation.NonNull;
{{/androidX}}
{{/androidX}}
import io.flutter.embedding.engine.FlutterEngine;
import io.flutter.embedding.engine.FlutterEngine;
...
@@ -329,6 +331,7 @@ import io.flutter.embedding.engine.plugins.shim.ShimPluginRegistry;
...
@@ -329,6 +331,7 @@ import io.flutter.embedding.engine.plugins.shim.ShimPluginRegistry;
* This file is generated by the Flutter tool based on the
* This file is generated by the Flutter tool based on the
* plugins that support the Android platform.
* plugins that support the Android platform.
*/
*/
@Keep
public final class GeneratedPluginRegistrant {
public final class GeneratedPluginRegistrant {
public static void registerWith(@NonNull FlutterEngine flutterEngine) {
public static void registerWith(@NonNull FlutterEngine flutterEngine) {
{{#needsShim}}
{{#needsShim}}
...
@@ -399,10 +402,14 @@ Future<void> _writeAndroidPluginRegistrant(FlutterProject project, List<Plugin>
...
@@ -399,10 +402,14 @@ Future<void> _writeAndroidPluginRegistrant(FlutterProject project, List<Plugin>
'main'
,
'main'
,
'java'
,
'java'
,
);
);
final
String
registryPath
=
fs
.
path
.
join
(
String
registryPath
;
javaSourcePath
,
'io'
,
'flutter'
,
'plugins'
,
'GeneratedPluginRegistrant.java'
,
);
String
templateContent
;
String
templateContent
;
final
String
appEmbeddingVersion
=
_getAndroidEmbeddingVersion
(
project
);
final
String
appEmbeddingVersion
=
_getAndroidEmbeddingVersion
(
project
);
switch
(
appEmbeddingVersion
)
{
switch
(
appEmbeddingVersion
)
{
case
'2'
:
case
'2'
:
...
@@ -415,23 +422,9 @@ Future<void> _writeAndroidPluginRegistrant(FlutterProject project, List<Plugin>
...
@@ -415,23 +422,9 @@ Future<void> _writeAndroidPluginRegistrant(FlutterProject project, List<Plugin>
break
;
break
;
}
}
}
}
registryPath
=
fs
.
path
.
join
(
javaSourcePath
,
'dev'
,
'flutter'
,
'plugins'
,
'GeneratedPluginRegistrant.java'
,
);
templateContent
=
_androidPluginRegistryTemplateNewEmbedding
;
templateContent
=
_androidPluginRegistryTemplateNewEmbedding
;
break
;
break
;
case
'1'
:
case
'1'
:
registryPath
=
fs
.
path
.
join
(
javaSourcePath
,
'io'
,
'flutter'
,
'plugins'
,
'GeneratedPluginRegistrant.java'
,
);
templateContent
=
_androidPluginRegistryTemplateOldEmbedding
;
templateContent
=
_androidPluginRegistryTemplateOldEmbedding
;
break
;
break
;
default
:
default
:
...
...
packages/flutter_tools/templates/app/android-java.tmpl/app/src/main/java/androidIdentifier/MainActivity.java.tmpl
View file @
ade8dfac
...
@@ -7,9 +7,9 @@ import androidx.annotation.NonNull;
...
@@ -7,9 +7,9 @@ import androidx.annotation.NonNull;
{{^
androidX
}}
{{^
androidX
}}
import
android
.
support
.
annotation
.
NonNull
;
import
android
.
support
.
annotation
.
NonNull
;
{{/
androidX
}}
{{/
androidX
}}
import
dev
.
flutter
.
plugins
.
GeneratedPluginRegistrant
;
import
io
.
flutter
.
embedding
.
android
.
FlutterActivity
;
import
io
.
flutter
.
embedding
.
android
.
FlutterActivity
;
import
io
.
flutter
.
embedding
.
engine
.
FlutterEngine
;
import
io
.
flutter
.
embedding
.
engine
.
FlutterEngine
;
import
io
.
flutter
.
plugins
.
GeneratedPluginRegistrant
;
public
class
MainActivity
extends
FlutterActivity
{
public
class
MainActivity
extends
FlutterActivity
{
@
Override
@
Override
...
...
packages/flutter_tools/templates/app/android-kotlin.tmpl/app/src/main/kotlin/androidIdentifier/MainActivity.kt.tmpl
View file @
ade8dfac
...
@@ -7,9 +7,9 @@ import androidx.annotation.NonNull;
...
@@ -7,9 +7,9 @@ import androidx.annotation.NonNull;
{{^
androidX
}}
{{^
androidX
}}
import
android
.
support
.
annotation
.
NonNull
;
import
android
.
support
.
annotation
.
NonNull
;
{{/
androidX
}}
{{/
androidX
}}
import
dev
.
flutter
.
plugins
.
GeneratedPluginRegistrant
import
io
.
flutter
.
embedding
.
android
.
FlutterActivity
import
io
.
flutter
.
embedding
.
android
.
FlutterActivity
import
io
.
flutter
.
embedding
.
engine
.
FlutterEngine
import
io
.
flutter
.
embedding
.
engine
.
FlutterEngine
import
io
.
flutter
.
plugins
.
GeneratedPluginRegistrant
class
MainActivity
:
FlutterActivity
()
{
class
MainActivity
:
FlutterActivity
()
{
override
fun
configureFlutterEngine
(@
NonNull
flutterEngine
:
FlutterEngine
)
{
override
fun
configureFlutterEngine
(@
NonNull
flutterEngine
:
FlutterEngine
)
{
...
...
packages/flutter_tools/templates/module/android/host_app_common/app.tmpl/src/main/java/androidIdentifier/host/MainActivity.java.tmpl
View file @
ade8dfac
...
@@ -8,9 +8,9 @@ import androidx.annotation.NonNull;
...
@@ -8,9 +8,9 @@ import androidx.annotation.NonNull;
{{^
androidX
}}
{{^
androidX
}}
import
android
.
support
.
annotation
.
NonNull
;
import
android
.
support
.
annotation
.
NonNull
;
{{/
androidX
}}
{{/
androidX
}}
import
dev
.
flutter
.
plugins
.
GeneratedPluginRegistrant
;
import
io
.
flutter
.
embedding
.
android
.
FlutterActivity
;
import
io
.
flutter
.
embedding
.
android
.
FlutterActivity
;
import
io
.
flutter
.
embedding
.
engine
.
FlutterEngine
;
import
io
.
flutter
.
embedding
.
engine
.
FlutterEngine
;
import
io
.
flutter
.
plugins
.
GeneratedPluginRegistrant
;
public
class
MainActivity
extends
FlutterActivity
{
public
class
MainActivity
extends
FlutterActivity
{
@
Override
@
Override
...
...
packages/flutter_tools/test/general.shard/plugins_test.dart
View file @
ade8dfac
...
@@ -190,11 +190,11 @@ void main() {
...
@@ -190,11 +190,11 @@ void main() {
await
injectPlugins
(
flutterProject
);
await
injectPlugins
(
flutterProject
);
final
File
registrant
=
flutterProject
.
directory
final
File
registrant
=
flutterProject
.
directory
.
childDirectory
(
fs
.
path
.
join
(
'android'
,
'app'
,
'src'
,
'main'
,
'java'
,
'
dev
'
,
'flutter'
,
'plugins'
))
.
childDirectory
(
fs
.
path
.
join
(
'android'
,
'app'
,
'src'
,
'main'
,
'java'
,
'
io
'
,
'flutter'
,
'plugins'
))
.
childFile
(
'GeneratedPluginRegistrant.java'
);
.
childFile
(
'GeneratedPluginRegistrant.java'
);
expect
(
registrant
.
existsSync
(),
isTrue
);
expect
(
registrant
.
existsSync
(),
isTrue
);
expect
(
registrant
.
readAsStringSync
(),
contains
(
'package
dev
.flutter.plugins'
));
expect
(
registrant
.
readAsStringSync
(),
contains
(
'package
io
.flutter.plugins'
));
expect
(
registrant
.
readAsStringSync
(),
contains
(
'class GeneratedPluginRegistrant'
));
expect
(
registrant
.
readAsStringSync
(),
contains
(
'class GeneratedPluginRegistrant'
));
},
overrides:
<
Type
,
Generator
>{
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
fs
,
FileSystem:
()
=>
fs
,
...
@@ -282,7 +282,7 @@ plugin3:${pluginUsingOldEmbeddingDir.childDirectory('lib').uri.toString()}
...
@@ -282,7 +282,7 @@ plugin3:${pluginUsingOldEmbeddingDir.childDirectory('lib').uri.toString()}
await
injectPlugins
(
flutterProject
);
await
injectPlugins
(
flutterProject
);
final
File
registrant
=
flutterProject
.
directory
final
File
registrant
=
flutterProject
.
directory
.
childDirectory
(
fs
.
path
.
join
(
'android'
,
'app'
,
'src'
,
'main'
,
'java'
,
'
dev
'
,
'flutter'
,
'plugins'
))
.
childDirectory
(
fs
.
path
.
join
(
'android'
,
'app'
,
'src'
,
'main'
,
'java'
,
'
io
'
,
'flutter'
,
'plugins'
))
.
childFile
(
'GeneratedPluginRegistrant.java'
);
.
childFile
(
'GeneratedPluginRegistrant.java'
);
expect
(
registrant
.
readAsStringSync
(),
expect
(
registrant
.
readAsStringSync
(),
...
@@ -362,11 +362,11 @@ plugin3:${pluginUsingOldEmbeddingDir.childDirectory('lib').uri.toString()}
...
@@ -362,11 +362,11 @@ plugin3:${pluginUsingOldEmbeddingDir.childDirectory('lib').uri.toString()}
await
injectPlugins
(
flutterProject
);
await
injectPlugins
(
flutterProject
);
final
File
registrant
=
flutterProject
.
directory
final
File
registrant
=
flutterProject
.
directory
.
childDirectory
(
fs
.
path
.
join
(
'android'
,
'app'
,
'src'
,
'main'
,
'java'
,
'
dev
'
,
'flutter'
,
'plugins'
))
.
childDirectory
(
fs
.
path
.
join
(
'android'
,
'app'
,
'src'
,
'main'
,
'java'
,
'
io
'
,
'flutter'
,
'plugins'
))
.
childFile
(
'GeneratedPluginRegistrant.java'
);
.
childFile
(
'GeneratedPluginRegistrant.java'
);
expect
(
registrant
.
existsSync
(),
isTrue
);
expect
(
registrant
.
existsSync
(),
isTrue
);
expect
(
registrant
.
readAsStringSync
(),
contains
(
'package
dev
.flutter.plugins'
));
expect
(
registrant
.
readAsStringSync
(),
contains
(
'package
io
.flutter.plugins'
));
expect
(
registrant
.
readAsStringSync
(),
contains
(
'class GeneratedPluginRegistrant'
));
expect
(
registrant
.
readAsStringSync
(),
contains
(
'class GeneratedPluginRegistrant'
));
},
overrides:
<
Type
,
Generator
>{
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
fs
,
FileSystem:
()
=>
fs
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment