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

Commit e0db8b99 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "BugreportManager API review updates."

parents af4f8b95 8c4887a7
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -29659,8 +29659,8 @@ package android.os {
  }
  public final class BugreportManager {
    method public void cancelBugreport();
    method public void startConnectivityBugreport(@NonNull android.os.ParcelFileDescriptor, @NonNull java.util.concurrent.Executor, @NonNull android.os.BugreportManager.BugreportCallback);
    method @WorkerThread public void cancelBugreport();
    method @WorkerThread public void startConnectivityBugreport(@NonNull android.os.ParcelFileDescriptor, @NonNull java.util.concurrent.Executor, @NonNull android.os.BugreportManager.BugreportCallback);
  }
  public abstract static class BugreportManager.BugreportCallback {
+1 −1
Original line number Diff line number Diff line
@@ -7212,7 +7212,7 @@ package android.os {
  public final class BugreportManager {
    method @RequiresPermission(android.Manifest.permission.DUMP) public void requestBugreport(@NonNull android.os.BugreportParams, @Nullable CharSequence, @Nullable CharSequence);
    method @RequiresPermission(android.Manifest.permission.DUMP) public void startBugreport(@NonNull android.os.ParcelFileDescriptor, @Nullable android.os.ParcelFileDescriptor, @NonNull android.os.BugreportParams, @NonNull java.util.concurrent.Executor, @NonNull android.os.BugreportManager.BugreportCallback);
    method @RequiresPermission(android.Manifest.permission.DUMP) @WorkerThread public void startBugreport(@NonNull android.os.ParcelFileDescriptor, @Nullable android.os.ParcelFileDescriptor, @NonNull android.os.BugreportParams, @NonNull java.util.concurrent.Executor, @NonNull android.os.BugreportManager.BugreportCallback);
  }
  public final class BugreportParams {
+25 −5
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@ import android.annotation.RequiresPermission;
import android.annotation.SuppressAutoDoc;
import android.annotation.SystemApi;
import android.annotation.SystemService;
import android.annotation.WorkerThread;
import android.app.ActivityManager;
import android.content.Context;
import android.util.Log;
@@ -41,7 +42,15 @@ import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.util.concurrent.Executor;

/** Class that provides a privileged API to capture and consume bugreports. */
/**
 * Class that provides a privileged API to capture and consume bugreports.
 *
 * <p>This class may only be used by apps that currently have carrier privileges (see {@link
 * android.telephony.TelephonyManager#hasCarrierPrivileges}) on an active SIM or priv-apps
 * explicitly allowed by the device manufacturer.
 *
 * <p>Only one bugreport can be generated by the system at a time.
 */
@SystemService(Context.BUGREPORT_SERVICE)
public final class BugreportManager {

@@ -56,7 +65,12 @@ public final class BugreportManager {
        mBinder = binder;
    }

    /** An interface describing the callback for bugreport progress and status. */
    /**
     * An interface describing the callback for bugreport progress and status.
     *
     * <p>In general, callers can expect to receive {@link #onProgress} calls as the bugreport
     * progresses, followed by a terminal call to either {@link #onFinished} or {@link #onError}.
     */
    public abstract static class BugreportCallback {
        /**
         * Possible error codes taking a bugreport can encounter.
@@ -75,15 +89,18 @@ public final class BugreportManager {
                })
        public @interface BugreportErrorCode {}

        /** The input options were invalid */
        /**
         * The input options were invalid. For example, the destination file the app provided could
         * not be written by the system.
         */
        public static final int BUGREPORT_ERROR_INVALID_INPUT =
                IDumpstateListener.BUGREPORT_ERROR_INVALID_INPUT;

        /** A runtime error occurred */
        /** A runtime error occurred. */
        public static final int BUGREPORT_ERROR_RUNTIME =
                IDumpstateListener.BUGREPORT_ERROR_RUNTIME_ERROR;

        /** User denied consent to share the bugreport */
        /** User denied consent to share the bugreport. */
        public static final int BUGREPORT_ERROR_USER_DENIED_CONSENT =
                IDumpstateListener.BUGREPORT_ERROR_USER_DENIED_CONSENT;

@@ -149,6 +166,7 @@ public final class BugreportManager {
     */
    @SystemApi
    @RequiresPermission(android.Manifest.permission.DUMP)
    @WorkerThread
    public void startBugreport(
            @NonNull ParcelFileDescriptor bugreportFd,
            @Nullable ParcelFileDescriptor screenshotFd,
@@ -222,6 +240,7 @@ public final class BugreportManager {
     * @param callback callback for progress and status updates.
     */
    @SuppressAutoDoc // Blocked by b/72967236 - no support for carrier privileges
    @WorkerThread
    public void startConnectivityBugreport(
            @NonNull ParcelFileDescriptor bugreportFd,
            @NonNull @CallbackExecutor Executor executor,
@@ -247,6 +266,7 @@ public final class BugreportManager {
     * @throws SecurityException if trying to cancel another app's bugreport in progress
     */
    @SuppressAutoDoc // Blocked by b/72967236 - no support for carrier privileges
    @WorkerThread
    public void cancelBugreport() {
        try {
            mBinder.cancelBugreport(-1 /* callingUid */, mContext.getOpPackageName());