Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 185c2506 authored by Aayush Gupta's avatar Aayush Gupta
Browse files

Merge remote-tracking branch 'origin/lineage-18.1' into v1-r

parents da108307 ff0dd629
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -459,9 +459,12 @@ void StatsdStats::notePullExceedMaxDelay(int pullAtomId) {
void StatsdStats::noteAtomLogged(int atomId, int32_t timeSec) {
    lock_guard<std::mutex> lock(mLock);

    if (atomId <= kMaxPushedAtomId) {
    if (atomId >= 0 && atomId <= kMaxPushedAtomId) {
        mPushedAtomStats[atomId]++;
    } else {
        if (atomId < 0) {
            android_errorWriteLog(0x534e4554, "187957589");
        }
        if (mNonPlatformPushedAtomStats.size() < kMaxNonPlatformPushedAtoms) {
            mNonPlatformPushedAtomStats[atomId]++;
        }
+5 −0
Original line number Diff line number Diff line
@@ -322,6 +322,11 @@ public class ExternalStorageProvider extends FileSystemProvider {
                return true;
            }

            if (TextUtils.equals(Environment.DIRECTORY_ANDROID.toLowerCase(),
                    path.toLowerCase())) {
                return true;
            }

            return false;
        } catch (IOException e) {
            throw new IllegalArgumentException(
+12 −1
Original line number Diff line number Diff line
@@ -935,7 +935,18 @@ public final class ActiveServices {
    void killMisbehavingService(ServiceRecord r,
            int appUid, int appPid, String localPackageName) {
        synchronized (mAm) {
            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,
                    "Bad notification for startForeground", true /*force*/);
        }
+5 −1
Original line number Diff line number Diff line
@@ -3362,7 +3362,11 @@ public class StatsPullAtomService extends SystemService {
    int pullFaceSettingsLocked(int atomTag, List<StatsEvent> pulledData) {
        final long callingToken = Binder.clearCallingIdentity();
        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();
            FaceManager faceManager = mContext.getSystemService(FaceManager.class);

+32 −8
Original line number Diff line number Diff line
@@ -3391,7 +3391,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.
     *
     * @param userId user handle for the locked managed profile.
@@ -3399,18 +3399,42 @@ class RootWindowContainer extends WindowContainer<DisplayContent>
    void lockAllProfileTasks(@UserIdInt int userId) {
        mService.deferWindowLayout();
        try {
            forAllLeafTasks(task -> {
                if (task.getActivity(activity -> !activity.finishing && activity.mUserId == userId)
                        != null) {
                    mService.getTaskChangeNotificationController().notifyTaskProfileLocked(
                            task.mTaskId, userId);
                }
            }, true /* traverseTopToBottom */);
            final PooledConsumer c = PooledLambda.obtainConsumer(
                    RootWindowContainer::taskTopActivityIsUser, this, PooledLambda.__(Task.class),
                    userId);
            forAllLeafTasks(c, true /* traverseTopToBottom */);
            c.recycle();
        } finally {
            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() {
        for (int displayNdx = getChildCount() - 1; displayNdx >= 0; --displayNdx) {
            final DisplayContent display = getChildAt(displayNdx);
Loading