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

Commit 416a4ec4 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Don't touch system_ce until the first user unlock."

parents 422b097b 0d407f4f
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -450,10 +450,17 @@ public class ActivityStackSupervisor implements RecentTasks.Callbacks {
    }

    void onSystemReady() {
        mPersisterQueue.startPersisting();
        mLaunchParamsPersister.onSystemReady();
    }

    void onUserUnlocked(int userId) {
        // Only start persisting when the first user is unlocked. The method call is
        // idempotent so there is no side effect to call it again when the second user is
        // unlocked.
        mPersisterQueue.startPersisting();
        mLaunchParamsPersister.onUnlockUser(userId);
    }

    public ActivityMetricsLogger getActivityMetricsLogger() {
        return mActivityMetricsLogger;
    }
+1 −1
Original line number Diff line number Diff line
@@ -954,7 +954,7 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
        @Override
        public void onUnlockUser(int userId) {
            synchronized (mService.getGlobalLock()) {
                mService.mStackSupervisor.mLaunchParamsPersister.onUnlockUser(userId);
                mService.mStackSupervisor.onUserUnlocked(userId);
            }
        }

+2 −8
Original line number Diff line number Diff line
@@ -131,10 +131,8 @@ class PersisterQueue {
    }

    /**
     *
     * @param item
     * @param flush
     * @param <T>
     * Updates the last item found in the queue that matches the given item, or adds it to the end
     * of the queue if no such item is found.
     */
    synchronized <T extends WriteQueueItem> void updateLastOrAddItem(T item, boolean flush) {
        final T itemToUpdate = findLastItem(item::matches, (Class<T>) item.getClass());
@@ -149,10 +147,6 @@ class PersisterQueue {

    /**
     * Removes all items with which given predicate returns {@code true}.
     *
     * @param predicate the predicate
     * @param clazz
     * @param <T>
     */
    synchronized <T extends WriteQueueItem> void removeItems(Predicate<T> predicate,
            Class<T> clazz) {
+9 −12
Original line number Diff line number Diff line
@@ -492,16 +492,8 @@ public class TaskPersister implements PersisterQueue.Listener {
        return new File(userTaskIdsDir, PERSISTED_TASK_IDS_FILENAME);
    }

    static File getUserTasksDir(int userId) {
        File userTasksDir = new File(Environment.getDataSystemCeDirectory(userId), TASKS_DIRNAME);

        if (!userTasksDir.exists()) {
            if (!userTasksDir.mkdir()) {
                Slog.e(TAG, "Failure creating tasks directory for user " + userId + ": "
                        + userTasksDir);
            }
        }
        return userTasksDir;
    private static File getUserTasksDir(int userId) {
        return new File(Environment.getDataSystemCeDirectory(userId), TASKS_DIRNAME);
    }

    static File getUserImagesDir(int userId) {
@@ -568,8 +560,13 @@ public class TaskPersister implements PersisterQueue.Listener {
                FileOutputStream file = null;
                AtomicFile atomicFile = null;
                try {
                    atomicFile = new AtomicFile(new File(
                            getUserTasksDir(task.userId),
                    File userTasksDir = getUserTasksDir(task.userId);
                    if (!userTasksDir.isDirectory() && !userTasksDir.mkdirs()) {
                        Slog.e(TAG, "Failure creating tasks directory for user " + task.userId
                                + ": " + userTasksDir + " Dropping persistence for task " + task);
                        return;
                    }
                    atomicFile = new AtomicFile(new File(userTasksDir,
                            String.valueOf(task.taskId) + TASK_FILENAME_SUFFIX));
                    file = atomicFile.startWrite();
                    file.write(stringWriter.toString().getBytes());