Skip to content
This repository has been archived by the owner on Feb 22, 2023. It is now read-only.

Commit

Permalink
Merge branch 'master' into image_picker_camera_on_android11
Browse files Browse the repository at this point in the history
  • Loading branch information
Bubu committed Dec 11, 2020
2 parents 0d9c4b9 + 7d39247 commit 6e416e9
Show file tree
Hide file tree
Showing 78 changed files with 2,439 additions and 648 deletions.
3 changes: 3 additions & 0 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ analyzer:
# Ignore generated files
- '**/*.g.dart'
- 'lib/src/generated/*.dart'
errors:
always_require_non_null_named_parameters: false # not needed with nnbd
unnecessary_null_comparison: false # Turned as long as nnbd mix-mode is supported.
linter:
rules:
- public_member_api_docs
2 changes: 1 addition & 1 deletion packages/android_alarm_manager/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Next, within the `<application></application>` tags, add:
android:name="io.flutter.plugins.androidalarmmanager.RebootBroadcastReceiver"
android:enabled="false">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED"></action>
<action android:name="android.intent.action.BOOT_COMPLETED"/>
</intent-filter>
</receiver>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
android:name="io.flutter.plugins.androidalarmmanager.RebootBroadcastReceiver"
android:enabled="false">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED"></action>
<action android:name="android.intent.action.BOOT_COMPLETED"/>
</intent-filter>
</receiver>
<meta-data
Expand Down
8 changes: 8 additions & 0 deletions packages/camera/camera/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
## 0.5.8+18

* Suppress unchecked warning in Android tests which prevented the tests to compile.

## 0.5.8+17

* Added Android 30 support.

## 0.5.8+16

* Moved package to camera/camera subdir, to allow for federated implementations.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import static io.flutter.plugins.camera.CameraUtils.computeBestPreviewSize;

import android.annotation.SuppressLint;
import android.annotation.TargetApi;
import android.app.Activity;
import android.content.Context;
import android.graphics.ImageFormat;
Expand All @@ -16,12 +17,16 @@
import android.hardware.camera2.CameraMetadata;
import android.hardware.camera2.CaptureFailure;
import android.hardware.camera2.CaptureRequest;
import android.hardware.camera2.params.OutputConfiguration;
import android.hardware.camera2.params.SessionConfiguration;
import android.hardware.camera2.params.StreamConfigurationMap;
import android.media.CamcorderProfile;
import android.media.Image;
import android.media.ImageReader;
import android.media.MediaRecorder;
import android.os.Build;
import android.os.Build.VERSION;
import android.os.Build.VERSION_CODES;
import android.util.Size;
import android.view.OrientationEventListener;
import android.view.Surface;
Expand All @@ -39,6 +44,7 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.Executors;

public class Camera {
private final SurfaceTextureEntry flutterTexture;
Expand Down Expand Up @@ -325,12 +331,42 @@ public void onConfigureFailed(@NonNull CameraCaptureSession cameraCaptureSession
}
};

// Collect all surfaces we want to render to.
List<Surface> surfaceList = new ArrayList<>();
surfaceList.add(flutterSurface);
surfaceList.addAll(remainingSurfaces);
// Start the session
cameraDevice.createCaptureSession(surfaceList, callback, null);
if (VERSION.SDK_INT >= VERSION_CODES.P) {
// Collect all surfaces we want to render to.
List<OutputConfiguration> configs = new ArrayList<>();
configs.add(new OutputConfiguration(flutterSurface));
for (Surface surface : remainingSurfaces) {
configs.add(new OutputConfiguration(surface));
}
createCaptureSessionWithSessionConfig(configs, callback);
} else {
// Collect all surfaces we want to render to.
List<Surface> surfaceList = new ArrayList<>();
surfaceList.add(flutterSurface);
surfaceList.addAll(remainingSurfaces);
createCaptureSession(surfaceList, callback);
}
}

@TargetApi(VERSION_CODES.P)
private void createCaptureSessionWithSessionConfig(
List<OutputConfiguration> outputConfigs, CameraCaptureSession.StateCallback callback)
throws CameraAccessException {
cameraDevice.createCaptureSession(
new SessionConfiguration(
SessionConfiguration.SESSION_REGULAR,
outputConfigs,
Executors.newSingleThreadExecutor(),
callback));
}

@TargetApi(VERSION_CODES.LOLLIPOP)
@SuppressWarnings("deprecation")
private void createCaptureSession(
List<Surface> surfaces, CameraCaptureSession.StateCallback callback)
throws CameraAccessException {
cameraDevice.createCaptureSession(surfaces, callback, null);
}

public void startVideoRecording(String filePath, Result result) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,9 @@ public void sendCameraClosingEvent() {
assertNull(event.get("errorDescription"));
}

@SuppressWarnings("unchecked")
private Map<String, String> decodeSentMessage(ByteBuffer sentMessage) {
sentMessage.position(0);
//noinspection unchecked
return (Map<String, String>) StandardMethodCodec.INSTANCE.decodeEnvelope(sentMessage);
}

Expand Down
2 changes: 1 addition & 1 deletion packages/camera/camera/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: camera
description: A Flutter plugin for getting information about and controlling the
camera on Android and iOS. Supports previewing the camera feed, capturing images, capturing video,
and streaming image buffers to dart.
version: 0.5.8+16
version: 0.5.8+18
homepage: https://github.com/flutter/plugins/tree/master/packages/camera/camera

dependencies:
Expand Down
11 changes: 11 additions & 0 deletions packages/camera/camera_platform_interface/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
## 1.0.2

- Added interface methods to support zoom features.

## 1.0.1

- Added interface methods for setting flash mode.

## 1.0.0

- Initial open-source release
25 changes: 25 additions & 0 deletions packages/camera/camera_platform_interface/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
Copyright 2017 The Chromium Authors. All rights reserved.

Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials provided
with the distribution.
* Neither the name of Google Inc. nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 changes: 26 additions & 0 deletions packages/camera/camera_platform_interface/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# camera_platform_interface

A common platform interface for the [`camera`][1] plugin.

This interface allows platform-specific implementations of the `camera`
plugin, as well as the plugin itself, to ensure they are supporting the
same interface.

# Usage

To implement a new platform-specific implementation of `camera`, extend
[`CameraPlatform`][2] with an implementation that performs the
platform-specific behavior, and when you register your plugin, set the default
`CameraPlatform` by calling
`CameraPlatform.instance = MyPlatformCamera()`.

# Note on breaking changes

Strongly prefer non-breaking changes (such as adding a method to the interface)
over breaking changes for this package.

See https://flutter.dev/go/platform-interface-breaking-changes for a discussion
on why a less-clean interface is preferable to a breaking change.

[1]: ../camera
[2]: lib/camera_platform_interface.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

export 'src/events/camera_event.dart';
export 'src/platform_interface/camera_platform.dart';
export 'src/types/types.dart';

/// Expose XFile
export 'package:cross_file/cross_file.dart';
Loading

0 comments on commit 6e416e9

Please sign in to comment.