Commit Graph

4094 Commits

Author SHA1 Message Date
Jeff Sharkey
0f3f60b576 Fix some issues found by new doclava linter.
Add missing API annotations for permissions and SdkConstants, and
invoke doclava with new "-android" flag.

Test: make -j32 offline-sdk-docs
Bug: 37526420
Change-Id: I970bb2655eb568fd25004636f134c794663a6c33
2017-04-25 13:12:45 -06:00
Jeff Sharkey
30e06bb668 Even more auto-doc work.
Update docs based on what new lint detector found.  Add new @IntDef
to parameters or methods returning constants or flags, and add
@RequiresPermission to methods mentioning permissions.

Test: make -j32 offline-sdk-docs
Bug: 37526420
Change-Id: I7f640f7883fcb66b911a52ae93b83f77306571ec
2017-04-24 13:20:46 -06:00
Jeff Sharkey
910e081216 More auto-doc work.
Add support for AnyThread, CallSuper, and UiThread.

Another related CL started documenting @RequiresPermission, so remove
duplicated information in existing APIs.

Suppress auto-doc on a handful of classes that are already
well-documented.

Test: make -j32 offline-sdk-docs
Bug: 37526420
Change-Id: I791437dccec0f11d5349a23b982ba098cb551af8
2017-04-21 16:35:08 -06:00
Jeff Sharkey
4b32f7c676 Merge "Fix code accounting bugs, track external app data." into oc-dev 2017-04-21 20:01:43 +00:00
Pavel Grafov
ce3e1a3c5f Fix javadoc for some user restrictions.
DISALLOW_UNMUTE_MICROPHONE and DISALLOW_ADJUST_VOLUME can
be set by POs on secondary users as well. But they have no
effect on managed profiles.

(In the bug I erroneously mentionted DISALLOW_UNMUTE_DEVICE
which is @hidden instead of *_MICROPHONE).

Bug: 36024135
Test: IntelliJ quickdoc popup renders correctly.
Change-Id: I7a0e77ac993846cdc3a4ddf4d457e1282872107f
2017-04-21 14:48:21 +01:00
Abodunrinwa Toki
06a53d4729 Merge changes from topics 'smartselectconfig', 'langidconfig' into oc-dev
* changes:
  SmartSelection Config installer.
  LangId Config installer.
2017-04-20 13:30:35 +00:00
Jocelyn Dang
b2aa0ceb0d Merge "Add min and max learned battery capacity to batterystats." into oc-dev 2017-04-20 04:34:14 +00:00
Jocelyn Dang
c627d10650 Add min and max learned battery capacity to batterystats.
BUG: 32645990
Test: manual

Change-Id: I3da569e48571cb86c640aed732abdf6c46a2bc73
2017-04-19 16:19:32 -07:00
Martijn Coenen
932b504865 Validate incoming data properly.
Make sure calls to readBuffer() and readEmbeddedBuffer()
get the correct size, parent and offset passed in, so
these can be validated by libhwbinder.

Modified HwBlob to take a length argument as well,
so it can be validated.

Bug: 30498700
Test: hidl_test, hidl_test_java, Youtube, Maps, Netflix, Camera
Change-Id: I28712db97ae29b46acfe952d3d92d1ce5f666a4d
2017-04-19 15:14:20 -07:00
Abodunrinwa Toki
bb957d12ba SmartSelection Config installer.
Test: none
Bug: 34780396
Change-Id: I9cb04e7b20b565ac5d128475a90bd065c805e95e
2017-04-19 21:39:41 +01:00
Abodunrinwa Toki
51c4203ab4 LangId Config installer.
Test: none
Bug: 34780396
Change-Id: I6cdd608ea9a41041d03640997c076c6e6fea0129
2017-04-19 21:35:07 +01:00
TreeHugger Robot
3a427c3bd9 Merge "Flesh out more API docs." into oc-dev 2017-04-19 20:31:05 +00:00
Jeff Sharkey
60a82cd4c2 Flesh out more API docs.
Flesh out docs for Context.getCacheDir(), Intent.addFlags(),
Intent.removeFlags(), and PackageManager.setApplicationCategoryHint().

Test: builds, boots
Bug: 37470473, 37327774, 35812899
Change-Id: Ided031185258a89c3e275d65c162d537065ad49e
2017-04-19 11:51:21 -06:00
Tao Bao
a532f4d7f8 Merge "RecoverySystem: Enable the package compatibility verification." into oc-dev 2017-04-19 16:30:28 +00:00
Tao Bao
e3872a4fc9 Merge "RecoverySystem: Verify the package compatibility." into oc-dev 2017-04-19 15:54:24 +00:00
Jeff Sharkey
0034788844 Fix code accounting bugs, track external app data.
When counting code size, don't include APKs baked into the system.

Settings already accounts external storage used by apps, so they
need a way to exclude that from the total space used by external
storage; give them new getAppSize() API.

Refine docs to explain that emulated storage might be included in
measured statistics.

Resolve symlinks as part of matching getUuidForPath().

Test: cts-tradefed run commandAndExit cts-dev -m CtsAppSecurityHostTestCases -t android.appsecurity.cts.StorageHostTest
Bug: 35812899, 35844919, 37193650
Change-Id: Iec3ce8b336b71dc98a7d25fdd30fa78e9ee826dc
2017-04-18 21:00:13 -06:00
Tao Bao
87daeb15fd RecoverySystem: Enable the package compatibility verification.
Hook up to android.os.VintfObject.verify().

Bug: 36592877
Test: Flash on marlin; verify with package that has and doesn't have
      compatibility.zip entry.
Change-Id: I4e73fa42f4e3fd2e1c5ffec2ffa6152538d62eee
2017-04-18 15:54:28 -07:00
Tao Bao
e01b520dd4 RecoverySystem: Verify the package compatibility.
This CL extends the existing API RecoverySystem.verifyPackage() to
verify the compatibility entry in an OTA package. It returns true
directly if such an entry doesn't exist. Otherwise it reads and passes
the contents to VintfObject to perform the verification.

This CL also adds a new system API
RecoverySystem.verifyPackageCompatibility() to verify a given
compatibility zip file. It extracts all the entries and passes them to
VintfObject.verify() to verify the package compatibility. This API is
for streaming A/B OTAs only, where we don't download the full package
but only needed entries.

Bug: 36592877
Bug: 36596980
Test: RecoverySystem.verifyPackage() returns the same result for
      packages w/o a compatibility entry.
Change-Id: I038be672868a91820c045d1da100e8e33b23d442
2017-04-17 13:51:02 -07:00
Jeff Sharkey
789a8fc792 Storage API polishing.
Based on API council feedback, switch to using real UUID objects
instead of Strings.  Since UUID is a general-purpose utility class
that will be passed around quite a bit, add it to Parcel and Bundle.

Define well-known namespaced UUID values for "default" and "primary
physical" storage devices, which will let us annotate a bunch of
things with @NonNull.

Define new extras for MANAGE_STORAGE intent that apps can use to
signal where and how much space they'd like the user to free up.

Test: cts-tradefed run commandAndExit cts-dev -m CtsAppSecurityHostTestCases -t android.appsecurity.cts.StorageHostTest
Bug: 37325923, 35812899, 35806020
Change-Id: I8421b126d680f69141a361c1e77223fe2bf4a325
2017-04-17 12:19:50 -06:00
Eugene Susla
cf00adebec API for notification listener for Companioon apps
Test: 1. Trigger the confitrmation dialog.
Ensure it looks exactly like the one from settings.
2. Call an API without associating the appa first
Ensure exception is thrown with a message mentioning the need to associate 1st
Change-Id: I94d4116e1988db869ed445ae3fd018c50590e3f4
2017-04-14 19:01:53 -07:00
Andrew Scull
e52a1bfede Merge "Service for OEM lock management." into oc-dev 2017-04-14 11:31:06 +00:00
TreeHugger Robot
c223d70e64 Merge "Add Java API for libvintf." into oc-dev 2017-04-14 02:02:08 +00:00
Yifan Hong
becc56d7ea Add Java API for libvintf.
android.os.VintfObject has two methods:

- report: return device info that can be reported to OTA server
- verify: verify that metadata for a given OTA package is
          compatible.

Test: pass
Test: adb shell am instrument -w -e class android.os.VintfObjectTest \
com.android.frameworks.coretests/android.support.test.runner.AndroidJUnitRunner

Bug: 36814503

Change-Id: Iff8fae289eec8ae9cfc327d0d0d36a1cdd5e6800
2017-04-13 18:04:05 -07:00
TreeHugger Robot
a8fc7bff5a Merge "Collect background stats: syncs" into oc-dev 2017-04-13 21:20:14 +00:00
Adam Lesinski
af85d84050 Merge "BatteryStats: Remove reading of cpu power" into oc-dev 2017-04-13 20:09:51 +00:00
Bookatz
2bffb5bb3a Collect background stats: syncs
Added background times and counts for an app's sync usage.

Bug: 35669746
Test: runtest -x
frameworks/base/core/tests/coretests/src/com/android/internal/os/BatteryStatsTests.java

Change-Id: I1c01c5044064277b97e8d330386454da3e8204da
2017-04-13 11:59:33 -07:00
TreeHugger Robot
73b54bfd6d Merge "Address API review for ProxyFileDescriptorCallback" into oc-dev 2017-04-13 18:11:48 +00:00
TreeHugger Robot
07d60cce02 Merge "Catch exceptions in Vibrator to maintain compatibility" into oc-dev 2017-04-13 06:48:29 +00:00
Daichi Hirono
e200ae8157 Address API review for ProxyFileDescriptorCallback
The CL revise the documentation for ProxyFileDescriptorCallback.

 * Added explanation to onFsync.
 * Added explanation about offset.
 * Mentioned ErrnoException should contain E constants in OsConstants.

Bug: 35813046
Test: Build succeed
Change-Id: Ied2490b1913445ea8240eb3aaf7c12170ae4e42d
(cherry picked from commit 9555e30288)
2017-04-13 03:40:08 +00:00
Adam Lesinski
d4abd1eeb0 BatteryStats: Remove reading of cpu power
The cpu power reported by the uid_cputime kernel is inaccurate
and has only ever been recorded for dumping to batterystats.
The values have never been used in power blame calculations.

This change removes these power values which just cause noisy
data.

Bug: 36002715
Change-Id: I61bea9992aabb84d099689360fd9377b44b36e2f
Test: run `adb shell dumpsys batterystats`
Test: should not show `p=` for `Total cpu time:` line
2017-04-12 12:25:21 -07:00
Dianne Hackborn
0a0a63c8b1 Merge "Add new "work queue" feature to JobScheduler." into oc-dev 2017-04-12 17:55:56 +00:00
Dianne Hackborn
7da13d7c3e Add new "work queue" feature to JobScheduler.
This gives semantics similar to the start command
queue of services.

The implementation is currently lacking in URI permission
grant handling of the work intents; that will be coming
in a follow-up change.

This includes a first step of adjusting/fixing locking
within JobSchedulerService.  The JobServiceContext class
has a bunch of stuff it does that assumes it doesn't need
locking because it schedules the work on a handler.  However,
to be able to correctly implement the work finish flow (that
takes care of stopping the job when there is no more work),
we can't dispatch these asynchronously so need to get rid of
that and just do explicit locking.

The switch to explicit locking is half-way there (again the
remaining part will be a follow-on CL).  Right now we have
the locking, but still also the handler.  But it turns out
there were a number of things we were doing without a lock
held where we actually should have been holding a lock, so
this is better anyway.

Test: new tests added

Change-Id: Iebd098046209b28e60fd2f4d855d7f91cd3a8b03
2017-04-11 13:57:15 -07:00
Makoto Onuki
cb8936eae9 Expose UserHandle.getIdentifier() to CTS.
This allows CTS to pass user IDs returned by APIs as UserHandle to various
ADB commands.

Test: Exposing as TestApi only; m -j
Change-Id: Iedba6d83b717baacf9e7cf97f1d32f93c191a5ca
2017-04-11 08:42:57 -07:00
TreeHugger Robot
6c171f35be Merge "Log excessive remote callbacks" into oc-dev 2017-04-07 02:58:53 +00:00
TreeHugger Robot
c56d782e13 Merge "Add UPDATE_TZDATA to config updater intents" into oc-dev 2017-04-07 02:28:23 +00:00
Amith Yamasani
18a23f2fd8 Log excessive remote callbacks
Bug: 36778087
Test: N/A
Change-Id: Ifb02fe09e3c0869f7f6c741f886421064e5c1b8a
2017-04-06 16:38:25 -07:00
Joel Fernandes
2d314e15c9 Set android.display thread to top-app cpusets and schedtune group
android.display being in the foreground cpuset group is an issue. As
seen on M/S, during heavily CPU load it is not given core 3 even though
it might be free and causes jank. This patch adds the thread to the
top-app group to ensure it is placed on all cores during scheduling
decisions.

Doing this required a couple of changes:
- new API to set per-thread cpusets
- changes to DisplayManagerService to set the thread to top-app group
- changes to SystemServer to set the policy toward the end, as doing it
  during start of the DisplayManagerService was in issue (issue being
  SystemServer calls setSystemProcess.. -> setProcessGroup which overrides
  the group settings for threads in the system server process, including
  android.display)

Bug: 36631902
Test: Boot and make sure android.display thread is in the top-app group

Change-Id: Icc394ea0ffcf159d11728ad38de114234a29d20f
Signed-off-by: Joel Fernandes <joelaf@google.com>
(cherry picked from commit 474d311cb0)
2017-04-06 21:19:25 +00:00
Chad Brubaker
df9bd4f7b3 Add UPDATE_TZDATA to config updater intents
Change-Id: I5fcd011e0ab030ebf1aa40818a05853117cc6811
Fixes: 36977046
Test: checkbuild
2017-04-06 13:35:23 -07:00
Chad Brubaker
19f98d9707 Expose ConfigUpdater Intents in SystemApi
The Intents are are in the android namespace and should have been
exposed as SystemApi, but were not previously.

Since there are no classes in the framework that reference these Intents
this adds android.os.ConfigUpdate to have them all in one place.

Test: builds
Change-Id: I2086945301f06b28b491ec876652c37e97315e8c
Fixes: 35252508
Fixes: 35266806
Fixes: 35266833
Fixes: 35271111
(cherry picked from commit 987b0fc4a5)
2017-04-06 17:18:13 +00:00
Adam Bookatz
a63e911ad2 Merge "Change wifiScanActualTime csv from usec to msec" into oc-dev 2017-04-05 23:57:00 +00:00
TreeHugger Robot
f68766f666 Merge "Collect background stats: scheduled jobs" into oc-dev 2017-04-05 22:13:10 +00:00
Michael Wright
6a40713e3b Catch exceptions in Vibrator to maintain compatibility
Bug: 36827833
Test: manual
Change-Id: I5ff165c4a1d7ee5c175cf4b50d4899f5e2092b5d
2017-04-05 15:54:25 +01:00
Jeff Sharkey
24403ff054 Just round up the data partition size.
Instead of trying to be clever by poking at underlying flash part
sizes, rely on the fact that device storage printed on retail
packaging is a power-of-two value.

For a typical device with a 23GiB data partition, this will return
a value of "32GB" which matches the retail packaging.

Test: builds, boots
Bug: 34827187
Change-Id: Ib4cf7f637dffc9238252e1fedcd86dc8b5cf656d
2017-04-04 15:10:06 -06:00
Andrew Scull
3b8b46f3a4 Service for OEM lock management.
The new service separates OEM lock management from the implementation.
Currently, a user restriction (DISALLOW_OEM_UNLOCK) and the persistent
data block have been used to implement OEM lock management. In future,
other implemention will be used e.g. a secure element.

The new API also allows for a signature to be passed when changing
whether the device is allowed to be OEM unlocked by the carrier which
can be used for cryptographic protection of the flag.

Bug: 34766843
Test: gts-tradefed run gts -m GtsOemLockServiceTestCases -t com.google.android.oemlock.gts.OemLockServiceTest
Test: cts-tradefed run cts -m CtsPermission2TestCases -t android.permission2.cts.PrivappPermissionsTest
Change-Id: I01660d7605d297f273d43436ca03d64ff611b6cf
2017-04-03 19:10:59 +01:00
Bookatz
aa4594aad2 Collect background stats: scheduled jobs
Added background times and counts for an app's scheduled job usage.
Changes DualTimer to be a subclass of Timer so that background timers
can be easily accessed from the main timer (which is convenient for
jobs, whose ArrayMap of Timers is directly accessed outside of
BatteryStatsImpl).

Bug: 35669746
Test: runtest -x
frameworks/base/core/tests/coretests/src/com/android/internal/os/BatteryStatsTests.java

Change-Id: Ic1d85db34346ebda94ed39f134fc0794a5877815
(cherry picked from commit d253f537a0)
2017-04-03 17:24:40 +00:00
Bookatz
ce49acad10 Change wifiScanActualTime csv from usec to msec
The wifi scan actual time is desired (in the batterystats.proto) to be
in msec instead of usec. It makes more sense to therefore output the
value in msec rather than convert it when it gets read into the proto.

Bug: 35677312
Test: runtest -x
frameworks/base/core/tests/coretests/src/com/android/internal/os/BatteryStatsTests.java

Change-Id: I22fce69b6faecd00f79837369344e04b426a1c33
2017-04-03 09:47:05 -07:00
Jeff Sharkey
dafb17e7eb We really want f_frsize and f_bavail.
It's confusing, but f_bsize is not the value you're looking for; the
real block size is f_frsize.  Fix all those bugs.

Also, the vast majority of clients are interested in the usable
disk space, not including reserved space.

Test: builds, boots
Bug: 36840579
Change-Id: Ib1470389afd49c14cab62282ec1e978ebb2c4791
2017-04-02 23:33:38 -06:00
Dianne Hackborn
a47223f99b Implement issue #36590595: Add ability to associated a ClipData with JobInfo
Yum!

Also needed to have a Context.revokeUriPermission() variant that is sane,
so reasonable CTS tests can be written.

Test: new ClipDataJobTest added.

Change-Id: Ia3135ea788a6e32c971bae7dab3a844d0ef4139c
2017-03-31 10:41:50 -07:00
TreeHugger Robot
bb621fd95c Merge "Update ENSURE_VERIFY_APPS javadoc" into oc-dev 2017-03-30 19:31:23 +00:00
Rubin Xu
9f592dbca3 Update ENSURE_VERIFY_APPS javadoc
Make it clear that now this restriction applies across the whole device,
and is settable by profile owner.

Bug: 31000521
Test: None; just javadoc update
Change-Id: If82d8f4167cf1b77d6e10554f1d96b2d3a2a54a0
2017-03-30 16:47:43 +01:00