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

Commit 49267f20 authored by Jing Ji's avatar Jing Ji Committed by Android (Google) Code Review
Browse files

Merge "Return the ProcessErrorStateInfo records for the caller's UID only"

parents ab689397 63ae4a40
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -2835,7 +2835,12 @@ public class ActivityManager {
     * Returns a list of any processes that are currently in an error condition.  The result
     * will be null if all processes are running properly at this time.
     *
     * @return Returns a list of ProcessErrorStateInfo records, or null if there are no
     * <p>As of {@link android.os.Build.VERSION_CODES#T Android T}, for regular apps this method
     * will only return {@link ProcessErrorStateInfo} records for the processes running as the
     * caller's uid, unless the caller has the permission {@link android.Manifest.permission#DUMP}.
     * </p>
     *
     * @return Returns a list of {@link ProcessErrorStateInfo} records, or null if there are no
     * current error conditions (it will not return an empty list).  This list ordering is not
     * specified.
     */
+9 −2
Original line number Diff line number Diff line
@@ -8396,9 +8396,13 @@ public class ActivityManagerService extends IActivityManager.Stub
        // assume our apps are happy - lazy create the list
        final List<ActivityManager.ProcessErrorStateInfo>[] errList = new List[1];
        final int callingUid = Binder.getCallingUid();
        final boolean allUsers = ActivityManager.checkUidPermission(INTERACT_ACROSS_USERS_FULL,
                Binder.getCallingUid()) == PackageManager.PERMISSION_GRANTED;
        int userId = UserHandle.getUserId(Binder.getCallingUid());
                callingUid) == PackageManager.PERMISSION_GRANTED;
        int userId = UserHandle.getUserId(callingUid);
        final boolean hasDumpPermission = ActivityManager.checkUidPermission(
                android.Manifest.permission.DUMP, callingUid) == PackageManager.PERMISSION_GRANTED;
        synchronized (mProcLock) {
            // iterate across all processes
@@ -8406,6 +8410,9 @@ public class ActivityManagerService extends IActivityManager.Stub
                if (!allUsers && app.userId != userId) {
                    return;
                }
                if (!hasDumpPermission && app.info.uid != callingUid) {
                    return;
                }
                final ProcessErrorStateRecord errState = app.mErrorState;
                final boolean crashing = errState.isCrashing();
                final boolean notResponding = errState.isNotResponding();