When transitioning from activity-over-launcher to task-over-launcher
ensureActivitiesVisibleLocked() was too aggressive in showing the
launcher. If there were any non-fullscreen activities in a task that
sits over the launcher then the launcher would be shown.
This fix adds a test to make sure the launcher will only be shown if
the bottommost activity in such a task is non-fullscreen.
Fixes bug 10840919.
Change-Id: I5dcd63be3fa2865ae38cbb921332937dfa4b5d47
...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
At some point during refactoring of ActivityStack, the code to pause the current
activity got deleted. Added back that line of code. Activity will now pause
as soon as the screen is turned off, rather than after 5 seconds (sleep timeout).
Bug: 10632898
Change-Id: If3cc8708d692d29a13dbd8cfd9edda8883b38c2e
* Make sure that pm.getHomeActivities() returns the activity metadata
as well, so that the caller can trace the reference
* Add a public canonical name for that metadata key
Bug 10749961
Change-Id: Ic4d0750d61001ffe5af180398f042afa30eea1ce
Some services do periodic network time lookups and can wedge the other operations on
BackgroundThread and IO Thread, causing Watchdog to kill the runtime. So best to put
those handlers on separate threads.
Going forward, should convert NTP lookups to be async with callbacks.
Bug: 10646480
Change-Id: I8c7ba6052cb3539575712c2099a706b14ff60196
The idea of multiple processes serving as home was unfeasible.
- Revert "Allow for more than one home app." commit
e428a7f662f109a5f2015008e3161df23932483e.
- Assign ActivityManagerService.mHomeProcess to the process of the
root activity of the home task.
Addresses bug 10342471.
Change-Id: Ifb494626107d24de1306e320a18206d5b176a7c0
...while setting up a new user from settings.
We can now delay broadcasts when there are enough background services
currently starting (still set to 1 for svelte devices, 3 for normal
devices).
Add new intent flag to not allow receivers to abort broadcasts, which
I use to fix an issue with the initial BOOT_COMPLETED broadcast not
actually requesting pss data at the right time -- it can now be sent
as an ordered broadcast without the ability for the receivers to cancel
it.
Change-Id: I51155bbbabe23e187003f3e2abd7b754e55d3c95
The variable ActivityRecord.mLaunchHomeTaskNext was used to indicate
that the home task should be launched when the activity completed.
This only mattered when it was at the end of a task. As the activity
launched other activities within the same task it needed to be
migrated from activity to activity and task to task. This became
too complicated and was at the wrong level to begin with.
By moving the flag to TaskRecord.mOnTopOfHome the logic is simpler
and the results more predictable.
Fixes bug 10602256.
Change-Id: If0b752522b77be9918f1dba221d0ff670fc01af8
PacManager previously would unbind service even when there was no
connection. This means that multiple set proxies of no PAC after a PAC was
present would cause the framework to crash.
Bug: 10801296
Change-Id: I4387b50b6510cea3ee73425c8a0a837f816b0ce1
...caused runtime restart
There were some situations where the package list could be set
with process stats when it shouldn't. Not sure if this is causing
the problem, since there is no repro.
Also some improvements to debug output -- new commands to clear
all stats, print full details of stats, and print a one-day
summary (which should match what the UI shows).
Change-Id: I9581db4059d7bb094f79f2fe06c1ccff3e1a4e74
Add a test for emptiness before accessing either mTaskHistory[0] or
TaskRecord.mActivities[0]. This will keep us from hitting
IndexOutOfBoundsException.
Fixes bug 10789624.
Change-Id: If726df888a2c8b393788793b6220a6bffe2df883
The InputMethod window was being assigned to the bottommost
window as a fall-through situation when no window could receive
input. This fix changes that so that if the bottommost window
cannot receive IME input then the InputMethod will be unassigned.
In most ANRs associated with bug 10689184 mInputMethodTarget
was assigned to the Wallpaper window and the InputMethod was
placed directly above it. When the ANR occurred the window that
was awaiting focused was then always placed immediately above the
InputMethod. This fix will keep that situation from happening.
Change-Id: Ic247e8132a907f2712a9f8a89e43c099142ec851
NPE at com.android.server.am.ProcessRecord.resetPackageList(ProcessRecord.java:596)
Take care of some more cases now that baseProcessTracker can be null.
Change-Id: I394c0b7802788118c3ad6bcac5dfdd23eeda8d58
...while setting up a new user from settings.
The delayed service start stuff was too aggressive -- it would
allow a process to be killed between the an onReceive() that calls
startService() and that service being started. This means that
apps that set up global state that they expect to remain set up
during that time could be lost.
This is the first part of a fix, which tightens up when we allow
services to be delayed. Now we will immediately start the service
as long as it currently as a process running that is not in the
cached state. (Previously we would delay if the process was in
the receiver state.)
This unfortunately means that our service start delay is much
less effective. To address that, there will be a follow-on change
to tie broadcast delivery into this to see if we can delay the
finish of a broadcast as long as there are background services
starting in that process.
Change-Id: I2bba2295d10699ee3479375bbe87114b2cbb0826
We now expect that the transport service's host process will be
OOM-killed sometimes, but will come back automatically because we
still hold the binding. So, we no longer drop it as the
expected-to-be-current transport when that happens.
Bug 10728767
Change-Id: I5e756e8942e7c4c3567632f10460ee31b9618d75
1. The UI of a printing app was freezing a little when calling the print
method since the print manager service was waiting for it to bind to the
print spooler which generated the print job id (and the initial print
job info really). Now the print manager service is responsible for job
id generation and does not not wait for the print spooler to spin. Hence,
the app UI is not blocked at all. Note that the print manager initiates
the binding to the spooler and as soon as it completes the spooler shows
the print UI which is hosted in its process. It is not possible to show
the print UI before the system is bound to the spooler since during this
binding the system passes a callback to the spooler so the latter can
talk to the system.
2. Changed the print job id to be an opaque class allowing us to vary the
way we generate print job ids in the future.
3. The queued print job state was hidden but the print job returned by the
print method of the print manager is in that state. Now now hidden.
4. We were incorrecly removing print job infos if they are completed or
cancelled. Doing that is problematic since the print job returned by
the print method allows the app to query for the job info after the
job has been say completed. Hence, an app can initiate printing and
get a print job whose state is "created" and hold onto it until after
the job is completed, now if the app asks for the print job info it
will get an info in "created" state even though the job is "completed"
since the spooler was not retaining the completed jobs. Now the spooler
removes the PDF files for the completed and cancelled print jobs but
keeps around the infos (also persisting them to disc) so it can answer
questions about them. On first boot or switch to a user we purge the
persisted print jobs in completed/cancelled state since they
are obsolete - no app can have a handle to them.
5. Removed the print method that takes a file since we have a public
PrintDocumentAdapter implementation for printing files. Once can
instantiate a PrintFileDocumentAdapter and pass it to the print
method. This class also allows overriding of the finish method to
know when the data is spooled and deleted the file if desired, etc.
6. Replaced the wrong code to slice a large list of parcelables to
use ParceledListSlice class.
bug:10748093
Change-Id: I1ebeeb47576e88fce550851cdd3e401fcede6e2b
Haven't found the underlying cause, but this will give us more
information when we get into the bad state.
Change-Id: I9aebd3a025a7c0d931f43098461b64ee3c220746
Bug: 9520957
DevicePolicyManagerService will play dumb if the feature is not installed.
Continue to keep track of failed password attempts for keyguard's use.
Change-Id: I28d258dc09a8b4976b188da6f453d8daabcc4bdd