History log of /frameworks/base/core/java/android/app/ActivityThread.java
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
c1b0ebf5793fd63c37a666c1d768ce9a3e6bc134 09-Jun-2016 Adam Lesinski <adamlesinski@google.com> ResourcesManager: Apply ContextThemeWrapper config

The ContextThemeWrapper's configuration override must also
be applied to ResourcesManager during a configuration change.

Bug:27644297
Change-Id: Ic126308b753979c18801d422a8243aa4daf45147
/frameworks/base/core/java/android/app/ActivityThread.java
c3a6c78feddd53241ea64d8aae1867235e043a75 08-Jun-2016 Chad Brubaker <cbrubaker@google.com> Don't depend directly on AppplicationInfo

ApplicationInfo is mutable and unfortunately some apps do actually
modify the flags. Due to the lazy loading nature of the network security
config this may lead to issues. Instead cache the needed flags and
resources at application startup.

Bug: 29063413

(cherry picked from commit 276ee969be89ba25e439839341953236adf80c40)

Change-Id: If638a716fd903b4e9dbabcbecb38bd4e26fef08c
/frameworks/base/core/java/android/app/ActivityThread.java
c74972f89159cb73db7817c3f1d53e1c813fa5bd 08-Jun-2016 Felipe Leme <felipeal@google.com> Wrap closeQuietly() on finally block.

BUG: 29123428
Change-Id: Ife7a919343ce4b73eef759bbc87dd37f12a71bca
/frameworks/base/core/java/android/app/ActivityThread.java
29de4922dbfccbf1d6fd975a320f80ae7a28c7c4 08-Jun-2016 Felipe Leme <felipeal@google.com> Duplicate file descriptor when dumping asynchronously.

dumpDbInfo() uses an async task when dumping from the system thread, but
then the file descriptor is closed by the time the task is executed. As
such, the system databases are not dumped.

BUG: 29123428
Change-Id: Ibb8bbe503aa03c3ca13b2b1789f0ead0b869e9d5
/frameworks/base/core/java/android/app/ActivityThread.java
27d301667be46fd5038e97f435c2d9f133894617 26-May-2016 Adam Lesinski <adamlesinski@google.com> Use app's best locale if they override LocaleList

App's can technically override their configuration's Locale,
which means we must choose the overriden locale as the best,
and therefore set the LocaleList.setDefault() with that locale.

Bug:28953437
Change-Id: I4b301fcd6bc426e37bb389d3a6f2b4a3c69ac33a
/frameworks/base/core/java/android/app/ActivityThread.java
b61e405397200f78b1c652143cba7c751df05a00 20-May-2016 Adam Lesinski <adamlesinski@google.com> Improve performance of LocaleList with Resources

We allow each individual Resources object to select the best
Locale for the given APK. This allows one update to the configuration
instead of multiple updates, once the locale is chosen.

The Java locale is selected from the app context's locale.

Bug:28625993
Bug:27325465
Change-Id: I99e1e53f522e560f3b80bbd1e1c605f552dbdff0
/frameworks/base/core/java/android/app/ActivityThread.java
c845b2a21cedda4dd221fcf01aae74706ecade94 13-May-2016 Chad Brubaker <cbrubaker@google.com> Use an attribute for the network security config resource

Originally we went with the meta-data approach to make unbundling
easier, however with the amount of platform changes that the config
ended up relying on it would be better to focus on exposing it through
the platform.

Bug:28763009
Change-Id: Iaf80001b1980220cd2e1e05faf2dc86af41700e1
/frameworks/base/core/java/android/app/ActivityThread.java
69de32071c8ca7fa2277e4340a320b7df6fe963d 17-May-2016 Sergio Giro <sgiro@google.com> ZygoteInit: install AndroidKeyStoreProvider in the Zygote

Instead of in activity thread. That way, we can warm up (ie,
precompute cached values) this provider and AndroidBCWorkaroundProvider
(which are installed together) so that the computation doesn't
happen in the app. As a result, the time spent in the first call to
SSLSocketFactory.getDefault() decreases by ~5ms in angler userdebug.
Measured with an app calling SSLSocketFactory.getDefault in onCreate
and timed it with System.currentTimeMillis() .

Bug: 28545496

Change-Id: I73284eccdf6d51dbf55206335d759ccf795c5f41
/frameworks/base/core/java/android/app/ActivityThread.java
4c8e542f68c990b76ce13748c719d05e65086329 18-May-2016 Andreas Gampe <agampe@google.com> Frameworks/base: Add more systrace points

Add more systrace points for application startup.

Bug: 28625993
Change-Id: I76dca9e842fb43f1b85981ef94582074d31528c8
/frameworks/base/core/java/android/app/ActivityThread.java
4ef107bb7ad0c1f28db710374bb118e6658d3238 13-May-2016 Andrii Kulian <akulian@google.com> Merge "Close leaked windows when trying to preserve main one" into nyc-dev
eac0ea5cdfade6bfd2a1e40e67c2a45d4c37ab9e 12-May-2016 Andrii Kulian <akulian@google.com> Close leaked windows when trying to preserve main one

When app has several windows and activity is relaunched + we try to preserve
main window - other windows just stayed around until removed by timeout or
replaced by app. There was a problem when one of the windows registered
broadcast receiver and set its own timer to remove it. In this case all
receivers were removed by framework because windows were considered leaked
and apps' timer caused crash when trying to remove registered receiver.

This CL removes all windows expect the main one, which we're trying to
preserve in this case.

Bug: 28337135
Change-Id: Ib8790cc8c61801f11d871ba3803bb0ebc3d3be01
/frameworks/base/core/java/android/app/ActivityThread.java
0997908c95151ce24609c10731990e648156b95d 19-Apr-2016 Dimitry Ivanov <dimitry@google.com> Move Vulkan layer path setup to ApplicationLoaders

ThreadedRenderer was never the right place for this anyway, and
ApplicationLoaders can provide both the full library search path (not
just the extracted native library dir) as well as the application loader
namespace.

Bug: 28213888
Change-Id: Ibcc0a9178da4dba6f3f3105932fdac1a1d0261af
/frameworks/base/core/java/android/app/ActivityThread.java
f09f0699369c02a6a46fbff68c02b00a7c703697 11-May-2016 Todd Kennedy <toddke@google.com> Merge "Fix secondary ABI instrumetion" into nyc-dev
a66d395490fc0797fb7b24ad8148c510a6e2cff3 11-May-2016 Amith Yamasani <yamasani@google.com> Merge "Fix multi-window assiststructure trashing" into nyc-dev
e713efcac103f3d8083ec9d5b00c528af7266b21 10-May-2016 Todd Kennedy <toddke@google.com> Fix secondary ABI instrumetion

When installing an APK that supports multiple ABIs, the ABI installed
can be forced to the secondary ABI [i.e. On devices that support both
32 and 64 bit variants, the 32-bit version can be forced when it's
the secondary ABI.] In this case, instrumenting the class always tried
to use the primary ABI. Instead of blindly using the primary ABI and
dropping the secondary ABI, we propagate both ABIs and make a
decision on which one should be chosen.

Bug: 28406240
Change-Id: I7ebb2fd264d2281912afd30f6d73ccb460f9cf85
/frameworks/base/core/java/android/app/ActivityThread.java
56e2aeba8fb40190dbe1303ae1d299e77e764b44 10-May-2016 Adam Powell <adamp@google.com> Merge "Move Activity multi-window event logic out of the public methods" into nyc-dev
eff06393458f3bb79826f7813041b99abe13f3ca 10-May-2016 Andreas Gampe <agampe@google.com> Frameworks/base: Shorten system property

Otherwise it's too long.

Bug: 26877591
Change-Id: I741186a9fbea6ee50df6cef58d528ec58662c772
/frameworks/base/core/java/android/app/ActivityThread.java
4f128e4d968b376bb7c3fa209d27b0a30202e604 10-May-2016 Amith Yamasani <yamasani@google.com> Fix multi-window assiststructure trashing

When multiple activities within the same process
try to handle requests for AssistStructure, the
singleton mLastAssistStructure tends to trash
the old structure when a second window's request
comes in.

This change passes in a sessionId so that the
cache is only cleared if the session id changes.

Bug: 28348867
Change-Id: I07efcd933db7e48aefd25a1c95493b71bbcffe4b
/frameworks/base/core/java/android/app/ActivityThread.java
0f03a01ca328b354e812751b2b307f244fcc463b 09-May-2016 Andreas Gampe <agampe@google.com> Frameworks/base: Make profile buffer adjustable

Add a debug system property to change the profile buffer size.

Bug: 26877591
Change-Id: Idd13f2bc6563fd88daadd1d6679f3243dab1a0ef
/frameworks/base/core/java/android/app/ActivityThread.java
858cf036a39e01bd35216a9194001a4536c03c80 10-May-2016 Adam Powell <adamp@google.com> Move Activity multi-window event logic out of the public methods

Move the logic for dispatching multi-window mode change events to
fragments and the activity window out of the public API onFoo methods
meant to be overridden by apps. This prevents problems if an extending
class forgets to call super.onFoo in these methods and removes the
need for doing so.

Bug 28667205

Change-Id: Ibf4c543e22b95753e1e4812bbd3e81f7648de54d
/frameworks/base/core/java/android/app/ActivityThread.java
ea162c3c7992b01d8d56766a94e56a0cee3fe3b2 05-May-2016 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Prepare to replace windows across recreate()." into nyc-dev
77bdfb512f963701082c5c78e9a9db00b167fcb6 03-May-2016 Robert Carr <racarr@google.com> Prepare to replace windows across recreate().

When the activity locally recreates itself, nothing
on the server side is able to prepare preserving windows,
or replacing windows. The activity was trying to defer
removing the old window, but it was just waiting
until the new one was created, not until it was drawn,
thus resulting in a flicker. It's easy to backpack on the
existing replacement infrastructure.

Bug: 28221875
Change-Id: I55fc4ca78e9e11809473fedd8b30b6a6350cf852
/frameworks/base/core/java/android/app/ActivityThread.java
5dc6d6551e28c4b1eb93d4047b40049ddc7c23c3 04-May-2016 Wale Ogunwale <ogunwale@google.com> Make sure to pause activity before stopping

In some cases it is possible for activity manager to request
a resumed activity to stop when it's visibility changes. This
is a valid transition, however we need to make sure to pause
the activity on the client side before stopping it so lifecycle
transition works as expected.

Bug: 28574036
Change-Id: I759b38bbd1c9c3bb0475759bcb638d8223fa504d
/frameworks/base/core/java/android/app/ActivityThread.java
1793d4769b9d357d4ec6e27099252bc1a938d100 28-Apr-2016 Jorim Jaggi <jjaggi@google.com> Remove optimization to report config change

Since activity manager only issues a configuration change when
we are not relaunching the activity, the optimization to suppress
that on the client side is not needed anymore and only leads to
issues where there is a change in smallest_width but we are not
relaunching the activity because the change doesn't cross a size
threshold.

Bug: 28050773
Change-Id: I303c190bd7390363d1030edcdb2913b7c64c666d
/frameworks/base/core/java/android/app/ActivityThread.java
311ecba9818a6b09a0061a3f3fae84043f333f40 27-Apr-2016 Robert Carr <racarr@google.com> Fix crash when docking.

ViewRootImpl may be null at this point if
we didn't preserve. Sorry about the churn.

Bug: 28413589
Change-Id: Iebfd819490252b52332d94ccefbddfae160087cf
/frameworks/base/core/java/android/app/ActivityThread.java
b2594850870ba950067962d41c481f9bbfafeaf1 26-Apr-2016 Robert Carr <racarr@google.com> Fix bugs with takeSurface and preserveWindows.

When reusing a ViewRoot and DecorView as we do with preserveWindows
there are two issues with SurfaceHolders. First, we update the
SurfaceHolder callbacks when we call ViewRootImpl.setView. In the
case of preserved window relaunch, the DecorView is reused and there is
no call to setView. We need the ActivityThread to notify the ViewRoot
that something has changed. Secondly, we were assuming the only time
a new surface would be created for the purposes of SurfaceHolder
notification was when we previously did not have a valid surface.
Instead we need to check if the native Surface object has changed each time we
get a result from relayout.

Bug: 28331264
Change-Id: If1b4aab9b2ba579fa040e2a3ab4471842476d82f
/frameworks/base/core/java/android/app/ActivityThread.java
5ac2da04c1321e8620fc85afae7a168c01ce218b 19-Apr-2016 Andrii Kulian <akulian@google.com> Merge "Recreate activity with correct configuration" into nyc-dev
d0ad938760ef01471ee609d85d025af3b6a37a92 19-Apr-2016 Andrii Kulian <akulian@google.com> Recreate activity with correct configuration

Dialer recreates activity inside onConfigurationChange
when configuration changes significantly. Recreated
activity in this case was initialised with old base version
which resulted in incorrect configuration in split-screen.

This CL updates configuration when activity is created from
override config.

Bug: 27976063
Change-Id: I0ac002a5661154ec25f2d5aba3d44070b683ba2f
/frameworks/base/core/java/android/app/ActivityThread.java
2a727d7bd52555ff2493ffdbc1f421b3228d04cc 15-Apr-2016 Calin Juravle <calin@google.com> Move profile registration from bindApplication to LoadedApk

In order to capture profiles for apps which share the same VM and for
splits loaded without restart we need to move the profile registration
closer to where we create the class loaders (since bindApplication is
not called multiple times).

Moving the registration after class loader creation also allows us to
not profile apks which are already fully compiled.

Bug: 27539488
Bug: 27893309
Bug: 28012567
Change-Id: I6333f026f4f0680ca28e989f1686e3eac1145339
/frameworks/base/core/java/android/app/ActivityThread.java
8f5770dcdb6d4cac8294938902ab83528a7feea7 12-Apr-2016 Calin Juravle <calin@google.com> Register the UI Thread as a sensitive thread to the runtime

Bug: 27865109
Bug: 28065407
Change-Id: I46194d444530770f505ac5e653536be2da7dd08b
/frameworks/base/core/java/android/app/ActivityThread.java
701214b2823e6d2ed87f9825ecec7cc164e1b7b5 07-Apr-2016 Andrii Kulian <akulian@google.com> Fix multiple configuration changes in multiwindow

When in split-screen mode and activity handles configuration changes
it gets 2 onConfigurationChanged calls which originate from
ActivityManagerService#updateConfigurationLocked:
1. app.thread.scheduleConfigurationChanged calls to all process records
send configuration of the whole screen for corresponding orientation,
which leads to CONFIGURATION_CHANGED message in ActivityThread.
2. mStackSupervisor.resizeStackLocked call resizes both visible stacks and
eventually ActivityThread receives ACTIVITY_CONFIGURATION_CHANGED
message with correct configuration corresponding to space occupied in
split-screen.

In this CL if component callback is an instance of Activity and it had
override config set - onConfigurationChanged will not be triggered unless
override config has changed.

Bug: 27948331
Change-Id: Ia73b045570b44eb5b351811bf6c4f63d78c3f909
/frameworks/base/core/java/android/app/ActivityThread.java
b6f5a4292bf97db3cba35b7e998a9ce70b982d37 08-Apr-2016 Tim Murray <timmurray@google.com> Improve service start/creation tracing.

bug 27998068

Change-Id: If18ab5d293f0bb0dfbfbed2f2af383c349464963
/frameworks/base/core/java/android/app/ActivityThread.java
3ad1b4899fcf38de92b6ac8d84e55a738f0baad9 02-Apr-2016 Adam Lesinski <adamlesinski@google.com> Fix issue with overridden configuration in onConfigurationChanged

When using applyOverrideConfiguration, subsequent callbacks to
onConfigurationChanged didn't take into account the locally overridden
configuration. This patches the incoming configuration to match
what is expected by the application.

Bug:27644297
Change-Id: I3a090e9862a56470d999aa0aa4d5bae29f533a11
/frameworks/base/core/java/android/app/ActivityThread.java
ac945867145c571506a211ccb0a87a3402c4d745 31-Mar-2016 Andrii Kulian <akulian@google.com> Merge "Refactor usages of Picture In Picture and Multi Window (1/4)" into nyc-dev
c14dd78a2c20c0cfa229dfeef064de148e0b608e 30-Mar-2016 Seigo Nonaka <nona@google.com> Fix incorrect initial locale negotiation.

It turned out that calling ResourceManager.setDefaultLocalesLocked
and ResourcesManager.applyConfigurationToResourcesLocked
can be called before the locale negotiation is ready.

To fix this issue, move ResourcesManager setup flow after creating
application context.

This also introduces RuntimeException for notifying developers the
initialize order.

Bug: 27567902
Change-Id: Iab7ea384b039fb649fb52d06d45b2bfae21f9a8a
/frameworks/base/core/java/android/app/ActivityThread.java
933076d80561751618f462b26309ce9e4c3ff3bf 30-Mar-2016 Andrii Kulian <akulian@google.com> Refactor usages of Picture In Picture and Multi Window (1/4)

Bug: 27365860
Change-Id: I1590e430a12ceb84cb83da295e0bf7e4378fea96
/frameworks/base/core/java/android/app/ActivityThread.java
a0a58a2fd5cbc1bb8056227bb04f276b364c6e96 17-Mar-2016 Jeff Sharkey <jsharkey@google.com> Merge "Refactoring FBE APIs based on council feedback." into nyc-dev
8a372a0a280127743ce9a7ce4b6198c7a02d2a4f 16-Mar-2016 Jeff Sharkey <jsharkey@android.com> Refactoring FBE APIs based on council feedback.

Mostly consists of removing the word "encryption" from most APIs,
since we can't actually make promises about the data being encrypted.

Bug: 27531029
Change-Id: Iace9d7c4e64716abf86ed11847c40f3947e1d625
/frameworks/base/core/java/android/app/ActivityThread.java
58178f2fe4fb2fd2dba0504acff35f8ecc2e495c 16-Mar-2016 Andrii Kulian <akulian@google.com> Add additional logging for incorrect activity stop

Print ActivityClientRecord state when ActivityThread#performStopActivityInner
is called for already stopped activity.

Bug: 25267624
Change-Id: I2b044e42d0188ef9eaf15422b6a05617ade802e2
/frameworks/base/core/java/android/app/ActivityThread.java
082614c6a57a115ee0c5975e3579bf34a178c0f8 04-Mar-2016 Adam Lesinski <adamlesinski@google.com> Cache per-Activity Resources objects

Each Activity has a Resources object whose underlying state changes
when a configuration change occurs, both global and for that activity only (multi-window).
Views and other clients of the Resources object can safely cache it knowing that
they always have a reference to the most up-to-date resources.

This applies to Resources.Theme objects as well.

Bug:26854894
Change-Id: Ifd3da5a1086e17f747dfc265a447fe92a3a5c692
/frameworks/base/core/java/android/app/ActivityThread.java
b8e8a91f54f9f11a5936611c00d198ed21824854 10-Mar-2016 Jeff Sharkey <jsharkey@android.com> Log when pre-N apps send too much to DropBox.

Once they target N, they'll start getting exceptions, which is
intended to make sure they pay attention to data that would have
otherwise been dropped on the floor.

Bug: 27571535
Change-Id: I49163679c629cd0788327d2c3a654e757ecdcb99
/frameworks/base/core/java/android/app/ActivityThread.java
3e1958936e9fbf853269200c00f8506d84d1a64d 06-Mar-2016 Jeff Sharkey <jsharkey@android.com> Skip publishContentProviders() when we have zero.

If the list of providers for the application being bound is empty,
don't bother trying to register them.

Bug: 27510621
Change-Id: I921fb70a4c97433fa123fa88e170745ee013ee35
/frameworks/base/core/java/android/app/ActivityThread.java
d5896630f6a2f21da107031cab216dc93bdcd851 05-Mar-2016 Jeff Sharkey <jsharkey@android.com> Move more PM calls to ParceledListSlice.

Since the data returned by these calls can grow unbounded based on
various GET flags, we need to switch 'em over.

Bug: 27391893
Change-Id: Ie849ca30dbaaa91158da4c83675657715629a0ee
/frameworks/base/core/java/android/app/ActivityThread.java
e8498cd0066113068f2b0294144837546f213bd1 03-Mar-2016 Todd Kennedy <toddke@google.com> Merge "Splits without restart" into nyc-dev
d98885c128e7045da244098d82751da6e792d677 02-Mar-2016 Dianne Hackborn <hackbod@google.com> Add APIs to find out the time when a process was created.

Change-Id: Id0d12c377f278fec6e31a98eab0c865a23c006ec
/frameworks/base/core/java/android/app/ActivityThread.java
3977f20d002c803f211599b44f457ff7dc3e7dd6 02-Mar-2016 Calin Juravle <calin@google.com> Merge "Simplify the error logs for profiles we can't open." into nyc-dev
39bfee5e3674faea992c32204abc1c03429b8cda 24-Feb-2016 Todd Kennedy <toddke@google.com> Splits without restart

In specific cases [as determined by the installer], we can install
splits without restarting the application. The split must be purely
additive [i.e. it should not modify class(es)/resource(s) defined
in the base or other splits. Otherwise, the behaviour could be
inconsistent [e.g. if a modified class was already loaded, the
modified version won't be loaded until the process is restarted].
The platform does not perform any verification that the split is
purely additive.

Bug: 26463098
Change-Id: I3526c3b1b847a8e0afabc7a4787fa770422196b7
/frameworks/base/core/java/android/app/ActivityThread.java
75f5de62fe4f7b529e51c6f3181483ed574cbd58 02-Mar-2016 Wale Ogunwale <ogunwale@google.com> Merge "Relaunch activity resumed if it got resumed before relaunching." into nyc-dev
6e6669577780cb343703f19e15df40bcae905437 01-Mar-2016 Wale Ogunwale <ogunwale@google.com> Merge "Add activity onStop lifecycle to event logs." into nyc-dev
9ad8613bbb6c77530e5407c07d67918512edf605 01-Mar-2016 Jeff Sharkey <jsharkey@android.com> Suppress StopInfo exception based on target API.

Bug: 27429026
Change-Id: Ibf0b058b1f921c20fbc3c72045467883a8934f67
/frameworks/base/core/java/android/app/ActivityThread.java
e1ac71fe9924add9368d118932e6c2bf0dfb2d70 01-Mar-2016 Calin Juravle <calin@google.com> Merge "Restrict the cases when we profile guided compile an apk" into nyc-dev
c3b6179fca9085824e03e44c89ca8dbf5d1cff3a 23-Jan-2016 Filip Gruszczynski <gruszczy@google.com> Relaunch activity resumed if it got resumed before relaunching.

This fixes following scenario:
1) first activity starts second activity and expects results; first
activity gets paused;
2) second activity finishes and returns a result;
3) first activity is still paused and receives the result from the second
activity; first activty requests a local relaunch; relaunch gets
scheduled and is marked as launching paused (because the activity is
still paused)
4) first activity resumes;
5) first activity relaunches and finishes in paused state.

The fix makes it drop the information about launching paused if it is
local when it gets resumed in step 4.

Bug: 25674611
Bug: 26116905
Change-Id: Ieeef3f0d5c311679882fdc59c13fd8a99e3d3a20
/frameworks/base/core/java/android/app/ActivityThread.java
cd7043e99abd14fd586ab6bf37a40c55cd529f3e 28-Feb-2016 Wale Ogunwale <ogunwale@google.com> Add activity onStop lifecycle to event logs.

Also added reasons why onPause and onResume are called.

Bug: 27384433
Change-Id: If6c304f577b601511f6d9b948061d2cfa0dcb970
/frameworks/base/core/java/android/app/ActivityThread.java
414c529a4f3d8aa50df6e3615d2084ac1089de85 29-Feb-2016 Colin Cross <ccross@android.com> Merge "Add dumpsys meminfo --unreachable" into nyc-dev
369f509d5688f84d1e5205c79ab919c1bac6c969 29-Feb-2016 Jeff Sharkey <jsharkey@android.com> Sigh, someone is pushing 2MB through StopInfo.

Bug: 27401092
Change-Id: Ib27a56ecc63662ce2d6210890ac65eca09fac9d6
/frameworks/base/core/java/android/app/ActivityThread.java
6bd212b58a33f3250ac39cebecdbfe6b347baff1 29-Feb-2016 Calin Juravle <calin@google.com> Simplify the error logs for profiles we can't open.

The stack trace is not interesting and we don't care if the unlink
failed because the file is not there.

Bug: 27401160
Change-Id: I765b3a1481e2d257dd120e240122c025b1c134bf
/frameworks/base/core/java/android/app/ActivityThread.java
f8880561e67e1da246970b49b14285efd4164ab1 26-Feb-2016 Jeff Sharkey <jsharkey@android.com> When system server goes down, crash apps more.

Similar to first patch, but now using new "rethrowFromSystemServer()"
method which internally translates DeadObjectException into
DeadSystemException. New logic over in Log.printlns() now
suppresses the DeadSystemException stack traces, since they're
misleading and just added pressure to the precious log buffer space.

Add some extra RuntimeInit checks to suppress logging-about-logging
when the system server is dead.

Bug: 27364859
Change-Id: I05316b3e8e42416b30a56a76c09cd3113a018123
/frameworks/base/core/java/android/app/ActivityThread.java
fd3d5e92ea05ca20e6c3700e2309d849d96f2f7d 26-Feb-2016 Chong Zhang <chz@google.com> Merge "Do not stop window if preserving the window" into nyc-dev
7687f25e588a0e13a2c97cc3fc948f48aee86b90 26-Feb-2016 Chong Zhang <chz@google.com> Do not stop window if preserving the window

bug: 27350647
Change-Id: I670d2641ee7e600a6ea46f7b329afd4df10a3862
/frameworks/base/core/java/android/app/ActivityThread.java
9b51160e0c9ecedd20039d4162bed1eb945e987b 26-Feb-2016 Thierry Strudel <tstrudel@google.com> Fix typo in SwappedOut reporting

Change-Id: I55b3725eba054d3d6d2b38041cf375fc7b141c69
/frameworks/base/core/java/android/app/ActivityThread.java
d479b52d12fc782f18df6b5ae15c19e022f0ec14 24-Feb-2016 Calin Juravle <calin@google.com> Restrict the cases when we profile guided compile an apk

Do not use profile guided compilation if the apk is loaded by another
app. The decision if an apk was used or not by another app is done
by looking into the foreign profile directory. Apks which where
loaded in others apps will have a file marker in the profile directory.
The marker is named after the canonical location of the apk file where
'/' is replaced by '@'.

Also, refactor the profile paths to the Environment.

Bug: 27334750
Bug: 26080105
Change-Id: Ic2ac5a7a231670ecb4462166c34fdd5b4c631178
/frameworks/base/core/java/android/app/ActivityThread.java
e60b28d99b7f541616a4f26d476ae452cdfe41e2 25-Feb-2016 Thierry Strudel <tstrudel@google.com> Revert "Temporary fix for QXDM crashes."

This reverts commit d7793693ad6b8937bb7850573278b881618795b0.

Change-Id: I9f27d6d5075be7b170ebe7a5bf4f2c3fe8c7c604
/frameworks/base/core/java/android/app/ActivityThread.java
d7793693ad6b8937bb7850573278b881618795b0 24-Feb-2016 Jeff Sharkey <jsharkey@android.com> Temporary fix for QXDM crashes.

Bug: 26971038
Change-Id: I59efbdec11ca8d9a0b640c092402091d66b220a0
/frameworks/base/core/java/android/app/ActivityThread.java
d96d2ddc23736070b2e47eae1629d210a16bc1c7 03-Feb-2016 Calin Juravle <calin@google.com> Change the location of profile files.

Bug: 26719109
Bug: 26563023
Change-Id: I8e9e03a58a7926c72283788c5eb49ae680e85cc3
/frameworks/base/core/java/android/app/ActivityThread.java
c4fb5f9d4b8012bc007f0c7e472d4ff4801254f5 03-Feb-2016 Colin Cross <ccross@android.com> Add dumpsys meminfo --unreachable

dumpsys meminfo --unreachable will search the native heap for
allocations that are unreachable.

Bug: 27208635
Change-Id: I40ab1c261cb222ca71d04ab8408f355bcb18ed94
(cherry picked from commit 84b1e3554b36b7fbccf57330c93bf484985ae3d6)
/frameworks/base/core/java/android/app/ActivityThread.java
e84bdd38addecc80878d811ab279646acfe6ab19 08-Feb-2016 Jeff Sharkey <jsharkey@android.com> Move graphics and JIT caches to DE storage.

We confirmed with the graphics and JIT teams that no sensitive
user data is written to these caches, so they're safe to point at DE
storage.

Since we don't have control over what is written by the app, we need
to keep the cache environment variable pointing at CE storage.

Fix ensurePrivateDirExists() to always return a path, instead of
returning null which can cause scary bugs.

Change packages.list to no longer canonicalize data paths, since
these fail when CE storage is still locked.

Bug: 27069522
Change-Id: Ifff64a036fa4aa1e61aa0dd98486bc711fbf8f4a
/frameworks/base/core/java/android/app/ActivityThread.java
2ac46f1bda969b2d042ac35ba89cda3e595d1c4a 04-Feb-2016 Alan Viverette <alanv@google.com> Ensure Bitmap.getDefaultDensity() matches DENSITY_DEVICE

Otherwise bitmaps constructed without a target display are incorrectly
scaled by a factor of (DENSITY_DEVICE / DENSITY_DEFAULT) when rendered
to a Canvas whose density has been specified correctly.

Bug: 26817900
Change-Id: I45edfc7c0cbdf84a267d5bedacb0548659ede301
/frameworks/base/core/java/android/app/ActivityThread.java
e578f454c63794ae3203a936c48a40bb209302c1 03-Feb-2016 Calin Juravle <calin@google.com> Merge "Enable profile support for apps with shared runtime"
a8a8545f1bacdecdaa6ade4bba47312c6eb72ad2 02-Feb-2016 Michael Lentine <mlentine@google.com> Merge "Fix activity thread."
2ba303fa9b74e7449df43fae73a4622fbb4bfcf5 02-Feb-2016 Michael Lentine <mlentine@google.com> Fix activity thread.

Fix activity thread to not call into the threaded renderer if it is
an isolated process.

Change-Id: I57035f5ff64d134866f9d2e19c60ab99657aea64
/frameworks/base/core/java/android/app/ActivityThread.java
8f2cd959305d7d3c190efb326013b0a7e9855b98 01-Feb-2016 Michael Lentine <mlentine@google.com> Merge "Adding plumbing for passing the lib directory."
e6cb0974b3465852702e3132b0f0503690a435d2 01-Feb-2016 Jeff Sharkey <jsharkey@android.com> Skip setting up cache paths on system package.

The system package doesn't have any real data directories, so we
shouldn't try setting any cache paths.

Bug: 26895494
Change-Id: Iafca72f51d77eac5f602d842369de74ae8669b02
/frameworks/base/core/java/android/app/ActivityThread.java
3b93a4d351aeb154fba8a4b2fa66ca25a951993d 30-Jan-2016 Wale Ogunwale <ogunwale@google.com> Renamed Activity class multi-window APIs

As requested by API council.

Bug: 26507736
Change-Id: I2a87c5eb3c1b48d52703103c2a4f72c250a9a827
/frameworks/base/core/java/android/app/ActivityThread.java
03d8f76836c5950374bc9030a78706d25ac233e9 31-Jan-2016 Michael Lentine <mlentine@google.com> Adding plumbing for passing the lib directory.

Added call in handleBindApplication which will pass the library path into
HardwareRender which then passes it to libvulkan through ThreadedRenderer's
jni interface.

Change-Id: I7dc1fec9c7a1566716a4501a0d5697ea94e57b53
/frameworks/base/core/java/android/app/ActivityThread.java
4c79fea9efea7cfa739cf5b5f525ddadb28e52a6 29-Jan-2016 Andreas Gampe <agampe@google.com> Frameworks/base: Stop profiling on uncaught exception

When "handling" an uncaught exception, make an attempt to stop
profiling. In case profiling was active, this will avoid losing
the profiling buffer.

Bug: 26291225
Change-Id: Ie5f5517b46ed89d0456a4aac9d4ff3b713d1d8aa
/frameworks/base/core/java/android/app/ActivityThread.java
344744b49633a7f8aa0c8e43469bbfcf9d8e2cab 29-Jan-2016 Jeff Sharkey <jsharkey@android.com> Exposing file:// beyond your app is bad, m'kay?

For several releases now we've told developers that sharing raw files
between apps is a recipe for trouble. There are at least three major
problems with sending raw files:

-- Apps sending generic intents can't know who is at the other end,
so they may not have access to shared storage locations. This is
more likely now that runtime permissions require apps to explicitly
ask users for permission.

-- Apps making files in their private storage world-readable has been
deprecated for several releases, and now in N it's fully blocked. If
we let these intents through, the receiving app would fail to open
the file, when the real blame rests on the sending app.

-- Devices with user profiles can't share raw files when using
cross-profile intent filters, since filesystem access is fully
locked down between users.

The time has finally come to communicate clearly that if you're
sharing content between apps, you need to use content:// Uris. We
added the simple FileProvider several years ago to give apps a clean
way to migrate with minimal work on their part.

Bug: 26860922, 9069185
Change-Id: I075f627f6a0d6c7fca2c090ca133b9aae9801c64
/frameworks/base/core/java/android/app/ActivityThread.java
486117bf5b3e6f1c5af0a176c4f07a06d44ab42f 27-Jan-2016 Roozbeh Pournader <roozbeh@google.com> Merge "Move locale negotiation to ResourcesManager"
32ebbd87d7a92234e1e05ab17251d3ece51d9ca1 26-Jan-2016 Wale Ogunwale <ogunwale@google.com> Revert "Relaunch activity resumed if it got resumed before relaunching."

This reverts commit 51dc8be2230758132744ae6204d95e8171784c26.

Due to activities getting multiple resume calls.

Bug: 26116905
Bug: 25674611
Change-Id: Idb4846b6a0efc4d6ac06bf240565f303d9206f0f
/frameworks/base/core/java/android/app/ActivityThread.java
834641b3908b21e7054c290e116d76e3d5e6888c 24-Jan-2016 Roozbeh Pournader <roozbeh@google.com> Move locale negotiation to ResourcesManager

Previously, locale resolution happened at Resources level, which
could result in different Resources in the same app using different
locales.

This change moves the locale negotiation to ResourcesManager, which
remembers the locales supported by each Resources as they are
created, and negotiates the locale based on their union.

It also makes sure that the old model of apps getting the default
locale by accessing it through the Configuration's locale attribute
continues to work, since the negotiated locale will be moved to the
top of the list before Resources are created and when they are
updated with a Configuration change.

Bug: 25800576
Bug: 26404653
Change-Id: I0dd81df288327fd8d1229188c9544ee2209c161a
/frameworks/base/core/java/android/app/ActivityThread.java
0af6fa7015cd9da08bf52c1efb13641d30fd6bd7 18-Jan-2016 Amith Yamasani <yamasani@google.com> Voice Interaction from within an Activity

This allows an app to show a voice search button
and invoke a voice interaction session for use
within the activity. Once the activity exits, the
session is stopped.

Test application has a new activity that
demonstrates it with the test voice interaction
service.

This initial version is functional enough for
an integration test, with some more tests
and improvements to come later.

Bug: 22791070
Change-Id: Ib1e5bc8cae1fde40570c999b9cf4bb29efe4916d
/frameworks/base/core/java/android/app/ActivityThread.java
51dc8be2230758132744ae6204d95e8171784c26 23-Jan-2016 Filip Gruszczynski <gruszczy@google.com> Relaunch activity resumed if it got resumed before relaunching.

This fixes following scenario:
1) first activity starts second activity and expects results; first
activity gets paused;
2) second activity finishes and returns a result;
3) first activity is still paused and receives the result from the second
activity; first activty requests a local relaunch; relaunch gets
scheduled and is marked as launching paused (because the activity is
still paused)
4) first activity resumes;
5) first activity relaunches and finishes in paused state.

The fix makes it drop the information about launching paused when it
gets resumed in step 4.

Bug: 25674611
Change-Id: Ieeef3f0d5c311679882fdc59c13fd8a99e3d3a20
/frameworks/base/core/java/android/app/ActivityThread.java
cada57a57bed6fb79a318ddf3cf0a09cd038c034 22-Jan-2016 Seigo Nonaka <nona@google.com> Set the default locale list when it is changed.

When the system language is changed by the Settings app, we need to call
LocaleList.setDefault() to change the default locale list
since components like TextView should be able to assume that
LocaleList.getDefault() returns the latest system locale list.

BUG: 26731035
Change-Id: I482567476e1b14cd9b4716343183627f81d96ace
/frameworks/base/core/java/android/app/ActivityThread.java
0102a8a8e957c38e8fe40e6cd184339ea9f38906 19-Jan-2016 Rob Carr <racarr@google.com> Merge "Replace SurfaceViews across resize trigerred relaunches."
23fa16b759f023ea18ab9f84e89df50d4b449dfd 13-Jan-2016 Robert Carr <racarr@google.com> Replace SurfaceViews across resize trigerred relaunches.

In resize modes where we are preserving the main application
window, we need to tell the WindowManager to prepare to replace
the child surfaces, or they will dissapear across relaunches.

Bug: 26070641
Change-Id: I864168688dc320e9280e651f9c5df614f52bc96c
/frameworks/base/core/java/android/app/ActivityThread.java
7bdf3cff92d26f9a4a8b88f816f5313fe02d6a33 19-Jan-2016 Calin Juravle <calin@google.com> Merge "Enable profile guided compilation on the framework side"
2abb4acd8c10452c4ba2cb0a4703273d8ff8bfc0 14-Jan-2016 Calin Juravle <calin@google.com> Enable profile support for apps with shared runtime

Bug: 26080105
Change-Id: I3ca8fc1d2c69ab31075947a332643cb53c17be5d
/frameworks/base/core/java/android/app/ActivityThread.java
db4a79a5d7d348e9d2286d95d4e5a59dd484456f 23-Dec-2015 Calin Juravle <calin@google.com> Enable profile guided compilation on the framework side

The background compilation service will trigger a profile based
compilation instead of a full one. If no profile information is
available the compilation is skipped (see installd).

Note that the end decision whether or not to compile a package is taken
by dext2oat. We can't make the decision here because this service runs
under system server which cannot read app's profile data.

Bug: 26080105
Change-Id: I457ea8dea0557839c1f7cdc241770055732b0a4a
/frameworks/base/core/java/android/app/ActivityThread.java
4846ee3cc378001128680f2a3309c7e60bfcac75 07-Jan-2016 Jorim Jaggi <jjaggi@google.com> Optimize window relayouts when dragging divider

- Communicate the resize mode to ViewRootImpl. If it is a docked
divider resize, do not call relayout for every traversal.
- Do not call Task.resizeWindows() unconditionally when changing
Stack bounds. It might be just a move.
- However, not calling relayout breaks layout bounds while
relaunching. To fix that, do the following:
-- Inform ViewRootImpl that the activity just relaunched, and force
a relayout call in the next traversal so the client can pick up
the unfrozen bounds.
-- When unfreezing the bounds, cause a traversal in window manager.

Bug: 25015474
Change-Id: Iab9a445dabce4f6ec1e25957038fe40a4be65246
/frameworks/base/core/java/android/app/ActivityThread.java
41f94edd5af600bff9856b6a5471a1e61935f78b 14-Dec-2015 Martijn Coenen <maco@google.com> Add Swap and SwapPss to meminfo checkin dump.

And make --checkin an accepted argument.

Change-Id: I6294915ec02c49415c7071f54ad995aa76b67e6c
/frameworks/base/core/java/android/app/ActivityThread.java
e076485754dc30f9f798fb1242e6f7d5a0b6d39b 08-Jan-2016 Martijn Coenen <maco@google.com> Report SwapPss usage if available as part of Pss

Parse "SwapPss:" lines from /proc/pid/smaps if it exist, and store them
in a seperate stat entry.
Report SwapPss if made available by kernel, otherwise we fall back to
legacy Swap.

Fix getTotalSwappablePss documentation.

Change-Id: I361928c0f44c7dc9b959b91c127c916215063866
Signed-off-by: Thierry Strudel <tstrudel@google.com>
/frameworks/base/core/java/android/app/ActivityThread.java
c5967e9862489024c932b0c7fcb84ed0af2a7fd7 08-Jan-2016 Jeff Sharkey <jsharkey@android.com> More progress on triaging PackageManager callers.

Catch a bunch of simple cases where the PackageManager flags are
obvious. Add the ability to use the MATCH_SYSTEM_ONLY flag on
PackageInfo and ApplicationInfo queries.

Re-examine recent tasks after a user is unlocked, since some of the
activities may now be available and runnable.

Bug: 26471205, 26253870
Change-Id: I989d9f8409070e5cae13202b47e2c7de85bf4a5b
/frameworks/base/core/java/android/app/ActivityThread.java
c74d338c13b2538ad30dabd0b30fb3197834c883 07-Jan-2016 Calin Juravle <calin@google.com> resolve merge conflicts of 435ad029a3 to master.

Change-Id: I87202d69a772c593b691de8ce2faeaac9b7d1f58
690523969d2f5b202e9929ad9fe0b5cba5537b0f 17-Dec-2015 Calin Juravle <calin@google.com> Create jit profile file during the app startup flow.

ActivityThread has already all the needed information
(userId,sharedAppId) to create the profile file and set the correct
permissions on it. This avoids passing uids to the runtime which now
expects the profile file to be already created.

As part of this change:
- move the registration with the runtim in handleBindApplication
- register only if needed: we could properly setup a profile file and we
have at least one code path. Note that registration with the runtime is
done solely for profiling reasons.

Bug: 26080105
Change-Id: I72657e9ea0a0449a09734456b5f8b5da844cee62
/frameworks/base/core/java/android/app/ActivityThread.java
fe89d122e5b6b129b25d5d5316f690bd4ab93fbb 22-Dec-2015 Jorim Jaggi <jjaggi@google.com> Add infrastructure to track activitiy relaunches

As a preparation to start synchronizing task size
with activity relaunches, we need a infrastructure
so we know in AM/WM when an activity is relaunching
and when it's done relaunching.

Bug: 26311778
Bug: 25015474
Change-Id: Ied3795eddbcd112f6329494afbf13178ca49a799
/frameworks/base/core/java/android/app/ActivityThread.java
fda25dad28e5e8118e03b190ca081e93a90c293b 21-Dec-2015 Calin Juravle <calin@google.com> Merge "Pass app\'s code paths to the runtime" am: db73912471
am: 7d7ab7ad3b

* commit '7d7ab7ad3b096d28b274024705b3171e42bebdcd':
Pass app's code paths to the runtime
f19c9638ddc6678b9ac28afc4c83189d4fe2fd62 10-Dec-2015 Calin Juravle <calin@google.com> Pass app's code paths to the runtime

The runtime needs the application's main code paths so it know for which
dex files to record the profile.

Bug:26080105
Change-Id: I5f2cb5c140aa6893ac78bc0d5897e33764569e5b
/frameworks/base/core/java/android/app/ActivityThread.java
14e811f5d99dc5368d9f668382009306f9f5f869 15-Dec-2015 Wale Ogunwale <ogunwale@google.com> Still save config on client side when not reporting to activity.

On the client side we have additional protection not to save new
configuration reported by activity manager if the app isn't handling
any of the configuration change that occurred. This is done because
the activity is expected to relaunch for any configuration it doesn't
handle. However, with multi-window support the activity manager doesn't
relaunch an activity if the configuration change doesn't cross a resource
threshold.
We now save the configuration on the client side when activity manager
tells us not to report the changes to the app (i.e. configuration
changed, but wasn't big enough for relaunch)

Bug: 23904868
Change-Id: I54f65cad65c1b8ed5da1165a8b2816adbea41d4b
/frameworks/base/core/java/android/app/ActivityThread.java
5f986095bed776c119d2f5452e0afeac3a437ea2 05-Dec-2015 Wale Ogunwale <ogunwale@google.com> APIs for activity to know when its windowing/pip modes change

Added APIs that allow activities to ask the system if they are currently
in multi-window or picture-in-picture mode and also get notified when
their modes change.

Bug: 25509834
Bug: 25683717
Change-Id: I4b8c316a49940bd6a8b31a93b345f9fd725a4721
/frameworks/base/core/java/android/app/ActivityThread.java
3696301ada2d42c67ef98ef7229b774e1418f93e 07-Dec-2015 Filip Gruszczynski <gruszczy@google.com> Merge "Update client configuration when resizing without crossing size threshold."
ca66481244913c4a17b62c3ddff214d2ca72c439 04-Dec-2015 Filip Gruszczynski <gruszczy@google.com> Update client configuration when resizing without crossing size threshold.

Even though the activity won't be relaunched and won't receive a
callback about the resize, we still need to update it's configuration.
Otherwise when the application queries for it, it will receive wrong
data.

Bug: 23904868
Change-Id: I601e91b8e71691c1cb5edb2734894441c4fde8e2
/frameworks/base/core/java/android/app/ActivityThread.java
680215f502d03d165c922eaccde7b21f7f608425 04-Dec-2015 Fyodor Kupolov <fkupolov@google.com> Merge "Fix instrumentation context initialization"
af38b8ea3e76f57febf3288e757ee23fef49cf99 03-Dec-2015 Fyodor Kupolov <fkupolov@google.com> Fix instrumentation context initialization

Previously, when a user was not the system user, an instrumentation context
was not properly initialized. Its ApplicationInfo should had been initialized for
the current user id .

Bug: 25981683
Change-Id: I7b934bb6de42be15a613ac26fd5377c9de1682cc
/frameworks/base/core/java/android/app/ActivityThread.java
51aaf906f9f5fb2f117f5ccfae8be6974f7cb903 03-Dec-2015 John Reck <jreck@google.com> Nuke HardwareRenderer abstract base

Bug: 17303292

Change-Id: I4a272ea4f695f4f9993e8be640fdd8530b691be0
/frameworks/base/core/java/android/app/ActivityThread.java
78d4712f272e2e68fdcd69f33f4d413eecc89390 18-Nov-2015 Chad Brubaker <cbrubaker@google.com> Install the Network Security Config Provider

The provider is installed early in ActivityThread to ensure that no
TLS objects are created in the application before the provider is
installed.

Change-Id: I5f77addfa75a4ee19301de54e01507d8dca33657
/frameworks/base/core/java/android/app/ActivityThread.java
15447798a38d2b5acb1998731340255f4203f294 06-Nov-2015 Jeff Sharkey <jsharkey@android.com> Initial file-based encryption public APIs.

Define two explicit directories where device-encrypted and
credential-encrypted data will be stored. Third-party apps only
need access to the device-encrypted directory, so that's the only
API exposed for now.

General cleanup in how ApplicationInfo details are derived.

Bug: 22358539
Change-Id: If0a0108721a4aa1c3052b4912e08604bbf24e1ae
/frameworks/base/core/java/android/app/ActivityThread.java
20aa0aed8c9d5f5fc25f239c151529de86603509 30-Oct-2015 Filip Gruszczynski <gruszczy@google.com> More granular reporting of size configurations.

There are two improvements in reporting size configurations:
1) duplicates are removed;
2) smallest width is reported separately;

Change-Id: I8f8235c99e6eefcae178e8d61e79ad0c4d6f1144
/frameworks/base/core/java/android/app/ActivityThread.java
63afb863815a80b05c6f1acd6b0e99a3508540f4 19-Oct-2015 Pablo Ceballos <pceballos@google.com> Merge "Remove GLTrace support"
db5dec271e3855d14576a18ab13df85391ea01c4 12-Oct-2015 Filip Gruszczynski <gruszczy@google.com> Improve relaunch merging in activity thread.

To reduce the number of times that we load resources based on
configuration changes ActivityThread employs an optimization
strategy that merges relaunch operations. If it receives a
relaunch request why one is already queued, it will just update
the queued request instead of creating a new one. Unfortunately
this breaks the guarantee of executing lifecycle events in the
order they were received.

Consider following scenario of requestes from Activity Manager:
1) relaunch the activity in not resumed state;
2) resume the activity;
3) relaunch the activity in resumed state.

The Activity Thread can process these commands in following order:
1) receive the request to relaunch in not resumed state;
2) receive the request to resume the activity;
3) receive the request to resumed state, update the exisiting
request;
4) execute the request to relaunch in resume state;
5) execute the request to resume.

This causes the activity to perform resume twice.

Since we need the merging of relaunch operations for performance
reasons, we need to introduce a secondary mechanism for ordering
of lifecycle requests. Relaunching, pausing, stopping and resuming
receive a sequence number based on when the request was received. If
the last executed sequence number is higher then the operations
sequence number then the operation will be dropped.

In the above scenario the sequence number would be:
1) request to relaunch not resumed receives seq + 0;
2) request to resume receives seq + 1;
3) request to relaunch resumed receives seq + 2;
4) execution of of request to relaunch resumed set current sequence
number to seq + 2;
5) since seq + 1 < seq + 2, then the execution of request to resume
is prevented.

Bug: 24806374

Change-Id: Ia520dd1aa215827d4172a9891a7cc01db2ce627e
/frameworks/base/core/java/android/app/ActivityThread.java
a4d4e82927ceadc23863e74b7e1160e4497504a7 05-Oct-2015 Pablo Ceballos <pceballos@google.com> Remove GLTrace support

GLTrace is defunct, it does not support newer GL features, breaks
security requirements, and has no supported tooling now that Eclipse
is at end of life.

Bug 22329852

Change-Id: I64c58464f8c2c7ae6125f5d5c7884e3fd34d68ea
/frameworks/base/core/java/android/app/ActivityThread.java
14418daa093f8cd39b7fccbc24115a6968dc8e92 05-Oct-2015 Filip Gruszczynski <gruszczy@google.com> Fix recents crashing during docked stack resize.

Whether acitvity window should be preserved during the relaunch is
controlled by the activity manager and the existence of
non-client-decor should not affect it. For example, docked activities
will not have non-client-decor, but we would like to preserve them
anyway.

Bug: 24573657
Change-Id: I5d4852c3b7c26ac3ec1bbc105639f75b67d1d3ad
/frameworks/base/core/java/android/app/ActivityThread.java
f48e1e21241b9a24e85845fcaf6f95dcc0f01924 05-Oct-2015 Filip Gruszczynski <gruszczy@google.com> Remove accidentally added logging.

Change-Id: Ibffca5e034c5009684bfe6b9a04bd476b9385053
/frameworks/base/core/java/android/app/ActivityThread.java
44bc4daff31d2d6f632695008a0e5f5272ff4f56 03-Oct-2015 Filip Gruszczynski <gruszczy@google.com> Only request resize for tasks on the freeform stack.

This fixes a crash during orientation changes, where window manager
requests a resize for a docked task, but activity manager throws an
exception since dock tasks can only be resized when their stack is
being resized.

Bug: 24575031

Change-Id: I954c4e6ae60931b30200b10c8a4834b0a5757606
/frameworks/base/core/java/android/app/ActivityThread.java
a59ac9cd645d25f03e4e488100bd99f92e83a3a7 11-Sep-2015 Filip Gruszczynski <gruszczy@google.com> Preserve window during resize triggered relaunches.

This changes application code behavior when the activity relaunches due
to configuration change. It only applies to scenarios, where the
configuration change was triggered by a user generated resize of an
activity (i.e. user drags a corner of an activity and thus changes its
size).

Preserving a window means that we will keep the decor view and non
client decor view around, but remove all children views when the
activity gets destroyed. When the activity gets created again, it will
attach its new content to the preserved view hierarchy. Mind, we
actually recreate application side Window object, since some of its
features might changed, but we retain its elevation (to not trigger
relayout with new layout params).

Preserving the window also means that we don't call the window manager
service to remove and later add the window. Instead, we continue using a
single window state throughout the resize operation.

Change-Id: Ie3d2878ed09c99ff343044bfe7a29a0ba07a265e
/frameworks/base/core/java/android/app/ActivityThread.java
d04c6d19a589a2a0f60650675438c59ac6900f45 14-Sep-2015 Alex Hills <ahills@google.com> resolved conflicts for 693e11e5 to mnc-dr-dev-plus-aosp

Change-Id: I701841759a80f434a09b086492e817ca23a6a2e6
3d2337eeb5c8b28bace281d049c5ca8cd13c8b70 11-Aug-2015 Alan Viverette <alanv@google.com> Cherry-pick system theme rebase to fix square UI on round watches

Our system themes were based on configurations that were added post-
init of the system theme.

I96e695441543379e4d5fdf3cc6f18d9e6cf953b4 broke this, because there
was a race condition in the code for rebasing themes

If8fecde76d62738a8e55eddf898eafc468afdba2 (the cherry-picked commit)
fixes the race condition and adds the rebasing back in.

This change cherry picks If8fecde76d62738a8e55eddf898eafc468afdba2.

Bug:23387146
Change-Id: I0725028e48599fc6cd9731ae16c71474dd5827e5
/frameworks/base/core/java/android/app/ActivityThread.java
be64eae333c32344ce22e72ac53443188815d1ed 03-Sep-2015 Alan Viverette <alanv@google.com> Minor clean up in ActivityThread, mostly final usage

Change-Id: Ic98103cb8b2ac6fb9b37fc9457366ded2bfbb7a8
/frameworks/base/core/java/android/app/ActivityThread.java
2107d69d35191c8e16e61720da62ff33290f5a8a 03-Sep-2015 Alan Viverette <alanv@google.com> Postpone loading app context until instrumentation is set up

The application context needs instrumentation data to be in place
prior to construction so that the class loader is initialized using
the correct paths.

Removes unnecessary clearClassLoader() workaround that was previously
added to fix instrumentation tests.

Bug: 22627299
Change-Id: Ibf8e69e037189a9a563f0b68cfe333461726b71d
/frameworks/base/core/java/android/app/ActivityThread.java
346296bd7d28fa79509605f30a222eb85d6bbb5d 01-Sep-2015 Alan Viverette <alanv@google.com> Reset class loader after updating instrumentation paths

Bug: 23688983
Change-Id: I9a0f81b422b5e29f3f8707b987e40c65965e0223
/frameworks/base/core/java/android/app/ActivityThread.java
02fc5fef36357467eba22a0ee250a96734daf791 27-Aug-2015 Alan Viverette <alanv@google.com> Extract drawable inflation to its own class, inflate from class name

Bug: 22627299
Change-Id: Icd2ac88af4f3102e08e52f6f0f7565839da6437a
/frameworks/base/core/java/android/app/ActivityThread.java
395cd017e66b81f9b223f5310cce9b827d156b4c 11-Aug-2015 Alan Viverette <alanv@google.com> Rebase system theme on configuration change

Also makes native theme accesses thread-safe to avoid a race condition
when modifying the theme off the UI thread. Since drawable loading can
occur off the UI thread, we need to ensure Theme access is thread-safe
anyway.

This reverts commit c12ec70def2a5682c6cd7fdb3adaa82cc34d5bf6.

Change-Id: If8fecde76d62738a8e55eddf898eafc468afdba2
/frameworks/base/core/java/android/app/ActivityThread.java
7bea76cecf14a1fcc5fe2847f6629a8c8901b938 11-Aug-2015 Alan Viverette <alanv@google.com> am 3e384531: am 1743988c: am 6c3a468c: am e720297f: am b4eb0640: Merge "Avoid use-after-free race condition when rebasing theme" into mnc-dev

* commit '3e384531bed8f80867ce1bab9c8de315865be824':
Avoid use-after-free race condition when rebasing theme
3e384531bed8f80867ce1bab9c8de315865be824 11-Aug-2015 Alan Viverette <alanv@google.com> am 1743988c: am 6c3a468c: am e720297f: am b4eb0640: Merge "Avoid use-after-free race condition when rebasing theme" into mnc-dev

* commit '1743988cd7647af8c64c961d4ca5e9d4b4b7bc00':
Avoid use-after-free race condition when rebasing theme
c12ec70def2a5682c6cd7fdb3adaa82cc34d5bf6 11-Aug-2015 Alan Viverette <alanv@google.com> Avoid use-after-free race condition when rebasing theme

... by never rebasing the theme. We don't need to do this unless the
system theme is configuration-dependent, which it is not currently.

Bug: 22943781
Change-Id: I96e695441543379e4d5fdf3cc6f18d9e6cf953b4
/frameworks/base/core/java/android/app/ActivityThread.java
2349332f9f69189d7889692b9aafd6f80070e352 30-Jul-2015 Filip Gruszczynski <gruszczy@google.com> Only relaunch activity on significant size configuration changes.

Currently if the configuration width/height/smallest width changes, we
relaunch the activity or invoke onConfigurationChanged callback. When it
comes to size based configuration changes it might not be necessary: if
the size change doesn't pass one of the threshold defined by the
resources, it means there is no need to relaunch the activity.

In this CL the ActivityManager will receive the thresholds from the
application and use them to decide, whether to relaunch the activity.
The application reads the thresholds from the resources, specifically
from resource qualifiers used by the app.

Change-Id: Ie3cf0a172dc1ba0b865cf30c2962e7cfd9ad8436
/frameworks/base/core/java/android/app/ActivityThread.java
6e02fa01a023cea148e87899c9bdedf12c46075e 06-Aug-2015 Wale Ogunwale <ogunwale@google.com> Merge changes I4fc1b47e,Icc6d6b25,I8c6bb864

* changes:
Support for an activity to change and/or query it's associated stack
Support creating/launching a task with non-fullscreen bounds
Support finishing a task with any finishing activity in the task.
a1a9644529292e531d5dbccdaeac1399544aff1a 06-Aug-2015 Dianne Hackborn <hackbod@google.com> am 74423ccf: am aacc7978: am 41dfffb3: am db6a6a21: am 6b0f1e78: Merge "Fix issue #22843150: fragment transaction crash from onRequestPermisssionResult" into mnc-dev

* commit '74423ccf95c9d09a52a6a6fbe8ccedb1be88eda9':
Fix issue #22843150: fragment transaction crash from onRequestPermisssionResult
74423ccf95c9d09a52a6a6fbe8ccedb1be88eda9 06-Aug-2015 Dianne Hackborn <hackbod@google.com> am aacc7978: am 41dfffb3: am db6a6a21: am 6b0f1e78: Merge "Fix issue #22843150: fragment transaction crash from onRequestPermisssionResult" into mnc-dev

* commit 'aacc797809e5bf2c02735cb3a7d92c5ccefb5116':
Fix issue #22843150: fragment transaction crash from onRequestPermisssionResult
ba7881c89e7dd50aa537e70f0b96273e131dd08e 02-Aug-2015 Wale Ogunwale <ogunwale@google.com> Support finishing a task with any finishing activity in the task.

Change-Id: I8c6bb864de6dc135e0fedb16ee424d7816ee3cfa
/frameworks/base/core/java/android/app/ActivityThread.java
6bdd3a155fe380735d4108ddcc50b156c62406d0 06-Aug-2015 Dianne Hackborn <hackbod@google.com> Fix issue #22843150: fragment transaction crash from onRequestPermisssionResult

Add new Activity callback to tell it when its saved state has
been invalidated.

The problem is that delivering the permission result does not go
through a path where the compatibility code can see it first to
mark its fragment manager as no longer having saved state. So this
new callback gives it a place to do that.

Change-Id: I5a4a185d9c746bae1afb5c588aba82c8daccf079
/frameworks/base/core/java/android/app/ActivityThread.java
f8cc20031e7772aed25c95046929ef7a258df209 14-Jul-2015 Mathieu Chartier <mathieuc@google.com> am 82f91da7: am ad4a285a: am ebac4d1b: Merge "Change conditionallyCheckInstanceCounts to use countInstancesOfClasses"

* commit '82f91da700445c4606faea45ac8f0dc9f2857471':
Change conditionallyCheckInstanceCounts to use countInstancesOfClasses
82f91da700445c4606faea45ac8f0dc9f2857471 14-Jul-2015 Mathieu Chartier <mathieuc@google.com> am ad4a285a: am ebac4d1b: Merge "Change conditionallyCheckInstanceCounts to use countInstancesOfClasses"

* commit 'ad4a285af619ea29f79dbe4da19061c49f24a8c9':
Change conditionallyCheckInstanceCounts to use countInstancesOfClasses
d288a266723e18d846ea1215919f7a377504225b 10-Jul-2015 Mathieu Chartier <mathieuc@google.com> Change conditionallyCheckInstanceCounts to use countInstancesOfClasses

countInstancesOfClasses allows passing multiple classes unlike
countInstanceOfClass. This provides a speedup since we dont traverse
the heap multiple times.

Changed ActivityThread.dumpMemInfo to do a GC since countInstancesOfClass
no longer does GC before counting.

https://code.google.com/p/android/issues/detail?id=177552

Change-Id: Ia85684f40cf59a52aa71a8479c711a994651209b
/frameworks/base/core/java/android/app/ActivityThread.java
b6fbe91a02c2d4a03ff65f37ec10d5b95a0792e7 10-Jul-2015 Dianne Hackborn <hackbod@google.com> am 782e31df: am 2dc2cdc0: am 1dfeb0b2: am d0e005de: am 0e7d497c: Merge "Fix issue #22328792: Fix scalability issues in AssistStructure" into mnc-dev

* commit '782e31dfcc448eaaab814fd76f42c3390a952037':
Fix issue #22328792: Fix scalability issues in AssistStructure
782e31dfcc448eaaab814fd76f42c3390a952037 10-Jul-2015 Dianne Hackborn <hackbod@google.com> am 2dc2cdc0: am 1dfeb0b2: am d0e005de: am 0e7d497c: Merge "Fix issue #22328792: Fix scalability issues in AssistStructure" into mnc-dev

* commit '2dc2cdc026e8494c09f0cc44205cf22f513b78eb':
Fix issue #22328792: Fix scalability issues in AssistStructure
782d49826862cbdc9d020fc9d85f8a6f64675dcb 09-Jul-2015 Dianne Hackborn <hackbod@google.com> Fix issue #22328792: Fix scalability issues in AssistStructure

We can now stream the AssistStructure across processes, avoiding
IPC size limitations for large structures. There is also a new
API that gets called on the VoiceInteractionSession if there is
a failure retrieving the assist data.

Also fix issue #22351981: Runtime restart due to ANR in system server,
getting rid of a deadlock.

And also tweak object lifecycles to try to avoid keeping around
in an app the previous AssistStructure after we request a new one.

Change-Id: Ifb136a0d31a14e56a8db6b90768d9fc65557a17f
/frameworks/base/core/java/android/app/ActivityThread.java
80bea9cde179e37def61748ff0e68b4155b5360c 25-Jun-2015 Man Cao <manc@google.com> resolved conflicts for merge of 8fb82074 to master

Change-Id: I27c7ddeead5a589ae8824f87bf6b42998dc081eb
8fb8207412905d034305b4b1be6eac07bdac833f 25-Jun-2015 Mathieu Chartier <mathieuc@google.com> resolved conflicts for merge of 0f14548c to mnc-dev-plus-aosp

Change-Id: I2f79840f82150eddebfbd549afd1eca28075eb43
cfa78b2080e590ca3b28dbf59e6d6f6e7ece7764 12-Jun-2015 Man Cao <manc@google.com> Add an AM option to start with allocation tracking

The new option "--track-allocation" is to work with the new
allocation tracker in ART.

Bug:20037135
Change-Id: Ic5f8945ab4c1f167c27b05ad0d11d04bac680c1f
/frameworks/base/core/java/android/app/ActivityThread.java
8ee0c2cf24cc4de0abe7114c189051277568f7f1 23-Jun-2015 Rahul Chaturvedi <rkc@google.com> Merge "Add binder transaction tracking."
52613f9084f40100021fbf21173bda329a2d5cc3 18-Jun-2015 Rahul Chaturvedi <rkc@google.com> Add binder transaction tracking.

Add the ability to am to be able to track binder transact calls. This
will help us diagnose excessive IPC calls.

This CL adds the trace-ip command to am. The usage is,

To start binder transaction tracking,
am trace-ipc start
To stop tracking and dump the data to a file,
am trace-ipc stop --dump-file <FILE>

Bug: 21398706
Change-Id: Ic0c9b3be757dd0662a2750a0d8447e2a5ef1fa90
/frameworks/base/core/java/android/app/ActivityThread.java
fbb32f6440ed74a4d27eec03569520580d00da42 12-Jun-2015 Narayan Kamath <narayan@google.com> Better systrace slices for application startup.

This change adds three new timeslices :

- PostFork : As soon as possible after the app forks from the
zygote. Can be used in conjunction with the system_server
"Start proc:" event to derive an upper bound on fork() and
zygote overhead.

- RuntimeInit & ActivityThreadMain for ZygoteInit#runtimeInit
and ActivityThread#main.

ActivityThread#handleBindApplication and higher level functions
are already well instrumented in systrace. handleBindApplication
should occur immediately after ActivityThread#main.

Note that we use the Activity manager tag to make it easier to
correlate these new events with surrounding events (Start proc
and handleBindApplication) that are already using the AM tag.

bug: 21632700
Change-Id: Ibc01f1721f962c913f3c02a51763b6feb1eb6a4d
/frameworks/base/core/java/android/app/ActivityThread.java
a3acdb33df7c7be7ff3d9f376ff833e4b0c1d897 09-Jun-2015 Dianne Hackborn <hackbod@google.com> Fix issue #21621920: VI: need mechanism to get current request

Add new APIs to associate a Request with a name, get all active
requests, and get active request by name.

Also add a new Activity.onProvideReferrer() which will allow
applications to propagate referrer information to the assistant
(and other apps they launch) in a consistent way.

Change-Id: I4ef74b5ed07447da9303a74a1bdf42e4966df363
/frameworks/base/core/java/android/app/ActivityThread.java
d8b9b642feab52523ec6db7b170b08f1bc74b004 08-Jun-2015 Wale Ogunwale <ogunwale@google.com> Merge "Use DisplayAdjustments when creating display in ResourceManager" into mnc-dev
26698514fbac587675221149aca98f3ea6414d55 06-Jun-2015 Wale Ogunwale <ogunwale@google.com> Use DisplayAdjustments when creating display in ResourceManager

We were previous only taking the Configuration into account when
creating Display objects in the ResourceManager. This led to the
Display object not containing critical CompatibilityInfo. We now
take the entire DisplayAdjustment into account.

Bug: 21637615
Change-Id: Ide5ff49bfa12791ad17993764f312836216b1dd8
/frameworks/base/core/java/android/app/ActivityThread.java
cd70c64f50be9e20c926a82bab3e9a737b05e464 05-Jun-2015 Adam Skory <skory@google.com> Record provision of custom Intents in AssistContent

Simplifies behavior wrt automatically setting the
web URI for ACTION_VIEW Intents, by not doing so
for custom Intents.

Adds a boolean isAppProvidedIntent() as a signal for
recepients of the AssistContent that a custom Intent
was provided. Custom Intents are more likely to be
relevant.

Change-Id: Ibe4bfa040eba904411b9820ab4ddfcf509413829
/frameworks/base/core/java/android/app/ActivityThread.java
733f147401f180b14acb13137cf99e65da1d72cc 05-Jun-2015 Wale Ogunwale <ogunwale@google.com> Merge "Always have a handler for PendingIntents sent in the system process" into mnc-dev
9a6ef1e94c2c7cd937a6af668b33988057042520 02-Jun-2015 Wale Ogunwale <ogunwale@google.com> Always have a handler for PendingIntents sent in the system process

It is possible for deadlocks to occur when sending/processing
PendingIntents due to components like AMS holding global service
locks when dispatching the broadcast without specifying an
handler and the receiver calling back into AMS.

We now set a default handler to process the broadcast on if we
are in the system process and a handler wasn't specified.

Bug: 19502993
Change-Id: Iccde32c6c1df997784155bc41ef39e52ee0f7243
/frameworks/base/core/java/android/app/ActivityThread.java
69c6adc96eecfde74ceb83cf9177428dc08b6067 02-Jun-2015 Dianne Hackborn <hackbod@google.com> More API changes.

Start moving Assist* stuff to android.app.assist.

Clean up some more of the VoiceInteractionSession APIs.

Clearly document that finish() is not the same as hide(),
always call hide() instead, and fix the finish() path to
also always do a hide to make sure everything is cleaned
up correctly.

Change-Id: I962d4069fcb34fe89547a95d395ae1b9fa3b4148
/frameworks/base/core/java/android/app/ActivityThread.java
09d57fe9b357495b7bc62be39a8befa00d9d7ffb 28-May-2015 Dianne Hackborn <hackbod@google.com> Add new API to set URI on AssistContent.

Also rework how we transfer AssistContent and AssistStructure
to the assistant, so they are delivered as completely separate
objects rather than the kludgy bundling them in the assist
data thing.

Change-Id: Ib40cc3b152bafeb358fd3adec564a7dda3a0dd1d
/frameworks/base/core/java/android/app/ActivityThread.java
c1a9436d27e41347e6063b1cfb77eaef7e191ca4 19-May-2015 Paul Jensen <pauljensen@google.com> Merge "Query HTTP proxy for network via a new API to avoid permissions exceptions" into mnc-dev
cee9b51c4beec4494d78bab784ba7e7e20c30e31 06-May-2015 Paul Jensen <pauljensen@google.com> Query HTTP proxy for network via a new API to avoid permissions exceptions

Add @hidden ConnectivityManager.getProxyForNetwork() API.

Bug:20470604
Change-Id: I6a9bc4afc8273bc43b14cdeccfedbbf3ff66be40
/frameworks/base/core/java/android/app/ActivityThread.java
dcdaf87ed0aa99073638bcfe645949f130f0c7ad 14-May-2015 Alex Klyubin <klyubin@google.com> Move Android Keystore impl to android.security.keystore.

This moves the non-public API classes backing Android Keystore from
android.security to android.security.keystore, a package specially
created for Android Keystore.

Bug: 18088752
Change-Id: Ibf04d6a26c54d310b0501fc5e34f37b1176324ad
/frameworks/base/core/java/android/app/ActivityThread.java
c14b9cf628471f4f3b34d7c91ef193326eff92c6 13-Mar-2015 Richard Uhler <ruhler@google.com> Add 'App Summary' section to meminfo.

The 'App Summary' section is shown by default when other memory
details are shown. This adds a new meminfo flag '-s' to show only the
App Summary section.

Change-Id: I66913673cd3afca873a8b13e45abe071d4c57b82
/frameworks/base/core/java/android/app/ActivityThread.java
e54d245b993e1347cb32c23a6bdc907a45fab324 06-May-2015 Alan Viverette <alanv@google.com> Improve keying for theme caches, rebase system theme on config change

Themes now use an array of applied styles rather than a String to store
their history. They are keyed based on a hash code computed from the
history of applied styles. The themed drawable cache has been abstracted
out into its own class.

Also updates system context to use DayNight as the default and ensures
that GlobalActions uses the correct context, which exercises the change.

CTS tests have been added in another CL.

Bug: 20421157
Change-Id: I9eb4b7dffd198ad24d02f656eaf0839570b59caa
/frameworks/base/core/java/android/app/ActivityThread.java
fbf0ecabac5d7a929628b43ffe8f4f953e47bd54 02-May-2015 Svetoslav <svetoslavganov@google.com> Add camera app op - framework

Change-Id: I17736a8abe2c6775e990b88fb3eab963f47167d0
/frameworks/base/core/java/android/app/ActivityThread.java
4812563f68c87278af68309662433279d10f573e 29-Apr-2015 Alex Klyubin <klyubin@google.com> AndroidKeyStore keys should not be handled by Bouncy Castle.

Bouncy Castle JCA provider incorrectly declares that its Cipher, Mac,
Signature, and KeyAgreement implementations accept arbitrary keys (
including AndroidKeyStore keys). As a result, when a Cipher, Mac,
Signature, or KeyAgreement instance is requested from JCA without
explicitly specifying the provider (which follows best practices)
and then initialied with an AndroidKeyStore key, JCA chooses the
BouncyCastle's implementation, which in turn blows up because it
can't handle such keys.

The workaround is to install Cipher, Mac, Signature, and
KeyAgreement implementations backed by AndroidKeyStore as a
higher-priority JCA provider than the Bouncy Castle one. This is
achieved by splitting out the above implementations from
AndroidKeyStoreProvider into AndroidKeyStoreBCWorkaroundProvider
and installing the AndroidKeyStoreProvider at the usual priority
(below Bouncy Castle) and the AndroidKeyStoreBCWorkaroundProvider
at above Bouncy Castle priority.

Bug: 20691708
Change-Id: I336464f4a49bc30c6845ddc4e84b07f4105424dd
/frameworks/base/core/java/android/app/ActivityThread.java
584e513952a28fb5d926fccc4ed640f48ee758d4 25-Apr-2015 Wale Ogunwale <ogunwale@google.com> am cc9c597d: am d639a453: am e60077e6: Merge "Revert "[ActivityManager] Improve multi-thread access the same provider""

* commit 'cc9c597dad6d99242ed2903d8760922f66223401':
Revert "[ActivityManager] Improve multi-thread access the same provider"
169364c1e5d1a8f31ba8c85321c836c35ad57ba4 25-Apr-2015 Wale Ogunwale <ogunwale@google.com> am 4cdc7e84: am e2047da6: am d9bf2652: Merge "Revert "Clean-up state if we have an exception when acquiring provider""

* commit '4cdc7e842d8b1ff1e70d2a0b4a2a1939fa116563':
Revert "Clean-up state if we have an exception when acquiring provider"
d639a4532417bf605f03b3b5efdb3a9e1cbe6661 25-Apr-2015 Wale Ogunwale <ogunwale@google.com> am e60077e6: Merge "Revert "[ActivityManager] Improve multi-thread access the same provider""

* commit 'e60077e62a441dbcc132b2abb35d998ab48d261c':
Revert "[ActivityManager] Improve multi-thread access the same provider"
e2047da6f3f21fc702d35b7d1c4e9bb62c963dac 25-Apr-2015 Wale Ogunwale <ogunwale@google.com> am d9bf2652: Merge "Revert "Clean-up state if we have an exception when acquiring provider""

* commit 'd9bf26522b930a8d5d25f6e28c390e39fee6d0b2':
Revert "Clean-up state if we have an exception when acquiring provider"
1d646128b2a80b1b223b0bfa1168605a30fe56f8 24-Apr-2015 Wale Ogunwale <ogunwale@google.com> Revert "[ActivityManager] Improve multi-thread access the same provider"

This reverts commit 57307b21cbdb261eeca081051ed61540dcf905f8.

Bug: 20091132
/frameworks/base/core/java/android/app/ActivityThread.java
67fe0a450c8e1405b23f1c803e44c9ce42299bf8 24-Apr-2015 Wale Ogunwale <ogunwale@google.com> Revert "Clean-up state if we have an exception when acquiring provider"

This reverts commit 73e239bdc9493d81215d5afe739b3ed095686ba2.

Bug: 20091132
/frameworks/base/core/java/android/app/ActivityThread.java
4aaed145f8331b73f39617bd1fee73664cb0c90b 22-Apr-2015 Adam Skory <skory@google.com> nullcheck Activity.getIntent() for AssistContent

Nothing stopping an Activity from giving us a
null Intent, and the Intent copy constructor
requires a non-null arg.

Bug: 20419159
Change-Id: I8b12a127431869394697e947e2298d4dbbe08604
/frameworks/base/core/java/android/app/ActivityThread.java
0a9bce976ae6f46cbd0e75cc857480c4d117acad 13-Apr-2015 Wale Ogunwale <ogunwale@google.com> am 110919d9: am bd59764a: am 8f0e0c1f: Merge "Clean-up state if we have an exception when acquiring provider"

* commit '110919d9952a60eb9a2ff1696f3e13818428ee6a':
Clean-up state if we have an exception when acquiring provider
bd59764a2c20deeebe945c5008abf9a62df09a1e 13-Apr-2015 Wale Ogunwale <ogunwale@google.com> am 8f0e0c1f: Merge "Clean-up state if we have an exception when acquiring provider"

* commit '8f0e0c1f3d7c02dff6fe4877477af583e490e6ee':
Clean-up state if we have an exception when acquiring provider
d4ea01b4aca807cc914a96addefcc2c64ce1a6f5 12-Apr-2015 Prerepa Viswanadham <dham@google.com> Merge "Merge commit 'e593d0a' into merge_work"
6036cd51265d31c08eefe0470a9f37e7f757aae8 11-Apr-2015 Jeff Sharkey <jsharkey@android.com> Merge "Support moving apps to expanded storage."
57bf2a8a38e929f00f3323cf97a8ea7a9af900ce 11-Apr-2015 Prerepa Viswanadham <dham@google.com> Merge commit 'e593d0a' into merge_work

Change-Id: I4f8ae40fc446cd9cda4d5c6ec99469a98dda595b
73e239bdc9493d81215d5afe739b3ed095686ba2 10-Apr-2015 Wale Ogunwale <ogunwale@google.com> Clean-up state if we have an exception when acquiring provider

We can get a number of exceptions (e.g. SecurityException) when
a process is acquiring a provider. We need to clean-up correctly
so that other threads that try to acquire the provider the progress.

Bug: 20122809
Change-Id: Icac1d391df7e8c24198be89035b1c5a23da834cf
/frameworks/base/core/java/android/app/ActivityThread.java
7f062245f633b8b987ef79ed5d49ead58ca2f562 08-Apr-2015 Narayan Kamath <narayan@google.com> Create DropboxService lazily.

We seldom use it from libcore.io.DropBox so there's not much point
(there's only one usage, from a conscrypt SSL error). This saves > 10ms
from ActivityThread.attach.

Change-Id: I360158ef9a36a9ababd700e4f3243c92b74047eb
/frameworks/base/core/java/android/app/ActivityThread.java
b9f3674c11ed9c89b80a69f728cbc5f540b2ecde 09-Apr-2015 Jeff Sharkey <jsharkey@android.com> Support moving apps to expanded storage.

Start deriving the data path for apps based on the volume UUID where
the app lives. This path is used for all higher-level APIs, giving
us a clean place to switch app storage.

When parsing a package, keep track of the volume UUID where it lives
and update PackageSetting once installed. For now continue treating
moves as installs, but we'll eventually clean this up to avoid the
additional dexopt pass. Wire up move to use the new installd command
to move private data between devices.

Cache LoadedApk only for the current user, since otherwise the data
dir points at the wrong path.

Bug: 19993667
Change-Id: I53336e3b147d5fd3130e6800869af172b628da37
/frameworks/base/core/java/android/app/ActivityThread.java
b6b17a575fa844b74d7673a41481ff4db6273ed8 07-Apr-2015 Stephen Hines <srhines@google.com> resolved conflicts for merge of 764f08ad to master

Change-Id: I0a22225b2d26b6d806de2dcc70ffba29c96865b3
d782c57d376f27e511692ac6259759dd5a0bdced 07-Apr-2015 Tim Murray <timmurray@google.com> am 5352411a: Merge "Move cache dir to its own class."

* commit '5352411a8c41dd1c3c51a28cdd0b09f42e246b33':
Move cache dir to its own class.
e1e6c66198e628f0784e1731bbdb775da479075b 07-Apr-2015 Tim Murray <timmurray@google.com> Move cache dir to its own class.

This prevents us from loading the RS static initializer all the time.

Change-Id: I8cea7540e50251aba8c2f199f06f344f991e7d7f
/frameworks/base/core/java/android/app/ActivityThread.java
72db88e46fba5f2581eb21c042dc79887cda1c10 10-Mar-2015 Paul Jensen <pauljensen@google.com> Deprecate static ConnectivityManager.get/setProcessDefaultNetwork() functions.

These functions risk hitting an unchecked Exception due to ConnectivityManager
not being instantiated yet. Also, change Network.openConnection() to throw a
checked Exception rather than an unchecked Exception when ConnectivityManager
is not yet instantiated.

bug:19416463
Change-Id: Ie1e2b3238aec0343d267c76b64927073f2f05f85
/frameworks/base/core/java/android/app/ActivityThread.java
78c926c9a3ee2a513bff08ca3e6276eafeebc531 01-Apr-2015 Olawale Ogunwale <ogunwale@google.com> am bcfa7cb2: am 259a649a: am 6091dcbb: Merge "[ActivityManager] Improve multi-thread access the same provider"

* commit 'bcfa7cb2508eb6f606aeef4c6cb44eaf9be07ccf':
[ActivityManager] Improve multi-thread access the same provider
259a649a935ca2ed63419a079211b0ac35f67496 01-Apr-2015 Olawale Ogunwale <ogunwale@google.com> am 6091dcbb: Merge "[ActivityManager] Improve multi-thread access the same provider"

* commit '6091dcbb80d3b1b885b6e02386ccb3139e5e43ae':
[ActivityManager] Improve multi-thread access the same provider
57307b21cbdb261eeca081051ed61540dcf905f8 01-Apr-2015 riddle_hsu <riddle_hsu@htc.com> [ActivityManager] Improve multi-thread access the same provider

Application may use many threads to load data from provider.
If the target provider needs to start process, each access
will occupy one binder thread of system server until the
provider process started and published.

Sometimes application uses more than 16 threads to access
the same provider, and the provider process needs a little
long time to start, then all binder threads of system server
are waiting. But when the provider is ready, it is unable to
publish to notify those waiting threads because no availabe
binder thread to use. And device will become almost hang.

Improvement:
If there is already a thread acquiring provider, let other threads
(which try to acquire the same provider) wait the result of the
first one. That reduces IPC to save binder thread of system server.

Remove calling removeContentProvider in installProvider because
we have ensured only get one provider holder for the same provider,
the original race that gets a new useless holder will not happen.

Change-Id: I521f2603db8ced56912f5dc54342a70451e68381
/frameworks/base/core/java/android/app/ActivityThread.java
afa10ad39a7effd964d6afc83dab891e98856e1d 22-Mar-2015 Alex Klyubin <klyubin@google.com> am 2110a28a: am a4c4c575: Merge "Add android.security.NetworkSecurityPolicy."

* commit '2110a28a6c7ef7d7802028d0a2dd9c14ceb432e1':
Add android.security.NetworkSecurityPolicy.
2110a28a6c7ef7d7802028d0a2dd9c14ceb432e1 20-Mar-2015 Alex Klyubin <klyubin@google.com> am a4c4c575: Merge "Add android.security.NetworkSecurityPolicy."

* commit 'a4c4c575c793d3ba4847107b15ce3a9dd5395878':
Add android.security.NetworkSecurityPolicy.
f9034cc4ae5a7d0ee67d505f46208384f9babf1c 12-Feb-2015 Alex Klyubin <klyubin@google.com> Add android.security.NetworkSecurityPolicy.

The initial purpose of the NetworkSecurityPolicy class is to provide a
way for network libraries to check whether cleartext network traffic
(e.g., HTTP, WebSockets, XMPP, IMAP, SMTP) should be blocked from this
process.

The policy is set declaratively by the app developer in the app's
manifest and can be queried from ApplicationInfo.flags. Unfortunately,
several network stacks (bundled and unbundled) do not have a reference
to ApplicationInfo or Context.

Alternatives:
* Keep this API hidden (and thus potentially move it from framework to
libcore), thus precluding unbundled HTTP stacks from using the API.
* Introduce a new java.lang.System property instead of this API.
However, such properties are a mess and not as powerful/extensible
as a public class.

Bug: 19215516
Change-Id: If22056a74d257bf1d805ebb4fc284240b3d338f1
/frameworks/base/core/java/android/app/ActivityThread.java
a83ce1dd2ad3a6b71e90ff4845afc1299fe17b9d 11-Mar-2015 Dianne Hackborn <hackbod@google.com> More work on collecting assist data.

Optimize parceling of AssistData (which is now renamed to
AssistStructure) by pooling duplicated class name strings.

Change text associated with a view node to a CharSequence,
so styling information comes along.

Include global text attributes -- size, colors, etc.

Introduce a new AssistContent structure, which allows us
to propagate information about the intent and data the
activity is looking at. This further allows us to propagate
permission grants, so the assistant can dig in to that data.
The default implementation propagates the base intent of an
activity, so if for example you bring up the assistant while
doing a share the assistant itself has the same information
and access that was given to the share activity (so it could
for example share it in another way if it wanted to).

Did some optimization of loading PersistableBundle from xml,
to avoid duplicating hash maps and such.

Changed how we dispatch ACTION_ASSIST to no longer include
the more detailed AssistStructure (and new AssistContent)
data when launching; now the example code that intercepts
that needs to be sure to ask for assist data when it starts
its session. This is more like it will finally be, and allows
us to get to the UI more quickly.

Change-Id: I88420a55761bf48d34ce3013e81bd96a0e087637
/frameworks/base/core/java/android/app/ActivityThread.java
967567541a22b6c474fe22be5c8f064359f5ee90 08-Mar-2015 Andreas Gampe <agampe@google.com> am 208e80d9: am a3d5b230: am cdc19f3f: Merge "Frameworks/base: Remove unnecessary Pattern instance"

* commit '208e80d931fd775de925529e0c36a34e9b7f916a':
Frameworks/base: Remove unnecessary Pattern instance
208e80d931fd775de925529e0c36a34e9b7f916a 08-Mar-2015 Andreas Gampe <agampe@google.com> am a3d5b230: am cdc19f3f: Merge "Frameworks/base: Remove unnecessary Pattern instance"

* commit 'a3d5b2304cf2db03ba728d37c87ef7360c7da44f':
Frameworks/base: Remove unnecessary Pattern instance
a3d5b2304cf2db03ba728d37c87ef7360c7da44f 07-Mar-2015 Andreas Gampe <agampe@google.com> am cdc19f3f: Merge "Frameworks/base: Remove unnecessary Pattern instance"

* commit 'cdc19f3f8a20b975e8e70f4b4cce5ce2be811726':
Frameworks/base: Remove unnecessary Pattern instance
b9a5e4ad30c9add140fd13491419ae66e947809d 04-Mar-2015 Dianne Hackborn <hackbod@google.com> Add new debug feature to automatically create heap dumps.

Not yet working, unless you turn off SELinux enforcing.
We need to update SElinux to allow the system process
to give apps access to /data/system/heapdump/javaheap.bin.

Currently watching can only be enabled through the shell,
such as:

adb shell am set-watch-heap com.android.systemui 1024

The last number is the process pss size in bytes, so this is
asking us to warn if it goes about 1K which will be all the
time.

Change-Id: I2089e5db2927afca0bf01a363c6247ee5dcb26e8
/frameworks/base/core/java/android/app/ActivityThread.java
18e99c128848d1467205222fc97f76056da54159 07-Mar-2015 Andreas Gampe <agampe@google.com> Frameworks/base: Remove unnecessary Pattern instance

Using a static Pattern in ActivityThread prevents compile-time
initialization of ActivityThread and GestureDetector, which depends
on the former.

It is also not efficient, as String.split has a fast path for simple
splits.

Bug: 19542228

Change-Id: I5bb843c08c81e0d259bb8afafa87a8467bb1730e
/frameworks/base/core/java/android/app/ActivityThread.java
ba6adf66d3c44c0aa2fd8a224862ff1901d64300 19-Feb-2015 John Reck <jreck@google.com> Initial attempt at jank-tracking stat collection

Is a bit naive, perhaps overly aggressive, but sorta works

Change-Id: I01a774e00dbe681439c02557d9728ae43c45ce50
/frameworks/base/core/java/android/app/ActivityThread.java
0233aee840ac7e4a934cc69f97f280682d13a788 18-Feb-2015 Wale Ogunwale <ogunwale@google.com> Merge "Fixed NPE in ResourceManager when Activity.recreate is called."
93f543ca98636a6d2552e960690294578ec37f30 18-Feb-2015 Wale Ogunwale <ogunwale@google.com> Fixed NPE in ResourceManager when Activity.recreate is called.

Bug: 19408756
Change-Id: I291badce7fe9a6feaf2a5e8ce1005e6a86b30147
/frameworks/base/core/java/android/app/ActivityThread.java
2007a630d4767b4e90f8ed727acd574424c2183c 18-Feb-2015 Craig Mautner <cmautner@google.com> am 28de8edb: am ab8f60e4: am a94e4297: Merge "Do not make ActivityContainer available to apps. DO NOT MERGE" into lmp-mr1-dev

* commit '28de8edb7d72f938f47d7fdd8ce058c5c8933b8e':
Do not make ActivityContainer available to apps. DO NOT MERGE
ca0653a424f9d0f64ad15236c882af2b8ed2fe00 17-Feb-2015 Craig Mautner <cmautner@google.com> Do not make ActivityContainer available to apps. DO NOT MERGE

A security leak was discovered whereby a malicious app could get the
IActivityContainer object from one app and use it to inject events
into another app. This fix removes the availability of the
IActivityContainer and replaces its one use with a method for
returning the information the IActivityContainer was used for.

Fixes bug 19394591.

Change-Id: Ib3cec25b25130cd8e098892c057742cfd575cfdd
/frameworks/base/core/java/android/app/ActivityThread.java
aa7e3ed94772be38a1f08a71551b9babdd625f46 17-Feb-2015 Craig Mautner <cmautner@google.com> Do not make ActivityContainer available to apps.

A security leak was discovered whereby a malicious app could get the
IActivityContainer object from one app and use it to inject events
into another app. This fix removes the availability of the
IActivityContainer and replaces its one use with a method for
returning the information the IActivityContainer was used for.

Fixes bug 19394591.

Change-Id: Ib3cec25b25130cd8e098892c057742cfd575cfdd
/frameworks/base/core/java/android/app/ActivityThread.java
7c72668f19d404b01412abc67937b1b5c660df71 07-Feb-2015 Wale Ogunwale <ogunwale@google.com> Adjust activity display metrics based on stack configuration.

Apps normally use context.getResources().getDisplayMetrics()
or getWindowManager().getDefaultDisplay() to get information
about the screen dimensions. Not all the screen space is available
for apps in a multi-window environment, so we limit the dimensions
of the display object exposed to the app to that of the containing
stack.

Bug: 19225079
Bug: 19354838
Change-Id: I8dc3a6c9b99ecedcca28fc4ddaba9f31feb4f871
/frameworks/base/core/java/android/app/ActivityThread.java
21761bc5de357aa5cf23f2f914b8e4e67a02432b 11-Feb-2015 Pirama Arumuga Nainar <pirama@google.com> am 0cc09449: Merge "Store compiled code in Context.getCodeCacheDir()" automerge: 3fbbe39 automerge: 1641e19

* commit '0cc09449b6b1e418a7d04590e28d1336694230ba':
Store compiled code in Context.getCodeCacheDir()
0cc09449b6b1e418a7d04590e28d1336694230ba 11-Feb-2015 Pirama Arumuga Nainar <pirama@google.com> Merge "Store compiled code in Context.getCodeCacheDir()" automerge: 3fbbe39
automerge: 1641e19

* commit '1641e192a82e266159e0b82078a8f98ebcd3d8ff':
Store compiled code in Context.getCodeCacheDir()
51772b7601b7540be6ff4069dda2b83f057c7ce4 10-Feb-2015 Pirama Arumuga Nainar <pirama@google.com> Store compiled code in Context.getCodeCacheDir()

bug 16345623

Use Context.getCodeCacheDir for EGL shader cache and RenderScript
compiled code.

Change-Id: I54c4e43674bd1f9342ae13059cb8899f4a3f4734
/frameworks/base/core/java/android/app/ActivityThread.java
c2607b4ececbefd18f223fa89d1b1aac56516009 08-Feb-2015 Wale Ogunwale <ogunwale@google.com> Include stack override configurations in onConfigurationChanged() call.

Important for activities that handle configuration changes.

Change-Id: I4d1612026f293fbb99e1abc17e663f0215658ae6
/frameworks/base/core/java/android/app/ActivityThread.java
60454dbc4d815c90ff2713e224953d6547fc3ad5 24-Jan-2015 Wale Ogunwale <ogunwale@google.com> Support activities in the same process having different resources.

Activities can be of various sizes in a multi-window environment.
This change allows them to have override configurations that allows
different resources to the loaded if needed.

Bug: 19002213
Change-Id: Ib2c7be0b427f5ce05e7a362bcdd496ddbc9164f0
/frameworks/base/core/java/android/app/ActivityThread.java
7b15552692bcccf0c413ed225a6d29461c1ee51e 21-Jan-2015 Craig Mautner <cmautner@google.com> Merge "Refactor removeApp and removeTask for last removals."
e3119b7d353e71d1f94ddff932b722b4d285931e 21-Jan-2015 Craig Mautner <cmautner@google.com> Refactor removeApp and removeTask for last removals.

Move app token removal to the AppWindowToken class so cleanup can
be done locally. Move task removal to the Task class so cleanup can
be done locally. Call task removal when the last app is removed.
Merge actions done prior to method calls into methods.

Fixes bug 18088522 item #12.

Change-Id: I5ce85d2bb309ceb82bd7404e27a56a7c31cd7359
/frameworks/base/core/java/android/app/ActivityThread.java
f6b4b1a43253d5ea94763cf9750224c7b7b618c0 21-Jan-2015 Dianne Hackborn <hackbod@google.com> Merge "Work on issue #18201239: ANRs in com.google.process.gapps:" into lmp-mr1-dev automerge: 2132695
automerge: 5346a21

* commit '5346a21bad95796611760d40c1540d1659038216':
Work on issue #18201239: ANRs in com.google.process.gapps:
455625e298204a27d3958eb56ff155f27562eec8 21-Jan-2015 Dianne Hackborn <hackbod@google.com> Work on issue #18201239: ANRs in com.google.process.gapps:

Reason: Executing service com.google.android.syncadapters.contacts
/.SyncHighResPhotoIntentService

Make the code more robust when destroying services, so that if
the nesting count gets out of sync we don't just hang.

Change-Id: If117d5ef242e7c148fd9576bd89a1a092583d6ad
/frameworks/base/core/java/android/app/ActivityThread.java
62e815bf7b154fe984e1a2aa8d615a2f04f71785 16-Jan-2015 Craig Mautner <cmautner@google.com> am 02c7c97a: am ac70b2d1: Merge "More debugging for bug 18201239." into lmp-mr1-dev

* commit '02c7c97a62ba9b79e56d1f7e206615e6eaca0689':
More debugging for bug 18201239.
66c4a824b9b11a47c7bd1bf858d92fe207409ab9 16-Jan-2015 Craig Mautner <cmautner@google.com> More debugging for bug 18201239.

Fixes bug 19045133.

Change-Id: I2ef2b8600278ed91df59db4acf4740dac970ee3a
/frameworks/base/core/java/android/app/ActivityThread.java
c2ae6fb9ada52e9c990542a6d1cae80085318f31 16-Jan-2015 Jeff Sharkey <jsharkey@android.com> Merge commit '605eb79c9519307147fc1795d0eb155638a7f542' into manualmerge

Change-Id: Id6db8cce3a477572478a1d50f624823200848896
605eb79c9519307147fc1795d0eb155638a7f542 04-Nov-2014 Jeff Sharkey <jsharkey@android.com> Offer to detect non-SSL/TLS network traffic.

Introduces new module that provides network-related features for
the StrictMode developer API. The first feature offers to detect
sockets sending data not wrapped inside a layer of SSL/TLS
encryption.

When a developer enables, we ask netd to watch all outgoing traffic
from our UID, and penalize us accordingly if cleartext sockets are
detected. When enabled, netd captures the offending packet and
passes it back to the owning process to aid investigations. When
death penalty is requested, all future traffic on the socket is
blocked, which usually results in a useful stacktrace before the
app is actually killed.

Bug: 18335678
Change-Id: I3adbc974efd8d3766b4b1a23257563bb82d53c29
/frameworks/base/core/java/android/app/ActivityThread.java
b523c55d76ef3215538158a65bdea70c9897993e 16-Jan-2015 Craig Mautner <cmautner@google.com> am 41d54237: am 92cf3608: Merge "Debug for bug 18201239." into lmp-mr1-dev

* commit '41d54237380d5f3c06ab2a71715e22f048278ecf':
Debug for bug 18201239.
9776ad41b900c6c7da0a3b6baf91b609be27f9b9 15-Jan-2015 Craig Mautner <cmautner@google.com> Debug for bug 18201239.

Change-Id: I06281bd76b8c1d887324d3efa39b6cb11c9e71ae
/frameworks/base/core/java/android/app/ActivityThread.java
19c549fc735bf8a1df5cccb6cc0cdf46c7d242a4 13-Jan-2015 Craig Mautner <cmautner@google.com> am 1e263d3f: am 66b4d484: Merge "Prevent system server dump stuck by pipe buffer full."

* commit '1e263d3f140e90966790875a815f23c92550f2f2':
Prevent system server dump stuck by pipe buffer full.
66b4d48469c74f7dd889f3f685b436fcb957bf16 13-Jan-2015 Craig Mautner <cmautner@google.com> Merge "Prevent system server dump stuck by pipe buffer full."
0f8ecc84c8b86054bfd3275f942c3a705df01fbb 12-Jan-2015 Olawale Ogunwale <ogunwale@google.com> am 9d293911: am ebdfb6e8: Merge "[ActivityManager] Distinguish FG or BG receiver finished"

* commit '9d293911221cac930eb8edfef01362ea083eeaab':
[ActivityManager] Distinguish FG or BG receiver finished
ebdfb6e8642e649f7efe877af398eae71cd9b80c 12-Jan-2015 Olawale Ogunwale <ogunwale@google.com> Merge "[ActivityManager] Distinguish FG or BG receiver finished"
eb896e1febd57eba541b8760bcd7010457598b85 09-Jan-2015 Mathieu Chartier <mathieuc@google.com> Merge "Call VMRuntime.clampGrowthLimit for small heap apps" automerge: 9a6c45e
automerge: 117ba18

* commit '117ba186d1d28ae7eb6d1187c795e502668fa9b4':
Call VMRuntime.clampGrowthLimit for small heap apps
24cee07160ec19c16198300bf8e3ec46c5806c54 08-Jan-2015 Mathieu Chartier <mathieuc@google.com> Call VMRuntime.clampGrowthLimit for small heap apps

If the manifest doesn't specify large heaps, we now call
VMRuntime.clampGrowthLimit to release heap virtual address space
which won't ever get used.

Bug: 18387825
Bug: 17131630
Change-Id: I61fdcd70c70234256637eeebefe3abb22b91095d
/frameworks/base/core/java/android/app/ActivityThread.java
1f5ac4d322d76ca76fdf5dee40fe9549aad7437e 03-Jan-2015 riddle_hsu <riddle_hsu@htc.com> [ActivityManager] Distinguish FG or BG receiver finished

Symptom:
Assume a foreground broadcast FG and a background BG.
If a recevier registers both FG and BG. When sending
BG and FG to the receiver, and the receiver BG receiver
completes first, its finishReceiver will trigger next FG
receiver rather than BG, and also deliver wrong result
code/data to the next.

More detail and sample:
https://code.google.com/p/android/issues/detail?id=92917

Root cause:
Due to BroadcastQueue:getMatchingOrderedReceiver will match
by receiver(IBinder), so the caller ActivityManagerService:
broadcastRecordForReceiverLocked will always match the first
queue(fg) if a receiver is both receiving fg and bg.

Solution:
Add a parameter flags to finishReceiver, then server side
could know the finished receiver should belong to which queue.

Another general solution but with bigger scope:
I60dce4a48e20c1002a61a979e4d78b9b0a8b94a0

Change-Id: I913ca6f101ac8ec6c7a8e42754e6781f80247b7f
/frameworks/base/core/java/android/app/ActivityThread.java
a230a43204e3567d93a2d914123b21c14bdf495d 17-Dec-2014 Olawale Ogunwale <ogunwale@google.com> am 486a9942: Merge "[ActivityManager] Use synchronized to protect object"
automerge: e3b07b4

* commit 'e3b07b4856d55f7d96dcb25e3749c7cce1a1cd3d':
[ActivityManager] Use synchronized to protect object
89764e337b6c11fb7ed919f563bcf1ceac92e364 12-Dec-2014 mark_chen <mark_chen@htc.com> [ActivityManager] Use synchronized to protect object

Symptom: ArrayIndexOutOfBoundsException at mResourcePackages
Root Cause: Race condition issue
Solution: Use synchronized to protect object

Change-Id: Ia2d89d50919d95d95f6f8ac2eb75594a93e8f2da
/frameworks/base/core/java/android/app/ActivityThread.java
e0bef71662d81caaaa0d7214fb0bef5d39996a69 10-Dec-2014 Paul Jensen <pauljensen@google.com> Fix several HTTP proxy issues with multinetworking.

1. Send PROXY_CHANGE_ACTION broadcast when any network's proxy changes,
not just the default network.
2. When a process is bound to a particular Network, update the proxy
system properties to those for the bound Network, and keep them
updated when PROXY_CHANGE_ACTION broadcasts are received.
3. Make Network.openConnection() use the proxy for the Network.

bug:17905627
bug:17420465
bug:18144582

(cherry-pick of https://android-review.googlesource.com/#/c/115170)

Change-Id: Ia2819985e6108a8c121e74c683a5646becfd0a97
/frameworks/base/core/java/android/app/ActivityThread.java
a01a0faebfbe6a8bd2ae52c54268ecedd280509b 02-Dec-2014 Dianne Hackborn <hackbod@google.com> Fix issue #18510117: Returning from an activity started with...

...startActivityForResult causes SecurityExpcetion

The ReferrerIntent hack was becoming visible to apps, which caused
a mismatch between marshalling/unmarshalling of the IPC call.

Change-Id: Ibcb788327b5bae4426efc826551799fa87d1cbaa
/frameworks/base/core/java/android/app/ActivityThread.java
a83c5806ded083f51549ba4bf70e0c1f6a17fc61 21-Nov-2014 Filip Gruszczynski <gruszczy@google.com> Merge "SwipeDismissLayout makes activity opaque only after entry animation ends." into lmp-sprout-dev
automerge: 96c5d37

* commit '96c5d37fb5139465cdd3d882b5deba830497557a':
SwipeDismissLayout makes activity opaque only after entry animation ends.
0d1c27a713cb49de8f6f4fd0a129baa883153921 03-Nov-2014 Chet Haase <chet@google.com> Fix seeking and scaled duration behavior

The animation scaled was not being factored in early enough in the
activity lifecycle. Also, setCurrentPlaytTime() was not accounting for
the scaled duration correctly. Finally, added setCurrentFraction() as
a more general-purpose seeking facility.

Issue #18222006 Animator duration scale ignored in some situations
Issue #17951668 add ability to seek fraction, not just time

Change-Id: Idad401f5ff5026d7046c36eee09d78a4793215dc
/frameworks/base/core/java/android/app/ActivityThread.java
6eafa902cbc15fa35f8f0dfb5e559673fa67f637 14-Nov-2014 Filip Gruszczynski <gruszczy@google.com> SwipeDismissLayout makes activity opaque only after entry animation ends.

Bug: 18340863
Change-Id: Ic60fa2463618f86b1ae23fc4a0c06cd348f28334
/frameworks/base/core/java/android/app/ActivityThread.java
bba231d7a63b58a8c2b174722ed1487b0f7d8270 15-Nov-2014 Jeff Brown <jeffbrown@google.com> Explicitly bind AsyncTask to main looper.

It seems we were sort of trying to do this by forcing the AsyncTask
static initializer to run at certain times but it was not sufficiently
reliable. In particular, this resulted in occasional system
server crashes.

Bug: 18192406
Change-Id: Ief73210c60e7680fbed6df74e3e58809b7ec7e4d
/frameworks/base/core/java/android/app/ActivityThread.java
fabb70b2efbd125f74923d19ab12bc8e1371ed1f 11-Nov-2014 Dianne Hackborn <hackbod@google.com> Add reporting of Parcel memory/count.

Also fix issue #18340771: Dumpsys Procstats missing a newline

Change-Id: I0c612187a3fb4d7eeafbf97d373efdef732c477e
/frameworks/base/core/java/android/app/ActivityThread.java
85d558cd486d195aabfc4b43cff8f338126f60a5 04-Nov-2014 Dianne Hackborn <hackbod@google.com> Add Activity API to get referrer information.

This expands the use of EXTRA_REFERRER to be relevant anywhere,
allowing apps to supply referrer information if they want. However,
if they don't explicitly supply it, then the platform now keeps
track of package names that go with Intents when delivering them
to apps, which it can be returned as the default value.

The new method Activity.getReferrer() is used to retrieve this
referrer information. It knows about EXTRA_REFERRER, it can return
the default package name tracked internally, and it also can return
a new EXTRA_REFERRER_NAME if that exists. The latter is needed
because we can't use EXTRA_REFERRER in some cases since it is a Uri,
and things like #Intent; URI extras can only generate primitive type
extras. We really need to support this syntax for referrers, so we
need to have this additional extra field as an option.

When a referrer is to a native app, we are adopting the android-app
scheme. Since we are doing this, Intent's URI creation and parsing
now supports this scheme, and we improve its syntax to be able to build
intents with custom actions and stuff, instead of being all hung up
on custom schemes.

While doing this, fixed a problem when parsing both intent: and new
android-app: schemes with a selector portion, where we were not
respecting any scheme that was specified.

Change-Id: I06e55221e21a8156c1d6ac755a254fea386917a2
/frameworks/base/core/java/android/app/ActivityThread.java
cb383183d722a9ef03ab8b8cb0d0e419efd96598 29-Oct-2014 Narayan Kamath <narayan@google.com> Fix getPackageInfo("android") in the system server.

The fix for bug 16555230 attempted to return the same LoadedApk
object between the system context object and the activity thread's
list of opened packaged. This ensured that we used the same classLoader
on both these objects (among other things).

However, the object the Context owns is actually incomplete (and
necessarily so) because it might be created before the package
manager is and we need the package manager to construct a complete
LoadedApk object.

Work around this by manually setting the classloader and aInfo for
"android" contexts created by the system server's activity thread.

bug: 18167468
Change-Id: I623634f912111f89eaf716b8258d1926d2513dcd
/frameworks/base/core/java/android/app/ActivityThread.java
bb2e2cae5881ec1806576a737e8d554301332f9f 23-Oct-2014 Jeff Sharkey <jsharkey@android.com> Allow I/O when installing providers.

Bug: 17879170
Change-Id: I073d5b56bab6db01290aad5386c53c305669dc5b
/frameworks/base/core/java/android/app/ActivityThread.java
7a5b01bc0e220382f0f84bfeb82b8e8b7cfb8730 23-Sep-2014 John Reck <jreck@google.com> am 01b5cfaa: am 668e566e: Merge "Aggressively trim memory for system_process" into lmp-dev

* commit '01b5cfaac7e72526d145b4c5ea706993321abaa9':
Aggressively trim memory for system_process
73840ea3670f1c117843acc6069635c80ba2ffd2 22-Sep-2014 John Reck <jreck@google.com> Aggressively trim memory for system_process

Bug: 16978006

Don't HWUI-accelerate KeyguardScrim
Aggressively trim memory as soon as a ViewRootImpl
dies or has its visibility changed.

Change-Id: Ie1b7c9d30653456bd2e9f309128174f972999368
/frameworks/base/core/java/android/app/ActivityThread.java
116e069cdb403d25ebd0c14bc19ad5956e4a3223 18-Sep-2014 Jeff Brown <jeffbrown@google.com> am 6fc160ed: am d510278d: Merge "Create an Application object for the system process." into lmp-dev

* commit '6fc160ed30b6d194bbf824c5674403fc622b94f1':
Create an Application object for the system process.
7fc8e357a47a371e875018675583fa5d05f103bf 17-Sep-2014 Jeff Brown <jeffbrown@google.com> Create an Application object for the system process.

Change-Id: Icd959fd859a7a556fbcbc519ff8646e1bf95fedc
/frameworks/base/core/java/android/app/ActivityThread.java
ae0477be093f4d55db3d9486d73d7f7ab7b83888 13-Sep-2014 Paul Jensen <pauljensen@google.com> am 11ee98ad: am 28b89f98: Allow libcore to perform necessary actions upon net config changes.

* commit '11ee98ade47dddefa60cf3f54a3a4c82a5d5f7ee':
Allow libcore to perform necessary actions upon net config changes.
e401d17d3fff3d29bec300f82f91443ec7f8b0dd 12-Sep-2014 Paul Jensen <pauljensen@google.com> Allow libcore to perform necessary actions upon net config changes.

Delegate to libcore the responsibility of performing the necessary
actions upon a network configuration change, such as a DNS
configuration change. In the L-release, these responsibilities
now include flushing the HTTP connection pools to prevent connections
on lingering networks getting pulled from the pool inadvertently to
satisfy requests that should be going over the new network. All such
responsibilities can now be controlled and delegated by libcore's
new NetworkEventDispatcher, designed for this purpose.

bug:17314604
Change-Id: Ic796aea9d9a1f6ecb787fbdb38b3b7f5d991829b
/frameworks/base/core/java/android/app/ActivityThread.java
b30ea42a8d5a516c61b6a2e00368abad9acb82e2 07-Sep-2014 Dianne Hackborn <hackbod@google.com> am 459f3911: am 9a77bddd: Merge "Fix issue #17391969: Only exception on Message.recycle() when target-sdk > 20" into lmp-dev

* commit '459f391177dd796d25d68184a0844a0420a1f33a':
Fix issue #17391969: Only exception on Message.recycle() when target-sdk > 20
7bc4c083236dfbb0a82e668878e4c0f7b399187c 07-Sep-2014 Dianne Hackborn <hackbod@google.com> am 8c7be259: am 6a83e4d1: Merge "Work on issue #17357238: Recents is often slow if not used in a while" into lmp-dev

* commit '8c7be25983e44e8e1bfcb721f50ae23ca7aabf32':
Work on issue #17357238: Recents is often slow if not used in a while
b30c9920df9a8b5f1515e26c65c5ce1d21e5a77a 07-Sep-2014 Dianne Hackborn <hackbod@google.com> Merge "Fix issue #17391969: Only exception on Message.recycle() when target-sdk > 20" into lmp-dev
a4e102ee580282dc7abeb22f4a025813e53b9431 05-Sep-2014 Dianne Hackborn <hackbod@google.com> Work on issue #17357238: Recents is often slow if not used in a while

Add a new activity attribute, resumeWhilePausing, that allows an
activity specifying it to immediately start running without waiting
for the previous activity to pause. The recents activity is updated
to use this.

The implementation of this is ultimately fairly simple -- if we are
in the path of resuming such an activity, and find that we first need
to pause the existing activity, then within the activity manager we
do the regular pause flow but act like it has immediately finished
pausing right then so that we can immediately go on to the resume.
To make this clean, we tell the activity when asking it to pause that
it should not come back and tell us it is done, because we aren't in
any way waiting for it.

One potentially important change I needed to make here is the pause
callback no longer provides the saved persistent state, because we
now can't count on that callback happening. I don't think there was
really any utility in this anyway -- all modern apps will have their
save state flow happen as part of stopping, not pausing, so we'll
only capture that saved state when the stop is reported back anyway.
And since we do send the saved state back when stopping, it would
always blow away whatever we had gotten at the pause.

Finally, update the documentation for AppTask.startActivity(), and
fix the implementation handling that to be cleaner -- we need to
deal with inTask first before getting in to "oh noes add NEW_TASK
if this isn't coming from a calling activity" flow.

Change-Id: Ia1da0fac90d7bdbaafdda2e34850d795ce17a39f
/frameworks/base/core/java/android/app/ActivityThread.java
7895bc2e6309427937ab060031bfee5c99879d59 06-Sep-2014 Dianne Hackborn <hackbod@google.com> Fix issue #17391969: Only exception on Message.recycle() when target-sdk > 20

Change-Id: Iaf271c96901c5dba15831681269a49ad4aaa57fd
/frameworks/base/core/java/android/app/ActivityThread.java
629dc1801331ce89e8ee0ff7ee5dcde1d7512417 04-Sep-2014 Anwar Ghuloum <anwarg@google.com> Timing Hacks DO NOT MERGE

Let's submit to see any lingering effects.

Bug: 17310019
Change-Id: I791bceec0b6aa8b80ac4e6c582a10c3f0ec7a906
/frameworks/base/core/java/android/app/ActivityThread.java
fcf7083eab5b859e660e2d4a191687d03dc7de06 28-Aug-2014 Jose Lima <joselima@google.com> Renamed Activity.onVisibleBehindCancelled() to Activity.onVisibleBehindCanceled()

API review request.

Bug: 17288987
Change-Id: If63f847ce630a57e4aa1e5291befe2863cb7e0c7
/frameworks/base/core/java/android/app/ActivityThread.java
1b012d302b56b4adf950035136d1d191a1936d5a 20-Aug-2014 Jeff Hao <jeffhao@google.com> Add sample profiling option to am.

Also bundles all profiling options into a class.

Bug: 17040932
Change-Id: I85d675ee1494bdc7308caffdf94145d27c996e9d
/frameworks/base/core/java/android/app/ActivityThread.java
89ad456ea49cb62615ebdcac83a2515743bbe5fa 25-Aug-2014 Dianne Hackborn <hackbod@google.com> Fix issue #16311398: Limit number of documents a process can open

In application processes, monitor for when we start getting close
to the Dalvik heap limit, and ask the activity manager to try to
prune old activity instances in that case.

Add an explicit API for apps to ask that they have their own
activity instances cleaned up, if they want.

Fix some bugs in launching activities that were not correctly
applying the "multi task" behavior in the appropriate situations
of document-centric recents.

Clean up the activity manager's process removal code to all share
a common path.

Add a new "Spam" option to ActivityTests, which continually creates
new tasks, checking that the activity manager will now prune old
tasks rather than letting the app run out of RAM.

And while I was was doing this, I found problems with the path
for bringing an empty task to the foreground -- it could make
a new task instead of re-starting the root activity in the
existing task. This is fixed, and some code in the recents
UI for working around the bug is removed.

And as long as I am doing that, we now have nice hooks in to
the activity manager for AppTask to give some APIs for better
managing the task, so add those along with more tests for these
APIs in ActivityTests.

We should look at also having the activity manager try to prune
old tasks when it sees app processes being killed, to better balance
memory use across multiple processes when some processes may host
many documents. That however is for another CL...

Change-Id: I2bb81c3f92819350c868c7a7470b35817eb9bea9
/frameworks/base/core/java/android/app/ActivityThread.java
836c0a8b949d71293c996761691e065f0651acef 11-Aug-2014 Jon Miranda <jonmiranda@google.com> Exposes style and theme data, adds developer option.

Adds support for a String[] return type in ViewDebug; and in addition to that,
the hasAdjacentMapping method can use the String array as means to map a key to
its value.

Adds DEBUG_VIEW_ATTRIBUTES to Settings so that the heavy per-view
computations only affect those who opt in. This setting is used in
CoreSettingsObserver to avoid impacting start time.

Change-Id: I8f507e4e5361414c30d247e8d9815205feb5e91f
/frameworks/base/core/java/android/app/ActivityThread.java
2b3b706e146f9d7773c9c2c99d969b48d89d237e 15-Aug-2014 Narayan Kamath <narayan@google.com> Merge "Fix getPackageInfo for the "android" package in the system server." into lmp-dev
3480ab45c82681399ac45d54105513baa9c041f6 15-Aug-2014 Narayan Kamath <narayan@google.com> Fix getPackageInfo for the "android" package in the system server.

bug: 16555230
Change-Id: I90ebf9b35fda8246b0079f67b1469f96c3b4ede2
/frameworks/base/core/java/android/app/ActivityThread.java
29564cd24589867f653cd22cabbaac6493cfc530 07-Aug-2014 Narayan Kamath <narayan@google.com> Remove system_server classes from the boot image.

We set the system_server classpath in the environment
(like we do with BOOTCLASSPATH). After the zygote forks
the system_server, we dexopt the classpath (if needed)
and then launch the system server with the correct
PathClassLoader. This needed several small / medium
refactorings :

- The logic for connecting to installd is now in a separate
class and belongs in the system_server.
- SystemService / SystemServiceManager have now moved to
classes.jar. They are only used from there, and since they
use Class.forName, we want them to be loaded by the
system_server classloader, and not the bootclassloader.
- BootReceiver now moves to frameworks.jar, because it is
used by ActivityThread and friends.

bug: 16555230

Change-Id: Ic84f0b2baf611eeedff6d123cb7191bb0259e600
/frameworks/base/core/java/android/app/ActivityThread.java
4b6c6697da5a20c08b2f9f2ca40c94008477e914 13-Aug-2014 Jose Lima <joselima@google.com> Renamed "media playing" APIs to "visible behind"

- Request from API Review: rename the media playing APIs to a more
generic name, reflecting the background visibility feature these
methods actually control.
- Made the new isActivityVisibleBehind().
- Changed convertFromTranslucent() and convertToTranslucent() to be
SystemApi.

Bug: 16959028
Change-Id: I526eac22f44273b3254dd6201f89194d13e597e2
/frameworks/base/core/java/android/app/ActivityThread.java
1d6c40a6698d271517e5b333f2d0dd4459913884 30-Jul-2014 riddle_hsu <riddle_hsu@htc.com> Prevent system server dump stuck by pipe buffer full.

Symptom:
Watchdog timeout during dumping db info.

Root Cause:
When the caller is system server, this invocation is not IPC
that means it is not asynchronous, it will need writer has
written all data to finish. But pipe has 16*4KB buffer limit,
if no reader consumes the data, it will keep waiting.

Solution:
Check if caller is system server, then use another thread to write
so reader could consume the data in buffer.

Change-Id: I4bf80fd645cc9396f51ffc0eb27fb895756c1dcf
/frameworks/base/core/java/android/app/ActivityThread.java
5e1565ead6dbb7d5c414522591f61b16a23de1c3 30-Jul-2014 Alan Viverette <alanv@google.com> Enable hardware rendering for system process

Also enables hardware rendering by default on windows created
without a parent activity (e.g. by services).

BUG: 16240470
Change-Id: I906d48cb07af50fa02dae4f4ecdb5e65211fc6ef
/frameworks/base/core/java/android/app/ActivityThread.java
d1c99b1fe85ed03261a77a14ae52e7fa3a6e523a 04-Jul-2014 Nicolas Prevot <nprevot@google.com> Migrate extras to ClipData for image/video capture intents.

The intents ACTION_IMAGE_CAPTURE, ACTION_IMAGE_CAPTURE_SECURE and ACTION_VIDEO_CAPTURE are now handled in a way
similar to ACTION_SEND and ACTION_SEND_MULTIPLE.
Migrate the uri in the EXTRA_OUTPUT extra to clipData, and add the flag GRANT_WRITE_URI_PERMISSION.

The userIds are now added to extra uris in the process receiving the intent, (not in the system process), because the
system process may not be able to parcel/unparcel the extras.

BUG: 15534203

Change-Id: I8f79666b726bc6d7745bf777ad3c7518945c5cc3
/frameworks/base/core/java/android/app/ActivityThread.java
8746a478abcfb3b0d73b156232051af1e8d21ce2 25-Jul-2014 Craig Mautner <cmautner@google.com> Create end of animation callback for Activity

Activities cannot draw while their entering animations are active.
This change introduces a callback, onEnterAnimationComplete() so
that activities can know when their draws will be effective.

Fixes bug 13658460.

Change-Id: Ic48540cd4c7e37538f10cb2dc0852aa3f55d11e1
/frameworks/base/core/java/android/app/ActivityThread.java
2e40d115ca4332d88424d1b591fdd8d5f78d1831 15-Jul-2014 Christopher Tate <ctate@google.com> Add BackupAgent.onRestoreFinished() callback

The agent's onRestoreFinished() method is called after all available
data has been delivered to the app, whether via the key/value restore
API or the full-data file-at-a-time API. This gives the app a stable
opportunity to do any postprocessing that might be appropriate.

Also fixes a lingering bug in the framework's handling of backup
agent lifetimes. In cases where an existing agent instances was
being rebound, the framework was forgetting to notify the dependent
that the agent was available. This was causing timeouts and restore
failure.

Bug 16241004

Change-Id: I3f52b299312d30d38b0cba63a2cfaeb934991ef2
/frameworks/base/core/java/android/app/ActivityThread.java
fee756ff91ab4d8f0e09ddb050d22d88ebb66ae7 17-Jul-2014 Dianne Hackborn <hackbod@google.com> Implement issue #16330060: Inform ActivityManager about WebView...

...state changes.

Add a new API to tell the activity manager about a new dependency
one process has on another package. Start using it already for
when apps is Context.createPackageContext() to load code from another
app.

Also do some work on getting the monitoring of proc/uid states
in shape so it can be used by unundled code, along with an
AppImportanceMonitor class for doing so.

Some small fixes and additions to VoiceInteractionService.

Improve handling of unaccounted/overcounted battery use so that
they aren't shown to the user unless they are significant.

Change-Id: I22dd79a73f4e70103d3f8964494aebc8a31f971c
/frameworks/base/core/java/android/app/ActivityThread.java
7ef70b001b4cb6258181591406d4b2b6de3a595c 09-Jul-2014 Dake Gu <dake@google.com> add missing break for Activity options

fix b/16166102

Change-Id: Iebe8c4d4e640a14b049ffa62d8decb062cfe8f12
/frameworks/base/core/java/android/app/ActivityThread.java
ee2e45acbff28986c2ced636b7550d0afbb0eeb7 27-Jun-2014 Craig Mautner <cmautner@google.com> Add Media Playing API

These methods permit an activity to play or continue playing media
behind a translucent activity above it. Particularly the home
activity in Android TV. Methods exist to notify the upper activity
when playing starts or stops and for notifying the playing activity
when to stop playing and release its resources.

Methods are called when either activity's state changes or new
activities are launched.

Fixes bug 14469711.

Change-Id: I7ba10c5a4683504931cffa228488f5281e5bbf86
/frameworks/base/core/java/android/app/ActivityThread.java
eb8abf7207aa118065999514f9248affbdd94de1 03-Jul-2014 Craig Mautner <cmautner@google.com> Introduce onNewActivityOptions for return activity

When an activity that is already translucent returns to the
previous activity using a scene transition the receiving activity
did not receive its ActivityOptions for its side of the animation.
The new method onNewActivityOptions() delivers those options.

Fixes bug 14869070.

Change-Id: I09b136b3213aae5d3521894e17a7500ac793f3d2
/frameworks/base/core/java/android/app/ActivityThread.java
f47a594f5250b1914c36423ee6b371f0b8db09d0 01-Jul-2014 John Reck <jreck@google.com> Fix onTrimMemory for HardwareRenderer

Also fixes detachFunctor possibly drawing after return

Bug: 15189843
Bug: 15990672

Change-Id: I64c48cb674c461a8eeaba407b697e09f72c98ce3
/frameworks/base/core/java/android/app/ActivityThread.java
f62d690b00c3808496e6a5c35f3942c78fbb15d5 18-Jun-2014 Craig Mautner <cmautner@google.com> Merge "Fix persistent tasks and expand scope"
43e52ed32e2d55ef4aee18c4b4bc13b7fdef9cc4 17-Jun-2014 Craig Mautner <cmautner@google.com> Fix persistent tasks and expand scope

- Fixed missing tag closure on the xml for storing Intent categories.
- Shortened timeout for flushing tasks to persistent storage from
one minute to ten seconds.
- Made persistency the default except for those tasks on the home
stack and those tasks that exclude themselves from the recent task
list.
- Fixed deletion of tasks after restoring. Tasks now survive a second
reboot, not just the first reboot.
- Fixed sort order so most recent tasks will be restored at front.

Fixes bug 15672002.

Change-Id: I16d87d58c6fd2e879cfd0c0b18b2694432a79b71
/frameworks/base/core/java/android/app/ActivityThread.java
8a4c9721a9e09d20c63381c13fa29bd9f7cbc3e3 16-Jun-2014 Jeff Sharkey <jsharkey@android.com> Plumb split APKs into public API.

Introduces new ApplicationInfo fields to surface zero or more split
APKs for an application. Splice these APKs into both the class
loader and resource system. Cleaner building of these paths.

Run dexopt() on all split APKs found after a parse, and populate
into ApplicationInfo.

Change-Id: I4a376bf4492d84ea95aafa866e106ea43a43e492
/frameworks/base/core/java/android/app/ActivityThread.java
a54c8246a58a1ae5ca3c364c0469f82ba8994a1b 09-Jun-2014 Robin Lee <rgl@google.com> am 0b889cd6: am db9e0a67: am 01c07a85: Merge "Choose CA certificate storage according to userId"

* commit '0b889cd66fdb739a8078fb50212501849e35eb1e':
Choose CA certificate storage according to userId
0b889cd66fdb739a8078fb50212501849e35eb1e 09-Jun-2014 Robin Lee <rgl@google.com> am db9e0a67: am 01c07a85: Merge "Choose CA certificate storage according to userId"

* commit 'db9e0a674ac3a9c71699618cb525fdd3c4669e30':
Choose CA certificate storage according to userId
3d076afc37034c0cf46580bc288a85f65b617399 25-Apr-2014 Robin Lee <rgl@google.com> Choose CA certificate storage according to userId

Sets the default CA certificate directory at first instantiation so
that only certificates for the current user are searched.

This means that if one user decides to trust a CA no other user of the
device will be forced into trusting that CA as well.

Change-Id: Iaca14a94dd14c598e49a598290e1a80917269eac
/frameworks/base/core/java/android/app/ActivityThread.java
6784f1c62379f2226d895cd944d716c17f4cb195 22-May-2014 Winson Chung <winsonc@google.com> Removing unnecessary public values. (Bug 14995844)
/frameworks/base/core/java/android/app/ActivityThread.java
9aeb60739909aa2b8100c95157835e4e3db28519 19-May-2014 Winson Chung <winsonc@google.com> Merge "Enabling alternate recents on all form factors."
7fd239cf0a1ddc0500b51d97e0e6c3539b42639f 14-May-2014 Craig Mautner <cmautner@google.com> Merge "Pass ActivityOptions back from finishing activity."
fd08622588d5a90c11216894344e58147ff6359a 14-May-2014 Winson Chung <winsonc@google.com> Enabling alternate recents on all form factors.

Change-Id: I9dec6da7646205b72f46cedf604fadfb03cab6d4
/frameworks/base/core/java/android/app/ActivityThread.java
233ceeebab7efe6ad4783371003c4cf29b896436 10-May-2014 Craig Mautner <cmautner@google.com> Pass ActivityOptions back from finishing activity.

Adding an ActivityOptions parameter to convertToTranslucent provides
a mechanism for delivering these options to the activity that
launched the one that is returning.

Fixes bug 13032208.
Fixes bug 14469460.
Fixes bug 14597427.

Change-Id: I4115dd3c69de9d175f6df0498a6e964fca5eca29
/frameworks/base/core/java/android/app/ActivityThread.java
83520b95124e0fcaaf3154a7a267f6be0205bc74 09-May-2014 Jason Monk <jmonk@google.com> Switch PacUrl storage from String to Uri

Since the interface for creating/accessing PAC URLs through a
ProxyInfo is Uri based, so should the internal storage and
references.

Change-Id: Ibf15c350f4cc526f81aba3ec463070f26af8f535
/frameworks/base/core/java/android/app/ActivityThread.java
d9ddf2e9d04f8a53d7445a96aa3e192fa86f08d6 09-May-2014 Craig Mautner <cmautner@google.com> Merge "Introduce persistent forms of Activity lifecycle calls."
a002604af0c9b1204556610537b85685d7055996 23-Apr-2014 Craig Mautner <cmautner@google.com> Introduce persistent forms of Activity lifecycle calls.

When an Activity is created with R.attr.persistable true different
forms of activity lifecycle methods including PersistableBundle will
be used.

Fixes bug 13736007.

Change-Id: I7e92917b300b76964257cfcc26c24e76aa19bd16
/frameworks/base/core/java/android/app/ActivityThread.java
9d75ccb6a1b3b300c33ce3ceab5eaece0ad55d42 07-May-2014 Jason Monk <jmonk@google.com> Merge "Make proxy API public"
207900c23b26d0df9ab28c709db4a1007d7d7904 25-Apr-2014 Jason Monk <jmonk@google.com> Make proxy API public

Also exposed proxy-related functions that were on the
ConnectivityManager.

Change-Id: I9fb5f1bcc257a6198679ea1d56e18da2ec5a3b33
/frameworks/base/core/java/android/app/ActivityThread.java
09233289624a85093b1d99e4a6a149bf09059d8d 30-Apr-2014 Dianne Hackborn <hackbod@google.com> Make GET_TASKS signature|system.

Normal apps can't hold it now. If they try to use
getRecentTasks() or getRunningTasks() without the permission,
they will only see their own tasks and home in the list.

Also took this opportunity to eradicate all of the old pending
thumbnail stuff.

Change-Id: I6dc52a06221c78097162e4a8b482027b798bf3ee
/frameworks/base/core/java/android/app/ActivityThread.java
91097de49b0f683b00e26a75dbc0ac6082344137 05-Apr-2014 Dianne Hackborn <hackbod@google.com> Initial implementation of new voice interaction API.

This gives a basic working implementation of a persist
running service that can start a voice interaction when
it wants, with the target activity(s) able to go through
the protocol to interact with it. It may even work when
the screen is off by putting the activity manager in the
correct state to act like the screen is on.

Includes a sample app that is a voice interation service
and also has an activity it can launch.

Now that I have this initial implementation, I think I
want to rework some aspects of the API.

Change-Id: I7646d0af8fb4ac768c63a18fe3de43f8091f60e9
/frameworks/base/core/java/android/app/ActivityThread.java
67b082e02cbfb7bafe046a619e686e9a5c1abc05 25-Apr-2014 Winson Chung <winsonc@google.com> Merge "Enabling doc centric recents on phones."
3b3f464445d1d369c8e87f526deba606ca62f76c 22-Apr-2014 Winson Chung <winsonc@google.com> Piping through ability for an Activity to remove its own task. (Bug 13735914)

Change-Id: Iefcd4fbe68748195de8ee37ee2b6edef55276603
/frameworks/base/core/java/android/app/ActivityThread.java
f9f2314aa444e32b93caecd06cb4f10a71a2df39 21-Apr-2014 Winson Chung <winsonc@google.com> Enabling doc centric recents on phones.

Change-Id: If853cdcbf3fc75001060e522bce2e0d49d2ddea3
/frameworks/base/core/java/android/app/ActivityThread.java
de898ff42912bd7ca1bfb099cd439562496765a4 30-Jan-2014 Adam Lesinski <adamlesinski@google.com> Shared library resource support

Shared libraries can now export resources for applications
to use.

Exporting resources works the same way the framework exports
resources, by defining the public symbols in res/values/public.xml.

Building a shared library requires aapt to be invoked with the
--shared-lib option. Shared libraries will be assigned a package
ID of 0x00 at build-time. At runtime, all loaded shared libraries
will be assigned a new package ID.

Currently, shared libraries should not import other shared libraries,
as those dependencies will not be loaded at runtime.

At runtime, reflection is used to update the package ID of resource
symbols in the shared library's R class file. The package name of
the R class file is assumed to be the same as the shared library's
package name declared in its manifest. This will be customizable in
a future commit.

See /tests/SharedLibrary/ for examples of a shared library and its
client.

Bug:12724178
Change-Id: I60c0cb8ab87849f8f8a1a13431562fe8603020a7
/frameworks/base/core/java/android/app/ActivityThread.java
ba6b8978169e5d974e0e363e25b5ef4646eb693e 14-Mar-2014 Jeff Brown <jeffbrown@google.com> resolved conflicts for merge of 825dd9dd to klp-dev-plus-aosp
.
Change-Id: I2363c40f641e7e60487354e1710312db2cbbc89a
ec463b96e188f2c68cbef2362e570118a3a460ed 12-Mar-2014 Jeff Brown <jeffbrown@google.com> resolved conflicts for merge of cc9894c8 to klp-modular-dev-plus-aosp

Change-Id: I0fa4486ed300a35de3af8748e01300b01f03ec01
f86c3a44f2af2dedd3c1d3a3c630a51f83984605 11-Mar-2014 Jeff Brown <jeffbrown@google.com> Retain display when creating specialized contexts. (DO NOT MERGE)

Fixed a bug that cause Context.createPackageContext() to discard
display information. Likewise also fixes issues where the
activity token, override configuration, user handle, and
restriction state might be discarded.

As part of this change, reworked how Contexts are created to make
initialization easier to understand and less error-prone.
The init() methods have been removed and most of the state is
now stored in final variables.

Bug: 12015587
Change-Id: If795851f1cd078bef889b76a52e00d9b3c06ab11
/frameworks/base/core/java/android/app/ActivityThread.java
089886058a9c56ce1921082ad682231a504ac832 11-Mar-2014 Jeff Brown <jeffbrown@google.com> Retain display when creating specialized contexts. (DO NOT MERGE)

Fixed a bug that cause Context.createPackageContext() to discard
display information. Likewise also fixes issues where the
activity token, override configuration, user handle, and
restriction state might be discarded.

As part of this change, reworked how Contexts are created to make
initialization easier to understand and less error-prone.
The init() methods have been removed and most of the state is
now stored in final variables.

Bug: 12015587
Change-Id: If795851f1cd078bef889b76a52e00d9b3c06ab11
/frameworks/base/core/java/android/app/ActivityThread.java
defd4a6b0448bf13606695eb086c77aa099684a2 11-Mar-2014 Jeff Brown <jeffbrown@google.com> Retain display when creating specialized contexts.

Fixed a bug that cause Context.createPackageContext() to discard
display information. Likewise also fixes issues where the
activity token, override configuration, user handle, and
restriction state might be discarded.

As part of this change, reworked how Contexts are created to make
initialization easier to understand and less error-prone.
The init() methods have been removed and most of the state is
now stored in final variables.

Bug: 12015587
Change-Id: If795851f1cd078bef889b76a52e00d9b3c06ab11
/frameworks/base/core/java/android/app/ActivityThread.java
303e1ff1fec8b240b587bb18b981247a99833aa8 08-Mar-2014 Winson Chung <winsonc@google.com> Initial changes for recents.

Change-Id: Ide2c202b4a5b25410f0f32bd0a81ccf817ede38f
/frameworks/base/core/java/android/app/ActivityThread.java
2d3ddc2ba9f86d795e437ea90dccb59cf1ebfd11 08-Mar-2014 Dave Allison <dallison@google.com> am 199670c4: am 324aa693: am b94904ab: am 3fc3b9fd: Merge "ART profiler usage."

* commit '199670c46a9950bd2e06af43ea082427b542060a':
ART profiler usage.
324aa693b82656809b97e307676adbbce37c3d95 08-Mar-2014 Dave Allison <dallison@google.com> am b94904ab: am 3fc3b9fd: Merge "ART profiler usage."

* commit 'b94904ab6dfbb9db7e8042f10886042a295857d4':
ART profiler usage.
0efbd9a463c848118c7685f4bfc8765a82caa761 30-Jan-2014 Dave Allison <dallison@google.com> ART profiler usage.

This is a change to add args to some of the profiler related
functions, including installd commands.

Also read properties and set command line options for the runtime
profiling parameters.

Changed calls to isDexOptNeeded() to isDexOptNeededInternal(). This
needs additional arguments passed for profiles.

Bug: 12877748
Change-Id: I1a426c9309d760bac0cf92daa298defee62287c1

Conflicts:
core/jni/AndroidRuntime.cpp
/frameworks/base/core/java/android/app/ActivityThread.java
ca35c18a374c143831cc282987c762507c0ffc34 07-Mar-2014 Narayan Kamath <narayan@google.com> am cd4874cf: am d265bcc4: Merge "Inform libcore of time format pref. changes."

* commit 'cd4874cfdc00d17454529b5dca85a487c7c2de77':
Inform libcore of time format pref. changes.
ccb2a086fe0de77a4e3277454cb4a66f8e7dc57d 19-Dec-2013 Narayan Kamath <narayan@google.com> Inform libcore of time format pref. changes.

- Introduce a boolean extra for intent TIME_CHANGED that
specifies if the user wants a 24 hour format or not.
- Have the ActivityManagerService inform running processes
of changes to this preference.
- Add plumbing in ActivityThread to inform j.t.DateFormat

(cherry-picked from dd491cc756233c088fd26eba4918671fcc9cfc30)

Change-Id: Ib90636bda4bc8332cfa22def831877b524b5c486
/frameworks/base/core/java/android/app/ActivityThread.java
27ad525c7e91bde38d6c9e3e67ab38b97eb7eed0 19-Dec-2013 Narayan Kamath <narayan@google.com> Inform libcore of time format pref. changes.

- Introduce a boolean extra for intent TIME_CHANGED that
specifies if the user wants a 24 hour format or not.
- Have the ActivityManagerService inform running processes
of changes to this preference.
- Add plumbing in ActivityThread to inform j.t.DateFormat

Change-Id: I05fafb903ae54e39c03a048b7a219dc5a93fd472
/frameworks/base/core/java/android/app/ActivityThread.java
19b6bcfd83eb7fb92ebd06d2fec89e308311f1d0 15-Feb-2014 John Reck <jreck@google.com> Support HardwareLayers in RenderThread

Also has a few HardwareLayer lifecycle fixes

Change-Id: I6308cb05f8f199eed72189ace768013a46815941
/frameworks/base/core/java/android/app/ActivityThread.java
d5c8044e7e1f1402fdd4a035690329294ab07b33 12-Feb-2014 Nick Kralevich <nnk@google.com> resolved conflicts for merge of 1cbea39f to master

Change-Id: Ib33484546c6a03cbc4cd96e97d9d785d68e10700
dd3d95f182a634acdcc1b1e8e4954234d048eb54 12-Feb-2014 Nick Kralevich <nnk@google.com> resolved conflicts for merge of 4ad93639 to klp-modular-dev-plus-aosp

Change-Id: I7ad222301ec0b863d48a1a9a839469436c385ea0
48d22323ce39f9aab003dce74456889b6414af55 31-Jan-2014 MÃ¥rten Kongstad <marten.kongstad@sonymobile.com> Runtime resource overlay, iteration 2

Support any number of overlay packages. Support any target package.

UPDATED PACKAGE MATCHING
------------------------
In Runtime resource overlay, iteration 1, only a single overlay package
was considered. Package matching was based on file paths:
/vendor/overlay/system/framework-res.apk corresponded to
/system/framework-res.apk. Introduce a more flexible matching scheme
where any package is an overlay package if its manifest includes

<overlay targetPackage="com.target.package"/>

For security reasons, an overlay package must fulfill certain criteria
to take effect: see below.

THE IDMAP TOOL AND IDMAP FILES
------------------------------
Idmap files are created by the 'idmap' binary; idmap files must be
present when loading packages. For the Android system, Zygote calls
'idmap' as part of the resource pre-loading. For application packages,
'idmap' is invoked via 'installd' during package installation (similar
to 'dexopt').

UPDATED FLOW
------------
The following is an outline of the start-up sequences for the Android
system and Android apps. Steps marked with '+' are introduced by this
commit.

Zygote initialization
Initial AssetManager object created
+ idmap --scan creates idmaps for overlays targeting 'android', \
stores list of overlays in /data/resource-cache/overlays.list
AssetManager caches framework-res.apk
+ AssetManager caches overlay packages listed in overlays.list

Android boot
New AssetManager's ResTable acquired
AssetManager re-uses cached framework-res.apk
+ AssetManager re-uses cached 'android' overlays (if any)

App boot
ActivityThread prepares AssetManager to load app.apk
+ ActivityThread prepares AssetManager to load app overlays (if any)
New AssetManager's ResTable acquired as per Android boot

SECURITY
--------
Overlay packages are required to be pre-loaded (in /vendor/overlay).
These packages are trusted by definition. A future iteration of runtime
resource overlay may add support for downloaded overlays, which would
likely require target and overlay signatures match for the overlay to
be trusted.

LOOKUP PRIORITY
---------------
During resource lookup, packages are sequentially queried to provide a
best match, given the constraints of the current configuration. If any
package provide a better match than what has been found so far, it
replaces the previous match. The target package is always queried last.

When loading a package with more than one overlay, the order in which
the overlays are added become significant if several packages overlay
the same resource.

Had downloaded overlays been supported, the install time could have been
used to determine the load order. Regardless, for pre-installed
overlays, the install time is randomly determined by the order in which
the Package Manager locates the packages during initial boot. To support
a well-defined order, pre-installed overlay packages are expected to
define an additional 'priority' attribute in their <overlay> tags:

<overlay targetPackage="com.target.package" priority="1234"/>

Pre-installed overlays are loaded in order of their priority attributes,
sorted in ascending order.

Assigning the same priority to several overlays targeting the same base
package leads to undefined behaviour. It is the responsibility of the
vendor to avoid this.

The following example shows the ResTable and PackageGroups after loading
an application and two overlays. The resource lookup framework will
query the packages in the order C, B, A.

+------+------+- -+------+------+
| 0x01 | | ... | | 0x7f |
+------+------+- -+------+------+
| |
"android" Target package A
|
Pre-installed overlay B (priority 1)
|
Pre-installed overlay C (priority 2)

Change-Id: If49c963149369b1957f7d2303b3dd27f669ed24e
/frameworks/base/core/java/android/app/ActivityThread.java
5ab77ac4a539e2117425e2dffeff7a29b6bc03d6 10-Jan-2014 Craig Mautner <cmautner@google.com> am 96ada57b: Merge "Allow for the possibility of null ActivityContainer" into klp-modular-dev

* commit '96ada57b2c0c456e9d3a1f43e3ff691f14ec1459':
Allow for the possibility of null ActivityContainer
bd503a4e3a1c897695f0edcf6e4aaac3a7e962c5 10-Jan-2014 Craig Mautner <cmautner@google.com> Allow for the possibility of null ActivityContainer

When BinderProxy is passed in as the IBinder for
getEnclosingActivityContainer the activity manager cannot turn it into
an ActivityRecord. This causes NPE in ActivityThread which is Not Good
(tm).

Allowing null to be returned when requesting an ActivityContainer and
handling it appropriately fixes this bug.

Fixes bug 12473669.

Change-Id: I6937636042f8853b3ddc2df40be010e7391e41a5
/frameworks/base/core/java/android/app/ActivityThread.java
b859449b717b24ac6e678c303d7706d55fd184f7 08-Jan-2014 Craig Mautner <cmautner@google.com> resolved conflicts for merge of 88bfc6dd to master

Change-Id: Ib656ac0591b21ad14f2df51021729552e9373515
88bfc6ddc846d714bc15518ef6741e39145a1687 08-Jan-2014 Craig Mautner <cmautner@google.com> Merge "Extend stack management to other displays." into klp-modular-dev
6c6a11648fc6ed9bf058fba51d82d467472ed8e6 07-Jan-2014 Ian Rogers <irogers@google.com> am 878df18c: am 8dbfde50: am 0e16e3d7: am c2b50c10: am f11dee79: Merge "Add a call to registerAppInfo for the VMRuntime"

* commit '878df18c48fa5f0282cee5ded80238f64826cf84':
Add a call to registerAppInfo for the VMRuntime
e0a3884cb627efc650e19fbe76b1b3343468cf57 17-Dec-2013 Craig Mautner <cmautner@google.com> Extend stack management to other displays.

- Abandon ActivityContainer.startActivity() in favor of
IActivityManager.startActivityAsUserInContainer().
- Modify Am to test starting an activity on a container.
- Create a DisplayContext as the base context if the activity token
is on a different display.
- Test for home display in more cases when manipulating home stack.
- Rename mDisplayInfos => mActivityDisplays.
- Create new method for moving task to front of stack regardless of
which display it is on.

Change-Id: I4fcb83ae844c5839ee3e2722229623d1a80ed921
/frameworks/base/core/java/android/app/ActivityThread.java
24bafbc93387be7e56116f9612e6d60ecbc0d66e 14-Nov-2013 Dave Allison <dallison@google.com> Add a call to registerAppInfo for the VMRuntime

This calls into the VMRuntime tells it where the
application directory is located.

Bug: 11539952
Change-Id: I20e0b8c63e459699a1bc9af435e65ae96f1e1e73
/frameworks/base/core/java/android/app/ActivityThread.java
6a0db5990187a71427029fb0fd64394e849aa057 14-Dec-2013 Kenny Root <kroot@google.com> resolved conflicts for merge of e0b14ea7 to master

Change-Id: Ie018d3e2eba1eb2d655c153880e1951b68c2bd51
e6585b32ea586743258a5457e2184ffc087f2d2f 13-Dec-2013 Kenny Root <kroot@google.com> Use java.util.Objects instead on internal API

Not needed since java.util.Objects implements all the needed
functionality.

Change-Id: Icd31d49a9801d1705427f028e9ac927d58e7d34c
/frameworks/base/core/java/android/app/ActivityThread.java
4524cc649affd5e83393ca07d5315fa09c617087 10-Dec-2013 Mathieu Chartier <mathieuc@google.com> am f2156ad2: am 6a58a2e7: am cb3ee4ed: am 3254260b: Merge "Update Dalvik process state through VMRuntime."

* commit 'f2156ad2db37ea3733cd090ec05aac3cb6860f2b':
Update Dalvik process state through VMRuntime.
3254260b8b55496468e2b897c76cadd9ecde508d 10-Dec-2013 Mathieu Chartier <mathieuc@google.com> Merge "Update Dalvik process state through VMRuntime."
cfbe9be5b3b701d95fb24fa0f7c8d9be43eec776 06-Nov-2013 Adam Powell <adamp@google.com> Add support for cross-activity scenes and transitions

* Add theme attributes for specifying a top-level TransitionManager
for an activity window.

* Add window feature for automatic content transitions. This
automatically assigns/creates a Scene for setContentView calls.

* Add named transitions. This allows apps to define APIs for
handshake-agreements about which exit/entrance transitions to play.

* Add new transition type for ActivityOptions. This lets the system
use ActivityOptions to communicate transition specifics and
arguments to the called activity.

* Have ActivityManager pass appropriate ActivityOptions through to the
called Activity. Have the called activity call back into the caller
to let it know which transition of a possible requested set was
chosen.

Still to do:

* Define and pass arguments for transitions. This will require
defining a Parcelable version of TransitionValues and deciding how
much leeway apps should have for these things.

* Determine how to appropriately filter the ActivityOptions bundle so
that only appropriate data reaches the target.

* Determine if generalizing the auto-Scenes functionality to
ViewGroups is appropriate.

Change-Id: I10684b926129ab2fbc1adec9ef31767237acae79
/frameworks/base/core/java/android/app/ActivityThread.java
1e37090caacc59c77c176db3329a4ad393e20013 18-Jul-2013 Mathieu Chartier <mathieuc@google.com> Update Dalvik process state through VMRuntime.

We now update Dalvik's process state through VMRuntime when the
process state changes in ActivityThread. This is used to determine
when to do trimming and will be used to determine when to do
compaction in the near future.

Bug: 8981901

Change-Id: I5eea272ba4ec2d1ed789b058d6457cb3c1fcf777
/frameworks/base/core/java/android/app/ActivityThread.java
e77187d01856fbc083d3fb651f43b2fb9ced716c 26-Oct-2013 Dianne Hackborn <hackbod@google.com> Fix issue #11391003: Allow dumpsys meminfo to be used with native processes

Change-Id: I005e4dc763deafac95dc3aa6261c06d1808fdaff
/frameworks/base/core/java/android/app/ActivityThread.java
9ef099713950805f6ffdd2e40d41991168a69576 16-Oct-2013 Jeff Brown <jeffbrown@google.com> Make dump messages asynchronous.

Prevents the dump actions from being blocked by traversals.

Removed a stale comment on queueOrSendMessage and renamed it to
reflect its current implementation since it no longer has a secondary
queue. Removed an unnecessary lock as well.

Bug: 10948648
Change-Id: Ic5fcc567212fb9cc07566c12f5f419af13c2b0b1
/frameworks/base/core/java/android/app/ActivityThread.java
dd97f4233fa8cca2a258c568f56a77c9bdc5fe74 09-Oct-2013 Jeff Sharkey <jsharkey@android.com> Install providers enabled after app started.

When an app has already been started, and a ContentProvider component
is enabled with DONT_KILL_APP, use the existing ProcessRecord to
install the provider.

Bug: 11118692
Change-Id: I990f18b337eb19768ee1db895f1e2eb982046cce
/frameworks/base/core/java/android/app/ActivityThread.java
bc74de6722f84e373cc77089e2843527afdd4c47 30-Sep-2013 You Kim <you.kim72@gmail.com> Wrong argument: handleUnstableProviderDiedLocked

mProvider is HashMap<ProviderKey, ProviderClientRecord>. String
is not correct object for KEY. Complete removal using iterator.

Bug: 11086495

Change-Id: I51e4576544ef02ede6f96938689dd4e43ec6eb4f
/frameworks/base/core/java/android/app/ActivityThread.java
8883ced18ac25199330843964634fdf70647a127 03-Oct-2013 Dianne Hackborn <hackbod@google.com> Implement issue #11050739: Show swapped out RAM

Add "swapped out" field to mem info everywhere.

Change-Id: I89abe8eb0e91fa5c193da93815dc592593c8a3c8
/frameworks/base/core/java/android/app/ActivityThread.java
7aa7601c09ab5d87cc15a0ed9a8f511d494a4cbc 30-Sep-2013 Jeff Sharkey <jsharkey@android.com> Detect wedged ContentProviders, treat as ANR.

All ContentProvider calls are currently blocking, making it hard for
an app to recover when a remote provider is wedged. This change adds
hidden support to ContentProviderClient to timeout remote calls,
treating them as ANRs. This behavior is disabled by default.

Update DocumentsUI to use a 20 second timeout whenever interacting
with a storage provider.

Bug: 10993301, 10819461, 10852518
Change-Id: I10fa3c425c6a7225fff9cb7a0a07659028230cd3
/frameworks/base/core/java/android/app/ActivityThread.java
cbd9a52f256087426feb19ac6e51eff772e81375 25-Sep-2013 Dianne Hackborn <hackbod@google.com> Fix issue #10903002: com.facebook.katana keeps itself in A Services

Now when memory low, if a service's process is above
a selected pss, then the process is not allowed to go
in to the service a list.

Also simplified the normal meminfo details dump to not
include the shared dirty and shared clean sizes by
default, since these can be very confusing. You will
still get to see them with the "-a" flag.

Finally some small steps to better managing service
processes in the LRU list, so hopefully we can some
day be better about letting them drop down in the list
when there isn't really much interesting happening in
the process. Not yet used at this point.

Change-Id: I654bfd6d05de2a63120185ebb15ffda8cbeb5dac
/frameworks/base/core/java/android/app/ActivityThread.java
3bc8f78d7a3d23a67c06221cc41292d04a2fd439 19-Sep-2013 Dianne Hackborn <hackbod@google.com> Implement issue #10691475: Kill cached processes if about to...

...be uncached and too large

When the device is in a low RAM state, when we go to pull a cached
process out to use for some background operation, we can now kill
the current process if we consider its size to be too large.

Note that the current implementation for killing processes is to
just use the same killUnneededProcessLocked() method that we already
have for other things like too many cached processes. This is a
little wrong here, though, because in this case we are at the
point where the caller is actually looking for a process to use.
This current code is not actually removing or cleaning up the
process, so we still need to return the now killed ProcessRecord
and let things fall out from there, which typically means the caller
trying to make an IPC on it and failing and falling into its "oh
no the process died unexpectedly" path. All code using this
*should* be able to handle this correctly, anyway, since processes
really can be killed at any time.

At some point we may to make this implementation cleaner, where it
actually tears down the process right in the call and returns a
null ProcessRecord. That is very dangerous however (we'd need to
go through all paths into this to make sure they are going to be
okay with process state changing on them like that), and I'm not
sure it is really worthwhile. This intention is that killing
processes like this is unusual, due to processes being too large,
and anyway as I wrote all of our incoming code paths must already
be able to handle the process being killed at this point and one
could argue this is just another way to excercise those code paths.
Really, the main negative to this is that we will often have spam
in the log with exceptions about processes dying unexpectedly.
If that is the only issue, we could just add some conditions to
quiet that up at in this case.

We don't want to compute the size of the process each time we try
to evaluate it here (it takes 10s or ms to do so), so there is now
a new field associated with the process to give us the last pss
size we computed for it while it was in the cached state.

To be able to have better cached pss data when we now need it, the
timing for computing process pss has been tuned to use a much
shorter delay for the situations when the process has first switch
into a new state. This may result in us having a fair amount more
pss data overall, which is good, as long as it doesn't cause us to
be computing pss excessively and burning cpu.

Procstats now also has new state to keep track of the number of
times each process has been killed by this new system, along with
the min, avg, max pss of all the times it has happened. This has
slightly changed the checkin format to include this additional data
at the end of pkgkills/prockills lines.

Other changes here:

- Fixed a problem where GPU RAM was not being seen when dumping
the full RAM details of a process. This was because in that
case the system would ask the process to compute its own MemInfo,
which it returned, but the process doesn't have permission to
access the files containing the GPU RAM data. So now the system
always computes the MemInfo and hands it to the app.

- Improved broadcast delays to not apply the delay if the next receiver
of the broadcast is going to run in the same process as the last
one. A situation I was seeing was an application that had two
receivers, one of which started a service; we are better off letting
the second receiver run while the service is running.

- Changed the alarm manager's TIME_TICK broadcast to be a foreground
broadcast. This really should have been anyway (it is supposed to
go out even minute, on the minute, very accurately, for UI elements
to update), and is even more important now that we are doing more
things to delay background broadcasts.

- Reworked how we maintain the LRU process list. It is now divided
into the two parts, the top always containing the processes holding
activities. This better matches the semantics we want (always try
to keep those around modulated by the LRU order we interleave with
other cached processes), and we now know whether a process is being
moved on the LRU list because of an activity operation so we can
only change the order of these activity processes when user operations
happen. Further, this just makes that common code path a lot simpler
and gets rid of all the old complexity that doesn't make sense any
more.

Change-Id: I04933ec3931b96db70b2b6ac109c071698e124eb
/frameworks/base/core/java/android/app/ActivityThread.java
7140a25f0135f473b66d01eb042471b2f0ebc836 11-Sep-2013 Adam Skory <skory@google.com> Revert services assist context in KitKat

Reverts extension to assist context API to query
foreground services for assist context data.

Also hides Intent.ACTION_VOICE_ASSIST because
nobody's actually using it yet.

Bug: 10461702
Change-Id: Idf6836adc659b434e11ebb2b98e8b814c94a7227
/frameworks/base/core/java/android/app/ActivityThread.java
1487466dc2ce14cccf0ff2bd2f824238aaa0044e 19-Jul-2013 Adam Powell <adamp@google.com> Add View#cancelPendingInputEvents API

This API allows an application to cancel deferred high-level input
events already in flight. It forms one tool of several to help apps
debounce input events and prevent things like multiple startActivity
calls, FragmentTransactions, etc. from executing when only one was
desired since it's otherwise not desirable for things like click
events to fire synchronously.

Change-Id: I60b12cd5350898065f0019d616e24d779eb8cff9
/frameworks/base/core/java/android/app/ActivityThread.java
46bfc4811094e5b1e3196246e457d4c6b58332ec 17-Aug-2013 Romain Guy <romainguy@google.com> Fix hardware layers lifecycle
Bug #10075732

Hardware layers could survive across EGL terminate events.

Change-Id: Ie8565d55cb29fe6625fa1584d695edfecd37ab5e
/frameworks/base/core/java/android/app/ActivityThread.java
77ece7b192d45351b313ee23270caab373d3c477 08-Aug-2013 Matt Casey <mrcasey@google.com> Merge "Extend assist context to foreground services"
602b232a06ede86999aa362a12eb28cbc782dc1d 03-Jul-2013 Jason Monk <jmonk@google.com> Add PAC File support for proxy configuration

PAC (Proxy auto-config) files contain a single javascript function,
FindProxyForURL(url, host). It gets called to determine what proxy should be
used for a specific request.

This adds PAC support to the system. The ProxyProperties has been modified
to hold the PAC file when one is present. The Proxy method
setHttpProxySystemProperty has been modified to insert a PacProxySelector
as the default ProxySelector when it is required. This new ProxySelector
makes calls to the ConnectivityService to parse the PAC file.

The ConnectivityService and the WifiConfigStore have been modified to support
saving the extra PAC file data.

The ConnectivityService now has a class attached (PacProxyNative) that
interfaces to the native calls for PAC files. The parsing of the PAC file
is handled by libpac (which is being added to external/) which utilizes
libv8 to parse the javascript.

As a fallback to applications that don't use the java ProxySelector, the proxy
is setup to point to a local proxy server that will handle the pac parsing.

bug:10182711
Change-Id: I5eb8df893c632fd3e1b732385cb7720ad646f401
/frameworks/base/core/java/android/app/ActivityThread.java
dfc7fd7818cda46b914c8a9d69d1ba00443ffe5b 06-Aug-2013 Adam Skory <skory@google.com> Extend assist context to foreground services

Add Service.onProvideAssistData(Bundle) which will be
called on foreground Services that have the new attr
in their manifest of provideAssistData = true;

Rename private reference to e.g. "getTopActivityExtras"
as "getAssistContextExtras" - do not rename the relevant
permission, since it is already public.

In ActivityManagerService, request extras both from the
top activity and from any foreground services with the
above attribute. Extend PendingActivityExtras as
PendingAssistExtras with a list of Services from which
extras are expected.

Reduce the timeout to or reporting extras from 4 sec to
just 500 ms.

Bug: 9526331
Change-Id: Ia03b96e8189033a68ae9c514c8cea0199a19bce8
/frameworks/base/core/java/android/app/ActivityThread.java
add005cf94dcc815d29b54588c76fd87929075b3 18-Jul-2013 Dianne Hackborn <hackbod@google.com> Mmmmmmm... lovely, lovely ArrayMap.

And ArraySet, too.

Change-Id: I72ea28cbb2286b01b6e1be082f8e7ec17e99074e
/frameworks/base/core/java/android/app/ActivityThread.java
a413dc06b2193442a2d956571b829aeb5fb97862 12-Jul-2013 Dianne Hackborn <hackbod@google.com> Add new proc state constants and delivery.

The activity manager now keeps a new "process state" for
each process, indicating the general execution and memory
state of the process. This closely follows the out-of-memory
adjustment and scheduling class that it currently tracks,
but roles these together (plus a little more info) into one
more semantically meaningful number.

This value is reported to each process as it changes, so they
can do things like tune the Dalvik garbage collector to match
the current process state.

I think I should also switch to this for process states. It
will give is more meaningful divisions of time for each process.

Also fix a problem in the activity stack where the previous
process was not being set correctly when moving between
activity stacks.

Change-Id: I598b1667dc46547f8fadae304e210c352cc9d41f
/frameworks/base/core/java/android/app/ActivityThread.java
fb20eb48aa95e438750fe2a32cd0b86897c71b4b 10-Jul-2013 Craig Mautner <cmautner@google.com> Merge "Add convertToTranslucent to API."
5eda9b330120f75964cd78b29f6101cc273c2a7e 02-Jul-2013 Craig Mautner <cmautner@google.com> Add convertToTranslucent to API.

Rename convertToOpaque to convertFromTranslucent. Add the
counterpart to Activity.convertFromTranslucent() for returning from
opaque to a translucent Activity. The caller should wait until
TranslucentConversionListener.onTranslucentConversionComplete() is
called before actually changing the background to translucent.

Change-Id: Id04b026bcc4dd8bad9a33a7af126e1bb28fb9c03
/frameworks/base/core/java/android/app/ActivityThread.java
88c0589969b17e66559cd2f132094cdaa0ee351d 28-Jun-2013 Craig Mautner <cmautner@google.com> Refactor ActivityThread cache - Baby step 1.

Introduce ResourcesManager and ResourcesKey as standalone classes.
Move DisplayMetrics and Resources HashMaps from ActivityThread to
ResourcesManager.

Change-Id: I20cc6c0dd1b74667354839e5ac9a660f4ee2d00d
/frameworks/base/core/java/android/app/ActivityThread.java
cfc837f7fa43362b5049f648fe1bfdf5a010cc1c 28-Jun-2013 Dianne Hackborn <hackbod@google.com> Start really collecting PSS data for process stats.

The activity manager now uses some heuristics to try to
sample PSS data from processes so that it can get enough
data to over reasonable time have something useful, without
doing it too aggressively.

The current policy is:

1. Whenever a significant global change happens (memory state,
sceen on or off), we collect PSS from all processes; this will
not happen more than every 10 minutes.
2. When all activities become idle, we will collect PSS from the
current top process; this will not happen more than every 2
minutes per process.
3. We will sample the top-most process's PSS every 5 minutes.
4. When an process's oom adj changes and it has been more than
30 minutes since PSS has been collected from it, we will
collect a new PSS sample.
5. If a process changes from service A to service B (meaning it
has been running a service for a long time), we will collect
a PSS sample from it.
6. If someone explicitly requests PSS data (for running services
UI or dumpsys), record that.

Also:

- Finish moving the procstats output all to the new format.
- Record information about processes being killed due to excessive
wake locks or CPU use in procstats.
- Rework how we structure common vs. per-package process stats to
make it simpler to deal with.
- Optimize the Debug.getPss() implementation (we use it a lot now).
Should probably optimize it further at some point.

Change-Id: I179f1f7ae5852c7e567de4127d8457b50d27e0f0
/frameworks/base/core/java/android/app/ActivityThread.java
8c84109b9fbbf473b225707a38261ff5f99d95fb 24-Jun-2013 Dianne Hackborn <hackbod@google.com> Use FastPrintWriter... everywhere.

One problem this turned up is, because FastPrintWriter does
its own buffering, a lot of code that used to use PrintWriter
would fail -- if it pointed to a StringWriter, there was no
buffering, so it could just immediately get the result. Now
you need to first flush the FastPrintWriter.

Also added some new constructors to specify the size of buffer
that FastPrintWriter should use.

Change-Id: If48cd28d7be0b6b3278bbb69a8357e6ce88cf54a
/frameworks/base/core/java/android/app/ActivityThread.java
48d0d1886731ff19ed3fb47a5997be5df0d1bba8 11-Jun-2013 Craig Mautner <cmautner@google.com> Add activity token to display system.

First step in adding activity specific information to displays.
Replace CompatibilityInfoHolder with DisplayAdjustmentsHolder that
holds an activity token in addition to the CompatibilityInfo.

Change-Id: Ie113cd8dd9c62e0b5311204e039a4829096bea68
/frameworks/base/core/java/android/app/ActivityThread.java
64770d16b0907a8e1ee81ef6c8fa398a6bdbee79 24-May-2013 Dianne Hackborn <hackbod@google.com> Some improvements to meminfo output.

- Rename "Swappable PSS" to "PSS Clean" which I think is what it
means and is consistent with the other memory metrics.
- Split at the top level the dalvik heap from other dalvik allocations,
so when you look on the dalvik allocations line things are consistent
with the allocator's data and it is clear what are app allocations vs.
other data in dalvik.
- Don't print lines that are all 0.
- Don't print the detailed Dalvik allocation data by default; add a new
option to have it printed.

Here's what a typical system process dump now looks like:

** MEMINFO in pid 6358 [system] **
Pss Pss Shared Private Shared Private Heap Heap Heap
Total Clean Dirty Dirty Clean Clean Size Alloc Free
------ ------ ------ ------ ------ ------ ------ ------ ------
Native Heap 0 0 0 0 0 0 6964 3599 2048
Dalvik Heap 7541 0 4344 7356 0 0 11768 11194 574
Dalvik Other 3553 0 2792 3448 0 0
Stack 28 0 8 28 0 0
Cursor 4 0 0 4 0 0
Ashmem 5 0 12 0 0 0
Other dev 4004 0 24 4000 0 4
.so mmap 3959 684 2500 2280 5468 684
.apk mmap 173 68 0 0 692 68
.dex mmap 4358 3068 0 0 9276 3068
Other mmap 60 0 8 8 244 36
Unknown 4387 0 508 4380 0 0
TOTAL 28072 3820 10196 21504 15680 3860 18732 14793 2622

Objects
Views: 10 ViewRootImpl: 1
AppContexts: 8 Activities: 0
Assets: 3 AssetManagers: 3
Local Binders: 176 Proxy Binders: 341
Death Recipients: 141
OpenSSL Sockets: 0

SQL
MEMORY_USED: 473
PAGECACHE_OVERFLOW: 98 MALLOC_SIZE: 62

DATABASES
pgsz dbsz Lookaside(b) cache Dbname
4 68 49 7/21/7 /data/data/com.android.providers.settings/databases/settings.db
4 20 17 0/13/1 /data/system/locksettings.db
4 20 21 96/14/2 /data/system/locksettings.db (1)
4 20 21 75/13/2 /data/system/locksettings.db (2)
4 80 29 4/17/3 /data/system/users/0/accounts.db

Change-Id: Ifd511a7baaa8808f82f39509a5a15c71c41d1bac
/frameworks/base/core/java/android/app/ActivityThread.java
3c61506b7147e13b9d39fc07fb189504fcab4541 13-May-2013 Anwar Ghuloum <anwarg@google.com> Add more memory usage stats

Added support for teasing apart different parts of the dalvik heap.

Note this adds more public api and we should talk to hackbod before going into master with this.

(cherry picked from commit 73407daf3f6110e933d8614605b21586c4c5fde2)

Change-Id: If4431f50e67e18bcc42e00694c97805477bd6815
/frameworks/base/core/java/android/app/ActivityThread.java
b1d45b3d3bd7a40169e941078cc09b885d730f38 03-May-2013 Anwar Ghuloum <anwarg@google.com> Fix small formatting issue with dumpsys meminfo

(cherry picked from commit 853d2b6bcd49af08458a2dbf2481bb931ef1c707)

Change-Id: I83cb5184ce9d7c029bd16eb16f131db280283536
/frameworks/base/core/java/android/app/ActivityThread.java
3a8ce1bec819c9b104880493a6862fd2a9546132 27-Apr-2013 Anwar Ghuloum <anwarg@google.com> More stats for meminfo

Added shared clean tracking (for pageable stuff). Renamed .oat and .art mmap.

(cherry picked from commit 967d53b17b6010c3a675ca9c3bbd0e9dd2f2f092)

Change-Id: I741e0dbe0d3f9aee6975c6fad8af9905942962d4
/frameworks/base/core/java/android/app/ActivityThread.java
e9ae6822a80cb1f3bd13c785f1727c03d35da52e 30-Apr-2013 Kenny Root <kroot@google.com> resolved conflicts for merge of 1f6e789b to jb-mr2-dev-plus-aosp

Change-Id: I06c05d637613215b6d83df3e29cd495f6a5a0176
12e752225aa96888358294be0d725d499a1c9f03 24-Apr-2013 Kenny Root <kroot@google.com> Track change to JSSE provider

Change-Id: I35e824e47ad758ab6408e91e2ba5dcda053a82f5
/frameworks/base/core/java/android/app/ActivityThread.java
b57a50bd16ce25db441da5c1b63d48721bb90687 12-Apr-2013 Dianne Hackborn <hackbod@google.com> Fix issue #8582003: Evernote Camera Capture Failure

ActivityThread.currentPackageName() was actually returning
the process name. Change this to return the package name, and
fix the one spot using it I could find that was actually wanting
the process name.

Change-Id: I323b9c5987106b5a090968e545281fc0ba55b6b8
/frameworks/base/core/java/android/app/ActivityThread.java
f9c7d6bc15b68393c1f0aa85c3c023c31244c3f2 25-Mar-2013 Jamie Gennis <jgennis@google.com> Add APIs for application-generated systrace events

This change adds new APIs to enable applications to generate custom Systrace
begin/end events. Application-generated events use the ATRACE_APP_TAG tag,
which is enabled only if either the application has declared itself debuggable
in its manifest or ro.debuggable is set to 1 on the device.

Change-Id: I311d09e2e6ed1a30f5ffa84907f250e11cc0d48d
/frameworks/base/core/java/android/app/ActivityThread.java
8b51475c97f8f2742047976283afbe1f9ef9fcbf 04-Feb-2013 Kenny Root <kroot@google.com> Revert "Remove AndroidKeyStore from API"

This reverts commit ce24985ad636c38b6ee01ec9cdecfb038bfeaeb6.

Change-Id: I02d6492c8db869619694c7209bb37522a7ec5a29
/frameworks/base/core/java/android/app/ActivityThread.java
174d90787c31027d98ad62c0c31e94910ee61b10 27-Mar-2013 Dianne Hackborn <hackbod@android.com> am bfd15fa0: am 6b96e2f0: Merge "Two REMOVE_PROVIDER messages caused by race condition."

* commit 'bfd15fa00557ea78567a30fe260dea62c37bd5a0':
Two REMOVE_PROVIDER messages caused by race condition.
9e3e5266506cb6817ea676e02d3099a7c44855f3 21-Mar-2013 Guobin Zhang <guobin.zhang@intel.com> Two REMOVE_PROVIDER messages caused by race condition.

Fix a bug in unstable ContentProvider.
IllegalStateException: ref counts can't go to zero here: stable=0 unstable=0
IllegalStateException: unstable count < 0: -1

There is a race between main thread and background database thread. Main thread
is responsible for handling the REMOVE_PROVIDER message. Database thread starts
insert or query request again and again. acquireProvider in db thread will often
snatch provider from the jaws of death, sometime it fails to remove REMOVE_PROVIDER
which is already fired out from MessageQueue. But completeRemoveProvider in main
thread gets suspended when trying to execute the critical section. If db thread
released the provider before main thread resumes the execution, then two
REMOVE_PROVIDER messages will be executed.

Change-Id: I8588aa1d1a8bc444dcd2adf6f8bc3f055cebbdc4
Signed-off-by: Guobin Zhang <guobin.zhang@intel.com>
/frameworks/base/core/java/android/app/ActivityThread.java
d0fd54648ca6249f56cf469c57181b5a7bbb71d0 29-Jan-2013 Svetoslav Ganov <svetoslavganov@google.com> Merge "Adding UI test automation APIs."
f9c5e0fe837a3090820da502ecaabc5accc00ace 23-Jan-2013 Dianne Hackborn <hackbod@google.com> Add new API to propagate contextual data to the assist action

When launching an assist, we have a new API allowing the
current foreground activity/application to provide additional
arbitrary contextual information that is stuffed in the
assist intent before it is launched.

Change-Id: I0b2a6f5a266dc42cc0175327fa76774f814af3b4
/frameworks/base/core/java/android/app/ActivityThread.java
80943d8daa6ab31ab5c486d57aea406aa0730d58 02-Jan-2013 Svetoslav Ganov <svetoslavganov@google.com> Adding UI test automation APIs.

This change adds APIs support for implementing UI tests. Such tests do
not rely on internal application structure and can span across application
boundaries. UI automation APIs are encapsulated in the UiAutomation object
that is provided by an Instrumentation object. It is initialized by the
system and can be used for both introspecting the screen and performing
interactions simulating a user. UI test are normal instrumentation tests
and are executed on the device.

UiAutomation uses the accessibility APIs to introspect the screen and
a special delegate object to perform privileged operations such as
injecting input events. Since instrumentation tests are invoked by a shell
command, the shell program launching the tests creates a delegate object and
passes it as an argument to started instrumentation. This delegate
allows the APK that runs the tests to access some privileged operations
protected by a signature level permissions which are explicitly granted
to the shell user.

The UiAutomation object also supports running tests in the legacy way
where the tests are run as a Java shell program. This enables existing
UiAutomator tests to keep working while the new ones should be implemented
using the new APIs. The UiAutomation object exposes lower level APIs which
allow simulation of arbitrary user interactions and writing complete UI test
cases. Clients, such as UiAutomator, are encouraged to implement higher-
level APIs which minimize development effort and can be used as a helper
library by the test developer.

The benefit of this change is decoupling UiAutomator from the system
since the former was calling hidden APIs which required that it is
bundled in the system image. This prevented UiAutomator from being
evolved separately from the system. Also UiAutomator was creating
additional API surface in the system image. Another benefit of the new
design is that now test cases have access to a context and can use
public platform APIs in addition to the UiAutomator ones. Further,
third-parties can develop their own higher level test APIs on top
of the lower level ones exposes by UiAutomation.

bug:8028258

Also this change adds the fully qualified resource name of the view's
id in the emitted AccessibilityNodeInfo if a special flag is set while
configuring the accessibility service. Also added is API for looking
up node infos by this id. The id resource name is relatively more stable
compared to the generaed id number which may change from one build to
another. This API facilitate reuing the already defined ids for UI
automation.

bug:7678973

Change-Id: I589ad14790320dec8a33095953926c2a2dd0228b
/frameworks/base/core/java/android/app/ActivityThread.java
66a017b63461a22842b3678c9520f803d5ddadfc 18-Jan-2013 Jeff Sharkey <jsharkey@android.com> Always give ContentResolver a valid Context.

Also add MockContentResolver constructor to provide a Context, and
move to singleton ActivityThread, since there is only one inside
each process. This makes ActivityThread accessible from threads like
InstrumentationThread.

Change-Id: Ib8b18f1b9bba8820ff412d782a43511066eabf24
/frameworks/base/core/java/android/app/ActivityThread.java
0c1761bd37815c3776608a19c8e11d862b3e910c 15-Dec-2012 Siva Velusamy <vsiva@google.com> DdmServer: add controls for OpenGL tracing

Add a new JDWP packet to allow control of OpenGL tracing.

Change-Id: Ic89e2f6299238a612df2f914581049f2cbba088c
/frameworks/base/core/java/android/app/ActivityThread.java
221d59f723584d316ea225bdaf1bc75cbfd7a794 29-Nov-2012 Dianne Hackborn <hackbod@google.com> am afdd978c: am 68e0da7e: Merge "Quiet down a lot of logging." into jb-mr1.1-dev

* commit 'afdd978ccd8d45ac789873dd4cf0ab0dd3f46d20':
Quiet down a lot of logging.
afdd978ccd8d45ac789873dd4cf0ab0dd3f46d20 29-Nov-2012 Dianne Hackborn <hackbod@google.com> am 68e0da7e: Merge "Quiet down a lot of logging." into jb-mr1.1-dev

* commit '68e0da7e397f6808a90509615c08c62bb00af6ba':
Quiet down a lot of logging.
40e9f2922cae76ffcbc521481e5be8e80e8744ef 28-Nov-2012 Dianne Hackborn <hackbod@google.com> Quiet down a lot of logging.

Also fix a little problem where the USER_STARTED broadcasts
were not being sent as ordered broadcasts(!).

Change-Id: I3aa3e0a9b3900967cdd2d115ee103371b0a50c41
/frameworks/base/core/java/android/app/ActivityThread.java
d9466f940ae3f04f8efede13b876d5968ff0e820 18-Oct-2012 Christopher Tate <ctate@google.com> am 2f296598: am 1ea75b88: Merge "Sanity-check erroneous backup agent instantiations" into jb-mr1-dev

* commit '2f2965985236d5cdc9cf2125055971da8e070e6f':
Sanity-check erroneous backup agent instantiations
2f2965985236d5cdc9cf2125055971da8e070e6f 18-Oct-2012 Christopher Tate <ctate@google.com> am 1ea75b88: Merge "Sanity-check erroneous backup agent instantiations" into jb-mr1-dev

* commit '1ea75b88b7ac4273b7a5395c5c57c6453d6cd3d1':
Sanity-check erroneous backup agent instantiations
346acb123dd87396726941b484be6fdd5cd4ea44 16-Oct-2012 Christopher Tate <ctate@google.com> Sanity-check erroneous backup agent instantiations

Two distinct changes:

Fix a bug seen in the wild where a newly-launched application will be
spuriously asked to instantiate a backup agent. What was happening
there is that some Activity Manager state was being left stale in certain
circumstances, and then in combination with app uninstall / install, there
could be a case where uid reuse wound up looking like an app identity
match.

We now positively verify before instantiating the agent that the intended
backup target package is uid-compatible with the app process that the
instantiation was requested of. The incomplete bookkeeping in the
Activity Manager has also been tightened up, and the Backup Manager is
more aggressive about cleaning up pending operations pertaining to
apps being uninstalled.

Bug 5874010

Change-Id: Ic389f4a96c9dcd0ba6b3962b579084033d8ae9f8
/frameworks/base/core/java/android/app/ActivityThread.java
85486bd33de1f3665f158df636217166c83199f5 04-Oct-2012 Dianne Hackborn <hackbod@google.com> am cd09cb8f: am 6fb7fd3a: Merge "Fix issue #7267494, issue #7212347" into jb-mr1-dev

* commit 'cd09cb8fb79442aa22018db9134ef1ef22059360':
Fix issue #7267494, issue #7212347
cd09cb8fb79442aa22018db9134ef1ef22059360 04-Oct-2012 Dianne Hackborn <hackbod@google.com> am 6fb7fd3a: Merge "Fix issue #7267494, issue #7212347" into jb-mr1-dev

* commit '6fb7fd3a0939413d8968fc0d404ed499d7f7dc52':
Fix issue #7267494, issue #7212347
c428aae6429c3fd5e2037c3793af399d9f6e23bf 04-Oct-2012 Dianne Hackborn <hackbod@google.com> Fix issue #7267494, issue #7212347

7267494 Calendar is not syncing
Check for whether a content provider is dead before returning
it. This is kind-of a band-aid, but probably the right thing
to do; I'm just not sure exactly the full details of why this
problem is happening. Hopefully this "fixes" it, though I don't
have a way to repro to tell.

7212347 System power off dialog is only visible to user 0
Make it visible. Also turn on some battery debugging stuff and
clean it up so we can just keep it.

Change-Id: I5add25bf2a763c8dfe1df23bc5c753a9ea5d157a
/frameworks/base/core/java/android/app/ActivityThread.java
02a3db9c6266910ab06937bd9e98b0703f8de5d0 02-Oct-2012 Dianne Hackborn <hackbod@google.com> am 79819093: am 11d8481f: Merge "Fix framework side of #7132432 com.android.vending:..." into jb-mr1-dev

* commit '7981909339d0ccd711efaf2ed531be8b57aeb270':
Fix framework side of #7132432 com.android.vending:...
7981909339d0ccd711efaf2ed531be8b57aeb270 02-Oct-2012 Dianne Hackborn <hackbod@google.com> am 11d8481f: Merge "Fix framework side of #7132432 com.android.vending:..." into jb-mr1-dev

* commit '11d8481f10a12caef0cfd9be7fe86e61d953d58f':
Fix framework side of #7132432 com.android.vending:...
11d8481f10a12caef0cfd9be7fe86e61d953d58f 02-Oct-2012 Dianne Hackborn <hackbod@google.com> Merge "Fix framework side of #7132432 com.android.vending:..." into jb-mr1-dev
689586d067c780c704b6ccef70adf5344b395fb6 02-Oct-2012 Dianne Hackborn <hackbod@google.com> Fix framework side of #7132432 com.android.vending:...

...java.lang.IllegalStateException: Can not perform this action
after onSaveInstanceStateat android.support.v4.app.FragmentManagerImpl
.checkStateLoss(FragmentManager.java:1300)

Framework fragment manager also needs to be told its state is not
saved earlier.

Change-Id: Ie5bb327fca6208f7eea6146a1b3223c61c9ecef6
/frameworks/base/core/java/android/app/ActivityThread.java
3645f2ccde5ae22e26358d9670ecbc563d415045 01-Oct-2012 Dianne Hackborn <hackbod@google.com> am 55241249: am 2a30547a: Merge "Work on issue #6949468: android.dpi.cts.ConfigurationScreenLayoutTest..." into jb-mr1-dev

* commit '552412496c00c04c9af353785936a89743677d49':
Work on issue #6949468: android.dpi.cts.ConfigurationScreenLayoutTest...
552412496c00c04c9af353785936a89743677d49 01-Oct-2012 Dianne Hackborn <hackbod@google.com> am 2a30547a: Merge "Work on issue #6949468: android.dpi.cts.ConfigurationScreenLayoutTest..." into jb-mr1-dev

* commit '2a30547af44536f6b0e2f7020ac1a435c72afc84':
Work on issue #6949468: android.dpi.cts.ConfigurationScreenLayoutTest...
fe37f8f51d90fc4c6230e54dcd1270df5fcc6be3 30-Sep-2012 Dianne Hackborn <hackbod@google.com> Work on issue #6949468: android.dpi.cts.ConfigurationScreenLayoutTest...

...#testScreenLayout failures on JO

This doesn't actually fix it; I have concluded that the test is broken
(the platform is correctly reporting that this is a NOT LONG device
because in portrait once you account for the status bar and system
bar our size is 880dp high and 600dp wide, which is not enough for us
to be in the LONG config).

However while working on this I noticed that the code for computing
the configuration of the external display was wrong. I have fixed
that by putting this code for computing these parts of the configuration
in a common place that both the window manager and external display
code can use.

Change-Id: Ic6a84b955e9ec345a87f725203a29e4712dac0ad
/frameworks/base/core/java/android/app/ActivityThread.java
7a0437b89a2982cd2ec1afb6fbe619d6842015e8 26-Sep-2012 Dianne Hackborn <hackbod@google.com> am e5215730: Merge "Maybe fix issue #7211766: bindService() to User u0 While u10 is..." into jb-mr1-dev

* commit 'e521573097390ce5465fc9b88dee2ae62f2317c6':
Maybe fix issue #7211766: bindService() to User u0 While u10 is...
b12e1354f25f04e9c9a71da76c6fca858b7d39d0 26-Sep-2012 Dianne Hackborn <hackbod@google.com> Maybe fix issue #7211766: bindService() to User u0 While u10 is...

...Forground Sometimes Doesn't Take

The main change here is a one-liner in ActiveServices to check the
uid when deciding whether to remove an item from mPendingServices.
This could cause the problem being seen -- if the same service for
two users is starting at the same time, the second one would blow
away the pending start of the first one. Unfortunately I have had
trouble reproducing the bug, so I don't know if this is actually
fixing it. It's a bug, anyway.

The reason so much has changed here is because I spread around
logging and printing of the user ID associated with operations and
objects to make it easier to debug these kind of multi-user things.

Also includes some tweaks to the oom manager to allow more background
processes (I have seen many times in logs where we thrash through
processes because the LRU list is too short), plus to compensate an
additional time-based metric for when to get rid of background processes,
plus some new logic to try to help things like Chrome keep around
their service processes.

Change-Id: Icda77fb2a1dd349969e3ff2c8fff0f19b40b31d3
/frameworks/base/core/java/android/app/ActivityThread.java
0b6a060400191cb3d3898bc621a23d8cc3c3d651 26-Sep-2012 Amith Yamasani <yamasani@google.com> am be47828f: Merge "Load resources for the correct user" into jb-mr1-dev

* commit 'be47828fbce3c647211b6948df4b61a27275cdff':
Load resources for the correct user
98edc951712823dbf5db2b7e9c203a0e98fc616b 25-Sep-2012 Amith Yamasani <yamasani@google.com> Load resources for the correct user

For apps that are only installed on secondary users, the SystemUI is
unable to see them by default. Added some methods to explicitly pass the
userId of the user the resources are requested for by the StatusBarIcon

Bug: 7214384

Also fix binding to remote views

Bug: 7192802

Change-Id: I5d6c5f624aa37fb231f3467f9764c8d99077a91d
/frameworks/base/core/java/android/app/ActivityThread.java
185c3a700d0ae80bfc13ea207c37a7b424f86867 25-Sep-2012 Jean-Baptiste Queru <jbq@google.com> am 7a7c6aa0: Merge into jb-mr1-dev

* commit '7a7c6aa0c35d80145e163d9e637180d3be127441':
Force activities to run on the second display for testing.
7a7c6aa0c35d80145e163d9e637180d3be127441 25-Sep-2012 Jean-Baptiste Queru <jbq@google.com> Merge into jb-mr1-dev

Change-Id: I821410e9ffcc7148139465c04ef335f0becc18c2
efd43bdb831351f1b0332ec3d55197e61e38bbb3 22-Sep-2012 Jeff Brown <jeffbrown@google.com> Force activities to run on the second display for testing.

This is a simple hack for testing and development purposes.
It makes the framework place the main window of an activity
on to a secondary display instead of on the default display.

Set the "debug.second-display.pkg" to a substring of the
package name of the activity that you want to have show
up on the secondary display, such as "com.example.android.apis"

Bug: 7183618
Change-Id: I0a9e7f27c8ff253253b9de57d4bc49f31d95a0e2
/frameworks/base/core/java/android/app/ActivityThread.java
e2bb66f64ce036409e9c306f4433f0dcc28f3847 24-Sep-2012 Jeff Sharkey <jsharkey@android.com> am 11820f73: Merge "Allow acquiring ContentProviders across users." into jb-mr1-dev

* commit '11820f7386ce86fd89e9e6b49d9231dce6e1ed07':
Allow acquiring ContentProviders across users.
6d51571835737c7502a2e111ee9dc2527ebad984 21-Sep-2012 Jeff Sharkey <jsharkey@android.com> Allow acquiring ContentProviders across users.

Otherwise services like SystemUI will always open content://-style
Uris as USER_OWNER. Surfaces through createPackageContextAsUser()
which points all ContentResolver operations towards a given user.

Start using in RemoteViews, so that Notifications correctly resolve
image Uris to the sending user. Also add user support for "content"
shell tool.

Bug: 7202982
Change-Id: I8cb7fb8a812e825bb0b5833799dba87055ff8699
/frameworks/base/core/java/android/app/ActivityThread.java
342737d54354ad2512c175617d769da415e3fab1 21-Sep-2012 Dianne Hackborn <hackbod@google.com> am e6f63800: Merge "Fix issue #7196015: system_server deadlock during setup wizard" into jb-mr1-dev

* commit 'e6f6380027d5c209eb17ec2567f00356ad32038a':
Fix issue #7196015: system_server deadlock during setup wizard
534a076c8168dc311a65eb027486f216d1f8e5e4 21-Sep-2012 Lei Zhang <rzhang@google.com> Fix auto-merger error in I74c0644c6938d28c20c42d88d995ffb56a71d703

Change-Id: If199aa3f01d1a7ea3f298504c0de4aa9a96e7451
/frameworks/base/core/java/android/app/ActivityThread.java
f445a77bf3218e89b863a3a06f92ba5355541a44 21-Sep-2012 Jason Simmons <jsimmons@google.com> resolved conflicts for merge of d053554f to jb-mr1-aah-dev

Change-Id: I8540083f7fd04e252c8879475f247ea6bbde8159
e6f6380027d5c209eb17ec2567f00356ad32038a 20-Sep-2012 Dianne Hackborn <hackbod@google.com> Merge "Fix issue #7196015: system_server deadlock during setup wizard" into jb-mr1-dev
b7faaf4c4029ea26f5f93958a51b7ae318feb50b 20-Sep-2012 Geremy Condra <gcondra@google.com> Push dropbox logging into libcore.

Change-Id: I74c0644c6938d28c20c42d88d995ffb56a71d703
/frameworks/base/core/java/android/app/ActivityThread.java
73c14161ec85629ebd6b5e24605a174305187e24 20-Sep-2012 Dianne Hackborn <hackbod@google.com> Fix issue #7196015: system_server deadlock during setup wizard

Can't aquire the providers lock while holding the main activity thead
lock, because we call into the activity manager with that lock held.

Change-Id: If27326a2caa46480d0f1b98608be9e8a862febe0
/frameworks/base/core/java/android/app/ActivityThread.java
131fa7fd55fe0086c9bf5c013fb15a4081f6dec5 18-Sep-2012 Dianne Hackborn <hackbod@google.com> am 4246f695: Merge "Try again to fix issue #6912004:tap on gmail notification sends me to home screen" into jb-mr1-dev

* commit '4246f695f44386ce74d94f5be73cde409dc2dd12':
Try again to fix issue #6912004:tap on gmail notification sends me to home screen
ad9b32115bf8c84a93ab30e6f30f8c46e86d7244 18-Sep-2012 Dianne Hackborn <hackbod@google.com> Try again to fix issue #6912004:tap on gmail notification sends me to home screen

Add a new call to the activity manager to tell it when the activity
is resumed, so it can mark its state as dirty then instead of when
it first tries to create it.

Also tweak things to update the LRU list for the upcoming activity
at the point we start pausing the current activity, to avoid an
inefficiency where we may decide to kill the process of the upcoming
activity if it is at the end of the LRU list.

Change-Id: Ia6dc8c34dc6d4b085a1efbe3a5d5f47721d55078
/frameworks/base/core/java/android/app/ActivityThread.java
84193b198f454c85c76e3ac0340a566f4a944f74 15-Sep-2012 Kenny Root <kroot@google.com> resolved conflicts for merge of 1c9894aa to jb-mr1-aah-dev

Change-Id: Ia640fa6a88fc75ac919eb542c1263756a9c3229a
ce24985ad636c38b6ee01ec9cdecfb038bfeaeb6 15-Sep-2012 Kenny Root <kroot@google.com> Remove AndroidKeyStore from API

Change-Id: Ibe09d78e5a5b86604f01144f344525bff94c2dde
/frameworks/base/core/java/android/app/ActivityThread.java
69689a735695585603244a49386536bc39299227 12-Sep-2012 Geremy Condra <gcondra@google.com> DO NOT MERGE Push event logging down into libcore.EventLogger

This changes the default behavior of the EventLogger from logging
to the normal logs to logging to the event logs.

Change-Id: I4338a1605928b82246a369adb3514bd31cd552e8

Conflicts:

core/java/android/app/ActivityThread.java
/frameworks/base/core/java/android/app/ActivityThread.java
b049e212ab7fe8967893c202efcb30fecfdb82fb 08-Sep-2012 Jeff Sharkey <jsharkey@android.com> Include user identifier in external storage paths.

When building external storage paths, always include user in path
to enable cross-user paths and aid debugging.

Each Zygote process continues to only have access to the appropriate
user-specific emulated storage through bind mounts. A second set of
mounts continue supporting legacy /sdcard-style paths. For example,
a process running as owner has these mount points:

/storage/emulated_legacy
/storage/emulated_legacy/Android/obb
/storage/emulated/0
/storage/emulated/obb

Since Environment is created before Zygote forks, we need to update
its internal paths after each process launches.

Bug: 7131382
Change-Id: I6f8c6971f2a8edfb415c14cb4ed05ff97e587a21
/frameworks/base/core/java/android/app/ActivityThread.java
d693dfa75b7a156898890014e7192a792314b757 10-Sep-2012 Siva Velusamy <vsiva@google.com> Report the user id of every app to ddms.

This CL extends the HELO and APNM packets to include the user id
of the application. This allows ddms users to differentiate between
the same app running for multiple users.

Bug 7110696.

Change-Id: I490d0e3781b8fb9db65cf81188677a0955650511
/frameworks/base/core/java/android/app/ActivityThread.java
a3909a93958676d341424d574752bc7b3280d421 09-Sep-2012 Jeff Brown <jeffbrown@google.com> Work around crash when display is removed.

After a display is removed, there may be a brief time
when a Context still exists that is bound to it.
We need to provide metrics in this case.

Bug: 7131637
Change-Id: I11b264a000653adbf0f3da399eaab66c4b40fb2a
/frameworks/base/core/java/android/app/ActivityThread.java
20e809870d8ac1e5b848f2daf51b2272ef89bdfc 01-Sep-2012 Dianne Hackborn <hackbod@google.com> Add registering for explicit users.

New API to register as an explicit user, which allows you to
also select ALL to see broadcasts for all users.

New BroadcastReceiver API to find out which user the broadcast
was sent to.

Use this in app widget service to handle per-user package broadcasts
and boot completed broadcasts correctly.

Change-Id: Ibbe28993bd4aa93900c79e412026c27863019eb8
/frameworks/base/core/java/android/app/ActivityThread.java
a492c3a7b2c18426fd0cb4d017eacbc368195dc5 24-Aug-2012 Jeff Brown <jeffbrown@google.com> Initial draft of high-level multi-display APIs.

This patch introduces the ability to create a Context that
is bound to a Display. The context gets its configuration and
metrics from that display and is able to provide a WindowManager
that is bound to the display.

To make it easier to use, we also add a new kind of Dialog
called a Presentation. Presentation takes care of setting
up the context as needed and watches for significant changes
in the display configuration. If the display is removed,
then the presentation simply dismisses itself.

Change-Id: Idc54b4ec84b1ff91505cfb78910cf8cd09696d7d
/frameworks/base/core/java/android/app/ActivityThread.java
bd6e1500aedc5461e832f69e76341bff0e55fa2b 28-Aug-2012 Jeff Brown <jeffbrown@google.com> Add initial multi-display support.

Split the DisplayManager into two parts. One part is bound
to a Context and takes care of Display compatibility and
caching Display objects on behalf of the Context. The other
part is global and takes care of communicating with the
DisplayManagerService, handling callbacks, and caching
DisplayInfo objects on behalf of the process.

Implemented support for enumerating Displays and getting
callbacks when displays are added, removed or changed.

Elaborated the roles of DisplayManagerService, DisplayAdapter,
and DisplayDevice. We now support having multiple display
adapters registered, each of which can register multiple display
devices and configure them dynamically.

Added an OverlayDisplayAdapter which is used to simulate
secondary displays by means of overlay windows. Different
configurations of overlays can be selected using a new
setting in the Developer Settings panel. The overlays can
be repositioned and resized by the user for convenience.

At the moment, all displays are mirrors of display 0 and
no display transformations are applied. This will be improved
in future patches.

Refactored the way that the window manager creates its threads.
The OverlayDisplayAdapter needs to be able to use hardware
acceleration so it must share the same UI thread as the Keyguard
and window manager policy. We now handle this explicitly as
part of starting up the system server. This puts us in a
better position to consider how we might want to share (or not
share) Loopers among components.

Overlay displays are disabled when in safe mode or in only-core
mode to reduce the number of dependencies started in these modes.

Change-Id: Ic2a661d5448dde01b095ab150697cb6791d69bb5
/frameworks/base/core/java/android/app/ActivityThread.java
92d570529c72c00ab456521a5b0237f62a6abdf5 23-Aug-2012 Amith Yamasani <yamasani@google.com> Handle null cache directory

data/android directory doesn't exist sometimes, and hence cache
directory creation fails. Don't crash the process due to that.

Change-Id: I22d7ed5df9c70f021a87029e89a13a11b4b0303b
/frameworks/base/core/java/android/app/ActivityThread.java
b4f56b5ea23325a492b61989a94a738be0fe9b8b 22-Aug-2012 Dianne Hackborn <hackbod@android.com> am 8b97ee6d: am b0b4a704: Merge "ActivityThread: Avoid creating duplicate handlers and reuse mH"

* commit '8b97ee6d8c26974a6fc9ce85c3d7a07ca1e9cac2':
ActivityThread: Avoid creating duplicate handlers and reuse mH
672cfdc5b6194a416eae93f5ebe82cb624e2add6 20-Aug-2012 Kenny Root <kroot@google.com> Merge "Add AndroidKeyStore provider for KeyStore API" into jb-mr1-dev
e29df16cb57b69995df597e8a6d95d986c1c43fc 10-Aug-2012 Kenny Root <kroot@google.com> Add AndroidKeyStore provider for KeyStore API

This introduces a public API for the Android keystore that is accessible
via java.security.KeyStore API. This allows programs to store
PrivateKeyEntry and TrustedCertificateEntry items visible only to
themselves.

Future work should include:

* Implement KeyStore.CallbackHandlerProtection parameter to allow the
caller to request that the keystore daemon unlock itself via the
system password input dialog.

* Implement SecretKeyEntry once that support is in keystore daemon

Change-Id: I382ffdf742d3f9f7647c5f5a429244a340b6bb0a
/frameworks/base/core/java/android/app/ActivityThread.java
98365d7663cbd82979a5700faf0050220b01084d 20-Aug-2012 Jeff Brown <jeffbrown@google.com> Refactor for multi-display support.

Split WindowManagerImpl into two parts, the WindowManager
interface implementation remains where it is but the global
communications with the window manager are now handled by
the WindowManagerGlobal class. This change greatly simplifies
the challenge of having separate WindowManager instances
for each Context.

Removed WindowManagerImpl.getDefault(). This represents the
bulk of this change. Most of the usages of this method were
either to perform global functions (now handled by WindowManagerGlobal)
or to obtain the default display (now handled by DisplayManager).

Explicitly associate each new window with a display and make
the Display object available to the View hierarchy.

Add stubs for some new display manager API features.

Start to split apart the concepts of display id and layer stack.
since they operate at different layers of abstraction.
While it's true that each logical display uniquely corresponds to a
surface flinger layer stack, it is not necessarily the case that
they must use the same ids. Added Display.getLayerStack()
and started using it in places where it was relatively easy to do.

Change-Id: I29ed909114dec86807c4d3a5059c3fa0358bea61
/frameworks/base/core/java/android/app/ActivityThread.java
848c2dc93b6795e171f3dd6f64ea0be65e2762ca 20-Aug-2012 Jeff Brown <jeffbrown@google.com> Stub out display manager service implementation.

Reverting to the previous stub as the display adapter registration
and the logical to physical mapping is not at all what we are going
to need moving forward.

Fixed up the service initialization order so that the display manager
service has a context from the start.

Change-Id: I717f2f1099c7a77180ef207c371ec8329258850a
/frameworks/base/core/java/android/app/ActivityThread.java
7335cfd9bb420c570c712ee081bb0927991227dd 19-Aug-2012 Vairavan Srinivasan <vairav@codeaurora.org> ActivityThread: Avoid creating duplicate handlers and reuse mH

sMainThreadHandler is used for notification of changes in
SharedPreferences and refers to a new instance of Handler instead
of the existing instance, mH, of the ActivityThread. Fix to reuse
existing handlers associated with main looper.

Change-Id: I794a5802a9eacdb188bd0619db5e70e3ae89a07d
/frameworks/base/core/java/android/app/ActivityThread.java
11de39a5cfa41e6518b7e9d171a0dc5888538c94 18-Aug-2012 Amith Yamasani <yamasani@google.com> Don't create cache directory for isolated processes

They don't have access anyway
This makes Chrome work in secondary users

Change-Id: I4d30581bc6e807901e642893d6964854c0567fec
/frameworks/base/core/java/android/app/ActivityThread.java
f02b60aa4f367516f40cf3d60fffae0c6fe3e1b8 16-Aug-2012 Dianne Hackborn <hackbod@google.com> Rename UserId to UserHandle.

This is the start of turning this into a formal public API.

Change-Id: I5786d2c320f1de41a06ed5d0f65adb68967287a0
/frameworks/base/core/java/android/app/ActivityThread.java
756220bd1912535840388a6743830d2e59ad4964 15-Aug-2012 Dianne Hackborn <hackbod@google.com> Add API to create new contexts with custom configurations.

This allows you to, say, make a Context whose configuration
is set to a different density than the actual density of the device.

The main API is Context.createConfigurationContext(). There is
also a new API on ContextThemeWrapper that allows you to apply
an override context before its resources are retrieved, which
addresses some feature requests from developers to be able to
customize the context their app is running in.

Change-Id: I88364986660088521e24b567e2fda22fb7042819
/frameworks/base/core/java/android/app/ActivityThread.java
dde331cebd87982faded6818ad5f9927ff994c96 03-Aug-2012 Dianne Hackborn <hackbod@google.com> We can now (kind-of) change screen density on the fly.

Preloaded drawables now have a density associated with them, so we
can load the correct drawable if we are using a different density.

Window manager now formally keeps track of the density for each
screen, allowing it to be overridden like you can already do with
size, and relies on this density to drive itself internally and
the configurations it reports.

There are a new set of Bitmap constructors where you provide a
DisplayMetrics so they can be constructed with the correct density.
(This will be for when you can have different windows in the same
app running at different densities.)

ActivityThread now watches for density changes, and pushes them
to the DENSITY_DEVICE and Bitmap global density values for that
process.

A new am command allows you to change the density.
/frameworks/base/core/java/android/app/ActivityThread.java
908aecc3a63c5520d5b11da14a9383f885b7d126 01-Aug-2012 Dianne Hackborn <hackbod@google.com> Start moving away from DisplayMetrics.DENSITY_DEVICE.

This puts in most of the infrastructure needed to allow us to
switch between different densities at run time. The main remaining
uses of the global are to initialize the Bitmap object (not sure
what to do about that since it doesn't have anything passed in
the constructor to get this information from), and being able to
load drawables if we need a different density than what was preloaded
by zygote.

Change-Id: Ifdbfd6b7a5c59e6aa22e63b95b78d96af3d96848
/frameworks/base/core/java/android/app/ActivityThread.java
d32460c5b7bea7b06e345397fdbaca58d9732dcf 21-Jul-2012 Jeff Brown <jeffbrown@google.com> Refactor local window manager implementation.

The objective of this refactoring is to remove the reliance on
WindowManager wrapper objects for compatibility mode and for
managing sub-windows.

Removed the WindowManager.isHardwareAccelerated() method since
it is never used.

Change-Id: I4840a6353121859a5e0c07d5cc307a437c595d63
/frameworks/base/core/java/android/app/ActivityThread.java
5f48fca218a2a0f67d4f5290619a656419f26a43 30-May-2012 Dianne Hackborn <hackbod@google.com> Fix issue #6579824: Email crash observed after updating...

...device from JRN59D to JRN60

Deal correctly with multiprocess content providers that need to
be loaded into a secondary process; wasn't correctly detecting the
case where the IContentProvider returned by the activity manager
is null. (installProvider used to be given the direct IContentProvider,
now it gets the ContentProviderHolder and much check whether the
provider inside is null.)

Change-Id: I888622e275a459031ab849952941f39cf9c02ee0
/frameworks/base/core/java/android/app/ActivityThread.java
6ae8d1821822296df0606c9cd1c46708cc21cb58 23-May-2012 Dianne Hackborn <hackbod@google.com> Fix (mostly) issue #5109947: Race condition between retrieving a...

...content provider and updating its oom adj

This introduces the concept of an "unstable" reference on a content
provider. When holding such a reference (and no normal stable ref),
the content provider dying will not cause the client process to be
killed.

This is used in ContentResolver.query(), .openAssetFileDescriptor(),
and .openTypedAssetFileDescriptor() to first access the provider
with an unstable reference, and if at the point of calling into the
provider we find it is dead then acquiring a new stable reference
and doing the operation again. Thus if the provider process dies
at any point until we get the result back, our own process will not
be killed and we can safely retry the operation.

Arguably there is still the potential for a race -- if somehow the
provider is killed way late by the OOM killer after the query or
open has returned -- but this should now be *extremely* unlikely.
We also continue to have the issue with the other calls, but these
are much less critical, and the same model can't be used there (we
wouldn't want to execute two insert operations for example).

The implementation of this required some significant changes to the
underlying plumbing of content providers, now keeping track of the
two different reference counts, and managing them appropriately. To
facilitate this, the activity manager now has a formal connection
object for a client reference on a content provider, which hands to
the application when opening the provider.

These changes have allowed a lot of the code to be cleaned up and
subtle issues closed. For example, when a process is crashing, we
now have a much better idea of the state of content provider clients
(olding a stable ref, unstable ref, or waiting for it to launch), so
that we can correctly handle each of these.

The client side code is also a fair amount cleaner, though in the
future there is more than should be done. In particular, the two
ProviderClientRecord and ProviderRefCount classes should be combined
into one, part of which is exposed to the ContentResolver internal
API as a reference on a content provider with methods for updating
reference counts and such. Some day we'll do that.

Change-Id: I87b10d1b67573ab899e09ca428f1b556fd669c8c
/frameworks/base/core/java/android/app/ActivityThread.java
13b907353f18215b52b5ceda24bbf520d91d72a1 21-May-2012 Romain Guy <romainguy@google.com> Remove unused, obsolete debug code

All these features have either been abandonned and left un-maintained
for years or can be replaced by systrace.

Change-Id: I42e4579a8078744047e5fe08a7a15254970b09bc
/frameworks/base/core/java/android/app/ActivityThread.java
03fcc333cf0fbbc4df1215649746d6360801efd8 15-May-2012 Dianne Hackborn <hackbod@google.com> Fix issue #6284404: ArrayIndexOutOfBoundsException in...

...FragmentManagerImpl.restoreAllState

This was a bug related to the difference between the pre- and post-HC
behavior of onSaveInstanceState(). Prior to HC, state was saved
before calling onPause(). Starting with HC, it is saved between
onPause() and onStop(). To maintain compatibility with existing
applications, there is a check in ActivityThread for pre-HC to in
that case emulate the behavior of old applications, still calling
onSaveInstanceState() before onPause() but using the state later.

One of the special cases we had to deal with in the old model of
saving state before pausing was restarting an activity that is
already paused.

Consider, for example: you have two activities on screen, the one on
top not fullscreen so you can see the one behind. The top activity
is resumed, the behind activity is paused. In the pre-HC world, the
behind activity would have already had its state saved.

Now you rotate the screen, and we need to restart the activities.
We need to destroy the behind activity and create a new instance,
but the new instance has to end up in the paused state. To
accompish this, we restart it with a flag saying that it should
end up paused. For the pre-HC world, since it ends up paused,
we need to make sure we still have its instance state kept around
in case we need it because we can't regenerate it (since it is
already paused).

So that is what the changed code here is doing. It goes through
the normal create/start/resume steps, but holds on to the current
saved state so that it isn't lost when resume clears it, and then
puts the activity back to paused and stuffs that old saved state
back in to it.

The problem is that this code was doing it for every application,
even HC apps. So we end up in a bad state, when a HC app has its
saved state sitting there as if it had been saved, even though it
is only paused. Now if we go to restart the activity again, instead
of asking it for a new saved state (as we should for a HC app as
part of stopping it), we just re-use the existing saved state again.

Now this wouldn't generally be a huge problem. Worst case, when we
restart the activity yet again we are just instantiating it from
the same saved state as we used last time, dropping whatever changes
may have happened in-between. Who cares? All it has been doing is
sitting there in the background, visible to the user, but not something
they can interact with. If the activity made changes to its
fragments, those changes will be lost, and we will restore it from
the older state.

However... if one of those fragements is a retained fragment, this
will *not* appear in the saved state, but actually be retained across
each activity instance. And now we have a problem: if the retained
fragments are changed during this time, the next activity instance
will be created from the most recent state for the retained fragments,
but the older state for everyting else. If these are inconsistent...
wham, dead app.

To fix this, just don't keep the saved state for HC apps.

Also includes a small optimization to ActivityStack to not push
the home screen to the front redundantly.

Change-Id: Ic3900b12940de25cdd7c5fb9a2a28fb1f4c6cd1a
/frameworks/base/core/java/android/app/ActivityThread.java
b61a02657b9e577179c934bbb5e199ce919c4642 15-May-2012 Dianne Hackborn <hackbod@google.com> Fix issue #6020164: Settings crashed on orientation change...

...while listening to TTS example

This was a nice one. What was happening is that immediately upon
being created, the activity was starting another activity in a
different process. The second activity would never show, just
immediately exit. However the original activity had time to
pause and get into stopping itself before the second activity had
come back to the activity manager to say it was going away, resulting
in the activity manager asking the original activity to resume.

At this point the activity manager's state is that the second
activity is finishing and gone, and the original activity is
resumed. However in the app process the original activity is
still working on stopping itself, and it eventually completes
this and tells the activity manager. The activity manager now
changes its state to STOPPED, even though it is actually resumed
and that is the last thing it told it to be, and it is now
proceeding to set itself in that state.

This would result later in the activity manager sending an
unnecessary state change to the application. In the case of
the screen here, we next do a rotation change, the activity
manager thinks the current state is STOPPED not RESUMED, so it
tells the application to relaunch the activity in a new config
but not in the resumed state. Now it does the whole "start a
new temporary activity" thing again, at which point it tries
to pause the original activity again, and we have an unbalanced
onPause() call to the app and it falls over.

Change-Id: I38b680746f4c61ae30e7ce831e1de187adf60902
/frameworks/base/core/java/android/app/ActivityThread.java
652b6d1e591f6684cda4b93d4712920f287991b4 10-May-2012 Dianne Hackborn <hackbod@google.com> Add infrastructure for accessing "unstable" content providers.

We have an API and some stuff that purports to this, but no real
implementation yet.

Change-Id: I93555440014a50fdf79fa3f65318d90fb82265b4
/frameworks/base/core/java/android/app/ActivityThread.java
92d7f9ff1c0c8a179ee935d86d3c94022980ead2 08-May-2012 Fabrice Di Meglio <fdimeglio@google.com> Merge "Fix bug #6408393 Character corruption is caused when locale is changed" into jb-dev
30ca5cd11a23f06f2f8eeaa587685450826f800f 08-May-2012 Fabrice Di Meglio <fdimeglio@google.com> Fix bug #6408393 Character corruption is caused when locale is changed

- free the TextLayoutCache on Locale change

- also free TextLayoutCache when memory is low

Change-Id: I39a37ac8ec3c292cfb1c0eea4bb41ff71897d089
/frameworks/base/core/java/android/app/ActivityThread.java
755c8bfbffe5134232217ef4c3998194b344ae17 08-May-2012 Dianne Hackborn <hackbod@google.com> Fix issue #6319312: Consecutive call to Activity's onCreate()/onResume()...

...without onPause() in between

There was a bug in the handling of "always finish activities" where we
would go through destroying activities while in the middle of updating
the activity stack. This would result in the activity behind the
non-full-screen activity being created and then immediately destroyed,
which things were not expecting.

Change-Id: Idaa89089f7b1af7eb747d7b8f9f394beeb2d23fa
/frameworks/base/core/java/android/app/ActivityThread.java
e1d330a071a4574040e6f1147800b4b2c8864043 02-May-2012 Jeff Sharkey <jsharkey@android.com> Set tmpdir to application cache directory.

Otherwise File.createTempFile() uses /sdcard which most apps don't
have write access to.

Bug: 6347289
Change-Id: Ibde191a63e4dbb9b03437406f8c999f192bcfa21
/frameworks/base/core/java/android/app/ActivityThread.java
1ded0b1f6af65c2f95f8327f7f3df4cee1bf2346 26-Apr-2012 Dianne Hackborn <hackbod@google.com> Add traces for window manager and activity manager.

Change-Id: I525d762db328e4c597da27b6b56d9a808e199756
/frameworks/base/core/java/android/app/ActivityThread.java
19f86e831ee0629b24385b0bb51d27ff91961dd2 24-Apr-2012 Romain Guy <romainguy@google.com> Invoke onTrimMemory with an EGL context
Bug #6369600

Change-Id: I3ded47c3688ef2f2873495392c35e898357204da
/frameworks/base/core/java/android/app/ActivityThread.java
162bc0ea0d7862b92f18d0ce47310a85304205f7 09-Apr-2012 Dianne Hackborn <hackbod@google.com> Some small tweaks to improve memory management.

We now allow processes that currently have stopping activities to
be managed as if they were done stopping, so that memory trimming
can be done before the process goes to the background. Hopefully
this will reduce cases where the processes goes to the background
and immediately gets killed, but wouldn't have had to be killed if
it had a chance to trim its memory.

Also change window memory trimming to always do the aggressive
trimming when memory is critical, even if not on a low-end device.

And tweak web view trimming to not trim for foreground UI events.

Change-Id: I241b3152b52d09757bd14a202477cf69c9b78786
/frameworks/base/core/java/android/app/ActivityThread.java
d893a890c92e174c1a4bf0075b0acc4749a0eaa8 02-Apr-2012 Brian Carlstrom <bdc@google.com> Add support for native library paths with instrumentation

(cherry picked from commit 8e658fd0415b3d6f44223c39a7e59a00cb0954aa)

Change-Id: Idb1e031d5deeea9305af8aacc17ae2d0d064dfc6
/frameworks/base/core/java/android/app/ActivityThread.java
d4577c0c29f8e38a34d1aeac59803b37769af790 24-Mar-2012 Romain Guy <romainguy@google.com> Merge "Destroy the hardware renderer when ViewRootImpl's die is post-poned Bug #6109035"
a998dff5d49a423aaf7097aa8f96bf5bdc681d25 24-Mar-2012 Romain Guy <romainguy@google.com> Destroy the hardware renderer when ViewRootImpl's die is post-poned
Bug #6109035

ViewRootImpl.die() can be invoked in such a way that doDie() will be
executed later. On memory limited device, an eglTerminate() may happen
before doDie() is executed which leads to unstable behaviors. This
change makes sure the renderer is destroyed as soon as possible.

Change-Id: I3322410cdd744b464951e2055aeade6069d1d673
/frameworks/base/core/java/android/app/ActivityThread.java
483f3b06ea84440a082e21b68ec2c2e54046f5a6 14-Mar-2012 Amith Yamasani <yamasani@google.com> Package restrictions per user

Packages can be enabled/disabled per user.
This requires maintaining stopped/launched states and
enabled / disabled components and packages per user.

Refactored pm.Settings and PackageSettingsBase to keep
track of states per user.

Migrated the stopped-packages.xml to users/<u>/package-restrictions.xml

Changed intent resolution to handle individual user restrictions.
Bunch of IPackageManager calls now have a userId argument.
Make AppWidgetService handle removals of packages.

Added some tests for pm.Settings and PackageManager.

Change-Id: Ia83b529e1df88dbcb3bd55ebfc952a6e9b20e861
/frameworks/base/core/java/android/app/ActivityThread.java
a4972e951bf2bdb7afdafee95b3ab0c15b8bacae 14-Mar-2012 Dianne Hackborn <hackbod@google.com> Add new "options" argument to all startActivity APIs.

This will be used to allow new features to be requested... such as,
say, a special kind of animation. Right now there are no options
defined.

Change-Id: I4eb6f27275cdd4bf186f6da316ab93a2372ad4b7
/frameworks/base/core/java/android/app/ActivityThread.java
92a8b22e7410e74e1cba1b856333116652af8a5c 10-Mar-2012 Siva Velusamy <vsiva@google.com> ActivityManager: add option to allow OpenGL trace.

This patch adds an option to enable tracing of OpenGL functions.
OpenGL tracing can be enabled by passing "--opengl-trace" option
to am start. This option requires either a device in debug mode,
or that the application itself has debug permission set.

Change-Id: I77788bfe97c9108943b1f947ce81afe8293d78a0
/frameworks/base/core/java/android/app/ActivityThread.java
eb00769e8983a02397db26a5413147a975b47c1f 03-Mar-2012 Jeff Sharkey <jsharkey@android.com> Merge "Allow disk I/O while performing dump()."
e861b423790e5bf2d5a55b096065c6ad0541d5bb 02-Mar-2012 Jeff Sharkey <jsharkey@android.com> Allow disk I/O while performing dump().

Add Closeable to ParcelFileDescriptor, and always close any incoming
PFDs when dumping.

Bug: 6106309
Change-Id: I25b465692d5e1da0a5980a307cb48a058bc2bca7
/frameworks/base/core/java/android/app/ActivityThread.java
b22d6c11efcb6b51315821c740b47b6deff30a12 02-Mar-2012 Teng-Hui Zhu <ztenghui@google.com> Merge "Allow webview to delete GL resource in a valid EGL context"
d9624138723c55a0ac2af58a2e78e98cd51eba27 02-Mar-2012 Teng-Hui Zhu <ztenghui@google.com> Allow webview to delete GL resource in a valid EGL context

bug:6079959

Change-Id: Idee1031b0bcc4aeb498a18eb01970a8ed7efd285
/frameworks/base/core/java/android/app/ActivityThread.java
6bff62c2fd1733832a81f613495f4ead14045b81 29-Feb-2012 Jeff Sharkey <jsharkey@android.com> Wrap StrictMode changes in try/finally.

Bug: 6091030
Change-Id: I2614f8bb30203e00953b1978bbcaf24d84d0397b
/frameworks/base/core/java/android/app/ActivityThread.java
7c5016787ec862445b1d4301787f46d52acfa88d 28-Feb-2012 Jeff Sharkey <jsharkey@android.com> Suppress StrictMode in handleBindApplication().

Allow disk access during application and provider setup. This could
block processing ordered broadcasts, but later processing would
probably end up doing the same disk access.

Bug: 6083825
Change-Id: I80f383063cedba2b099c78465134faa811e898d8
/frameworks/base/core/java/android/app/ActivityThread.java
a6f338ca5f0c8359d1952167858851dd025e47e2 25-Feb-2012 Jason Sams <rjsams@android.com> Do RS caching the same way HardwareRenderer does.
Eliminates the need for an application context for caching.

Change-Id: I4374738083b5eb4ce983d2cb5409428e3668c423
/frameworks/base/core/java/android/app/ActivityThread.java
a0c283eac33dd2da72235751bbfa4f2d9898d5ea 09-Feb-2012 Dianne Hackborn <hackbod@google.com> Add new feature for running services in "isolated" sandbox processes.

This reserves a range of uids (for each user) in which these processes
run. These uids are not associated with an application, so they
effectively run with no permissions. When a Service requests to
run in such a process through android:isolatedProcess="true", each
time it is brought up a new isolated process is started with its
own unique uid.

What we have so far gives us the basic infrastructure; more work
remains to further lock down what these uids have access to.

Change-Id: Ibfd27c75619cba61f528f46ede9113f98dc5f45b
/frameworks/base/core/java/android/app/ActivityThread.java
742a67127366c376fdf188ff99ba30b27d3bf90c 04-May-2011 Amith Yamasani <yamasani@google.com> Multi-user - 1st major checkin

Switching activity stacks
Cache ContentProvider per user
Long-press power to switch users (on phone)

Added ServiceMap for separating services by user
Launch PendingIntents on the correct user's uid
Fix task switching from Recents list
AppWidgetService is mostly working.

Commands added to pm and am to allow creating and switching profiles.

Change-Id: I15810e8cfbe50a04bd3323a7ef5a8ff4230870ed
/frameworks/base/core/java/android/app/ActivityThread.java
5e9120d4adfb07aeeadb0e0de1de2eb9ebbd80e0 30-Jan-2012 Romain Guy <romainguy@google.com> Always initialize AsyncTask on the main thread.

Change-Id: I039e5d6cb7157a0c8873e0d29161daf1cbda5577
/frameworks/base/core/java/android/app/ActivityThread.java
99b46be97bd02d304024d692de12e5779ed34355 26-Jan-2012 Teng-Hui Zhu <ztenghui@google.com> Merge "Make sure WebView get notified before the EGL context destroyed."
a34eb91a208937e06f9aa49f7a583c9f25e658e1 25-Jan-2012 Teng-Hui Zhu <ztenghui@google.com> Make sure WebView get notified before the EGL context destroyed.

bug:5639899

Change-Id: Id778cf3dac1d2f6d6b8014b7a911b51dc14fcc8a
/frameworks/base/core/java/android/app/ActivityThread.java
81e9276a479fd3a5ccc3129505c0fb018941934b 10-Oct-2011 Dianne Hackborn <hackbod@google.com> Added JELLY_BEAN version name; update some targetSdkVersion docs.

Change-Id: Ia38ff5b9ad2b63c2cf667260881222d9ff168052
/frameworks/base/core/java/android/app/ActivityThread.java
2a293b61cb0efbf24994d74ed980f58b820bb35a 19-Jan-2012 Jeff Brown <jeffbrown@google.com> Clean up SQLite debugging code.

Deleted a bunch of dead / useless code.
Raised number of logged operations in dumpsys dbinfo to 20.

Change-Id: I88344ff57a978f200c1f0172141d91e430caa1a9
/frameworks/base/core/java/android/app/ActivityThread.java
6754ba24f12a54b97b3ca1c5d29fc23c15980abe 15-Dec-2011 Jeff Brown <jeffbrown@google.com> Add plumbing for dumping database info using dumpsys.

Change-Id: I51b0364c3d3d41aa38a759fbce48e625fff1b2dd
/frameworks/base/core/java/android/app/ActivityThread.java
18cb28756caf02bf2b2f5e67c68451edaf719b47 15-Nov-2011 Marco Nelissen <marcone@google.com> Add ContentProvider.dump()

This is similar to the existing dump() facility for services.
ContentProviders can now implement dump() and that info will be shown
when running "dumpsys activity provider" and when taking a bugreport.

Change-Id: I33b3b132e3c4f920153355cc368eda2f725a715f
/frameworks/base/core/java/android/app/ActivityThread.java
1fbee79eb31011fa260d9fe088c165cc9171d98b 30-Nov-2011 Dianne Hackborn <hackbod@google.com> Fix issue #5679504: Device stuck and sudden reboot - Watchdog reset?

Calls to get the display size no longer need to acquire the global
window lock.

Change-Id: I751ea6ed0e20f1f521783f4bd5a8f9c31cd43573
/frameworks/base/core/java/android/app/ActivityThread.java
ddaa9ac896b279ed6a7bb54262c27764619700c9 12-Nov-2011 Jeff Brown <jeffbrown@google.com> Fix races when content providers are acquired and released.

This change fixes race conditions that occur very regularly when
content providers are accessed from multiple threads at the same
time.

When a content provider is not already in the application's cache,
the application needs to ask the ActivityManager to obtain it.
Meanwhile, another thread can come along and do the same thing.
This can cause problems because the application attempts to
install two copies of the provider and the reference counts
and other bookkeeping can get muddled.

Similarly, there are races between releasing the last reference
to a content provider and acquiring the content provider. It's
possible for one thread to snatch the content provider from the
jaws of death. We need to handle this explicitly to ensure that
the content provider does not accidentally get released right
after it was acquired by the other thread.

This change ensures that the reference count bookkeeping and
provider map are maintained in parallel while holding the same lock.
Previously because the lock was dropped and reacquired in the
middle of acquisition and removal, it was possible for a
content provider with a zero reference count to be returned
to the application. Likewise, it was possible for a content
provider with a non-zero reference count to be disposed!

This change also performs compensatory actions when races are
detected to ensure that the necessary invariants are maintained
throughout. In particular, it ensures that the application
drops a duplicate reference to a content provider when no
longer needed.

Another way to solve this problem would be to explicitly prevent
the races from happening in the first place by maintaining a
table of content providers that are in the process of being
acquired. The first thread to attempt to acquire the provider
would store a record. The next thread would find the record
and block until the first thread was finished. I chose not
to implement the code in that manner because we would still
have needed to perform compensatory actions in the case where
the same provider binder has multiple logical names. Also,
it could cause deadlocks if the attempt to acquire
a content provider were re-entrant for some bizarre reason.

Bug: 5547357
Change-Id: I2ad39a8acc30aaf7ae5354decd0a0a41e9b9c3da
/frameworks/base/core/java/android/app/ActivityThread.java
a95826582773a194ed7fb66bc29c9b82fe9bb8d1 10-Nov-2011 Romain Guy <romainguy@google.com> Initialize egl_cache with an app writeable file

Change-Id: I5dda234feab0fedd6e4179a80715ae20dee1c833
/frameworks/base/core/java/android/app/ActivityThread.java
d4d32c594f9a414821df147f503af5748d839c66 09-Nov-2011 Dianne Hackborn <hackbod@google.com> Don't crash if there is no connectivity service.

Change-Id: I5f991896125fda22ff99b98a6aca244adbb17449
/frameworks/base/core/java/android/app/ActivityThread.java
0500b3cfda5192efc09d6d4344b0c6c785c0a815 01-Nov-2011 Dianne Hackborn <hackbod@google.com> Some optimizations.

- Don't try to create a thumbnail bitmap on the client side. This
wastes 64k, and isn't needed since we are doing screenshots.
- Optimize View to put all of the callback pointers out of line.
Added a couple new APIs so these don't need to be protected/public.
- Lazily create ViewGroup's cache paint.
- Change FrameworkPerf app to not use HW accel drawing, to give better
comparison with GB.

Change-Id: Iec56d02459820d74a4cc9c7ec9c1856563c82c7b
/frameworks/base/core/java/android/app/ActivityThread.java
58f42a59bda3bc912d0d2f81dc65a9d31d140eaa 10-Oct-2011 Dianne Hackborn <hackbod@google.com> Fix issue #5405788: Device continuously opening and closing...

...the "Complete action using" dialog

When an application goes idle, it sends back to the activity manager
the configuration it last used, to make sure the two don't get out
of sync. Fix a bunch of edge cases here in dealing with that, and
be sure to also send the current configuration when launching an
activity so the client is always up-to-date when launching.

Also a small fix to not show the upgrading dialog during first boot.

Change-Id: I14ed366a87cd689d1c78787369e052422290ac6f
/frameworks/base/core/java/android/app/ActivityThread.java
836e262aa8e2f66548231ab11eb3b3e91d0e7901 05-Oct-2011 Dianne Hackborn <hackbod@google.com> Fix issue #5348948: Third Party app "Byki Turkish" shows...

...a tiny dialog (works fine in GB and HC)

I found two problems:

- When first binding an application, we were not correctly computing
the compat configuration.
- When retrieving the display metrics to hand to Resources, we were
using the one with compat applied. This is not right, because
Resources will apply the compat itself, so in some cases the compat
scaling was applied twice.

Change-Id: I22c9cfed9e271290c1a7544fa3ffa54a2e65daf9
/frameworks/base/core/java/android/app/ActivityThread.java
9ecebbfbf768fd63e9a6c9a09c86d81c7737ee2d 29-Sep-2011 Dianne Hackborn <hackbod@google.com> Add mechanism for Parcel to not allow FDs to be written to it.

This is to help implement issue #5224703.

Change-Id: I026a5890495537d15b57fe61227a640aac806d46
/frameworks/base/core/java/android/app/ActivityThread.java
3ad9d00cff03ebb6b24bb0d4e1fc2004cee0f5ea 16-Sep-2011 Jeff Sharkey <jsharkey@android.com> Fix "am profile" when run on system_server.

Split profiler controls into separate object, since system server
doesn't have an AppBindData.

Bug: 5327365
Change-Id: I613170cd94e0d4930dee049d0fe6c19124f13d65
/frameworks/base/core/java/android/app/ActivityThread.java
5d927c2d8e832fcfcb0154c8741f896001141ef4 02-Sep-2011 Dianne Hackborn <hackbod@google.com> Fix issue #5150899: Call activity takes 15MB we never get back.

Persistent process can no longer use hardware acclerated drawing
when running on a low-memory device.

Change-Id: I3110335617af1c98fcede9bf41f4a1d0c20d0e87
/frameworks/base/core/java/android/app/ActivityThread.java
ba24e4d8bbeb60e96d74f05e21691dad61ce497e 01-Sep-2011 Dianne Hackborn <hackbod@google.com> Fix issue #5229575: Youtube link shared through messaging is not...

...opening after selecting option "Youtube" as a luncher.

Also:

* Tweak window animations so that the wallpaper exist animations do not
stop too early (causing the wallpaper to suddenly disappear).
* Make sure no input is being processed while booting, to avoid
accidentally doing things especially in the upgrade dialog.
* Some other small cleanup.

Change-Id: I40a6b53731991d4e31ac4502e3d85f0e47507481
/frameworks/base/core/java/android/app/ActivityThread.java
cfb9f2bca39772aecd072e2a30342a67b6319bbb 24-Aug-2011 Dianne Hackborn <hackbod@google.com> Fix issue #5192141: systemui asplodes after enough tapping on the windowlist button

Change-Id: I5afb2d54b531d9eac9435660616579324f239812
/frameworks/base/core/java/android/app/ActivityThread.java
2a4c5acc27e546f11e578e9982d8c33deb6b88fb 23-Aug-2011 Jeff Brown <jeffbrown@google.com> Fix race in removeDeadProvider.
Bug: 5202824

It's possible for removeDeadProvider to be called after the provider
has already been removed from the provider map due to a race between
binderDied and removing the provider.

Deleted removeDeadProviderLocked; it was dead code.

Change-Id: Iecdc68703225e7ac171746e63f1b3141c6f2ce4c
/frameworks/base/core/java/android/app/ActivityThread.java
62f20ecf492d2b29881bba307c79ff55e68760e6 16-Aug-2011 Dianne Hackborn <hackbod@google.com> Add new am option to profile the launching of an activity.

Change-Id: Ie71a8043eafe41f53a0b3dbb5170276d87acbc9b
/frameworks/base/core/java/android/app/ActivityThread.java
b437e090ec03a2bab10bdfcb9484577a7f34e157 06-Aug-2011 Dianne Hackborn <hackbod@google.com> Improved memory use reporting.

Change-Id: I38e53e6228bba92a142bafeedb5af8df4e4e5724
/frameworks/base/core/java/android/app/ActivityThread.java
6311d0a079702b29984c0d31937345be105e1a5e 03-Aug-2011 Dianne Hackborn <hackbod@google.com> Clear the bitmap from the canvas in a lot of places.

Change-Id: I6b2071ac7b348c473b9bdd1b972d095aebbb4fb3
/frameworks/base/core/java/android/app/ActivityThread.java
c68c913d357e2955d4bd7ca52829071e531c7825 29-Jul-2011 Dianne Hackborn <hackbod@google.com> Various work on out of memory managment.

- Improve how we handle processes that have shown UI, to take care
of more cases where we want to push them into the background LRU
list.
- New trim memory level for when an application that has done UI
is no longer visible to the user.
- Add APIs to get new trim memory callback.
- Add a host of new bind flags to tweak how the system will adjust
the OOM level of the target process.

Change-Id: I23ba354112f411a9f8773a67426b4dff85fa2439
/frameworks/base/core/java/android/app/ActivityThread.java
65b345fa22b878e141b8fd8ece9c208df00fa40f 28-Jul-2011 Romain Guy <romainguy@google.com> Reclaim more memory, more often.

Yay.

Change-Id: I04557ad575c307a55088549f48f0e9ad994b7275
/frameworks/base/core/java/android/app/ActivityThread.java
c09bd156b74a3e366beb26cf1eb15a2912e8e02d 22-Jul-2011 Dianne Hackborn <hackbod@google.com> Merge "Fix bug where memory trim was not being delivered with correct level."
f0754f5ba7a45b517cffcb3c2c96f2a32aeac06d 22-Jul-2011 Dianne Hackborn <hackbod@google.com> Fix bug where memory trim was not being delivered with correct level.

Also improve how we handle services, keeping track of whether they showed
UI and if so putting them immediately on the LRU list.

Change-Id: I816834668722fc67071863acdb4a7f427a982a08
/frameworks/base/core/java/android/app/ActivityThread.java
7eabe55db6b113f83c2cefcd06812648927de877 21-Jul-2011 Romain Guy <romainguy@google.com> Add looper profiling to adb shell am

To profile the looper, run the following command:

adb shell am profile looper start <process> <file>
adb shell am profile looper stop <process>

Change-Id: I781f156e473d7bdbb6d13aaffeeaae88bc01a69f
/frameworks/base/core/java/android/app/ActivityThread.java
6dd005b48138708762bfade0081d031a2a4a3822 18-Jul-2011 Dianne Hackborn <hackbod@google.com> I. Can. Not. Stand. ViewAncestor.

It was done so we would have the name "ViewRoot" available for a
public API. However, the name "ViewAncestor" just makes no sense.
So instead, change it to ViewRootImpl.

Change-Id: If9599ca67896f339f6fefa7d1dde121201171d97
/frameworks/base/core/java/android/app/ActivityThread.java
bdf7609867a3f886455c51dba91623a86cceb6e2 19-Jul-2011 Romain Guy <romainguy@google.com> Trim OpenGLRenderer's memory usage whenever possible

Change-Id: I9225077184f374b1a43300add15cc1d5b6869d1c
/frameworks/base/core/java/android/app/ActivityThread.java
0e3328fbdd3845b0e2bec364e951498eaee6b079 17-Jul-2011 Dianne Hackborn <hackbod@google.com> Rework and fix "adb shell dumpsys meminfo"

We now collect more detailed information splitting the maps into
additional useful categories.

Fixed some bugs in account, such as not correctly handling all of
the current dalvik allocations.

The activity manager now prints a final summary of all pss organized
by the apps and the categories.

Change-Id: Iafc5f27c998095812b1483c6803b8e0f0587aeae
/frameworks/base/core/java/android/app/ActivityThread.java
ce86ba86df61de8b34b226a4eb6c23ec33e866e0 14-Jul-2011 Dianne Hackborn <hackbod@google.com> Improve handling of low memory.

Now classify background processes into a set of bins of how much
memory they should try to clear. The last bin also involves
destroying all activities in that process.

Removed the old code for the simulator that is no longer needed
(yay). The debugging features it had are now integrated into the
regular oom adj code.

Small fixes to load average service.

Change-Id: Ic8df401714b188c73b50dbc8f8e6345b58f1f3a0
/frameworks/base/core/java/android/app/ActivityThread.java
10e89712863f5b91a2982dc1783fbdfe39c1485d 09-Jul-2011 Jeff Brown <jeffbrown@google.com> Eliminate single-process mode.
Bug: 5010576

Change-Id: Id450dc83efed4897d1e4ff451530fed14457aace
/frameworks/base/core/java/android/app/ActivityThread.java
79ec80db70d788f35aa13346e4684ecbd401bd84 24-Jun-2011 Christopher Tate <ctate@google.com> Make full backup API available to apps

New methods for full backup/restore have been added to BackupAgent
(still hidden): onFullBackup() and onRestoreFile(). The former is the
entry point for a full app backup to adb/socket/etc: the app then writes
all of its files, entire, to the output. During restore, the latter
new callback is invoked, once for each file being restored.

The full backup/restore interface does not use the previously-defined
BackupDataInput / BackupDataOutput classes, because those classes
provide an API designed for incremental key/value data structuring.
Instead, a new FullBackupDataOutput class has been introduced, through
which we restrict apps' abilities to write data during a full backup
operation to *only* writing entire on-disk files via a new BackupAgent
method called fullBackupFile().

"FullBackupAgent" exists now solely as a concrete shell class that
can be instantiated in the case of apps that do not have their own
BackupAgent implementations.

Along with the API change, responsibility for backing up the .apk
file and OBB container has been moved into the framework rather than
have the application side of the transaction do it.

Change-Id: I12849b06b1a6e4c44d080587c1e9828a52b70dae
/frameworks/base/core/java/android/app/ActivityThread.java
f741e679c496f7345304a6543f01d7048e31d1a7 10-Jun-2011 Dianne Hackborn <hackbod@google.com> resolved conflicts for merge of e2aa0490 to master

Change-Id: Id0448a1598fc93aca0652b29253e02586e35a067
5fd2169eabd77e6bfafaf456e58051a3bafb2bca 07-Jun-2011 Dianne Hackborn <hackbod@google.com> 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
/frameworks/base/core/java/android/app/ActivityThread.java
3c43ced84184f19b8bb72f42894e37c97fdecab2 04-Jun-2011 Dianne Hackborn <hackbod@google.com> resolved conflicts for merge of d247ee41 to master

Change-Id: I49bd932f5019ce0608e2661d5cb7f24b6122dcba
2515db74fe2e75018f618591fabe23fda8362bf3 03-Jun-2011 Dianne Hackborn <hackbod@google.com> am 3a80c504: am 8b9a2b6c: am e6676351: Work around OpenFeint bug.

* commit '3a80c50485809fe72d6de83dacad494c5e84ed24':
Work around OpenFeint bug.
50469db07167e3a837e10f215baa4eacb1319604 03-Jun-2011 Dianne Hackborn <hackbod@google.com> am 7322e557: am a4cfcf10: am 75d6b3c2: Merge "Fix issue #4502672: Wrong xml resources used for homescreen widgets." into honeycomb-mr2

* commit '7322e557cfe42da42779625d69ced2db74a9df90':
Fix issue #4502672: Wrong xml resources used for homescreen widgets.
b46ed7636be9341b6ce0b158b3d86f34a437e6da 03-Jun-2011 Dianne Hackborn <hackbod@google.com> Add new Fragment API for explicitly saving/restoring state.

Also fix issue #4519821:
Blank screen displayed on tapping "Battery Use" option in the settings

We weren't correctly doing the full Activity resume code when coming
back from delivering a new Intent or result.

And fix a fragment problem where we still weren't correctly restoring
the state of list views. (I think this was from a bad manual-merge
from master.)

Change-Id: If79dc7e998155c39ab8c04781f6c73a82238a9ef
/frameworks/base/core/java/android/app/ActivityThread.java
546d64f56d0f930070289e26021f97638601e388 02-Jun-2011 Dianne Hackborn <hackbod@google.com> resolved conflicts for merge of 5c2e4d20 to master

Change-Id: Iadbee872468ceafb54c5877046c91f6052f3c953
e66763516a9c27c192adaba417616371a1c3c9bf 02-Jun-2011 Dianne Hackborn <hackbod@google.com> Work around OpenFeint bug.

Change-Id: Ib8320e50bb63fc56dc0118d5c8e9e328dbd3fcb1
/frameworks/base/core/java/android/app/ActivityThread.java
75a99709accef8cf221fd436d646727e7c8dd1f1 19-May-2011 Christopher Tate <ctate@google.com> 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
/frameworks/base/core/java/android/app/ActivityThread.java
2f0b17573d4324832f7a20402a3d2b5920bc4866 01-Jun-2011 Dianne Hackborn <hackbod@google.com> Fix issue #4502672: Wrong xml resources used for homescreen widgets.

There was a race in the system process between applying the initial
configuration and executing code in higher-level system services
like the app widget service that relies on the config. For some
reason it starting showing up more after my code changes; it should
now be completely fixed.

Also fix the activity starting window to run in compatibility mode
if its application is going to be in compatibility mode.

And some various cleanup and small fixes.

Change-Id: I0566933bf1bbb4259c1d99a60c0a3c19af1542e5
/frameworks/base/core/java/android/app/ActivityThread.java
df6e980e3f63eb0f6f9eb437fa925d5009cd9c44 26-May-2011 Dianne Hackborn <hackbod@google.com> Add new supports-screens attributes for declaring the compatible screens.

Change-Id: I40d57e4354e48accc1027c9f90916ea73eb5190d
android:requiresSmallestWidthDp provides the smallest supported width.
android:compatibleWidthLimitDp provides the largest compatible width.
/frameworks/base/core/java/android/app/ActivityThread.java
9a84983a9fd9959671e102045eaf185b83291269 08-Apr-2011 Dianne Hackborn <hackbod@google.com> DO NOT MERGE. Integrate from master: Improve activity manager debug dumps.

Activity manager now does all dump requests into apps
asynchronously, so it can nicely timeout if there is an
app problem. Also lots of general cleanup of the am
dump output.

Change-Id: I99447b87f77a701af52aeca984d93dfe931f065d
/frameworks/base/core/java/android/app/ActivityThread.java
4a627c71ff53a4fca1f961f4b1dcc0461df18a06 01-Apr-2011 Christopher Tate <ctate@google.com> 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
/frameworks/base/core/java/android/app/ActivityThread.java
aa9d84c37e05f696ec158dac98ce38cf41e18314 10-May-2011 Dianne Hackborn <hackbod@google.com> resolved conflicts for merge of 05be6d6f to master

Change-Id: Ic6a6c5bb300f6f1d43f9ed550b284282b4f16212
e2515eebf42c763c0a2d9f873a153711778cfc17 28-Apr-2011 Dianne Hackborn <hackbod@google.com> Better compat mode part one: start scaling windows.

First step of improving app screen size compatibility mode. When
running in compat mode, an application's windows are scaled up on
the screen rather than being small with 1:1 pixels.

Currently we scale the application to fill the entire screen, so
don't use an even pixel scaling. Though this may have some
negative impact on the appearance (it looks okay to me), it has a
big benefit of allowing us to now treat these apps as normal
full-screens apps and do the normal transition animations as you
move in and out and around in them.

This introduces fun stuff in the input system to take care of
modifying pointer coordinates to account for the app window
surface scaling. The input dispatcher is told about the scale
that is being applied to each window and, when there is one,
adjusts pointer events appropriately as they are being sent
to the transport.

Also modified is CompatibilityInfo, which has been greatly
simplified to not be so insane and incomprehendible. It is
now simple -- when constructed it determines if the given app
is compatible with the current screen size and density, and
that is that.

There are new APIs on ActivityManagerService to put applications
that we would traditionally consider compatible with larger screens
in compatibility mode. This is the start of a facility to have
a UI affordance for a user to switch apps in and out of
compatibility.

To test switching of modes, there is a new variation of the "am"
command to do this: am screen-compat [on|off] [package]

This mode switching has the fundamentals of restarting activities
when it is changed, though the state still needs to be persisted
and the overall mode switch cleaned up.

For the few small apps I have tested, things mostly seem to be
working well. I know of one problem with the text selection
handles being drawn at the wrong position because at some point
the window offset is being scaled incorrectly. There are
probably other similar issues around the interaction between
two windows because the different window coordinate spaces are
done in a hacky way instead of being formally integrated into
the window manager layout process.

Change-Id: Ie038e3746b448135117bd860859d74e360938557
/frameworks/base/core/java/android/app/ActivityThread.java
c6cc0f8c19d9eccf408a443fa2bf668af261dcd0 12-Apr-2011 Joe Onorato <joeo@google.com> Rename ViewRoot to ViewAncestor.

ViewRoot is about to be a new public class for poking at ViewAncestor.

Change-Id: Ie95d707c6d8bbb48f78d093d7b2667851812a7d5
/frameworks/base/core/java/android/app/ActivityThread.java
0c5001d776d56bae02a5cc2663286a125d99bc5e 13-Apr-2011 Dianne Hackborn <hackbod@google.com> Add APIs to remove tasks.

You can remove sub-tasks inside of a task, or an entire task.

When removing an entire task, you can have its process killed
as well.

When the process is killed, any running services will get an
onTaskRemoved() callback for them to do cleanup before their
process is killed (and the service possibly restarted).

Or they can set a new android:stopWithTask attribute to just
have the service automatically (cleanly) stopped at this point.

Change-Id: I1891bc2da006fa53b99c52f9040f1145650e6808
/frameworks/base/core/java/android/app/ActivityThread.java
43a17654cf4bfe7f1ec22bd8b7b32daccdf27c09 07-Apr-2011 Joe Onorato <joeo@google.com> Remove the deprecated things from Config.java. These haven't been working since before 1.0.

Change-Id: Ic2e8fa68797ea9d486f4117f3d82c98233cdab1e
/frameworks/base/core/java/android/app/ActivityThread.java
e17aeb31030cfeed339a39a107912ad5e9178390 08-Apr-2011 Dianne Hackborn <hackbod@google.com> Improve activity manager debug dumps.

Activity manager now does all dump requests into apps
asynchronously, so it can nicely timeout if there is an
app problem. Also lots of general cleanup of the am
dump output.

Change-Id: Id0dbccffb217315aeb85c964e379833e6aa3f5af
/frameworks/base/core/java/android/app/ActivityThread.java
9c1e23baf5bfbebd1aebbd6d9a18c225325567ce 24-Mar-2011 Chet Haase <chet@google.com> Add logging of graphics acceleration info to bugreports

Change-Id: I9fa4cda6ccf92df9d1c644ccdc0e7274a30106e0
/frameworks/base/core/java/android/app/ActivityThread.java
ed7e00729f78d11107f0e9a7f0559dfe4be6b560 24-Mar-2011 Brian Carlstrom <bdc@google.com> SamplingProfilerIntegration and SamplingProfiler improvements (3/3)

Summary:

frameworks/base
- fix profiling to collect data beyond the first snapshot
- avoid many small files, accumulate data over process lifetime

libcore:
- add support for VM specific sampling, trying to cut down overhead
- added support for converting snapshot files to text format
- fixed race in profiler when stopping

dalvik
- added VMStack.setThreadStackTrace interface for filling a stack
trace into an existing StackTraceElement[]

Details:

frameworks/base

Changed snapshots from text to binary hprof format (bumping version to 3)
Changed from one file per snapshot to one file per process lifetime.
Restart profiling after snapshot.

core/java/com/android/internal/os/SamplingProfilerIntegration.java

Add quick test in maybeSnapshot to avoid doing work when the
SamplingProfilerIntegration is disabled. Make maybeSnapshot
private. Remove unneeded memory allocation in handleLowMemory.

core/java/android/app/ActivityThread.java

libcore

Added ThreadSampler interface. This allows VM specific thread
sampling optimizations. The portable version continues to use
Thread.getStackTrace().

dalvik/src/main/java/dalvik/system/profiler/ThreadSampler.java
dalvik/src/main/java/dalvik/system/profiler/PortableThreadSampler.java
dalvik/src/main/java/dalvik/system/profiler/SamplingProfiler.java

Add VMStack.setThreadStackTrace and use in new DalvikThreadSampler
to avoid allocating a full stack trace when only a limited depth
is desired.

dalvik/src/main/java/dalvik/system/profiler/DalvikThreadSampler.java
dalvik/src/main/java/dalvik/system/VMStack.java

Refactored BinaryHprof.readMagic out of BinaryHprofReader so it
can be used by HprofBinaryToAscii converter to probing file
types. Added magic number constant to be shared between readMagic
and BinaryHprofWriter.

dalvik/src/main/java/dalvik/system/profiler/BinaryHprof.java
dalvik/src/main/java/dalvik/system/profiler/BinaryHprofReader.java
dalvik/src/main/java/dalvik/system/profiler/BinaryHprofWriter.java
dalvik/src/main/java/dalvik/system/profiler/HprofBinaryToAscii.java

Removed unneeded HprofWriter interface. Changed to simpler static
interface to write HprofData to binary and text formats.

dalvik/src/main/java/dalvik/system/profiler/HprofWriter.java
dalvik/src/main/java/dalvik/system/profiler/AsciiHprofWriter.java
dalvik/src/main/java/dalvik/system/profiler/BinaryHprofWriter.java
dalvik/src/test/java/dalvik/system/profiler/SamplingProfilerTest.java

Added support for reading snapshot files created by
SamplingProfilerIntegration by stripping the text header to allow
easier conversion to the text format.

dalvik/src/main/java/dalvik/system/profiler/HprofBinaryToAscii.java

Fixed race between Sampler and
SamplingProfiler.stop. SamplingProfiler.stop previously simply
called the Sampler's TimerTask.cancel method, but this does not
wait for a currently running Sampler to finish. The TimerTask
documentation says the only reliable way to do this is to have the
run() cancel itself, so that is what is now done, with new code to
ensure that SamplingProfiler.stop does not return until the
Sampler has been terminated.

dalvik/src/main/java/dalvik/system/profiler/SamplingProfiler.java

dalvik

Refactored VMStack_getThreadStackTrace to create helper getTraceBuf
used to implement new VMStack_setThreadStackTrace. The new version
interface fills an existing StackTraceElement[], avoid allocating
unnecessary StackTraceElements.

vm/native/dalvik_system_VMStack.c

Refactor dvmGetStackTraceRaw to create dvmSetStackTraceRaw which
fills in an existing, potentially smaller, StackTraceElement[].

vm/Exception.c
vm/Exception.h

Change stack depths to be unsigned to avoid signed/unsigned comparison warnings.

vm/Ddm.c
vm/Exception.c
vm/Exception.h

Change-Id: I4b90255e4e1d33ea2b569321c4968b0f3369f251
/frameworks/base/core/java/android/app/ActivityThread.java
d630f105e8bc0021541aacb4dc6498a49048ecea 18-Mar-2011 Joe Onorato <joeo@google.com> AsyncTask now uses the poll executor for apps up through HC MR1 and the serialized one after that.

Change-Id: I47d135ace5f8e78e4fa44ac9d1bf7abeeb9d3ba0
/frameworks/base/core/java/android/app/ActivityThread.java
9aa597e68b3fb30b079d627e1fcdea766e98ad26 04-Mar-2011 Svetoslav Ganov <svetoslavganov@google.com> Propagating core settings to the system process.

bug:3511123

Now the core settins are stored in the ActivityThread
instad in the AppBindData of the currently bound app.
Also the settings are pushed to the system process on
init.

Change-Id: I100bb7dc80d0d4548def22c328427bbef1694eb7
/frameworks/base/core/java/android/app/ActivityThread.java
54d068ec6af0ee6d261a135400efe6816c6f5ffe 02-Mar-2011 Svetoslav Ganov <svetoslavganov@google.com> Add system wide management of core settings

bug:3505060

Since we want to have some settings that are used very frequently
by many applications (long-press timeout is one example) these should
be managed efficiently to reduce lookups from different processes
because in the case of a cache miss a disk I/O is performed. Now
the system manages such core settings and propagates them to the
application processes.

Change-Id: Ie793211baf8770f2181ac8ba9d7c2609dfaa32a7
/frameworks/base/core/java/android/app/ActivityThread.java
98d169eacd65e6278bb8eab354f0278065771e9f 25-Jan-2011 Dianne Hackborn <hackbod@google.com> am 5d9d03a0: Maybe fix issue #3093599: java.lang.IndexOutOfBoundsException...

* commit '5d9d03a0234faa3cffd11502f973057045cafe82':
Maybe fix issue #3093599: java.lang.IndexOutOfBoundsException...
5d9d03a0234faa3cffd11502f973057045cafe82 24-Jan-2011 Dianne Hackborn <hackbod@google.com> Maybe fix issue #3093599: java.lang.IndexOutOfBoundsException...

...Invalid index 0, size is 0 at
android.app.ActivityThread.performPauseActivity(ActivityThread.java:2326)

It looks like if an arrow key is dispatched between the time the
list view is told its data set has changed and it does the resulting
layout pass, we could try to move the position to a now invalid
index. This may prevent that from happening.

Also put in a better error message if saving state of a fragment
whose target is no longer in the fragment manager.

And fix a bug in PackageManager where we could return a null from
queryIntentActivities().

And add a new API to find out whether a fragment is being removed,
to help fix issue #3306021: NPE at
android.app.AlertDialog.getDefaultDialogTheme(AlertDialog.java)

Next, for new HC apps we can delay committing data to
storage until the activity is stopped.

Finally, use the new multi-threaded AyncTask executor in a few
places, so we don't have worked blocked by long-running tasks from
the application.

Change-Id: I27b2aafedf2e1bf3a2316309889613fa539760f3
/frameworks/base/core/java/android/app/ActivityThread.java
db4e32fe68a50ea8ba75b434a88c1adeffb6018c 22-Jan-2011 Dianne Hackborn <hackbod@google.com> am f36af164: Merge "Whoops, actually exclude pre-HC apps." into honeycomb

* commit 'f36af16479e252bec168ed181885ec21d9df46f5':
Whoops, actually exclude pre-HC apps.
842e04b221048668e468cc06f09c9d18a39cbd3f 22-Jan-2011 Dianne Hackborn <hackbod@google.com> Whoops, actually exclude pre-HC apps.

Change-Id: I7266b3a622ae65f350bdb2a0eb6557b481a14365
/frameworks/base/core/java/android/app/ActivityThread.java
8a0f17560080077b972c97bf9d5b68961f148fe3 22-Jan-2011 Dianne Hackborn <hackbod@google.com> am 5503d803: Merge "Fix issue #3377999: Activities need to be stopped when sleeping" into honeycomb

* commit '5503d803ecee63d417128d3849717b59b971fc08':
Fix issue #3377999: Activities need to be stopped when sleeping
4eba96bb314d8ff773ea33d6cb3179f25751ecce 21-Jan-2011 Dianne Hackborn <hackbod@google.com> Fix issue #3377999: Activities need to be stopped when sleeping

This is a band-aid over the existing kludgy stopping mechanism
where the semantics of stop are different in the activity manager
than in the clients.

This change is intended to be as unobtrusive as possible, only
impacting the sleep case. I have a different change that
completely reworks how we stop activities to simply this all
a lot by unifying the semantics between the server and client.
However, it is too late in HC for such an extensive change. Later
I'll revert this one and put in the better solution.

Change-Id: Id77f2db1ec83469cdd888acb8fbc4679daa7766e
/frameworks/base/core/java/android/app/ActivityThread.java
11ce84fcaadb7051735dd50a35f6e6c234fbe480 21-Jan-2011 Nick Pelly <npelly@google.com> resolved conflicts for merge of 97ac2935 to honeycomb-plus-aosp

Change-Id: I5b510a3598adf17b738ecfe6bf8fbc47f7111350
7204528e71145e34bedd6cfb13110eb872d8a968 21-Jan-2011 Brad Fitzpatrick <bradfitz@android.com> am 9358bd39: Merge "Fixes for StrictMode instance count checking." into honeycomb

* commit '9358bd39dc8829ef8413294da70d44cd928ca878':
Fixes for StrictMode instance count checking.
5f8b5c191cae77f536ee64f0b625e4a7f8596787 21-Jan-2011 Brad Fitzpatrick <bradfitz@android.com> Fixes for StrictMode instance count checking.

Misc stuff found after looking at the first day of data, Jesse's
review, and comments from Dianne about tracking Activity counts
better.

Change-Id: Ifee1ef8f59f41061d4aac8c02765627dbf3cd8e4
/frameworks/base/core/java/android/app/ActivityThread.java
1426d6bdd889821fd83e355d54da989ca3370940 20-Jan-2011 Dianne Hackborn <hackbod@google.com> am b26a651b: Merge "Hook up large heap API." into honeycomb

* commit 'b26a651b47b5fc90a6685477aff5b76fdd1787f1':
Hook up large heap API.
de39851592679a545b8b6fb749507ccc7ec407f9 19-Jan-2011 Dianne Hackborn <hackbod@google.com> Hook up large heap API.

Change-Id: I215644f8de326fe3d4fa582447885b0aa01f72d3
/frameworks/base/core/java/android/app/ActivityThread.java
ce3224cda51f946871daa1e11e3976e25c59e6fa 17-Jan-2011 Jeff Hamilton <jham@android.com> Javadoc updates for NFC.

Change-Id: Ibd91829979576297599fbcc9eb8054924af1d527
/frameworks/base/core/java/android/app/ActivityThread.java
64e306430570fcfb35a1b14e1b333ad114b23829 16-Jan-2011 Dianne Hackborn <hackbod@google.com> am c237bb27: Merge "Add manifest API to request a large heap." into honeycomb

* commit 'c237bb2776facbfd3325ef23865fd7f6ced67f17':
Add manifest API to request a large heap.
3b81bc18bb661c02ad8074c39dab16644c1e65d0 15-Jan-2011 Dianne Hackborn <hackbod@google.com> Add manifest API to request a large heap.

You can now do android:largeHeap="true" on an application.

Doesn't yet do anything, waiting for Dalvik API.

Also tweak package parsing so that the SDK API level is set in the
configuration, allowing manifest resource value selection based on
that.

Change-Id: I6e035f9702a97b055416743b88f83a22ba4a9584
/frameworks/base/core/java/android/app/ActivityThread.java
93ec68e6a9ef0c6031db506dbd035a7ade6350ad 14-Jan-2011 Jeff Hamilton <jham@android.com> resolved conflicts for merge of 06bb3aef to honeycomb-plus-aosp

Change-Id: Ia7071ca07d917bd79e7697f4b0c0640ebb5f6a6f
52d3203ef69d4babbc4dd030a15c08c0b8d1d226 08-Jan-2011 Jeff Hamilton <jham@android.com> Add dispatching overrides for foreground apps.

Apps can register to override the default dispatching
but only when they're in the foreground.

Change-Id: I8e9a9254d3f79f097fb3c8c677d806043574ba4d
/frameworks/base/core/java/android/app/ActivityThread.java
bfddc0fe77f9b943bd35ab525c50f5ce9d7390f4 14-Dec-2010 Dianne Hackborn <hackbod@google.com> Work around issue #3241701: crash in ActivityThread.handleWindowVisibility

Change-Id: I9d5df3605f3d216e651e0a294409f82dea3968ad
/frameworks/base/core/java/android/app/ActivityThread.java
30d7189067524000c738c188c4ff91f84f474d25 11-Dec-2010 Dianne Hackborn <hackbod@google.com> Fix issue #3274841: Orientation change problem with a paused activity

Plus a bunch of debug output improvements.

And some new Intent helpers for dealing with restarting an app.

Change-Id: I50ec56bca6a86c562156b13fe8a6fdf68038a12e
/frameworks/base/core/java/android/app/ActivityThread.java
fb3806d68d51d336cba0ace697b1bae3e699a890 09-Dec-2010 Dianne Hackborn <hackbod@google.com> Fix issue #3271486: SetupWizward NullPointerException in

andriod.app.ActivityThread.performStopActivityInner

Change-Id: Ifce73b7fc48fedb4767d759f70c98fcdee510f36
/frameworks/base/core/java/android/app/ActivityThread.java
e2b0480f5e698b7d771b1c1348cc0bff2a72548d 09-Dec-2010 Dianne Hackborn <hackbod@google.com> Fix not saving state when restarting an activity.

Change-Id: I4c9e93e9523c9c62e3a15e6e4587ffad06280545
/frameworks/base/core/java/android/app/ActivityThread.java
0aae2d4e0075fd699cf40b26dca0eb2c3b3e37d2 08-Dec-2010 Dianne Hackborn <hackbod@google.com> Rework activity lifecycle so onSaveInstanceState() is after onPause().

The goal is to fix a bunch of fragment-related bugs caused by various
things trying to do fragment transactions after onPause()... which
currently throws an exception, since this is after the activity's state
has been saved so the new fragment state can be lost.

The basic change is relatively simple -- we now consider processes
hosting paused or stopping activities to be unkillable, and the client
code now does the onSaveInstanceState() as part of stopping the
activity.

For compatibility, if an app's targetSdkVersion is < HONEYCOMB, the
client side will still call onSaveInstanceState() prior to onPause()
and just hold on to that state until it needs to report it in once
being stopped.

Also included here is a change to generate thumbnails by taking
screenshots. The code for generating thumbnails by re-rendering
the view hierarchy is thus removed.

Change-Id: Iac1191646bd3cadbfe65779297795f22edf7e74a
/frameworks/base/core/java/android/app/ActivityThread.java
30c9bd89556137157b2f686637ece961454ccabe 02-Dec-2010 Dianne Hackborn <hackbod@google.com> Implement issue #3189564: New API to create an activity.

Change-Id: I7aef83324d653130eb3b2a148ba089d7347e6ba6
/frameworks/base/core/java/android/app/ActivityThread.java
00e40171892c73295b6e7221ed83126731230b98 29-Nov-2010 Vasu Nori <vnori@google.com> Revert "Merge "print certain rows from downloads.db when bugreports are taken""

This reverts commit 34878787f06c07b5cf14879254ef9abccffa631b, reversing
changes made to 5a2755d0c9220b6bc52cb1262927e27dc3dce6c1.
/frameworks/base/core/java/android/app/ActivityThread.java
624002b0d5b5bd812ca457fdfde0ead2b908eb7a 22-Nov-2010 Vasu Nori <vnori@google.com> print certain rows from downloads.db when bugreports are taken

when downloads fail/get stuck, we need to look at the database state
for those downloads. and when the users report such problems, it is
a royal pain not to have that info and most users don't seem to bother
sending database dumps because it is a bit of work.

so lets just dump info about downloads that failed or
downloads from GSF (OTAs, for example)

helps debugging. there is STOP ship comment to not dump data once
HC is released.

Change-Id: Id1254982fd82b4c55f1816a2491f00966840f024
/frameworks/base/core/java/android/app/ActivityThread.java
434203a277cd2f237a71508a3d5a7d1602126cd5 12-Oct-2010 Robert Greenwalt <rgreenwalt@google.com> Notify all VMs when proxy changes.

bug:2700664
Change-Id: I74cc6e0bd6e66847bf18f524ce851e3e9d2c4e87
/frameworks/base/core/java/android/app/ActivityThread.java
4d9e6d2bc21292619c48818d313112a2ec65ad52 15-Nov-2010 Brad Fitzpatrick <bradfitz@android.com> Disable CloseGuard early. (it defaults to spammy otherwise)

We already selectively enable it later when desired.

Change-Id: Ic428f13a57a2b4340ce343e73c32413b64fcd1af
/frameworks/base/core/java/android/app/ActivityThread.java
390dae1a8b8c2da6a24f3246c8c277645bcc75dc 10-Nov-2010 Brad Fitzpatrick <bradfitz@android.com> Move ApplicationPackageManager out of ContextImpl.java

Change-Id: I706bce3fc4a5c7e6ee351d677899a01ac222960c
/frameworks/base/core/java/android/app/ActivityThread.java
03595d01188d88c169e8c9dd51b357fd545e69cc 02-Nov-2010 Robert Greenwalt <rgreenwalt@google.com> Tell each VM to flush their DNS cache.

bug:3095357
Change-Id: I93de24e3e5a7d8b94d55f4facfffc863a2b8c202
/frameworks/base/core/java/android/app/ActivityThread.java
bfb191998eba2ebc710ff9eb59480b10909ba4c9 30-Oct-2010 Brad Fitzpatrick <bradfitz@android.com> StrictMode: annotate violations with the Broadcast Intent's action, if any.

Change-Id: If36ab776bb95054a109b5475c6be041c75c7e0af
/frameworks/base/core/java/android/app/ActivityThread.java
b6e18412af35bf724298796eed65ef1fbbe1925e 28-Oct-2010 Brad Fitzpatrick <bradfitz@android.com> Make network usage on the main thread fatal (Honeycomb+)

For apps targetting Honeycomb SDK or above, make network usage on the
main thread (aka event thread, Looper thread, UI thread) be fatal.

If an app is targetting a previous SDK version, they're grandfathered
into the older (lack of) rules.

Bug: 786847
Change-Id: Ia4ae77b8369567ee526c96b930d523bc722b0bc9
/frameworks/base/core/java/android/app/ActivityThread.java
e829fef63957a23b61cdb01bb692a17a041ff2dc 27-Oct-2010 Dianne Hackborn <hackbod@google.com> Add facility for broadcasts receives to do work asynchronously.

You can now call goAsync() and move your work to a background thread.
If you are that kind of receiver. You weirdo.

Also allows SharedPreferences.apply() to be committed off the main
thread after returning from onReceive().

Change-Id: I27f975910e28f230ababcaeb551eb9a78ec4fc76
/frameworks/base/core/java/android/app/ActivityThread.java
e71df8fa166eb2de7fcdecc14d958d3e3b796531 28-Oct-2010 Dianne Hackborn <hackbod@google.com> am 96abb48d: am aa93bcd6: Fix issue #3138926: App\'s preferences can be lost after onPause()
aa93bcd62482719c146a411008e1eac94135b6a4 27-Oct-2010 Dianne Hackborn <hackbod@google.com> Fix issue #3138926: App's preferences can be lost after onPause()

Change-Id: Icea3d37fab5e47c89c5cbc0adff7bbec898fa93e
/frameworks/base/core/java/android/app/ActivityThread.java
fb3cffeb35368da22f99b85d45039c4e6e471c06 26-Oct-2010 Dianne Hackborn <hackbod@google.com> Fix issue #3130426: Finsky crash in switching from window carousel

Need to note that we no longer have saved state before delivering
results or new intents to an activity.

Also do some work on loaders to prevent apps from making fragment
changes as a result of receiving loader data. This makes apps
consistent crash in a case that they would previously sometimes
crash (if they got the loader data after onPause).

Change-Id: I46e9e46d0aa05d9d7d6a275a2a488a18a20a5747
/frameworks/base/core/java/android/app/ActivityThread.java
c9d5b31f84f5c8b5db690491031369556ed7fee9 06-Oct-2010 Brian Carlstrom <bdc@google.com> Fix instance count to be long

Change-Id: I88b17c4ff17a04db6e931f9b25885bdf05d4453c
/frameworks/base/core/java/android/app/ActivityThread.java
c21550a8d1dfc9e5359fe994cb48049a0bd4c82c 06-Oct-2010 Brian Carlstrom <bdc@google.com> Adding android.os.Debug.countInstancesOfClass

- Debug.countInstancesOfClass is just a wrapper on
dalvik.system.VMDebug.countInstancesOfClass to avoid code from
depending on the dalvik classes directly

- Existing usages of VMDebug.countInstancesOfClass in ActivityThread
and ViewDebug are converted to the new Debug.countInstancesOfClass

- Existing use of OpenSSLSocketImpl.instanceCount, which is being
removed, is converted to Debug.countInstancesOfClass(OpenSSLSocketImpl.class)

Bug: 3015791
Change-Id: Iefa781292d5b82a63bad7254c913a09deb3b7888
/frameworks/base/core/java/android/app/ActivityThread.java
dc71b9e4d67327065a992924a021cad4bc100fa2 01-Oct-2010 Dianne Hackborn <hackbod@google.com> resolved conflicts for merge of 6a3eddb4 to master

Change-Id: I1ca1d100274d4a733ef2bf58b0d5d7217b4f858e
cef65eeb0315c3118bf8860d6f723cb49ff6bc52 01-Oct-2010 Dianne Hackborn <hackbod@google.com> Rub in a little 'ol log-b-gone.

Mmmmmm... great fresh scent!

Change-Id: I050e70b31b5d4a9c6731f15a4b51a3620a33a78d
/frameworks/base/core/java/android/app/ActivityThread.java
cca1f0e3476edd09cdd81b075a6b7780a2959b46 27-Sep-2010 Dianne Hackborn <hackbod@google.com> Allow all apps to call ContentResolver.getType().

I can't find the bug number for this, but it is needed for some things
we are doing where the app building an intent may not have access to the
URI in the data field. This is for HC, but doing in GB to avoid introducing
integration issues.

Change-Id: I0cac971854198b18775d2a73deb80f23431bfbe2
/frameworks/base/core/java/android/app/ActivityThread.java
8313fc7e94e46e5cc09f457a15a771a325b9f74f 27-Sep-2010 Dianne Hackborn <hackbod@google.com> Allow all apps to call ContentResolver.getType().

I can't find the bug number for this, but it is needed for some things
we are doing where the app building an intent may not have access to the
URI in the data field. This is for HC, but doing in GB to avoid introducing
integration issues.

Change-Id: I0cac971854198b18775d2a73deb80f23431bfbe2
/frameworks/base/core/java/android/app/ActivityThread.java
846df9f5171c4ef32f038cca651b6b9c0b6c3083 24-Sep-2010 Dianne Hackborn <hackbod@google.com> resolved conflicts for merge of 8952a448 to master

Change-Id: I9c752a5d10ae8d8e5ead1243b6abd4795204fc0b
287952c35e148811c106bc0f5036eabf20f71562 23-Sep-2010 Dianne Hackborn <hackbod@google.com> Fix issue #3022508: Crash during media scan

Don't kill processes for excessive wake lock use, even if they
are in the background, as long as they have running services.

Also fix some problems with this, such as not noting the kill
in battery stats.

And add killing of processes for cpu usage as well, along with
some optimizations to computing CPU usage.

And fix BatteryWaster to be better behaving for testing these
cases.

Add new "monitor" command to am to watch as the activity manager
does stuff (so we can catch things at the point of ANR).

Finally some miscellaneous debug output for the stuff here, as
well as in progress debugging of an ANR.

Change-Id: Ib32f55ca50fb7486b4be4eb5e695f8f60c882cd1
/frameworks/base/core/java/android/app/ActivityThread.java
625ac271f80777668f832a344486a6fcdc06d0ae 18-Sep-2010 Dianne Hackborn <hackbod@google.com> Work on fragments in layouts.

- Change semantics if IDs associated with these fragments, to
work correctly when placed in a container. If the container
has an ID or you have supplied a tag, the fragment's ID is
optional.

- To do this, there is a new LayoutInflater API that allows code
creating views to access the parent container that view will
be in.

- Fix issues with state management around these fragments. Now
correctly retains state when switching to a layout that doesn't
include the fragment.

Also:

- Add new simple list layouts for items that want to show an
activated state.
- Add new Activity.dump() that can be invoked with adb shell
dumpsys; the default implementation dumps fragment state.

Change-Id: I192f35e3ea8c53fbd26cf909095f2a994abfc1b6
/frameworks/base/core/java/android/app/ActivityThread.java
3c7131ffca4695f80dd2921faebedfbf2eece0d8 21-Sep-2010 Vasu Nori <vnori@google.com> bring database code in master for 'adb bugreport' in sync with ginger

Change-Id: Ibe9eb07db363b483a07645e9644d75db51132808
/frameworks/base/core/java/android/app/ActivityThread.java
9540a8d320d14b75203d9cc4ca65638fd06a94fb 21-Sep-2010 Vasu Nori <vnori@google.com> DO NOT MERGE - use appropriate names on SQL numbers in 'adb bugreport'

output now looks like the following
SQL
heap: 551 MEMORY_USED: 551
PAGECACHE_OVERFLOW: 113 MALLOC_SIZE: 50

DATABASES
pgsz dbsz Lookaside(b) Dbname
1 148 500 contacts2.db
1 8 0 (attached) presence_db
1 18 31 :memory:SQL

Change-Id: I8bb65a522fd9478ff2f6a8c27e69f9e6c10aef8a
/frameworks/base/core/java/android/app/ActivityThread.java
b835d9abd6d7c89bb1226fc83d1e96b3b04b9ee3 15-Sep-2010 Brad Fitzpatrick <bradfitz@android.com> am f26ac1f8: am 96d6c345: Merge "Unify some duplicate StrictMode-enabling code." into gingerbread

Merge commit 'f26ac1f8ed27d9e88bbde8978557c34788c7509c'

* commit 'f26ac1f8ed27d9e88bbde8978557c34788c7509c':
Unify some duplicate StrictMode-enabling code.
50d66f9fcdac84b2af65a82be56728f54b1a7ef0 14-Sep-2010 Brad Fitzpatrick <bradfitz@android.com> Unify some duplicate StrictMode-enabling code.

Change-Id: Ifb92f35d9e245dbdb5e201597d8be702bce9e8b8
/frameworks/base/core/java/android/app/ActivityThread.java
0b29554188f57ff1eec4150fa24f9a6a6603ed0f 11-Sep-2010 Brad Fitzpatrick <bradfitz@android.com> am 37fc8cc7: am b724d251: Merge "Enable strictmode logging in system_server & add a lock." into gingerbread

Merge commit '37fc8cc7b87133eddacaeab60cabefaf4a7b9bdd'

* commit '37fc8cc7b87133eddacaeab60cabefaf4a7b9bdd':
Enable strictmode logging in system_server & add a lock.
1e02d36b0f1dc833cf8a837c7619fbe6478694c8 10-Sep-2010 Brad Fitzpatrick <bradfitz@android.com> Enable strictmode logging in system_server & add a lock.

We weren't logging strictmode violation in the system_server process
in non-user builds (only system apps), even though the rest of the
strictmode logging supports it.

Also add a missing lock in ActivityManagerService.

Change-Id: If2af96a7e4fdde604a647b836097f0029ef1334b
/frameworks/base/core/java/android/app/ActivityThread.java
a14c8e0c67223fdc9a0746b370ae594a92530e78 04-Sep-2010 Romain Guy <romainguy@google.com> Bring back instances counts to dumpsys meminfo.

Change-Id: Idd846e137e8e87cb93551ba13751df60a8046eed
/frameworks/base/core/java/android/app/ActivityThread.java
5233920a216302b4aa03b100c32e8b3efe33cbc6 04-Sep-2010 Romain Guy <romainguy@google.com> Prevent the system process from using the HardwareRenderer.

This change allows applications with the system UID to use the hardware
renderer.

Change-Id: I3c5d776ee9c07bb14933dbe3060cad4175e4fc95
/frameworks/base/core/java/android/app/ActivityThread.java
c9ad7c6dbb1d70b831cd79416cbe493ade50ed2c 01-Sep-2010 Brian Carlstrom <bdc@google.com> resolved conflicts for merge of 41e99538 to master

Change-Id: Idddb72e369f127cd74322c3c7385701c2412e343
1751086360056bc60d00f2ed2988bc82be9e7bd9 18-Aug-2010 Brian Carlstrom <bdc@google.com> New Java-based SamplingProfiler

Summary:
- libcore: new Java based SamplingProfiler
- dalvik: remove old SamplingProfiler native bits
- frameworks/base: New placeholder SamplingProfilerIntegration
- vendor/google: remove old profiler snapshot parsing code

Details:

libcore

A new 100% Java SamplingProfiler. While it has more overhead that
the old native one, the new one can actually collect more than the
current PC and frame pointer, so you can get useful context of
where your app is spending time. It currently provides ASCII hprof
format output for use with tools like PerfAnal
dalvik/src/main/java/dalvik/system/SamplingProfiler.java

Unit test for the new SamplingProfiler
dalvik/src/test/java/dalvik/system/SamplingProfilerTest.java

Add core-tests-dalvik
JavaLibrary.mk

dalvik

Removing native code that supported the old SamplingProfiler
vm/Dvm.mk
vm/native/InternalNative.c
vm/native/dalvik_system_SamplingProfiler.c

frameworks/base

Placeholder SamplingProfilerIntegration. Later plans include
generating EventStackTrace protobufs.

New SamplingProfiler does not have a global instance, so
SamplingProfilerIntegration provides one in INSTANCE. Old binary
snapshot format is temporily replaced with ASCII hprof data.
core/java/com/android/internal/os/SamplingProfilerIntegration.java

Simplified interface for zygote profile snapshotting
core/java/com/android/internal/os/ZygoteInit.java

Current SamplingProfilerIntegration does not track event loop
explicitly, but hprof information does include thread information.
core/java/android/app/ActivityThread.java

vendor/google

Removing code for parsing old SamplingProfiler snapshot format
tools/samplingprofiler/Android.mk
tools/samplingprofiler/NOTICE
tools/samplingprofiler/profiler.iml
tools/samplingprofiler/profiler.ipr
tools/samplingprofiler/pull-snapshots.sh
tools/samplingprofiler/sorttable.js
tools/samplingprofiler/src/com/android/profiler/PrintHtml.java
/frameworks/base/core/java/android/app/ActivityThread.java
818c830c59fb8fb0fe7576f1e5a073ab599227c8 28-Aug-2010 Kenny Root <kroot@google.com> am 83285781: am 7046bd92: Merge "Allow native shared libraries in ASEC containers" into gingerbread

Merge commit '8328578152fbfd23952a6cda4b2e60853d78eb74'

* commit '8328578152fbfd23952a6cda4b2e60853d78eb74':
Allow native shared libraries in ASEC containers
85387d7ba36e56b291cbde87acb5a5b2200fe01c 26-Aug-2010 Kenny Root <kroot@google.com> Allow native shared libraries in ASEC containers

This change moves the native library handling earlier in the package
installation process so that it may be inserted into ASEC containers
before they are finalized in the DefaultContainerService.

Note that native libraries on SD card requires that vold mount ASEC
containers without the "noexec" flag on the mount point.

Change-Id: Ib34b1886bf6f94b99bb7b3781db6e9b5a58807ba
/frameworks/base/core/java/android/app/ActivityThread.java
7f7ce40f90cf00dc046fb9520d77d29e96b474d6 28-Aug-2010 Brad Fitzpatrick <bradfitz@android.com> resolved conflicts for merge of 28130bae to master

Change-Id: I13df8dc12092c3d2536e12216df9130d5914380a
333b8cba996c8ebb8ca55ebfc5cc536bdd64af94 26-Aug-2010 Brad Fitzpatrick <bradfitz@android.com> SharedPreferences$Editor.startCommit()

Adds a fire-and-forget save method (startCommit) to the
SharedPreferences.Editor, which is the way most people use it anyway.

This commit adds the implementation. The previous commit added the
interface and docs:

previous change: Idf9934b445da1fb72b79f0192218b47c0a7f5a34
git commit: edf32d01316bd3432c023f17747461b08ae36375

In addition, this change:

-- adds a generic "runPendingWorkFinishers" mechanism to
ActivityThread to wait on async operations that are still
in flight and use it for this.

-- ties runPendingWorkFinishers into Activity.onPause,
BroadcastReceiver, and Service.

-- makes sSharedPreferences keyed on name, not File, to avoid
unnnecessary allocations

-- documents and guarantees what thread
OnSharedPreferenceChangeListener callbacks run on

-- makes a few things in frameworks/base use startCommit(), notably
Preference.java (which was ignoring the return value anyway)

Change-Id: I1c8db60ad45643226fe6d246d3e513eeb7bd0ebd
/frameworks/base/core/java/android/app/ActivityThread.java
7f9106fb1f167607ce64a6013c24251971ab8bf8 25-Aug-2010 Brad Fitzpatrick <bradfitz@android.com> am 6cf1a8bf: am b1bbe99a: Merge "Some StrictMode API changes." into gingerbread

Merge commit '6cf1a8bfb04aead9cee5f59df4529a79c0a92dca'

* commit '6cf1a8bfb04aead9cee5f59df4529a79c0a92dca':
Some StrictMode API changes.
97461bd25c3821f3fb6af9705f0612259c6b4492 24-Aug-2010 Brad Fitzpatrick <bradfitz@android.com> Some StrictMode API changes.

* rename setThreadBlockingPolicy to setThreadPolicy (opens the way to
using StrictMode for non-blocking-related things in the future?)

* add allowThreadDiskWrites() and allowThreadDiskReads() to modify the
current policy mask and return the old one. this will allow turning
off part of StrictMode during certain regions of code. (for
instance, writing to disk in Activity onPause...)

Change-Id: Ia1878153713f79299971fdab567fa15b3cb9d56c
/frameworks/base/core/java/android/app/ActivityThread.java
37444f4239b26944d24f039c537d411ac7004243 21-Aug-2010 Dianne Hackborn <hackbod@google.com> am d172594e: am cf6d2a1d: Merge "Fix issue #2845673: android:exported="false" is not obeyed" into gingerbread

Merge commit 'd172594e3a1e25f1f2c190e99421cb7d4963389b'

* commit 'd172594e3a1e25f1f2c190e99421cb7d4963389b':
Fix issue #2845673: android:exported="false" is not obeyed
b424b633bb3664bed924d2ea89036290a57eb2bd 19-Aug-2010 Dianne Hackborn <hackbod@google.com> Fix issue #2845673: android:exported="false" is not obeyed

Thou shall obey.

Change-Id: I09f163a0db7cc9189c8d7f5116cc8ca9d4f7a76c
/frameworks/base/core/java/android/app/ActivityThread.java
74446cef55e75aa6bf4627f4c128768a2cdc5b63 16-Jul-2010 Brad Fitzpatrick <bradfitz@android.com> am f96c2719: am 0c36c96f: Merge "StrictMode: batch drop box writes for system apps" into gingerbread

Merge commit 'f96c2719c3cb4878e899b6fe0753b4f4b8aea8b7'

* commit 'f96c2719c3cb4878e899b6fe0753b4f4b8aea8b7':
StrictMode: batch drop box writes for system apps
ad13b9807b3311b5375e7b8acba894528c9146a8 14-Jul-2010 Brad Fitzpatrick <bradfitz@android.com> StrictMode: batch drop box writes for system apps

Change-Id: Iab49c15ecccefea1d36d86271e1ceb37d79e9449
/frameworks/base/core/java/android/app/ActivityThread.java
839458d8d4dbf44cd1778a23471cf8f948a2012c 15-Jul-2010 Jim Miller <jaggies@google.com> resolved conflicts for merge of e03952c0 to master

Change-Id: I414d934101d452a2c2500e539f0b0aff1e1b3ff0
0b2a6d0773211449fbde9d2706388714beeffebb 14-Jul-2010 Jim Miller <jaggies@google.com> Fix 2797185: Re-enable thumbnail generation in framework

This re-enables thumbnail generation code in the framework
with a few improvements.

In addition to enabling the system to capture thumbnails,
it removes padding from the borders to account for space
overlapped by system widgets (status bar, etc.). Thus,
the contents of the bitmap are only those pixels unique to
the activity.

It also maximizes resolution of the bitmap by capturing the
image in the application's current orientation. In landscape
mode, it captures a bitmap with dimensions w x h. In portrait,
it captures a bitmap with dimensions h x w. Where w and h are
thumbnail_width and thumbnail_height as defined in dimens.xml.

Though enabled, the change is not currently used in this
branch. The work is being checked in here to avoid
complicated downstream merges.

Change-Id: Ifc8a4e0075d7d0697d8159589be3816ace31d70c
/frameworks/base/core/java/android/app/ActivityThread.java
06a6b558bd03d8f0fed8f94f1dcfc03c5a51bd1c 14-Jul-2010 Andy McFadden <fadden@android.com> Implement native dump for "am dumpheap -n".

This adds the ability to generate a trivial heap dump on demand. If
the appropriate system properties aren't set, the output file will
instead contain instructions for enabling them.

The data returned by get_malloc_leak_info() is processed and written
to the specified file. The output looks something like:

Android Native Heap Dump v1.0

Total memory: 2981301
Allocation records: 2152

z 1 sz 65557 num 1 bt 8010dd78 afd12618 ...
z 1 sz 52008 num 3 bt 8010dd78 afd12618 ...
z 1 sz 24428 num 1 bt 8010dd78 8010de84 ...
...2149 more...
END

(the "..." is actually the remaining entries in the stack backtrace;
I truncated it here)

"z" indicates whether the allocation was made pre- or post-zygote,
"sz" is the size allocated, and "num" is the number of allocations
made of that size with the specified backtrace.

Change-Id: I2d60f07444fce5f7178b3f51c928c8faa0b051bd
/frameworks/base/core/java/android/app/ActivityThread.java
824c510752fd6a30cdba5ed7324cb80a5043ce26 10-Jul-2010 Andy McFadden <fadden@android.com> Allow "am" to initiate heap dumps.

This was mostly cloned from the "am profile" implementation. It's
intended to replace the old "kill -10" approach used by "runhat".

We could really use a native heap dump, so I pass a "managed"
flag through that indicates whether we want to dump the native or
managed heap. We don't currently have a native heap dump-to-file
function, so it currently just logs a warning.

(android.ddm.DdmHandleNativeHeap.getLeakInfo is a good start -- it
copies /proc/maps and then calls get_malloc_leak_info to get some
goodies. Needs some formatting to make it human-readable. I didn't
want to cram all that into this change.)

It would be useful if "am" didn't exit until the heap dump operation
completed, but I'm not sure how to do that.

Bug 2759474.

Change-Id: I46bc98067738d8c72ac0fc10002ca67bb4929271
/frameworks/base/core/java/android/app/ActivityThread.java
45886e606593708e342b6a546e45727036eabf7c 01-Jul-2010 Christopher Tate <ctate@google.com> am 705a2df9: am c8525edc: Merge "Remove memory monitoring from the system watchdog" into gingerbread

Merge commit '705a2df97c51c3e31ed36831a4302d705e0532b2'

* commit '705a2df97c51c3e31ed36831a4302d705e0532b2':
Remove memory monitoring from the system watchdog
c27181c7f3e11170ec82807cfa416f0a906ff574 30-Jun-2010 Christopher Tate <ctate@google.com> Remove memory monitoring from the system watchdog

This was originally written as an in-case-we-need-it facility, but was
never actually used in production. It also soaked up a surprising amount
of cpu on occasion, as well as doing sketchy things like demoting the
system_server's primary looper thread to the background cgroup at times.

Change-Id: I9a81a8d1e9caea9e0a1277d97785fe96add438d7
/frameworks/base/core/java/android/app/ActivityThread.java
8bb998d52c118d361390af89b14dd67a4563509a 25-Jun-2010 Dianne Hackborn <hackbod@google.com> am ea8eafad: am 2529a453: Merge "Make bad notifications crash their application." into gingerbread

Merge commit 'ea8eafad4f5438ec1291d45376959a996d36e15e'

* commit 'ea8eafad4f5438ec1291d45376959a996d36e15e':
Make bad notifications crash their application.
9d39d0cb361c5d3bba04a6bacf299be2162a6e92 25-Jun-2010 Dianne Hackborn <hackbod@google.com> Make bad notifications crash their application.

Implement notification manager handling of bad notifications, to
call a new activity manager to have the owner's process crashed
(if there is one).

Change-Id: Ib15e8d0c598756f3b39c99cc2045c18e054daf6b
/frameworks/base/core/java/android/app/ActivityThread.java
36e5f667bc889a7b1bc17f9a5bd44f33b2d47020 25-Jun-2010 Dianne Hackborn <hackbod@google.com> resolved conflicts for merge of 2eb12a47 to master

Change-Id: I79eb9d9f083e51ec1b99145d81632683669e7a99
01e4cfc47d0a2c7e7ab383d2fb23224ec52c0301 25-Jun-2010 Dianne Hackborn <hackbod@google.com> Some ActivityThread/ActivityManager cleanup.

- Move PackageInfo out of ActivityThread, renaming to LoadedApk.
- Rename some of the other PacakgeInfo inner classes to better
represent what they are.
- Rename HistoryRecord to ActivityRecord.
- Introduce AppGlobals, to eventually let ActivityThread become
package scoped.

Change-Id: Ib714c54ceb3cdbb525dce3db9505f31042e88cf0
/frameworks/base/core/java/android/app/ActivityThread.java
bde75706592c77379fb6546283e733abaca6fe04 28-May-2010 Sen Hu <senhu@google.com> wire up sampling profiler to dropbox

When system property "persist.sys.profiler_hz" > 0, SamplingProfilerService is
loaded to SystemServer. It creates a FileObserver, watching any new file in the snapshot
directory. When a snapshot is found, it is put in dropbox and deleted after that.

SamplingProfilerIntegration writes snapshots with headers. Headers are <name, value> pairs,
instantiated by caller.

Currently header format is (also in source comment):

Version: <version number of profiler>\n
Process: <process name>\n
Package: <package name, if exists>\n
Package-Version: <version number of the package, if exists>\n
Build: <fingerprint>\n
\n
<the actual snapshot content begins here...>

BUG=2732642

Change-Id: I2c1699f1728e603de13dbd38f9d8443cd3eecc06
/frameworks/base/core/java/android/app/ActivityThread.java
0c330e26e853e478bf1c3d63eae98a42a1c12bad 12-Jun-2010 Brad Fitzpatrick <bradfitz@android.com> am 11bd9d1e: am 94f14aec: Merge "More StrictMode work, handling violations in ActivityManagerService." into gingerbread

Merge commit '11bd9d1ec20ce3bbd3791b537faad429a1ca87e7'

* commit '11bd9d1ec20ce3bbd3791b537faad429a1ca87e7':
More StrictMode work, handling violations in ActivityManagerService.
46d42387464a651268648659e91d022566d4844c 11-Jun-2010 Brad Fitzpatrick <bradfitz@android.com> More StrictMode work, handling violations in ActivityManagerService.

Also starts to do duplicate-suppression.

Change-Id: I0502f6ab6c45fa319298de4874ecfe44b7829d21
/frameworks/base/core/java/android/app/ActivityThread.java
b60c941811cc15ab34fcc2f038aba56f862659b8 11-Jun-2010 Brad Fitzpatrick <bradfitz@android.com> resolved conflicts for merge of f37cbe6b to master

Change-Id: I529b17e55b9668f900f685f92e9831e14a82db05
438d0595121a7a2cdf19741e76e3c0e21a5c173d 10-Jun-2010 Brad Fitzpatrick <bradfitz@android.com> Introduce "StrictMode"

This is a new public API for developers to opt-in to strict rules
about what they're allowed to do on certain threads. (this is the
public face of the @hide dalvik.system.BlockGuard, added recently...)

In practice this will be used for developers to opt-in to declaring
that they don't want to be allowed to do various operations (such as
disk I/O or network operations) on their main UI threads. (these
operations are often accidental, or even when they are fast come with
a good chance of being slow or very slow in some cases....)

Implementation wise, this is just a thread-local integer that has a
bitmask of the things that aren't allowed, and more bits for saying
what the violation penalty is. The penalties, of which multiple can
be chosen, include:

* logging
* dropbox uploading for analysis/reporting
* annoying dialog
* full-on crashing

These are all only very roughly implemented at this point, but all
parts now minimally work end-to-end now, so this is a good checkpoint
commit before this gets too large.

Future CLs will polish all the above 4 penalties, including
checksumming of stacktraces and minimizing penalties for duplicate
violations.

Change-Id: Icbe61a2e950119519e7364030b10c3c28d243abe
/frameworks/base/core/java/android/app/ActivityThread.java
b4bc78b16a05554c57508b488e21dd8eca4e13e6 13-May-2010 Dianne Hackborn <hackbod@google.com> Further work on fragments:

- Implement all of the state saving and restoring machinery. This
caused some flux in the API.
- Add ability to have fragments that are retained across activity
instances.
- Fix some bugs.

Change-Id: Ib6b5b0752d7f8d667cfdcd3e76d127cc9b6d901b
/frameworks/base/core/java/android/app/ActivityThread.java
3d32f6e5228e5dfbfe88b24f6df64406628a3e0c 01-Apr-2010 Jeff Hamilton <jham@android.com> Add Activity.isChangingConfiguration().

This allows activities to know if they're being
torn down due to a configuration change.

Bug: 2557550
Change-Id: Ibd9bf5a06c92dbe3789049b84133cf4754381873
/frameworks/base/core/java/android/app/ActivityThread.java
67eb751e526539a7252a6d97173ed2c376fe3888 05-May-2010 Dianne Hackborn <hackbod@google.com> am 9bbc5683: am d9d009d7: am 3445dae3: am 65b2561c: Merge "Fix issue #2643754: Launcher is caching widget layouts for too long" into froyo
4416c3d6e4becd9ed39b89a03db0239c8225a135 05-May-2010 Dianne Hackborn <hackbod@google.com> Fix issue #2643754: Launcher is caching widget layouts for too long

With the .apk file names now changing during an update, we need
to make sure to flush all caches related to a package when the
package is removed. Otherwise we can continue to use the old
package, since its old file may still exist if we try to load it
too soon.

Change-Id: I15f08dffca3feac999dbca4f24bef12a30ca0a66
/frameworks/base/core/java/android/app/ActivityThread.java
2dedce6e84679ead961a485c7fe4b0f77c713b6a 15-Apr-2010 Dianne Hackborn <hackbod@google.com> Introducing Fragment.

Basic implementation of an API for organizing a single activity into separate,
discrete pieces. Currently supports adding and removing fragments, and
performing basic lifecycle callbacks on them.

Change-Id: I6ea8e6bdb04d93f8105c2e983fe9b6532422de34
/frameworks/base/core/java/android/app/ActivityThread.java
97107f0497c9afe549933a04ccc44858a0841c0b 15-Apr-2010 Dianne Hackborn <hackbod@google.com> am 093d621c: am 11d7502b: am 8656145e: Merge "Fix issue #593153: Broadcast time out when sending..." into froyo
399cccb85749e02f6d3e12d1d2846310e7cbfdf1 14-Apr-2010 Dianne Hackborn <hackbod@google.com> Fix issue #593153: Broadcast time out when sending...

...ordered broadcast for ACTION_EXTERNAL_APPLICATIONS_UNAVAILABLE

Turns out this was because the broadcast receiver for ContextImpl was
not correctly being created, so when it received an ordered broadcast
it would not tell the activity manager when it was done.

This is now fixed, along with a ton of superficial changes to debug
output to help track this down and a little cleanup of dealing with
error cases in dispatching broadcasts. Also a fix for a NPE when
dumping the broadcast state.

Finally, a little fiddling with package manager to get rid of a lot
of the noise when removing and re-adding packages on the SD card.

Change-Id: I961c14836dc613d3ea8122b6e910ef866e7fcb25
/frameworks/base/core/java/android/app/ActivityThread.java
90a36726b7553a1e7efd2f4ecbe01d7e1b3e7a67 12-Apr-2010 Vasu Nori <vnori@google.com> let apps set statement-cache size.

1. we should let apps set their statement-cache size. right n ow it is 250
is the statement-cache size for all apps and that is wasting
a lot of memory. each prepared statement is averaging about 1k-5K,
depending upon the complexity of sql and schema.
mnake default 25 and let apps increase the size, if they need to.

2. in "adb bugreport" info, print stats on the statement-cache hits/missies
and size (in number of statement cached). this will help us understand
how statement-cache is being used

Change-Id: Ic53a2842ef75823757492778158fcb8d5b4a28bb
/frameworks/base/core/java/android/app/ActivityThread.java
eb9e9ec06167b0caa459f2fb3f3fae094bb8d8f7 24-Mar-2010 Christopher Tate <ctate@google.com> Return the right thing from Context.getApplicationContext()

Previously, this would always return the app context for the first application
ever instantiated in the process. Usually this is fine, since usually there
will be one process per application, but in the case of shared-process apps,
it causes activities/views to try to access the wrong set of resources, be
unable to access their proper derived-class Application objects, etc.

Fixes bug #2513901

Change-Id: Ie19f2a86583c5d927db4d84a4262077450e37539
/frameworks/base/core/java/android/app/ActivityThread.java
ae07816a3fcae73fbbc4b23ec3f647d4bee473ce 18-Mar-2010 Dianne Hackborn <hackbod@google.com> Fix problem with calling onConfigurationChanged() too much.

We now return the initial configuration for a window when it is
added to the window manager. The view hierarchy would check to
see if it was different than the last one, and not dispatch a
configuration change down itself if not. However, when
ActivityThread received it, it would always dispatch a config
change even if it is the same.

The solution is to only do this in ActivityThread if the config
is actually different; otherwise, we continue to rely only on
the activity manager explicitly telling us when to do a config
change.

Change-Id: I8a6e3565776dd2723c8b791496bb6041463d4b67
/frameworks/base/core/java/android/app/ActivityThread.java
694f79b5d1196640d1beb680b7d1fc68e6e77cbd 18-Mar-2010 Dianne Hackborn <hackbod@google.com> Fix issue #2519590: Lock screen stuck in landscape mode

Well, mostly. There is still a problem here where the first time
you show the lock screen it just doesn't draw itself. I assume
this is something breaking in the view hierarchy as it floounders
around removing and adding new views as it is first being shown...
but no idea at this point what is the actual case.

Change-Id: Iba99ae3242931c8673b17b106c86fc99e2c52abe
/frameworks/base/core/java/android/app/ActivityThread.java
061d58a10122b2ef56d4c2ed46090add16fb5b17 13-Mar-2010 Dianne Hackborn <hackbod@google.com> Fix problem with starting a translucent activity in onCreate().

Fixes issue #2437252: Starting activity by means of startActivityForResult
causes 5 seconds delay if "android:windowIsTranslucent" is true

The optimization to avoid showing an activity window when a new
activity is being started was a little too aggressive. Now it
avoids doing this if there is not actually a fullscreen activity
on top to cover it.

Change-Id: I630e37a1f1d3b874b5a25572cbf887cebc2e3e91
/frameworks/base/core/java/android/app/ActivityThread.java
c9421ba1f46d9f9aeee833e1fde2cc263b058411 12-Mar-2010 Dianne Hackborn <hackbod@google.com> Fix issue #2492387: system server crash in WallpaperManagerService

Also move some of the important framework error logs over to Slog.

Change-Id: If6697c3e4f18498612ebd7b0e4e4f042fd713372
/frameworks/base/core/java/android/app/ActivityThread.java
c3849200fa60b22ea583ba2a6f902d6a632a5e7e 09-Mar-2010 Vasu Nori <vnori@google.com> add more debug info to SQL section in bugreport

after this CL, adb bugreport will the following info (under SQL section
of each app's meminfo dump)

SQL
heap: 344 memoryUsed: 344
pageCacheOverflo: 67 largestMemAlloc: 50

DATABASES
Pagesize Dbsize Lookaside Dbname
1024 7 24 googlesettings.db
1024 26 110 talk.db
1024 11 0 (attached) transient_talk_db
1024 11 32 subscribedfeeds.db
1024 20 27 gservices.db

Change-Id: Iabd13be9793d9794137c60a045b84fa632f13498
/frameworks/base/core/java/android/app/ActivityThread.java
4528186e0d65fc68ef0dd1941aa2ac8aefcd55a3 06-Mar-2010 Christopher Tate <ctate@google.com> Refactor android.backup => android.app.backup

Change-Id: I0b21316ff890d7f3c7d4b82837bb60670724c2e8
/frameworks/base/core/java/android/app/ActivityThread.java
778ce486656a00c21ae9b51cda1f504fc11004f6 09-Feb-2010 Brian Carlstrom <bdc@google.com> Issue 5697: getContextClassLoader returns a non-application classloader

ActivityThread should try to set the value for Java
Thread.getContextClassLoader to the PathClassLoader that loaded the
APK's classes so that Java frameworks that use the Java context class
loader, which is not to be confused with the
android.content.Context.getClassLoader which serves a similar purpose
in the Android framework.

However, we avoid setting the Java context ClassLoader to the APK's
PathClassLoader if there is a static indication that multiple packages
may share the VM, since they could load in an unpredictable order
leading to different values for the thread local Java context
ClassLoader. In this case, we instead use a specially created
WarningContextClassLoader that warns the user the first time the Java
context ClassLoader.

Currently the static indications that a package might share a VM with
other packages are the presence in the AndroidManifest of a
sharedUserId or requesting a non-default application process name.
/frameworks/base/core/java/android/app/ActivityThread.java
9e0f5d9a63ba88c2bf69df0557f8c9696db370c4 23-Feb-2010 Dianne Hackborn <hackbod@google.com> Fix some random bugs.

2185256: After open &close of device keyboard shortcut does not added to Home desktop.

ActivityThread was losing the last saved state when restarting or launching into
a paused state.

2366174: defaults not cleared when they should be

PackageManagerService now removes any preferred activity records for a package
when it is uninstalled.

2154556: Battery stats can have an unbounded number of wake locks

We now start combining wake locks into one shared record when we hit a
maximum limit (currently 20).

2442519: Foreground services can have no notification by providing a bogus one.

If the notification manager rejects our notification, the service is forced to
no longer be in the foreground.

2442383: Finalization issues in com.android.server.am.PendingIntentRecord.java

Cleaned up finalization to call super class and avoid the big activity manager
lock (we still need to use the locks inside of the message system, but these
are much less likely to be a problem).

2284190: Cannot call a phone number using adb

We weren't getting the calling uid/pid in startActivity() if the caller did not
supply an application record.
/frameworks/base/core/java/android/app/ActivityThread.java
e36d6e277e49475076b7872d36ea6a5c5b996e9d 18-Feb-2010 Dianne Hackborn <hackbod@google.com> Work on issue #2263557: PMF3000 showing hybrid of portrait and landscape modes

This is a bunch of reworking of how configuration changes are handled:

- When orientation is changing (for whatever reason), the window manager no
longer tries to pre-emptively compute a new configuration. Instead, it
just determines change is happening and tells the window manager.
- The activity manager is now responsible for giving the window manager the
final configuration it is using. This is both so it knows whem the
activity manager is done with its configuration updates, and so the window
manager can use the "real" configuration.
- When an orientation or other configuration change is happening, freeze the
screen and keep it frozen until the activity manager has given us the
final configuration.
- The window manager can now send new configurations to its clients during
its layout pass, as part of a resize, if it has determined that it has
changed. This allows for a new View.onConfigurationChanged() API for any
view to easily find out when the configuration has changed.
- ViewRoot now also works with the activity thread to make sure the process's
current resources are updated to the new configuration when it receives one
from a window. This ensures that at the time onConfigurationChanged() and
other view callbacks are happening, the correct configuration is in force.
- There is now a sequence number associated with Configuration, which
ActivityThread uses to avoid using stale configurations. This is needed now
that it can receive configurations asynchronously from both the window
manager and activity manager.
- The hack for keeping the locale has been removed, and underlying problem
fixed by having Configuration initialize its locale to "unknown" instead of
a valid default value.
/frameworks/base/core/java/android/app/ActivityThread.java
2155637d0028e87ebaaf71b9a77f3c43853e8f2f 05-Feb-2010 Dianne Hackborn <hackbod@google.com> Rename ApplicationContext to ContextImpl.

I've been wanting to do this for a long long time.
/frameworks/base/core/java/android/app/ActivityThread.java
2a9094d07915a077026a651a7773f94322bf7d23 04-Feb-2010 Dianne Hackborn <hackbod@google.com> Framework part of issue #2391576: Add method to start the Jit and call it
/frameworks/base/core/java/android/app/ActivityThread.java
7762d93621f508f4410fd37b5bbdfec0071b0420 11-Dec-2009 Paul Westbrook <pwestbro@google.com> Unbundling work

Moved AndroidHttpClient, Rfc822InputFilter, Rfc822Validator
NumberPicker, NumberPickerButton to android-common
---
/frameworks/base/core/java/android/app/ActivityThread.java
871ecdce67fb59a2603c1b93db657fe8b65695bd 12-Dec-2009 Dianne Hackborn <hackbod@google.com> Fix issue #2304284: contacts/dialer/recentcalls constantly flashing

Make sure the application is always given the most recent configuration
when launcher. Use the current configuration, instead of whatever happens
to be set by the app, for reporting what it was launched with.

Change-Id: I2ffe306f56cc9092b640546dd0a28d2c29b9c0b3
/frameworks/base/core/java/android/app/ActivityThread.java
08a462524a81bda336b17e25e3b178448880d448 08-Dec-2009 Christopher Tate <ctate@android.com> Make sure to acknowledge stale broadcasts

If a broadcast arrives at a process but the receiver has been unregistered in
the interval between dispatch and its arrival on the receiving process's side,
we were simply dropping the broadcast entirely, leading to spurious ANRs and
potentially issues involving future broadcasts being timed out incorrectly. Fix
this by making sure to correctly 'finish' a broadcast even when the recipient
app no longer has any receiver that matches the broadcast's profile.

Change-Id: If990cab021a26668052cb536753f6c308d80a5b4
/frameworks/base/core/java/android/app/ActivityThread.java
f93152028726f75c26fa960ef6a5bc87ce867eea 18-Nov-2009 Dianne Hackborn <hackbod@google.com> Fix issue #2262563: 40 ANR reports from com.android.settings in dogfooding sholes running ERD43

Don't hold the global package log while instantiated an AssetManager+Resources, since
this is a fairly heavy-weight operation, and if done in the background can starve the
foreground.

Change-Id: I5ad37324fb7c27ffdbf28e1498ca0ad667479580
/frameworks/base/core/java/android/app/ActivityThread.java
0be1f78c97ba6f38b315ab3ab28b44cdc883abec 09-Nov-2009 Dianne Hackborn <hackbod@google.com> Fix issue #2246723: Only one Application object gets onCreate called

Change-Id: I83ba96fe81ad04258099d6f94a667dc7d9dd4fd3
/frameworks/base/core/java/android/app/ActivityThread.java
8ee038d9265cb4da0e65475610a1a88c51761bb5 06-Nov-2009 Christopher Tate <ctate@android.com> Set argv[0] from the main thread of an app, not a random binder thread

Change-Id: Ibf6e51b7975cdb5e6aa97591a571c599ecf84020
/frameworks/base/core/java/android/app/ActivityThread.java
0c3154d3fc54a1b3d8358a2932042cca729327b9 07-Oct-2009 Dianne Hackborn <hackbod@google.com> Fix issue #2163654: deadlock, runtime restart

Don't hold a lock when the activity thread is telling the activity manager
to release a provider.

This requires that the activity manager now keep a reference count on the
providers, because without the lock it is possible for activity thread to
call in to request the provider again before it has finished telling
about the release.

Change-Id: I5f912903891f4edae85e28819d4e6f14b8f2e688
/frameworks/base/core/java/android/app/ActivityThread.java
68d881cf2d2b252f6f795cd64d43e316a1d736e5 05-Oct-2009 Dianne Hackborn <hackbod@google.com> Fix issue #2166755: BroadcastReceiver trying to return result during a non-ordered broadcast

Tell the broadcast receiver whether it is getting an initial sticky value,
so it will be quiet about attempts to do ordered broadcast stuff.

Note that the original bug being reported was not actually a crash, just
an error log. So all we are doing here is making the log quieter.

Change-Id: Iaf1b718d82093ec1197142410a64feff47eb3859
/frameworks/base/core/java/android/app/ActivityThread.java
e88846eeaf70f9f4299af9e3d54ba5dacede42b6 01-Oct-2009 Dianne Hackborn <hackbod@google.com> Semi-workaround for #2027266: app drawer showing up on the side of the screen

(when booted while docked)

This isn't really a fix, but we now have the activity report the configuration
it actually launched in, so the activity manager will later adjust it if
needed. Should help us recover from hitting the race in this particular case.

Change-Id: I3bb83a48c2d692b4cb1822d8ae7d924cfa9187b2
/frameworks/base/core/java/android/app/ActivityThread.java
436344ae12c819f58306ceb94241a266141e1218 01-Oct-2009 Christopher Tate <ctate@android.com> Turn off most of the backup-related debug logging

The core logging in BackupManagerService and in the Google backup transport are
still enabled at this point.

Change-Id: I10abfa565bbd1097dd3631051b6aca163e4af33a
/frameworks/base/core/java/android/app/ActivityThread.java
dc6b635cfa440454985461444c3cf1da8078cee1 30-Sep-2009 Dianne Hackborn <hackbod@google.com> Debugging for #2027266: app drawer showing up on the side

Nothing fixed, but this tells us what is going on.

Change-Id: I174d16a3864af2fa235e8cc7b1e74d32a375fb42
/frameworks/base/core/java/android/app/ActivityThread.java
c1e605eff4a940d749bab6c854810038c1485ec7 26-Sep-2009 Dianne Hackborn <hackbod@google.com> Fix issue #2136448: googleapps crashes while adding 2nd gmail account

Change-Id: I1dc27959650643bf0c7fd0564719856d7b3efeb1
/frameworks/base/core/java/android/app/ActivityThread.java
432b713c9442a4c0e1e4d400fada0c44dc17e786 25-Sep-2009 Mike Cleron <mcleron@google.com> Fix bug 2129190
The context used by the status bar (i.e., the system context) was
not properly initialized to have the right ApplicationInfo inside
its PackageInfo. This eventually caused it to believe that it
was running at 160dpi.

Kudos to Dianne for figuring this out.
/frameworks/base/core/java/android/app/ActivityThread.java
9bfb707597898f54722460b48588007b682f3e2a 22-Sep-2009 Dianne Hackborn <hackbod@google.com> Various fixes and improvements to window, activity.

- New meta-data you can add to a dock activity to have it launched by the
home key when the device is in that dock.

- Fix a deadlock involving ActivityThread's internal content provider lock.

- New window flag to have a non-secure keyguard entirely dismissed when a
window is displayed.

- New WindowManagerPolicy APIs to allow the policy to tell the system when
a change it makes during layout may cause the wall paper or
overall configuration to change.

- Fix a bug where an application token removed while one of its windows is
animating could cause the animating window to get stuck on screen.

Change-Id: I6d33fd39edd796bb9bdfd9dd7e077b84ca62ea08
/frameworks/base/core/java/android/app/ActivityThread.java
eec2f41d607c3eacba4f7d9cc098b335c7310d23 10-Sep-2009 Bob Lee <crazybob@google.com> Addressed reviewer comments.
/frameworks/base/core/java/android/app/ActivityThread.java
e540833fdff4d58e37c9ba859388e24e2945ed45 05-Sep-2009 Bob Lee <crazybob@crazybob.org> Integrated the profiler into the framework. We run it all the time if the persist.sampling_profiler
system property is set. Saves snapshots to the SD card.
/frameworks/base/core/java/android/app/ActivityThread.java
5e1ab335e6e8fbfa19c64d53880a22f472010953 02-Sep-2009 Christopher Tate <ctate@android.com> Expand apps' control over the settings restore process

Applications can now specify two more aspects of the restore process: whether
they need to run with their own custom Application subclass rather than being
launched in the usual restricted mode during restore, and whether it's okay for
the backup manager to kill the app process once restore has completed. The new
manifest attributes for these are, respectively, android:restoreNeedsApplication
and android:killAfterRestore.

If unspecified in the manifest, restoreNeedsApplication is false, and
killAfterRestore is true.

In order to support kill-after-restore cleanly, this change also adds a new
system-process-only interface to the Activity Manager, which will schedule a
"commit suicide" event on the target app's main thread looper.

The framework backup agents have been given the appropriate new backup
attributes as well.
/frameworks/base/core/java/android/app/ActivityThread.java
3025ef332c29e255388f74b2afefe05f64bce07c 01-Sep-2009 Dianne Hackborn <hackbod@google.com> Various infrastructure to support a running services UI.

Some of this is temporary (in particular the two approaches for getting
process memory, one working but horrible, the other not working but
preferred) until I figure out the best way to do it.

Change-Id: I8c8f25062d481fcea22a47d459b083d2fd8a5040
/frameworks/base/core/java/android/app/ActivityThread.java
f6f9f2d0256930ce0bb4913b2260b8480914edc2 22-Aug-2009 Dianne Hackborn <hackbod@google.com> Add more control over a service's start state.

One of the problems I have been noticing is background services
sitting around running and using resources. Some times this is
due to the app developer doing this when they shouldn't, but there
are also a number of issues with the current Service interaction
model that make it very difficult (or impossible) to avoid
getting services stuck in the started state. This is a
change/enhancement to the Service API to try to address this.

The main change is that Service.onStart() has been deprecated,
replaced with a new Service.onStartCommand() that allows the
service to better control how the system should manage it. The
key part here is a new result code returned by the function, telling
the system what it should do with the service afterwards:

- START_STICKY is basically the same as the previous behavior,
where we usually leave the service running. The only difference
is that it if it gets restarted because its process is killed,
onStartCommand() will be called on the new service with a null
Intent instead of not being called at all.

- START_NOT_STICKY says that, upon returning to the system, if
its process is killed with no remaining start commands to
deliver, then the service will be stopped instead of restarted.
This makes a lot more sense for services that are intended to
only run while executing commands sent to them.

- START_REDELIVER_INTENT is like START_NOT_STICKY, except if
the service's process is killed before it calls stopSelf()
for a given intent, that intent will be re-delivered to it
until it completes (unless after 4 or more tries it still
can't complete, at which point we give up).

Change-Id: I978f5ca420d70023d1b5e7f97de639d09381f8ad
/frameworks/base/core/java/android/app/ActivityThread.java
82e1ee93eece8fb0aec6acc3ef4ee7b1c86feec7 12-Aug-2009 Dianne Hackborn <hackbod@google.com> Fix issue #2048263: More debugging information

We now hopefully do better about generating the anr reports, and include
information about the malloc loaded assets in meminfo.
/frameworks/base/core/java/android/app/ActivityThread.java
0d907fa00bd9b20e69f2a95a71fbaf9fffeb8c94 28-Jul-2009 Dianne Hackborn <hackbod@google.com> Fix issue #1991230: DisplayMetrics.displayHeight is not updated with orientation change
/frameworks/base/core/java/android/app/ActivityThread.java
96e240f25a97c10bba863df328ed73a82c34ff61 27-Jul-2009 Dianne Hackborn <hackbod@google.com> Fiddle with default densities to try to sanitize the API.

An issue with the density API is that bitmaps assumed the old default density,
so new programs would have to explicitly set the correct density for every bitmap
they create.

This is an attempt to fix that situation, by define the default density of bitmaps
to be the main screen's density, except for old apps where it is the original default
density.

Actually implementing this is not so great, though, because the Bitmap constructors
can't really know anything about who is calling them to know which density to use.
So at this level the compatibility mode is defined per-process -- meaning the initial
package loaded into a process defines the default bitmap density, and everyone else
loaded in later on has to live with that.

In practice this shouldn't be much of a problem, there shouldn't be much mixing of
old vs. new apps in a process. It does mean that, going forward, if a developer is
going to use shared user IDs for this, they will need to make sure either that all of
their apps are in the same compatibility mode, or that their code explicitly sets the
density of bitmaps it receives. This isn't all that great, but I think it is worth
the benefit of allowing people who write modern apps to not have to deal with bitmap
densities.

This change also does some cleanup of the density management (making sure to always
copy over bitmap densities, etc) and adds java docs to explain the various ways
density is set and used by the system.
/frameworks/base/core/java/android/app/ActivityThread.java
11ea33471e1a14a8594f0b2cd012d86340dd3bd8 23-Jul-2009 Dianne Hackborn <hackbod@google.com> Allow for screen density drawables in compatibility mode.

This change allows us to use drawables that match the current screen
density even when being loaded in compatibility mode. In this case,
the bitmap is loaded in the screen density, and the bitmap and
nine-patch drawables take care of accounting for the density difference.

This should be safe for existing applications, for the most part, since
they shouldn't really be pulling the bitmap out of the drawable. For
the small rare chance of them breaking, it worth getting the correct
graphics. Also this will only happen when there is actually a resource
of the matching density, and no existing apps should have resources for
anything besides the default density (though of course all of the
framework resources will be available in the native density).

As part of this, the bitmap density API has been changed to a single
integer provider the DPI unit density.
/frameworks/base/core/java/android/app/ActivityThread.java
a53b828635fce8b6b2d3e3377d74d72070056623 17-Jul-2009 Dianne Hackborn <hackbod@google.com> Add "nodpi" density, and expose a bunch of density-related APIs.

Also update the DpiTest app to use nodpi images, and try to have a mode
where it turns off compatibility though it's not quite working.
/frameworks/base/core/java/android/app/ActivityThread.java
b06ea706530e6d19eb2a1a9a7ae6c5dd77d80af0 13-Jul-2009 Dianne Hackborn <hackbod@google.com> Add reporting of activity movement for search manager.

This adds a new API with the activity manager to find out about movement between
activities. For my sanity, the old IActivityWatcher is now renamed to
IActivityController, and the new activity movement interface is named
IActivityWatcher.

This changes the search manager itself to use the new API to manage its state.
Note that there are still problems when going back to the search dialog after
it was hidden -- the suggestions window no longer appears until you explicitly
dismiss and re-show it.
/frameworks/base/core/java/android/app/ActivityThread.java
ba3ba57921dedaaef669719c0359c0caf60e008b 09-Jul-2009 Mitsuru Oshima <oshima@google.com> * Use cached resources for widgets
/frameworks/base/core/java/android/app/ActivityThread.java
d1475e0375cbf1ebd5010c6ce96bbdc1de6c1b57 10-Jul-2009 Christopher Tate <ctate@google.com> Don't crash the app when restore agent bringup throws

Restore runs during the SetupWizard, before the phone is usable per se, so we
want to avoid presenting the usual "Application whatever has crashed..." dialog
to the user in the middle of that process. This change modifies the exception
handling around agent bringup so that agent-originated exceptions are caught and
a null agent binder reported to the backup manager.

There are three points during this code sequence at which an exception can be
thrown due to application-code error:

+ the app's manifest can name a nonexistent or malformed BackupAgent class,
incurring a VM-level exception like ClassNotFound or BadCast.
- the agent's onCreate() method could crash/throw.
- the agent's onBind() method could crash/throw.

The new code arrangement here puts a try/catch around all of these possible
failure points. When the code is invoked for backup, any caught exception is
merely rethrown. During restore, however, execution is allowed to proceed
through reporting the app's agent binder back to the activity manager. If any
exception was thrown, this reported binder will be null, i.e. a clean failure
notification to the backup manager.

What this code does *not* do at present is tear down the app when an exception
has been thrown. This is happens if the exception is allowed to propagate.
Doing so cleanly is problematic, however, in circumstances where mutiple apps
and agents share a process. Leaving the background process around until it is
torn down by the usual policies is probably the safer course at present.
/frameworks/base/core/java/android/app/ActivityThread.java
fff2fda0199dedbf1079454dca98a81190dce765 01-Jul-2009 Suchi Amalapurapu <asuchitra@google.com> Fix memory leaks in system_server
unlink DeathRecipients in a whole bunch of places to avoid memory leaks
/frameworks/base/core/java/android/app/ActivityThread.java
c984329d30ba23be90f0e407684ad2410a9bbfe0 25-Jun-2009 Suchi Amalapurapu <asuchitra@google.com> Invoke getSystem.updateConfiguration when binding an application to
update config changes in Resources.mSystem
Since Resources is preloaded in the zygote, system resources in Resources
need to be updated with config changes every time an application is started
/frameworks/base/core/java/android/app/ActivityThread.java
9c8dd55a9d829c29a3feee9469d8c2f27a9f5516 24-Jun-2009 Dianne Hackborn <hackbod@google.com> Fix bug 1829561 ("am profile" with bad filename kills process).

The am command is now the one that takes care of opening the target file,
handling the opened file descriptor to the process that will be profiled.
This allows you to send profile data to anywhere the shell can access, and
avoids any problems coming up from the target process trying to open the
file.
/frameworks/base/core/java/android/app/ActivityThread.java
d97c7adfc2d6e885826e40694a116cf3f9225025 19-Jun-2009 Dianne Hackborn <hackbod@google.com> Fix issue #1753079: running instrumentation in shared processes.

The check for allowing the start of an activity was broken, it was
comparing the process of that activity's application vs. the current
instrumentation target package name. Okay it was utterly insane.

Now this check is that the target activity will be running in the
same process as the instrumentation, which is really what we want.
/frameworks/base/core/java/android/app/ActivityThread.java
5c1e00b14d2ef10ec76abf3e951fa8003a67f558 19-Jun-2009 Dianne Hackborn <hackbod@google.com> Fix targetSdkVersion, make resize mode a flag, delayed dexopt, easy ApplicationInfo.

- Fix a bug where targetSdkVersion could not be set if minSdkVersion. Stupid, stupid.
Also make sure to fail if minSdkVersion is for a code name. Really stupid.

- Change the API for resize compatibility mode to be a bit in the flags field, instead
of a separate boolean.

- Implement delayed dexopting, to avoid the looong full dexopt during boot. This is
only enabled for "eng" builds. When in this mode, the activity manager will make
sure that a dexopt has been done before loading an .apk into a process, and will
try to avoid displaying ANRs if they are due to the dexopt causing some operation
to take longer than it normally would (though I make no guarantees about this
totally working).

- Add API to Context to get the ApplicationInfo for its package, for easy access to
things like targetSdkVersion.
/frameworks/base/core/java/android/app/ActivityThread.java
1ccac75e1f1b97eccb916a8de04fc1012b30f6e5 12-Jun-2009 Suchi Amalapurapu <asuchitra@google.com> Remove circular dependency in PackageManager. api freeStorage uses PendingIntent from android.app
Create a new public IntentSender class that can be used by PackageManager instead.
This new class uses IIntentSender internally and can only be created by PendingIntent for now.
Provide a new getIntentSender api in PendingIntent to create an instance of this class.
Move IIntentSender and IIntentReceiver from android.app to android.content
Change imports of IIntentSender and IIntentReceiver to reflect the new package name
The PackageManager api has been named as freeStorageWithIntent and will be renamed as freeStorage
once the older api(which has been deprecated) will be removed shortly.
/frameworks/base/core/java/android/app/ActivityThread.java
d9aef73f72cb11ba7f278a0ef13c6d02ffc95851 17-Jun-2009 Mitsuru Oshima <oshima@google.com> Squashed commit of the following:

commit 9798cd23605c96c1d6a29202f4d31f5454079b61
Author: Mitsuru Oshima <oshima@google.com>
Date: Tue Jun 16 13:50:44 2009 -0700

Made other toShortString in performDestroyActivity safe.

commit 19bf973df81d9d01210effb39c99e5236f2229c1
Author: Mitsuru Oshima <oshima@google.com>
Date: Fri Jun 12 15:50:03 2009 -0700

* component can be null after destory?
This was causing NPE in catch block, which hides the actual exception.

Conflicts:

core/java/android/app/ActivityThread.java
/frameworks/base/core/java/android/app/ActivityThread.java
12172baa6b72a8996b3f043f18067c9b43ed3bc8 13-Jun-2009 Mitsuru Oshima <oshima@google.com> * component can be null after destory?
This was causing NPE in catch block, which hides the actual exception.
/frameworks/base/core/java/android/app/ActivityThread.java
9189cabb0b6c6c28232fe6f412b7ba7a37352a6a 03-Jun-2009 Mitsuru Oshima <oshima@google.com> * Moved supports-density tag under manifest
* Refactored Compatibility code
* Added CompatibilityInfo class
* Removed getApplicationScale from Context
* Added Resources#getCompatibilityInfo so that RootView can get the compatibility info w/o going through Context
* Expandable support
* Added expandable tag under manifest
* Old application w/o expandable is given the default screen size ([320, 480] x density).
* The non-expandable window is centered.
/frameworks/base/core/java/android/app/ActivityThread.java
181fafaf48208978b8ba2022683ffa78aaeddde1 14-May-2009 Christopher Tate <ctate@google.com> Retool the backup process to use a new 'BackupAgent' class

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.
/frameworks/base/core/java/android/app/ActivityThread.java
06de2ea752171f52a4e6e6872cb3a0689e591dcb 21-May-2009 Dianne Hackborn <hackbod@google.com> Activity Manager changes the scheduling group of processes.

The algorithm for this is currently very simple: all persistent processes are
always in the normal scheduling group, all other processes are normal if their
oom_adj is as good or better than VISIBLE, otherwise they are in the background
group.

Note that this currently results in a fair number of log messages about not
being able to change the group, since the system process does not have
permission to do so. Once a kernel fix is in, these will go away and the code
will start working.
/frameworks/base/core/java/android/app/ActivityThread.java
a1565b934093e0fc29d2ff2104e279aad4a233d3 12-May-2009 Mitsuru Oshima <oshima@google.com> removing log message checked in by acccident.
/frameworks/base/core/java/android/app/ActivityThread.java
58feea74b42bbaaa0552d76af23873bdd0b5dca2 12-May-2009 Mitsuru Oshima <oshima@google.com> * update all metrics data when updating density.
* Keyboard should use DisplayMetrics from Resource rather than getting it from WindowManager as
the display metrics can differ under compatibility mode.
/frameworks/base/core/java/android/app/ActivityThread.java
2e3d3b9ce74cb9c906e5cc0e9898d757d45c4237 07-May-2009 Mitsuru Oshima <oshima@google.com> * update density correctly when the configuration is changed.
* Turns private sLcdDensity to public DEVICE_DENSITY to use it in ActivityThread
/frameworks/base/core/java/android/app/ActivityThread.java
13735a255dedd2c2e3b0cff66f0be2e17671f553 29-Apr-2009 Mitsuru Oshima <> Merge branch 'readonly-p4-donut' into donut
8169daed2f7a8731d478b884b1f455c747b88478 29-Apr-2009 Mitsuru Oshima <> AI 147976: Compatibility mode support. Part 2.
* Introduced ApplicationScale (may not be good name. CompatibilityScale? CanvasScale? Pls let me know if you have better idea)
* Changes to RootView / SurfaceView
- Makes the app believe it's running in the supported density/resolution.
- Makes the window manager believe it's running at the right density/resolution.
* Added methods to Rect/Event for scaling up/down.
Known issues:
* certain kind of images (such as nine patch for buttons) seesm to be loaded not by app, thus does not take the scale into account,
which, in turn, is causing layout issue.
* ZoomButton in MapView is rendered in wrong place
* Transparent region on Surface is not correct
* Specifying different densities in one process is not working.
BUG=1770627

Automated import of CL 147976
/frameworks/base/core/java/android/app/ActivityThread.java
caf0df1b7f99736aed1a0b923ef278fc4fd0fcca 27-Apr-2009 Mike Reed <reed@google.com> Add call to (new) Canvas.freeCaches() in response to low-memory

This is in conjunction with removing a similar call made by the browser.
Now it will be centralized, and the browser's call site will be removed.
/frameworks/base/core/java/android/app/ActivityThread.java
b70f3dff01e7e1e85f77cf0b0b2eaba8200eb82c 08-Apr-2009 Christopher Tate <ctate@google.com> Preserve an Activity's setIntent() state across relaunches

Previously any Intent designated by setIntent() would be lost when
the Activity was shut down and restarted due to orientation change.
Now the custom intent is preserved across the relaunch.

Bug: b/1743425
/frameworks/base/core/java/android/app/ActivityThread.java
ce229059e25066b36c99208a04e8e5696a76abf3 26-Mar-2009 Chris Tate <> Automated import from //branches/donutburger/...@142714,142714
/frameworks/base/core/java/android/app/ActivityThread.java
8a7dc17790b7f24e8e819eca46d14c4471230eba 25-Mar-2009 Chris Tate <> Automated import from //branches/donutburger/...@141391,141391
/frameworks/base/core/java/android/app/ActivityThread.java
105925376f8d0f6b318c9938c7b83ef7fef094da 19-Mar-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //branches/cupcake_rel/...@140373
/frameworks/base/core/java/android/app/ActivityThread.java
f5b4b98fada53d91c4c2ebeb5a1d33ccc95c94d2 06-Mar-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //depot/cupcake/@136745
/frameworks/base/core/java/android/app/ActivityThread.java
9066cfe9886ac131c34d59ed0e2d287b0e3c0087 04-Mar-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //depot/cupcake/@135843
/frameworks/base/core/java/android/app/ActivityThread.java
d83a98f4ce9cfa908f5c54bbd70f03eec07e7553 04-Mar-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //depot/cupcake/@135843
/frameworks/base/core/java/android/app/ActivityThread.java
d24b8183b93e781080b2c16c487e60d51c12da31 11-Feb-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //branches/cupcake/...@130745
/frameworks/base/core/java/android/app/ActivityThread.java
f1e484acb594a726fb57ad0ae4cfe902c7f35858 22-Jan-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //branches/cupcake/...@127436
/frameworks/base/core/java/android/app/ActivityThread.java
9266c558bf1d21ff647525ff99f7dadbca417309 16-Jan-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //branches/cupcake/...@126645
/frameworks/base/core/java/android/app/ActivityThread.java
f013e1afd1e68af5e3b868c26a653bbfb39538f8 18-Dec-2008 The Android Open Source Project <initial-contribution@android.com> Code drop from //branches/cupcake/...@124589
/frameworks/base/core/java/android/app/ActivityThread.java
54b6cfa9a9e5b861a9930af873580d6dc20f773c 21-Oct-2008 The Android Open Source Project <initial-contribution@android.com> Initial Contribution
/frameworks/base/core/java/android/app/ActivityThread.java