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

Commit 13579ed3 authored by Dianne Hackborn's avatar Dianne Hackborn
Browse files

Cleaner initial boot.

This does some cleanup of the initial boot, especially when
booting in "no core apps" mode for encryption/decryption.

Change-Id: Ifb3949f580e52f54559e603c4b0b104f6bac2f6c
parent 71175f72
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -378,6 +378,7 @@ interface IPackageManager {
    VerifierDeviceIdentity getVerifierDeviceIdentity();

    boolean isFirstBoot();
    boolean isOnlyCoreApps();

    void setPermissionEnforced(String permission, boolean enforced);
    boolean isPermissionEnforced(String permission);
+12 −1
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ import android.content.ContentValues;
import android.content.Context;
import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.content.pm.IPackageManager;
import android.content.pm.PackageManager;
import android.content.res.XmlResourceParser;
import android.database.Cursor;
@@ -31,6 +32,8 @@ import android.media.AudioManager;
import android.media.AudioService;
import android.net.ConnectivityManager;
import android.os.Environment;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.os.SystemProperties;
import android.os.UserHandle;
import android.provider.Settings;
@@ -171,7 +174,15 @@ public class DatabaseHelper extends SQLiteOpenHelper {
        db.execSQL("CREATE INDEX bookmarksIndex2 ON bookmarks (shortcut);");

        // Populate bookmarks table with initial bookmarks
        boolean onlyCore = false;
        try {
            onlyCore = IPackageManager.Stub.asInterface(ServiceManager.getService(
                    "package")).isOnlyCoreApps();
        } catch (RemoteException e) {
        }
        if (!onlyCore) {
            loadBookmarks(db);
        }

        // Load initial volume levels into DB
        loadVolumeLevels(db);
+12 −1
Original line number Diff line number Diff line
@@ -20,11 +20,14 @@ import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.pm.IPackageManager;
import android.os.Build;
import android.os.DropBoxManager;
import android.os.FileObserver;
import android.os.FileUtils;
import android.os.RecoverySystem;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.os.SystemProperties;
import android.provider.Downloads;
import android.util.Slog;
@@ -69,7 +72,15 @@ public class BootReceiver extends BroadcastReceiver {
                    Slog.e(TAG, "Can't log boot events", e);
                }
                try {
                    boolean onlyCore = false;
                    try {
                        onlyCore = IPackageManager.Stub.asInterface(ServiceManager.getService(
                                "package")).isOnlyCoreApps();
                    } catch (RemoteException e) {
                    }
                    if (!onlyCore) {
                        removeOldUpdatePackages(context);
                    }
                } catch (Exception e) {
                    Slog.e(TAG, "Can't remove old update packages", e);
                }
+5 −2
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package com.android.server;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
@@ -97,8 +98,10 @@ public class EntropyMixer extends Binder {
    private void loadInitialEntropy() {
        try {
            RandomBlock.fromFile(entropyFile).toFile(randomDevice, false);
        } catch (FileNotFoundException e) {
            Slog.w(TAG, "No existing entropy file -- first boot?");
        } catch (IOException e) {
            Slog.w(TAG, "unable to load initial entropy (first boot?)", e);
            Slog.w(TAG, "Failure loading existing entropy file", e);
        }
    }

@@ -106,7 +109,7 @@ public class EntropyMixer extends Binder {
        try {
            RandomBlock.fromFile(randomDevice).toFile(entropyFile, true);
        } catch (IOException e) {
            Slog.w(TAG, "unable to write entropy", e);
            Slog.w(TAG, "Unable to write entropy", e);
        }
    }

+2 −0
Original line number Diff line number Diff line
@@ -1096,6 +1096,8 @@ class WallpaperManagerService extends IWallpaperManager.Stub {
                }
            } while (type != XmlPullParser.END_DOCUMENT);
            success = true;
        } catch (FileNotFoundException e) {
            Slog.w(TAG, "no current wallpaper -- first boot?");
        } catch (NullPointerException e) {
            Slog.w(TAG, "failed parsing " + file + " " + e);
        } catch (NumberFormatException e) {
Loading