Commit Graph

10356 Commits

Author SHA1 Message Date
Kweku Adams
872eecc6a7 Merge "Open up getCloudMediaProvider to mainline modules." into tm-dev 2022-02-23 18:28:44 +00:00
Philip Junker
eefc676fd2 Merge "Deprecate ACQUIRE_CAUSES_WAKEUP flag." into tm-dev 2022-02-23 15:56:07 +00:00
Kweku Adams
fdae3e8060 Open up getCloudMediaProvider to mainline modules.
Bug: 220890919
Test: atest CtsPhotoPickerTest
Change-Id: I2933b622eede53f87baff94da12cc9b3cc532456
2022-02-22 20:08:56 +00:00
Bernardo Rufino
854cd54abd Merge "Add safer Bundle APIs and deprecated old ones" am: c5589d2c92 am: ce09bba3fc am: aed366dc04
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1988908

Change-Id: I684471f938a4400fae3309ad2c9759d808075aea
2022-02-22 14:31:52 +00:00
Bernardo Rufino
ce09bba3fc Merge "Add safer Bundle APIs and deprecated old ones" am: c5589d2c92
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1988908

Change-Id: Iadab8b0106bf99b9c6fbdeca6cc020e1d909ae1a
2022-02-22 13:50:00 +00:00
Bernardo Rufino
486bd1e357 Merge "Add @hide Bundle.getParcelable() with explicit type" am: 58b4c57393
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1988907

Change-Id: I64dcfca33f85e355346b0fe6880ba58413a98308
2022-02-21 13:31:47 +00:00
Philip Junker
1c82568b6c Deprecate ACQUIRE_CAUSES_WAKEUP flag.
Bug: 216114297
Test: javadocs only, no tests were run
Change-Id: Iba8521e47151b84e4a59f32884041ea13f82e36b
2022-02-21 10:10:42 +00:00
Bernardo Rufino
cccb1b78d9 Add safer Bundle APIs and deprecated old ones
Add safer Bundle APIs that take an extra Class<T> argument that checks
that the type about to be deserialized is a child of the type passed in
parameter *before* actually deserializing it, while also deprecating old
APIs.

This allows use to reap the benefits of the new typed Parcel APIs and
enhances security.

Only the APIs that could involve custom object injection are modified.
So, besides the obvious ones that have that design (eg.
readParcelableList()), subtler cases such as readIntegerArrayList()
could result in custom object deserialization, and since it's all
generics, even the casting inside Bundle wouldn't fail, only after the
client unpacked the list items would it blow up. Now those are checked
beforehand.

Since Bundle always calls Parcel.readValue() under the hood (instead of
specialized APIs such as readParcelable() etc), we had to augment that
method (that's used by LazyValue when retrieving the item) to accept
item types now for containers, which I implemented as a vararg of
Class<?> parameters (this is all private/@hide). This way we could
retrieve a list of intents like readValue(.., List.class, Intent.class),
or a map of string to intents like readValue(.., Map.class,
String.class, Intent.class). For non-container items, we can just pass
no arguments for the vararg. This is explained in internal javadocs.

Inside readValue() now, we also check the container types before
calling the internal methods for deserialization. So, if the thing on
the wire is a VAL_MAP and we know the method we're about to call will
return a HashMap, we verify that the type passed in parameter is a super
type of that (if it's non-null, if it's null it means "perform no
check").

Now, LazyValue became a BiFunction<Class<?>, Class<?>[], Object> to
receive those extra "item types" for containers. The reason for
separating the first from the rest is that the first defines the return
type in the new APIs and inside Parcel, so we need the T from Class<T>
to ensure type-safety.

(I was torn here between using BiFunction or just exposing LazyValue as
@hide for Bundle since it feels like we're missing meaning/abstraction,
but end up leaving this way, advise if you'd prefer the other way)

There was a bit of a refactor in Parcel so readValue() could call
internal methods that accepted nullable Class<?> parameters with the
meaning that null = "no verification"  and non-null = "check against
type provided" (because the external APIs all require non-null
parameters).

Now we can return null in all cases when there is a type mismatch. Note
that the Bundle APIs catch ClassCastException to return null, but that
only works for non-generic types (eg. getSizeF()). For generic types
wrapping "return (T) o" with try-catch doesn't work because the type
gets erased to its bound at runtime, so the type mismatch escapes that
try-catch to the caller, potentially causing a crash. Now they happen
inside the getters, as the non-generic ones.

Test: Boots for now
Test: Working on CTS
Test: atest -d android.os.cts.ParcelTest android.os.cts.BundleTest android.os.BundleTest android.os.ParcelTest
CTS-Coverage-Bug: 219980813
Change-Id: Ifcbeb34b4684d7de105756b9d414162a9205ffaa
2022-02-19 14:10:29 +00:00
Wei Wang
43243e35d9 Merge "Add systrace tag for thermal" 2022-02-17 19:27:12 +00:00
Bernardo Rufino
32b2842e07 Add @hide Bundle.getParcelable() with explicit type
Provider a type-safer API getParcelable() that takes a Class<?>
parameter.

Test: Manual (tested downstream)
Bug: 213169612
Bug: 212804042
Bug: 212803946
Bug: 210885162
Merged-In: Ieebc044043e0776e71d35c1cc11be9299f972c45
Change-Id: I76f9558bfa1525877bec15cfc43abdc43cba0f24
2022-02-16 20:16:44 +00:00
Wenhao Wang
31603e398f LogcatManagerService: Update AIDL file
1. add comments
2. add "oneway" modifier.

Bug: 197901557
Test: manually
Ignore-AOSP-First: pending fix for logcat privacy issue
Change-Id: I7a0217d76183ebc7609ab776cc8b8dcc1cd0d2ee
2022-02-16 12:14:51 -08:00
Simon Bowden
1d8030a182 Merge "Update vibrator javadoc formatting." 2022-02-15 22:41:33 +00:00
Sudheer Shanka
cfe627f236 Merge "Cache IAlarmManager binder handle." 2022-02-15 21:39:43 +00:00
TeYuan Wang
3b09ac0c9e Add systrace tag for thermal
Bug: 218939123
Test: python systrace.py thermal -o test.html
Change-Id: Ib77f7364e9c491238116240e84cdde420a6e1a11
Ignore-AOSP-First: conflict in vendor/google_arc, need master first
2022-02-15 15:46:04 +00:00
Simon Bowden
447f56e5e9 Update vibrator javadoc formatting.
After reviewing rendered docs, adding missing paragraph markers
and some small typos, as well as fixing code snippets to be inside a <pre> block. At the
moment, trailing newlines get picked up so it's also necessary to
terminate the code and pre blocks on the actual last line of code.

Test: built docs and manually reviewed site
Change-Id: I327b146eaae20fa3a2e8cf066e211e14cb165c51
2022-02-15 11:56:14 +00:00
Neharika Jali
8c4113ea51 Merge "Clarification to incorporate API review feedback" 2022-02-15 04:07:46 +00:00
Xin Li
a6a261b1be Merge "Merge sc-v2-dev-plus-aosp-without-vendor@8084891" into stage-aosp-master 2022-02-14 17:30:12 +00:00
Neharika Jali
1f65ee7946 Clarification to incorporate API review feedback
Bug: 210990627
Test: manual build succeeds
Change-Id: I62332fb462810050ed5baac3fecd559a4c28165a
2022-02-14 16:44:42 +00:00
Artur Satayev
2dcdd39194 Merge "Use ro.build.version.known_codenames sysprop for KNOWN_CODENAMES." am: 19c5ee8bf1 am: 247988066c am: c8d4c8faf8
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1978331

Change-Id: I1062423fe2b0c8af78e7826c123a7d547704edcd
2022-02-14 12:59:21 +00:00
Artur Satayev
c8d4c8faf8 Merge "Use ro.build.version.known_codenames sysprop for KNOWN_CODENAMES." am: 19c5ee8bf1 am: 247988066c
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1978331

Change-Id: Ifb3aec2d1e7aeb5aa24b6d1bf70ba6cd4fa987ed
2022-02-14 12:43:40 +00:00
Artur Satayev
19c5ee8bf1 Merge "Use ro.build.version.known_codenames sysprop for KNOWN_CODENAMES." 2022-02-14 12:08:04 +00:00
Kweku Adams
7dd1109928 Merge "Exempt backup jobs for media cloud provider." 2022-02-12 01:55:53 +00:00
TreeHugger Robot
92adbe6a25 Merge "Added RemoveResult annotation to RemoveUserWhenPossible call" 2022-02-12 00:05:39 +00:00
Adam Bookatz
aa804f9749 Merge "UserManager.getProfileType hidden API and caching" 2022-02-11 23:58:05 +00:00
Sudheer Shanka
7cbad8a063 Cache IAlarmManager binder handle.
Bug: 218909495
Test: treehugger
Change-Id: Ib73dac85999311993fa9f0d552609065c24a155c
2022-02-11 15:47:24 -08:00
Mayank Garg
362212f8ad Added RemoveResult annotation to RemoveUserWhenPossible call
Bug: 215555912
Test: m
Change-Id: I82dff56942cbc576a1205e09b25fcc26f882b1d7
2022-02-11 22:24:49 +00:00
Bernardo Rufino
1521f59b3b Merge "Safer @hide Bundle.getParcelable() with explicit type" 2022-02-11 18:23:18 +00:00
Kweku Adams
63e99633fd Exempt backup jobs for media cloud provider.
Now that we have an official cloud media provider, exempt backup jobs
for that provider's app instead of the gallery app.

Bug: 218361620
Test: atest CtsPhotoPickerTest
Change-Id: Ic8487cdf7883894d9a4c1d654f779c98edf69cb8
2022-02-11 17:30:18 +00:00
Treehugger Robot
ba790e4807 Merge "Expand javadoc for Build.VERSION.KNOWN_CODENAMES." am: 4ff7b1d723 am: f8e89c239f am: 64d4a8e01a
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1979486

Change-Id: Ide5adfe60c9ce36948e22dea54b83667df55a8e7
2022-02-11 10:17:51 +00:00
Treehugger Robot
64d4a8e01a Merge "Expand javadoc for Build.VERSION.KNOWN_CODENAMES." am: 4ff7b1d723 am: f8e89c239f
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1979486

Change-Id: I6617ac35d6946ed4f1884ba7a6f8c832f96cd4e5
2022-02-11 10:06:42 +00:00
Xin Li
5ad6db7742 Merge sc-v2-dev-plus-aosp-without-vendor@8084891
Bug: 214455710
Merged-In: I8cfa435bb6233818adb9cc99dadeeb06a03443d5
Change-Id: Ib93992d88fd1704179009a3872798b9e7b83a6d1
2022-02-11 07:25:43 +00:00
Wenhao Wang
9bc171544a Merge changes from topic "revert_with_fix"
* changes:
  Temporarily disable user consent check
  Revert "Revert "Revert "Revert "User consent for Logcat data access""""
2022-02-11 01:31:59 +00:00
Adam Bookatz
c9bc9adfd7 UserManager.getProfileType hidden API and caching
Currently we have a few APIs for isXXXProfile. In the case of managed
profiles, we cachce the results.

Here, we introduce a new hidden API getProfileType, which gets and
caches the user type (string), if the user type is a profile. That way,
we automatically have the caching benefits for all profiles, not just
managed profiles.

We only do this for profiles because they have a relaxed permission
requirement. Other user types have strong restrictions, so we do not use
their more general getters here.

Test: atest UserManagerTest
Change-Id: I36b4caead83954518d6fc48860af61f8988f19a9
2022-02-10 13:17:28 -08:00
Alan Viverette
7d1188244c Merge "Migrate frameworks/base javadocs references to androidx" 2022-02-10 18:02:28 +00:00
satayev
c5dafe7ea4 Expand javadoc for Build.VERSION.KNOWN_CODENAMES.
Bug: 211747008
Test: N/A
Change-Id: I030076caae7b76a09a43aa5cd5fdf5671c09a832
2022-02-10 17:11:50 +00:00
Martijn Coenen
de1ab8513a Merge "Supplemental processes don't get external storage." 2022-02-10 14:22:28 +00:00
Nikita Ioffe
ecfb7fbf24 Merge changes from topics "sp-permissions", "sp-pm-uid-apis"
* changes:
  Add Process.toSupplementalUid to @TestApi
  Handle supplemental process uid range for uid-based PM apis
2022-02-10 13:12:17 +00:00
Martijn Coenen
41466ea489 Supplemental processes don't get external storage.
Bug: 217538016
Test: Inspect /storage for supplemental
Change-Id: Ibd29834b0d611a7313890fe06428cd73021ebf4f
2022-02-10 11:04:13 +01:00
Sailendra Bathi
058e30994f Merge "Fix javadoc rendering" 2022-02-10 08:53:54 +00:00
sailendrabathi
6cdf3748ab Fix javadoc rendering
Fixed CDD link rendering in javadoc for
getStorageVolumesIncludingSharedProfiles

Bug: 217627738
Test: Verify the javadoc by opening the generated html pages in browser
Change-Id: Ib5a7e52b44a6b5bc11f17fe3a8e726649c6b70bc
2022-02-10 06:12:29 +00:00
Wenhao Wang
07e705052a Revert "Revert "Revert "Revert "User consent for Logcat data access""""
This reverts commit 761d4a0ccf.

Reason for revert: A fix can solve the issue for which this revert was created

Bug: 196856709
Bug: 218391941
Bug: 218267535
Test: Safetynet test
Test: health/mpts/heavyweight
Ignore-AOSP-First: pending fix for logcat privacy issue

Change-Id: I54222244b2aa6a9f307ed61629608abe12db1e3d
2022-02-09 21:52:15 -08:00
Alan Viverette
406e0f6553 Migrate frameworks/base javadocs references to androidx
Does not remove Support Library artifacts from docs classpath (ApiDocs.bp)
because they are still used in development/samples, which is not as easy
to migrate as javadoc.

Bug: 158779503
Test: make docs
Exempt-From-Owner-Approval: Mass find/replace for androidx migration
Change-Id: Icf7f53ec36a0e970413352e2ebf40ce9d60ed17e
2022-02-09 22:25:14 +00:00
satayev
0a1100e6bc Use ro.build.version.known_codenames sysprop for KNOWN_CODENAMES.
The sysprop is needed to avoid JNI when accessing KNOWN_CODENAMES
from native code.

Bug: 211747008
Test:  atest android.os.cts.BuildTest#testBuildCodenameConstants
Change-Id: I713a122655f5f8a6a2fed5cee61bbe4094acbeb8
2022-02-09 22:07:20 +00:00
Kholoud Mohamed
03c3473c6f Merge "Expose UserManager#isProfile as a public API" 2022-02-09 20:57:54 +00:00
Wenhao Wang
9756d738a0 Merge "Revert "Revert "Revert "User consent for Logcat data access"""" 2022-02-09 18:53:33 +00:00
Bernardo Rufino
0206268a12 Safer @hide Bundle.getParcelable() with explicit type
Provider a safer API getParcelable() that takes a Class<?> parameter
just like the safer Parcel APIs introduced, so we check the type before
deserializing, preventing unexpected and potentially vulnerable code
being executed (technique used in the bugs).

Making it @hide since ASA requested this in T (more details on bugs)
and the urgent usage is inside the platform, we can flesh out a public
API for U.

Test: App code gpaste/6130483466338304 logs gpaste/5148052949041152
Bug: 213169612
Bug: 212804042
Bug: 212803946
Bug: 210885162

Change-Id: Ieebc044043e0776e71d35c1cc11be9299f972c45
2022-02-09 16:04:32 +00:00
kholoud mohamed
e4d4cbd55f Expose UserManager#isProfile as a public API
Test: N/A
Bug: 188410712
Bug: 206106797
Change-Id: Id27a56a69af7abe91f4c61cc31511fc854123704
2022-02-09 12:01:53 +00:00
Dmitri Plotnikov
58fff8488b Remove BatteryStatsHelper and BatterySipper
These classes have been superseded by BatteryUsageStats

Bug: 217618527
Test: presubmit
Change-Id: Ia562365031048ad5b541dd08196e04e53e7cc547
2022-02-09 06:26:59 +00:00
Dmitri Plotnikov
992d488c81 Move mobile stats calculations from BatteryStatsHelper to BatteryStats
Bug: 217618527
Test: adb shell dumpsys batterystats
Test: atest FrameworksCoreTests:BatteryStatsTests
Change-Id: I70a156e96a855655cde97e8b7736db3e672219c7
2022-02-09 06:26:31 +00:00
Dmitri Plotnikov
24e45284df Merge "Convert dumpsys batterystats --checkin and --proto to BatteryUsageStats API" 2022-02-09 06:26:02 +00:00