Skip to content

Commit 3a615d6

Browse files
authored
Merge branch 'main' into system_bar_protection_views
2 parents 44f1ea8 + f9bb817 commit 3a615d6

File tree

3 files changed

+131
-0
lines changed

3 files changed

+131
-0
lines changed
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
/*
2+
* Copyright 2025 The Android Open Source Project
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
@file:Suppress("unused")
18+
19+
package com.example.compose.snippets.stylus
20+
21+
import android.view.MotionEvent
22+
import androidx.compose.foundation.Canvas
23+
import androidx.compose.runtime.Composable
24+
import androidx.compose.ui.ExperimentalComposeUiApi
25+
import androidx.compose.ui.Modifier
26+
import androidx.compose.ui.draw.clipToBounds
27+
import androidx.compose.ui.input.pointer.pointerInteropFilter
28+
import androidx.lifecycle.ViewModel
29+
30+
class UserViewModel : ViewModel() {
31+
fun processMotionEvent(e: MotionEvent): Boolean {
32+
return true
33+
}
34+
}
35+
36+
val viewModel = UserViewModel()
37+
38+
// [START android_compose_stylus_motion_event_access]
39+
@Composable
40+
@OptIn(ExperimentalComposeUiApi::class)
41+
fun DrawArea(modifier: Modifier = Modifier) {
42+
Canvas(
43+
modifier = modifier
44+
.clipToBounds()
45+
.pointerInteropFilter {
46+
viewModel.processMotionEvent(it)
47+
}
48+
49+
) {
50+
// Drawing code here.
51+
}
52+
}
53+
// [END android_compose_stylus_motion_event_access]
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/*
2+
* Copyright 2025 The Android Open Source Project
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
// [START android_identity_assetlinks_json]
18+
[
19+
{
20+
"relation" : [
21+
"delegate_permission/common.handle_all_urls",
22+
"delegate_permission/common.get_login_creds"
23+
],
24+
"target" : {
25+
"namespace" : "android_app",
26+
"package_name" : "com.example.android",
27+
"sha256_cert_fingerprints" : [
28+
SHA_HEX_VALUE
29+
]
30+
}
31+
}
32+
]
33+
// [END android_identity_assetlinks_json]
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
/*
2+
* Copyright 2025 The Android Open Source Project
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
// Enable host to permit Google to retrieve the DAL
18+
// [START android_identity_assetlinks_allow_host]
19+
User-agent: *
20+
Allow: /.well-known/
21+
// [END android_identity_assetlinks_allow_host]
22+
23+
// Manifest file addition
24+
// [START android_identity_assetlinks_manifest]
25+
<meta-data android:name="asset_statements" android:resource="@string/asset_statements" />
26+
// [END android_identity_assetlinks_manifest]
27+
28+
// Declare association in Android app
29+
// [START android_identity_assetlinks_app_association]
30+
<string name="asset_statements" translatable="false">
31+
[{
32+
\"include\": \"https://signin.example.com/.well-known/assetlinks.json\"
33+
}]
34+
</string>
35+
// [END android_identity_assetlinks_app_association]
36+
37+
// Example status code to test DAL
38+
// [START android_identity_assetlinks_curl_check]
39+
> GET /.well-known/assetlinks.json HTTP/1.1
40+
> User-Agent: curl/7.35.0
41+
> Host: signin.example.com
42+
43+
< HTTP/1.1 200 OK
44+
< Content-Type: application/json
45+
// [END android_identity_assetlinks_curl_check]

0 commit comments

Comments
 (0)