Loading services/core/java/com/android/server/am/ActiveServices.java +16 −7 Original line number Diff line number Diff line Loading @@ -7600,8 +7600,14 @@ public final class ActiveServices { super(Objects.requireNonNull(am).mHandler, msg, label); } void start(@NonNull ProcessRecord proc, long millis) { start(proc, proc.getPid(), proc.uid, millis); @Override public int getPid(@NonNull ProcessRecord proc) { return proc.getPid(); } @Override public int getUid(@NonNull ProcessRecord proc) { return proc.uid; } } Loading @@ -7611,11 +7617,14 @@ public final class ActiveServices { super(Objects.requireNonNull(am).mHandler, msg, label); } void start(@NonNull ServiceRecord service, long millis) { start(service, (service.app != null) ? service.app.getPid() : 0, service.appInfo.uid, millis); @Override public int getPid(@NonNull ServiceRecord service) { return (service.app != null) ? service.app.getPid() : 0; } @Override public int getUid(@NonNull ServiceRecord service) { return (service.appInfo != null) ? service.appInfo.uid : 0; } } Loading services/core/java/com/android/server/am/BroadcastQueueModernImpl.java +8 −2 Original line number Diff line number Diff line Loading @@ -1339,8 +1339,14 @@ class BroadcastQueueModernImpl extends BroadcastQueue { MSG_DELIVERY_TIMEOUT, "BROADCAST_TIMEOUT", true); } void start(@NonNull BroadcastProcessQueue queue, long timeoutMillis) { start(queue, queue.app.getPid(), queue.app.uid, timeoutMillis); @Override public int getPid(@NonNull BroadcastProcessQueue queue) { return (queue.app != null) ? queue.app.getPid() : 0; } @Override public int getUid(@NonNull BroadcastProcessQueue queue) { return (queue.app != null) ? queue.app.uid : 0; } } Loading services/core/java/com/android/server/utils/AnrTimer.java +22 −6 Original line number Diff line number Diff line Loading @@ -47,7 +47,7 @@ import java.util.Objects; * mode, the timer just sends a delayed message. In modern mode, the timer is implemented in * native code; on expiration, the message is sent without delay. * * <p>There are four external operations on a timer: * <p>There are five external operations on a timer: * <ul> * * <li>{@link #start} starts a timer. The timer is started with an object that the message Loading @@ -74,9 +74,13 @@ import java.util.Objects; * exit. (So, instances in system server generally need not be explicitly closed since they are * created during process start and will last until process exit.) * * <p>AnrTimer parameterized by the type <code>V</code>. The public methods on AnrTimer require * an instance of <code>V</code>; the instance of <code>V</code> is a key that identifies a * specific timer. * * @hide */ public class AnrTimer<V> implements AutoCloseable { public abstract class AnrTimer<V> implements AutoCloseable { /** * The log tag. Loading @@ -100,6 +104,20 @@ public class AnrTimer<V> implements AutoCloseable { */ private static final long TRACE_TAG = Trace.TRACE_TAG_ACTIVITY_MANAGER; /** * Fetch the Linux pid from the object. The returned value may be zero to indicate that there * is no valid pid available. * @return a valid pid or zero. */ public abstract int getPid(V obj); /** * Fetch the Linux uid from the object. The returned value may be zero to indicate that there * is no valid uid available. * @return a valid uid or zero. */ public abstract int getUid(V obj); /** * Return true if the feature is enabled. By default, the value is take from the Flags class * but it can be changed for local testing. Loading Loading @@ -564,13 +582,11 @@ public class AnrTimer<V> implements AutoCloseable { * allows a client to deliver an immediate timeout via the AnrTimer. * * @param arg The key by which the timer is known. This is never examined or modified. * @param pid The Linux process ID of the target being timed. * @param uid The Linux user ID of the target being timed. * @param timeoutMs The timer timeout, in milliseconds. */ public void start(@NonNull V arg, int pid, int uid, long timeoutMs) { public void start(@NonNull V arg, long timeoutMs) { if (timeoutMs < 0) timeoutMs = 0; mFeature.start(arg, pid, uid, timeoutMs); mFeature.start(arg, getPid(arg), getUid(arg), timeoutMs); } /** Loading services/tests/servicestests/src/com/android/server/utils/AnrTimerTest.java +8 −2 Original line number Diff line number Diff line Loading @@ -136,8 +136,14 @@ public class AnrTimerTest { this(helper.mHandler, MSG_TIMEOUT, caller()); } void start(TestArg arg, long millis) { start(arg, arg.pid, arg.uid, millis); @Override public int getPid(TestArg arg) { return arg.pid; } @Override public int getUid(TestArg arg) { return arg.uid; } // Return the name of method that called the constructor, assuming that this function is Loading Loading
services/core/java/com/android/server/am/ActiveServices.java +16 −7 Original line number Diff line number Diff line Loading @@ -7600,8 +7600,14 @@ public final class ActiveServices { super(Objects.requireNonNull(am).mHandler, msg, label); } void start(@NonNull ProcessRecord proc, long millis) { start(proc, proc.getPid(), proc.uid, millis); @Override public int getPid(@NonNull ProcessRecord proc) { return proc.getPid(); } @Override public int getUid(@NonNull ProcessRecord proc) { return proc.uid; } } Loading @@ -7611,11 +7617,14 @@ public final class ActiveServices { super(Objects.requireNonNull(am).mHandler, msg, label); } void start(@NonNull ServiceRecord service, long millis) { start(service, (service.app != null) ? service.app.getPid() : 0, service.appInfo.uid, millis); @Override public int getPid(@NonNull ServiceRecord service) { return (service.app != null) ? service.app.getPid() : 0; } @Override public int getUid(@NonNull ServiceRecord service) { return (service.appInfo != null) ? service.appInfo.uid : 0; } } Loading
services/core/java/com/android/server/am/BroadcastQueueModernImpl.java +8 −2 Original line number Diff line number Diff line Loading @@ -1339,8 +1339,14 @@ class BroadcastQueueModernImpl extends BroadcastQueue { MSG_DELIVERY_TIMEOUT, "BROADCAST_TIMEOUT", true); } void start(@NonNull BroadcastProcessQueue queue, long timeoutMillis) { start(queue, queue.app.getPid(), queue.app.uid, timeoutMillis); @Override public int getPid(@NonNull BroadcastProcessQueue queue) { return (queue.app != null) ? queue.app.getPid() : 0; } @Override public int getUid(@NonNull BroadcastProcessQueue queue) { return (queue.app != null) ? queue.app.uid : 0; } } Loading
services/core/java/com/android/server/utils/AnrTimer.java +22 −6 Original line number Diff line number Diff line Loading @@ -47,7 +47,7 @@ import java.util.Objects; * mode, the timer just sends a delayed message. In modern mode, the timer is implemented in * native code; on expiration, the message is sent without delay. * * <p>There are four external operations on a timer: * <p>There are five external operations on a timer: * <ul> * * <li>{@link #start} starts a timer. The timer is started with an object that the message Loading @@ -74,9 +74,13 @@ import java.util.Objects; * exit. (So, instances in system server generally need not be explicitly closed since they are * created during process start and will last until process exit.) * * <p>AnrTimer parameterized by the type <code>V</code>. The public methods on AnrTimer require * an instance of <code>V</code>; the instance of <code>V</code> is a key that identifies a * specific timer. * * @hide */ public class AnrTimer<V> implements AutoCloseable { public abstract class AnrTimer<V> implements AutoCloseable { /** * The log tag. Loading @@ -100,6 +104,20 @@ public class AnrTimer<V> implements AutoCloseable { */ private static final long TRACE_TAG = Trace.TRACE_TAG_ACTIVITY_MANAGER; /** * Fetch the Linux pid from the object. The returned value may be zero to indicate that there * is no valid pid available. * @return a valid pid or zero. */ public abstract int getPid(V obj); /** * Fetch the Linux uid from the object. The returned value may be zero to indicate that there * is no valid uid available. * @return a valid uid or zero. */ public abstract int getUid(V obj); /** * Return true if the feature is enabled. By default, the value is take from the Flags class * but it can be changed for local testing. Loading Loading @@ -564,13 +582,11 @@ public class AnrTimer<V> implements AutoCloseable { * allows a client to deliver an immediate timeout via the AnrTimer. * * @param arg The key by which the timer is known. This is never examined or modified. * @param pid The Linux process ID of the target being timed. * @param uid The Linux user ID of the target being timed. * @param timeoutMs The timer timeout, in milliseconds. */ public void start(@NonNull V arg, int pid, int uid, long timeoutMs) { public void start(@NonNull V arg, long timeoutMs) { if (timeoutMs < 0) timeoutMs = 0; mFeature.start(arg, pid, uid, timeoutMs); mFeature.start(arg, getPid(arg), getUid(arg), timeoutMs); } /** Loading
services/tests/servicestests/src/com/android/server/utils/AnrTimerTest.java +8 −2 Original line number Diff line number Diff line Loading @@ -136,8 +136,14 @@ public class AnrTimerTest { this(helper.mHandler, MSG_TIMEOUT, caller()); } void start(TestArg arg, long millis) { start(arg, arg.pid, arg.uid, millis); @Override public int getPid(TestArg arg) { return arg.pid; } @Override public int getUid(TestArg arg) { return arg.uid; } // Return the name of method that called the constructor, assuming that this function is Loading