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

Commit 59350eaf authored by Alexander Martinz's avatar Alexander Martinz Committed by Gerrit Code Review
Browse files

[2/2] base: cm custom boot dexopt UI

* Pass app info and number of installed packages to boot message UI
* Ui by Asher and Joey, based on Alexander's previous work

Change-Id: I9ec9d0cb0e20a9bac73e126f6b6f3965400f05e7
parent 32265aee
Loading
Loading
Loading
Loading
+13 −6
Original line number Diff line number Diff line
@@ -2097,11 +2097,14 @@ public abstract class ActivityManagerNative extends Binder implements IActivityM
            return true;
        }

        case SHOW_BOOT_MESSAGE_TRANSACTION: {
        case UPDATE_BOOT_PROGRESS_TRANSACTION: {
            data.enforceInterface(IActivityManager.descriptor);
            CharSequence msg = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
            int stage = data.readInt();
            ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
            int current = data.readInt();
            int total = data.readInt();
            boolean always = data.readInt() != 0;
            showBootMessage(msg, always);
            updateBootProgress(stage, info, current, total, always);
            reply.writeNoException();
            return true;
        }
@@ -5285,13 +5288,17 @@ class ActivityManagerProxy implements IActivityManager
        return res;
    }

    public void showBootMessage(CharSequence msg, boolean always) throws RemoteException {
    public void updateBootProgress(int stage, ApplicationInfo optimizedApp,
            int currentAppPos, int totalAppCount, boolean always) throws RemoteException {
        Parcel data = Parcel.obtain();
        Parcel reply = Parcel.obtain();
        data.writeInterfaceToken(IActivityManager.descriptor);
        TextUtils.writeToParcel(msg, data, 0);
        data.writeInt(stage);
        optimizedApp.writeToParcel(data, 0);
        data.writeInt(currentAppPos);
        data.writeInt(totalAppCount);
        data.writeInt(always ? 1 : 0);
        mRemote.transact(SHOW_BOOT_MESSAGE_TRANSACTION, data, reply, 0);
        mRemote.transact(UPDATE_BOOT_PROGRESS_TRANSACTION, data, reply, 0);
        reply.readException();
        data.recycle();
        reply.recycle();
+8 −2
Original line number Diff line number Diff line
@@ -408,7 +408,8 @@ public interface IActivityManager extends IInterface {

    public long[] getProcessPss(int[] pids) throws RemoteException;

    public void showBootMessage(CharSequence msg, boolean always) throws RemoteException;
    public void updateBootProgress(int stage, ApplicationInfo optimizedApp,
            int currentAppPos, int totalAppCount, boolean always) throws RemoteException;

    public void keyguardWaitingForActivityDrawn() throws RemoteException;

@@ -622,6 +623,11 @@ public interface IActivityManager extends IInterface {
        }
    }

    public static final int BOOT_STAGE_STARTING_APPS = 1;
    public static final int BOOT_STAGE_FSTRIM = 2;
    public static final int BOOT_STAGE_PREPARING_APPS = 3;
    public static final int BOOT_STAGE_COMPLETE = 4;

    String descriptor = "android.app.IActivityManager";

    // Please keep these transaction codes the same -- they are also
@@ -757,7 +763,7 @@ public interface IActivityManager extends IInterface {
    int IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+134;
    int UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+135;
    int GET_PROCESS_PSS_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+136;
    int SHOW_BOOT_MESSAGE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+137;
    int UPDATE_BOOT_PROGRESS_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+137;
    int KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+139;
    int GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+140;
    int REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+141;
+4 −2
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ import android.annotation.IntDef;
import android.annotation.SystemApi;
import android.content.Context;
import android.content.pm.ActivityInfo;
import android.content.pm.ApplicationInfo;
import android.content.res.CompatibilityInfo;
import android.content.res.Configuration;
import android.graphics.Rect;
@@ -1171,9 +1172,10 @@ public interface WindowManagerPolicy {
    public void systemBooted();

    /**
     * Show boot time message to the user.
     * Update UI for boot-up progress.
     */
    public void showBootMessage(final CharSequence msg, final boolean always);
    public void updateBootProgress(final int stage, final ApplicationInfo optimizedApp,
            final int currentAppPos, final int totalAppCount);

    /**
     * Hide the UI for showing boot messages, never to be displayed again.
+9 −7
Original line number Diff line number Diff line
@@ -44,6 +44,7 @@ import android.app.ApplicationThreadNative;
import android.app.BroadcastOptions;
import android.app.IActivityContainer;
import android.app.IActivityContainerCallback;
import android.app.IActivityManager;
import android.app.IAppTask;
import android.app.ITaskStackListener;
import android.app.ProfilerInfo;
@@ -6558,12 +6559,14 @@ public final class ActivityManagerService extends ActivityManagerNative
    }
    @Override
    public void showBootMessage(final CharSequence msg, final boolean always) {
    public void updateBootProgress(final int stage, final ApplicationInfo optimizedApp,
            final int currentAppPos, final int totalAppCount, final boolean always) {
        if (Binder.getCallingUid() != Process.myUid()) {
            // These days only the core system can call this, so apps can't get in
            // the way of what we show about running them.
        }
        mWindowManager.showBootMessage(msg, always);
        mWindowManager.updateBootProgress(stage, optimizedApp,
                currentAppPos, totalAppCount, always);
    }
    @Override
@@ -11985,8 +11988,8 @@ public final class ActivityManagerService extends ActivityManagerNative
                intent.setComponent(comp);
                doneReceivers.add(comp);
                lastRi = curRi;
                CharSequence label = ai.loadLabel(mContext.getPackageManager());
                showBootMessage(mContext.getString(R.string.android_preparing_apk, label), false);
                updateBootProgress(IActivityManager.BOOT_STAGE_PREPARING_APPS,
                        ai.applicationInfo, 0, 0, false);
            }
            Slog.i(TAG, "Pre-boot of " + intent.getComponent().toShortString()
                    + " for user " + users[curUser]);
@@ -12109,9 +12112,8 @@ public final class ActivityManagerService extends ActivityManagerNative
                        synchronized (ActivityManagerService.this) {
                            mDidUpdate = true;
                        }
                        showBootMessage(mContext.getText(
                                R.string.android_upgrading_complete),
                                false);
                        updateBootProgress(IActivityManager.BOOT_STAGE_COMPLETE,
                                null, 0, 0, false);
                        writeLastDonePreBootReceivers(doneReceivers);
                        systemReady(goingCallback);
                    }
+5 −6
Original line number Diff line number Diff line
@@ -6364,9 +6364,8 @@ public class PackageManagerService extends IPackageManager.Stub {
                if (doTrim) {
                    if (!isFirstBoot()) {
                        try {
                            ActivityManagerNative.getDefault().showBootMessage(
                                    mContext.getResources().getString(
                                            R.string.android_upgrading_fstrim), true);
                            ActivityManagerNative.getDefault().updateBootProgress(
                                    IActivityManager.BOOT_STAGE_FSTRIM, null, 0, 0, true);
                        } catch (RemoteException e) {
                        }
                    }
@@ -6493,9 +6492,9 @@ public class PackageManagerService extends IPackageManager.Stub {
            Log.i(TAG, "Optimizing app " + curr + " of " + total + ": " + pkg.packageName);
        }
        try {
            ActivityManagerNative.getDefault().showBootMessage(
                    mContext.getResources().getString(R.string.android_upgrading_apk,
                            curr, total), true);
            ActivityManagerNative.getDefault().updateBootProgress(
                    IActivityManager.BOOT_STAGE_PREPARING_APPS,
                    pkg.applicationInfo, curr, total, true);
        } catch (RemoteException e) {
        }
        PackageParser.Package p = pkg;
Loading