This also includes some changes to the window manager permission checks. Almost all of these
are to make it most testable (through an exception on a permission failure), though there is
one permission check that needed to be added: updateOrientationFromAppTokens().
Fixes http://b/issue?id=1905863
This is needed to address two security issues with global search:
http://b/issue?id=1871088 (Apps can read content providers through GlobalSearch)
http://b/issue?id=1819627 (Apps can use GlobalSearch to launch arbirtrary intents)
This also fixes http://b/issue?id=1693153 (SearchManager.OnDismissListener
never gets called)
To fix the security issues, GlobalSearch also needs to require
a non-app permission to access its content provider and launch intents.
* changes:
Make the file backup helper not crash if a file you requested can't be stated. This means you don't need to know if the files you are backing up exist or not -- we'll figure it out for you.
Fix SharedPrefsBackupHelper so it doesn't hard code the paths to the files.
The earlier used googlesearch package may not be available in some devices so switching to globalsearch which has searchable info relevant for this unit test.
- Along with ACTION_SEARCH we now enumate ACTION_WEB_SEARCH as well so web search providers are covered in the searchables list. This fixes a broken unit test.
- Moved get/setPreferredWebSearchActivity and get-all-web-search-providers implementation to this module when the searchables list gets updated, so that it happens on boot and on package add/remove events and remains up to date. The duplicate code in WebSearchProvider will be removed in a separate change.
- Also made Searchables broadcast an intent when the searchables list got rebuilt, so components such as GlobalSearch/SuggestionSources no longer need to do this on their own.
Before, the variants of MemoryFile.MemoryInputStream.read() would throw
IOException or IndexOutOfBoundsException if EOF was encountered
before the requested number of bytes was read. This violates
the contract of InputStream.read().
This patch makes read() return the number of bytes available, if any.
If already at EOF, -1 is returned. The patch also adds new tests,
which checks cases where MemoryFile.MemoryInputStream.read()
should throw IndexOutOfBoundsException or return -1. several of these
tests failed with the old code and pass now.
This fixes http://b/issue?id=1881894
This allows content providers to use in-memory data to implement
ContentProvider.openAssetFile(), instead of just normal files
and sockets as before.
To test cross-process use of AssetFileDescriptors for MemoryFiles,
a test content provider and a client for it are added to
AndroidTests.
Fixes http://b/issue?id=1871731
Backups will be handled by launching the application in a special
mode under which no activities or services will be started, only
the BackupAgent subclass named in the app's android:backupAgent
manifest property. This takes the place of the BackupService class
used earlier during development.
In the cases of *full* backup or restore, an application that does
not supply its own BackupAgent will be launched in a restricted
manner; in particular, it will be using the default Application
class rather than any manifest-declared one. This ensures that the
app is not running any code that may try to manipulate its data
while the backup system reads/writes its data set.
Bug 1883998: We only support sending 8-bit references for now.
Bug 1885080: Also fix the GsmAlphabetTest, which started failing when SmsHeader
was re-worked.
As reported in http://b/issue?id=1398215 MemoryFile did not
munmap(2) the ashmem region after closing it. This
causes the process to leak virtual address space.
This change fixes the problem by calling munmap(2) in
close(). The unmapping is done by a helper method deactivate().
The change also replaces the use of an int for the
file descriptor with a FileDescriptor object to
make sure that we keep track of when the file descriptor
has been closed. I chose to implement it this way because I
will need decativate() and a FileDescriptor object in an
upcoming change that allows sending MemoryFile file
descriptors between processes.
The change also adds a number of tests for the behavior
of close(). The testCloseRead() and testCloseWrite() fail
with the old MemoryFile implementation, and testCloseLeak()
causes a segfault. They all pass now.