Merge "DO NOT MERGE - Merge RQ3A.210805.001.A1."
This commit is contained in:
@@ -322,6 +322,11 @@ public class ExternalStorageProvider extends FileSystemProvider {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (TextUtils.equals(Environment.DIRECTORY_ANDROID.toLowerCase(),
|
||||||
|
path.toLowerCase())) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new IllegalArgumentException(
|
throw new IllegalArgumentException(
|
||||||
|
|||||||
@@ -935,7 +935,18 @@ public final class ActiveServices {
|
|||||||
void killMisbehavingService(ServiceRecord r,
|
void killMisbehavingService(ServiceRecord r,
|
||||||
int appUid, int appPid, String localPackageName) {
|
int appUid, int appPid, String localPackageName) {
|
||||||
synchronized (mAm) {
|
synchronized (mAm) {
|
||||||
stopServiceLocked(r);
|
if (!r.destroying) {
|
||||||
|
// This service is still alive, stop it.
|
||||||
|
stopServiceLocked(r);
|
||||||
|
} else {
|
||||||
|
// Check if there is another instance of it being started in parallel,
|
||||||
|
// if so, stop that too to avoid spamming the system.
|
||||||
|
final ServiceMap smap = getServiceMapLocked(r.userId);
|
||||||
|
final ServiceRecord found = smap.mServicesByInstanceName.remove(r.instanceName);
|
||||||
|
if (found != null) {
|
||||||
|
stopServiceLocked(found);
|
||||||
|
}
|
||||||
|
}
|
||||||
mAm.crashApplication(appUid, appPid, localPackageName, -1,
|
mAm.crashApplication(appUid, appPid, localPackageName, -1,
|
||||||
"Bad notification for startForeground", true /*force*/);
|
"Bad notification for startForeground", true /*force*/);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3362,7 +3362,11 @@ public class StatsPullAtomService extends SystemService {
|
|||||||
int pullFaceSettingsLocked(int atomTag, List<StatsEvent> pulledData) {
|
int pullFaceSettingsLocked(int atomTag, List<StatsEvent> pulledData) {
|
||||||
final long callingToken = Binder.clearCallingIdentity();
|
final long callingToken = Binder.clearCallingIdentity();
|
||||||
try {
|
try {
|
||||||
List<UserInfo> users = mContext.getSystemService(UserManager.class).getUsers();
|
UserManager manager = mContext.getSystemService(UserManager.class);
|
||||||
|
if (manager == null) {
|
||||||
|
return StatsManager.PULL_SKIP;
|
||||||
|
}
|
||||||
|
List<UserInfo> users = manager.getUsers();
|
||||||
int numUsers = users.size();
|
int numUsers = users.size();
|
||||||
FaceManager faceManager = mContext.getSystemService(FaceManager.class);
|
FaceManager faceManager = mContext.getSystemService(FaceManager.class);
|
||||||
|
|
||||||
|
|||||||
@@ -3372,7 +3372,7 @@ class RootWindowContainer extends WindowContainer<DisplayContent>
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Find all task stacks containing {@param userId} and intercept them with an activity
|
* Find all visible task stacks containing {@param userId} and intercept them with an activity
|
||||||
* to block out the contents and possibly start a credential-confirming intent.
|
* to block out the contents and possibly start a credential-confirming intent.
|
||||||
*
|
*
|
||||||
* @param userId user handle for the locked managed profile.
|
* @param userId user handle for the locked managed profile.
|
||||||
@@ -3380,18 +3380,42 @@ class RootWindowContainer extends WindowContainer<DisplayContent>
|
|||||||
void lockAllProfileTasks(@UserIdInt int userId) {
|
void lockAllProfileTasks(@UserIdInt int userId) {
|
||||||
mService.deferWindowLayout();
|
mService.deferWindowLayout();
|
||||||
try {
|
try {
|
||||||
forAllLeafTasks(task -> {
|
final PooledConsumer c = PooledLambda.obtainConsumer(
|
||||||
if (task.getActivity(activity -> !activity.finishing && activity.mUserId == userId)
|
RootWindowContainer::taskTopActivityIsUser, this, PooledLambda.__(Task.class),
|
||||||
!= null) {
|
userId);
|
||||||
mService.getTaskChangeNotificationController().notifyTaskProfileLocked(
|
forAllLeafTasks(c, true /* traverseTopToBottom */);
|
||||||
task.mTaskId, userId);
|
c.recycle();
|
||||||
}
|
|
||||||
}, true /* traverseTopToBottom */);
|
|
||||||
} finally {
|
} finally {
|
||||||
mService.continueWindowLayout();
|
mService.continueWindowLayout();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Detects whether we should show a lock screen in front of this task for a locked user.
|
||||||
|
* <p>
|
||||||
|
* We'll do this if either of the following holds:
|
||||||
|
* <ul>
|
||||||
|
* <li>The top activity explicitly belongs to {@param userId}.</li>
|
||||||
|
* <li>The top activity returns a result to an activity belonging to {@param userId}.</li>
|
||||||
|
* </ul>
|
||||||
|
*
|
||||||
|
* @return {@code true} if the top activity looks like it belongs to {@param userId}.
|
||||||
|
*/
|
||||||
|
private void taskTopActivityIsUser(Task task, @UserIdInt int userId) {
|
||||||
|
// To handle the case that work app is in the task but just is not the top one.
|
||||||
|
final ActivityRecord activityRecord = task.getTopNonFinishingActivity();
|
||||||
|
final ActivityRecord resultTo = (activityRecord != null ? activityRecord.resultTo : null);
|
||||||
|
|
||||||
|
// Check the task for a top activity belonging to userId, or returning a
|
||||||
|
// result to an activity belonging to userId. Example case: a document
|
||||||
|
// picker for personal files, opened by a work app, should still get locked.
|
||||||
|
if ((activityRecord != null && activityRecord.mUserId == userId)
|
||||||
|
|| (resultTo != null && resultTo.mUserId == userId)) {
|
||||||
|
mService.getTaskChangeNotificationController().notifyTaskProfileLocked(
|
||||||
|
task.mTaskId, userId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void cancelInitializingActivities() {
|
void cancelInitializingActivities() {
|
||||||
for (int displayNdx = getChildCount() - 1; displayNdx >= 0; --displayNdx) {
|
for (int displayNdx = getChildCount() - 1; displayNdx >= 0; --displayNdx) {
|
||||||
final DisplayContent display = getChildAt(displayNdx);
|
final DisplayContent display = getChildAt(displayNdx);
|
||||||
|
|||||||
@@ -25,7 +25,6 @@ import static android.view.WindowManager.LayoutParams.TYPE_NOTIFICATION_SHADE;
|
|||||||
import static android.view.WindowManager.LayoutParams.TYPE_STATUS_BAR;
|
import static android.view.WindowManager.LayoutParams.TYPE_STATUS_BAR;
|
||||||
import static android.view.WindowManager.LayoutParams.TYPE_TOAST;
|
import static android.view.WindowManager.LayoutParams.TYPE_TOAST;
|
||||||
|
|
||||||
import static com.android.dx.mockito.inline.extended.ExtendedMockito.spyOn;
|
|
||||||
import static com.android.server.wm.ActivityStack.ActivityState.FINISHING;
|
import static com.android.server.wm.ActivityStack.ActivityState.FINISHING;
|
||||||
import static com.android.server.wm.ActivityStack.ActivityState.PAUSED;
|
import static com.android.server.wm.ActivityStack.ActivityState.PAUSED;
|
||||||
import static com.android.server.wm.ActivityStack.ActivityState.PAUSING;
|
import static com.android.server.wm.ActivityStack.ActivityState.PAUSING;
|
||||||
@@ -37,13 +36,10 @@ import static com.google.common.truth.Truth.assertThat;
|
|||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
import static org.junit.Assert.assertFalse;
|
import static org.junit.Assert.assertFalse;
|
||||||
import static org.junit.Assert.assertTrue;
|
import static org.junit.Assert.assertTrue;
|
||||||
import static org.mockito.ArgumentMatchers.eq;
|
|
||||||
import static org.mockito.Mockito.verify;
|
|
||||||
|
|
||||||
import android.app.WindowConfiguration;
|
import android.app.WindowConfiguration;
|
||||||
import android.content.ComponentName;
|
import android.content.ComponentName;
|
||||||
import android.content.pm.ActivityInfo;
|
import android.content.pm.ActivityInfo;
|
||||||
import android.os.UserHandle;
|
|
||||||
import android.platform.test.annotations.Presubmit;
|
import android.platform.test.annotations.Presubmit;
|
||||||
|
|
||||||
import androidx.test.filters.SmallTest;
|
import androidx.test.filters.SmallTest;
|
||||||
@@ -173,34 +169,5 @@ public class RootWindowContainerTests extends WindowTestsBase {
|
|||||||
activity.setState(FINISHING, "test FINISHING");
|
activity.setState(FINISHING, "test FINISHING");
|
||||||
assertThat(mWm.mRoot.allPausedActivitiesComplete()).isTrue();
|
assertThat(mWm.mRoot.allPausedActivitiesComplete()).isTrue();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testLockAllProfileTasks() {
|
|
||||||
// Make an activity visible with the user id set to 0
|
|
||||||
DisplayContent displayContent = mWm.mRoot.getDisplayContent(DEFAULT_DISPLAY);
|
|
||||||
TaskDisplayArea taskDisplayArea = displayContent.getTaskDisplayAreaAt(0);
|
|
||||||
final ActivityStack stack = createTaskStackOnDisplay(WINDOWING_MODE_FULLSCREEN,
|
|
||||||
ACTIVITY_TYPE_STANDARD, displayContent);
|
|
||||||
final ActivityRecord activity = new ActivityTestsBase.ActivityBuilder(stack.mAtmService)
|
|
||||||
.setStack(stack)
|
|
||||||
.setUid(0)
|
|
||||||
.setCreateTask(true)
|
|
||||||
.build();
|
|
||||||
|
|
||||||
// Create another activity on top and the user id is 1
|
|
||||||
Task task = activity.getTask();
|
|
||||||
final ActivityRecord topActivity = new ActivityTestsBase.ActivityBuilder(mWm.mAtmService)
|
|
||||||
.setStack(stack)
|
|
||||||
.setUid(UserHandle.PER_USER_RANGE + 1)
|
|
||||||
.setTask(task)
|
|
||||||
.build();
|
|
||||||
|
|
||||||
// Make sure the listeners will be notified for putting the task to locked state
|
|
||||||
TaskChangeNotificationController controller =
|
|
||||||
mWm.mAtmService.getTaskChangeNotificationController();
|
|
||||||
spyOn(controller);
|
|
||||||
mWm.mRoot.lockAllProfileTasks(0);
|
|
||||||
verify(controller).notifyTaskProfileLocked(eq(task.mTaskId), eq(0));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -572,6 +572,13 @@ public class SubscriptionInfo implements Parcelable {
|
|||||||
return mGroupUUID;
|
return mGroupUUID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
public void clearGroupUuid() {
|
||||||
|
this.mGroupUUID = null;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @hide
|
* @hide
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user