Skip to content

Commit b6b6394

Browse files
committed
Merge remote-tracking branch 'upstream/main'
2 parents ac090f8 + 85b333e commit b6b6394

File tree

248 files changed

+3250
-4514
lines changed

Some content is hidden

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

248 files changed

+3250
-4514
lines changed

.github/workflows/build.yml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,21 +42,24 @@ jobs:
4242
- name: Build debug
4343
run: ./gradlew assembleDebug
4444

45-
- name: Run local tests
46-
run: ./gradlew testDebug
45+
# TODO: Temporarily disable unit tests until the infra is fixed
46+
# - name: Run local tests
47+
# run: ./gradlew testDebug
4748

4849
- name: Upload build outputs (APKs)
49-
uses: actions/upload-artifact@v3
50+
uses: actions/upload-artifact@v4
5051
with:
5152
name: build-outputs
5253
path: app/build/outputs
54+
overwrite: true
5355

5456
- name: Upload build reports
5557
if: always()
56-
uses: actions/upload-artifact@v3
58+
uses: actions/upload-artifact@v4
5759
with:
5860
name: build-reports
5961
path: app/build/reports
62+
overwrite: true
6063

6164
androidTest:
6265
needs: build
@@ -112,7 +115,8 @@ jobs:
112115

113116
- name: Upload test reports
114117
if: always()
115-
uses: actions/upload-artifact@v3
118+
uses: actions/upload-artifact@v4
116119
with:
117120
name: test-reports-${{ matrix.api-level }}
118121
path: '*/build/reports/androidTests'
122+
overwrite: true

.idea/kotlinc.xml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@
55
This repository contains a collection of samples that demonstrate the use of different Android OS platform APIs. The samples are organized into folders by topic, and each folder contains a README file that provides more information about the samples in that folder.
66

77
> **Note:** These samples are intended to showcase specific functionality in isolation, and they may use
8-
> simplified code. They are not intended to be used as production-ready code. The project uses the
9-
> [casa-android](https://github.com/google/casa-android) (intended only for demo projects).
8+
> simplified code. They are not intended to be used as production-ready code.
109
> For best practices follow our documentation and check
1110
> [Now In Android](https://github.com/android/nowinandroid)
1211
@@ -22,9 +21,7 @@ Browse the samples inside each topic samples folder:
2221
- [User-interface](https://github.com/android/platform-samples/tree/main/samples/user-interface)
2322
- More to come...
2423

25-
We are constantly adding new samples to this repository. You can find a list of all the available samples [here](https://github.com/android/platform-samples/tree/main/samples/README.md).
26-
27-
> 🚧 **Work-in-Progress:** we are working on bringing more existing and new samples into this format.
24+
We are constantly adding new samples to this repository. You can find a list of all the available samples [here](https://github.com/android/platform-samples/tree/main/samples).
2825

2926
## How to run
3027

@@ -39,17 +36,6 @@ categories and available samples.
3936
> for their functionality, you can simply ignore it. The wiring is done under the hood and an
4037
> implementation detail not needed to understand any sample functionality.
4138
42-
### Deeplink to sample
43-
44-
To open a specific sample directly you can use one of the auto-generated configurations.
45-
46-
1. Build the project at least once
47-
2. Open `Run Configuration` dropdown
48-
3. Select sample name
49-
4. Run
50-
51-
> **Tip:** use `⌃⌥R` or `Alt+Shift+F10` shortcut to open the full list and launch the selected one.
52-
5339
## Reporting Issues
5440

5541
You can report an [issue with a sample](https://github.com/android/platform-samples/issues) using

app/build.gradle.kts

Lines changed: 59 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -13,103 +13,98 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16-
@Suppress("DSL_SCOPE_VIOLATION")
16+
1717
plugins {
1818
alias(libs.plugins.android.application)
1919
alias(libs.plugins.kotlin.android)
20-
alias(libs.plugins.ksp)
21-
alias(libs.plugins.hilt)
22-
id("com.example.platform.convention")
23-
}
24-
25-
java {
26-
toolchain {
27-
languageVersion.set(JavaLanguageVersion.of(17))
28-
}
20+
alias(libs.plugins.kotlin.compose)
21+
kotlin("plugin.serialization") version "2.1.10"
2922
}
3023

3124
android {
32-
namespace = "com.example.platform.app"
25+
namespace = "com.example.platform"
3326
compileSdk = 35
3427

3528
defaultConfig {
36-
applicationId = "com.example.platform.app"
29+
applicationId = "com.example.platform"
3730
minSdk = 21
3831
targetSdk = 35
3932
versionCode = 1
4033
versionName = "1.0"
4134

42-
testInstrumentationRunner = "com.example.platform.app.AppTestRunner"
43-
vectorDrawables {
44-
useSupportLibrary = true
45-
}
35+
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
4636
}
4737

4838
buildTypes {
4939
release {
5040
isMinifyEnabled = false
5141
proguardFiles(
5242
getDefaultProguardFile("proguard-android-optimize.txt"),
53-
"proguard-rules.pro"
43+
"proguard-rules.pro",
5444
)
5545
}
5646
}
57-
5847
compileOptions {
59-
sourceCompatibility = JavaVersion.VERSION_17
60-
targetCompatibility = JavaVersion.VERSION_17
48+
sourceCompatibility = JavaVersion.VERSION_11
49+
targetCompatibility = JavaVersion.VERSION_11
50+
}
51+
kotlinOptions {
52+
jvmTarget = "11"
6153
}
62-
6354
buildFeatures {
6455
compose = true
6556
}
66-
composeOptions {
67-
kotlinCompilerExtensionVersion = libs.versions.composeCompiler.get()
68-
}
69-
packagingOptions {
70-
resources {
71-
excludes += "/META-INF/{AL2.0,LGPL2.1}"
72-
}
73-
}
7457
}
7558

7659
dependencies {
77-
implementation(platform(libs.compose.bom))
78-
implementation(libs.casa.ui)
79-
implementation(libs.androidx.appcompat)
80-
81-
implementation(libs.hilt.android)
82-
ksp(libs.hilt.compiler)
8360

84-
implementation(libs.coil.base)
85-
implementation(libs.coil.video)
61+
implementation(libs.androidx.core.ktx)
62+
implementation(libs.androidx.lifecycle.runtime.ktx)
63+
implementation(libs.androidx.activity.compose)
64+
implementation(platform(libs.androidx.compose.bom))
65+
implementation(libs.androidx.ui)
66+
implementation(libs.androidx.ui.graphics)
67+
implementation(libs.androidx.ui.tooling.preview)
68+
implementation(libs.androidx.material3)
69+
implementation(libs.androidx.navigation.compose)
8670

87-
// include all available samples.
88-
val samples: List<String> by project.extra
89-
samples.forEach {
90-
implementation(project(it))
91-
}
71+
implementation(libs.kotlinx.serialization.json)
72+
implementation(libs.androidx.fragment.compose)
9273

93-
// Testing
94-
kspAndroidTest(libs.hilt.compiler)
95-
androidTestImplementation(platform(libs.compose.bom))
96-
androidTestImplementation(libs.androidx.navigation.testing)
97-
androidTestImplementation(libs.compose.ui.test.manifest)
98-
debugImplementation(libs.compose.ui.test.manifest)
99-
androidTestImplementation(libs.compose.ui.test.junit4)
100-
androidTestImplementation(libs.androidx.test.core)
101-
androidTestImplementation(libs.androidx.test.espresso.core)
102-
androidTestImplementation(libs.androidx.test.rules)
103-
androidTestImplementation(libs.androidx.test.runner)
104-
androidTestImplementation(libs.hilt.testing)
105-
androidTestImplementation(libs.junit4)
106-
}
74+
implementation(project(":shared"))
75+
implementation(project(":samples:accessibility"))
76+
implementation(project(":samples:camera:camera2"))
77+
implementation(project(":samples:connectivity:audio"))
78+
implementation(project(":samples:connectivity:bluetooth:ble"))
79+
implementation(project(":samples:connectivity:bluetooth:companion"))
80+
implementation(project(":samples:connectivity:callnotification"))
81+
implementation(project(":samples:connectivity:telecom"))
82+
implementation(project(":samples:graphics:pdf"))
83+
implementation(project(":samples:graphics:ultrahdr"))
84+
implementation(project(":samples:location"))
85+
implementation(project(":samples:media:ultrahdr"))
86+
implementation(project(":samples:media:video"))
87+
implementation(project(":samples:privacy:data"))
88+
implementation(project(":samples:privacy:permissions"))
89+
implementation(project(":samples:privacy:transparency"))
90+
implementation(project(":samples:storage"))
91+
implementation(project(":samples:user-interface:appwidgets"))
92+
implementation(project(":samples:user-interface:constraintlayout"))
93+
implementation(project(":samples:user-interface:draganddrop"))
94+
implementation(project(":samples:user-interface:haptics"))
95+
implementation(project(":samples:user-interface:picture-in-picture"))
96+
implementation(project(":samples:user-interface:predictiveback"))
97+
implementation(project(":samples:user-interface:quicksettings"))
98+
implementation(project(":samples:user-interface:share"))
99+
implementation(project(":samples:user-interface:text"))
100+
implementation(project(":samples:user-interface:window-insets"))
101+
implementation(project(":samples:user-interface:windowmanager"))
107102

108-
tasks.register("syncSamplesInfo", com.example.platform.plugin.SyncSamplesInfo::class.java) {
109-
projectDir.set(project.rootDir)
110-
}
111-
// Link the assemble task to the sync task.
112-
// TODO: move syncSamplesInfo task here, as this can break isolated projects
113-
afterEvaluate {
114-
tasks.findByName("assembleDebug")?.finalizedBy(tasks.findByName("syncSamplesInfo"))
115-
}
103+
testImplementation(libs.junit)
104+
androidTestImplementation(libs.androidx.junit)
105+
androidTestImplementation(libs.androidx.espresso.core)
106+
androidTestImplementation(platform(libs.androidx.compose.bom))
107+
androidTestImplementation(libs.androidx.ui.test.junit4)
108+
debugImplementation(libs.androidx.ui.tooling)
109+
debugImplementation(libs.androidx.ui.test.manifest)
110+
}

app/src/androidTest/java/com/example/platform/app/AppTestRunner.kt

Lines changed: 0 additions & 31 deletions
This file was deleted.

app/src/androidTest/java/com/example/platform/app/NavigationTest.kt

Lines changed: 0 additions & 90 deletions
This file was deleted.

0 commit comments

Comments
 (0)