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

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

Merge "Base support for `servicestests` under Ravenwood." into main

parents 9562ea2a 784b36cc
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -46,7 +46,6 @@ import android.os.TransactionTooLargeException;
import android.os.WorkSource;
import android.util.ArraySet;
import android.util.Pair;
import android.util.StatsEvent;

import com.android.internal.os.TimeoutRecord;

@@ -1224,7 +1223,8 @@ public abstract class ActivityManagerInternal {
     * @return The stats event for the cached apps high watermark since last pull.
     */
    @NonNull
    public abstract StatsEvent getCachedAppsHighWatermarkStats(int atomTag, boolean resetAfterPull);
    // TODO: restore to android.util.StatsEvent once Ravenwood includes Mainline stubs
    public abstract Object getCachedAppsHighWatermarkStats(int atomTag, boolean resetAfterPull);

    /**
     * Internal method for clearing app data, with the extra param that is used to indicate restore.
+14 −0
Original line number Diff line number Diff line
@@ -853,6 +853,7 @@ public class Process {
            args.argi2 = pid;
            args.argi3 = Long.hashCode(Thread.currentThread().getId());
            args.argi4 = THREAD_PRIORITY_DEFAULT;
            args.arg1 = Boolean.TRUE; // backgroundOk
            return args;
        });
    }
@@ -1105,6 +1106,11 @@ public class Process {
        final SomeArgs args =
                Preconditions.requireNonNullViaRavenwoodRule(sIdentity$ravenwood).get();
        if (args.argi3 == tid) {
            boolean backgroundOk = (args.arg1 == Boolean.TRUE);
            if (priority >= THREAD_PRIORITY_BACKGROUND && !backgroundOk) {
                throw new IllegalArgumentException(
                        "Priority " + priority + " blocked by setCanSelfBackground()");
            }
            args.argi4 = priority;
        } else {
            throw new UnsupportedOperationException(
@@ -1119,8 +1125,16 @@ public class Process {
     *
     * @hide
     */
    @android.ravenwood.annotation.RavenwoodReplace
    public static final native void setCanSelfBackground(boolean backgroundOk);

    /** @hide */
    public static final void setCanSelfBackground$ravenwood(boolean backgroundOk) {
        final SomeArgs args =
                Preconditions.requireNonNullViaRavenwoodRule(sIdentity$ravenwood).get();
        args.arg1 = Boolean.valueOf(backgroundOk);
    }

    /**
     * Sets the scheduling group for a thread.
     * @hide
+11 −0
Original line number Diff line number Diff line
@@ -29,6 +29,7 @@ import android.util.ArrayMap;
 *
 * {@hide}
 */
@android.ravenwood.annotation.RavenwoodKeepWholeClass
public final class LocalServices {
    private LocalServices() {}

@@ -69,4 +70,14 @@ public final class LocalServices {
            sLocalServiceObjects.remove(type);
        }
    }

    /**
     * Remove all known service instances, must be only used in tests.
     */
    @VisibleForTesting
    public static void removeAllServicesForTest() {
        synchronized (sLocalServiceObjects) {
            sLocalServiceObjects.clear();
        }
    }
}
+4 −0
Original line number Diff line number Diff line
@@ -32,6 +32,8 @@ public class RavenwoodRuleImpl {
        android.os.Process.init$ravenwood(rule.mUid, rule.mPid);
        android.os.Binder.init$ravenwood();

        com.android.server.LocalServices.removeAllServicesForTest();

        if (rule.mProvideMainThread) {
            final HandlerThread main = new HandlerThread(MAIN_THREAD_NAME);
            main.start();
@@ -45,6 +47,8 @@ public class RavenwoodRuleImpl {
            Looper.clearMainLooperForTest();
        }

        com.android.server.LocalServices.removeAllServicesForTest();

        android.os.Process.reset$ravenwood();
        android.os.Binder.reset$ravenwood();
    }
+2 −0
Original line number Diff line number Diff line
@@ -64,3 +64,5 @@ android.graphics.Point
android.graphics.PointF
android.graphics.Rect
android.graphics.RectF

com.android.server.LocalServices
Loading