Commit graph

5861 commits

Author SHA1 Message Date
Mathias Agopian
de6926bc94 add a ctor to Mutex to specify the type, which can be shared. This is used by sf and af an soon will allow some optimization in the kernel for non shared mutexes 2013-07-30 13:56:51 -07:00
Mathias Agopian
1555436473 implement Mutex and Condition with pthread instead of calling futex directly.
internally pthread uses futex. the implementation consists of simple inlines
there are no implementation files anymore.
2013-07-30 13:56:51 -07:00
Dianne Hackborn
d8cc052faf Fix resources not being set correctly. 2013-07-30 13:56:51 -07:00
Daisuke Miyakawa
56d6326a0e quick fix; utf8_codepoint_count must be utf8_length 2013-07-30 13:56:51 -07:00
Daisuke Miyakawa
44dad3e006 Add useful functions to String8, which enables users to convert between UTF-8 and UTF-32
It will be used in SQL functions in external/sqlite/android.
See https://android-git.corp.google.com/g/Gerrit#change,5511 for example.

Related internal bug id: 1707173
2013-07-30 13:56:51 -07:00
Andy McFadden
34ed82706a Fix sim build.
Looks like older gcc (4.1.x) doesn't properly handle templated
fanciness.  Apparently that's what we have on the build server.
2013-07-30 13:56:51 -07:00
Dianne Hackborn
bd875d2638 Don't re-parse the framework resources all the time.
A small optimization to the resource code, to not re-parse the framework
resources every time we build a new AssetManager.  Instead, you can now
construct a ResTable from a previously created one...  of course, like the
existing code for using the data in-place, you can't delete the original
ResTable until you have deleted the one that has been constructed from it.
2013-07-30 13:56:51 -07:00
Dianne Hackborn
cfd03822f0 Fix issue #1673793: Theme styles don't apply.
It turns out this was not a problem in the resource code at all.  Rather,
the system process has a cache of pre-loaded attributes it uses to avoid
continually reloading things as it needs them.  Well it turns out this
cache wasn't flushed after a package was uninstalled or a configuration
changed, so you could re-install an app where you change its style resources
so its theme now points to one that is inconsistent in the cache.

This is mostly a problem for developers, where they continually install
new versions of an app where resources have changed.  This could possibly
show up when updating an app on a normal phone, although the problem would
eventually correct itself since this cache uses weak references.

Anyway, the cache is now reworked to be flushed appropriately.

This change also includes an update to aapt to be able to dump the
contents of bags in resources.
2013-07-30 13:56:51 -07:00
Joe Onorato
ff57433745 Better (and less) logging from backup. 2013-07-30 13:56:51 -07:00
Dianne Hackborn
8b72a9bb4e Expand support for different screen sizes.
Applications can now declare that they support small, normal, or
large screens.  Resource selection can also be done based on these
sizes.  By default, pre-Donut apps are false for small and large,
and Donut or later apps are assumed to support all sizes.  In either
case they can use <supports-screens> in their manifest to declare
what they actually support.
2013-07-30 13:56:51 -07:00
Mathias Agopian
35b4039b48 move ui/Time.cpp to core/jni, since this is the only place it is used 2013-07-30 13:56:51 -07:00
Christopher Tate
585d4f410e Only report "unknown metadata" once per restore helper
Also removes the auto-free object, replacing it with direct memory manipulation.
2013-07-30 13:56:51 -07:00
Christopher Tate
aacacf7f75 Put back LOGP -> printf in the backup helper code 2013-07-30 13:56:51 -07:00
Christopher Tate
ad2030d99e Preserve file access mode when backing up / restoring files
This change adds a fixed-size metadata block at the head of each file's content
entity.  The block is versioned, and fixed-size on the theory that it might be
nice to be able to recover the content (if not the full metadata) of the files
if we're ever confronted with data backed up some hypothetical future helper
that stored expanded metadata.

The net effect is that now on restore, we assign the same access mode to the
file that it originally had when backed up.

Also, some of the code was failing to properly free transient heap-based buffers
when it encountered errors.  This has been fixed with the addition of a tiny
stack-based object whose job it is to free() its designated pointer from its
destructor.
2013-07-30 13:56:51 -07:00
Christopher Tate
02abe53d8a Add file mode to the file-backup saved state blobs
This change puts the file's access mode into the saved-state blob used by the
file backup helpers.  The tests have been updated for the new blob content
format.

What this change *doesn't* do is actually backup/restore the file mode.  This
change is a prerequisite for that, but mode preservation in backup/restore will
require adding metadata to the backup data stream itself, so will be approached
a bit more carefully.

(Also fixed one outright bug in the test program: ReadEntityData() had been
changed to return a ssize_t union of either a byte-count or a negative number
indicating error, but the test program was still assuming that nonzero == error,
and was spuriously failing.)
2013-07-30 13:56:51 -07:00
Joe Onorato
109518880c Helper API cleanup. Allows multiple helpers to function,
because they'll always go in the same order, and this lets
us not have to write headers to keep them paired.
2013-07-30 13:56:50 -07:00
Mathias Agopian
fe3b5edcf1 fix warnings that will show up with GCC 4.4 (in master) 2013-07-30 13:56:50 -07:00
Mathias Agopian
a33bd1672f improve Vector<> with types that can be trivially moved and remove some unused code.
This optimization applies to sp<> and wp<> which should now perform about the same as regular pointers when placed in to Vector<>.
2013-07-30 13:56:50 -07:00
Dianne Hackborn
4538dd85da Report densities in badging, debugging for nine patch bug.
The aapt tool now reports all available densities like it already did
for locales.  Also this includes more resource data output, which I
was using to examine bug #1867049 (which at this point I am unable to
reproduce).
2013-07-30 13:56:50 -07:00
Joe Onorato
aebb1ce05e backup stuff 2013-07-30 13:56:50 -07:00
Joe Onorato
b90ae5522a Make RestoreHelper and friends also write out the snapshot state. 2013-07-30 13:56:50 -07:00
Joe Onorato
f9f76ac291 FileRestoreHelper and RestoreHelperDispatcher work. 2013-07-30 13:56:50 -07:00
Joe Onorato
1781fd1ae7 checkpoint BackupDatAInput / RestoreHelper 2013-07-30 13:56:50 -07:00
Joe Onorato
6890e0bc52 Add RestoreFileHelper, BackupDataInput, and add java wrappers for the methods on BackupDataOutput. 2013-07-30 13:56:50 -07:00
Joe Onorato
9becbac780 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.
2013-07-30 13:56:50 -07:00
Joe Onorato
0d1d7ae49a Fix SharedPrefsBackupHelper so it doesn't hard code the paths to the files.
This took quite a bit of refactoring.
2013-07-30 13:56:50 -07:00
Mathias Agopian
14d978d02d get rid of LogSocket which wasn't even implemented (enabled) 2013-07-30 13:56:50 -07:00
Mathias Agopian
09e2b145ff break dependency on utils/ZipEntry.h and utils/ZipFile.h, get rid of inet_address.h and Socket.h which were not used 2013-07-30 13:56:50 -07:00
Mathias Agopian
254406e313 rename string_array.h to StringArray.h and move the implementation from the header file to a new cpp file.
StringArray is used in two places in framework/base and in the Sim. Ideally we should get rid of it and use Vector<String8> instead of creating new code.
2013-07-30 13:56:50 -07:00
Mathias Agopian
ba6a87f916 cleanup Debug.h a bit 2013-07-30 13:56:50 -07:00
Christopher Tate
2972a14f48 Fix back_up_files() error detection when opening/CRCing the file 2013-07-30 13:56:50 -07:00
Mathias Agopian
7c88914df4 rename a few files to camel-case, add copyright notices 2013-07-30 13:56:50 -07:00
Mathias Agopian
9f2dc70fd1 move utils/Pipe.h to the simulator 2013-07-30 13:56:50 -07:00
Mathias Agopian
861db31eb9 get rid of TimerProbe which is never used 2013-07-30 13:56:50 -07:00
Mathias Agopian
d12529a149 get rid of sleepForInterval() which didn't seem to be used anywhere in the source tree. Also get rid of ported.h which seem to be used only (possibly) in the sim. moved the implementation there. 2013-07-30 13:56:50 -07:00
Mathias Agopian
ec8fb949ca get rid of utils.h 2013-07-30 13:56:50 -07:00
Mathias Agopian
cbae9a27ce get rid of utils/executablepath.h, which now lives in the simulator 2013-07-30 13:56:50 -07:00
Mathias Agopian
624756e7ed force explicit instantiation of Singleton<> objects 2013-07-30 13:56:50 -07:00
Andy McFadden
69197b6020 Sim-only files move, part 2/2.
Move Pipe and executablepath from libutils to the simulator, since nothing
else uses them.
2013-07-30 13:56:50 -07:00
Mathias Agopian
d0ef3d46f9 some work to try to reduce the code size of some native libraries
- make sure that all binder Bn classes define a ctor and dtor in their respective library.
  This avoids duplication of the ctor/dtor in libraries where these objects are instantiated.
  This is also cleaner, should we want these ctor/dtor to do something one day.

- same change as above for some Bp classes and various other non-binder classes

- moved the definition of CHECK_INTERFACE() in IInterface.h instead of having it everywhere.

- improved the CHECK_INTERFACE() macro so it calls a single method in Parcel, instead of inlining its code everywhere

- IBinder::getInterfaceDescriptor() now returns a "const String16&" instead of String16, which saves calls to String16 and ~String16

- implemented a cache for BpBinder::getInterfaceDescriptor(), since this does an IPC. HOWEVER, this method never seems to be called.
  The cache makes BpBinder bigger, so we need to figure out if we need this method at all.
2013-07-30 13:56:50 -07:00
Nicolas Catania
d5e0fd44bc Fix for the simultor build breakage.
Added missing include sys/time.h for utimes.

Detects when stat64 uses a timespec for the modif and access times
and work around the missing st_*time_nsec.

Apologies for the whitespace changes, emacs removed them automatically.
2013-07-30 13:56:50 -07:00
Marco Nelissen
a7470e498c This should fix the simulator build. 2013-07-30 13:56:50 -07:00
Mathias Agopian
61c60b1a81 move libbinder's header files under includes/binder 2013-07-30 13:56:50 -07:00
Mathias Agopian
b8db306e1a checkpoint: split libutils into libutils + libbinder 2013-07-30 13:56:50 -07:00
Jean-Baptiste Queru
a393a7dd94 donut snapshot 2013-07-30 13:56:50 -07:00
Joe Onorato
062a488f1e Hook up the backup data writer, and add a utility to read the backup data files. 2013-07-30 13:56:50 -07:00
Dianne Hackborn
7ac7ecb6bd Update aapt badging for native code, configs, density, etc. 2013-07-30 13:56:50 -07:00
Joe Onorato
cd1c1c86c3 Add the backup data file writer C++ class. 2013-07-30 13:56:50 -07:00
Eric Fischer
9db34413c7 Start using CLDR for some date-and-time strings and formats.
Use java.text.DateFormat where possible, since that is already using
the CLDR data for the things it supports.  Remove an unused date format
object from DatePickerDialog.

Add a new method for getting the standalone month names from applications,
although @hidden for now because it is an API change.

Pass the standalone month names down to native code in Time so that
tztime's strftime() can use them.

And then the bulk of the change: replace all the names for the months
and the days of the week, and AM and PM, and yesterday, today, and tomorrow,
with strings from CLDR.  And replace several of the date format strings
with ones derived from CLDR, but reformatted to use strftime() style
instead of SimpleDateFormat style.

All these resource changes go into new donottranslate-cldr.xml files
and are removed from strings.xml so that they aren't part of the
normal translation process and the translators don't have to bother
with them (and risk messing them up).
2013-07-30 13:56:50 -07:00
Joe Onorato
62a381bd13 Implement the C++ class to write the backed up file data. 2013-07-30 13:56:50 -07:00