Add tests for shouldBypass decision based on manifest property.

To improve the performance of bulk file path operations like
creating/deleting 1000 files, we allowed apps which are common to have
such use cases such as apps which hold MANAGE_EXTERNAL_STORAGE
permission or apps with System Gallery role to bypass database
operations.

We added new manifest attribute which provides an option for apps to
optionally skip bypassing database operations.

Added tests to verify that app with MANAGE_EXTERNAL_STORAGE permission
and
1) targeting 31 or higher will not bypass database operations by
default
2) targeting 31 or higher with manifest attribute set will bypass
database operations
3) targeting 30 or below will bypass database operations by default.

Added tests to verify that app with SYSTEM_GALLERY role and
1) targeting 31 or higher will not bypass database operations by
default
2) targeting 31 or higher with manifest attribute set will bypass
database operations
3) targeting 30  will not bypass database operations by default.
4) targeting 30 with manifest attribute set will bypass database
operations

Existing test
testLegacySystemGalleryCanRenameImagesAndVideosWithoutDbUpdates verifies
that app with SYSTEM_GALLERY role and targeting targetSDK<=29 bypasses
database operations.

Bug: 178209446
Test: atest
android.scopedstorage.cts.device.BypassDatabaseOperationsTest

Change-Id: Ic5e76efe1d216dc02c6cd84b0ff86435cd5a58c6
(cherry picked from commit cfeafe56af2249f38473525a7fc1d3c3b5967c29)
2 files changed