summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
Diffstat (limited to 'services')
-rw-r--r--services/java/com/android/server/am/ActivityManagerService.java26
-rwxr-xr-xservices/java/com/android/server/am/ActivityStack.java34
-rw-r--r--services/java/com/android/server/display/WifiDisplayController.java23
-rw-r--r--services/java/com/android/server/pm/PackageManagerService.java4
-rw-r--r--services/java/com/android/server/pm/UserManagerService.java23
-rw-r--r--services/java/com/android/server/updatable/ConfigUpdateInstallReceiver.java17
-rw-r--r--services/java/com/android/server/wm/WindowAnimator.java42
-rw-r--r--services/java/com/android/server/wm/WindowState.java3
8 files changed, 118 insertions, 54 deletions
diff --git a/services/java/com/android/server/am/ActivityManagerService.java b/services/java/com/android/server/am/ActivityManagerService.java
index 989477f..db042b5 100644
--- a/services/java/com/android/server/am/ActivityManagerService.java
+++ b/services/java/com/android/server/am/ActivityManagerService.java
@@ -1794,7 +1794,7 @@ public final class ActivityManagerService extends ActivityManagerNative
}
private final void updateLruProcessInternalLocked(ProcessRecord app,
- boolean oomAdj, boolean updateActivityTime, int bestPos) {
+ boolean updateActivityTime, int bestPos) {
// put it on the LRU to keep track of when it should be exited.
int lrui = mLruProcesses.indexOf(app);
if (lrui >= 0) mLruProcesses.remove(lrui);
@@ -1851,7 +1851,7 @@ public final class ActivityManagerService extends ActivityManagerNative
if (cr.binding != null && cr.binding.service != null
&& cr.binding.service.app != null
&& cr.binding.service.app.lruSeq != mLruSeq) {
- updateLruProcessInternalLocked(cr.binding.service.app, false,
+ updateLruProcessInternalLocked(cr.binding.service.app,
updateActivityTime, i+1);
}
}
@@ -1859,21 +1859,21 @@ public final class ActivityManagerService extends ActivityManagerNative
for (int j=app.conProviders.size()-1; j>=0; j--) {
ContentProviderRecord cpr = app.conProviders.get(j).provider;
if (cpr.proc != null && cpr.proc.lruSeq != mLruSeq) {
- updateLruProcessInternalLocked(cpr.proc, false,
+ updateLruProcessInternalLocked(cpr.proc,
updateActivityTime, i+1);
}
}
-
- //Slog.i(TAG, "Putting proc to front: " + app.processName);
- if (oomAdj) {
- updateOomAdjLocked();
- }
}
final void updateLruProcessLocked(ProcessRecord app,
boolean oomAdj, boolean updateActivityTime) {
mLruSeq++;
- updateLruProcessInternalLocked(app, oomAdj, updateActivityTime, 0);
+ updateLruProcessInternalLocked(app, updateActivityTime, 0);
+
+ //Slog.i(TAG, "Putting proc to front: " + app.processName);
+ if (oomAdj) {
+ updateOomAdjLocked();
+ }
}
final ProcessRecord getProcessRecordLocked(
@@ -4455,7 +4455,13 @@ public final class ActivityManagerService extends ActivityManagerNative
enableScreenAfterBoot();
}
}
-
+
+ public final void activityResumed(IBinder token) {
+ final long origId = Binder.clearCallingIdentity();
+ mMainStack.activityResumed(token);
+ Binder.restoreCallingIdentity(origId);
+ }
+
public final void activityPaused(IBinder token) {
final long origId = Binder.clearCallingIdentity();
mMainStack.activityPaused(token, false);
diff --git a/services/java/com/android/server/am/ActivityStack.java b/services/java/com/android/server/am/ActivityStack.java
index f72d318..29ee0bc 100755
--- a/services/java/com/android/server/am/ActivityStack.java
+++ b/services/java/com/android/server/am/ActivityStack.java
@@ -52,7 +52,6 @@ import android.os.IBinder;
import android.os.Message;
import android.os.ParcelFileDescriptor;
import android.os.PowerManager;
-import android.os.Process;
import android.os.RemoteException;
import android.os.SystemClock;
import android.os.UserHandle;
@@ -755,8 +754,6 @@ final class ActivityStack {
completeResumeLocked(r);
checkReadyForSleepLocked();
if (DEBUG_SAVED_STATE) Slog.i(TAG, "Launch completed; removing icicle of " + r.icicle);
- r.icicle = null;
- r.haveState = false;
} else {
// This activity is not starting in the resumed state... which
// should look like we asked it to pause+stop (but remain visible),
@@ -1010,7 +1007,21 @@ final class ActivityStack {
resumeTopActivityLocked(null);
}
}
-
+
+ final void activityResumed(IBinder token) {
+ ActivityRecord r = null;
+
+ synchronized (mService) {
+ int index = indexOfTokenLocked(token);
+ if (index >= 0) {
+ r = mHistory.get(index);
+ if (DEBUG_SAVED_STATE) Slog.i(TAG, "Resumed activity; dropping state of: " + r);
+ r.icicle = null;
+ r.haveState = false;
+ }
+ }
+ }
+
final void activityPaused(IBinder token, boolean timeout) {
if (DEBUG_PAUSE) Slog.v(
TAG, "Activity paused: token=" + token + ", timeout=" + timeout);
@@ -1488,6 +1499,15 @@ final class ActivityStack {
// can be resumed...
if (mResumedActivity != null) {
if (DEBUG_SWITCH) Slog.v(TAG, "Skip resume: need to start pausing");
+ // At this point we want to put the upcoming activity's process
+ // at the top of the LRU list, since we know we will be needing it
+ // very soon and it would be a waste to let it get killed if it
+ // happens to be sitting towards the end.
+ if (next.app != null && next.app.thread != null) {
+ // No reason to do full oom adj update here; we'll let that
+ // happen whenever it needs to later.
+ mService.updateLruProcessLocked(next.app, false, true);
+ }
startPausingLocked(userLeaving, false);
return true;
}
@@ -1728,11 +1748,6 @@ final class ActivityStack {
"resume-exception", true);
return true;
}
-
- // Didn't need to use the icicle, and it is now out of date.
- if (DEBUG_SAVED_STATE) Slog.i(TAG, "Resumed activity; didn't need icicle of: " + next);
- next.icicle = null;
- next.haveState = false;
next.stopped = false;
} else {
@@ -2578,7 +2593,6 @@ final class ActivityStack {
mDismissKeyguardOnNextActivity = false;
mService.mWindowManager.dismissKeyguard();
}
- Slog.i(TAG, "DONE STARTING!");
return err;
}
diff --git a/services/java/com/android/server/display/WifiDisplayController.java b/services/java/com/android/server/display/WifiDisplayController.java
index 141cbd7..3bc19a1 100644
--- a/services/java/com/android/server/display/WifiDisplayController.java
+++ b/services/java/com/android/server/display/WifiDisplayController.java
@@ -129,6 +129,9 @@ final class WifiDisplayController implements DumpUtils.Dump {
// True if RTSP has connected.
private boolean mRemoteDisplayConnected;
+ // True if the remote submix is enabled.
+ private boolean mRemoteSubmixOn;
+
public WifiDisplayController(Context context, Handler handler, Listener listener) {
mContext = context;
mHandler = handler;
@@ -160,6 +163,7 @@ final class WifiDisplayController implements DumpUtils.Dump {
pw.println("mRemoteDisplay=" + mRemoteDisplay);
pw.println("mRemoteDisplayInterface=" + mRemoteDisplayInterface);
pw.println("mRemoteDisplayConnected=" + mRemoteDisplayConnected);
+ pw.println("mRemoteSubmixOn=" + mRemoteSubmixOn);
pw.println("mKnownWifiDisplayPeers: size=" + mKnownWifiDisplayPeers.size());
for (WifiP2pDevice device : mKnownWifiDisplayPeers) {
@@ -390,16 +394,14 @@ final class WifiDisplayController implements DumpUtils.Dump {
Slog.i(TAG, "Stopped listening for RTSP connection on " + mRemoteDisplayInterface
+ " from Wifi display: " + mConnectedDevice.deviceName);
- if (mRemoteDisplayConnected) {
- mAudioManager.setRemoteSubmixOn(false, REMOTE_SUBMIX_ADDRESS);
- }
-
mRemoteDisplay.dispose();
mRemoteDisplay = null;
mRemoteDisplayInterface = null;
mRemoteDisplayConnected = false;
mHandler.removeCallbacks(mRtspTimeout);
+ setRemoteSubmixOn(false);
+
mHandler.post(new Runnable() {
@Override
public void run() {
@@ -483,6 +485,8 @@ final class WifiDisplayController implements DumpUtils.Dump {
mConnectingDevice = mDesiredDevice;
WifiP2pConfig config = new WifiP2pConfig();
config.deviceAddress = mConnectingDevice.deviceAddress;
+ // Helps with STA & P2P concurrency
+ config.groupOwnerIntent = WifiP2pConfig.MAX_GO_INTENT;
final WifiDisplay display = createWifiDisplay(mConnectingDevice);
mHandler.post(new Runnable() {
@@ -527,6 +531,8 @@ final class WifiDisplayController implements DumpUtils.Dump {
return; // done
}
+ setRemoteSubmixOn(true);
+
final WifiP2pDevice oldDevice = mConnectedDevice;
final int port = getPortNumber(mConnectedDevice);
final String iface = addr.getHostAddress() + ":" + port;
@@ -545,8 +551,6 @@ final class WifiDisplayController implements DumpUtils.Dump {
mRemoteDisplayConnected = true;
mHandler.removeCallbacks(mRtspTimeout);
- mAudioManager.setRemoteSubmixOn(true, REMOTE_SUBMIX_ADDRESS);
-
final WifiDisplay display = createWifiDisplay(mConnectedDevice);
mHandler.post(new Runnable() {
@Override
@@ -583,6 +587,13 @@ final class WifiDisplayController implements DumpUtils.Dump {
}
}
+ private void setRemoteSubmixOn(boolean on) {
+ if (mRemoteSubmixOn != on) {
+ mRemoteSubmixOn = on;
+ mAudioManager.setRemoteSubmixOn(on, REMOTE_SUBMIX_ADDRESS);
+ }
+ }
+
private void handleStateChanged(boolean enabled) {
if (mWifiP2pEnabled != enabled) {
mWifiP2pEnabled = enabled;
diff --git a/services/java/com/android/server/pm/PackageManagerService.java b/services/java/com/android/server/pm/PackageManagerService.java
index ce52d2b..536c612 100644
--- a/services/java/com/android/server/pm/PackageManagerService.java
+++ b/services/java/com/android/server/pm/PackageManagerService.java
@@ -3535,8 +3535,8 @@ public class PackageManagerService extends IPackageManager.Stub {
return DEX_OPT_DEFERRED;
} else {
Log.i(TAG, "Running dexopt on: " + pkg.applicationInfo.packageName);
- ret = mInstaller.dexopt(path, pkg.applicationInfo.uid,
- !isForwardLocked(pkg));
+ final int sharedGid = UserHandle.getSharedAppGid(pkg.applicationInfo.uid);
+ ret = mInstaller.dexopt(path, sharedGid, !isForwardLocked(pkg));
pkg.mDidDexOpt = true;
performed = true;
}
diff --git a/services/java/com/android/server/pm/UserManagerService.java b/services/java/com/android/server/pm/UserManagerService.java
index a58c4ea..690d7c9 100644
--- a/services/java/com/android/server/pm/UserManagerService.java
+++ b/services/java/com/android/server/pm/UserManagerService.java
@@ -196,7 +196,7 @@ public class UserManagerService extends IUserManager.Stub {
synchronized (mPackagesLock) {
UserInfo info = mUsers.get(userId);
if (info == null) return null;
- ParcelFileDescriptor fd = updateIconBitmapLocked(info);
+ ParcelFileDescriptor fd = openIconBitmapLocked(info, true /* write */);
if (fd != null) {
writeUserLocked(info);
}
@@ -205,6 +205,17 @@ public class UserManagerService extends IUserManager.Stub {
}
@Override
+ public ParcelFileDescriptor getUserIcon(int userId) {
+ checkManageUsersPermission("read users");
+ synchronized (mPackagesLock) {
+ UserInfo info = mUsers.get(userId);
+ if (info == null || info.iconPath == null) return null;
+ ParcelFileDescriptor fd = openIconBitmapLocked(info, false /* read */);
+ return fd;
+ }
+ }
+
+ @Override
public void setGuestEnabled(boolean enable) {
checkManageUsersPermission("enable guest users");
synchronized (mPackagesLock) {
@@ -278,7 +289,7 @@ public class UserManagerService extends IUserManager.Stub {
}
}
- private ParcelFileDescriptor updateIconBitmapLocked(UserInfo info) {
+ private ParcelFileDescriptor openIconBitmapLocked(UserInfo info, boolean toWrite) {
try {
File dir = new File(mUsersDir, Integer.toString(info.id));
File file = new File(dir, USER_PHOTO_FILENAME);
@@ -290,8 +301,10 @@ public class UserManagerService extends IUserManager.Stub {
-1, -1);
}
ParcelFileDescriptor fd = ParcelFileDescriptor.open(file,
- MODE_CREATE|MODE_READ_WRITE);
- info.iconPath = file.getAbsolutePath();
+ toWrite ? MODE_CREATE|MODE_READ_WRITE : MODE_READ_WRITE);
+ if (toWrite) {
+ info.iconPath = file.getAbsolutePath();
+ }
return fd;
} catch (FileNotFoundException e) {
Slog.w(LOG_TAG, "Error setting photo for user ", e);
@@ -688,7 +701,7 @@ public class UserManagerService extends IUserManager.Stub {
*/
private int getNextAvailableIdLocked() {
synchronized (mPackagesLock) {
- int i = 0;
+ int i = 10;
while (i < Integer.MAX_VALUE) {
if (mUsers.indexOfKey(i) < 0) {
break;
diff --git a/services/java/com/android/server/updatable/ConfigUpdateInstallReceiver.java b/services/java/com/android/server/updatable/ConfigUpdateInstallReceiver.java
index c1f45a8..a74a648 100644
--- a/services/java/com/android/server/updatable/ConfigUpdateInstallReceiver.java
+++ b/services/java/com/android/server/updatable/ConfigUpdateInstallReceiver.java
@@ -89,12 +89,15 @@ public class ConfigUpdateInstallReceiver extends BroadcastReceiver {
// get the hash of the currently used value
String currentHash = getCurrentHash(getCurrentContent());
if (!verifyVersion(currentVersion, altVersion)) {
- Slog.e(TAG, "New version is not greater than current version, aborting!");
+ EventLog.writeEvent(EventLogTags.CONFIG_INSTALL_FAILED,
+ "New version is not greater than current version");
} else if (!verifyPreviousHash(currentHash, altRequiredHash)) {
- Slog.e(TAG, "Current hash did not match required value, aborting!");
+ EventLog.writeEvent(EventLogTags.CONFIG_INSTALL_FAILED,
+ "Current hash did not match required value");
} else if (!verifySignature(altContent, altVersion, altRequiredHash, altSig,
cert)) {
- Slog.e(TAG, "Signature did not verify, aborting!");
+ EventLog.writeEvent(EventLogTags.CONFIG_INSTALL_FAILED,
+ "Signature did not verify");
} else {
// install the new content
Slog.i(TAG, "Found new update, installing...");
@@ -103,8 +106,12 @@ public class ConfigUpdateInstallReceiver extends BroadcastReceiver {
}
} catch (Exception e) {
Slog.e(TAG, "Could not update content!", e);
- EventLog.writeEvent(EventLogTags.CONFIG_INSTALL_FAILED,
- updateDir.toString());
+ // keep the error message <= 100 chars
+ String errMsg = e.toString();
+ if (errMsg.length() > 100) {
+ errMsg = errMsg.substring(0, 99);
+ }
+ EventLog.writeEvent(EventLogTags.CONFIG_INSTALL_FAILED, errMsg);
}
}
}.start();
diff --git a/services/java/com/android/server/wm/WindowAnimator.java b/services/java/com/android/server/wm/WindowAnimator.java
index 4494058..0a4e6d3 100644
--- a/services/java/com/android/server/wm/WindowAnimator.java
+++ b/services/java/com/android/server/wm/WindowAnimator.java
@@ -101,6 +101,23 @@ public class WindowAnimator {
boolean mInitialized = false;
+ // forceHiding states.
+ static final int KEYGUARD_NOT_SHOWN = 0;
+ static final int KEYGUARD_ANIMATING_IN = 1;
+ static final int KEYGUARD_SHOWN = 2;
+ static final int KEYGUARD_ANIMATING_OUT = 3;
+ int mForceHiding = KEYGUARD_NOT_SHOWN;
+
+ private String forceHidingToString() {
+ switch (mForceHiding) {
+ case KEYGUARD_NOT_SHOWN: return "KEYGUARD_NOT_SHOWN";
+ case KEYGUARD_ANIMATING_IN: return "KEYGUARD_ANIMATING_IN";
+ case KEYGUARD_SHOWN: return "KEYGUARD_SHOWN";
+ case KEYGUARD_ANIMATING_OUT:return "KEYGUARD_ANIMATING_OUT";
+ default: return "KEYGUARD STATE UNKNOWN " + mForceHiding;
+ }
+ }
+
WindowAnimator(final WindowManagerService service) {
mService = service;
mContext = service.mContext;
@@ -280,13 +297,7 @@ public class WindowAnimator {
getDisplayContentsAnimatorLocked(displayId).mWinAnimators;
ArrayList<WindowStateAnimator> unForceHiding = null;
boolean wallpaperInUnForceHiding = false;
-
- // forceHiding states.
- final int KEYGUARD_NOT_SHOWN = 0;
- final int KEYGUARD_ANIMATING_IN = 1;
- final int KEYGUARD_SHOWN = 2;
- final int KEYGUARD_ANIMATING_OUT = 3;
- int forceHiding = KEYGUARD_NOT_SHOWN;
+ mForceHiding = KEYGUARD_NOT_SHOWN;
for (int i = winAnimatorList.size() - 1; i >= 0; i--) {
WindowStateAnimator winAnimator = winAnimatorList.get(i);
@@ -329,16 +340,16 @@ public class WindowAnimator {
if (win.isReadyForDisplay()) {
if (nowAnimating) {
if (winAnimator.mAnimationIsEntrance) {
- forceHiding = KEYGUARD_ANIMATING_IN;
+ mForceHiding = KEYGUARD_ANIMATING_IN;
} else {
- forceHiding = KEYGUARD_ANIMATING_OUT;
+ mForceHiding = KEYGUARD_ANIMATING_OUT;
}
} else {
- forceHiding = KEYGUARD_SHOWN;
+ mForceHiding = KEYGUARD_SHOWN;
}
}
if (WindowManagerService.DEBUG_VISIBILITY) Slog.v(TAG,
- "Force hide " + forceHiding
+ "Force hide " + mForceHiding
+ " hasSurface=" + win.mHasSurface
+ " policyVis=" + win.mPolicyVisibility
+ " destroying=" + win.mDestroying
@@ -350,9 +361,9 @@ public class WindowAnimator {
final boolean hideWhenLocked =
(winAnimator.mAttrFlags & FLAG_SHOW_WHEN_LOCKED) == 0;
final boolean changed;
- if (((forceHiding == KEYGUARD_ANIMATING_IN)
+ if (((mForceHiding == KEYGUARD_ANIMATING_IN)
&& (!winAnimator.isAnimating() || hideWhenLocked))
- || ((forceHiding == KEYGUARD_SHOWN) && hideWhenLocked)) {
+ || ((mForceHiding == KEYGUARD_SHOWN) && hideWhenLocked)) {
changed = win.hideLw(false, false);
if (WindowManagerService.DEBUG_VISIBILITY && changed) Slog.v(TAG,
"Now policy hidden: " + win);
@@ -708,10 +719,11 @@ public class WindowAnimator {
if (dumpAll) {
if (mWindowDetachedWallpaper != null) {
pw.print(prefix); pw.print("mWindowDetachedWallpaper=");
- pw.println(mWindowDetachedWallpaper);
+ pw.println(mWindowDetachedWallpaper);
}
pw.print(prefix); pw.print("mAnimTransactionSequence=");
- pw.println(mAnimTransactionSequence);
+ pw.print(mAnimTransactionSequence);
+ pw.println(" mForceHiding=" + forceHidingToString());
for (int i = 0; i < mDisplayContentsAnimators.size(); i++) {
pw.print(prefix); pw.print("DisplayContentsAnimator #");
pw.println(mDisplayContentsAnimators.keyAt(i));
diff --git a/services/java/com/android/server/wm/WindowState.java b/services/java/com/android/server/wm/WindowState.java
index a06ee3b..b62028e 100644
--- a/services/java/com/android/server/wm/WindowState.java
+++ b/services/java/com/android/server/wm/WindowState.java
@@ -1133,7 +1133,8 @@ final class WindowState implements WindowManagerPolicy.WindowState {
pw.print(prefix); pw.print("mConfiguration="); pw.println(mConfiguration);
}
pw.print(prefix); pw.print("mHasSurface="); pw.print(mHasSurface);
- pw.print(" mShownFrame="); mShownFrame.printShortString(pw); pw.println();
+ pw.print(" mShownFrame="); mShownFrame.printShortString(pw);
+ pw.print(" isReadyForDisplay()="); pw.println(isReadyForDisplay());
if (dumpAll) {
pw.print(prefix); pw.print("mFrame="); mFrame.printShortString(pw);
pw.print(" last="); mLastFrame.printShortString(pw);