summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
Diffstat (limited to 'services')
-rw-r--r--services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java6
-rw-r--r--services/core/java/com/android/server/ConnectivityService.java12
-rwxr-xr-xservices/core/java/com/android/server/am/ActivityManagerService.java211
-rwxr-xr-xservices/core/java/com/android/server/am/ActivityRecord.java9
-rwxr-xr-xservices/core/java/com/android/server/am/ActivityStack.java4
-rw-r--r--services/core/java/com/android/server/am/LockTaskNotify.java7
-rw-r--r--services/core/java/com/android/server/am/LockToAppRequestDialog.java3
-rw-r--r--services/core/java/com/android/server/am/TaskRecord.java67
-rw-r--r--services/core/java/com/android/server/connectivity/NetworkMonitor.java3
-rw-r--r--services/core/java/com/android/server/pm/PackageInstallerService.java25
-rw-r--r--services/core/java/com/android/server/power/ShutdownThread.java10
-rw-r--r--services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java47
12 files changed, 291 insertions, 113 deletions
diff --git a/services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java b/services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java
index c6aa30b..f1e99fd 100644
--- a/services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java
+++ b/services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java
@@ -1539,7 +1539,7 @@ class AppWidgetServiceImpl extends IAppWidgetService.Stub implements WidgetBacku
widget.views = views;
}
- scheduleNotifyUpdateAppWidgetLocked(widget);
+ scheduleNotifyUpdateAppWidgetLocked(widget, views);
}
}
@@ -1611,7 +1611,7 @@ class AppWidgetServiceImpl extends IAppWidgetService.Stub implements WidgetBacku
}
}
- private void scheduleNotifyUpdateAppWidgetLocked(Widget widget) {
+ private void scheduleNotifyUpdateAppWidgetLocked(Widget widget, RemoteViews updateViews) {
if (widget == null || widget.provider == null || widget.provider.zombie
|| widget.host.callbacks == null || widget.host.zombie) {
return;
@@ -1620,7 +1620,7 @@ class AppWidgetServiceImpl extends IAppWidgetService.Stub implements WidgetBacku
SomeArgs args = SomeArgs.obtain();
args.arg1 = widget.host;
args.arg2 = widget.host.callbacks;
- args.arg3 = widget.views;
+ args.arg3 = updateViews;
args.argi1 = widget.appWidgetId;
mCallbackHandler.obtainMessage(
diff --git a/services/core/java/com/android/server/ConnectivityService.java b/services/core/java/com/android/server/ConnectivityService.java
index 96f8324..54afe99 100644
--- a/services/core/java/com/android/server/ConnectivityService.java
+++ b/services/core/java/com/android/server/ConnectivityService.java
@@ -2850,11 +2850,13 @@ public class ConnectivityService extends IConnectivityManager.Stub {
enforceConnectivityInternalPermission();
if (TextUtils.isEmpty(iface)) return ConnectivityManager.TYPE_NONE;
- for (NetworkStateTracker tracker : mNetTrackers) {
- if (tracker != null) {
- LinkProperties lp = tracker.getLinkProperties();
- if (lp != null && iface.equals(lp.getInterfaceName())) {
- return tracker.getNetworkInfo().getType();
+
+ synchronized(mNetworkForNetId) {
+ for (int i = 0; i < mNetworkForNetId.size(); i++) {
+ NetworkAgentInfo nai = mNetworkForNetId.valueAt(i);
+ LinkProperties lp = nai.linkProperties;
+ if (lp != null && iface.equals(lp.getInterfaceName()) && nai.networkInfo != null) {
+ return nai.networkInfo.getType();
}
}
}
diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java
index 174ec38..f36f25f 100755
--- a/services/core/java/com/android/server/am/ActivityManagerService.java
+++ b/services/core/java/com/android/server/am/ActivityManagerService.java
@@ -40,6 +40,9 @@ import android.app.admin.DevicePolicyManager;
import android.app.usage.UsageEvents;
import android.app.usage.UsageStatsManagerInternal;
import android.appwidget.AppWidgetManager;
+import android.content.res.Resources;
+import android.graphics.Bitmap;
+import android.graphics.Point;
import android.graphics.Rect;
import android.os.BatteryStats;
import android.os.PersistableBundle;
@@ -261,6 +264,7 @@ public final class ActivityManagerService extends ActivityManagerNative
static final boolean DEBUG_VISBILITY = localLOGV || false;
static final boolean DEBUG_PSS = localLOGV || false;
static final boolean DEBUG_LOCKSCREEN = localLOGV || false;
+ static final boolean DEBUG_RECENTS = localLOGV || false;
static final boolean VALIDATE_TOKENS = false;
static final boolean SHOW_ACTIVITY_START_TIME = true;
@@ -410,6 +414,21 @@ public final class ActivityManagerService extends ActivityManagerNative
ArrayList<TaskRecord> mRecentTasks;
ArraySet<TaskRecord> mTmpRecents = new ArraySet<TaskRecord>();
+ /**
+ * For addAppTask: cached of the last activity component that was added.
+ */
+ ComponentName mLastAddedTaskComponent;
+
+ /**
+ * For addAppTask: cached of the last activity uid that was added.
+ */
+ int mLastAddedTaskUid;
+
+ /**
+ * For addAppTask: cached of the last ActivityInfo that was added.
+ */
+ ActivityInfo mLastAddedTaskActivity;
+
public class PendingAssistExtras extends Binder implements Runnable {
public final ActivityRecord activity;
public boolean haveResult = false;
@@ -1181,6 +1200,9 @@ public final class ActivityManagerService extends ActivityManagerNative
/** Flag whether the device has a recents UI */
final boolean mHasRecents;
+ final int mThumbnailWidth;
+ final int mThumbnailHeight;
+
final ServiceThread mHandlerThread;
final MainHandler mHandler;
@@ -2230,8 +2252,10 @@ public final class ActivityManagerService extends ActivityManagerNative
mConfigurationSeq = mConfiguration.seq = 1;
mProcessCpuTracker.init();
- mHasRecents = mContext.getResources().getBoolean(
- com.android.internal.R.bool.config_hasRecents);
+ final Resources res = mContext.getResources();
+ mHasRecents = res.getBoolean(com.android.internal.R.bool.config_hasRecents);
+ mThumbnailWidth = res.getDimensionPixelSize(com.android.internal.R.dimen.thumbnail_width);
+ mThumbnailHeight = res.getDimensionPixelSize(com.android.internal.R.dimen.thumbnail_height);
mCompatModePackages = new CompatModePackages(this, systemDir, mHandler);
mIntentFirewall = new IntentFirewall(new IntentFirewallInterface(), mHandler);
@@ -3482,7 +3506,8 @@ public final class ActivityManagerService extends ActivityManagerNative
try {
int ret = mStackSupervisor.startActivityMayWait(null, targetUid, targetPackage, intent,
resolvedType, null, null, resultTo, resultWho, requestCode, startFlags,
- null, null, null, null, options, UserHandle.getUserId(targetUid), null);
+ null, null, null, null, options, UserHandle.getUserId(sourceRecord.app.uid),
+ null);
return ret;
} catch (SecurityException e) {
// XXX need to figure out how to propagate to original app.
@@ -3782,7 +3807,7 @@ public final class ActivityManagerService extends ActivityManagerNative
}
final void addRecentTaskLocked(TaskRecord task) {
- int N = mRecentTasks.size();
+ final int N = mRecentTasks.size();
// Quick case: check if the top-most recent task is the same.
if (N > 0 && mRecentTasks.get(0) == task) {
return;
@@ -3791,10 +3816,25 @@ public final class ActivityManagerService extends ActivityManagerNative
if (task.voiceSession != null) {
return;
}
- // Remove any existing entries that are the same kind of task.
+
+ trimRecentsForTask(task, true);
+
+ if (N >= MAX_RECENT_TASKS) {
+ final TaskRecord tr = mRecentTasks.remove(N - 1);
+ tr.disposeThumbnail();
+ tr.closeRecentsChain();
+ }
+ mRecentTasks.add(0, task);
+ }
+
+ /**
+ * If needed, remove oldest existing entries in recents that are for the same kind
+ * of task as the given one.
+ */
+ int trimRecentsForTask(TaskRecord task, boolean doTrim) {
+ int N = mRecentTasks.size();
final Intent intent = task.intent;
final boolean document = intent != null && intent.isDocument();
- final ComponentName comp = intent.getComponent();
int maxRecents = task.maxRecents - 1;
for (int i=0; i<N; i++) {
@@ -3826,6 +3866,12 @@ public final class ActivityManagerService extends ActivityManagerNative
}
}
+ if (!doTrim) {
+ // If the caller is not actually asking for a trim, just tell them we reached
+ // a point where the trim would happen.
+ return i;
+ }
+
// Either task and tr are the same or, their affinities match or their intents match
// and neither of them is a document, or they are documents using the same activity
// and their maxRecents has been reached.
@@ -3843,12 +3889,8 @@ public final class ActivityManagerService extends ActivityManagerNative
}
notifyTaskPersisterLocked(tr, false);
}
- if (N >= MAX_RECENT_TASKS) {
- final TaskRecord tr = mRecentTasks.remove(N - 1);
- tr.disposeThumbnail();
- tr.closeRecentsChain();
- }
- mRecentTasks.add(0, task);
+
+ return -1;
}
@Override
@@ -7640,7 +7682,10 @@ public final class ActivityManagerService extends ActivityManagerNative
for (int i=0; i<N && maxNum > 0; i++) {
TaskRecord tr = mRecentTasks.get(i);
// Only add calling user or related users recent tasks
- if (!includedUsers.contains(Integer.valueOf(tr.userId))) continue;
+ if (!includedUsers.contains(Integer.valueOf(tr.userId))) {
+ if (DEBUG_RECENTS) Slog.d(TAG, "Skipping, not user: " + tr);
+ continue;
+ }
// Return the entry if desired by the caller. We always return
// the first entry, because callers always expect this to be the
@@ -7657,11 +7702,14 @@ public final class ActivityManagerService extends ActivityManagerNative
// If the caller doesn't have the GET_TASKS permission, then only
// allow them to see a small subset of tasks -- their own and home.
if (!tr.isHomeTask() && tr.creatorUid != callingUid) {
+ if (DEBUG_RECENTS) Slog.d(TAG, "Skipping, not allowed: " + tr);
continue;
}
}
if (tr.autoRemoveRecents && tr.getTopActivity() == null) {
// Don't include auto remove tasks that are finished or finishing.
+ if (DEBUG_RECENTS) Slog.d(TAG, "Skipping, auto-remove without activity: "
+ + tr);
continue;
}
@@ -7676,11 +7724,15 @@ public final class ActivityManagerService extends ActivityManagerNative
if (rti.origActivity != null) {
if (pm.getActivityInfo(rti.origActivity, 0, userId)
== null) {
+ if (DEBUG_RECENTS) Slog.d(TAG, "Skipping, unavail orig act: "
+ + tr);
continue;
}
} else if (rti.baseIntent != null) {
if (pm.queryIntentActivities(rti.baseIntent,
null, 0, userId) == null) {
+ if (DEBUG_RECENTS) Slog.d(TAG, "Skipping, unavail intent: "
+ + tr);
continue;
}
}
@@ -7722,6 +7774,97 @@ public final class ActivityManagerService extends ActivityManagerNative
}
@Override
+ public int addAppTask(IBinder activityToken, Intent intent,
+ ActivityManager.TaskDescription description, Bitmap thumbnail) throws RemoteException {
+ final int callingUid = Binder.getCallingUid();
+ final long callingIdent = Binder.clearCallingIdentity();
+
+ try {
+ synchronized (this) {
+ ActivityRecord r = ActivityRecord.isInStackLocked(activityToken);
+ if (r == null) {
+ throw new IllegalArgumentException("Activity does not exist; token="
+ + activityToken);
+ }
+ ComponentName comp = intent.getComponent();
+ if (comp == null) {
+ throw new IllegalArgumentException("Intent " + intent
+ + " must specify explicit component");
+ }
+ if (thumbnail.getWidth() != mThumbnailWidth
+ || thumbnail.getHeight() != mThumbnailHeight) {
+ throw new IllegalArgumentException("Bad thumbnail size: got "
+ + thumbnail.getWidth() + "x" + thumbnail.getHeight() + ", require "
+ + mThumbnailWidth + "x" + mThumbnailHeight);
+ }
+ if (intent.getSelector() != null) {
+ intent.setSelector(null);
+ }
+ if (intent.getSourceBounds() != null) {
+ intent.setSourceBounds(null);
+ }
+ if ((intent.getFlags()&Intent.FLAG_ACTIVITY_NEW_DOCUMENT) != 0) {
+ if ((intent.getFlags()&Intent.FLAG_ACTIVITY_RETAIN_IN_RECENTS) == 0) {
+ // The caller has added this as an auto-remove task... that makes no
+ // sense, so turn off auto-remove.
+ intent.addFlags(Intent.FLAG_ACTIVITY_RETAIN_IN_RECENTS);
+ }
+ } else if ((intent.getFlags()&Intent.FLAG_ACTIVITY_NEW_TASK) != 0) {
+ // Must be a new task.
+ intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+ }
+ if (!comp.equals(mLastAddedTaskComponent) || callingUid != mLastAddedTaskUid) {
+ mLastAddedTaskActivity = null;
+ }
+ ActivityInfo ainfo = mLastAddedTaskActivity;
+ if (ainfo == null) {
+ ainfo = mLastAddedTaskActivity = AppGlobals.getPackageManager().getActivityInfo(
+ comp, 0, UserHandle.getUserId(callingUid));
+ if (ainfo.applicationInfo.uid != callingUid) {
+ throw new SecurityException(
+ "Can't add task for another application: target uid="
+ + ainfo.applicationInfo.uid + ", calling uid=" + callingUid);
+ }
+ }
+
+ TaskRecord task = new TaskRecord(this, mStackSupervisor.getNextTaskId(), ainfo,
+ intent, description);
+
+ int trimIdx = trimRecentsForTask(task, false);
+ if (trimIdx >= 0) {
+ // If this would have caused a trim, then we'll abort because that
+ // means it would be added at the end of the list but then just removed.
+ return -1;
+ }
+
+ final int N = mRecentTasks.size();
+ if (N >= (MAX_RECENT_TASKS-1)) {
+ final TaskRecord tr = mRecentTasks.remove(N - 1);
+ tr.disposeThumbnail();
+ tr.closeRecentsChain();
+ }
+
+ mRecentTasks.add(task);
+ r.task.stack.addTask(task, false, false);
+
+ task.setLastThumbnail(thumbnail);
+ task.freeLastThumbnail();
+
+ return task.taskId;
+ }
+ } finally {
+ Binder.restoreCallingIdentity(callingIdent);
+ }
+ }
+
+ @Override
+ public Point getAppTaskThumbnailSize() {
+ synchronized (this) {
+ return new Point(mThumbnailWidth, mThumbnailHeight);
+ }
+ }
+
+ @Override
public void setTaskDescription(IBinder token, ActivityManager.TaskDescription td) {
synchronized (this) {
ActivityRecord r = ActivityRecord.isInStackLocked(token);
@@ -18057,14 +18200,16 @@ public final class ActivityManagerService extends ActivityManagerNative
mCallingUid = callingUid;
}
- @Override
- public void finishAndRemoveTask() {
- // Ensure that we are called from the same process that created this AppTask
+ private void checkCaller() {
if (mCallingUid != Binder.getCallingUid()) {
- Slog.w(TAG, "finishAndRemoveTask: caller " + mCallingUid
+ throw new SecurityException("Caller " + mCallingUid
+ " does not match caller of getAppTasks(): " + Binder.getCallingUid());
- return;
}
+ }
+
+ @Override
+ public void finishAndRemoveTask() {
+ checkCaller();
synchronized (ActivityManagerService.this) {
long origId = Binder.clearCallingIdentity();
@@ -18086,12 +18231,7 @@ public final class ActivityManagerService extends ActivityManagerNative
@Override
public ActivityManager.RecentTaskInfo getTaskInfo() {
- // Ensure that we are called from the same process that created this AppTask
- if (mCallingUid != Binder.getCallingUid()) {
- Slog.w(TAG, "finishAndRemoveTask: caller " + mCallingUid
- + " does not match caller of getAppTasks(): " + Binder.getCallingUid());
- return null;
- }
+ checkCaller();
synchronized (ActivityManagerService.this) {
long origId = Binder.clearCallingIdentity();
@@ -18106,5 +18246,28 @@ public final class ActivityManagerService extends ActivityManagerNative
return null;
}
}
+
+ @Override
+ public void setExcludeFromRecents(boolean exclude) {
+ checkCaller();
+
+ synchronized (ActivityManagerService.this) {
+ long origId = Binder.clearCallingIdentity();
+ try {
+ TaskRecord tr = recentTaskForIdLocked(mTaskId);
+ if (tr != null) {
+ Intent intent = tr.getBaseIntent();
+ if (exclude) {
+ intent.addFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
+ } else {
+ intent.setFlags(intent.getFlags()
+ & ~Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
+ }
+ }
+ } finally {
+ Binder.restoreCallingIdentity(origId);
+ }
+ }
+ }
}
}
diff --git a/services/core/java/com/android/server/am/ActivityRecord.java b/services/core/java/com/android/server/am/ActivityRecord.java
index abacb2d..24b7cb3 100755
--- a/services/core/java/com/android/server/am/ActivityRecord.java
+++ b/services/core/java/com/android/server/am/ActivityRecord.java
@@ -1054,8 +1054,8 @@ final class ActivityRecord {
return null;
}
- private static String createImageFilename(ActivityRecord r, int taskId) {
- return String.valueOf(taskId) + ACTIVITY_ICON_SUFFIX + r.createTime +
+ private static String createImageFilename(long createTime, int taskId) {
+ return String.valueOf(taskId) + ACTIVITY_ICON_SUFFIX + createTime +
TaskPersister.IMAGE_EXTENSION;
}
@@ -1072,7 +1072,7 @@ final class ActivityRecord {
out.attribute(null, ATTR_USERID, String.valueOf(userId));
if (taskDescription != null) {
- task.saveTaskDescription(taskDescription, createImageFilename(this, task.taskId),
+ task.saveTaskDescription(taskDescription, createImageFilename(createTime, task.taskId),
out);
}
@@ -1165,7 +1165,8 @@ final class ActivityRecord {
r.persistentState = persistentState;
if (createTime >= 0) {
- taskDescription.setIcon(TaskPersister.restoreImage(createImageFilename(r, taskId)));
+ taskDescription.setIcon(TaskPersister.restoreImage(createImageFilename(createTime,
+ taskId)));
}
r.taskDescription = taskDescription;
r.createTime = createTime;
diff --git a/services/core/java/com/android/server/am/ActivityStack.java b/services/core/java/com/android/server/am/ActivityStack.java
index e309a03..5ad84d4 100755
--- a/services/core/java/com/android/server/am/ActivityStack.java
+++ b/services/core/java/com/android/server/am/ActivityStack.java
@@ -355,8 +355,8 @@ final class ActivityStack {
mCurrentUser = mService.mCurrentUserId;
// Get the activity screenshot thumbnail dimensions
Resources res = mService.mContext.getResources();
- mThumbnailWidth = res.getDimensionPixelSize(com.android.internal.R.dimen.thumbnail_width);
- mThumbnailHeight = res.getDimensionPixelSize(com.android.internal.R.dimen.thumbnail_height);
+ mThumbnailWidth = mService.mThumbnailWidth;
+ mThumbnailHeight = mService.mThumbnailHeight;
}
/**
diff --git a/services/core/java/com/android/server/am/LockTaskNotify.java b/services/core/java/com/android/server/am/LockTaskNotify.java
index cf65243..5768ddb 100644
--- a/services/core/java/com/android/server/am/LockTaskNotify.java
+++ b/services/core/java/com/android/server/am/LockTaskNotify.java
@@ -34,6 +34,7 @@ public class LockTaskNotify {
private final Context mContext;
private final H mHandler;
private AccessibilityManager mAccessibilityManager;
+ private Toast mLastToast;
public LockTaskNotify(Context context) {
mContext = context;
@@ -52,7 +53,11 @@ public class LockTaskNotify {
if (!isLocked && mAccessibilityManager.isEnabled()) {
text = mContext.getString(R.string.lock_to_app_toast_accessible);
}
- Toast.makeText(mContext, text, Toast.LENGTH_LONG).show();
+ if (mLastToast != null) {
+ mLastToast.cancel();
+ }
+ mLastToast = Toast.makeText(mContext, text, Toast.LENGTH_LONG);
+ mLastToast.show();
}
public void show(boolean starting) {
diff --git a/services/core/java/com/android/server/am/LockToAppRequestDialog.java b/services/core/java/com/android/server/am/LockToAppRequestDialog.java
index 57732fa..a1eb31e 100644
--- a/services/core/java/com/android/server/am/LockToAppRequestDialog.java
+++ b/services/core/java/com/android/server/am/LockToAppRequestDialog.java
@@ -108,8 +108,7 @@ public class LockToAppRequestDialog implements OnClickListener {
if (unlockStringId != 0) {
String unlockString = mContext.getString(unlockStringId);
mCheckbox = (CheckBox) mDialog.findViewById(R.id.lock_to_app_checkbox);
- mCheckbox.setText(mContext.getString(R.string.lock_to_app_use_screen_lock,
- unlockString));
+ mCheckbox.setText(unlockString);
// Remember state.
try {
diff --git a/services/core/java/com/android/server/am/TaskRecord.java b/services/core/java/com/android/server/am/TaskRecord.java
index ccca657..2a8c6fb 100644
--- a/services/core/java/com/android/server/am/TaskRecord.java
+++ b/services/core/java/com/android/server/am/TaskRecord.java
@@ -167,6 +167,34 @@ final class TaskRecord {
setIntent(_intent, info);
}
+ TaskRecord(ActivityManagerService service, int _taskId, ActivityInfo info, Intent _intent,
+ ActivityManager.TaskDescription _taskDescription) {
+ mService = service;
+ mFilename = String.valueOf(_taskId) + TASK_THUMBNAIL_SUFFIX +
+ TaskPersister.IMAGE_EXTENSION;
+ mLastThumbnailFile = new File(TaskPersister.sImagesDir, mFilename);
+ taskId = _taskId;
+ mAffiliatedTaskId = _taskId;
+ voiceSession = null;
+ voiceInteractor = null;
+ mActivities = new ArrayList<ActivityRecord>();
+ setIntent(_intent, info);
+
+ taskType = ActivityRecord.APPLICATION_ACTIVITY_TYPE;
+ isPersistable = true;
+ mCallingUid = info.applicationInfo.uid;
+ mCallingPackage = info.packageName;
+ // Clamp to [1, 100].
+ maxRecents = Math.min(Math.max(info.maxRecents, 1), 100);
+
+ taskType = APPLICATION_ACTIVITY_TYPE;
+ mTaskToReturnTo = HOME_ACTIVITY_TYPE;
+ userId = UserHandle.getUserId(info.applicationInfo.uid);
+ lastTaskDescription = _taskDescription;
+ mCallingUid = info.applicationInfo.uid;
+ mCallingPackage = info.packageName;
+ }
+
TaskRecord(ActivityManagerService service, int _taskId, Intent _intent, Intent _affinityIntent,
String _affinity, ComponentName _realActivity, ComponentName _origActivity,
boolean _rootWasReset, boolean _autoRemoveRecents, boolean _askedCompatMode,
@@ -764,8 +792,13 @@ final class TaskRecord {
return true;
}
+ private static String createLastTaskDescriptionIconFilename(int taskId, long lastActiveTime) {
+ return String.valueOf(taskId) + LAST_ACTIVITY_ICON_SUFFIX + lastActiveTime +
+ TaskPersister.IMAGE_EXTENSION;
+ }
+
void saveToXml(XmlSerializer out) throws IOException, XmlPullParserException {
- Slog.i(TAG, "Saving task=" + this);
+ if (ActivityManagerService.DEBUG_RECENTS) Slog.i(TAG, "Saving task=" + this);
out.attribute(null, ATTR_TASKID, String.valueOf(taskId));
if (realActivity != null) {
@@ -790,8 +823,8 @@ final class TaskRecord {
out.attribute(null, ATTR_LASTDESCRIPTION, lastDescription.toString());
}
if (lastTaskDescription != null) {
- saveTaskDescription(lastTaskDescription, String.valueOf(taskId) +
- LAST_ACTIVITY_ICON_SUFFIX + lastActiveTime, out);
+ saveTaskDescription(lastTaskDescription, createLastTaskDescriptionIconFilename(taskId,
+ lastActiveTime), out);
}
out.attribute(null, ATTR_TASK_AFFILIATION_COLOR, String.valueOf(mAffiliatedTaskColor));
out.attribute(null, ATTR_TASK_AFFILIATION, String.valueOf(mAffiliatedTaskId));
@@ -933,8 +966,8 @@ final class TaskRecord {
}
if (lastActiveTime >= 0) {
- taskDescription.setIcon(TaskPersister.restoreImage(String.valueOf(taskId) +
- LAST_ACTIVITY_ICON_SUFFIX + lastActiveTime + TaskPersister.IMAGE_EXTENSION));
+ taskDescription.setIcon(TaskPersister.restoreImage(
+ createLastTaskDescriptionIconFilename(taskId, lastActiveTime)));
}
final TaskRecord task = new TaskRecord(stackSupervisor.mService, taskId, intent,
@@ -948,18 +981,15 @@ final class TaskRecord {
activities.get(activityNdx).task = task;
}
- Slog.i(TAG, "Restored task=" + task);
+ if (ActivityManagerService.DEBUG_RECENTS) Slog.d(TAG, "Restored task=" + task);
return task;
}
void dump(PrintWriter pw, String prefix) {
- if (rootWasReset || userId != 0 || numFullscreen != 0) {
- pw.print(prefix); pw.print(" rootWasReset="); pw.print(rootWasReset);
- pw.print(" userId="); pw.print(userId);
- pw.print(" taskType="); pw.print(taskType);
- pw.print(" numFullscreen="); pw.print(numFullscreen);
- pw.print(" mTaskToReturnTo="); pw.println(mTaskToReturnTo);
- }
+ pw.print(prefix); pw.print("userId="); pw.print(userId);
+ pw.print(" creatorUid="); pw.print(creatorUid);
+ pw.print(" mCallingUid="); pw.print(mCallingUid);
+ pw.print(" mCallingPackage="); pw.println(mCallingPackage);
if (affinity != null) {
pw.print(prefix); pw.print("affinity="); pw.println(affinity);
}
@@ -991,6 +1021,17 @@ final class TaskRecord {
pw.print(prefix); pw.print("realActivity=");
pw.println(realActivity.flattenToShortString());
}
+ if (autoRemoveRecents || taskType != 0 || mTaskToReturnTo != 0 || numFullscreen != 0) {
+ pw.print(prefix); pw.print("autoRemoveRecents="); pw.print(autoRemoveRecents);
+ pw.print(" numFullscreen="); pw.print(numFullscreen);
+ pw.print(" taskType="); pw.print(taskType);
+ pw.print(" mTaskToReturnTo="); pw.println(mTaskToReturnTo);
+ }
+ if (rootWasReset || mNeverRelinquishIdentity || mReuseTask) {
+ pw.print(prefix); pw.print("rootWasReset="); pw.print(rootWasReset);
+ pw.print(" mNeverRelinquishIdentity="); pw.print(mNeverRelinquishIdentity);
+ pw.print(" mReuseTask="); pw.println(mReuseTask);
+ }
pw.print(prefix); pw.print("Activities="); pw.println(mActivities);
if (!askedCompatMode) {
pw.print(prefix); pw.print("askedCompatMode="); pw.println(askedCompatMode);
diff --git a/services/core/java/com/android/server/connectivity/NetworkMonitor.java b/services/core/java/com/android/server/connectivity/NetworkMonitor.java
index b09298c..ddd0865 100644
--- a/services/core/java/com/android/server/connectivity/NetworkMonitor.java
+++ b/services/core/java/com/android/server/connectivity/NetworkMonitor.java
@@ -769,6 +769,7 @@ public class NetworkMonitor extends StateMachine {
latencyBroadcast.putExtra(EXTRA_IS_CAPTIVE_PORTAL, isCaptivePortal);
latencyBroadcast.putExtra(EXTRA_RESPONSE_TIMESTAMP_MS, responseTimestampMs);
}
- mContext.sendBroadcast(latencyBroadcast, PERMISSION_ACCESS_NETWORK_CONDITIONS);
+ mContext.sendBroadcastAsUser(latencyBroadcast, UserHandle.CURRENT,
+ PERMISSION_ACCESS_NETWORK_CONDITIONS);
}
}
diff --git a/services/core/java/com/android/server/pm/PackageInstallerService.java b/services/core/java/com/android/server/pm/PackageInstallerService.java
index 03cb2e9..5e802de 100644
--- a/services/core/java/com/android/server/pm/PackageInstallerService.java
+++ b/services/core/java/com/android/server/pm/PackageInstallerService.java
@@ -485,17 +485,22 @@ public class PackageInstallerService extends IPackageInstaller.Stub {
if (params.mode == SessionParams.MODE_FULL_INSTALL) {
// Brand new install, use best resolved location. This also verifies
// that target has enough free space for the install.
- final int resolved = PackageHelper.resolveInstallLocation(mContext,
- params.appPackageName, params.installLocation, params.sizeBytes,
- params.installFlags);
- if (resolved == PackageHelper.RECOMMEND_INSTALL_INTERNAL) {
- stageInternal = true;
- } else if (resolved == PackageHelper.RECOMMEND_INSTALL_EXTERNAL) {
- stageInternal = false;
- } else {
- throw new IOException("No storage with enough free space; res=" + resolved);
+ final long ident = Binder.clearCallingIdentity();
+ try {
+ final int resolved = PackageHelper.resolveInstallLocation(mContext,
+ params.appPackageName, params.installLocation, params.sizeBytes,
+ params.installFlags);
+
+ if (resolved == PackageHelper.RECOMMEND_INSTALL_INTERNAL) {
+ stageInternal = true;
+ } else if (resolved == PackageHelper.RECOMMEND_INSTALL_EXTERNAL) {
+ stageInternal = false;
+ } else {
+ throw new IOException("No storage with enough free space; res=" + resolved);
+ }
+ } finally {
+ Binder.restoreCallingIdentity(ident);
}
-
} else if (params.mode == SessionParams.MODE_INHERIT_EXISTING) {
// We always stage inheriting sessions on internal storage first,
// since we don't want to grow containers until we're sure that
diff --git a/services/core/java/com/android/server/power/ShutdownThread.java b/services/core/java/com/android/server/power/ShutdownThread.java
index 5f3da07..da11387 100644
--- a/services/core/java/com/android/server/power/ShutdownThread.java
+++ b/services/core/java/com/android/server/power/ShutdownThread.java
@@ -430,10 +430,10 @@ public final class ShutdownThread extends Thread {
}
try {
- radioOff = phone == null || !phone.isRadioOn();
+ radioOff = phone == null || !phone.needMobileRadioShutdown();
if (!radioOff) {
- Log.w(TAG, "Turning off radio...");
- phone.setRadio(false);
+ Log.w(TAG, "Turning off cellular radios...");
+ phone.shutdownMobileRadios();
}
} catch (RemoteException ex) {
Log.e(TAG, "RemoteException during radio shutdown", ex);
@@ -456,7 +456,7 @@ public final class ShutdownThread extends Thread {
}
if (!radioOff) {
try {
- radioOff = !phone.isRadioOn();
+ radioOff = !phone.needMobileRadioShutdown();
} catch (RemoteException ex) {
Log.e(TAG, "RemoteException during radio shutdown", ex);
radioOff = true;
@@ -472,7 +472,7 @@ public final class ShutdownThread extends Thread {
Log.e(TAG, "RemoteException during NFC shutdown", ex);
nfcOff = true;
}
- if (radioOff) {
+ if (nfcOff) {
Log.i(TAG, "NFC turned off.");
}
}
diff --git a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
index 02aeacf..7baa258 100644
--- a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
+++ b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
@@ -4594,46 +4594,6 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
}
@Override
- public int setApplicationsHidden(ComponentName who, Intent intent, boolean hidden) {
- int callingUserId = UserHandle.getCallingUserId();
- synchronized (this) {
- if (who == null) {
- throw new NullPointerException("ComponentName is null");
- }
- getActiveAdminForCallerLocked(who, DeviceAdminInfo.USES_POLICY_PROFILE_OWNER);
-
- long id = Binder.clearCallingIdentity();
- try {
- IPackageManager pm = AppGlobals.getPackageManager();
- List<ResolveInfo> activitiesToEnable = pm.queryIntentActivities(intent,
- intent.resolveTypeIfNeeded(mContext.getContentResolver()),
- PackageManager.GET_DISABLED_COMPONENTS
- | PackageManager.GET_UNINSTALLED_PACKAGES,
- callingUserId);
-
- if (DBG) Slog.d(LOG_TAG, "Enabling activities: " + activitiesToEnable);
- int numberOfAppsUnhidden = 0;
- if (activitiesToEnable != null) {
- for (ResolveInfo info : activitiesToEnable) {
- if (info.activityInfo != null) {
- numberOfAppsUnhidden++;
- pm.setApplicationHiddenSettingAsUser(info.activityInfo.packageName,
- hidden, callingUserId);
- }
- }
- }
- return numberOfAppsUnhidden;
- } catch (RemoteException re) {
- // shouldn't happen
- Slog.e(LOG_TAG, "Failed to setApplicationsHiddenSettingsWithIntent", re);
- } finally {
- restoreCallingIdentity(id);
- }
- return 0;
- }
- }
-
- @Override
public boolean isApplicationHidden(ComponentName who, String packageName) {
int callingUserId = UserHandle.getCallingUserId();
synchronized (this) {
@@ -4809,7 +4769,8 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
}
@Override
- public void setBlockUninstall(ComponentName who, String packageName, boolean blockUninstall) {
+ public void setUninstallBlocked(ComponentName who, String packageName,
+ boolean uninstallBlocked) {
final int userId = UserHandle.getCallingUserId();
synchronized (this) {
@@ -4821,7 +4782,7 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
long id = Binder.clearCallingIdentity();
try {
IPackageManager pm = AppGlobals.getPackageManager();
- pm.setBlockUninstallForUser(packageName, blockUninstall, userId);
+ pm.setBlockUninstallForUser(packageName, uninstallBlocked, userId);
} catch (RemoteException re) {
// Shouldn't happen.
Slog.e(LOG_TAG, "Failed to setBlockUninstallForUser", re);
@@ -4832,7 +4793,7 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
}
@Override
- public boolean getBlockUninstall(ComponentName who, String packageName) {
+ public boolean getUninstallBlocked(ComponentName who, String packageName) {
final int userId = UserHandle.getCallingUserId();
synchronized (this) {