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

Commit 3da5c974 authored by Michal Karpinski's avatar Michal Karpinski
Browse files

Adjusting AMN#requestBugReport() to be able to invoke 3 types

of bugreport services

ActivityManagerNative#requestBugReport() now can accept 3 types:
FULL, INTERACTIVE AND REMOTE.

Bug: 26152603
Change-Id: Ife9bbef4691e172fb56b72b256880f0d4ad4d198
parent 2e8bafc3
Loading
Loading
Loading
Loading
+3 −0
Original line number 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);
  }
  public static abstract class ActivityManager.BugreportMode implements java.lang.annotation.Annotation {
  }
  public static class ActivityManager.MemoryInfo implements android.os.Parcelable {
    ctor public ActivityManager.MemoryInfo();
    method public int describeContents();
+3 −0
Original line number 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);
  }
  public static abstract class ActivityManager.BugreportMode implements java.lang.annotation.Annotation {
  }
  public static class ActivityManager.MemoryInfo implements android.os.Parcelable {
    ctor public ActivityManager.MemoryInfo();
    method public int describeContents();
+3 −0
Original line number 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);
  }
  public static abstract class ActivityManager.BugreportMode implements java.lang.annotation.Annotation {
  }
  public static class ActivityManager.MemoryInfo implements android.os.Parcelable {
    ctor public ActivityManager.MemoryInfo();
    method public int describeContents();
+3 −3
Original line number Diff line number Diff line
@@ -1080,16 +1080,16 @@ public class Am extends BaseCommand {

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

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

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

@@ -79,6 +82,36 @@ public class ActivityManager {
    private final Context mContext;
    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
     * <meta-data>}</a> name for a 'home' Activity that declares a package that is to be
Loading