Skip to content

Commit 8df2f53

Browse files
committed
Merge remote-tracking branch 'origin/main' into NoDocumentPerformanceFix
2 parents df8aefd + db3bd7a commit 8df2f53

File tree

51 files changed

+717
-176
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+717
-176
lines changed

.github/workflows/ai-nightlies.yml renamed to .github/workflows/ai-daily-tests.yml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,21 @@
1-
name: Firebase AI Nightlies
1+
name: Firebase AI Daily Tests
22

33
on:
44
schedule:
55
- cron: 2 7 * * * # Runs automatically once a day
66
workflow_dispatch: # Allow triggering the workflow manually
77

8+
permissions:
9+
contents: read
10+
811
jobs:
9-
nightlies:
10-
name: "Nightlies"
12+
dailies:
13+
name: "Daily Tests"
1114
runs-on: ubuntu-latest
1215

1316
steps:
1417
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
1518
with:
16-
fetch-depth: 2
1719
submodules: true
1820

1921
- name: Enable KVM
@@ -48,7 +50,7 @@ jobs:
4850
FTL_RESULTS_DIR: ${{ format('logs/{0}/{1}_{2}/artifacts/', github.workflow, github.run_id, github.run_attempt) }}
4951
FIREBASE_APP_CHECK_DEBUG_SECRET: ${{ secrets.FIREBASE_APP_CHECK_DEBUG_SECRET }}
5052
with:
51-
api-level: 31
53+
api-level: 34
5254
arch: x86_64
5355
ram-size: 4096M
5456
heap-size: 4096M

.github/workflows/check_format.yml

Lines changed: 2 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -9,44 +9,13 @@ on:
99
- main
1010

1111
jobs:
12-
determine_changed:
13-
name: "Determine changed modules"
14-
runs-on: ubuntu-22.04
15-
if: (github.repository == 'Firebase/firebase-android-sdk' && github.event_name == 'push') || github.event_name == 'pull_request'
16-
outputs:
17-
modules: ${{ steps.changed-modules.outputs.modules }}
18-
steps:
19-
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
20-
with:
21-
fetch-depth: 2
22-
submodules: true
23-
24-
- name: Set up JDK 17
25-
uses: actions/setup-java@3a4f6e1af504cf6a31855fa899c6aa5355ba6c12 # v4.7.0
26-
with:
27-
java-version: 17
28-
distribution: temurin
29-
cache: gradle
30-
31-
- id: changed-modules
32-
run: |
33-
git diff --name-only HEAD~1 | xargs printf -- '--changed-git-paths %s\n' | xargs ./gradlew writeChangedProjects --output-file-path=modules.json
34-
echo modules=$(cat modules.json) >> $GITHUB_OUTPUT
35-
3612
check_format:
3713
name: "Check Format"
3814
runs-on: ubuntu-22.04
39-
needs:
40-
- determine_changed
41-
strategy:
42-
fail-fast: false
43-
matrix:
44-
module: ${{ fromJSON(needs.determine_changed.outputs.modules) }}
4515

4616
steps:
4717
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
4818
with:
49-
fetch-depth: 2
5019
submodules: true
5120

5221
- name: Set up JDK 17
@@ -56,18 +25,5 @@ jobs:
5625
distribution: temurin
5726
cache: gradle
5827

59-
- name: ${{ matrix.module }} Check Format
60-
run: |
61-
./gradlew ${{matrix.module}}:spotlessCheck
62-
63-
# A job that fails if any job in the check_format matrix fails,
64-
# to be used as a required check for merging.
65-
check_all:
66-
runs-on: ubuntu-22.04
67-
if: always()
68-
name: Check Format (matrix)
69-
needs: check_format
70-
steps:
71-
- name: Check matrix
72-
if: needs.check_format.result != 'success'
73-
run: exit 1
28+
- name: Run Spotless
29+
run: ./gradlew ${{matrix.module}}:spotlessCheck

.github/workflows/ci_tests.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ jobs:
3838
runs-on: ubuntu-22.04
3939
needs:
4040
- determine_changed
41+
if: ${{ needs.determine_changed.outputs.modules != '[]' }}
4142
strategy:
4243
fail-fast: false
4344
matrix:
@@ -89,12 +90,11 @@ jobs:
8990
# to be used as a required check for merging.
9091
check_all:
9192
runs-on: ubuntu-22.04
92-
if: always()
9393
name: Unit Tests (matrix)
9494
needs: unit_tests
95+
if: ${{ failure() }}
9596
steps:
96-
- name: Check test matrix
97-
if: needs.unit_tests.result != 'success'
97+
- name: Check test matrix results
9898
run: exit 1
9999

100100

.github/workflows/dataconnect.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ env:
3434
FDC_JAVA_VERSION: ${{ inputs.javaVersion || '17' }}
3535
FDC_ANDROID_EMULATOR_API_LEVEL: ${{ inputs.androidEmulatorApiLevel || '34' }}
3636
FDC_NODEJS_VERSION: ${{ inputs.nodeJsVersion || '20' }}
37-
FDC_FIREBASE_TOOLS_VERSION: ${{ inputs.firebaseToolsVersion || '14.12.0' }}
37+
FDC_FIREBASE_TOOLS_VERSION: ${{ inputs.firebaseToolsVersion || '14.15.1' }}
3838
FDC_FIREBASE_TOOLS_DIR: /tmp/firebase-tools
3939
FDC_FIREBASE_COMMAND: /tmp/firebase-tools/node_modules/.bin/firebase
4040
FDC_PYTHON_VERSION: ${{ inputs.pythonVersion || '3.13' }}
@@ -134,6 +134,7 @@ jobs:
134134
135135
./gradlew \
136136
--profile \
137+
--warning-mode all \
137138
${{ (inputs.gradleInfoLog && '--info') || '' }} \
138139
:firebase-dataconnect:assembleDebugAndroidTest
139140
@@ -222,7 +223,7 @@ jobs:
222223
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
223224
disable-animations: true
224225
script: |
225-
set -eux && ./gradlew ${{ (inputs.gradleInfoLog && '--info') || '' }} :firebase-dataconnect:connectedCheck :firebase-dataconnect:connectors:connectedCheck
226+
set -eux && ./gradlew --warning-mode all ${{ (inputs.gradleInfoLog && '--info') || '' }} :firebase-dataconnect:connectedCheck :firebase-dataconnect:connectors:connectedCheck
226227
227228
- name: Upload Log Files
228229
uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # v4.6.1

.github/workflows/dataconnect_demo_app.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ on:
1818

1919
env:
2020
FDC_NODE_VERSION: ${{ inputs.nodeVersion || '20' }}
21-
FDC_FIREBASE_TOOLS_VERSION: ${{ inputs.firebaseToolsVersion || '14.12.0' }}
21+
FDC_FIREBASE_TOOLS_VERSION: ${{ inputs.firebaseToolsVersion || '14.15.1' }}
2222
FDC_JAVA_VERSION: ${{ inputs.javaVersion || '17' }}
2323
FDC_FIREBASE_TOOLS_DIR: ${{ github.workspace }}/firebase-tools
2424
FDC_FIREBASE_COMMAND: ${{ github.workspace }}/firebase-tools/node_modules/.bin/firebase
@@ -108,13 +108,15 @@ jobs:
108108
--project-dir firebase-dataconnect/demo \
109109
${{ (inputs.gradleInfoLog && '--info') || '' }} \
110110
--profile \
111+
--warning-mode all \
111112
-PdataConnect.demo.firebaseCommand=${{ env.FDC_FIREBASE_COMMAND }} \
112113
assemble test
113114
114115
- name: gradle dokkaGeneratePublicationHtml
115116
run: |
116117
set -x
117118
firebase-dataconnect/demo/gradlew \
119+
--warning-mode all \
118120
--project-dir firebase-dataconnect/demo \
119121
${{ (inputs.gradleInfoLog && '--info') || '' }} \
120122
dokkaGeneratePublicationHtml
@@ -176,6 +178,7 @@ jobs:
176178
run: |
177179
set -x
178180
firebase-dataconnect/demo/gradlew \
181+
--warning-mode all \
179182
--project-dir firebase-dataconnect/demo \
180183
--no-daemon \
181184
${{ (inputs.gradleInfoLog && '--info') || '' }} \

agents.md

Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
# Agents
2+
3+
This guide provides essential information for working within the `firebase-android-sdk` repository.
4+
5+
## Environment Setup
6+
7+
To work with this repository, the Android SDK must be installed. Use the `sdkmanager` command-line
8+
tool for this purpose.
9+
10+
1. **Install Android SDK Command-Line Tools**:
11+
12+
- If not already installed, download the command-line tools from the
13+
[Android Studio page](https://developer.android.com/studio#command-line-tools-only).
14+
- Create a directory for the Android SDK, e.g., `android_sdk`.
15+
- Unzip the downloaded package. This will create a `cmdline-tools` directory. Move this
16+
directory to `android_sdk/cmdline-tools/latest`.
17+
- The final structure should be `android_sdk/cmdline-tools/latest/`.
18+
19+
2. **Install required SDK packages**:
20+
21+
- Use `sdkmanager` to install the necessary platforms, build tools, and other packages. For
22+
example:
23+
24+
```bash
25+
# List all available packages
26+
sdkmanager --list
27+
28+
# Install platform tools and the SDK for API level 33
29+
sdkmanager "platform-tools" "platforms;android-33"
30+
31+
# Accept all licenses
32+
yes | sdkmanager --licenses
33+
```
34+
35+
- Refer to the specific requirements of the project to determine which packages to install.
36+
37+
3. **Configure for integration tests**:
38+
39+
- To run integration tests, a `google-services.json` file is required.
40+
- Place this file in the root of the repository.
41+
42+
4. **Install NDK for specific projects**:
43+
- Some projects, like `firebase-crashlytics-ndk`, require a specific version of the Android NDK.
44+
You can install it using `sdkmanager`. For example, to install NDK version 21.4.7075529, you
45+
would run `sdkmanager "ndk;21.4.7075529"`. Always refer to the project's `README.md` for the
46+
exact version required.
47+
48+
---
49+
50+
## Testing
51+
52+
This repository uses two main types of tests:
53+
54+
1. **Unit Tests**:
55+
56+
- These tests run on the local JVM.
57+
- To execute unit tests for a specific project, run:
58+
```bash
59+
./gradlew :<firebase-project>:check
60+
```
61+
62+
2. **Integration Tests**:
63+
- These tests run on a hardware device or emulator.
64+
- Ensure a `google-services.json` file is present in the repository root.
65+
- To execute integration tests for a specific project, run:
66+
```bash
67+
./gradlew :<firebase-project>:connectedCheck
68+
```
69+
70+
---
71+
72+
## API Surface
73+
74+
The public API of the Firebase SDKs is managed using a set of annotations:
75+
76+
- `@PublicApi`: Marks APIs that are intended for public consumption by developers.
77+
- `@KeepForSdk`: Marks APIs that are intended for use by other Firebase SDKs. These APIs will
78+
trigger a linter error if used by developers outside of a Firebase package.
79+
- `@Keep`: Marks APIs that need to be preserved at runtime, usually due to reflection. This
80+
annotation should be used sparingly as it prevents Proguard from removing or renaming the code.
81+
82+
---
83+
84+
## Common Patterns
85+
86+
This repository uses a combination of dependency injection frameworks:
87+
88+
- **`firebase-components`**: This is a custom dependency injection framework used for discovery and
89+
dependency injection between different Firebase SDKs. It allows SDKs to register their components
90+
and declare dependencies on other components. The initialization is managed by `FirebaseApp`.
91+
92+
- **Dagger**: Dagger is used for internal dependency injection within individual SDKs. This helps to
93+
create more testable and maintainable code. Dagger components are typically instantiated within
94+
the `ComponentRegistrar` of an SDK, which allows for the injection of dependencies from
95+
`firebase-components` into the Dagger graph.
96+
97+
---
98+
99+
## Iteration Loop
100+
101+
After you make a change, here's the flow you should follow:
102+
103+
- Format the code using `spotless`. It can be run with:
104+
```bash
105+
./gradlew :<firebase-project>:spotlessApply
106+
```
107+
- Run unit tests:
108+
```bash
109+
./gradlew :<firebase-project>:check
110+
```
111+
- If necessary, run integration tests based on the instructions above.
112+
113+
---
114+
115+
## External Dependencies
116+
117+
---
118+
119+
Do not add, under any circunstance, any new dependency to a SDK that does not already exists in the
120+
`gradle/libs.versions.toml`, and even then, only do it if cxexplicitly asked to do so. The Firebase
121+
SDKs are designed to be lightweight, and adding new dependencies can increase the size of the final
122+
artifacts.
123+
124+
---
125+
126+
## Updating this Guide
127+
128+
If new patterns or conventions are discovered, update this guide to ensure it remains a useful
129+
resource.

firebase-ai/CHANGELOG.md

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,23 @@
11
# Unreleased
22

3+
- [feature] Introduced `MissingPermissionsException`, which is thrown when the necessary permissions
4+
have not been granted by the user.
5+
- [feature] Added helper functions to `LiveSession` to allow developers to track the status of the
6+
audio session and the underlying websocket connection.
7+
- [changed] Added new values to `HarmCategory` (#7324)
8+
9+
# 17.2.0
10+
311
- [feature] Added support for returning thought summaries, which are synthesized versions of a
412
model's internal reasoning process.
513
- [fixed] Fixed an issue causing the accessor methods in `GenerateContentResponse` to throw an
614
exception when the response contained no candidates.
715
- [changed] Added better description for requests which fail due to the Gemini API not being
816
configured.
9-
- [changed] Added a `dilation` parameter to `ImagenMaskReference.generateMaskAndPadForOutpainting`
17+
18+
* [changed] Added a `dilation` parameter to `ImagenMaskReference.generateMaskAndPadForOutpainting`
1019
(#7260)
11-
- [feature] Added support for limited-use tokens with Firebase App Check. These short-lived tokens
20+
* [feature] Added support for limited-use tokens with Firebase App Check. These short-lived tokens
1221
provide greater protection for the APIs that give you access to Gemini and Imagen models. Learn
1322
how to [enable usage of limited-use tokens](https://firebase.google.com/docs/ai-logic/app-check).
1423
(#7285)
@@ -19,7 +28,8 @@
1928

2029
- [feature] added support for Imagen Editing, including inpainting, outpainting, control, style
2130
transfer, and subject references (#7075)
22-
- [feature] **Preview:** Added support for bidirectional streaming in Gemini Developer Api
31+
32+
* [feature] **Preview:** Added support for bidirectional streaming in Gemini Developer Api
2333

2434
# 17.0.0
2535

firebase-ai/api.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -531,6 +531,10 @@ package com.google.firebase.ai.type {
531531
field public static final com.google.firebase.ai.type.HarmCategory DANGEROUS_CONTENT;
532532
field public static final com.google.firebase.ai.type.HarmCategory HARASSMENT;
533533
field public static final com.google.firebase.ai.type.HarmCategory HATE_SPEECH;
534+
field public static final com.google.firebase.ai.type.HarmCategory IMAGE_DANGEROUS_CONTENT;
535+
field public static final com.google.firebase.ai.type.HarmCategory IMAGE_HARASSMENT;
536+
field public static final com.google.firebase.ai.type.HarmCategory IMAGE_HATE;
537+
field public static final com.google.firebase.ai.type.HarmCategory IMAGE_SEXUALLY_EXPLICIT;
534538
field public static final com.google.firebase.ai.type.HarmCategory SEXUALLY_EXPLICIT;
535539
field public static final com.google.firebase.ai.type.HarmCategory UNKNOWN;
536540
}
@@ -879,6 +883,8 @@ package com.google.firebase.ai.type {
879883

880884
@com.google.firebase.ai.type.PublicPreviewAPI public final class LiveSession {
881885
method public suspend Object? close(kotlin.coroutines.Continuation<? super kotlin.Unit>);
886+
method public boolean isAudioConversationActive();
887+
method public boolean isClosed();
882888
method public kotlinx.coroutines.flow.Flow<com.google.firebase.ai.type.LiveServerMessage> receive();
883889
method public suspend Object? send(com.google.firebase.ai.type.Content content, kotlin.coroutines.Continuation<? super kotlin.Unit>);
884890
method public suspend Object? send(String text, kotlin.coroutines.Continuation<? super kotlin.Unit>);
@@ -918,6 +924,10 @@ package com.google.firebase.ai.type {
918924
method public static String? asTextOrNull(com.google.firebase.ai.type.Part);
919925
}
920926

927+
public final class PermissionMissingException extends com.google.firebase.ai.type.FirebaseAIException {
928+
ctor public PermissionMissingException(String message, Throwable? cause = null);
929+
}
930+
921931
public final class PromptBlockedException extends com.google.firebase.ai.type.FirebaseAIException {
922932
method public com.google.firebase.ai.type.GenerateContentResponse? getResponse();
923933
property public final com.google.firebase.ai.type.GenerateContentResponse? response;

firebase-ai/gradle.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
version=17.2.0
16-
latestReleasedVersion=17.1.0
15+
version=17.3.0
16+
latestReleasedVersion=17.2.0

0 commit comments

Comments
 (0)