Commit Graph

9904 Commits

Author SHA1 Message Date
TreeHugger Robot
49b58654c5 Merge "Revert "Use ArraySet for the list of observer WeakReference."" 2018-07-20 19:21:58 +00:00
Hui Yu
8eeac7d338 Revert "Use ArraySet for the list of observer WeakReference."
This reverts commit 3488f1afcb.

Reason for revert: The change to ArraySet increase system_server startup time by 20ms as reported in b/111658334. It is because add() operation into ArraySet takes much longer than ArrayList. 

Change-Id: I1523332a8c9fc74cfef29b119a3c4c54d55596ec
2018-07-20 17:24:36 +00:00
Jinguang Dong
741d2fa757 Merge "Ensure dropbox could copy tombstone files to special folder." am: 12cdea59d3 am: 3034085dff am: 38c07c31dd
am: 7e49326439

Change-Id: I22b4da6b09985d99de20f6fe4602441d49c40993
2018-07-19 16:50:56 -07:00
Jinguang Dong
7e49326439 Merge "Ensure dropbox could copy tombstone files to special folder." am: 12cdea59d3 am: 3034085dff
am: 38c07c31dd

Change-Id: Id462f492b9a7882c700d090dcfe5eb366f44556f
2018-07-19 16:12:12 -07:00
Jinguang Dong
3034085dff Merge "Ensure dropbox could copy tombstone files to special folder."
am: 12cdea59d3

Change-Id: I8b7f1b2d07629af4cc0008679cd8daf7d1e0464f
2018-07-19 15:52:33 -07:00
Treehugger Robot
12cdea59d3 Merge "Ensure dropbox could copy tombstone files to special folder." 2018-07-19 21:10:43 +00:00
Andreas Gampe
41d4a9b0dd Merge "Frameworks: Let GuardedBy accept multiple locks" am: 940a9e95df am: b32933c3cc am: a48b21a802
am: 02f0c20563

Change-Id: I5c04744e0b53b98a6e8cf7a11d1af43a2ff21593
2018-07-19 12:40:09 -07:00
Andreas Gampe
02f0c20563 Merge "Frameworks: Let GuardedBy accept multiple locks" am: 940a9e95df am: b32933c3cc
am: a48b21a802

Change-Id: I59fd2f34f26a036387e909b6ad9f6c78b6bdc897
2018-07-19 12:27:03 -07:00
Neil Fuller
44b035185c Merge "Use Base64 from android.util in LocalTransport" am: 8b9f98536e am: ec99ee195c
am: a234b4579c

Change-Id: I5b7caa54102f2334e6b15699bb0846c721cd9922
2018-07-19 12:15:37 -07:00
Andreas Gampe
b32933c3cc Merge "Frameworks: Let GuardedBy accept multiple locks"
am: 940a9e95df

Change-Id: Ic74f0c274873d4573bb2ae9a38e91d43df79280d
2018-07-19 11:38:07 -07:00
Treehugger Robot
940a9e95df Merge "Frameworks: Let GuardedBy accept multiple locks" 2018-07-19 17:29:03 +00:00
Jinguang Dong
fe8d2c9a8c Ensure dropbox could copy tombstone files to special folder.
Process of tombstoned have changed the generation flow for
tombstone, and dropbox could not be notified when generating new
tombstone file any more, so dropbox could not copy and compress
tombstone file to /data/system/dropbox. We need to modify
observer events from CLOSE_WRITE to CREATE, and it could
work normally.

Bug: http://b/111608961
Test: 1 After tombstone is triggered, we could see the tombstone
      file in the data/system/dropbox directory.

Signed-off-by: Haoran Li <lihaoran5@huawei.com>

Change-Id: I9d6a31773e4a58658ffab214b1e337f27e9f3ae6
2018-07-19 17:01:53 +00:00
Neil Fuller
ec99ee195c Merge "Use Base64 from android.util in LocalTransport"
am: 8b9f98536e

Change-Id: I8178aea431b41a521346fd40a81ae79a253e5554
2018-07-19 09:58:06 -07:00
Andreas Gampe
7e9236873c Frameworks: Let GuardedBy accept multiple locks
Widen the definition to take advantage of errorprone support.

Bug: 72666911
Test: m
Test: m RUN_ERROR_PRONE=true javac-check
Change-Id: Id792ee70b41b786da717f916e143786fe6308937
2018-07-19 08:12:43 -07:00
TreeHugger Robot
f931eb8fd1 Merge "Support rotation on secondary displays (1/N)" 2018-07-19 14:09:57 +00:00
Hui Yu
3488f1afcb Use ArraySet for the list of observer WeakReference.
On a real device, the mObservers list size can be close to 20k.
Previously mObservers is an ArrayList of strong Reference and there
is memory leak from it. This is why we changed to WeakReference. It
takes 2ms to remove an Reference element from a 20k ArrayList. But It
takes 9ms to remove a WeakReference element from a 20k ArrayList
. This increases chance of ANR. Now we change from ArrayList to
ArraySet, removing a WeakReference element from a 20k ArraySet only
takes 0.1ms. The memory difference between ArrayList and ArraySet is
minimum.

Fix: 111555898
Test: compare time takes to remove WeakReference element from ArrayList
and ArraySet.

Change-Id: If77633549197bcb3cf5269b537288f0189f2fcf3
2018-07-19 00:35:48 +00:00
Bernardo Rufino
cef59b95c9 Use Base64 from android.util in LocalTransport
Stop using bouncycastle as requested in the bug.

Bug: 111440841
Test: 1. Without changes
         a. adb shell bmgr transport android/com.android.internal.backup.LocalTransport
         b. adb shell bmgr backupnow com.android.providers.settings
         c. adb shell ls /cache/backup/1/_delta/<kv_package> #=> Base64 encoded keys
      2. Build and flash this CL
         a. adb shell bmgr restore 1 com.android.providers.settings #=> verify stuff restored
         b. adb shell rm /cache/backup/1/_delta/com.android.providers.settings/* /data/backup/com.android.internal.backup.LocalTransport/com.android.providers.settings
	 c. adb shell bmgr backupnow com.android.providers.settings
	 d. adb shell ls
	 /cache/backup/1/_delta/com.android.providers.settings # Verify same keys as 1c

Merged-In: I305bbae0e0af3639c1d45def19872e6da84624df
Change-Id: I305bbae0e0af3639c1d45def19872e6da84624df
(cherry picked from commit 7a6e032719)
2018-07-18 17:26:24 +01:00
Riddle Hsu
654a6f90b0 Support rotation on secondary displays (1/N)
- Allow to apply rotation animation on non-default display.
- Separate by display:
    Rotation related timeout.
    Pause/resume rotation.
- Able to get/watch non-default display orientation/rotation.

Bug: 111361251
Test: atest FrameworksServicesTests:DisplayContentTests
Test: go/wm-smoke
Change-Id: I9533f1b90b9969d455b6dc235c5318e39f63ab12
2018-07-18 23:48:13 +08:00
TreeHugger Robot
38cfe4e34c Merge "Use Base64 from android.util in LocalTransport" 2018-07-18 11:59:59 +00:00
Sudheer Shanka
7f6857eb80 Merge "Fix potential crash when per-procstate cpu times tracking is turned on." 2018-07-18 05:03:12 +00:00
Hui Yu
b7956e07ad BatteryStatsHistory needs to public for unit test to work.
Otherwise BatteryStatsHistoryTest gets "Illegal class access" error.

Test: atest BatteryStatsHistoryTest.java
Change-Id: I6efc9df24e1fd15cc3cdc4611a65d3e41efa63da
2018-07-17 10:46:34 -07:00
Sudheer Shanka
020239df85 Fix potential crash when per-procstate cpu times tracking is turned on.
When per-procstate cpu times tracking is turned on,
BatteryStatsImpl tries to access mKernelSingleUidTimeReader but
it's possible that mKernelSingleUidTimeReader hasn't been initialized
yet after a reboot and this could lead to a system_server crash.

Bug: 111523951
Test: manual
Change-Id: Id014f23fbe31fed64fba769f14ba4396a003092e
2018-07-17 17:24:06 +00:00
Bernardo Rufino
7a6e032719 Use Base64 from android.util in LocalTransport
Stop using bouncycastle as requested in the bug.

Bug: 111440841
Test: 1. Without changes
         a. adb shell bmgr transport android/com.android.internal.backup.LocalTransport
         b. adb shell bmgr backupnow com.android.providers.settings
         c. adb shell ls /cache/backup/1/_delta/<kv_package> #=> Base64 encoded keys
      2. Build and flash this CL
         a. adb shell bmgr restore 1 com.android.providers.settings #=> verify stuff restored
         b. adb shell rm /cache/backup/1/_delta/com.android.providers.settings/* /data/backup/com.android.internal.backup.LocalTransport/com.android.providers.settings
	 c. adb shell bmgr backupnow com.android.providers.settings
	 d. adb shell ls
	 /cache/backup/1/_delta/com.android.providers.settings # Verify same keys as 1c

Change-Id: I305bbae0e0af3639c1d45def19872e6da84624df
2018-07-17 10:17:43 +01:00
TreeHugger Robot
9c52638f19 Merge "Let LocaleInfo implements Serializable" 2018-07-16 19:04:30 +00:00
Jeff Sharkey
162d771709 Merge "Extend SQLiteQueryBuilder for update and delete." 2018-07-14 21:35:29 +00:00
Hui Yu
0ed84f1263 Better Handling of Battery Stats History Overflow
Previously battery history is kept in the in-memory mHistoryBuffer
with size of 512KB (96KB on low memory device). When the buffer is
close to full we drop certain types of history. When the buffer is
full the whole buffer is reset and we lost elder history. On a
device with long battery life this problem is more frequent.

This CL changes mHistoryBuffer to 128KB (64KB on low memory device).
When the buffer is full, it is saved to history file on file system.
By default we allow 32 history files (64 history files on low-memory
device) which gives us 4MB history (compare to 512KB today).

The MAX_HISTORY_BUFFER and MAX_HISTORY_FILES can be remote configured
through GServices or P/H.

In case of history exceeding 4MB, the oldest history file is deleted
and new history file is open.

This change increases battery history by using disk file and the
chance of losing history is greatly reduced.

Bug: 67297625
Test: adb shell dumpsys batterystats --history
Change-Id: Id9aafea761649d7323b97d1e44135f7880a95414
2018-07-13 17:31:19 -07:00
Jeff Sharkey
6adc98c09c Extend SQLiteQueryBuilder for update and delete.
Developers often accept selection clauses from untrusted code, and
SQLiteQueryBuilder already supports a "strict" mode to help catch
SQL injection attacks.  This change extends the builder to support
update() and delete() calls, so that we can help secure those
selection clauses too.

Extend it to support selection arguments being provided when
appending appendWhere() clauses, meaning developers no longer need
to manually track their local selection arguments along with
remote arguments.

Extend it to support newer ContentProvider.query() variant that
accepts "Bundle queryArgs", and have all query() callers flow
through that common code path.  (This paves the way for a future
CL that will offer to gracefully extract non-WHERE clauses that
callers have tried smashing into their selections.)

Updates ContentValues to internally use more efficient ArrayMap.

Bug: 111268862
Test: atest frameworks/base/core/tests/utiltests/src/com/android/internal/util/ArrayUtilsTest.java
Test: atest cts/tests/tests/database/src/android/database/sqlite/cts/SQLiteQueryBuilderTest.java
Change-Id: I60b6f69045766bb28d2f21a32c120ec8c383b917
2018-07-13 18:11:37 -06:00
tmfang
b2c5ac86ee Let LocaleInfo implements Serializable
Settings need LocaleInfo can be serializabled.
So, it can be passed by Intent.

Bug: 111373939
Test: manual test
Change-Id: Ie42c99583688be6fdcec5dd12b105bee90b2577e
2018-07-13 18:14:12 +08:00
Lucas Dupin
401ea1647a Merge "Dark Notification Shade" 2018-07-13 02:09:31 +00:00
TreeHugger Robot
af93684515 Merge "Fix a few issues with procstats associations:" 2018-07-13 00:56:29 +00:00
Lucas Dupin
f03e752407 Dark Notification Shade
Test: adb shell service call uimode 4 i32 1 # day
Test: adb shell service call uimode 4 i32 2 # night
Bug: 110758454
Change-Id: Ib6fce91d1aeff7e1fbfe8a7a528095487fbdb3f8
2018-07-12 17:30:34 -07:00
Dianne Hackborn
2fd8ce4933 Fix a few issues with procstats associations:
- Use the correct state when comparing the association
  with the process.  (Was causing warning spam as well.)

- Don't wtf if we call startAssociationIfNeeded() no a
  ServiceRecord that doesn't have a process...  that is normal
  when first bringing up a service.

Also add a switch to turn this all off, which for now is
leaving it on.

Test: manual
Bug: 111391911
Bug: 111302807
Bug: 111131998

Change-Id: I2d3f43fd99c7ade24c867ad80a728d898ab0e6c5
2018-07-12 15:45:48 -07:00
Olivier Gaillard
00bfb1b95a Collects binder call stats data through WestWorld.
We require binder calls detailed tracking to be enabled to collect the
stats (in addition to enabling it in WestWorld).

Test: unit test + manual

adb shell cmd stats pull-source 10022
Pull from 10022: { 1531240941000000000 25807560798 (10022)0x10000->0[I]
0x20000->com.android.server.StorageManagerService$3[S]
0x30000->onVolumePathChanged[S] 0x40000->1[L] 0x50000->0[L]
0x60000->18490[L] 0x70000->18490[L] 0x80000->2611[L] 0x90000->2611[L]
0xa0000->0[L]  } ...

Change-Id: I07cad5d8678426cdac45872cda028ea7a85d7d81
2018-07-11 10:44:49 +01:00
Treehugger Robot
62d5e041a2 Merge "Java side setup and access to Binder Proxy Tracking" 2018-07-10 16:24:47 +00:00
Olivier Gaillard
103aae2096 Resolve codes to method names for binder call stats.
Test: unit test

Change-Id: Ie2178e6f9ebb900251d7c9ab20587d3c01acda83
2018-07-10 12:56:08 +01:00
TreeHugger Robot
672763530c Merge "Now track "active time" in procstats." 2018-07-10 01:12:22 +00:00
Dianne Hackborn
95031ef2e6 Now track "active time" in procstats.
Associations now keep track of the time they are
actively involved in impacting their target application.
This is based on the procstate propagating through the
association being the same as the procstate of its target
process...  so it may count as active when there is
another reason for that process to be in the same state.

To do this, we now maintain a set of "tracking
associations" -- these are in-use associations that
we know we need to be tracking to determine whether
they are active.  This list is built based on whether
we at all consider an association during an oom_adj
computation, and at the end of that walked to determine
which of those associations are currently active.

Also add tracking of associations through external
provider references, with a tag name now needing to be
passed through so we can mark up the reason for the
external reference.

Test: manual
Bug: 110957691
Change-Id: I426a499834e20a9d7f2b439faf9cb398d9792fa2
2018-07-09 12:46:53 -07:00
Olivier Gaillard
d2af61a1e8 Merge "Add experiment flag to control binder call stats." 2018-07-09 19:09:47 +00:00
Neil Fuller
f53c7a2ae5 resolve merge conflicts of 7980b19bc8 to stage-aosp-master
am: 3147288c3b

Change-Id: Ie04ef5cd3277271304c3564ee6e41d8c24dee74c
2018-07-06 09:59:52 -07:00
Neil Fuller
3147288c3b resolve merge conflicts of 7980b19bc8 to stage-aosp-master
BUG: None
Test: I solemnly swear I tested this conflict resolution.
Change-Id: Ica0d3578c6e3fcd17b350f63b4acd471774ac014
2018-07-06 16:32:44 +01:00
Olivier Gaillard
d202011c37 Transforms uid to packages for the raw data
Test: manual

Change-Id: I8d6ef245bb42a1f1c058dc43e23e82f2a8b70264
2018-07-06 16:10:44 +01:00
Treehugger Robot
7980b19bc8 Merge "Track changes in libcore to remove a constructor" 2018-07-06 13:58:29 +00:00
Neil Fuller
6e162540ab Merge "Track constructor changes in libcore/" am: f94eb29500 am: 67dcf6da3c
am: 9ca5d6f0a0

Change-Id: I7e7115799180d17e4ad6468e155aed79fc8600cb
2018-07-05 05:34:45 -07:00
Neil Fuller
9ca5d6f0a0 Merge "Track constructor changes in libcore/" am: f94eb29500
am: 67dcf6da3c

Change-Id: I1205219e1fead95ecdb8f9ce5d503ec416baf4c2
2018-07-05 05:25:35 -07:00
Neil Fuller
67dcf6da3c Merge "Track constructor changes in libcore/"
am: f94eb29500

Change-Id: I344d9210bd173f78651318366c852f65afe969d6
2018-07-05 05:14:26 -07:00
Neil Fuller
33e7250f1f Merge "Track changes in libcore to remove a constructor" 2018-07-05 10:27:40 +00:00
Olivier Gaillard
1d7f615eec Add experiment flag to control binder call stats.
For instance, to enabled detailed tracking locally.
adb shell settings put global binder_calls_stats detailed_tracking=true

Also adds the ability to turn off data collection completely and
changing the sampling interval. Uploading data through westworld can
re-use the same flag once implemented.

Test: Unit tested

Change-Id: I808c9902b8124ab643d9b197703d537da040ae3e
2018-07-04 13:36:46 +01:00
Neil Fuller
baae7fa357 Track changes in libcore to remove a constructor
Track changes in libcore to remove a constructor + lint
import order changes. Instead of the constructor a utility
method is introduced.

Test: Build / boot
Bug: 111055375
Merged-In: Id683a9d9d6e27d4c8df623dae189da9e74a6d410
Change-Id: Id683a9d9d6e27d4c8df623dae189da9e74a6d410
2018-07-04 09:11:08 +01:00
Neil Fuller
8a1683f0a2 Track changes in libcore to remove a constructor
Track changes in libcore to remove a constructor + lint
import order changes. Instead of the constructor a utility
method is introduced.

Test: Build / boot
Bug: 111055375
Change-Id: Id683a9d9d6e27d4c8df623dae189da9e74a6d410
2018-07-04 09:10:55 +01:00
TreeHugger Robot
9a8e27a915 Merge "Allow UiAutomation to adopt the shell permission indentity" 2018-07-04 03:00:14 +00:00