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

Commit 42efc586 authored by Michal Karpinski's avatar Michal Karpinski Committed by Android (Google) Code Review
Browse files

Merge "Adjusting AMN#requestBugReport() to be able to invoke 3 types of bugreport services"

parents 1a7d98b7 3da5c974
Loading
Loading
Loading
Loading
+3 −0
Original line number Original line Diff line number Diff line
@@ -3638,6 +3638,9 @@ package android.app {
    method public void startActivity(android.content.Context, android.content.Intent, android.os.Bundle);
    method public void startActivity(android.content.Context, android.content.Intent, android.os.Bundle);
  }
  }
  public static abstract class ActivityManager.BugreportMode implements java.lang.annotation.Annotation {
  }
  public static class ActivityManager.MemoryInfo implements android.os.Parcelable {
  public static class ActivityManager.MemoryInfo implements android.os.Parcelable {
    ctor public ActivityManager.MemoryInfo();
    ctor public ActivityManager.MemoryInfo();
    method public int describeContents();
    method public int describeContents();
+3 −0
Original line number Original line Diff line number Diff line
@@ -3749,6 +3749,9 @@ package android.app {
    method public void startActivity(android.content.Context, android.content.Intent, android.os.Bundle);
    method public void startActivity(android.content.Context, android.content.Intent, android.os.Bundle);
  }
  }
  public static abstract class ActivityManager.BugreportMode implements java.lang.annotation.Annotation {
  }
  public static class ActivityManager.MemoryInfo implements android.os.Parcelable {
  public static class ActivityManager.MemoryInfo implements android.os.Parcelable {
    ctor public ActivityManager.MemoryInfo();
    ctor public ActivityManager.MemoryInfo();
    method public int describeContents();
    method public int describeContents();
+3 −0
Original line number Original line Diff line number Diff line
@@ -3638,6 +3638,9 @@ package android.app {
    method public void startActivity(android.content.Context, android.content.Intent, android.os.Bundle);
    method public void startActivity(android.content.Context, android.content.Intent, android.os.Bundle);
  }
  }
  public static abstract class ActivityManager.BugreportMode implements java.lang.annotation.Annotation {
  }
  public static class ActivityManager.MemoryInfo implements android.os.Parcelable {
  public static class ActivityManager.MemoryInfo implements android.os.Parcelable {
    ctor public ActivityManager.MemoryInfo();
    ctor public ActivityManager.MemoryInfo();
    method public int describeContents();
    method public int describeContents();
+3 −3
Original line number Original line Diff line number Diff line
@@ -1080,16 +1080,16 @@ public class Am extends BaseCommand {


    private void runBugReport() throws Exception {
    private void runBugReport() throws Exception {
        String opt;
        String opt;
        boolean progress = false;
        int bugreportType = ActivityManager.BUGREPORT_OPTION_FULL;
        while ((opt=nextOption()) != null) {
        while ((opt=nextOption()) != null) {
            if (opt.equals("--progress")) {
            if (opt.equals("--progress")) {
                progress = true;
                bugreportType = ActivityManager.BUGREPORT_OPTION_INTERACTIVE;
            } else {
            } else {
                System.err.println("Error: Unknown option: " + opt);
                System.err.println("Error: Unknown option: " + opt);
                return;
                return;
            }
            }
        }
        }
        mAm.requestBugReport(progress);
        mAm.requestBugReport(bugreportType);
        System.out.println("Your lovely bug report is being created; please be patient.");
        System.out.println("Your lovely bug report is being created; please be patient.");
    }
    }


+33 −0
Original line number Original line Diff line number Diff line
@@ -17,6 +17,7 @@
package android.app;
package android.app;


import android.Manifest;
import android.Manifest;
import android.annotation.IntDef;
import android.annotation.NonNull;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.Nullable;
import android.annotation.RequiresPermission;
import android.annotation.RequiresPermission;
@@ -68,6 +69,8 @@ import java.io.FileDescriptor;
import java.io.FileOutputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.IOException;
import java.io.PrintWriter;
import java.io.PrintWriter;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.util.ArrayList;
import java.util.ArrayList;
import java.util.List;
import java.util.List;


@@ -82,6 +85,36 @@ public class ActivityManager {
    private final Context mContext;
    private final Context mContext;
    private final Handler mHandler;
    private final Handler mHandler;


    @Retention(RetentionPolicy.SOURCE)
    @IntDef({
            BUGREPORT_OPTION_FULL,
            BUGREPORT_OPTION_INTERACTIVE,
            BUGREPORT_OPTION_REMOTE
    })
    /**
     * Defines acceptable types of bugreports.
     * @hide
     */
    public @interface BugreportMode {}
    /**
     * Takes a bugreport without user interference (and hence causing less
     * interference to the system), but includes all sections.
     * @hide
     */
    public static final int BUGREPORT_OPTION_FULL = 0;
    /**
     * Allows user to monitor progress and enter additional data; might not include all
     * sections.
     * @hide
     */
    public static final int BUGREPORT_OPTION_INTERACTIVE = 1;
    /**
     * Takes a bugreport requested remotely by administrator of the Device Owner app,
     * not the device's user.
     * @hide
     */
    public static final int BUGREPORT_OPTION_REMOTE = 2;

    /**
    /**
     * <a href="{@docRoot}guide/topics/manifest/meta-data-element.html">{@code
     * <a href="{@docRoot}guide/topics/manifest/meta-data-element.html">{@code
     * <meta-data>}</a> name for a 'home' Activity that declares a package that is to be
     * <meta-data>}</a> name for a 'home' Activity that declares a package that is to be
Loading