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

Commit c8e42d59 authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge "BugreportManager API review updates." am: e0db8b99

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1584520

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I41e43baa35a660165075df1bc602cf197656df82
parents d82f6409 e0db8b99
Loading
Loading
Loading
Loading
+2 −2
Original line number Original line Diff line number Diff line
@@ -29659,8 +29659,8 @@ package android.os {
  }
  }
  public final class BugreportManager {
  public final class BugreportManager {
    method public void cancelBugreport();
    method @WorkerThread 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 startConnectivityBugreport(@NonNull android.os.ParcelFileDescriptor, @NonNull java.util.concurrent.Executor, @NonNull android.os.BugreportManager.BugreportCallback);
  }
  }
  public abstract static class BugreportManager.BugreportCallback {
  public abstract static class BugreportManager.BugreportCallback {
+1 −1
Original line number Original line Diff line number Diff line
@@ -7212,7 +7212,7 @@ package android.os {
  public final class BugreportManager {
  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 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 {
  public final class BugreportParams {
+25 −5
Original line number Original line Diff line number Diff line
@@ -25,6 +25,7 @@ import android.annotation.RequiresPermission;
import android.annotation.SuppressAutoDoc;
import android.annotation.SuppressAutoDoc;
import android.annotation.SystemApi;
import android.annotation.SystemApi;
import android.annotation.SystemService;
import android.annotation.SystemService;
import android.annotation.WorkerThread;
import android.app.ActivityManager;
import android.app.ActivityManager;
import android.content.Context;
import android.content.Context;
import android.util.Log;
import android.util.Log;
@@ -41,7 +42,15 @@ import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.RetentionPolicy;
import java.util.concurrent.Executor;
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)
@SystemService(Context.BUGREPORT_SERVICE)
public final class BugreportManager {
public final class BugreportManager {


@@ -56,7 +65,12 @@ public final class BugreportManager {
        mBinder = binder;
        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 {
    public abstract static class BugreportCallback {
        /**
        /**
         * Possible error codes taking a bugreport can encounter.
         * Possible error codes taking a bugreport can encounter.
@@ -75,15 +89,18 @@ public final class BugreportManager {
                })
                })
        public @interface BugreportErrorCode {}
        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 =
        public static final int BUGREPORT_ERROR_INVALID_INPUT =
                IDumpstateListener.BUGREPORT_ERROR_INVALID_INPUT;
                IDumpstateListener.BUGREPORT_ERROR_INVALID_INPUT;


        /** A runtime error occurred */
        /** A runtime error occurred. */
        public static final int BUGREPORT_ERROR_RUNTIME =
        public static final int BUGREPORT_ERROR_RUNTIME =
                IDumpstateListener.BUGREPORT_ERROR_RUNTIME_ERROR;
                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 =
        public static final int BUGREPORT_ERROR_USER_DENIED_CONSENT =
                IDumpstateListener.BUGREPORT_ERROR_USER_DENIED_CONSENT;
                IDumpstateListener.BUGREPORT_ERROR_USER_DENIED_CONSENT;


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