Skip to content

Commit 7e7bd3d

Browse files
committed
Merge tag 'android-15.0.0_r32' of https://android.googlesource.com/platform/build into HEAD
Android 15.0.0 Release 32 (BP1A.250505.005) Change-Id: I42a95ed20738acc34a36098b5429f4f8ebb11b5c
2 parents 569827e + 1cd3439 commit 7e7bd3d

File tree

239 files changed

+8348
-3084
lines changed

Some content is hidden

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

239 files changed

+8348
-3084
lines changed

backported_fixes/Android.bp

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
// Copyright 2024 Google Inc. All rights reserved.
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
package {
16+
default_applicable_licenses: ["Android-Apache-2.0"],
17+
default_team: "trendy_team_android_media_reliability",
18+
}
19+
20+
genrule {
21+
name: "applied_backported_fixes",
22+
tools: ["applied_backported_fixes_main"],
23+
srcs: [":applied_backported_fix_binpbs"],
24+
out: ["applied_backported_fixes.prop"],
25+
cmd: "$(location applied_backported_fixes_main)" +
26+
" -p $(location applied_backported_fixes.prop)" +
27+
" $(in)",
28+
}
29+
30+
java_library {
31+
name: "backported_fixes_proto",
32+
srcs: [
33+
"backported_fixes.proto",
34+
],
35+
host_supported: true,
36+
}
37+
38+
java_library {
39+
name: "backported_fixes_common",
40+
srcs: ["src/java/com/android/build/backportedfixes/common/*.java"],
41+
static_libs: [
42+
"backported_fixes_proto",
43+
"guava",
44+
],
45+
host_supported: true,
46+
}
47+
48+
java_test_host {
49+
name: "backported_fixes_common_test",
50+
srcs: ["tests/java/com/android/build/backportedfixes/common/*.java"],
51+
static_libs: [
52+
"backported_fixes_common",
53+
"backported_fixes_proto",
54+
"junit",
55+
"truth",
56+
"truth-liteproto-extension",
57+
"truth-proto-extension",
58+
],
59+
test_options: {
60+
unit_test: true,
61+
},
62+
test_suites: ["general-tests"],
63+
}
64+
65+
java_library {
66+
name: "applied_backported_fixes_lib",
67+
srcs: ["src/java/com/android/build/backportedfixes/*.java"],
68+
static_libs: [
69+
"backported_fixes_common",
70+
"backported_fixes_proto",
71+
"jcommander",
72+
"guava",
73+
],
74+
host_supported: true,
75+
}
76+
77+
java_binary_host {
78+
name: "applied_backported_fixes_main",
79+
main_class: "com.android.build.backportedfixes.Main",
80+
static_libs: [
81+
"applied_backported_fixes_lib",
82+
],
83+
}
84+
85+
java_test_host {
86+
name: "applied_backported_fixes_test",
87+
srcs: ["tests/java/com/android/build/backportedfixes/*.java"],
88+
static_libs: [
89+
"applied_backported_fixes_lib",
90+
"backported_fixes_proto",
91+
"junit",
92+
"truth",
93+
],
94+
test_options: {
95+
unit_test: true,
96+
},
97+
test_suites: ["general-tests"],
98+
}
99+
100+
gensrcs {
101+
name: "applied_backported_fix_binpbs",
102+
tools: ["aprotoc"],
103+
srcs: [
104+
"applied_fixes/*.txtpb",
105+
],
106+
tool_files: [
107+
"backported_fixes.proto",
108+
],
109+
output_extension: "binpb",
110+
cmd: "$(location aprotoc) " +
111+
" --encode=com.android.build.backportedfixes.BackportedFix" +
112+
" $(location backported_fixes.proto)" +
113+
" < $(in)" +
114+
" > $(out); echo $(out)",
115+
}

backported_fixes/OWNERS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
2+
3+

core/tasks/tools/update_bootloader_radio_image.mk renamed to backported_fixes/applied_fixes/ki350037023.txtpb

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,16 @@
44
# you may not use this file except in compliance with the License.
55
# You may obtain a copy of the License at
66
#
7-
# http:#www.apache.org/licenses/LICENSE-2.0
7+
# http://www.apache.org/licenses/LICENSE-2.0
88
#
99
# Unless required by applicable law or agreed to in writing, software
1010
# distributed under the License is distributed on an "AS IS" BASIS,
1111
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
14+
#
15+
# proto-file: ../backported_fixes.proto
16+
# proto-message: BackportedFix
1417

15-
ifeq ($(USES_DEVICE_GOOGLE_ZUMA),true)
16-
-include vendor/google_devices/zuma/prebuilts/misc_bins/update_bootloader_radio_image.mk
17-
endif
18+
known_issue: 350037023
19+
alias: 1
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
// Copyright (C) 2024 The Android Open Source Project
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
syntax = "proto2";
16+
17+
package com.android.build.backportedfixes;
18+
19+
option java_multiple_files = true;
20+
21+
// A list of backported fixes.
22+
message BackportedFixes {
23+
repeated BackportedFix fixes = 1;
24+
}
25+
26+
// A known issue approved for reporting Build.getBackportedFixStatus
27+
message BackportedFix {
28+
29+
// The issue id from the public bug tracker
30+
// https://issuetracker.google.com/issues/{known_issue}
31+
optional int64 known_issue = 1;
32+
// The alias for the known issue.
33+
// 1 - 1023 are valid aliases
34+
// Must be unique across all backported fixes.
35+
optional int32 alias = 2;
36+
}
37+
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
2+
/*
3+
* Copyright (C) 2024 The Android Open Source Project
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
package com.android.build.backportedfixes;
18+
19+
import static java.nio.charset.StandardCharsets.UTF_8;
20+
21+
import com.android.build.backportedfixes.common.ClosableCollection;
22+
import com.android.build.backportedfixes.common.Parser;
23+
24+
import com.beust.jcommander.JCommander;
25+
import com.beust.jcommander.Parameter;
26+
import com.beust.jcommander.converters.FileConverter;
27+
import com.google.common.io.Files;
28+
29+
import java.io.File;
30+
import java.io.PrintWriter;
31+
import java.io.Writer;
32+
import java.util.Arrays;
33+
import java.util.List;
34+
import java.util.stream.Collectors;
35+
36+
public final class Main {
37+
@Parameter(description = "BackportedFix proto binary files", converter = FileConverter.class,
38+
required = true)
39+
List<File> fixFiles;
40+
@Parameter(description = "The file to write the property value to.",
41+
names = {"--property_file", "-p"}, converter = FileConverter.class, required = true)
42+
File propertyFile;
43+
44+
public static void main(String... argv) throws Exception {
45+
Main main = new Main();
46+
JCommander.newBuilder().addObject(main).build().parse(argv);
47+
main.run();
48+
}
49+
50+
Main() {
51+
}
52+
53+
private void run() throws Exception {
54+
try (var fixStreams = ClosableCollection.wrap(Parser.getFileInputStreams(fixFiles));
55+
var out = Files.newWriter(propertyFile, UTF_8)) {
56+
var fixes = Parser.parseBackportedFixes(fixStreams.getCollection());
57+
writeFixesAsAliasBitSet(fixes, out);
58+
}
59+
}
60+
61+
static void writeFixesAsAliasBitSet(BackportedFixes fixes, Writer out) {
62+
PrintWriter printWriter = new PrintWriter(out);
63+
printWriter.println("# The following backported fixes have been applied");
64+
for (var f : fixes.getFixesList()) {
65+
printWriter.printf("# https://issuetracker.google.com/issues/%d with alias %d",
66+
f.getKnownIssue(), f.getAlias());
67+
printWriter.println();
68+
}
69+
var bsArray = Parser.getBitSetArray(
70+
fixes.getFixesList().stream().mapToInt(BackportedFix::getAlias).toArray());
71+
String bsString = Arrays.stream(bsArray).mapToObj(Long::toString).collect(
72+
Collectors.joining(","));
73+
printWriter.printf("ro.build.backported_fixes.alias_bitset.long_list=%s", bsString);
74+
printWriter.println();
75+
if (printWriter.checkError()) {
76+
throw new RuntimeException("There was an error writing to " + out.toString());
77+
}
78+
}
79+
}
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
/*
2+
* Copyright (C) 2024 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+
* http://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+
package com.android.build.backportedfixes.common;
17+
18+
import com.google.common.collect.ImmutableList;
19+
20+
import java.util.ArrayList;
21+
import java.util.Collection;
22+
23+
/** An AutoCloseable holder for a collection of AutoCloseables. */
24+
public final class ClosableCollection<T extends AutoCloseable, C extends Collection<T>> implements
25+
AutoCloseable {
26+
C source;
27+
28+
/** Makes the collection AutoCloseable. */
29+
public static <T extends AutoCloseable, C extends Collection<T>> ClosableCollection<T, C> wrap(
30+
C source) {
31+
return new ClosableCollection<>(source);
32+
}
33+
34+
private ClosableCollection(C source) {
35+
this.source = source;
36+
}
37+
38+
/** Get the source collection. */
39+
public C getCollection() {
40+
return source;
41+
}
42+
43+
/**
44+
* Closes each item in the collection.
45+
*
46+
* @throws Exception if any close throws an an exception, a new exception is thrown with
47+
* all the exceptions thrown closing the streams added as a suppressed
48+
* exceptions.
49+
*/
50+
@Override
51+
public void close() throws Exception {
52+
var failures = new ArrayList<Exception>();
53+
for (T t : source) {
54+
try {
55+
t.close();
56+
} catch (Exception e) {
57+
failures.add(e);
58+
}
59+
}
60+
if (!failures.isEmpty()) {
61+
Exception e = new Exception(
62+
"%d of %d failed while closing".formatted(failures.size(), source.size()));
63+
failures.forEach(e::addSuppressed);
64+
throw e;
65+
}
66+
}
67+
}
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
/*
2+
* Copyright (C) 2024 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+
* http://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+
package com.android.build.backportedfixes.common;
17+
18+
import com.android.build.backportedfixes.BackportedFix;
19+
import com.android.build.backportedfixes.BackportedFixes;
20+
21+
import com.google.common.collect.ImmutableList;
22+
23+
import java.io.File;
24+
import java.io.FileInputStream;
25+
import java.io.FileNotFoundException;
26+
import java.io.IOException;
27+
import java.io.InputStream;
28+
import java.util.BitSet;
29+
import java.util.List;
30+
31+
32+
/** Static utilities for working with {@link BackportedFixes}. */
33+
public final class Parser {
34+
35+
/** Creates list of FileInputStreams for a list of files. */
36+
public static ImmutableList<FileInputStream> getFileInputStreams(List<File> fixFiles) throws
37+
FileNotFoundException {
38+
var streams = ImmutableList.<FileInputStream>builder();
39+
for (var f : fixFiles) {
40+
streams.add(new FileInputStream(f));
41+
}
42+
return streams.build();
43+
}
44+
45+
/** Converts a list of backported fix aliases into a long array representing a {@link BitSet} */
46+
public static long[] getBitSetArray(int[] aliases) {
47+
BitSet bs = new BitSet();
48+
for (int a : aliases) {
49+
bs.set(a);
50+
}
51+
return bs.toLongArray();
52+
}
53+
54+
/**
55+
* Creates a {@link BackportedFixes} from a list of {@link BackportedFix} binary proto streams.
56+
*/
57+
public static BackportedFixes parseBackportedFixes(List<? extends InputStream> fixStreams)
58+
throws
59+
IOException {
60+
var fixes = BackportedFixes.newBuilder();
61+
for (var s : fixStreams) {
62+
BackportedFix fix = BackportedFix.parseFrom(s);
63+
fixes.addFixes(fix);
64+
s.close();
65+
}
66+
return fixes.build();
67+
}
68+
69+
private Parser() {
70+
}
71+
}

0 commit comments

Comments
 (0)