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

Commit 12cde00d authored by Jeff Sharkey's avatar Jeff Sharkey Committed by Android (Google) Code Review
Browse files

Merge "Prepare app data only when storage is available."

parents 2e98cfd7 0e62384c
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -766,9 +766,13 @@ public class UserManager {
     * @param user The user to retrieve the running state for.
     */
    public boolean isUserRunning(UserHandle user) {
        return isUserRunning(user.getIdentifier());
    }

    /** {@hide} */
    public boolean isUserRunning(int userId) {
        try {
            return ActivityManagerNative.getDefault().isUserRunning(
                    user.getIdentifier(), 0);
            return ActivityManagerNative.getDefault().isUserRunning(userId, 0);
        } catch (RemoteException e) {
            return false;
        }
+0 −1
Original line number Diff line number Diff line
@@ -12684,7 +12684,6 @@ public final class ActivityManagerService extends ActivityManagerNative
        if (goingCallback != null) goingCallback.run();
        mBatteryStatsService.noteEvent(BatteryStats.HistoryItem.EVENT_USER_RUNNING_START,
                Integer.toString(currentUserId), currentUserId);
        mBatteryStatsService.noteEvent(BatteryStats.HistoryItem.EVENT_USER_FOREGROUND_START,
+5 −1
Original line number Diff line number Diff line
@@ -249,6 +249,9 @@ final class UserController {
            if (uss.state == UserState.STATE_RUNNING_LOCKED) {
                uss.setState(UserState.STATE_RUNNING);

                // Give user manager a chance to prepare app storage
                mUserManager.onBeforeUnlockUser(userId);

                mHandler.sendMessage(mHandler.obtainMessage(SYSTEM_USER_UNLOCK_MSG, userId, 0));

                final Intent unlockedIntent = new Intent(Intent.ACTION_USER_UNLOCKED);
@@ -651,7 +654,8 @@ final class UserController {
                }

                if (uss.state == UserState.STATE_BOOTING) {
                    // Let user manager propagate user restrictions to other services.
                    // Give user manager a chance to propagate user restrictions
                    // to other services and prepare app storage
                    getUserManager().onBeforeStartUser(userId);

                    // Booting up a new user, need to tell system services about it.
+13 −0
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package com.android.server.pm;

import android.annotation.IntDef;
import android.annotation.Nullable;
import android.content.Context;
import android.content.pm.PackageStats;
@@ -28,6 +29,9 @@ import com.android.server.SystemService;

import dalvik.system.VMRuntime;

import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;

public final class Installer extends SystemService {
    private static final String TAG = "Installer";

@@ -46,8 +50,17 @@ public final class Installer extends SystemService {
    /** Run the application with the JIT compiler */
    public static final int DEXOPT_USEJIT       = 1 << 5;

    /** @hide */
    @IntDef(flag = true, value = {
            FLAG_DE_STORAGE,
            FLAG_CE_STORAGE,
    })
    @Retention(RetentionPolicy.SOURCE)
    public @interface StorageFlags {}

    public static final int FLAG_DE_STORAGE = 1 << 0;
    public static final int FLAG_CE_STORAGE = 1 << 1;

    public static final int FLAG_CLEAR_CACHE_ONLY = 1 << 2;
    public static final int FLAG_CLEAR_CODE_CACHE_ONLY = 1 << 3;

+5 −0
Original line number Diff line number Diff line
@@ -25,6 +25,11 @@ import com.android.internal.os.InstallerConnection.InstallerException;
public class PackageManagerException extends Exception {
    public final int error;

    public PackageManagerException(String detailMessage) {
        super(detailMessage);
        this.error = PackageManager.INSTALL_FAILED_INTERNAL_ERROR;
    }

    public PackageManagerException(int error, String detailMessage) {
        super(detailMessage);
        this.error = error;
Loading