210 Commits

Author SHA1 Message Date
Neil Fuller
845146b012 Make NtpTrustedTime safer / expand docs
This commit makes a number of changes:
1) Documents / enforces thread safety, removes or deprecates unsafe
check-then-do methods / adds a way to get the NTP query result
atomically.
2) Delays configuration lookup until point of use: the config can change
due to various possible config overlays, e.g. MCC-based config.

(1) is because the threading model is currently unclear / possibly
unsafe - it looks like NtpTrustedTime is supposed to be single threaded
but it's also a singleton so could be accessed from multiple threads.
If NtpTrustedTime were not a singleton things might be easier but the
@UnsupportedAppUsage makes it difficult to change now.
(2) is to address the same issue as https://r.android.com/1182530,
contributed by Luca Stefani.

Bug: 140712361
Test: build only
Merged-In: Ie09da9db5d853b59829886a020de21a88da5dd51
Change-Id: Ie09da9db5d853b59829886a020de21a88da5dd51
(cherry picked from commit 65f0f31bdee65d1bbe76fcd14a13151a476a51ec)
2020-01-13 16:54:14 +00:00
Colin Cross
1c58fb2928 Merge "Convert frameworks/base/services/robotests to Android.bp" into stage-aosp-master am: 6c074332a9
am: 789419cf51

Change-Id: I678ad1d2b4a0e9c27e522159d31fbdcab6b6eef0
2019-07-24 19:18:31 -07:00
Colin Cross
c65ca26446 Convert frameworks/base/services/robotests to Android.bp
See build/soong/README.md for more information.

Bug: 122332340
Test: m RunFrameworksServicesRoboTests RunBackupFrameworksServicesRoboTests
Change-Id: I3c768074c181a6072c7c1fee4a66faa8b4f5c2f4
2019-07-24 15:14:39 -07:00
nathch
842369a82b DO NOT MERGE Add stop method to backup handler thread.
Currently we call .quit() on the underlying thread which will cause all
messages to stop being processed. This has the side effect that, because
the backup system is a state machine where the state transitions are
messages, the message to transition into a state where the WakeLock is
released may not occur when a user is torn down.

This change adds a stop method we can call instead of .quit() on the
thread which drops any remaining messages and then releases the
WakeLock.

We also wrap the wakelock acquire/release calls to prevent any acquire/release on
the underlying wakelock after a quit. For the acquire, this avoids a non-released
wakelock and for the release, this avoids a runtime exception which can happen
when we release a released wakelock

Test: atest CtsBackupTestCases CtsBackupHostTestCases
Test: m RunBackupFrameworksServicesRoboTests && atest RunBackupFrameworksServicesRoboTests
Test: blaze run -- //experimental/users/nathch/py/bug_repros:repro 136264323 -m acquire_quit  -log DEBUG
Test: blaze run -- //experimental/users/nathch/py/bug_repros:repro 136264323 -m quit_acquire  -log DEBUG
Test: blaze run -- //experimental/users/nathch/py/bug_repros:repro 136264323 -m acquire_quit_release  -log DEBUG
Bug: 136264323

Change-Id: I42dcf997fc44cde05695a563aa19c8e47f6f9f26
2019-07-24 17:46:09 +00:00
Ruslan Tkhakokhov
e0399328c9 Add dumpsys param to dump users running backup service
This is required in CTS tests to know when UserBackupManagerService init is finished.

Bug: 131307343
Test: 1) atest RunBackupFrameworksServicesRoboTests
      2) atest CtsBackupTestCases
      3) atest CtsBackupHostTestCases
      4) atest GtsBackupTestCases
      5) atest GtsBackupHostTestCases

Change-Id: Ia220f32b5be793b3b36efb2985604e29b0015e53
2019-05-10 08:10:47 +00:00
Ruslan Tkhakokhov
451e2d843d Merge "BroadcastReceiver in UserBackupManagerService can crash system_server" into qt-dev 2019-04-17 14:54:46 +00:00
Annie Meng
599e9b3cc2 Fix KeyValueBackupTaskTest shadow errors
Replace IPackageManager with PackageManagerInternal to avoid shadowing
ActivityThread. This shadow is prone to unrelated framework changes breaking
our tests.

Bug: 130540953
Test: 1) atest RunBackupFrameworksServicesRoboTests
2) atest AppBackupUtilsTest

Change-Id: Iea95a37da3df9d3f0887ed5ab30c7007306415a1
2019-04-16 16:00:19 +01:00
Ruslan Tkhakokhov
dd5e5e35b2 BroadcastReceiver in UserBackupManagerService can crash system_server
Make sure mBroadcastReceiver is initialized after its dependencies,
i.e. mTransportManager.

Bug: 130408863
Test: 1) atest RunBackupFrameworksServicesRoboTests
      2) atest CtsBackupTestCases
      3) atest CtsBackupHostTestCases
      4) atest GtsBackupTestCases
      5) atest GtsBackupHostTestCases

Manual test:
1) Before fix: Add Thread.sleep() before mTransportManager is
initialized in constructor and tirgger PACKAGE_CHANGED event. Verify
broadcast receiver callback is triggered and systen_process crashes.
2) After fix: Add Thread.sleep() before mTransportManager is
initialized in constructor and tirgger PACKAGE_CHANGED event. Verify
broadcast receiver callback is not triggered.

Change-Id: If1628628176a08a2d33d020ce270de92b606d6df
2019-04-16 12:14:51 +01:00
Colin Cross
0a2d8cbb26 Convert frameworks/base/cmds/media and bmgr to Android.bp
See build/soong/README.md for more information.

Bug: 122332340
Test: m media
Test: m RunBackupFrameworksServicesRoboTests
Change-Id: Ieb54feb3902bddfd5a571369fbf50161ae646647
2019-03-29 12:41:25 -07:00
Annie Meng
4eb4efc466 API Review: Make dataManagementLabel a CharSequence
Make the data management label a CharSequence for the system APIs:
- BackupManager#updateTransportAttributes
- BackupManager#getDataManagementLabel
- BackupTransport#dataManagementLabel

Renames dataManagementLabel -> dataManagementIntentLabel to change
return type

Removes getDataManagementLabel AIDL method as usages converted to use
"forUser" version in topic CL.

Bug: 113856654
Test: 1) atest RunBackupFrameworksServicesRoboTests
2) atest BackupManagerTransportAttributesHostSideTest
3) atest $(find \
frameworks/base/services/tests/servicestests/src/com/android/server/backup \
-name '*Test.java')
4) Manual: boot and verify transports registered properly using old API;
Modify LocalTransport to use new API, verify success

Change-Id: Ia48017156debe0a29684909f58927fa1fbf972f9
2019-03-20 12:13:10 +00:00
Ruslan Tkhakokhov
507e6f834d API Review: Internal RestoreSession#restorePackages
Bug: 120843781
Test: 1) atest RunBackupFrameworksServicesRoboTests
      2) atest CtsBackupTestCases
      3) atest CtsBackupHostTestCases
      4) atest GtsBackupTestCases
      5) atest GtsBackupHostTestCases

Change-Id: Ice42aedd702e1c16b074d7a00d7b15d8f4aaf733
2019-03-18 12:26:02 +00:00
Annie Meng
36953aa154 Move chunking backup tests to correct test target
Bug: 124311427
Test: atest RunBackupFrameworksServicesRoboTests -> verify moved tests
run;
atest RunFrameworksServicesRoboTests -> verify only location tests run

Change-Id: I9086a97c6ca0e269bbec14ac7e2056f283b0fb51
2019-02-13 10:28:41 +00:00
Bram Bonné
985b1800d4 Renames ChunkListing.java to ChunkListingMap.java.
Bug: 111386661
Test: atest RunBackupFrameworksServicesRoboTests
Change-Id: I94327204ed39b4b4a6138eb6ddd1b28732a16363
2019-02-12 09:29:19 +00:00
Bram Bonné
af4ba04daf Merge "Ports DiffScriptBackupWriter from gmscore to AOSP." 2019-02-07 09:36:51 +00:00
Bram Bonné
02cf411d27 Ports DiffScriptBackupWriter from gmscore to AOSP.
A few additional changes (apart from style and usual dependencies) were
needed:
- Additional dependencies (not part of Backup & Restore code) were
ported over:
	- ByteRange
	- DiffScriptWriter
	- OutputStreamWrapper
	- SingleStreamDiffScriptWriter

- DiffScripBackupWriter.ENCRYPTION_DIFF_SCRIPT_MAX_CHUNK_SIZE_BYTES is
now a constant rather than a flag.
- Additional tests were added for SingleStreamDiffScriptWriter.

Bug: 111386661
Test: atest RunBackupFrameworksServicesRoboTests
Change-Id: Ia3234bb8d665211e6fa91d6a92d190171b0d2dc1
2019-02-06 18:00:30 +01:00
Stefano Tommasini
471a35da6c Create API in BackupManagerService for work profile serial id mapping.
The launcher needs to know the serial id of the ancenstral device's work
profile  and the serial id of the current device's work profile in order
to properly perform a restore.

Test: atest BackupManagerService
Bug: 111301511

Change-Id: Ia929dcc2cb599f935183be1820b1c45f2d6e1de7
2019-02-05 18:16:49 +00:00
Annie Meng
21a91fbbd0 [Multi-user] Schedule full backup jobs immediately
All other schedule call sites for full backup and key value schedule
inline. The operation should be quick and scheduling on a separate
handler makes testing flaky.

Test: 1) atest RunBackupFrameworksServicesRoboTests
2) atest ScheduledBackupHostSideTest
3) atest ProfileScheduledJobHostSideTest
Change-Id: Id6ae557080da5a98c2ac572ca6b4b7973b7a9c29
2019-01-28 19:29:57 +00:00
Ruslan Tkhakokhov
6712b72a48 [Multi-user] Verfiy full backup/restore flow
Bug: 121198030
Test: 1) atest RunBackupFrameworksServicesRoboTests
2) atest $(find \
frameworks/base/services/tests/servicestests/src/com/android/server/backup \
-name '*Test.java')
3) atest CtsBackupTestCases
4) atest CtsBackupHostTestCases
5) atest GtsBackupTestCases
6) atest GtsBackupHostTestCases

Manual testing:
1. Start secondary user -> verify fb-schedule file is created, full backup queue initialised
2. Verify fullbackup of 1 package for system/secondary users, [package] only exists for current user:
  * bmgr --user [user-id] fullbackup [package]
  * Verify in logs that backup is successful
  * Uninstall/install [package]
  * Verify data is restored
3. Verify fullbackup of 1 package for secondary user, [package] eixtst for user 0:
  * bmgr fullbackup [package]
  * bmgr --user [user-id] fullbackup [package]
  * Verify in logs that backup is successful
  * Uninstall/install [package] for secondary user
  * bmgr --user [user-id] restore [token] [package]
  * Verify the data restored is different from system user data and belongs to [user-id]
3. Verify backup of all packages for system/secondary users:
  * bmgr --user [user-id] backupnow --all
  * Verify system packages (android, settings, wallpaper) are skipped for secondary user
  * Verify in logs that backup is successful
  * Uninstall/install [package]
  * Verify data is restored

Base -> Patchset 2: Update method calls to use asUser versions
Patchset 2 -> Patchset 3: Update opComplete callback to accept userId
Patchset 3 -> Patchset 4: Gate system packages from backup/restore for non-system users

Change-Id: Ic3986709ba4d46c0af9da45bb4dd682ee2aef3ce
2019-01-23 15:57:11 +00:00
Annie Meng
53cf520817 [Multi-user] Convert various calls to use user id
Changes various transport, restore and general bookkeeping flows. Also
performs restorecon recursively to relabel child directories properly.

Bug: 121198605
Bug: 121197942
Bug: 121198606
Test: 1) atest RunBackupFrameworksServicesRoboTests
2) user unlocked -> transports registered successfully
3) adb shell bmgr backupnow [package]
4) Cloud restore backup set from 3) -> apps + widgets successful
5) atest BackupManagerTransportAttributesHostSideTest
6) Add secondary user -> check all directories/files relabelled
Change-Id: I26b23fd7bf10b792658fa7c44941be50aee65521
2019-01-16 12:51:12 +00:00
Annie Meng
ca1b5b9f9a Merge "[Multi-user] Convert key-value flow to use user id" 2019-01-14 23:43:16 +00:00
Ruslan Tkhakokhov
1cf011cd76 Merge "[Multi-User] Make JobScheduler logic multi-user aware" 2019-01-14 20:07:14 +00:00
Annie Meng
99c350da2c [Multi-user] Convert key-value flow to use user id
Change paths that key-value backup/restore flow goes through to use
user id.

Bug: 121198605
Bug: 121198606
Test: 1) atest RunBackupFrameworksServicesRoboTests
2) atest $(find \
frameworks/base/services/tests/servicestests/src/com/android/server/backup \
-name '*Test.java')
3) adb shell bmgr backupnow [kv package]
Change-Id: Ie192391561f8e03f623c4d86914b3787ff2c0f88
2019-01-14 18:05:10 +00:00
Ruslan Tkhakokhov
851bdd4571 [Multi-User] Make JobScheduler logic multi-user aware
Patchset 1: Introduce BackupJobIdManager to allocate/recycle IDs for KeyValueBackupJob and
FullBackupJob

Patchset 2: Update KeyValueBackupJob and FullBackupJob to work for multiple users — take in
userId as a parameter and use BackupJobIdManager to assign job IDs

Patchset 3: Update robo tests

The corresponding GTS ScheduledBackupHostSideTest will be updated in a separate CL with the same
topic.

Bug: 121198009
Test: 1) atest KeyValueBackupJobTest
      2) atest KeyValueBackupTaskTest
Change-Id: Ifdba254b7084b3d0a1507cc6512e98399c1aad8f
2019-01-14 17:36:14 +00:00
Chandan Nath
d50bda40d3 Merge "[Multi-user] Transport changes" 2019-01-14 17:04:27 +00:00
Chandan Nath
b407681aec Merge "[Roboelectric] Remove backup tests from framework target" 2019-01-14 16:29:05 +00:00
Chandan Nath
1b99948e6b [Multi-user] Transport changes
Bug: 121197942

Test: 1) atest RunBackupFrameworksServicesRoboTests
2) atest $(find \
frameworks/base/services/tests/servicestests/src/com/android/server/backup \
-name '*Test.java')
3) atest CtsBackupTestCases
4) atest CtsBackupHostTestCases
5) atest GtsBackupTestCases
6) atest GtsBackupHostTestCases

Change-Id: If9c23a7d6b2fc936502d184f585041cf91ad5893
2019-01-14 15:04:24 +00:00
Chandan Nath
242c7b5dcd [Roboelectric] Remove backup tests from framework target
This is the sequal to ag/5779092 where we created a new target RunBackupFrameworksServicesRoboTests
spcifically for backup tests. We had then kept the backup tests in the
original target since we want to push out cl/228790879 first to make
sure our new target was being run in presubmit.

Bug: 120223382

Test: 1) atest RunFrameworksServicesRoboTests (backup + location). out: RunFrameworksServicesRoboTests: OK (33 tests)
2) atest RunBackupFrameworksServicesRoboTests (backup). out: RunBackupFrameworksServicesRoboTests: OK (586 tests)

Change-Id: I2016363d95ce2f2ad1b79aa8afc3b44f973f5cfc
2019-01-11 19:58:23 +00:00
Annie Meng
345ec1b990 Merge "[Multi-user] Make package changes receiver per-user" 2019-01-10 15:56:23 +00:00
Annie Meng
4f98512cc5 [Multi-user] Make package changes receiver per-user
Makes the BroadcastReceiver that receives changes to installed packages
and sdcards tied to a specific user.

Bug: 121198607
Test: 1) atest RunBackupFrameworksServicesRoboTests
2) Manual testing with user 0 and 11:
- User started -> receiver registered for correct user;
- Package changed -> correct receiver;
- Package added -> correct receiver, updates bookkeeping for correct user;
- Package removed -> correct receiver, updates bookkeeping for correct user;

Change-Id: I68c034da6ec775a4d0489a2d09fc32854dcf11dc
2019-01-10 14:25:47 +00:00
Chandan Nath
4a5e370b61 [Multi-user] adb fullbackup: support userId
Bug: 121198030

Test: 1) atest RunBackupFrameworksServicesRoboTests
2) atest $(find \
frameworks/base/services/tests/servicestests/src/com/android/server/backup \
-name '*Test.java')
3) atest CtsBackupTestCases CtsBackupHostTestCases GtsBackupTestCases GtsBackupHostTestCases
4) tested "adb backup -all -obb -apk". confirmed that log contains "obb dir: /storage/emu.." etc. restore of wallpaper worked.

Change-Id: Ic8ff71c5dd949aecc7561a3bac5033e822fcf305
2019-01-09 20:39:26 +00:00
Annie Meng
6e95fc95ce [Multi-user] Clean up backup enabled initialization
Remove indirection in setting backup enabled state to call directly into
the UserBMS instance.

Bug: 121305979
Test: 1) atest RunBackupFrameworksServicesRoboTests
2) During SUW -> backup initializes off;
Turn backup on in SUW -> backup enabled;
Subsequent boots -> backup initializes on
Change-Id: Ief688c4e1c14b443db87eda43ec0ee398282662f
2019-01-07 16:50:24 +00:00
Annie Meng
443143af4b [Multi-user] Change device provisioned to per-user setup complete
Migrate from the global setting DEVICE_PROVISIONED to the per-user
setting USER_SETUP_COMPLETE. The logic for how the service handles
provisioned state is the same, only the setting we use to determine the
state is changed, as well as a rename to reflect this ("provisioned" ->
"setup complete").

ProvisionedObserver is now SetupObserver (move didn't persist b/c of
amount of changes to the file)

The BackupManagerMonitor log event id referencing provisioned will be
changed in a future CL as it requires an API change.

Bug: 121305979
Test: 1) atest RunBackupFrameworksServicesRoboTests
2) Reset device, go through SUW -> not setupComplete;
Finish SUW -> setupComplete (verify logging + dumpsys) and jobs
scheduled;
Perform backup (not blocked by setupComplete);
Add new user -> setupComplete only after finishing SUW

Change-Id: Iddf9ce7853a13b2d51135047de1b270af7034c06
2019-01-07 12:09:24 +00:00
Annie Meng
180e51535c [Multi-user] Make each user have their own backup thread
The original backup thread is now only used by Trampoline and BMS for
general non-user specific operations. Each UserBMS instance has its own
'backup-[user id]' thread to allow for parallelism between users. When a
user is stopped, we quit this thread.

Bug: 121305979
Test: 1) atest RunBackupFrameworksServicesRoboTests
2) Start system user -> verify backup-0 thread created;
Start secondary user -> verify backup-10 thread created;
Stop secondary user -> verify backup-10 thread stopped;
Verify work posted to the thread is executed (register transports, bmgr
backupnow, etc.)

Change-Id: Iaa37fb3e2eb442653e27565ca13a88a0582efa9d
2019-01-04 12:33:29 +00:00
James Lemieux
b7043a96d5 Fix test cases for impending Robolectric merge
ShadowApplication.sendBroadcast(...) has been removed. Tests must call
Context.sendBroadcast(...) just like normal code.

ShadowInstrumentation now correctly models granted permissions by pid
and uid. Tests must configure them both correctly.

Bug: 121048884
Test: make -j56 RunFrameworksServicesRoboTests
Change-Id: Ib4786ddacdfbe6592d8090331eb58495aebb4b55
2018-12-21 14:20:11 -08:00
Annie Meng
71452ce204 [Multi-User] Unregister stopped users in BMS
Adds a handler for system service callbacks when a user is stopped. This
currently only unregisters the user in bookkeeping but will be used in
the future for cleanup work such as cancelling scheduled jobs, etc.

Bug: 120212806
Test: 1) atest RunBackupFrameworksServicesRoboTests
2) atest TrampolineTest
3) Enable multi user + register user -> service started for user; stop
user -> user is unregistered

Change-Id: Ic712da646f961b9bb02c7d77d964a13345eca7ec
2018-12-21 10:07:37 +00:00
Chandan Nath
8cd86f195e [Multi-user] Change Trampoline,BackupManagerService to use userId
Also, a few additional small changes:
1) move getTransportWhitelist from UserBackupManagerService to
BackupManagerService since it doesn't depend on the user
2) remove setBackupProvisioned from BackupManagerService and
UserBackupManagerService since its unused and is a no-op. I'll remove
it from Trampoline and the AIDL in a future CL.

Bug: 120120742

Test: 1) atest RunBackupFrameworksServicesRoboTests
2) atest $(find \
frameworks/base/services/tests/servicestests/src/com/android/server/backup \
-name '*Test.java')
3) atest CtsBackupTestCases
4) atest CtsBackupHostTestCases
5) atest GtsBackupTestCases
6) atest GtsBackupHostTestCases
7) 'adb shell bmgr' enabled/backupnow flow

Change-Id: Iec932dac2ccd6200888e22b35a524a2aec834854
2018-12-19 19:48:13 +00:00
Annie Meng
f55148bfe6 [Multi-user] Store user id in UserBMS
The user id will be used in methods to other system services and passed
to backup/restore subclasses.

Bug: 120212806
Test: atest RunFrameworksServicesRoboTests
Change-Id: I9aca91c3aca30ac0861438e438c4b96bb78e14ed
2018-12-19 10:57:01 +00:00
Chandan Nath
dae228b492 [Roboelectric] Split Robolectric frameworks services targets
1. Move all backup tests from services/robotests/src to services/robotests/backup/src
2. Copied over services/robotests/backup/config/robolectric.properties
3. Copied and modified services/robotests/backup/Android.mk

Bug: 120223382

Test: 1) atest RunFrameworksServicesRoboTests (backup + location). out: RunFrameworksServicesRoboTests: OK (615 tests)
2) atest RunBackupFrameworksServicesRoboTests (backup). out: RunBackupFrameworksServicesRoboTests: OK (582 tests)

Change-Id: I2b0c95b22e90b01f715f772c60c2179b8c0eb29b
2018-12-18 14:39:22 +00:00
Annie Meng
6a93c233fe [Multi-user] Decouple UserBMS and BMS creation
The BMS constructor is now only responsible for setting up the system
service. User registration logic is moved to its own helper that
Trampoline calls during a user unlock callback.

** Logic **
All IBackupManager methods that BMS implements now use bookkeeping to
get the UserBMS instance to act on. Currently the system user instance
is hardcoded in most methods as we don't pass in the user id parameter
(except for a few added in ag/5667585).

If these methods are called on a non-registered user, we log and return
a default value.

** Tests **
Each IBackupManager method now has four corresponding tests:
1) Permission denial test: No INTERACT_ACROSS_USERS_FULL permission +
non-calling user id = security exception (added in ag/5667585, only for
methods that take in an user id param currently).
2) Permission grant test: INTERACT_ACROSS_USERS_FULL permission +
non-calling user id = call forwarded.
3) Registered user test: Passing an user id that has a corresponding
UserBMS instance -> delegate call to that UserBMS instance.
4) Unknown user test: Passing an user id that has no corresponding
UserBMS instance -> no call forwarded.

These tests will be updated when more methods take in an user id param.

Bug: 120212806
Test: 1) atest RunFrameworksServicesRoboTests
2) Unlock system user -> starts service, registers transports
3) adb shell bmgr flows
4) atest TrampolineTest
5) CTS + GTS Backup test cases
6) SUW + Cloud restore; D2D
Change-Id: Ic04f754c75af905ee34c609063c08406e23671d5
2018-12-17 22:00:51 +00:00
Ruslan Tkhakokhov
a2fe6c5bb9 [Multi-user] Add -user param to adb backup/restore
Add an optional parameter -user to provide ID of the user for which to
run backup/restore operation. Add robolectric test to verify the
new parameter is proccessed correctly.

Bug: 119908153
Test: 1) atest BackupTest
      2) atest BackupManagerServiceTest
      3) atest TrampolineTest
      4) atest GtsBackupTestCases
      5) atest GtsBackupHostTestCases
      6) Manual:
        - Run "adb backup -all" and verify that backup is successfull
        - Run "adb restore" and verify that restore is successfull
        - Run "adb backup -all -user 10" and verify that backup faield as
          it's only currently supported for system user
        - Run "adb restore -user 10" and verify that restore failed as it's
          only currently supported for system user

Change-Id: I6dbf9c87eedd5a72da0446beff7d2551f98f2654
2018-12-17 16:48:13 +00:00
TreeHugger Robot
b4815ebf76 Merge "[Multi-user] Change BackupManager AIDL to accept userId in methods" 2018-12-11 18:49:39 +00:00
Chandan Nath
cd44f75895 [Multi-user] Change BackupManager AIDL to accept userId in methods
Bug: 120120742

Test: 1) atest RunFrameworksServicesRoboTests
2) atest $(find \
frameworks/base/services/tests/servicestests/src/com/android/server/backup \
-name '*Test.java')
3) atest CtsBackupTestCases
4) atest CtsBackupHostTestCases
5) atest GtsBackupTestCases
6) atest GtsBackupHostTestCases
7) Toggle Backup/'Backup Now' in Settings
8) 'adb shell bmgr' enabled/backupnow flow

Change-Id: I5dba38f6a24e07947d1b0948f9caefeca011205d
2018-12-11 17:06:30 +00:00
Anil Admal
e016c16c6a Merge "Show location icon when reporting GNSS measurements/status" 2018-12-10 20:31:15 +00:00
Annie Meng
59f6f7fffa [Multi-user] Initialize user state in UserBMS
Move per-user state initialization (directories for bookkeeping data and
transport manager) from BMS to UserBMS.

The UserBMS constructor is now private and callers should use the static
helper to create a new instance. This is primarily for three reasons:
1) Allows for extracting logic out of the constructor into helpers.
2) Allows for performing necessary user-specific setup in the future
such as data migration.
3) Allows for writing unit tests without having setters/getters
exclusively for tests.

Bug: 120212806
Test: 1) atest RunFrameworksServicesRoboTests
2) boot -> unlock user -> service started and verify transports
registered
3) adb shell bmgr backupnow [package] -> writes to /data dir
   adb shell bmgr enable false -> writes to /data dir
4) adb shell bmgr backupnow --all -> writes to /cache dir

Change-Id: If88d95059951dbae0abf691629db1a05d27f743d
2018-12-10 12:43:44 +00:00
Annie Meng
604eb2a838 [Multi-user] Consolidate BMS creation
Part of prep work to create a UserBMS instance per user.

Moves BMS state initialization to the BMS constructor. Most of this
state will then be moved to the UserBMS constructor since it's per-user
state.

Bug: 120212806
Test: 1) atest RunFrameworksServicesRoboTests
2) atest TrampolineTest
3) boot -> unlock user -> create service
4) adb shell bmgr flows

Change-Id: I140c4db3d5c147e3dd09e590eaf15a9f4d8b3da1
2018-12-10 12:43:15 +00:00
TreeHugger Robot
4292d79e92 Merge "Not to use handler thread in GnssGeofenceProvider" 2018-12-08 01:06:19 +00:00
Yu-Han Yang
6dc9f05f3a Not to use handler thread in GnssGeofenceProvider
- Synchronize the calls to native methods with a lock.
- When native calls come back to GnssLocationProvider, make sure to post
tasks on the background thread so the lock is released.

Bug: 116788068
Change-Id: I613c9bb7190ce19100b2bc154e3cda92bf44e2a7
Fixes: 116788068
Test: atest GnssGeofenceProviderTest
2018-12-05 17:56:02 -08:00
Anil Admal
75b9fd6de3 Show location icon when reporting GNSS measurements/status
GNSS measurements and status can be used to compute user location.
Hence, the location icon must be turned on in the status bar to
notify the user every time the measurements are reported to an
application. Also, check for location permission before delivery
as the application may have lost location permission.

Bug: 113332106
Test: Tested it manually using GNSS logger application.
Change-Id: I985610cab207af50a84e7e47390c51359375bb78
2018-12-05 18:15:51 +00:00
Bram Bonné
ae12b3c5a1 Ports the first part of encryption/key to AOSP.
A few additional changes (apart from style and usual dependencies) were needed:
- Dependency on KeyStore was removed (see b/75771701).
- References to internal names were removed or renamed.
- ByteStringUtils is used as a replacement for the Guava bytes-to-hex-string conversions.
- Uses java's Optional rather than Guava's Optional.
- Change to Slog for logging.
- TertiaryKeyRotationTracker.MAX_BACKUPS_UNTIL_TERTIARY_KEY_ROTATION is now a constant rather than a flag.

Bug: 111386661
Test: atest RunFrameworksServicesRoboTests
Change-Id: If9bcfb1f73ba78c278947b8499236bb536e625eb
2018-12-05 16:11:28 +00:00
Annie Meng
384230f9e0 [Multi-user] Rename GlobalBackupManagerService -> BackupManagerService
Restore original naming since UserBackupManagerService is now merged.

Just find and replace, no functionality changes in this CL.

Bug: 118520567
Test: 1) atest RunFrameworksServicesRoboTests
2) atest $(find \
frameworks/base/services/tests/servicestests/src/com/android/server/backup \
-name '*Test.java')
3) adb shell bmgr flows
Change-Id: Ia37997cec93fac9ebb5102edfff9000c9cff4eb1
2018-11-28 12:30:21 +00:00