15585 Commits

Author SHA1 Message Date
Andreas Gampe
aec67dcc02 Frameworks/base: Add native bridge post-fork initialization
Change-Id: I5a20de1cb68dd1802937b369b14c50c9c1031c67
2014-09-03 21:38:34 -07:00
Robert Craig
99891156fc Add testing api to SELinuxMMAC code.
Added needed api for local unit testing.

Change-Id: If52555ecb4f0e6bc06e153b6a17e2c706b11253e
Signed-off-by: rpcraig <rpcraig@tycho.ncsc.mil>
2014-09-02 12:50:29 -04:00
Alex Light
09107db491 Remove obsolete pruneDexCache
Bug: 16875245

Change-Id: I06e14c405aa4af295795982c1d236be3cb00e893
2014-08-28 23:30:45 +00:00
Calin Juravle
e8d2ffd733 Pass vmSafeMode (manifest attribute) to installd.
The flag is used to enforce --interpret-only flag when running dex2oat.

Bug: 12457423

(cherry picked from commit 11e08c010a42390803b65eaa698ca0e768aed896)

Change-Id: I215339527e998b24e274c8df42a5024839e6a9fa
2014-08-27 14:49:11 +01:00
Craig Mautner
ca9ba58786 Revert "Fix a bug: unable to start activity when AM is killing the process."
This reverts commit 5073145f85c8197ec4387d5e2599442a7291ca9c.

I spoke to Dianne and she said that if this is making a problem go away then it is only hiding it and there is a deeper problem we need to fix.

I think if killedByApp is true then we should set app and app.thread to null. I'll look at it further when I have more time.

Change-Id: I44c29e15ca654666440472eab2d2af1c5af80b9a
2014-08-12 21:09:07 +00:00
Leo Hsu
5073145f85 Fix a bug: unable to start activity when AM is killing the process.
Symptom: No activity was started for startActivity, low repro rate.
Root Cause: Starting activity on a process which was killed by ActivityManagerService.killUnneededProcessLocked() and before receiving AppDeathRecipient of it.
Solution: Choose the flow of starting a new process if ProcessRecord.killedByAm is true.

Change-Id: Ida2639b0fb4631222fc92d65aadc9fd2da637b45
2014-08-12 13:47:23 +08:00
Calin Juravle
219b535673 Fix the instruction set for dex file during (re)moving ops.
This complements https://android-review.googlesource.com/#/c/103231/
where the instruction set was mapped just for comptilation. The same
should have been done for move,remove and getSize.

The list of dex code ISAs is alo de-duped.

Bug: 16185267
Change-Id: I8fe453a800812e382e8f41b5f7922997aa9c18a9
2014-08-08 18:45:28 +01:00
Calin Juravle
576c384ed8 Use native ISA for dex code (in case there's a NativeBridge)
In the presence of a native bridge it is more efficient to compile the
dex directly to the native ISA than to use the shared library ISA as a
reference.

This can be achieve by configuring the readonly system properties to map
between the .so ISA and the desired dex code .ISA (e.g.
ro.dalvik.vm.isa.ISA1=ISA2).

Bug: 16185267

Change-Id: I50baa7b37e1465b9adf72d6f6b96f526a08d59c7
2014-08-06 19:28:28 +01:00
Alex Light
1995d12d26 Make system use patchoat to relocate during runtime.
Make PackageManagerService aware of patchoat and make it use it when
appropriate.

Bug: 15358152

Change-Id: Ibe92d8b55a24bbf718b0416a21b76e5df7a2de26
2014-08-05 10:22:10 -07:00
Eunae Kim
26ac40305a Fix a bug that the RecentTask list of other’s may show up to non-primary users.
When switching to a newly created user, the user may face this bug when he opens the RecentTask screen.
A possible bug scenario is described as follows:
A user id of a removed user may be recycled when created a new user.
However, mRecentTasks is not correctly controlled so that old information may still remain and be possibly mapped to wrong user.
This patch prevents this bug by explicitly removing old information in mRecentTasks when removing existing user.

Change-Id: I1874dbd604598a5d740ae1e034981e21214c15c6
Signed-off-by: Eunae Kim <eunae.kim@lge.com>
2014-07-31 13:58:53 +09:00
riddle_hsu
8062b9534f [ActivityManager] Prevent coredump file may not complete for testing.
Sympton:
During testing, skip kill native crash process manually because it will continue to die by default.

Root Cause:
Large process may take some time to do coredump.In auto test, crash process will be killed immediately that results incomplete coredump file.

Solution:
If the tester (IActivityController) will handle app crash event,
Do not kill native crashed process if the rom is debuggable.

Change-Id: Ia360af147d694125d440e5ba2f958c4759a50494
2014-07-31 03:53:04 +00:00
riddle_hsu
1df4d9f8c7 [ActivityManager] Avoid mistaking visibility by finishing task.
Sympton:
Next activity only adds to history but does not launch/resume then results ANR.

Root Cause:
In a rare timing, some windows are switched at the same time,
it will cause some finishing records on the top temporarily,
then set startIt to false that skip to resume the real top activty.

Solution:
If all activities in a task are finishing, do not use it to check.
The behavior/checking is the same concept as in JellyBean:
            // If starting in an existing task, find where that is...
            boolean startIt = true;
            for (int i = NH-1; i >= 0; i--) {
                ActivityRecord p = mHistory.get(i);
                if (p.finishing) { // <--
                    continue;
                }

Change-Id: I9d81a7b5182400c52e173da23eee61c74692beee
2014-07-31 00:26:51 +08:00
Craig Mautner
02fd104f30 Merge "Skip broadcasting to a receiver if the receiver seems to be dead" 2014-07-17 23:22:21 +00:00
Koji Fukui
63909886b2 Skip broadcasting to a receiver if the receiver seems to be dead
If an application that has a broadcast receiver is killed
during broadcasting, thread variable of ProcessRecord becomes null
so that IIntentReceiver#performReceive() is called
in BroadcastQueue#performReceiveLocked(). But if binder driver has not
noticed the death of the application yet, it can't throw
DeadObjectException. After that, binder driver notices. But it can't
notify DeadObjectException to the caller because performReceive() is
async call. So broadcasting keeps on waiting for finishing
performReceive() until timeout.

This change checks the death of the application before calling
performReceive() and skips broadcasting to the receiver
if the application has already died.

Change-Id: Ifa02b8b1a7e7b6fd314de90fedff5b7a5326825d
2014-07-21 09:53:05 +02:00
louis_chang
73fd117c65 [ActivityManager]: Update home process when home activity resumed
Symptom:
  When switch between two home activities, the home process might not be updated to the correct one. In that case, the home activity might be killed easily.

Root Cause:
  The home process is updated only when a home activity is newly created or being restarted. ActivityManager did not update the home process when simply resume a home activity.

Solution:
  Update home process when home activity resumed

Reproduce Steps:
  1. Install a launcher application, such as Apex Launcher
  2. Press home key to change to Apex Launcher by "Just once" option
  3. Press home key to switch back to original home activity by "Just once" option.
     (The home process is still the Apex Launcher's process because ActivityManager does not update the home process when resuming the original home activity.)

Change-Id: I046279ca7ba851a283ee67ea19202890f7b3f343
2014-07-16 17:16:34 +00:00
Craig Mautner
d543c3e113 Merge "[ActivityManager] Do not finish root activity when reset task" 2014-07-15 20:36:09 +00:00
louis_chang
f87b219539 [ActivityManager] Do not finish root activity when reset task
Symptom:
The root activity not always located at index 0 of the task.
For example, the index 1 activity will become the new root
when the original root activity (at index 0) finished.
The new root activity might be finished unexpectedly before
the original root activity actually destroyed.

Solution:
Check frontOfTask to avoid finishing the root activity unexpectedly

Change-Id: I623ab97e9c95c83b3cfe7c9dfc151a291a391ea4
2014-07-16 18:15:35 +08:00
louis_chang
d937616f87 [ActivityManager] Move top task to top in window manager
Symptom:
In certain situations, application starts activity while
it is in background. When an existing background activity
starts a new activity which results to be kept in the same
background task, the new activity won't be resumed.
In that case, the background task (sourceTask) should not be
moved to top in window manager.

Solution:
Move top task of the target stack to top in window manager

Change-Id: Id7a37ea67ce1f80e0c2b5399865c51fd7113deb8
2014-07-16 17:42:04 +08:00
Colin Cross
1f060a178d Merge "GpsLocationProvider: look for config file in /etc/gps.<ro.hardware.gps>.conf" 2014-07-10 00:35:03 +00:00
Robin Lee
74803e559c Merge "Make misc config directory during user creation" 2014-07-02 20:49:53 +00:00
riddle_hsu
7f1e3f3e93 [ActivityManager] Prevent potential deadlock from system error dialog and InputMethodManager.
Sympton:
When application crash in a special timing and system server's InputMethodManager is binding, deadlock may occur.

Root Cause:
Thread(1): When using InputMethodManager in system server, it will lock mH(handler) of InputMethodManager,
and sometimes it will call to InputMethodManagerService::showCurrentInputLocked and will call bindService at some condition,
then it will also lock ActivityManagerService.
Thread(2): When an application crashed, it will lock ActivityManager when showing crash dialog, inside the dialog,
it will call setEnabled of Button and lock mH of InputMethodManager.setEnable of TextView will lock IMM's handler.
So the deadlock happened as the flow: (2) lock AMS -> (1)lock mH -> (2)wait mH -> (1) wait AMS

Solution:
Reduce nested lock of error dialog: post message to let (2) lock mH after release AMS lock.

Change-Id: Id85c29406236db3b5fca9655fde1fcaf0afd1337
2014-07-08 04:30:19 +08:00
Craig Mautner
ef2e76675a Merge "[ActivityManager] Avoid keeping restarting home when only home activity exists." 2014-07-02 20:49:53 +00:00
Craig Mautner
c66da9d606 Merge "[ActivityManager] Prevent kill a restarted process again." 2014-07-06 03:24:06 +00:00
riddle_hsu
3145b24902 [ActivityManager] Avoid keeping restarting home when only home activity exists.
Root Cause:
When there is only home activity existed,
updating home apk will call forceStopPackageLocked to finish the activity.
Then activity history becomes empty, then home will be launched,
but its package is still target to close that results a loop.

Solution:
If home activity has been force-stopped, do not stop the same home activity again.

Change-Id: Icff12028d407873c2e6f50a06bcad231b908ccbd
2014-07-04 17:01:56 +08:00
riddle_hsu
a4f1f8a239 [ActivityManager] Prevent kill a restarted process again.
Root Cause:
Use removeTask with flag ActivityManager.REMOVE_TASK_KILL_PROCESS will set waitingToKill = "remove task"
to the target process when its setSchedGroup is not BG_NONINTERACTIVE.
Later the target process may be killed when applying oom-adj due to setSchedGroup has changed to BG_NONINTERACTIVE.
If the process is needed to restart, the process record will be resued.
Then the restarted process may be killed again because its waitingToKill is not null.

Solution:
Clean waitingToKill when process is dead.

Change-Id: I5ffb5388127f4221da4c700d3f1c224f7ca6e7b2
2014-07-04 12:19:41 +08:00
riddle_hsu
abc69e93d6 [ActivityManager] Ensure alive process is not killedByAm.
Symptom: Unable to kill by Am again and will be skipped updating its oom adj.

Root Cause:
A restarted process will reuse original process record.
The flag killedByAm will keep previous state.

Solution:
Reset the flag killedByAm to false when the process is started.

Note: Found another similiar patch If95137d91939cc44882ad2813131bcde0edd0c1b


Change-Id: I59a86648ca8d0aed4c489d92751af120aae5ef90
2014-07-04 13:33:19 +00:00
Narayan Kamath
6e84f8c1b9 Merge "Fix native crashes when APKs can't be opened." 2014-07-01 17:48:27 +00:00
Robert Craig
83b54ecab7 Allow different SELinux policies for third party apps.
Prior support forced all third party apps
to be resolved against the default stanza
of the mac_permissions.xml file when assigning
seinfo labels. This meant that all third party
apps, in effect, were untrusted regardless of
cert and therefore received the same selinux domain.
This also had the unfortunate side effect of forcing
certain third party apps into the wrong domains
because of shared userid requests among apps.

This patch removes that restriction and instead
allows all apps, regardless of location, to be
matched against the full mac_permissions.xml
policy file. This then allows all apps signed
with known good certs to receive the same selinux
domains of other apps with whom they share trust.

Change-Id: Iba569c046135c0e81140faf6296c5da26a243037
Signed-off-by: rpcraig <rpcraig@tycho.ncsc.mil>
2014-07-01 13:53:11 -07:00
Narayan Kamath
ec4516470d Fix native crashes when APKs can't be opened.
There was lax / incomplete error checking around the
construction of Apk handles. This change changes the ApkHandle
API and makes it throw IOException if the zipfile couldn't
be opened.

Additionally :
- Fix a resource leak in DefaultContainerService
- Report errors correctly during package moves.

bug: 15563874
Change-Id: Ic71a10709eb82b8f53405bbfb2320e80aa96b771
2014-06-30 17:14:29 +01:00
Narayan Kamath
2a0f9e6a52 Merge "Explicitly list out the list of cache subdirs to prune." 2014-06-24 06:33:30 +00:00
Jianzheng Zhou
78c8e7c8bf DO NOT MERGE refactor wifi p2p's startDhcpServer function
Add getTetheredDhcpRanges() interface and call it before calling
mNwService.startTethering() to update dhcp ranges. This will allow p2p app
to run well concurrently with other tethering app(e.g. usb tethering).

Change-Id: I5e8ffeb5d2d396f48b897cd9396f133e25ecca57
Signed-off-by: Jianzheng Zhou <jianzheng.zhou@freescale.com>
2014-06-23 21:02:45 +00:00
Brian Carlstrom
0924ef6592 Merge "Treat missing package usage data as a separate case" 2014-06-21 03:13:40 +00:00
Danny Baumann
ec4e780e5c Fix frontOfTask assignment.
If all activities of a given stack were finishing, no activity was
marked as front-of-task. This confused ActivityManager, so make sure
there's always exactly one activity marked as front-of-task.

Change-Id: I087cbe10280d4a60aa5ccfaefe24a223523fb3f2
2014-06-23 08:43:37 +02:00
Brian Carlstrom
0547ce55eb Treat missing package usage data as a separate case
Bug: 15520936
Change-Id: I8e1c6921973f84af7ee94de91721cc4a3436ebaf
2014-06-20 12:53:19 -07:00
Narayan Kamath
8df5bd08c2 Explicitly list out the list of cache subdirs to prune.
We don't want directories like profiles and the former
profile-cache from being included in the prune. SELinux would
have prevented the move, but that's very brittle.

bug: 15677279

Change-Id: I2ff5db056757ffacaf108bb07b02dc0cac7172dd
2014-06-17 13:07:45 +01:00
Dan Albert
7bd2992504 Use openssl's SHA1 instead of bionic's.
Bionic is removing its SHA1.

Change-Id: I2b2d028223d2299666511a683cffba29c55639b7
2014-06-16 17:01:21 -07:00
Narayan Kamath
5b95e02684 Move dex file pruning to installd.
Companion change for commit 7dbf95cd7606e22267
in frameworks/native.

bug: 14407732
Change-Id: I520aa3950fb6b87c7ca5a805e597d734496407d3
2014-06-16 13:59:21 +01:00
Riley Spahn
5f5cf5f670 Add service_contexts to policy update bundles.
Add service_context file to SELinuxPolicyInstallReceiver
to allow updating.

Bug: 12909011
Change-Id: Ic0ad89958cc750413787d57e0f51363212a8730b
2014-06-12 20:46:34 +00:00
Robin Lee
94ca179eca Make misc config directory during user creation
Directories will appear in /data/misc/user/XX, readable only by
applications within that user.

Change-Id: I0adb14deb1a035abdbe51714356bd0c94ccf04c5
2014-06-10 18:48:05 +01:00
Robin Lee
e46e600412 Merge "Assign AID_EVERYONE gid to newly-created processes" 2014-06-04 20:51:55 +00:00
Narayan Kamath
d47e38b634 Scan for renderscript files before deciding ABIs.
The presence of ".bc" files in an APK implies
incompatibility with any of the 64 bit ABIs.

bug: 14900093

Change-Id: I66ca339a9a149cb3b7e7b349033d80acdeb4140a
2014-06-03 12:58:35 +01:00
Narayan Kamath
6431d11cd4 Add an --abi argument to "pm install"
This allows callers to force an install to a particular
ABI. This is intended only for testing (and CTS) and is
not meant for usage by the installer package.

Change-Id: Icb1528c0cd35b1aa9323386cb35ff4aaba374fcb
2014-06-03 11:11:47 +01:00
Narayan Kamath
032c5c054c Merge "Log process abis during start." 2014-06-03 09:57:03 +00:00
Nick Kralevich
daa0ee137d am 4f8785f2: Merge "SELinuxMMAC additions to perform policy versioning checks."
* commit '4f8785f28e6305d427cc3e483248828c9b9b06a2':
  SELinuxMMAC additions to perform policy versioning checks.
2014-05-31 05:27:46 +00:00
Nick Kralevich
4f8785f28e Merge "SELinuxMMAC additions to perform policy versioning checks." 2014-05-31 05:25:14 +00:00
Nick Kralevich
89b88f2269 am 3a9835d4: Merge "Allow SELinuxPolicyInstallReceiver to update new policy files."
* commit '3a9835d4914bc959a37eefecf4d5d0d20852e3e7':
  Allow SELinuxPolicyInstallReceiver to update new policy files.
2014-05-31 05:09:37 +00:00
Nick Kralevich
3a9835d491 Merge "Allow SELinuxPolicyInstallReceiver to update new policy files." 2014-05-31 05:07:13 +00:00
Narayan Kamath
b9b31f4b8e am bd4d3203: Merge "Support an ABI flag for instrumentation."
* commit 'bd4d320344833ce67dad3a4e10a61d0502a81d0e':
  Support an ABI flag for instrumentation.
2014-05-30 10:41:24 +00:00
Narayan Kamath
bd4d320344 Merge "Support an ABI flag for instrumentation." 2014-05-30 10:35:29 +00:00
Narayan Kamath
246469a355 Log process abis during start.
Adds to the info log that the activity manager emits
during every app launch.

Change-Id: Icd442334cb0e0e0fd0cc529c6b9c315a47d4aadc
2014-05-29 18:04:57 +01:00