Skip to content

[camera_android_camerax] Updates internal API wrapper to use ProxyApis #8618

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 167 commits into from
Apr 15, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
167 commits
Select commit Hold shift + click to select a range
7990d35
add kotlin
bparrishMines Dec 23, 2024
849f149
add copyright
bparrishMines Dec 23, 2024
f54d5d9
some work towards
bparrishMines Dec 23, 2024
fe63e89
rest of non persmission and system stuff for pigeon
bparrishMines Dec 23, 2024
bbe060f
compiling
bparrishMines Dec 25, 2024
a131960
compiling
bparrishMines Dec 25, 2024
8d3664a
change dependencies
bparrishMines Dec 25, 2024
1f93a1e
some progress
bparrishMines Dec 25, 2024
bdf0460
finish on system api update
bparrishMines Dec 25, 2024
65de5b9
finish platform implementation
bparrishMines Dec 26, 2024
ee8adb5
add missing java classes
bparrishMines Dec 26, 2024
2b553ef
some of the classes
bparrishMines Dec 26, 2024
e4ab7bc
most of the api implementations
bparrishMines Dec 26, 2024
2d85644
finish java api implementations
bparrishMines Dec 26, 2024
52e4145
remove other implementations
bparrishMines Dec 27, 2024
4f05e1d
more java cleanup
bparrishMines Dec 27, 2024
c07b09a
Merge branch 'main' of github.com:flutter/packages into camerax_proxy
bparrishMines Dec 27, 2024
5bf75b8
formatting
bparrishMines Dec 27, 2024
575a496
code builds again
bparrishMines Dec 27, 2024
475d465
fix setup
bparrishMines Dec 27, 2024
696454d
temporary work for value
bparrishMines Dec 27, 2024
7bf4991
proxy for setup generics
bparrishMines Dec 29, 2024
9530050
update proxy
bparrishMines Jan 2, 2025
5d39444
java test files and update library
bparrishMines Jan 2, 2025
ac5394c
add setup generics
bparrishMines Jan 2, 2025
6b33f06
default mocks for proxy
bparrishMines Jan 3, 2025
9537145
fix test lints
bparrishMines Jan 3, 2025
e43984c
passing tests
bparrishMines Jan 3, 2025
66773c3
change tests to set the proxy
bparrishMines Jan 4, 2025
5e5fb5d
3rd test
bparrishMines Jan 4, 2025
b07d8b5
tests broken
bparrishMines Jan 7, 2025
62f2426
Merge branch 'main' of github.com:flutter/packages into camerax_proxy
bparrishMines Jan 10, 2025
1c40c4e
fix preview
bparrishMines Jan 10, 2025
e2d6d25
fix third test
bparrishMines Jan 10, 2025
79598e7
semi fix test
bparrishMines Jan 17, 2025
1a7c9c8
change how comments are
bparrishMines Jan 22, 2025
8f94c8e
Merge branch 'main' of github.com:flutter/packages into camerax_proxy
bparrishMines Jan 22, 2025
add672d
Merge branch 'camerax_proxy' of github.com:bparrishMines/packages int…
bparrishMines Jan 22, 2025
418e5b0
fix test
bparrishMines Jan 22, 2025
0427fa9
another test
bparrishMines Jan 23, 2025
0a8841b
another test
bparrishMines Jan 23, 2025
14007a8
improve another test
bparrishMines Jan 23, 2025
38ad55e
remove unused methods
bparrishMines Jan 23, 2025
2c09d11
another test
bparrishMines Jan 23, 2025
e76bcaf
Merge branch 'main' of github.com:flutter/packages into camerax_proxy
bparrishMines Jan 23, 2025
0525d53
another test
bparrishMines Jan 24, 2025
6ba035e
another test
bparrishMines Jan 24, 2025
bf12f84
more passing tests
bparrishMines Jan 24, 2025
1b1e183
fix systerm service test
bparrishMines Jan 24, 2025
b22548e
18 out of 91 tests
bparrishMines Jan 26, 2025
0010bad
21 tests
bparrishMines Jan 26, 2025
c674290
Merge branch 'main' of github.com:flutter/packages into camerax_proxy
bparrishMines Jan 26, 2025
4857bf1
22 tests
bparrishMines Jan 26, 2025
f0247d0
23
bparrishMines Jan 26, 2025
01e5f28
25
bparrishMines Jan 27, 2025
1f4c594
29
bparrishMines Jan 27, 2025
bb0166b
34
bparrishMines Jan 27, 2025
6ff4f08
40
bparrishMines Jan 27, 2025
9248b1f
47
bparrishMines Jan 27, 2025
bcfffc7
50
bparrishMines Jan 27, 2025
28fef62
55 tests passing
bparrishMines Jan 27, 2025
b1699e7
fix first exposure test
bparrishMines Jan 27, 2025
f71f535
second exposure test
bparrishMines Jan 27, 2025
be5fd35
test 60
bparrishMines Jan 28, 2025
7c248bb
63 tests
bparrishMines Jan 28, 2025
5bbb31e
first focus test
bparrishMines Jan 28, 2025
02a152a
Merge branch 'main' of github.com:flutter/packages into camerax_proxy
bparrishMines Jan 28, 2025
51aa98e
67 tests
bparrishMines Jan 28, 2025
7b34e55
71 tests
bparrishMines Jan 28, 2025
6e7fc93
failing test still
bparrishMines Jan 30, 2025
28e9535
Merge branch 'main' of github.com:flutter/packages into camerax_proxy
bparrishMines Feb 10, 2025
9d2c860
Merge branch 'main' of github.com:flutter/packages into camerax_proxy
bparrishMines Feb 11, 2025
e54975e
test
bparrishMines Feb 12, 2025
53fb961
more tests fixed
bparrishMines Feb 12, 2025
5d994ea
84 tests
bparrishMines Feb 12, 2025
7d8c3b5
finish all dart unit tests
bparrishMines Feb 12, 2025
1f1f31d
fix analysis errors
bparrishMines Feb 12, 2025
c70f4d4
fix all analysis errors
bparrishMines Feb 12, 2025
ee2d959
fix dart file names
bparrishMines Feb 12, 2025
61e0626
fix platform side with a few missing stuff
bparrishMines Feb 12, 2025
7555588
fix request options
bparrishMines Feb 12, 2025
18b2310
Merge branch 'main' of github.com:flutter/packages into camerax_proxy
bparrishMines Feb 12, 2025
b626999
fixes
bparrishMines Feb 13, 2025
744138b
formatting
bparrishMines Feb 13, 2025
5582bbb
one java test done
bparrishMines Feb 13, 2025
2164d40
move
bparrishMines Feb 13, 2025
b4482a3
Merge branch 'main' of github.com:flutter/packages into camerax_proxy
bparrishMines Feb 13, 2025
9fd4f86
add mockito
bparrishMines Feb 14, 2025
3c82486
formatting and fix tests
bparrishMines Feb 14, 2025
78ee70f
Merge branch 'main' of github.com:flutter/packages into camerax_proxy
bparrishMines Feb 18, 2025
b3a84b6
camera2cameracontrol test
bparrishMines Feb 18, 2025
d16b24a
camera2camera info test
bparrishMines Feb 19, 2025
979993b
add static method tests
bparrishMines Feb 19, 2025
4afd975
plugin tests
bparrishMines Feb 19, 2025
2fedfda
cameracontrol tests
bparrishMines Feb 20, 2025
0886ff1
camerainfo test
bparrishMines Feb 20, 2025
703f176
range tests
bparrishMines Feb 22, 2025
03cbebe
test class override
bparrishMines Feb 22, 2025
3b5722c
more tests
bparrishMines Feb 22, 2025
cfd8cac
camera selector test
bparrishMines Feb 22, 2025
646fcd5
more more tests
bparrishMines Feb 22, 2025
fd07800
capture request optiosn
bparrishMines Feb 22, 2025
424456e
formatting
bparrishMines Feb 22, 2025
7f48551
device orientation api test
bparrishMines Feb 22, 2025
a34228d
2 more tests
bparrishMines Feb 23, 2025
4410f79
focusmetering tests
bparrishMines Feb 23, 2025
fb912b8
image analysis
bparrishMines Feb 23, 2025
503aea9
image capture tests
bparrishMines Feb 23, 2025
2a48433
image capture test
bparrishMines Feb 23, 2025
542cd06
live data
bparrishMines Feb 23, 2025
50eb131
metering point tests
bparrishMines Feb 23, 2025
2f8e3c2
pending recording
bparrishMines Feb 23, 2025
6e21dba
start of preview tests
bparrishMines Feb 23, 2025
a3b5dcb
preview test
bparrishMines Feb 23, 2025
d02456f
process camera tests
bparrishMines Feb 23, 2025
fc23510
quality selector
bparrishMines Feb 23, 2025
0ab8585
recorder tests
bparrishMines Feb 24, 2025
395e768
resolution filter and recording
bparrishMines Feb 24, 2025
8691de4
more java tests
bparrishMines Feb 24, 2025
8a904b3
create camerapermissions error
bparrishMines Feb 24, 2025
ade6c52
system services manager test
bparrishMines Feb 24, 2025
515db6d
rest of java tests
bparrishMines Feb 24, 2025
1605146
version bump
bparrishMines Feb 24, 2025
d555f3a
Merge branch 'main' of github.com:flutter/packages into camerax_proxy
bparrishMines Feb 24, 2025
b675d18
fix tests
bparrishMines Feb 24, 2025
712225f
add licenses
bparrishMines Feb 24, 2025
637fc60
fixup java tests
bparrishMines Feb 24, 2025
c544f32
remove unused code
bparrishMines Feb 24, 2025
ae792fa
add UnsafeOptInUsageError suppress
bparrishMines Feb 24, 2025
2c55484
synthetic accessor lint
bparrishMines Feb 24, 2025
fd23cfe
nonnull
bparrishMines Feb 24, 2025
7ce2e64
more nonnull
bparrishMines Feb 24, 2025
5dc41af
last one
bparrishMines Feb 24, 2025
a202ba2
Merge branch 'main' of github.com:flutter/packages into camerax_proxy
bparrishMines Mar 19, 2025
77688e4
fix imports and device orientation controller
bparrishMines Mar 19, 2025
986718e
fix rotation tests
bparrishMines Mar 19, 2025
d5ac8a5
lints
bparrishMines Mar 19, 2025
163f41f
formatting
bparrishMines Mar 19, 2025
949afb7
use a single previewproxyapi
bparrishMines Apr 1, 2025
0a616aa
better comments
bparrishMines Apr 1, 2025
5ef7811
remove unused vars
bparrishMines Apr 1, 2025
c1f12a3
switch to onSurfaceCleanup
bparrishMines Apr 1, 2025
83d6ad3
review comments
bparrishMines Apr 1, 2025
496b79a
Merge branch 'main' of github.com:flutter/packages into camerax_proxy
bparrishMines Apr 1, 2025
bd4cf2f
fix remove and use get
bparrishMines Apr 1, 2025
7aa02b6
added suppress for generated kotlin
bparrishMines Apr 1, 2025
79d230e
bump dart
bparrishMines Apr 1, 2025
ffd3a45
Merge branch 'main' of github.com:flutter/packages into camerax_proxy
bparrishMines Apr 2, 2025
631bcc0
switch back to cleanup
bparrishMines Apr 2, 2025
d43749a
Merge branch 'main' of github.com:flutter/packages into camerax_proxy
bparrishMines Apr 2, 2025
d7ea161
change to pigeonInstance
bparrishMines Apr 2, 2025
190a2b0
maybe weird formatting
bparrishMines Apr 2, 2025
892b96e
uncomment
bparrishMines Apr 2, 2025
5036d74
add expected pattern to tests
bparrishMines Apr 3, 2025
7e927fc
Merge branch 'main' of github.com:flutter/packages into camerax_proxy
bparrishMines Apr 3, 2025
a539d65
formatting
bparrishMines Apr 3, 2025
c5ae202
throw exception on error
bparrishMines Apr 3, 2025
177339d
fix permission unit test
bparrishMines Apr 3, 2025
0a42540
change ignore to true
bparrishMines Apr 14, 2025
9eb2270
Merge branch 'main' of github.com:flutter/packages into camerax_proxy
bparrishMines Apr 14, 2025
d63078b
add docs for systemservices
bparrishMines Apr 14, 2025
9100a9c
log error on failed flutter method
bparrishMines Apr 14, 2025
5954729
unused method
bparrishMines Apr 14, 2025
e627829
improve example and add comment
bparrishMines Apr 14, 2025
3c6529c
fix syntheticaccessor lint
bparrishMines Apr 14, 2025
44f9113
surface missing cameracontrol errors
bparrishMines Apr 14, 2025
a8327d1
also try catch turning torch mode off
bparrishMines Apr 14, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions packages/camera/camera_android_camerax/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.6.15

* Updates internal API wrapper to use ProxyApis.

## 0.6.14+1

* Updates compileSdk 34 to flutter.compileSdkVersion.
Expand Down
11 changes: 10 additions & 1 deletion packages/camera/camera_android_camerax/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@ group 'io.flutter.plugins.camerax'
version '1.0'

buildscript {
ext.kotlin_version = '1.9.10'
repositories {
google()
mavenCentral()
}

dependencies {
classpath 'com.android.tools.build:gradle:8.5.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}

Expand All @@ -20,6 +22,7 @@ rootProject.allprojects {
}

apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'

android {
namespace 'io.flutter.plugins.camerax'
Expand All @@ -31,6 +34,11 @@ android {
targetCompatibility JavaVersion.VERSION_11
}

kotlinOptions {
// This must match the Java version provided in compileOptions.
jvmTarget = '11'
}

defaultConfig {
// Many of the CameraX APIs require API 21.
minSdkVersion 21
Expand Down Expand Up @@ -65,7 +73,8 @@ dependencies {
implementation "androidx.camera:camera-video:${camerax_version}"
implementation 'com.google.guava:guava:33.4.0-android'
testImplementation 'junit:junit:4.13.2'
testImplementation 'org.mockito:mockito-inline:5.0.0'
testImplementation "org.mockito:mockito-core:5.15.2"
testImplementation 'org.mockito:mockito-inline:5.1.0'
testImplementation 'androidx.test:core:1.4.0'
testImplementation 'org.robolectric:robolectric:4.10.3'
}

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
// Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

package io.flutter.plugins.camerax;

import androidx.annotation.NonNull;
import androidx.camera.core.ImageAnalysis.Analyzer;
import java.util.Objects;

/**
* ProxyApi implementation for {@link Analyzer}. This class may handle instantiating native object
* instances that are attached to a Dart instance or handle method calls on the associated native
* class or an instance of that class.
*/
class AnalyzerProxyApi extends PigeonApiAnalyzer {
AnalyzerProxyApi(@NonNull ProxyApiRegistrar pigeonRegistrar) {
super(pigeonRegistrar);
}

@NonNull
@Override
public ProxyApiRegistrar getPigeonRegistrar() {
return (ProxyApiRegistrar) super.getPigeonRegistrar();
}

/** Implementation of {@link Analyzer} that passes arguments of callback methods to Dart. */
static class AnalyzerImpl implements Analyzer {
final AnalyzerProxyApi api;

AnalyzerImpl(@NonNull AnalyzerProxyApi api) {
this.api = api;
}

@Override
public void analyze(@NonNull androidx.camera.core.ImageProxy image) {
api.getPigeonRegistrar()
.runOnMainThread(
new ProxyApiRegistrar.FlutterMethodRunnable() {
@Override
public void run() {
api.analyze(
AnalyzerImpl.this,
image,
ResultCompat.asCompatCallback(
result -> {
if (result.isFailure()) {
onFailure(
"Analyzer.analyze",
Objects.requireNonNull(result.exceptionOrNull()));
}
return null;
}));
}
});
}
}

@NonNull
@Override
public Analyzer pigeon_defaultConstructor() {
return new AnalyzerImpl(this);
}
}

This file was deleted.

Loading