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

Commit ec41b387 authored by Kun Liang's avatar Kun Liang Committed by Linux Build Service Account
Browse files

QuickBoot: restrict app's auto start under Quickboot mode

Don't launch apps that not in whitelist under Quickboot mode.

Change-Id: I5d156cbea4ef18397ce4569cb74f73a446a6e49b
parent adf6ff28
Loading
Loading
Loading
Loading
+16 −1
Original line number Diff line number Diff line
@@ -38,6 +38,7 @@ import android.os.Message;
import android.os.Process;
import android.os.RemoteException;
import android.os.SystemClock;
import android.os.SystemProperties;
import android.os.UserHandle;
import android.util.EventLog;
import android.util.Log;
@@ -130,6 +131,7 @@ public final class BroadcastQueue {
     */
    int mPendingBroadcastRecvIndex;

    static ArrayList<String> quickbootWhiteList = null;
    static final int BROADCAST_INTENT_MSG = ActivityManagerService.FIRST_BROADCAST_QUEUE_MSG;
    static final int BROADCAST_TIMEOUT_MSG = ActivityManagerService.FIRST_BROADCAST_QUEUE_MSG + 1;

@@ -925,7 +927,10 @@ public final class BroadcastQueue {
            if (DEBUG_BROADCAST)  Slog.v(TAG,
                    "Need to start app ["
                    + mQueueName + "] " + targetProcess + " for broadcast " + r);
            if ((r.curApp=mService.startProcessLocked(targetProcess,
            if ((SystemProperties.getInt("sys.quickboot.enable", 0) == 1 &&
                        SystemProperties.getInt("sys.quickboot.poweron", 0) == 0 &&
                       !getWhiteList().contains(info.activityInfo.applicationInfo.packageName))
                || (r.curApp=mService.startProcessLocked(targetProcess,
                    info.activityInfo.applicationInfo, true,
                    r.intent.getFlags() | Intent.FLAG_FROM_BACKGROUND,
                    "broadcast", r.curComponent,
@@ -950,6 +955,16 @@ public final class BroadcastQueue {
        }
    }

    private ArrayList<String> getWhiteList() {
        if (quickbootWhiteList == null) {
            quickbootWhiteList = new ArrayList();
            // allow deskclock app to be launched
            quickbootWhiteList.add("com.android.deskclock");
            quickbootWhiteList.add("com.qapp.quickboot");
        }
        return quickbootWhiteList;
    }

    final void setBroadcastTimeoutLocked(long timeoutTime) {
        if (! mPendingBroadcastTimeoutMessage) {
            Message msg = mHandler.obtainMessage(BROADCAST_TIMEOUT_MSG, this);