summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDianne Hackborn <hackbod@google.com>2012-08-20 17:23:30 -0700
committerDianne Hackborn <hackbod@google.com>2012-08-21 10:34:20 -0700
commit0c3804950236fe170ebf6cc7a5f1e3e305b8f315 (patch)
tree832ea4ab2c17fe568df894aa3ed7438a01d97533
parenta5d5d608ccd885d8328879dde782a8cc93b7cf4f (diff)
downloadframeworks_base-0c3804950236fe170ebf6cc7a5f1e3e305b8f315.zip
frameworks_base-0c3804950236fe170ebf6cc7a5f1e3e305b8f315.tar.gz
frameworks_base-0c3804950236fe170ebf6cc7a5f1e3e305b8f315.tar.bz2
Improve multi-user app management.
Introduce API to get per-user storage information, keep track of services associated with users, and various small cleanup. Change-Id: I5d4e784e7ff3cccfed627d66a090d2f464202634
-rw-r--r--cmds/installd/commands.c4
-rw-r--r--cmds/installd/installd.c7
-rw-r--r--cmds/installd/installd.h2
-rw-r--r--core/java/android/app/ActivityManager.java7
-rw-r--r--core/java/android/app/ApplicationPackageManager.java6
-rw-r--r--core/java/android/content/pm/IPackageManager.aidl3
-rw-r--r--core/java/android/content/pm/PackageManager.java14
-rw-r--r--core/java/android/content/pm/PackageStats.java65
-rwxr-xr-xcore/tests/coretests/src/android/content/pm/AppCacheTest.java2
-rwxr-xr-xservices/java/com/android/server/NotificationManagerService.java4
-rw-r--r--services/java/com/android/server/am/ActiveServices.java60
-rw-r--r--services/java/com/android/server/am/ActivityManagerService.java21
-rw-r--r--services/java/com/android/server/am/ConnectionRecord.java28
-rw-r--r--services/java/com/android/server/am/IntentBindRecord.java18
-rw-r--r--services/java/com/android/server/am/ServiceRecord.java4
-rw-r--r--services/java/com/android/server/pm/Installer.java4
-rw-r--r--services/java/com/android/server/pm/PackageManagerService.java11
-rw-r--r--test-runner/src/android/test/mock/MockPackageManager.java3
18 files changed, 208 insertions, 55 deletions
diff --git a/cmds/installd/commands.c b/cmds/installd/commands.c
index 0a7cb2d..c16e6fb 100644
--- a/cmds/installd/commands.c
+++ b/cmds/installd/commands.c
@@ -432,7 +432,7 @@ int protect(char *pkgname, gid_t gid)
return 0;
}
-int get_size(const char *pkgname, const char *apkpath,
+int get_size(const char *pkgname, int persona, const char *apkpath,
const char *fwdlock_apkpath, const char *asecpath,
int64_t *_codesize, int64_t *_datasize, int64_t *_cachesize,
int64_t* _asecsize)
@@ -479,7 +479,7 @@ int get_size(const char *pkgname, const char *apkpath,
}
}
- if (create_pkg_path(path, pkgname, PKG_DIR_POSTFIX, 0)) {
+ if (create_pkg_path(path, pkgname, PKG_DIR_POSTFIX, persona)) {
goto done;
}
diff --git a/cmds/installd/installd.c b/cmds/installd/installd.c
index b8d0bd7..7108d68 100644
--- a/cmds/installd/installd.c
+++ b/cmds/installd/installd.c
@@ -85,8 +85,9 @@ static int do_get_size(char **arg, char reply[REPLY_MAX])
int64_t asecsize = 0;
int res = 0;
- /* pkgdir, apkpath */
- res = get_size(arg[0], arg[1], arg[2], arg[3], &codesize, &datasize, &cachesize, &asecsize);
+ /* pkgdir, persona, apkpath */
+ res = get_size(arg[0], atoi(arg[1]), arg[2], arg[3], arg[4],
+ &codesize, &datasize, &cachesize, &asecsize);
/*
* Each int64_t can take up 22 characters printed out. Make sure it
@@ -150,7 +151,7 @@ struct cmdinfo cmds[] = {
{ "freecache", 1, do_free_cache },
{ "rmcache", 1, do_rm_cache },
{ "protect", 2, do_protect },
- { "getsize", 4, do_get_size },
+ { "getsize", 5, do_get_size },
{ "rmuserdata", 2, do_rm_user_data },
{ "movefiles", 0, do_movefiles },
{ "linklib", 2, do_linklib },
diff --git a/cmds/installd/installd.h b/cmds/installd/installd.h
index f5485d2..3201427 100644
--- a/cmds/installd/installd.h
+++ b/cmds/installd/installd.h
@@ -199,7 +199,7 @@ int delete_cache(const char *pkgname);
int move_dex(const char *src, const char *dst);
int rm_dex(const char *path);
int protect(char *pkgname, gid_t gid);
-int get_size(const char *pkgname, const char *apkpath, const char *fwdlock_apkpath,
+int get_size(const char *pkgname, int persona, const char *apkpath, const char *fwdlock_apkpath,
const char *asecpath, int64_t *codesize, int64_t *datasize, int64_t *cachesize,
int64_t *asecsize);
int free_cache(int64_t free_size);
diff --git a/core/java/android/app/ActivityManager.java b/core/java/android/app/ActivityManager.java
index 58e6616..e644db4 100644
--- a/core/java/android/app/ActivityManager.java
+++ b/core/java/android/app/ActivityManager.java
@@ -1378,6 +1378,13 @@ public class ActivityManager {
public static final int FLAG_PERSISTENT = 1<<1;
/**
+ * Constant for {@link #flags}: this process is associated with a
+ * persistent system app.
+ * @hide
+ */
+ public static final int FLAG_HAS_ACTIVITIES = 1<<2;
+
+ /**
* Flags of information. May be any of
* {@link #FLAG_CANT_SAVE_STATE}.
* @hide
diff --git a/core/java/android/app/ApplicationPackageManager.java b/core/java/android/app/ApplicationPackageManager.java
index 7ab7086..86ee8a0 100644
--- a/core/java/android/app/ApplicationPackageManager.java
+++ b/core/java/android/app/ApplicationPackageManager.java
@@ -1079,10 +1079,10 @@ final class ApplicationPackageManager extends PackageManager {
}
@Override
- public void getPackageSizeInfo(String packageName,
- IPackageStatsObserver observer) {
+ public void getPackageSizeInfo(String packageName, int userHandle,
+ IPackageStatsObserver observer) {
try {
- mPM.getPackageSizeInfo(packageName, observer);
+ mPM.getPackageSizeInfo(packageName, userHandle, observer);
} catch (RemoteException e) {
// Should never happen!
}
diff --git a/core/java/android/content/pm/IPackageManager.aidl b/core/java/android/content/pm/IPackageManager.aidl
index f266b00..3f4b994 100644
--- a/core/java/android/content/pm/IPackageManager.aidl
+++ b/core/java/android/content/pm/IPackageManager.aidl
@@ -305,10 +305,11 @@ interface IPackageManager {
* Get package statistics including the code, data and cache size for
* an already installed package
* @param packageName The package name of the application
+ * @param userHandle Which user the size should be retrieved for
* @param observer a callback to use to notify when the asynchronous
* retrieval of information is complete.
*/
- void getPackageSizeInfo(in String packageName, IPackageStatsObserver observer);
+ void getPackageSizeInfo(in String packageName, int userHandle, IPackageStatsObserver observer);
/**
* Get a list of shared libraries that are available on the
diff --git a/core/java/android/content/pm/PackageManager.java b/core/java/android/content/pm/PackageManager.java
index e9e0ee3..0461dd1 100644
--- a/core/java/android/content/pm/PackageManager.java
+++ b/core/java/android/content/pm/PackageManager.java
@@ -28,6 +28,7 @@ import android.content.res.XmlResourceParser;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.Environment;
+import android.os.UserHandle;
import android.util.AndroidException;
import android.util.DisplayMetrics;
@@ -2407,6 +2408,7 @@ public abstract class PackageManager {
* should have the {@link android.Manifest.permission#GET_PACKAGE_SIZE} permission.
*
* @param packageName The name of the package whose size information is to be retrieved
+ * @param userHandle The user whose size information should be retrieved.
* @param observer An observer callback to get notified when the operation
* is complete.
* {@link android.content.pm.IPackageStatsObserver#onGetStatsCompleted(PackageStats, boolean)}
@@ -2417,10 +2419,20 @@ public abstract class PackageManager {
*
* @hide
*/
- public abstract void getPackageSizeInfo(String packageName,
+ public abstract void getPackageSizeInfo(String packageName, int userHandle,
IPackageStatsObserver observer);
/**
+ * Like {@link #getPackageSizeInfo(String, int, IPackageStatsObserver)}, but
+ * returns the size for the calling user.
+ *
+ * @hide
+ */
+ public void getPackageSizeInfo(String packageName, IPackageStatsObserver observer) {
+ getPackageSizeInfo(packageName, UserHandle.myUserId(), observer);
+ }
+
+ /**
* @deprecated This function no longer does anything; it was an old
* approach to managing preferred activities, which has been superceeded
* (and conflicts with) the modern activity-based preferences.
diff --git a/core/java/android/content/pm/PackageStats.java b/core/java/android/content/pm/PackageStats.java
index 1205da7..cb9039b 100644
--- a/core/java/android/content/pm/PackageStats.java
+++ b/core/java/android/content/pm/PackageStats.java
@@ -18,6 +18,7 @@ package android.content.pm;
import android.os.Parcel;
import android.os.Parcelable;
+import android.os.UserHandle;
/**
* implementation of PackageStats associated with a
@@ -27,6 +28,9 @@ public class PackageStats implements Parcelable {
/** Name of the package to which this stats applies. */
public String packageName;
+ /** @hide */
+ public int userHandle;
+
/** Size of the code (e.g., APK) */
public long codeSize;
@@ -78,33 +82,58 @@ public class PackageStats implements Parcelable {
public String toString() {
final StringBuilder sb = new StringBuilder("PackageStats{");
sb.append(Integer.toHexString(System.identityHashCode(this)));
- sb.append(" packageName=");
+ sb.append(" ");
sb.append(packageName);
- sb.append(",codeSize=");
- sb.append(codeSize);
- sb.append(",dataSize=");
- sb.append(dataSize);
- sb.append(",cacheSize=");
- sb.append(cacheSize);
- sb.append(",externalCodeSize=");
- sb.append(externalCodeSize);
- sb.append(",externalDataSize=");
- sb.append(externalDataSize);
- sb.append(",externalCacheSize=");
- sb.append(externalCacheSize);
- sb.append(",externalMediaSize=");
- sb.append(externalMediaSize);
- sb.append(",externalObbSize=");
- sb.append(externalObbSize);
+ if (codeSize != 0) {
+ sb.append(" code=");
+ sb.append(codeSize);
+ }
+ if (dataSize != 0) {
+ sb.append(" data=");
+ sb.append(dataSize);
+ }
+ if (cacheSize != 0) {
+ sb.append(" cache=");
+ sb.append(cacheSize);
+ }
+ if (externalCodeSize != 0) {
+ sb.append(" extCode=");
+ sb.append(externalCodeSize);
+ }
+ if (externalDataSize != 0) {
+ sb.append(" extData=");
+ sb.append(externalDataSize);
+ }
+ if (externalCacheSize != 0) {
+ sb.append(" extCache=");
+ sb.append(externalCacheSize);
+ }
+ if (externalMediaSize != 0) {
+ sb.append(" media=");
+ sb.append(externalMediaSize);
+ }
+ if (externalObbSize != 0) {
+ sb.append(" obb=");
+ sb.append(externalObbSize);
+ }
+ sb.append("}");
return sb.toString();
}
public PackageStats(String pkgName) {
packageName = pkgName;
+ userHandle = UserHandle.myUserId();
+ }
+
+ /** @hide */
+ public PackageStats(String pkgName, int userHandle) {
+ this.packageName = pkgName;
+ this.userHandle = userHandle;
}
public PackageStats(Parcel source) {
packageName = source.readString();
+ userHandle = source.readInt();
codeSize = source.readLong();
dataSize = source.readLong();
cacheSize = source.readLong();
@@ -117,6 +146,7 @@ public class PackageStats implements Parcelable {
public PackageStats(PackageStats pStats) {
packageName = pStats.packageName;
+ userHandle = pStats.userHandle;
codeSize = pStats.codeSize;
dataSize = pStats.dataSize;
cacheSize = pStats.cacheSize;
@@ -133,6 +163,7 @@ public class PackageStats implements Parcelable {
public void writeToParcel(Parcel dest, int parcelableFlags){
dest.writeString(packageName);
+ dest.writeInt(userHandle);
dest.writeLong(codeSize);
dest.writeLong(dataSize);
dest.writeLong(cacheSize);
diff --git a/core/tests/coretests/src/android/content/pm/AppCacheTest.java b/core/tests/coretests/src/android/content/pm/AppCacheTest.java
index 8d53db9..aae55e8 100755
--- a/core/tests/coretests/src/android/content/pm/AppCacheTest.java
+++ b/core/tests/coretests/src/android/content/pm/AppCacheTest.java
@@ -570,7 +570,7 @@ public class AppCacheTest extends AndroidTestCase {
PackageStatsObserver observer = new PackageStatsObserver();
//wait on observer
synchronized(observer) {
- getPm().getPackageSizeInfo(packageName, observer);
+ getPm().getPackageSizeInfo(packageName, UserHandle.myUserId(), observer);
long waitTime = 0;
while((!observer.isDone()) || (waitTime > MAX_WAIT_TIME) ) {
observer.wait(WAIT_TIME_INCR);
diff --git a/services/java/com/android/server/NotificationManagerService.java b/services/java/com/android/server/NotificationManagerService.java
index a565d08..d6fed39 100755
--- a/services/java/com/android/server/NotificationManagerService.java
+++ b/services/java/com/android/server/NotificationManagerService.java
@@ -1272,7 +1272,7 @@ public class NotificationManagerService extends INotificationManager.Stub
void checkCallerIsSystem() {
int uid = Binder.getCallingUid();
- if (uid == Process.SYSTEM_UID || uid == 0) {
+ if (UserHandle.getAppId(uid) == Process.SYSTEM_UID || uid == 0) {
return;
}
throw new SecurityException("Disallowed call for uid " + uid);
@@ -1280,7 +1280,7 @@ public class NotificationManagerService extends INotificationManager.Stub
void checkCallerIsSystemOrSameApp(String pkg) {
int uid = Binder.getCallingUid();
- if (uid == Process.SYSTEM_UID || uid == 0) {
+ if (UserHandle.getAppId(uid) == Process.SYSTEM_UID || uid == 0) {
return;
}
try {
diff --git a/services/java/com/android/server/am/ActiveServices.java b/services/java/com/android/server/am/ActiveServices.java
index d8ccabb..e222936 100644
--- a/services/java/com/android/server/am/ActiveServices.java
+++ b/services/java/com/android/server/am/ActiveServices.java
@@ -1725,21 +1725,53 @@ public class ActiveServices {
ArrayList<ActivityManager.RunningServiceInfo> res
= new ArrayList<ActivityManager.RunningServiceInfo>();
- int userId = UserHandle.getUserId(Binder.getCallingUid());
- if (mServiceMap.getAllServices(userId).size() > 0) {
- Iterator<ServiceRecord> it
- = mServiceMap.getAllServices(userId).iterator();
- while (it.hasNext() && res.size() < maxNum) {
- res.add(makeRunningServiceInfoLocked(it.next()));
- }
- }
+ final int uid = Binder.getCallingUid();
+ final long ident = Binder.clearCallingIdentity();
+ try {
+ if (ActivityManager.checkUidPermission(
+ android.Manifest.permission.INTERACT_ACROSS_USERS_FULL,
+ uid) == PackageManager.PERMISSION_GRANTED) {
+ List<UserInfo> users = mAm.getUserManager().getUsers();
+ for (int ui=0; ui<users.size() && res.size() < maxNum; ui++) {
+ final UserInfo user = users.get(ui);
+ if (mServiceMap.getAllServices(user.id).size() > 0) {
+ Iterator<ServiceRecord> it = mServiceMap.getAllServices(
+ user.id).iterator();
+ while (it.hasNext() && res.size() < maxNum) {
+ res.add(makeRunningServiceInfoLocked(it.next()));
+ }
+ }
+ }
+
+ for (int i=0; i<mRestartingServices.size() && res.size() < maxNum; i++) {
+ ServiceRecord r = mRestartingServices.get(i);
+ ActivityManager.RunningServiceInfo info =
+ makeRunningServiceInfoLocked(r);
+ info.restarting = r.nextRestartTime;
+ res.add(info);
+ }
+ } else {
+ int userId = UserHandle.getUserId(uid);
+ if (mServiceMap.getAllServices(userId).size() > 0) {
+ Iterator<ServiceRecord> it
+ = mServiceMap.getAllServices(userId).iterator();
+ while (it.hasNext() && res.size() < maxNum) {
+ res.add(makeRunningServiceInfoLocked(it.next()));
+ }
+ }
- for (int i=0; i<mRestartingServices.size() && res.size() < maxNum; i++) {
- ServiceRecord r = mRestartingServices.get(i);
- ActivityManager.RunningServiceInfo info =
- makeRunningServiceInfoLocked(r);
- info.restarting = r.nextRestartTime;
- res.add(info);
+ for (int i=0; i<mRestartingServices.size() && res.size() < maxNum; i++) {
+ ServiceRecord r = mRestartingServices.get(i);
+ if (r.userId == userId) {
+ ActivityManager.RunningServiceInfo info =
+ makeRunningServiceInfoLocked(r);
+ info.restarting = r.nextRestartTime;
+ res.add(info);
+ }
+ }
+ }
+ } finally {
+ Binder.restoreCallingIdentity(ident);
}
return res;
diff --git a/services/java/com/android/server/am/ActivityManagerService.java b/services/java/com/android/server/am/ActivityManagerService.java
index 944fd6b..7f2b69f 100644
--- a/services/java/com/android/server/am/ActivityManagerService.java
+++ b/services/java/com/android/server/am/ActivityManagerService.java
@@ -27,7 +27,6 @@ import com.android.server.ProcessMap;
import com.android.server.SystemServer;
import com.android.server.Watchdog;
import com.android.server.am.ActivityStack.ActivityState;
-import com.android.server.pm.UserManagerService;
import com.android.server.wm.WindowManagerService;
import dalvik.system.Zygote;
@@ -52,7 +51,6 @@ import android.app.Instrumentation;
import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
-import android.app.Service;
import android.app.backup.IBackupManager;
import android.content.ActivityNotFoundException;
import android.content.BroadcastReceiver;
@@ -145,7 +143,6 @@ import java.io.PrintWriter;
import java.io.StringWriter;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
-import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
@@ -8391,11 +8388,19 @@ public final class ActivityManagerService extends ActivityManagerNative
// assume our apps are happy - lazy create the list
List<ActivityManager.ProcessErrorStateInfo> errList = null;
+ final boolean allUsers = ActivityManager.checkUidPermission(
+ android.Manifest.permission.INTERACT_ACROSS_USERS_FULL,
+ Binder.getCallingUid()) == PackageManager.PERMISSION_GRANTED;
+ int userId = UserHandle.getUserId(Binder.getCallingUid());
+
synchronized (this) {
// iterate across all processes
for (int i=mLruProcesses.size()-1; i>=0; i--) {
ProcessRecord app = mLruProcesses.get(i);
+ if (!allUsers && app.userId != userId) {
+ continue;
+ }
if ((app.thread != null) && (app.crashing || app.notResponding)) {
// This one's in trouble, so we'll generate a report for it
// crashes are higher priority (in case there's a crash *and* an anr)
@@ -8459,6 +8464,9 @@ public final class ActivityManagerService extends ActivityManagerNative
if (app.persistent) {
outInfo.flags |= ActivityManager.RunningAppProcessInfo.FLAG_PERSISTENT;
}
+ if (app.hasActivities) {
+ outInfo.flags |= ActivityManager.RunningAppProcessInfo.FLAG_HAS_ACTIVITIES;
+ }
outInfo.lastTrimLevel = app.trimMemoryLevel;
int adj = app.curAdj;
outInfo.importance = oomAdjToImportance(adj, outInfo);
@@ -8469,10 +8477,17 @@ public final class ActivityManagerService extends ActivityManagerNative
enforceNotIsolatedCaller("getRunningAppProcesses");
// Lazy instantiation of list
List<ActivityManager.RunningAppProcessInfo> runList = null;
+ final boolean allUsers = ActivityManager.checkUidPermission(
+ android.Manifest.permission.INTERACT_ACROSS_USERS_FULL,
+ Binder.getCallingUid()) == PackageManager.PERMISSION_GRANTED;
+ int userId = UserHandle.getUserId(Binder.getCallingUid());
synchronized (this) {
// Iterate across all processes
for (int i=mLruProcesses.size()-1; i>=0; i--) {
ProcessRecord app = mLruProcesses.get(i);
+ if (!allUsers && app.userId != userId) {
+ continue;
+ }
if ((app.thread != null) && (!app.crashing && !app.notResponding)) {
// Generate process state info for running application
ActivityManager.RunningAppProcessInfo currApp =
diff --git a/services/java/com/android/server/am/ConnectionRecord.java b/services/java/com/android/server/am/ConnectionRecord.java
index 0106114..5b3ff8d 100644
--- a/services/java/com/android/server/am/ConnectionRecord.java
+++ b/services/java/com/android/server/am/ConnectionRecord.java
@@ -18,6 +18,7 @@ package com.android.server.am;
import android.app.IServiceConnection;
import android.app.PendingIntent;
+import android.content.Context;
import java.io.PrintWriter;
@@ -62,6 +63,33 @@ class ConnectionRecord {
sb.append("ConnectionRecord{");
sb.append(Integer.toHexString(System.identityHashCode(this)));
sb.append(' ');
+ if ((flags&Context.BIND_AUTO_CREATE) != 0) {
+ sb.append("CR ");
+ }
+ if ((flags&Context.BIND_DEBUG_UNBIND) != 0) {
+ sb.append("DBG ");
+ }
+ if ((flags&Context.BIND_NOT_FOREGROUND) != 0) {
+ sb.append("NOTFG ");
+ }
+ if ((flags&Context.BIND_ABOVE_CLIENT) != 0) {
+ sb.append("ABCLT ");
+ }
+ if ((flags&Context.BIND_ALLOW_OOM_MANAGEMENT) != 0) {
+ sb.append("OOM ");
+ }
+ if ((flags&Context.BIND_WAIVE_PRIORITY) != 0) {
+ sb.append("WPRI ");
+ }
+ if ((flags&Context.BIND_IMPORTANT) != 0) {
+ sb.append("IMP ");
+ }
+ if ((flags&Context.BIND_ADJUST_WITH_ACTIVITY) != 0) {
+ sb.append("ACT ");
+ }
+ if ((flags&Context.BIND_NOT_VISIBLE) != 0) {
+ sb.append("NOTVIS ");
+ }
if (serviceDead) {
sb.append("DEAD ");
}
diff --git a/services/java/com/android/server/am/IntentBindRecord.java b/services/java/com/android/server/am/IntentBindRecord.java
index c94f714..0a92964 100644
--- a/services/java/com/android/server/am/IntentBindRecord.java
+++ b/services/java/com/android/server/am/IntentBindRecord.java
@@ -16,6 +16,7 @@
package com.android.server.am;
+import android.content.Context;
import android.content.Intent;
import android.os.IBinder;
@@ -78,6 +79,20 @@ class IntentBindRecord {
intent = _intent;
}
+ int collectFlags() {
+ int flags = 0;
+ if (apps.size() > 0) {
+ for (AppBindRecord app : apps.values()) {
+ if (app.connections.size() > 0) {
+ for (ConnectionRecord conn : app.connections) {
+ flags |= conn.flags;
+ }
+ }
+ }
+ }
+ return flags;
+ }
+
public String toString() {
if (stringName != null) {
return stringName;
@@ -86,6 +101,9 @@ class IntentBindRecord {
sb.append("IntentBindRecord{");
sb.append(Integer.toHexString(System.identityHashCode(this)));
sb.append(' ');
+ if ((collectFlags()&Context.BIND_AUTO_CREATE) != 0) {
+ sb.append("CR ");
+ }
sb.append(service.shortName);
sb.append(':');
if (intent != null) {
diff --git a/services/java/com/android/server/am/ServiceRecord.java b/services/java/com/android/server/am/ServiceRecord.java
index 41386e4..5d60b9c 100644
--- a/services/java/com/android/server/am/ServiceRecord.java
+++ b/services/java/com/android/server/am/ServiceRecord.java
@@ -23,6 +23,7 @@ import android.app.INotificationManager;
import android.app.Notification;
import android.app.NotificationManager;
import android.content.ComponentName;
+import android.content.Context;
import android.content.Intent;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
@@ -260,6 +261,9 @@ class ServiceRecord extends Binder {
IntentBindRecord b = it.next();
pw.print(prefix); pw.print("* IntentBindRecord{");
pw.print(Integer.toHexString(System.identityHashCode(b)));
+ if ((b.collectFlags()&Context.BIND_AUTO_CREATE) != 0) {
+ pw.append(" CREATE");
+ }
pw.println("}:");
b.dumpInService(pw, prefix + " ");
}
diff --git a/services/java/com/android/server/pm/Installer.java b/services/java/com/android/server/pm/Installer.java
index 48004bb..d4fe3fb 100644
--- a/services/java/com/android/server/pm/Installer.java
+++ b/services/java/com/android/server/pm/Installer.java
@@ -338,12 +338,14 @@ class Installer {
return execute(builder.toString());
}
- public int getSizeInfo(String pkgName, String apkPath, String fwdLockApkPath,
+ public int getSizeInfo(String pkgName, int persona, String apkPath, String fwdLockApkPath,
String asecPath, PackageStats pStats) {
StringBuilder builder = new StringBuilder("getsize");
builder.append(' ');
builder.append(pkgName);
builder.append(' ');
+ builder.append(persona);
+ builder.append(' ');
builder.append(apkPath);
builder.append(' ');
builder.append(fwdLockApkPath != null ? fwdLockApkPath : "!");
diff --git a/services/java/com/android/server/pm/PackageManagerService.java b/services/java/com/android/server/pm/PackageManagerService.java
index be82b34..a76f854 100644
--- a/services/java/com/android/server/pm/PackageManagerService.java
+++ b/services/java/com/android/server/pm/PackageManagerService.java
@@ -5743,7 +5743,7 @@ public class PackageManagerService extends IPackageManager.Stub {
@Override
void handleStartCopy() throws RemoteException {
synchronized (mInstallLock) {
- mSuccess = getPackageSizeInfoLI(mStats.packageName, mStats);
+ mSuccess = getPackageSizeInfoLI(mStats.packageName, mStats.userHandle, mStats);
}
final boolean mounted;
@@ -8036,12 +8036,12 @@ public class PackageManagerService extends IPackageManager.Stub {
return true;
}
- public void getPackageSizeInfo(final String packageName,
+ public void getPackageSizeInfo(final String packageName, int userHandle,
final IPackageStatsObserver observer) {
mContext.enforceCallingOrSelfPermission(
android.Manifest.permission.GET_PACKAGE_SIZE, null);
- PackageStats stats = new PackageStats(packageName);
+ PackageStats stats = new PackageStats(packageName, userHandle);
/*
* Queue up an async operation since the package measurement may take a
@@ -8052,7 +8052,8 @@ public class PackageManagerService extends IPackageManager.Stub {
mHandler.sendMessage(msg);
}
- private boolean getPackageSizeInfoLI(String packageName, PackageStats pStats) {
+ private boolean getPackageSizeInfoLI(String packageName, int userHandle,
+ PackageStats pStats) {
if (packageName == null) {
Slog.w(TAG, "Attempt to get size of null packageName.");
return false;
@@ -8089,7 +8090,7 @@ public class PackageManagerService extends IPackageManager.Stub {
publicSrcDir = applicationInfo.publicSourceDir;
}
}
- int res = mInstaller.getSizeInfo(packageName, p.mPath, publicSrcDir,
+ int res = mInstaller.getSizeInfo(packageName, userHandle, p.mPath, publicSrcDir,
asecPath, pStats);
if (res < 0) {
return false;
diff --git a/test-runner/src/android/test/mock/MockPackageManager.java b/test-runner/src/android/test/mock/MockPackageManager.java
index a85c8b5..0fb51f0 100644
--- a/test-runner/src/android/test/mock/MockPackageManager.java
+++ b/test-runner/src/android/test/mock/MockPackageManager.java
@@ -480,7 +480,8 @@ public class MockPackageManager extends PackageManager {
* @hide - to match hiding in superclass
*/
@Override
- public void getPackageSizeInfo(String packageName, IPackageStatsObserver observer) {
+ public void getPackageSizeInfo(String packageName, int userHandle,
+ IPackageStatsObserver observer) {
throw new UnsupportedOperationException();
}