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

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

Merge "Add API to allow app to report ANR by its own"

parents f28391eb 83c6bc5d
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -3955,6 +3955,7 @@ package android.app {
  public class ActivityManager {
    method public int addAppTask(@NonNull android.app.Activity, @NonNull android.content.Intent, @Nullable android.app.ActivityManager.TaskDescription, @NonNull android.graphics.Bitmap);
    method public void appNotResponding(@NonNull String);
    method public boolean clearApplicationUserData();
    method public void clearWatchHeapLimit();
    method @RequiresPermission(android.Manifest.permission.DUMP) public void dumpPackageState(java.io.FileDescriptor, String);
+13 −0
Original line number Diff line number Diff line
@@ -4547,4 +4547,17 @@ public class ActivityManager {
            throw e.rethrowFromSystemServer();
        }
    }

    /**
     * Method for the app to tell system that it's wedged and would like to trigger an ANR.
     *
     * @param reason The description of that what happened
     */
    public void appNotResponding(@NonNull final String reason) {
        try {
            getService().appNotResponding(reason);
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
        }
    }
}
+5 −0
Original line number Diff line number Diff line
@@ -583,4 +583,9 @@ interface IActivityManager {
     * unlockProgressListener can be null if monitoring progress is not necessary.
     */
    boolean startUserInForegroundWithListener(int userid, IProgressListener unlockProgressListener);

    /**
     * Method for the app to tell system that it's wedged and would like to trigger an ANR.
     */
    void appNotResponding(String reason);
}
+20 −0
Original line number Diff line number Diff line
@@ -7558,6 +7558,26 @@ public class ActivityManagerService extends IActivityManager.Stub
        });
    }
    @Override
    public void appNotResponding(final String reason) {
        final int callingPid = Binder.getCallingPid();
        synchronized (mPidsSelfLocked) {
            final ProcessRecord app = mPidsSelfLocked.get(callingPid);
            if (app == null) {
                throw new SecurityException("Unknown process: " + callingPid);
            }
            mHandler.post(new Runnable() {
                @Override
                public void run() {
                    app.appNotResponding(
                            null, app.info, null, null, false, "App requested: " + reason);
                }
            });
        }
    }
    public final void installSystemProviders() {
        List<ProviderInfo> providers;
        synchronized (this) {