Commit Graph

396 Commits

Author SHA1 Message Date
Glenn Kasten
940673f92e Merge "Add C++ thread API androidGetThreadSchedulingGroup" 2011-08-29 14:38:52 -07:00
Mathias Agopian
cbe527884a fix a memory leak and memory corruption in RefBase
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
2011-08-11 22:33:02 -07:00
Kenny Root
b313559b21 Merge "Move extract native libraries to JNI code" 2011-07-27 15:54:51 -07:00
Kenny Root
49a65e5526 Move extract native libraries to JNI code
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
2011-07-26 10:14:58 -07:00
Kenny Root
395dcd07f1 am 64ed1059: am e612c881: am 4f3a8db6: am 3cf03987: Merge "Continue idmap generation even if name lookup fails."
* commit '64ed105957098a900d58e7c2598e060cb37755ce':
  Continue idmap generation even if name lookup fails.
2011-07-25 17:24:52 -07:00
Kenny Root
66a2eec564 am e612c881: am 4f3a8db6: am 3cf03987: Merge "Continue idmap generation even if name lookup fails."
* commit 'e612c881ecf74770098aa9c07d4f0611ac982038':
  Continue idmap generation even if name lookup fails.
2011-07-25 12:21:06 -07:00
Kenny Root
2cc4e531f0 am 3cf03987: Merge "Continue idmap generation even if name lookup fails."
* commit '3cf039876177b5b314b635bb12a1dae1b42f4605':
  Continue idmap generation even if name lookup fails.
2011-07-21 13:09:05 -07:00
Jeff Brown
585ef1e14a Remove unimplemented memory pool.
dlmalloc does such a great job that we don't need a pool anyways.

Change-Id: I105b28c4a5c491543959190c7c0a9de75a5b8052
2011-07-20 15:19:50 -07:00
Le-Chun Wu
3919950de8 Add a call to pthread_attr_destroy to avoid potential memory leaks.
Change-Id: Ib57efc3530e9793298190cc9cab19c9af54e11a7
2011-07-14 20:14:07 -07:00
Jeff Brown
c105333997 Minor code cleanups in vector.
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
2011-07-14 04:11:23 -07:00
Jeff Brown
686f62fcaf Replace Vector _grow/_shrink checks with assert.
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
2011-07-14 04:11:22 -07:00
Christopher Tate
a100c02b8d Compress the backup output stream
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
2011-07-13 15:30:41 -07:00
Jeff Brown
7175398247 Merge "Remove the simulator target from all makefiles. Bug: 5010576" 2011-07-12 12:15:07 -07:00
Jeff Brown
baa44b89ec Remove the simulator target from all makefiles.
Bug: 5010576

Change-Id: I04d722f258951a3078fe07899f5bbe8aac02a8e8
2011-07-11 22:12:16 -07:00
Mathias Agopian
f6f177f2e2 Fix typo in an assert's log
Change-Id: I94883a23a0a92eaf3e4976f942f747a2137499ac
2011-07-11 16:26:18 -07:00
Glenn Kasten
4fb2427591 Add C++ thread API androidGetThreadSchedulingGroup
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
2011-07-08 10:11:08 -07:00
Glenn Kasten
be3c018f8b Merge "Add Thread::join" 2011-07-06 11:37:53 -07:00
Glenn Kasten
f44c896b09 Merge "Thread ID zero for androidSetThreadSchedulingGroup" 2011-07-05 15:08:31 -07:00
Jason Simmons
c18d4da5e4 Add a linear transform library to libutils
Change-Id: Icdec5a6bebd9d8f24b3f335f8ec8b09a5810a774
2011-06-28 17:43:30 -07:00
Christopher Tate
cd604a1a6e Fix settings restore
Also correct the debug-mode logging of error locations in backup data.
Bug 4914182

Change-Id: Ie7dda0192afa819e42490b7ffd2d3db6f11968f6
2011-06-24 15:06:48 -07:00
Glenn Kasten
58e012d1e3 Add Thread::join
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
2011-06-23 12:55:29 -07:00
Glenn Kasten
ce63396eff Thread ID zero for androidSetThreadSchedulingGroup
Already implemented by androidSetThreadPriority but not documented

Change-Id: I85302b17092952065f3f3a4214d8d8abdd465dbd
2011-06-22 17:45:30 -07:00
Mathias Agopian
e397ce2880 am 0887b8c2: am 8e18668d: revert surfaceflinger leak fix as it uncovered a crasher on xoom (DO NOT MERGE)
* commit '0887b8c2e583e682cd2c1bc909cb3fdbec704004':
  revert surfaceflinger leak fix as it uncovered a crasher on xoom (DO NOT MERGE)
2011-06-15 22:42:52 -07:00
Mathias Agopian
dbe60ddd85 am d5244e0a: am 52a43990: Revert "revert surfaceflinger leak fix as it uncovered a crasher on xoom"
* commit 'd5244e0a88ed2f843651aa5ffdc71a45c968e0f3':
  Revert "revert surfaceflinger leak fix as it uncovered a crasher on xoom"
2011-06-15 22:12:32 -07:00
Kenny Root
111280a8de Use rand() for MinGW
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
2011-06-15 20:55:49 -07:00
Mathias Agopian
1b2c2a9ea0 revert surfaceflinger leak fix as it uncovered a crasher on xoom (DO NOT MERGE)
This reverts commit 52a43990880b27808bcf562afcc4209d34728e6e.

Change-Id: I1856a48f863b051395b8091ddfd1e01292fa1b1e
2011-06-15 20:45:32 -07:00
Mathias Agopian
63ad28fb53 Revert "revert surfaceflinger leak fix as it uncovered a crasher on xoom"
This reverts commit af6edba59e250adbdfa5b3c3be134f70d8c38a16.

Change-Id: I7793d3ca8a4d20a2b188364f47854328ab5f586d
2011-06-15 20:42:25 -07:00
Mathias Agopian
e776586a08 am 7ecdeb6e: am d20d72d1: Merge "revert surfaceflinger leak fix as it uncovered a crasher on xoom" into honeycomb-mr2
* commit '7ecdeb6e548ff71d4f70b343e30136e89eaa3e33':
  revert surfaceflinger leak fix as it uncovered a crasher on xoom
2011-06-15 20:21:31 -07:00
Mathias Agopian
3790e7997a revert surfaceflinger leak fix as it uncovered a crasher on xoom
Bug: 4600244
Change-Id: Ia68ebf0f243a051ff6a21b3863e3e5d259bbf7ac
2011-06-15 19:31:04 -07:00
Mathias Agopian
35cc0fcd51 am afffa8fa: fix RefBase so it retains binary-compatibility with gingerbread (DO NOT MERGE)
* commit 'afffa8fa9f82a7343e1158bf921931fd3e3df615':
  fix RefBase so it retains binary-compatibility with gingerbread (DO NOT MERGE)
2011-06-15 14:13:04 -07:00
Glenn Kasten
982a69f827 Merge "Bug 4608375" 2011-06-14 17:54:25 -07:00
Glenn Kasten
f0c412513f Bug 4608375
Update priority and policy together for audio threads

Change-Id: Ib3b07b32586c222c4aacbf23414ae8b05db502be
2011-06-14 10:41:50 -07:00
Mathias Agopian
ddc31c3e2b fix RefBase so it retains binary-compatibility with gingerbread
Bug: 4595257
Change-Id: I0d5e10f497e3f39868bff58f6ded510c38b44b12
2011-06-13 18:39:45 -07:00
Mathias Agopian
7794b30589 am 77079399: am a9c9a4ba: fix RefBase so it retains binary-compatibility with gingerbread (DO NOT MERGE)
* commit '77079399fca3e9c71e2ac06f3da26934e1c278b9':
  fix RefBase so it retains binary-compatibility with gingerbread (DO NOT MERGE)
2011-06-13 14:15:00 -07:00
Mathias Agopian
76feee7a58 fix RefBase so it retains binary-compatibility with gingerbread (DO NOT MERGE)
Bug: 4595257
Change-Id: I4773cf4fe59b2509db0ed733739eb6961d473b25
2011-06-13 13:58:34 -07:00
Mathias Agopian
867740df05 fix RefBase so it retains binary-compatibility with gingerbread (DO NOT MERGE)
Bug: 4595257
Change-Id: I1db83149107d7dab1f0b7e73c684e0ff82e17e62
2011-06-13 13:44:28 -07:00
Jamie Gennis
ac642349ba Merge "libutils: add a binary blob cache implementation." 2011-06-13 12:32:46 -07:00
Glenn Kasten
c4a0feaaf4 Merge "Remove redundant memory barrier" 2011-06-13 10:30:29 -07:00
Glenn Kasten
d9e1bb76fe Remove redundant memory barrier
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
2011-06-10 17:07:46 -07:00
Dianne Hackborn
66168d4bb4 resolved conflicts for merge of f51ded0f to master
Change-Id: Ida356524a68aeb2b9b0013dfbb6ab4bd11e616e2
2011-06-10 12:45:36 -07:00
Dianne Hackborn
5ea8834ab9 resolved conflicts for merge of e2aa0490 to master
Change-Id: Id0448a1598fc93aca0652b29253e02586e35a067
2011-06-09 17:50:36 -07:00
Dianne Hackborn
199512446d am a8d7ea06: am 220cd77d: Merge "Enforce public resource restriction on bag parents." into honeycomb-mr2
* commit 'a8d7ea067cf22baeee2ff0a33e5a8c5a35936942':
  Enforce public resource restriction on bag parents.
2011-06-09 16:06:07 -07:00
Dianne Hackborn
d4bfc93113 Enforce public resource restriction on bag parents.
Need to put some more styles in the SDK to avoid breaking apps.

Also, welcome Android 3.2.

Change-Id: Ia31d07c9b1b91ad868d8630437fdc1b5ae24f37d
2011-06-09 15:27:39 -07:00
Mathias Agopian
a1bb021469 am 96fcb702: am b40e85f9: am 645434fb: Merge "Fix a leak in RefBase" into honeycomb-mr2
* commit '96fcb702d75dcfb36c3ebd8fe420c8b29fa67fb7':
  Fix a leak in RefBase
2011-06-09 13:54:54 -07:00
Christopher Tate
61334a3f83 Fix handling of directory entries
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
2011-06-08 20:11:49 -07:00
Dianne Hackborn
b0cc4a8083 am a1396dfe: am 02140891: Merge "Work on issue #4518815: Compatibility mode introduces compatibility regression..." into honeycomb-mr2
* commit 'a1396dfe7ad6ec6953f544be42d69d7804ab0fd4':
  Work on issue #4518815: Compatibility mode introduces compatibility regression...
2011-06-08 20:06:40 -07:00
Dianne Hackborn
ab6bf752b3 Merge "Work on issue #4518815: Compatibility mode introduces compatibility regression..." into honeycomb-mr2 2011-06-08 20:00:50 -07:00
Mathias Agopian
ef1e16fc0b am 19974ecc: Fix a leak in RefBase (DO NOT MERGE)
* commit '19974eccdbd3e4dbd7e3b2cc401db7806d4a17bc':
  Fix a leak in RefBase (DO NOT MERGE)
2011-06-08 19:56:06 -07:00
Mathias Agopian
c2db91c3bf am b40e85f9: am 645434fb: Merge "Fix a leak in RefBase" into honeycomb-mr2
* commit 'b40e85f90146a654bfe5657187be491147814ea0':
  Fix a leak in RefBase
2011-06-08 19:34:30 -07:00
Dianne Hackborn
acf87675ae Work on issue #4518815: Compatibility mode introduces compatibility 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
2011-06-08 18:45:43 -07:00
Mathias Agopian
3b0a7a739e Fix a leak in RefBase
this bug was introduced recently. it caused RefBase's weakref_impl
structure to be leaked for every RefBase object (about 20 bytes).

Change-Id: Id85e749ba04521199555dd701198edd097c313d4
2011-06-08 16:25:01 -07:00
Mathias Agopian
9a03cecf8b Fix a leak in RefBase (DO NOT MERGE)
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
2011-06-08 16:13:39 -07:00
Christopher Tate
9f7bcda136 Fix embedded spaces in tar stream EVEN HARDER
Change-Id: I97ac586ff3541a05d73e1e53f680517c15e6c662
2011-06-07 13:17:17 -07:00
Christopher Tate
72a404d102 Implement shared-storage full backup/restore
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
2011-06-07 12:16:27 -07:00
Mathias Agopian
f3d939c5e5 merge various SF fixes from gingerbread to honeycomb-mr2 (DO NOT MERGE)
Fix a race that could cause GL commands to be executed from the wrong thread.
  RefBase subclasses can now decide how they want to be destroyed.
  Fix a race in SurfaceFlinger that could cause layers to be leaked forever.
  Fix a race-condtion in SurfaceFlinger that could lead to a crash.

initial cherry-pick:
resolved conflicts for merge of b9783b49 to honeycomb-plus-aosp

Change-Id: I2a335e03fff219e35c18a7b0089b3a11d636576f
2011-06-06 15:14:25 -07:00
Marco Nelissen
0129f1a27f resolved conflicts for merge of b9783b49 to honeycomb-plus-aosp
Change-Id: I1d86ea56b3d1d1b69f6671e5b0df0ca3f0c79643
2011-06-06 09:55:15 -07:00
Christopher Tate
15e113033b Restore from a previous full backup's tarfile
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
2011-06-01 15:09:55 -07:00
Jeff Brown
98d1f99704 am 8148cc3e: am 86ea1f5f: Initial checkin of spot presentation for touchpad gestures. (DO NOT MERGE)
* commit '8148cc3e47e50c916066e2fed562618b5827188f':
  Initial checkin of spot presentation for touchpad gestures. (DO NOT MERGE)
2011-05-25 14:46:53 -07:00
Jeff Brown
9a2c1ca2dd am af685f3b: am 85a7f99c: Merge "Refactor how timeouts are calculated. (DO NOT MERGE)" into honeycomb-mr2
* commit 'af685f3bb566f297deee1615d55d4f33d5580ba3':
  Refactor how timeouts are calculated. (DO NOT MERGE)
2011-05-25 14:42:20 -07:00
Jeff Brown
d3e6d3e763 Initial checkin of spot presentation for touchpad gestures. (DO NOT MERGE)
Added a new PointerIcon API (hidden for now) for loading
pointer icons.

Fixed a starvation problem in the native Looper's sendMessage
implementation which caused new messages to be posted ahead
of old messages sent with sendMessageDelayed.

Redesigned the touch pad gestures to be defined in terms of
more fluid finger / spot movements.  The objective is to reinforce
the natural mapping between fingers and spots which means there
must not be any discontinuities in spot motion relative to
the fingers.

Removed the SpotController stub and folded its responsibilities
into PointerController.

Change-Id: Ib647dbd7a57a7f30dd9c6e2c260df51d7bbdd18e
2011-05-25 14:37:17 -07:00
Simon Wilson
be93983384 am c9cd2387: Merge changes I37f0f315,I8cbf6044,Ibb598931,I5262bf11 into gingerbread
* commit 'c9cd2387b6938a6fbefc731d2177902266f2a130':
  Fix a race that could cause GL commands to be executed from the wrong thread.
  RefBase subclasses can now decide how they want to be destroyed.
  Fix a race in SurfaceFlinger that could cause layers to be leaked forever.
  Fix a race-condtion in SurfaceFlinger that could lead to a crash.
2011-05-24 17:29:12 -07:00
Jeff Brown
1eb42cf6db Refactor how timeouts are calculated. (DO NOT MERGE)
Added a timeout mechanism to EventHub and InputReader so that
InputMappers can request timeouts to perform delayed processing of
input when needed.

Change-Id: I89c1171c9326c6e413042e3ee13aa9f7f1fc0454
2011-05-23 17:20:42 -07:00
Mathias Agopian
3d6881f394 RefBase subclasses can now decide how they want to be destroyed.
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.

Bug: 4483050
Change-Id: I8cbf6044a6fd3f01043a45592b5a60fa1e5fade2
2011-05-23 16:13:48 -07:00
Mathias Agopian
d31099f021 Merge "Call RefBase::destroy() when OBJECT_LIFETIME_* is not the default" 2011-05-20 13:15:20 -07:00
Dianne Hackborn
79ba9b5e39 resolved conflicts for merge of 06a8ceac to master
Change-Id: Id51574c825affddfac14ad7214c5496d6a3d6e69
2011-05-19 21:44:52 -07:00
Mathias Agopian
8561698c9b Call RefBase::destroy() when OBJECT_LIFETIME_* is not the default
Change-Id: Ifb2069e095dba57b7d97e9f2d942fd85fa975f58
2011-05-19 21:01:04 -07:00
Mathias Agopian
20aeb1caa4 RefBase subclasses can now decide how they want to be destroyed.
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.
2011-05-19 19:40:01 -07:00
Dianne Hackborn
7583282db6 am c851ea56: am 69cb8757: Add new "-swNNNdp" resource qualifier.
* commit 'c851ea5672f6e042c2e89b2a2ce4a2467e1fcd2a':
  Add new "-swNNNdp" resource qualifier.
2011-05-19 19:34:21 -07:00
Dianne Hackborn
22585947ff Add new "-swNNNdp" resource qualifier.
Change-Id: I0101e88ca9d8d44138bdcaf571f24b0352f4f6ce
2011-05-19 18:23:29 -07:00
Mårten Kongstad
963664b6b7 Continue idmap generation even if name lookup fails.
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
2011-05-19 16:02:35 +02:00
Jamie Gennis
58c8dd2aa9 libutils: add a binary blob cache implementation.
This change adds an implementation of a cache that stores key/value
pairs of unstructured binary blobs.

Change-Id: Idd01fdabedfa3aed6d359a6efb0592967af52651
2011-05-17 16:58:37 -07:00
Christopher Tate
b41c5a5ae7 Full backup tweaks
* 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
2011-05-13 15:38:02 -07:00
Dianne Hackborn
89178d4de2 am 46a282f3: am 0ed2e845: Merge "DO NOT MERGE. Integrate add new screen width/height in "dp" configs." into honeycomb-mr2
* commit '46a282f323bc05606e4fe1eba795bd9ac7c99819':
  DO NOT MERGE.  Integrate add new screen width/height in "dp" configs.
2011-05-13 11:21:26 -07:00
Dianne Hackborn
88c0d696cc DO NOT MERGE. Integrate add new screen width/height in "dp" configs.
You can now specify resource configuration variants "wNNNdp"
and "hNNNdp".  These are the minimum screen width/height in "dp"
units.  This allows you to do things like have your app adjust
its layout based only on the about of horizontal space available.

This introduces a new configuration change flag for screen size.
Note that this configuration change happens each time the orientation
changes.  Applications often say they handle the orientation change
to avoid being restarted at a screen rotation, and this will now
cause them to be restarted.  To address this, we assume the app can
handle this new config change if its target SDK version is < ICS.

Change-Id: I4acb73d82677b74092c1da9e4046a4951921f9f4
2011-05-12 18:39:51 -07:00
Christopher Tate
ffd242ed55 Use pax extended tar format to support long filenames etc.
'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
2011-05-12 18:07:57 -07:00
Conley Owens
25bc410b31 am 041aa34e: am 87d86044: am bcd029b6: Merge "Add missing clean-up of idmap file descriptors."
* commit '041aa34e089d7b194a5d93c682c3af3d3116d3f3':
  Add missing clean-up of idmap file descriptors.
2011-05-11 13:10:56 -07:00
Christopher Tate
d78797f6e6 Full local backup infrastructure
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
2011-05-10 17:52:51 -07:00
Conley Owens
74cfbe1239 am 87d86044: am bcd029b6: Merge "Add missing clean-up of idmap file descriptors."
* commit '87d86044c0f15ae2ffc0350271c76ff874fb413b':
  Add missing clean-up of idmap file descriptors.
2011-05-10 16:19:29 -07:00
Mårten Kongstad
3e17850f1c Add missing clean-up of idmap file descriptors.
Change-Id: I9bdc9a4b7962f1a8dce77f4b213c8b9dc26e4b0f
2011-05-05 15:38:14 +02:00
Kenny Root
7e002d9a3f am fbb0e9f9: am bb93dad9: am bb10986c: am 13ce221e: Merge "libutils: Fix an improper const-cast in RefBase"
* commit 'fbb0e9f9846e185ba8ded63d754c4e61b1499b90':
  libutils: Fix an improper const-cast in RefBase
2011-04-26 12:46:04 -07:00
Kenny Root
f3faf0bc3d am bb93dad9: am bb10986c: am 13ce221e: Merge "libutils: Fix an improper const-cast in RefBase"
* commit 'bb93dad9250c0ee8330ab37bbdcd2eb8bfc0f930':
  libutils: Fix an improper const-cast in RefBase
2011-04-26 11:45:46 -07:00
Josh Stone
e6b21626a5 libutils: Fix an improper const-cast in RefBase
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
2011-04-22 11:13:35 -07:00
Jeff Brown
4815f2a6ad Initial checkin of spot presentation for touchpad gestures.
Added a new PointerIcon API (hidden for now) for loading
pointer icons.

Fixed a starvation problem in the native Looper's sendMessage
implementation which caused new messages to be posted ahead
of old messages sent with sendMessageDelayed.

Redesigned the touch pad gestures to be defined in terms of
more fluid finger / spot movements.  The objective is to reinforce
the natural mapping between fingers and spots which means there
must not be any discontinuities in spot motion relative to
the fingers.

Removed the SpotController stub and folded its responsibilities
into PointerController.

Change-Id: I5126b1e69d95252fda7f2a684c9287e239a57163
2011-04-19 15:35:51 -07:00
Kenny Root
81bc567745 resolved conflicts for merge of 18490fb9 to master
Change-Id: I6c68e6fb0f9c1182a955689bbffc161a8f30bd37
2011-04-12 12:51:08 -07:00
Kenny Root
f6bbefd581 resolved conflicts for merge of 87b3c0dc to honeycomb-plus-aosp
Change-Id: Ia1a0024aabf531438203eb9fea3a10dd15eabe53
2011-04-12 10:27:15 -07:00
Dianne Hackborn
592e3fc150 Add new resource configurations for screen width/height in "dp".
You can now specify resource configuration variants "wNNNdp"
and "hNNNdp".  These are the minimum screen width/height in "dp"
units.  This allows you to do things like have your app adjust
its layout based only on the about of horizontal space available.

This introduces a new configuration change flag for screen size.
Note that this configuration change happens each time the orientation
changes.  Applications often say they handle the orientation change
to avoid being restarted at a screen rotation, and this will now
cause them to be restarted.  To address this, we assume the app can
handle this new config change if its target SDK version is < ICS.

Change-Id: I22f8afa136b4f274423978c570fa7c9855040496
2011-04-06 11:00:37 -07:00
Mårten Kongstad
5f29c87ef2 Runtime resource overlay, iteration 1.
Runtime resource overlay allows unmodified applications to appear
as if they had been compiled with additional resources defined. See
libs/utils/README for more information.

This commit is the first iteration of runtime resource overlay. It
provides the actual overlay modifications and loading of trusted overlay
packages (ie residing in /vendor) targeting framework-res.apk.

This commit loads exactly one overlay package. The overlay,
if present, must target framework-res.apk and be located at
/vendor/overlay/framework/framework-res.apk.

Change-Id: If26ee7754813004a96c043dba37fbe99fa3919db
2011-04-01 14:12:10 +02:00
Carl Shapiro
3bafffb1bd Include strings.h for the strcasecmp prototype.
Change-Id: I0659ce2186547274e58f8b2027e16d3e45189353
2011-03-21 20:26:25 -07:00
Jeff Brown
c0a5e8df03 Refactor how timeouts are calculated.
Added a timeout mechanism to EventHub and InputReader so that
InputMappers can request timeouts to perform delayed processing of
input when needed.

Change-Id: Iec2045baaf4e67690b15eef3c09a58d5cac76897
2011-03-17 17:29:09 -07:00
Jeff Brown
80f3e7cc15 Fade out the mouse pointer after inactivity or other events.
Fades out the mouse pointer:
- after 15 seconds of inactivity normally
- after 3 seconds of inactivity in lights out mode
- after a non-modifier key down
- after a touch down

Extended the native Looper to support enqueuing time delayed
messages.  This is used by the PointerController to control
pointer fade timing.

Change-Id: I87792fea7dbe2d9376c78cf354fe3189a484d9da
2011-03-02 15:37:57 -08:00
Mathias Agopian
32bebb0a58 Fix sp<> conversion operator / constructor
some of the conversion operators were not using the proper
pointer type when calling incStrong/decStrong, usually it
has no bad consequences, but for some implementation
of the ref-counted object it could lead to recording the wrong
owner id.

Change-Id: If574b9069b8a4cf6e0911a992c8f095aba799995
2011-02-25 16:20:52 -08:00
Mathias Agopian
da26c6662d Merge "Fix some issues with RefBase debugging." 2011-02-24 16:23:51 -08:00
Glenn Kasten
3477a8cff2 Merge "Bug 3362814 Fix SMP race in access to mRequestExit" 2011-02-24 10:01:31 -08:00
Mathias Agopian
f14a1046e7 Fix some issues with RefBase debugging.
First slipt sp<> out of RefBase into StrongPointer.h so it can be reused
more easily and to make it clear that it doesn't require RefBase.

Note: the rest of the change only affects the system when DEBUG_REFS is enabled.

The main problem we fix here is that the owner id associated with each
reference could get out of date when a sp<> or wp<> was moved, for
instance when they're used in a Vector< >.

We fix this issue by calling into RefBase::moveReferences from
a template specialization for sp<TYPE> and wp<TYPE> of the
type helpers. RefBase::moveReferences() has then a chance to
update the owner ids.

There is a little bit of trickery to implement this generically in
RefBase, where we need to use a templatized functor that can turn
a sp<TYPE>* casted to a void* into a RefBase*.

Introduced a new debug option DEBUG_REFS_FATAL_SANITY_CHECKS
currently set to 0 by default as there seem to be an issue
with sp<ANativeWindow> which trips the sanity checks.

Change-Id: I4825b21c8ec47d4a0ef35d760760ae0c9cdfbd7f
2011-02-23 22:21:41 -08:00
Glenn Kasten
7e453a51a5 Bug 3362814 Fix SMP race in access to mRequestExit
Also fix an unlikely SMP race in access to mHoldSelf on entry to _threadLoop.

Change-Id: I6cbc0b94739c7dd5e77e8a5ba0da22cdc0b1a4db
2011-02-23 17:49:59 -08:00
Mathias Agopian
a08ef4932f Remove RefBase.h dependency on TextOutput.h
Change-Id: I72cd6b98ef82b4868fe1c8ec87862cf43fb4ee73
2011-02-22 18:08:58 -08:00
Kenny Root
af1cf07134 Clean up use of HAVE_ANDROID_OS
HAVE_ANDROID_OS was defined as "1" for targets, but never defined as "0"
for non-targets. Changing them to #ifdef should be safe and matches
all the other uses of HAVE_ANDROID_OS throughout the system.

Change-Id: I82257325a8ae5e4e4371ddfc4dbf51cea8ea0abb
2011-02-16 10:56:32 -08:00
Jean-Baptiste Queru
d45c61dfcf am 1314bdb2: am e88fa50b: Merge from open-source gingerbread
* commit '1314bdb2b22ae3613c3e08ae278dbc70f90b965c':
  fix failing thread object run
2011-01-30 16:32:44 -08:00
Jean-Baptiste Queru
9bfc45e3c3 am e88fa50b: Merge from open-source gingerbread
* commit 'e88fa50be8d6709ef58b7aeb01c5efa059bcac2e':
  fix failing thread object run
2011-01-30 16:19:59 -08:00
Jean-Baptiste Queru
02bac86968 Merge from open-source gingerbread
Change-Id: I56f2ed37187796807fbf0de15274a85164f9432c
2011-01-30 15:30:03 -08:00