Skip to content

Commit

Permalink
Merge branch 'master' into gmain
Browse files Browse the repository at this point in the history
* master: (48 commits)
  [video_player] Add toString() to Caption (flutter#3233)
  [google_maps_flutter_web] Show one InfoWindow at a time. (flutter#3224)
  [in_app_purchase] Bump version (flutter#3227)
  [google_maps_flutter] Overhaul lifecycle management in GoogleMapsPlugin (flutter#3213)
  [in_app_purchase] Remove the custom analysis options, fix failing lints. (flutter#3220)
  [video_player]Fixes Playing video from asset on Android (flutter#3123)
  [camera] Added documentation about video not working correctly on Android emulators (flutter#3180)
  Revert "update api"
  update api
  [wifi_info_flutter] Method channel name fixed for android (flutter#3207)
  [share] Fix bug on iPad where `origin` is null and enable XCUITests in the repo (flutter#3210)
  [google_maps_flutter] Clean up google_maps_flutter plugin (flutter#3206)
  Exclude generated_plugin_registrant.cc (flutter#3198)
  broaden the constraint on package:vm_service (flutter#3208)
  Remove unnecessary work around from test in prep for vm_service migration (flutter#3209)
  Add windows directory to examples (flutter#3149)
  [video_player] Upgrade ExoPlayer (flutter#3204)
  [android_alarm_manager] Removed deprecated display1 (flutter#3200)
  [Connectivity] wifi removal (flutter#3173)
  [wifi_info_flutter] make it ready for initial 1.0.0 release  (flutter#3191)
  ...
  • Loading branch information
yasargil committed Oct 30, 2020
2 parents 5c53cee + 3665c9f commit 52dac7c
Show file tree
Hide file tree
Showing 465 changed files with 12,343 additions and 1,173 deletions.
2 changes: 2 additions & 0 deletions .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ task:
- name: build-ipas+drive-examples
env:
PATH: $PATH:/usr/local/bin
PLUGINS_TO_SKIP_XCTESTS: "battery/battery,camera,connectivity/connectivity,device_info/device_info,espresso,google_maps_flutter/google_maps_flutter,google_sign_in/google_sign_in,image_picker/image_picker,in_app_purchase,integration_test,ios_platform_images,local_auth,package_info,path_provider/path_provider,quick_actions,sensors,shared_preferences/shared_preferences,url_launcher/url_launcher,video_player/video_player,webview_flutter,wifi_info_flutter/wifi_info_flutter"
matrix:
PLUGIN_SHARDING: "--shardIndex 0 --shardCount 4"
PLUGIN_SHARDING: "--shardIndex 1 --shardCount 4"
Expand All @@ -179,6 +180,7 @@ task:
- flutter channel $CHANNEL
- ./script/incremental_build.sh build-examples --ipa
- ./script/incremental_build.sh drive-examples
- ./script/incremental_build.sh xctest --target RunnerUITests --skip $PLUGINS_TO_SKIP_XCTESTS
task:
# don't run on release tags since it creates O(n^2) tasks where n is the number of plugins
only_if: $CIRRUS_TAG == ''
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ gradle-wrapper.jar
generated_plugin_registrant.dart
GeneratedPluginRegistrant.h
GeneratedPluginRegistrant.m
generated_plugin_registrant.cc
GeneratedPluginRegistrant.java
GeneratedPluginRegistrant.swift
build/
Expand Down
8 changes: 8 additions & 0 deletions packages/android_alarm_manager/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
## 0.4.5+16

* Remove unnecessary workaround from test.

## 0.4.5+15

* Update android compileSdkVersion to 29.

## 0.4.5+14

* Keep handling deprecated Android v1 classes for backward compatibility.
Expand Down
2 changes: 1 addition & 1 deletion packages/android_alarm_manager/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ project.getTasks().withType(JavaCompile){
apply plugin: 'com.android.library'

android {
compileSdkVersion 28
compileSdkVersion 29
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
Expand Down
2 changes: 1 addition & 1 deletion packages/android_alarm_manager/example/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ Demonstrates how to use the android_alarm_manager plugin.
## Getting Started

For help getting started with Flutter, view our online
[documentation](http://flutter.io/).
[documentation](https://flutter.dev/).
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ apply plugin: 'com.android.application'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android {
compileSdkVersion 28
compileSdkVersion 29

lintOptions {
disable 'InvalidPackage'
Expand Down
6 changes: 1 addition & 5 deletions packages/android_alarm_manager/example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,7 @@ class _AlarmHomePageState extends State<_AlarmHomePage> {

@override
Widget build(BuildContext context) {
// TODO(jackson): This has been deprecated and should be replaced
// with `headline4` when it's available on all the versions of
// Flutter that we test.
// ignore: deprecated_member_use
final textStyle = Theme.of(context).textTheme.display1;
final textStyle = Theme.of(context).textTheme.headline4;
return Scaffold(
appBar: AppBar(
title: Text(widget.title),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,39 +7,14 @@ import 'dart:convert';
import 'dart:io';

import 'package:flutter_driver/flutter_driver.dart';
import 'package:vm_service_client/vm_service_client.dart';

Future<StreamSubscription<VMIsolateRef>> resumeIsolatesOnPause(
FlutterDriver driver) async {
final VM vm = await driver.serviceClient.getVM();
for (VMIsolateRef isolateRef in vm.isolates) {
final VMIsolate isolate = await isolateRef.load();
if (isolate.isPaused) {
await isolate.resume();
}
}
return driver.serviceClient.onIsolateRunnable
.asBroadcastStream()
.listen((VMIsolateRef isolateRef) async {
final VMIsolate isolate = await isolateRef.load();
if (isolate.isPaused) {
await isolate.resume();
}
});
}

Future<void> main() async {
final FlutterDriver driver = await FlutterDriver.connect();
// flutter drive causes isolates to be paused on spawn. The background isolate
// for this plugin will need to be resumed for the test to pass.
final StreamSubscription<VMIsolateRef> subscription =
await resumeIsolatesOnPause(driver);
final String data = await driver.requestData(
null,
timeout: const Duration(minutes: 1),
);
await driver.close();
await subscription.cancel();
final Map<String, dynamic> result = jsonDecode(data);
exit(result['result'] == 'true' ? 0 : 1);
}
2 changes: 1 addition & 1 deletion packages/android_alarm_manager/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ description: Flutter plugin for accessing the Android AlarmManager service, and
# 0.4.y+z is compatible with 1.0.0, if you land a breaking change bump
# the version to 2.0.0.
# See more details: https://github.com/flutter/flutter/wiki/Package-migration-to-1.0.0
version: 0.4.5+14
version: 0.4.5+16
homepage: https://github.com/flutter/plugins/tree/master/packages/android_alarm_manager

dependencies:
Expand Down
4 changes: 4 additions & 0 deletions packages/android_intent/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.3.7+6

* Update android compileSdkVersion to 29.

## 0.3.7+5

* Android Code Inspection and Clean up.
Expand Down
2 changes: 1 addition & 1 deletion packages/android_intent/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ project.getTasks().withType(JavaCompile){
apply plugin: 'com.android.library'

android {
compileSdkVersion 28
compileSdkVersion 29

defaultConfig {
minSdkVersion 16
Expand Down
2 changes: 1 addition & 1 deletion packages/android_intent/example/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ Demonstrates how to use the android_intent plugin.
## Getting Started

For help getting started with Flutter, view our online
[documentation](http://flutter.io/).
[documentation](https://flutter.dev/).
2 changes: 1 addition & 1 deletion packages/android_intent/example/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ apply plugin: 'com.android.application'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android {
compileSdkVersion 28
compileSdkVersion 29

lintOptions {
disable 'InvalidPackage'
Expand Down
2 changes: 1 addition & 1 deletion packages/android_intent/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ homepage: https://github.com/flutter/plugins/tree/master/packages/android_intent
# 0.3.y+z is compatible with 1.0.0, if you land a breaking change bump
# the version to 2.0.0.
# See more details: https://github.com/flutter/flutter/wiki/Package-migration-to-1.0.0
version: 0.3.7+5
version: 0.3.7+6

flutter:
plugin:
Expand Down
4 changes: 4 additions & 0 deletions packages/battery/battery/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 1.0.7

* Update android compileSdkVersion to 29.

## 1.0.6

* Keep handling deprecated Android v1 classes for backward compatibility.
Expand Down
2 changes: 1 addition & 1 deletion packages/battery/battery/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ rootProject.allprojects {
apply plugin: 'com.android.library'

android {
compileSdkVersion 28
compileSdkVersion 29

defaultConfig {
minSdkVersion 16
Expand Down
2 changes: 1 addition & 1 deletion packages/battery/battery/example/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ Demonstrates how to use the battery plugin.
## Getting Started

For help getting started with Flutter, view our online
[documentation](http://flutter.io/).
[documentation](https://flutter.dev/).
2 changes: 1 addition & 1 deletion packages/battery/battery/example/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ apply plugin: 'com.android.application'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android {
compileSdkVersion 28
compileSdkVersion 29

lintOptions {
disable 'InvalidPackage'
Expand Down
2 changes: 1 addition & 1 deletion packages/battery/battery/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: battery
description: Flutter plugin for accessing information about the battery state
(full, charging, discharging) on Android and iOS.
homepage: https://github.com/flutter/plugins/tree/master/packages/battery/battery
version: 1.0.6
version: 1.0.7

flutter:
plugin:
Expand Down
21 changes: 21 additions & 0 deletions packages/camera/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,24 @@
## 0.5.8+12

* Added information of video not working correctly on Android emulators to `README.md`.

## 0.5.8+11

* Fix rare nullptr exception on Android.
* Updated README.md with information about handling App lifecycle changes.

## 0.5.8+10

* Suppress the `deprecated_member_use` warning in the example app for `ScaffoldMessenger.showSnackBar`.

## 0.5.8+9

* Update android compileSdkVersion to 29.

## 0.5.8+8

* Fixed garbled audio (in video) by setting audio encoding bitrate.

## 0.5.8+7

* Keep handling deprecated Android v1 classes for backward compatibility.
Expand Down
23 changes: 23 additions & 0 deletions packages/camera/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,29 @@ Change the minimum Android sdk version to 21 (or higher) in your `android/app/bu
minSdkVersion 21
```

It's important to note that the `MediaRecorder` class is not working properly on emulators, as stated in the documentation: https://developer.android.com/reference/android/media/MediaRecorder. Specifically, when recording a video with sound enabled and trying to play it back, the duration won't be correct and you will only see the first frame.

### Handling Lifecycle states

As of version [0.5.0](https://github.com/flutter/plugins/blob/master/packages/camera/CHANGELOG.md#050) of the camera plugin, lifecycle changes are no longer handled by the plugin. This means developers are now responsible to control camera resources when the lifecycle state is updated. Failure to do so might lead to unexpected behavior (for example as described in issue [#39109](https://github.com/flutter/flutter/issues/39109)). Handling lifecycle changes can be done by overriding the `didChangeAppLifecycleState` method like so:

```dart
@override
void didChangeAppLifecycleState(AppLifecycleState state) {
// App state changed before we got the chance to initialize.
if (controller == null || !controller.value.isInitialized) {
return;
}
if (state == AppLifecycleState.inactive) {
controller?.dispose();
} else if (state == AppLifecycleState.resumed) {
if (controller != null) {
onNewCameraSelected(controller.description);
}
}
}
```

### Example

Here is a small example flutter app displaying a full screen camera preview.
Expand Down
3 changes: 2 additions & 1 deletion packages/camera/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ project.getTasks().withType(JavaCompile){
apply plugin: 'com.android.library'

android {
compileSdkVersion 28
compileSdkVersion 29

defaultConfig {
minSdkVersion 21
Expand All @@ -51,4 +51,5 @@ android {

dependencies {
testImplementation 'junit:junit:4.12'
testImplementation 'org.mockito:mockito-core:3.5.13'
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import androidx.annotation.NonNull;
import io.flutter.plugin.common.EventChannel;
import io.flutter.plugin.common.MethodChannel.Result;
import io.flutter.plugins.camera.media.MediaRecorderBuilder;
import io.flutter.view.TextureRegistry.SurfaceTextureEntry;
import java.io.File;
import java.io.FileOutputStream;
Expand Down Expand Up @@ -82,7 +83,6 @@ public Camera(
if (activity == null) {
throw new IllegalStateException("No activity available!");
}

this.cameraName = cameraName;
this.enableAudio = enableAudio;
this.flutterTexture = flutterTexture;
Expand Down Expand Up @@ -120,23 +120,12 @@ private void prepareMediaRecorder(String outputFilePath) throws IOException {
if (mediaRecorder != null) {
mediaRecorder.release();
}
mediaRecorder = new MediaRecorder();

// There's a specific order that mediaRecorder expects. Do not change the order
// of these function calls.
if (enableAudio) mediaRecorder.setAudioSource(MediaRecorder.AudioSource.MIC);
mediaRecorder.setVideoSource(MediaRecorder.VideoSource.SURFACE);
mediaRecorder.setOutputFormat(recordingProfile.fileFormat);
if (enableAudio) mediaRecorder.setAudioEncoder(recordingProfile.audioCodec);
mediaRecorder.setVideoEncoder(recordingProfile.videoCodec);
mediaRecorder.setVideoEncodingBitRate(recordingProfile.videoBitRate);
if (enableAudio) mediaRecorder.setAudioSamplingRate(recordingProfile.audioSampleRate);
mediaRecorder.setVideoFrameRate(recordingProfile.videoFrameRate);
mediaRecorder.setVideoSize(recordingProfile.videoFrameWidth, recordingProfile.videoFrameHeight);
mediaRecorder.setOutputFile(outputFilePath);
mediaRecorder.setOrientationHint(getMediaOrientation());

mediaRecorder.prepare();

mediaRecorder =
new MediaRecorderBuilder(recordingProfile, outputFilePath)
.setEnableAudio(enableAudio)
.setMediaOrientation(getMediaOrientation())
.build();
}

@SuppressLint("MissingPermission")
Expand Down Expand Up @@ -421,6 +410,8 @@ public void resumeVideoRecording(@NonNull final Result result) {
}

public void startPreview() throws CameraAccessException {
if (pictureImageReader == null || pictureImageReader.getSurface() == null) return;

createCaptureSession(CameraDevice.TEMPLATE_PREVIEW, pictureImageReader.getSurface());
}

Expand Down
Loading

0 comments on commit 52dac7c

Please sign in to comment.