Skip to content

Commit 5afa4bd

Browse files
committed
Merge remote-tracking branch 'origin/main' into patch-3
2 parents 901e61c + 78744e2 commit 5afa4bd

File tree

116 files changed

+4651
-601
lines changed

Some content is hidden

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

116 files changed

+4651
-601
lines changed

.github/workflows/build_and_test.yml

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,13 @@ jobs:
4040
env:
4141
DEBUG_GOOGLE_SERVICES_JSON_BASE64: ${{ secrets.DEBUG_GOOGLE_SERVICES_JSON_BASE64 }}
4242
run: |
43-
echo $DEBUG_GOOGLE_SERVICES_JSON_BASE64 | base64 --decode > app/google-services.json
43+
if [ -z "$DEBUG_GOOGLE_SERVICES_JSON_BASE64" ]; then
44+
echo "DEBUG_GOOGLE_SERVICES_JSON_BASE64 is empty. Copying test-google-services.json."
45+
cp test-google-services.json app/google-services.json
46+
else
47+
echo "Decoding DEBUG_GOOGLE_SERVICES_JSON_BASE64."
48+
echo $DEBUG_GOOGLE_SERVICES_JSON_BASE64 | base64 --decode > app/google-services.json
49+
fi
4450
4551
- name: Apply Spotless
4652
run: ./gradlew spotlessApply
@@ -127,7 +133,13 @@ jobs:
127133
env:
128134
DEBUG_GOOGLE_SERVICES_JSON_BASE64: ${{ secrets.DEBUG_GOOGLE_SERVICES_JSON_BASE64 }}
129135
run: |
130-
echo $DEBUG_GOOGLE_SERVICES_JSON_BASE64 | base64 --decode > app/google-services.json
136+
if [ -z "$DEBUG_GOOGLE_SERVICES_JSON_BASE64" ]; then
137+
echo "DEBUG_GOOGLE_SERVICES_JSON_BASE64 is empty. Copying test-google-services.json."
138+
cp test-google-services.json app/google-services.json
139+
else
140+
echo "Decoding DEBUG_GOOGLE_SERVICES_JSON_BASE64."
141+
echo $DEBUG_GOOGLE_SERVICES_JSON_BASE64 | base64 --decode > app/google-services.json
142+
fi
131143
132144
- name: Build
133145
run: ./gradlew assembleDebug assembleDebugAndroidTest

CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* @riggaroo @tiwiz

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,11 @@ fontName="Roboto Flex"
4343

4444
For Googlers, get this info from go/androidify-api-setup
4545

46+
## Availability
47+
Due to the background vibe feature using
48+
`gemini-2.0-flash-preview-image-generation`, its not currently supported in a number of countries in Europe, Middle East & Africa.
49+
See [this](https://ai.google.dev/gemini-api/docs/models#gemini-2.0-flash-preview-image-generation) doc for more information.
50+
4651
## Contributing
4752

4853
See [Contributing](CONTRIBUTING.md).

app/build.gradle.kts

Lines changed: 32 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ plugins {
2626
alias(libs.plugins.crashlytics)
2727
alias(libs.plugins.baselineprofile)
2828
id("com.google.android.gms.oss-licenses-plugin")
29+
id("org.spdx.sbom") version "0.9.0"
2930
}
3031

3132
android {
@@ -36,8 +37,8 @@ android {
3637
applicationId = "com.android.developers.androidify"
3738
minSdk = libs.versions.minSdk.get().toInt()
3839
targetSdk = 36
39-
versionCode = 1
40-
versionName = "1.0"
40+
versionCode = 3
41+
versionName = "1.1.1"
4142

4243
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
4344
}
@@ -47,7 +48,9 @@ android {
4748
}
4849

4950
buildTypes {
50-
debug {}
51+
debug {
52+
versionNameSuffix = "-debug"
53+
}
5154
create("benchmark") {
5255
initWith(buildTypes.getByName("release"))
5356
matchingFallbacks += listOf("release")
@@ -61,13 +64,24 @@ android {
6164
getDefaultProguardFile("proguard-android-optimize.txt"),
6265
"proguard-rules.pro",
6366
)
64-
baselineProfile.automaticGenerationDuringBuild = true
67+
baselineProfile.automaticGenerationDuringBuild = false
6568
configure<CrashlyticsExtension> {
6669
mappingFileUploadEnabled = true
6770
}
68-
// To publish on the Play store a private signing key is required, but to allow anyone
69-
// who clones the code to sign and run the release variant, use the debug signing key.
70-
signingConfig = signingConfigs.named("debug").get()
71+
// Conditionally apply signingConfig for release builds
72+
// If the 'CI_BUILD' project property is set to 'true', do not assign a signingConfig.
73+
// Otherwise, (e.g., for local Android Studio builds), sign with the debug key.
74+
if (project.findProperty("CI_BUILD")?.toString()?.toBoolean() == true) {
75+
// For CI builds, we want an unsigned artifact.
76+
// No signingConfig is assigned here.
77+
// The bundleRelease task will produce an unsigned AAB.
78+
println("CI_BUILD property detected. Release build will be unsigned by Gradle.")
79+
} else {
80+
// For local builds (not CI), sign with the debug key to allow easy deployment.
81+
// This ensures you can select the "release" variant in Android Studio and run it.
82+
println("Not a CI_BUILD or CI_BUILD property not set. Signing release build with debug key.")
83+
signingConfig = signingConfigs.getByName("debug")
84+
}
7185
}
7286
}
7387
compileOptions {
@@ -88,6 +102,16 @@ baselineProfile() {
88102
dexLayoutOptimization = true
89103
}
90104

105+
spdxSbom {
106+
targets {
107+
// create a target named "release",
108+
// this is used for the task name (spdxSbomForRelease)
109+
// and output file (release.spdx.json)
110+
create("release") {
111+
configurations.set(listOf("releaseRuntimeClasspath"))
112+
}
113+
}
114+
}
91115
dependencies {
92116
debugImplementation(libs.leakcanary.android)
93117
implementation(libs.androidx.app.startup)
@@ -144,3 +168,4 @@ androidComponents {
144168
variantBuilder.enableAndroidTest = false
145169
}
146170
}
171+

app/proguard-rules.pro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,4 @@
3232

3333
-keepattributes Signature
3434
-keepattributes *Annotation*
35-
-keepattributes InnerClasses
35+
-keepattributes InnerClasses

app/src/main/AndroidManifest.xml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
<?xml version="1.0" encoding="utf-8"?>
2-
<!--
1+
<?xml version="1.0" encoding="utf-8"?><!--
32
Copyright 2025 The Android Open Source Project
43
54
Licensed under the Apache License, Version 2.0 (the "License");
@@ -66,6 +65,7 @@
6665
android:name="com.android.developers.androidify.startup.FirebaseRemoteConfigInitializer"
6766
android:value="@string/androidx_startup" />
6867
</provider>
68+
6969
<activity
7070
android:name=".MainActivity"
7171
android:configChanges="keyboard|keyboardHidden|screenSize|screenLayout"
@@ -87,6 +87,10 @@
8787
<activity
8888
android:name="com.google.android.gms.oss.licenses.OssLicensesActivity"
8989
android:theme="@style/AppCompatAndroidify" />
90+
91+
<meta-data
92+
android:name="com.google.mlkit.vision.DEPENDENCIES"
93+
android:value="subject_segmentation" />
9094
</application>
9195

9296
</manifest>

app/src/main/java/com/android/developers/androidify/MainActivity.kt

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ package com.android.developers.androidify
1717

1818
import android.os.Build
1919
import android.os.Bundle
20-
import android.util.Log
2120
import android.view.WindowManager
2221
import android.window.TrustedPresentationThresholds
2322
import androidx.activity.ComponentActivity
@@ -33,12 +32,16 @@ import com.android.developers.androidify.navigation.MainNavigation
3332
import com.android.developers.androidify.theme.AndroidifyTheme
3433
import com.android.developers.androidify.util.LocalOcclusion
3534
import dagger.hilt.android.AndroidEntryPoint
35+
import java.util.function.Consumer
3636

3737
@ExperimentalMaterial3ExpressiveApi
3838
@AndroidEntryPoint
3939
class MainActivity : ComponentActivity() {
4040

4141
private val isWindowOccluded = mutableStateOf(false)
42+
private val presentationListener = Consumer<Boolean> { isMinFractionRendered ->
43+
isWindowOccluded.value = !isMinFractionRendered
44+
}
4245

4346
override fun onCreate(savedInstanceState: Bundle?) {
4447
super.onCreate(savedInstanceState)
@@ -69,16 +72,26 @@ class MainActivity : ComponentActivity() {
6972
val minFractionRendered = 0.25f
7073
val stabilityRequirements = 500
7174
val presentationThreshold = TrustedPresentationThresholds(
72-
minAlpha, minFractionRendered, stabilityRequirements
75+
minAlpha,
76+
minFractionRendered,
77+
stabilityRequirements,
7378
)
7479

7580
val windowManager = getSystemService(WINDOW_SERVICE) as WindowManager
7681
windowManager.registerTrustedPresentationListener(
7782
window.decorView.windowToken,
7883
presentationThreshold,
79-
mainExecutor
80-
) { isMinFractionRendered -> isWindowOccluded.value = !isMinFractionRendered }
84+
mainExecutor,
85+
presentationListener,
86+
)
8187
}
8288
}
8389

90+
override fun onDetachedFromWindow() {
91+
super.onDetachedFromWindow()
92+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.VANILLA_ICE_CREAM) {
93+
val windowManager = getSystemService(WINDOW_SERVICE) as WindowManager
94+
windowManager.unregisterTrustedPresentationListener(presentationListener)
95+
}
96+
}
8497
}

app/src/main/java/com/android/developers/androidify/navigation/MainNavigation.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ import androidx.compose.animation.scaleOut
2626
import androidx.compose.material3.ExperimentalMaterial3ExpressiveApi
2727
import androidx.compose.material3.MaterialTheme
2828
import androidx.compose.runtime.Composable
29-
import androidx.compose.runtime.MutableState
3029
import androidx.compose.runtime.getValue
3130
import androidx.compose.runtime.mutableStateOf
3231
import androidx.compose.runtime.remember
@@ -121,7 +120,7 @@ fun MainNavigation() {
121120
},
122121
onLicensesClicked = {
123122
context.startActivity(Intent(context, OssLicensesMenuActivity::class.java))
124-
}
123+
},
125124
)
126125
}
127126
},

benchmark/src/main/kotlin/com/android/developers/androidify/baselineprofile/BaselineProfileGenerator.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@ class BaselineProfileGenerator {
4545
) {
4646
uiAutomator {
4747
startApp(packageName = packageName)
48-
onView { textAsString() == "Let's Go" }.click()
49-
onView { textAsString() == "Prompt" }.click()
50-
onView { isEditable }.apply {
48+
onElement { textAsString() == "Let's Go" }.click()
49+
onElement { textAsString() == "Prompt" }.click()
50+
onElement { isEditable }.apply {
5151
click()
5252
text =
5353
"wearing brown sneakers, a red t-shirt, " +

benchmark/src/main/kotlin/com/android/developers/androidify/benchmark/PromptBenchmark.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,9 @@ class PromptBenchmark {
6868
) {
6969
uiAutomator {
7070
startApp(packageName = packageName)
71-
onView { textAsString() == "Let's Go" }.click()
72-
onView { textAsString() == "Prompt" }.click()
73-
onView { isEditable }.apply {
71+
onElement { textAsString() == "Let's Go" }.click()
72+
onElement { textAsString() == "Prompt" }.click()
73+
onElement { isEditable }.apply {
7474
click()
7575
text =
7676
"wearing brown sneakers, a red t-shirt, " +

0 commit comments

Comments
 (0)