summaryrefslogtreecommitdiffstats
path: root/libs/utils
Commit message (Collapse)AuthorAgeFilesLines
* Slight change to the unwinder API.Jeff Brown2013-07-301-2/+2
| | | | Change-Id: I5424de76a21b74842e004e0281936b3f492d3c7a
* BlobCache: implement cache serializationJamie Gennis2013-07-302-2/+302
| | | | | | | This change adds serialization and deserialization functionality to BlobCache, conforming to the Flattenable interface. Change-Id: Ibc99cb1c3d015f363d57d0713eabccec07ff975e
* BlobCache: remove the mutex lockingJamie Gennis2013-07-301-2/+0
| | | | | | | | | | | | This change removes the mutex from the BlobCache class. The caller must be responsible for thread synchronization in order to properly implement the Flattenable interface, which is coming soon. Otherwise would be the potential for the cache contents to change between the call to the getFlattenedSize and flatten methods. Because the caller must do this synchronization anyway there's no reason to also some synchronization inside BlobCache. Change-Id: Ie1f4f6f82b78744f46a41ce863cac0cad276a20e
* Rename (IF_)LOGV(_IF) to (IF_)ALOGV(_IF) DO NOT MERGESteve Block2013-07-3010-69/+69
| | | | | | | See https://android-git.corp.google.com/g/#/c/143865 Bug: 5449033 Change-Id: I0122812ed6ff6f5b59fe4a43ab8bff0577adde0a
* Rename (IF_)LOG() to (IF_)ALOG() DO NOT MERGESteve Block2013-07-302-5/+5
| | | | | | | See https://android-git.corp.google.com/g/#/c/141576 Bug: 5449033 Change-Id: I42575e7c29cf1c0f465c357a5c97ab118df6f473
* Use libcorkscrew for stack unwinding.Jeff Brown2013-07-302-267/+60
| | | | Change-Id: Iee1ee5a2018ab8cfc1ce12ec2a124809245eaa02
* add -ldl to host executablesIliyan Malchev2013-07-301-0/+4
| | | | | | | | This fixes the build on Linux when RefBase is compiled with reference tracking enabled. Change-Id: I3e931e0b463ce836f6fdb30c37068d77144631a3 Signed-off-by: Iliyan Malchev <malchev@google.com>
* Fix regression in CursorWindow.copyStingToBuffer.Jeff Brown2013-07-301-6/+7
| | | | | | Bug: 5332296 Change-Id: Iff9eed786f0a8293b6156f883a66a322ddad5e99
* may fix the buildMathias Agopian2013-07-301-6/+2
| | | | Change-Id: I065b1e6652f0e800ba5674a6d9aa954c3ac6c790
* Fix androidGetThreadPriority for non-pthread configurations.Andreas Huber2013-07-301-0/+4
| | | | | | related-to-build Change-Id: Ic865af0865906f96fd615a56a030c8e3adaf13c4
* A new API "androidGetThreadPriority"Andreas Huber2013-07-301-0/+4
| | | | Change-Id: I6baeead8c70460863343fd557250635fb1e6a170
* Resurrect verbose binder loggingAndy McFadden2013-07-301-1/+3
| | | | | | | | | | | | | | | | | Updated the command name lists, and masked off the additional bits in the command word when doing the name lookup. Made descriptor values easier to grep for and consistent with kernel output (i.e. decimal rather than hex). Attempt to show transaction descriptors as such (they're in a union with a pointer). Also, the writeLines() function in Static was using a no-op logging call to write an iovec. It looks like all callers are using N=1, so I just added a log for the first string. Bug 5155269 Change-Id: I417b8d77da3eb6ee1d2069ba94047210f75738bc
* fix a memory leak and memory corruption in RefBaseMathias Agopian2013-07-301-84/+180
| | | | | | | | | | | | | | | | | we would leak a weakref_impl if a RefBase was never incWeak()'ed. there was also a dangling pointer that would cause memory corruption and double-delete when a custom destroyer was used to delay the execution of ~RefBase. it turns out that the custom destroyer feature caused most of the problems, so it's now gone. The only client was SurfaceFlinger who now handles things on its own. RefBase is essentially back its "gingerbread" state, but the code was slightly cleaned-up. Bug: 5151207, 5084978 Change-Id: Id6ef1d707f96d96366f75068f77b30e0ce2722a5
* Move extract native libraries to JNI codeKenny Root2013-07-302-1/+66
| | | | | | | | | | | | | The built-in ZipFile class was quite a long time to find an unpack libraries. Move everything to using the libutils ZipFileRO class that goes quite a bit faster. Initial measurements are 6 times faster than the Java code. Also, read files off the disk and compare their CRC against the APK's CRC to see if we need to write the new file to disk. This also cuts down the bootup time by up to a second per APK that has native files. Change-Id: Ic464a7969a17368fb6a6b81d026888c4136c7603
* Remove unimplemented memory pool.Jeff Brown2013-07-302-38/+0
| | | | | | dlmalloc does such a great job that we don't need a pool anyways. Change-Id: I105b28c4a5c491543959190c7c0a9de75a5b8052
* Add a call to pthread_attr_destroy to avoid potential memory leaks.Le-Chun Wu2013-07-301-0/+1
| | | | Change-Id: Ib57efc3530e9793298190cc9cab19c9af54e11a7
* Minor code cleanups in vector.Jeff Brown2013-07-301-26/+24
| | | | | | | | | | | | | Fixed a potential bug where calling replaceAt with a reference to an existing element in the vector at the same index would cause the element to be destroyed while being copied to itself. Refactored the conditions in _grow and _shrink for clarity. The computations are exactly the same but I think it reads better this way. In particular, the ssize_t variable 's' is gone: it didn't need to be signed anyways because its value could never be negative. Change-Id: If087841c15e6a87160eee874720c4a77eb0e99a6
* Replace Vector _grow/_shrink checks with assert.Jeff Brown2013-07-301-5/+7
| | | | | | | | | | | | | | | On review of the code, _grow and _shrink are checking for conditions that cannot happen and that don't even really make sense. For example, if _shrink is called with where + amount > mCount then this is really bad, however the check only considered the case when where >= mCount and then it would arbitrarily choose a new value for where. Huh? As it happens, the callers are correctly validating the arguments before passing them down to these methods so we can get rid of this code. Change-Id: I921852dba8997065bb0e9cac733e82028d14afcd
* Compress the backup output streamChristopher Tate2013-07-301-4/+12
| | | | | | | | | | Zlib compression, with a full flush between each application's data. Encryption will be performed on the already-compressed data once that's implemented. On restore, the streamed data is similarly uncompressed on the fly. Change-Id: I19b65c88e759a66527d10913d18fffa9df0bc011
* Remove the simulator target from all makefiles.Jeff Brown2013-07-302-8/+0
| | | | | | Bug: 5010576 Change-Id: I04d722f258951a3078fe07899f5bbe8aac02a8e8
* Fix typo in an assert's logMathias Agopian2013-07-301-2/+2
| | | | Change-Id: I94883a23a0a92eaf3e4976f942f747a2137499ac
* Add C++ thread API androidGetThreadSchedulingGroupGlenn Kasten2013-07-301-0/+35
| | | | | | | This API is intended for applications that need to read a thread's scheduling group, while using the higher-level (C++) family of thread APIs. Change-Id: I5e58017f74c3989b20b5b1cc2bc4483c95720520
* Add a linear transform library to libutilsJason Simmons2013-07-302-0/+263
| | | | Change-Id: Icdec5a6bebd9d8f24b3f335f8ec8b09a5810a774
* Fix settings restoreChristopher Tate2013-07-301-1/+2
| | | | | | | Also correct the debug-mode logging of error locations in backup data. Bug 4914182 Change-Id: Ie7dda0192afa819e42490b7ffd2d3db6f11968f6
* Add Thread::joinGlenn Kasten2013-07-301-0/+19
| | | | | | | | | This new API will be used by applications that previously used the lower-level pthread APIs (including pthread_join). Centralizing on the Thread class instead of pthread will permit additional functionality to be added later in only one location. Change-Id: I8460169ac9c61ac9f85752405ed54c94651058d7
* Thread ID zero for androidSetThreadSchedulingGroupGlenn Kasten2013-07-301-0/+4
| | | | | | Already implemented by androidSetThreadPriority but not documented Change-Id: I85302b17092952065f3f3a4214d8d8abdd465dbd
* Use rand() for MinGWKenny Root2013-07-301-1/+13
| | | | | | | The version of MinGW we use doesn't have nrand48() which is really lame, but we need to use libutils in the Windows SDK. Change-Id: If854c03dbf02bc29e79f49e4539f08c2bf057517
* revert surfaceflinger leak fix as it uncovered a crasher on xoom (DO NOT MERGE)Mathias Agopian2013-07-301-35/+9
| | | | | | This reverts commit 52a43990880b27808bcf562afcc4209d34728e6e. Change-Id: I1856a48f863b051395b8091ddfd1e01292fa1b1e
* Revert "revert surfaceflinger leak fix as it uncovered a crasher on xoom"Mathias Agopian2013-07-301-9/+35
| | | | | | This reverts commit af6edba59e250adbdfa5b3c3be134f70d8c38a16. Change-Id: I7793d3ca8a4d20a2b188364f47854328ab5f586d
* revert surfaceflinger leak fix as it uncovered a crasher on xoomMathias Agopian2013-07-301-35/+9
| | | | | Bug: 4600244 Change-Id: Ia68ebf0f243a051ff6a21b3863e3e5d259bbf7ac
* Bug 4608375Glenn Kasten2013-07-301-2/+9
| | | | | | Update priority and policy together for audio threads Change-Id: Ib3b07b32586c222c4aacbf23414ae8b05db502be
* fix RefBase so it retains binary-compatibility with gingerbread (DO NOT MERGE)Mathias Agopian2013-07-301-9/+25
| | | | | Bug: 4595257 Change-Id: I1db83149107d7dab1f0b7e73c684e0ff82e17e62
* Remove redundant memory barrierGlenn Kasten2013-07-301-8/+5
| | | | | | | | | | | | | | pthread_create already includes the necessary memory barriers: - parent at pthread_create : pthread_mutex_unlock(start_mutex) - child at __thread_entry : pthread_mutex_lock(start_mutex) Add lock around uses of mThread. Added comments: - uses of mThread require lock - androidCreateRawThreadEtc returned ID is not safe for direct use from non-parent threads. Change-Id: I18cb296b41ddaf64cf127b57aab31154319b5970
* Enforce public resource restriction on bag parents.Dianne Hackborn2013-07-301-2/+30
| | | | | | | | Need to put some more styles in the SDK to avoid breaking apps. Also, welcome Android 3.2. Change-Id: Ia31d07c9b1b91ad868d8630437fdc1b5ae24f37d
* Fix handling of directory entriesChristopher Tate2013-07-301-0/+1
| | | | | | | | | | | Don't emit tar blocks for directories with an invalid nonzero size. Also, if such an entry is encountered during restore, don't actually attempt to treat it as valid and thus skip over the next actual tar entry. This patch also adds tracking of the data actually consumed during restore, and reports a total at the end of stream. Change-Id: I625173f76df3c007e899209101ff2b587841f184
* Work on issue #4518815: Compatibility mode introduces compatibility ↵Dianne Hackborn2013-07-301-5/+5
| | | | | | | | | | | | | | | | | | | regression... ...for Market App iRunner There were a lot of serious issues with how we updated (or often didn't update) the display and resource state when switching compatibility mode in conjunction with restarting and updating application components. This addresses everything I could find. Unfortunately it does *not* fix this particular app. I am starting to think this is just an issue in the app. This change does fix a number of other problems I could repro, such as switching the compatibility mode of an IME. Also a few changes here and there to get rid of $#*&^!! debug logs. Change-Id: Ib15572eac9ec93b4b9966ddcbbc830ce9dec1317
* Fix a leak in RefBase (DO NOT MERGE)Mathias Agopian2013-07-301-151/+80
| | | | | | | this bug was introduced recently. it caused RefBase's weakref_impl structure to be leaked for every RefBase object (about 20 bytes). Change-Id: Ia9b155fbfa643ef72cfb8129e96260a3b806a78c
* Fix embedded spaces in tar stream EVEN HARDERChristopher Tate2013-07-301-2/+2
| | | | Change-Id: I97ac586ff3541a05d73e1e53f680517c15e6c662
* Implement shared-storage full backup/restoreChristopher Tate2013-07-301-2/+2
| | | | | | | | | | | | | Every available shared-storage volume is backed up, tagged with its ordinal in the set of mounted shared volumes. This is an approximation of "internal + the external card". This lets us restore things to the same volume [or "equivalent" volume, in the case of a cross-model restore] as they originated on. Also fixed a bug in the handling of files/dirs with spaces in their names. Change-Id: I380019da8d0bb5b3699bd7c11eeff621a88e78c3
* Restore from a previous full backup's tarfileChristopher Tate2013-07-301-0/+10
| | | | | | | | | | | | | | | | | | | Usage: adb restore [tarfilename] Restores app data [and installs the apps if necessary from the backup file] captured in a previous invocation of 'adb backup'. The user must explicitly acknowledge the action on-device before it is allowed to proceed; this prevents any "invisible" pushes of content from the host to the device. Known issues: * The settings databases and wallpaper are saved/restored, but lots of other system state is not yet captured in the full backup. This means that for practical purposes this is usable for 3rd party apps at present but not for full-system cloning/imaging. Change-Id: I0c748b645845e7c9178e30bf142857861a64efd3
* Call RefBase::destroy() when OBJECT_LIFETIME_* is not the defaultMathias Agopian2013-07-301-2/+4
| | | | Change-Id: Ifb2069e095dba57b7d97e9f2d942fd85fa975f58
* RefBase subclasses can now decide how they want to be destroyed.Mathias Agopian2013-07-301-1/+5
| | | | | | | This adds a destroy() virtual on RefBase which sublasses can implement. destroy() is called in lieu of the destructor whenthe last strong ref goes away.
* Add new "-swNNNdp" resource qualifier.Dianne Hackborn2013-07-301-3/+10
| | | | Change-Id: I0101e88ca9d8d44138bdcaf571f24b0352f4f6ce
* Continue idmap generation even if name lookup fails.Mårten Kongstad2013-07-301-1/+2
| | | | | | | | | | In resources.arsc files, a resource is represented by a specification block and one or more value blocks. In rare cases, a resource name is also given a new resource ID, a specification block and no values blocks. This commit ensures idmap generation does not fail if such an entry is encountered. Change-Id: I32302a0b07a7a320b7eeb31886931be3bb7b7e9a
* libutils: add a binary blob cache implementation.Jamie Gennis2013-07-304-0/+491
| | | | | | | This change adds an implementation of a cache that stores key/value pairs of unstructured binary blobs. Change-Id: Idd01fdabedfa3aed6d359a6efb0592967af52651
* Full backup tweaksChristopher Tate2013-07-301-12/+20
| | | | | | | | * provide placeholder UI showing backup/restore start/stop/timeout * don't kill the progress UI in mid stream * tidy up the pax extended header data writing a little Change-Id: Ife0cb78e3facb541d8327f1d5ca5fe77faa6cbca
* Use pax extended tar format to support long filenames etc.Christopher Tate2013-07-301-41/+116
| | | | | | | | | | 'tar' supports only 100-character paths; 'ustar' supports only 155+100 character prefix + paths; neither supports files larger than about 8 gigabytes. We now use the POSIX.1-2001 'pax' extended tar format for those files in the backup stream that are too large or have too-long paths for the 'ustar' format. Change-Id: I2f256823091deaec9b1ccea685d2344753c6cb67
* Full local backup infrastructureChristopher Tate2013-07-302-2/+192
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is the basic infrastructure for pulling a full(*) backup of the device's data over an adb(**) connection to the local device. The basic process consists of these interacting pieces: 1. The framework's BackupManagerService, which coordinates the collection of app data and routing to the destination. 2. A new framework-provided BackupAgent implementation called FullBackupAgent, which is instantiated in the target applications' processes in turn, and knows how to emit a datastream that contains all of the app's saved data files. 3. A new shell-level program called "bu" that is used to bridge from adb to the framework's Backup Manager. 4. adb itself, which now knows how to use 'bu' to kick off a backup operation and pull the resulting data stream to the desktop host. 5. A system-provided application that verifies with the user that an attempted backup/restore operation is in fact expected and to be allowed. The full agent implementation is not used during normal operation of the delta-based app-customized remote backup process. Instead it's used during user-confirmed *full* backup of applications and all their data to a local destination, e.g. via the adb connection. The output format is 'tar'. This makes it very easy for the end user to examine the resulting dataset, e.g. for purpose of extracting files for debug purposes; as well as making it easy to contemplate adding things like a direct gzip stage to the data pipeline during backup/restore. It also makes it convenient to construct and maintain synthetic backup datasets for testing purposes. Within the tar format, certain artificial conventions are used. All files are stored within top-level directories according to their semantic origin: apps/pkgname/a/ : Application .apk file itself apps/pkgname/obb/: The application's associated .obb containers apps/pkgname/f/ : The subtree rooted at the getFilesDir() location apps/pkgname/db/ : The subtree rooted at the getDatabasePath() parent apps/pkgname/sp/ : The subtree rooted at the getSharedPrefsFile() parent apps/pkgname/r/ : Files stored relative to the root of the app's file tree apps/pkgname/c/ : Reserved for the app's getCacheDir() tree; not stored. For each package, the first entry in the tar stream is a file called "_manifest", nominally rooted at apps/pkgname. This file contains some metadata about the package whose data is stored in the archive. The contents of shared storage can optionally be included in the tar stream. It is placed in the synthetic location: shared/... uid/gid are ignored; app uids are assigned at install time, and the app's data is handled from within its own execution environment, so will automatically have the app's correct uid. Forward-locked .apk files are never backed up. System-partition .apk files are not backed up unless they have been overridden by a post-factory upgrade, in which case the current .apk *is* backed up -- i.e. the .apk that matches the on-disk data. The manifest preceding each application's portion of the tar stream provides version numbers and signature blocks for version checking, as well as an indication of whether the restore logic should expect to install the .apk before extracting the data. System packages can designate their own full backup agents. This is to manage things like the settings provider which (a) cannot be shut down on the fly in order to do a clean snapshot of their file trees, and (b) manage data that is not only irrelevant but actively hostile to non-identical devices -- CDMA telephony settings would seriously mess up a GSM device if emplaced there blind, for example. When a full backup or restore is initiated from adb, the system will present a confirmation UI that the user must explicitly respond to within a short [~ 30 seconds] timeout. This is to avoid the possibility of malicious desktop-side software secretly grabbing a copy of all the user's data for nefarious purposes. (*) The backup is not strictly a full mirror. In particular, the settings database is not cloned; it is handled the same way that it is in cloud backup/restore. This is because some settings are actively destructive if cloned onto a different (or especially a different-model) device: telephony settings and AndroidID are good examples of this. (**) On the framework side it doesn't care that it's adb; it just sends the tar stream to a file descriptor. This can easily be retargeted around whatever transport we might decide to use in the future. KNOWN ISSUES: * the security UI is desperately ugly; no proper designs have yet been done for it * restore is not yet implemented * shared storage backup is not yet implemented * symlinks aren't yet handled, though some infrastructure for dealing with them has been put in place. Change-Id: Ia8347611e23b398af36ea22c36dff0a276b1ce91
* Add missing clean-up of idmap file descriptors.Mårten Kongstad2013-07-301-0/+3
| | | | Change-Id: I9bdc9a4b7962f1a8dce77f4b213c8b9dc26e4b0f
* libutils: Fix an improper const-cast in RefBaseJosh Stone2013-07-301-1/+1
| | | | | | | | | | | | | | | | Under Fedora 15 Beta, gcc 4.6.0 warns: frameworks/base/libs/utils/RefBase.cpp: In member function ‘void android::RefBase::weakref_type::trackMe(bool, bool)’: frameworks/base/libs/utils/RefBase.cpp:483:67: error: passing ‘const android::RefBase::weakref_impl’ as ‘this’ argument of ‘void android::RefBase::weakref_impl::trackMe(bool, bool)’ discards qualifiers [-fpermissive] trackMe is not a const function, so don't use const in the static_cast to a weakref_impl pointer. Change-Id: I3c9ba73eb127985f5f54197ffecf2939c50f632c