12271 Commits

Author SHA1 Message Date
Craig Mautner
ae7ecab400 Move flag for home launching from activity to task.
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
2013-09-18 11:48:14 -07:00
Dianne Hackborn
222920c460 Merge "Maybe fix issue #10797796: IllegalStateException in ProcessState..." into klp-dev 2013-09-18 00:34:02 +00:00
Dianne Hackborn
53459a7020 Maybe fix issue #10797796: IllegalStateException in ProcessState...
...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
2013-09-17 17:30:34 -07:00
Craig Mautner
019f8cb8a7 Merge "Add bounds checks before accessing ArrayList." into klp-dev 2013-09-17 23:13:31 +00:00
Craig Mautner
dccb770b84 Add bounds checks before accessing ArrayList.
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
2013-09-17 15:53:34 -07:00
David Braun
345d491b77 Merge "Implement new method for handling SMS/MMS on the platform" into klp-dev 2013-09-17 22:14:54 +00:00
Craig Mautner
bc65c1dbcc Merge "Do not assign InputMethod to non-input windows." into klp-dev 2013-09-17 22:13:10 +00:00
Craig Mautner
22b9a5e0aa Do not assign InputMethod to non-input windows.
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
2013-09-17 14:50:56 -07:00
Craig Mautner
16efe96cbc Merge "Fix parenthetical error." into klp-dev 2013-09-17 20:21:40 +00:00
Dianne Hackborn
463850e0c6 Merge "Fix issue #10795385: System process crash reinstalling GEL -" into klp-dev 2013-09-17 18:08:00 +00:00
Dianne Hackborn
e56c2c3f05 Fix issue #10795385: System process crash reinstalling GEL -
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
2013-09-17 11:03:10 -07:00
Craig Mautner
7504d7b24a Fix parenthetical error.
Mis-grouping of && and || from CL ag/360551.

Fixes bug 10798273.

Change-Id: Idbc77e03d09f7ad5fcf1a5de98c6c14f0c63a6e4
2013-09-17 10:50:53 -07:00
Craig Mautner
fbd67258e1 Merge "More debugging for b/106899184" into klp-dev 2013-09-17 17:39:08 +00:00
Craig Mautner
b1885b8588 More debugging for b/106899184
Change-Id: I729a2c5bae087713765d782daaa7309ee6cd5b5a
2013-09-17 09:35:20 -07:00
Amith Yamasani
33caca5cd5 Merge "Add a feature to specify if device admins are supported on the device" into klp-dev 2013-09-17 15:56:14 +00:00
Svetoslav
be0d9317e2 Merge "App UI freezes when printing. API clean up." into klp-dev 2013-09-17 02:28:34 +00:00
Dianne Hackborn
a0d53c6188 Merge "Fix issue #10779747: Calendar Storage crash observed..." into klp-dev 2013-09-17 02:12:58 +00:00
Christopher Tate
ca776158b7 Merge "Don't assume that transport unbind == transport invalid" into klp-dev 2013-09-17 02:10:40 +00:00
Dianne Hackborn
0d97cd1f6a Fix issue #10779747: Calendar Storage crash observed...
...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
2013-09-16 19:02:52 -07:00
Christopher Tate
a8de43fd8c Don't assume that transport unbind == transport invalid
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
2013-09-16 18:14:52 -07:00
Svetoslav
2fbd2a7f07 App UI freezes when printing. API clean up.
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
2013-09-16 17:55:14 -07:00
Dianne Hackborn
50ef0b62f0 Work on issue #10771346: runtime restart
Haven't found the underlying cause, but this will give us more
information when we get into the bad state.

Change-Id: I9aebd3a025a7c0d931f43098461b64ee3c220746
2013-09-16 17:40:27 -07:00
Amith Yamasani
44a01b742c Add a feature to specify if device admins are supported on the device
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
2013-09-16 17:24:06 -07:00
Dianne Hackborn
61158244b4 Merge "Implement issue #10691359: Kill long-running processes" into klp-dev 2013-09-16 21:33:04 +00:00
Craig Mautner
deec7e481a Merge "Put next task on top of stack if top is finishing." into klp-dev 2013-09-16 21:21:11 +00:00
Dianne Hackborn
35f72be50b Implement issue #10691359: Kill long-running processes
We now have the activity manager kill long-running processes
during idle maintanence.

This involved adding some more information to the activity manager
about the current memory state, so that it could know if it really
should bother killing anything.  While doing this, I also improved
how we determine when memory is getting low by better ignoring cases
where processes are going away for other reasons (such as now idle
maintenance).  We now won't raise our memory state if either a process
is going away because we wanted it gone for another reason or the
total number of processes is not decreasing.

The idle maintanence killing also uses new per-process information
about whether the process has ever gone into the cached state since
the last idle maintenance, and the initial pss and current pss size
over its run time.

Change-Id: Iceaa7ffb2ad2015c33a64133a72a272b56dbad53
2013-09-16 14:05:34 -07:00
David Braun
f5d831915d Implement new method for handling SMS/MMS on the platform
Multi project change:
The changes in this project add the new (hidden) default sms application
setting to Settings.Secure and updates AppOps to support the concept
of an op defaulting to something other than allowed. OP_WRITE_SMS is set
to default to MODE_IGNORED.

Bug: 10449618
Change-Id: I37619784ac70c27cf9fbcbfcac1b263398bc4e01
2013-09-16 13:43:51 -07:00
Yuhao Zheng
af672998af Merge "Fix Settings app crash while enabling tethering" into klp-dev 2013-09-16 20:36:50 +00:00
Yuhao Zheng
8c461c6fc6 Fix Settings app crash while enabling tethering
While enabling Portable Wifi hotspot in Settings, a null WifiConfiguration
is provided. This null config is on purpose and meanful, and it should bypass
the validation test to avoid the NullPointerException.

Bug: 10780414

Change-Id: Ic507ecae463946c925b3d5fb5a1d185b37db410f
2013-09-16 13:24:04 -07:00
Craig Mautner
7dd9fdfca0 Put next task on top of stack if top is finishing.
In the case where the top task is finishing and another task is
launching make sure that the next task will be launched once the
top task actually completes pausing.

In the case of b/10550460 the top task, Dialtacts, was finishing
but had not yet completed pausing. It was configured to return to
the home screen (mLaunchHomeTaskNext true) but because its finishing
flag was set all the tests we have thought that the InCallActivity
task was the top task. When it finally did complete the
mLaunchHomeTaskNext flag caused the home activity to be started
instead of the InCallActivity.

If the InCallActivity task had been moved above the Dialtacts task
at the time it was judged to be the top task the home activity
would not have been launched when Dialtacts completed. This fix
moves the judged top task over the finishing top task.

Fixes bug 10550460.

Change-Id: I14052ad2282008679b560dd7fb16b216664ec24d
2013-09-16 13:05:41 -07:00
Vinit Deshapnde
ffec332727 Fix an NPE in WifiService
The check to validate incoming configurations is flagging a correct
API usage as well - which doesn't provide any configuration to test.
Fixing code to accommodate this.

Bug: 10749041

Change-Id: I972f0edbdfa14aaa3edb34e4c6784b436c288383
2013-09-16 12:41:12 -07:00
Christopher Tate
06dc8484b4 Fix handling of privileged permissions on update
When a bundled app is upgraded, only reprocess ungranted 'system'
permissions if the bundled apk is privileged.

Also adds the 'privileged' flag to the dumpsys flag summary.

Bug 10503183

Change-Id: Ic6560fc904e5970fc871a155c898744a6607f851
2013-09-15 17:51:04 -07:00
Craig Mautner
dc3335429a Merge "Add debug logging for b/10689184." into klp-dev 2013-09-15 21:47:52 +00:00
Craig Mautner
5845812780 Add debug logging for b/10689184.
Focus is now on focus. Remove logging when fixed.

Change-Id: Ic0cd2d6bd4e65dac9dd40f4745dd12fb84f687ce
2013-09-15 14:18:54 -07:00
Svetoslav Ganov
4244d66a12 Merge changes Id0a67846,I20b57d66 into klp-dev
* changes:
  Print system may get stuck bound to a print service
  Spooler should not crash if print service config activities are not exported.
2013-09-15 18:46:02 +00:00
Svetoslav Ganov
de4fa2dfe2 Print system may get stuck bound to a print service
1. If a print service dies, is restarted and at the time of the
   restart the service has neither print jobs nor a discovery
   serssion it gets stuck into a bound state. Now it unbinds if
   after binding and ensuring it is in the lifecycle state right
   before the death there are no active print jobs and no discovery
   session.

   Also when a print service dies we fail all of its print jobs
   but did not update the service that all of its print jobs are
   handled, i.e. it has no active print jobs.

2. Fixed a null pointer exception in UserState

bug:10696723

Change-Id: Id0a67846093fca5d4c1e10843eaf6aa90169d942
2013-09-15 02:58:14 -07:00
Wink Saville
78d0cf7958 Merge "Tighten condition for calling checkMobileProvisioning." into klp-dev 2013-09-14 18:19:39 +00:00
Maggie Benthall
f5aba5ad1e Merge "CA cert monitoring: add notifications and actions for dialog" into klp-dev 2013-09-14 18:00:13 +00:00
Wink Saville
127beffb05 Tighten condition for calling checkMobileProvisioning.
Add the condition that the connected network needs to be TYPE_MOBILE.
This eliminates checking on connecting to secondary networks like
FOTA, MMS, SUPL ...

This reduces unnecessary attempts to bring up multiple connections at
the same time. Especially in the light of the trouble we're having with HFA
on Sprint, where we don't want to connect to any other network until HFA
has completed.

Bug: 10758001
Change-Id: Id294536b70304a51de4752bc1a4ffac734f10f1a
2013-09-14 09:04:53 -07:00
Svetoslav Ganov
860f8a6b66 Spooler should not crash if print service config activities are not exported.
1. If a print service does not export its activities for settings and
   adding printers the print spooler ignores them instead of crashing.
   Also if the service is not enabled its activities are now ignored.

2. Added a dedicated permission for a print service to optionally
   protect its settings and add printer activities such that only the
   system can bind to them.

3. Fixed a crash in the print dialog if its content is detached
   from the window and animators are running.

bug:10680224

Change-Id: I20b57d6622a15f9b2352ba78d04c44e67b316a15
2013-09-14 01:00:55 -07:00
David Christie
5f68f71701 Merge "Strip names out of externally supplied WorkSources to WifiManager (b/10710007)." into klp-dev 2013-09-14 01:02:40 +00:00
David Christie
6ab2284c98 Strip names out of externally supplied WorkSources to WifiManager (b/10710007).
Change-Id: I69bd7ce9e942c2f9327415b2821d805e1b50a1a4
2013-09-13 17:34:40 -07:00
Christopher Tate
0f8ec44b13 Merge "Prune shared users that the system declares but does not use" into klp-dev 2013-09-14 00:11:48 +00:00
Dianne Hackborn
236afa0d8b Merge "Fix issue #10747324: adb install hangs" into klp-dev 2013-09-14 00:04:43 +00:00
Dianne Hackborn
2e46bb5d88 Fix issue #10747324: adb install hangs
Dumb typo was clearing the wrong service array, causing
us to sometimes forget we were launching a service.

Change-Id: Ie1aba0e07d19e85a104a5985e3cead5f28a0556a
2013-09-13 17:01:26 -07:00
Christopher Tate
86b391cd03 Prune shared users that the system declares but does not use
Bug 10184643

Change-Id: I72c5177c621c24fac34bf8744eb6c5108b6d3464
2013-09-13 16:58:36 -07:00
Craig Mautner
540421ba98 Merge "When launching home activity, make sure it is top." into klp-dev 2013-09-13 23:33:17 +00:00
Dianne Hackborn
28eeb42012 Merge "Implement #10749688: Improve low memory reporting" into klp-dev 2013-09-13 23:06:07 +00:00
Dianne Hackborn
8e69257a9c Implement #10749688: Improve low memory reporting
This significantly reworks the logging we do when
all cached processes are killed:

- We now collect the list of processes in-place so we
  have a snapshot of exactly when the low memory situation
  happened.
- In that snapshot we include the key process state: oom
  adj, proc state, adj reasons.
- The report then asynchronously collects pss information
  for those processes.
- The ultimate data printed to the log looks like a mix
  between the "dumpsys meminfo" and "dumpsys activity"
  output.  This code no longer uses "dumpsys meminfo"
  itself, so some of that data is no longer included,
  in particular pss organized by allocation type.

In doing this, I realized that the existing code that is
supposed to run "procstats" is not currently working.  And
at that point I realized, really, when we are collecting
this pss data we'd really like to include all those native
processes using ghod-only-knows how much RAM.  And guess
what, we have a list of processes available in
ProcessCpuTracker.

So we now also collect and print information for native
processes, and we also do this for "dumpsys meminfo" which
really seems like a good thing when we are printing summaries
of all pss and such.

I also improved the code for reading /proc/meminfo to be
able to load all the interesting fields from there, and
am now printing that as well.

Change-Id: I9e7d13e9c07a8249c7a7e12e5433973b2c0fdc11
2013-09-13 16:02:01 -07:00
Craig Mautner
a82aa09ba3 When launching home activity, make sure it is top.
Because recents sits on the same stack as launcher it can sometimes be
above launcher. When we were launching home activity because the flag
told us to we would sometimes launch recents instead. This fix makes
sure that the home activity is on the top when it is supposed to be
launched next.

Previously this was fixed by having recents move itself to the back
of the stack after it launched an activity (b/9750207 and ag/336019).
But that solution caused the AppTransition to be set to
TRANSIT_TASK_TO_BACK which left the SOFT_INPUT_IS_FORWARD_NAVIGATION
flag unset. This in turn caused IMEs to remain unlaunched when
returning from recents (b/10240567).

Fixes bug 10240567.

Change-Id: I35c6619af0e68d0e6d9ab87cad06ea7c27e11e27
2013-09-13 15:46:51 -07:00