diff options
| author | 2018-03-19 22:15:11 +0000 | |
|---|---|---|
| committer | 2018-03-19 22:15:11 +0000 | |
| commit | 46c0e91b74fbddf0031175ec855b11a12581fe11 (patch) | |
| tree | b434a9020a7ff38f016d736e4f57ad951a4dad2f | |
| parent | c45c2d65a58d1dfc64bc8532f33bd7b6c8e42f86 (diff) | |
| parent | 015288241edac0f87929774b35b3aa06fc6bb911 (diff) | |
Merge "Removing the settings-based IncidentReportArgs method." into pi-dev
| -rw-r--r-- | api/system-current.txt | 2 | ||||
| -rw-r--r-- | api/test-current.txt | 2 | ||||
| -rw-r--r-- | core/java/android/os/IncidentManager.java | 42 | ||||
| -rw-r--r-- | core/java/android/os/IncidentReportArgs.java | 48 |
4 files changed, 0 insertions, 94 deletions
diff --git a/api/system-current.txt b/api/system-current.txt index d9e2cb6be9b6..a6b70fd94373 100644 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -3769,7 +3769,6 @@ package android.os { public class IncidentManager { method public void reportIncident(android.os.IncidentReportArgs); - method public void reportIncident(java.lang.String, byte[]); } public final class IncidentReportArgs implements android.os.Parcelable { @@ -3780,7 +3779,6 @@ package android.os { method public boolean containsSection(int); method public int describeContents(); method public boolean isAll(); - method public static android.os.IncidentReportArgs parseSetting(java.lang.String) throws java.lang.IllegalArgumentException; method public void readFromParcel(android.os.Parcel); method public int sectionCount(); method public void setAll(boolean); diff --git a/api/test-current.txt b/api/test-current.txt index 3ddbdba07f3e..e4caf9e0093b 100644 --- a/api/test-current.txt +++ b/api/test-current.txt @@ -473,7 +473,6 @@ package android.os { public class IncidentManager { method public void reportIncident(android.os.IncidentReportArgs); - method public void reportIncident(java.lang.String, byte[]); } public final class IncidentReportArgs implements android.os.Parcelable { @@ -484,7 +483,6 @@ package android.os { method public boolean containsSection(int); method public int describeContents(); method public boolean isAll(); - method public static android.os.IncidentReportArgs parseSetting(java.lang.String) throws java.lang.IllegalArgumentException; method public void readFromParcel(android.os.Parcel); method public int sectionCount(); method public void setAll(boolean); diff --git a/core/java/android/os/IncidentManager.java b/core/java/android/os/IncidentManager.java index 9b6d6e56407a..0e6652d471a5 100644 --- a/core/java/android/os/IncidentManager.java +++ b/core/java/android/os/IncidentManager.java @@ -21,7 +21,6 @@ import android.annotation.SystemApi; import android.annotation.SystemService; import android.annotation.TestApi; import android.content.Context; -import android.provider.Settings; import android.util.Slog; /** @@ -57,47 +56,6 @@ public class IncidentManager { reportIncidentInternal(args); } - /** - * Convenience method to trigger an incident report and put it in dropbox. - * <p> - * The fields that are reported will be looked up in the system setting named by - * the settingName parameter. The setting must match one of these patterns: - * The string "disabled": The report will not be taken. - * The string "all": The report will taken with all sections. - * The string "none": The report will taken with no sections, but with the header. - * A comma separated list of field numbers: The report will have these fields. - * <p> - * The header parameter will be added as a header for the incident report. Fill in a - * {@link android.util.proto.ProtoOutputStream ProtoOutputStream}, and then call the - * {@link android.util.proto.ProtoOutputStream#bytes bytes()} method to retrieve - * the encoded data for the header. - */ - @RequiresPermission(allOf = { - android.Manifest.permission.DUMP, - android.Manifest.permission.PACKAGE_USAGE_STATS - }) - public void reportIncident(String settingName, byte[] headerProto) { - // Sections - String setting = Settings.Global.getString(mContext.getContentResolver(), settingName); - IncidentReportArgs args; - try { - args = IncidentReportArgs.parseSetting(setting); - } catch (IllegalArgumentException ex) { - Slog.w(TAG, "Bad value for incident report setting '" + settingName + "'", ex); - return; - } - if (args == null) { - Slog.i(TAG, String.format("Incident report requested but disabled with " - + "settings [name: %s, value: %s]", settingName, setting)); - return; - } - - args.addHeader(headerProto); - - Slog.i(TAG, "Taking incident report: " + settingName); - reportIncidentInternal(args); - } - private class IncidentdDeathRecipient implements IBinder.DeathRecipient { @Override public void binderDied() { diff --git a/core/java/android/os/IncidentReportArgs.java b/core/java/android/os/IncidentReportArgs.java index 9fa129cb98b4..1aeac5f53be0 100644 --- a/core/java/android/os/IncidentReportArgs.java +++ b/core/java/android/os/IncidentReportArgs.java @@ -188,53 +188,5 @@ public final class IncidentReportArgs implements Parcelable { public void addHeader(byte[] header) { mHeaders.add(header); } - - /** - * Parses an incident report config as described in the system setting. - * - * @see IncidentManager#reportIncident - */ - public static IncidentReportArgs parseSetting(String setting) - throws IllegalArgumentException { - if (setting == null || setting.length() == 0) { - return null; - } - setting = setting.trim(); - if (setting.length() == 0 || "disabled".equals(setting)) { - return null; - } - - final IncidentReportArgs args = new IncidentReportArgs(); - - if ("all".equals(setting)) { - args.setAll(true); - return args; - } else if ("none".equals(setting)) { - return args; - } - - final String[] splits = setting.split(","); - final int N = splits.length; - for (int i=0; i<N; i++) { - final String str = splits[i].trim(); - if (str.length() == 0) { - continue; - } - int section; - try { - section = Integer.parseInt(str); - } catch (NumberFormatException ex) { - throw new IllegalArgumentException("Malformed setting. Bad integer at section" - + " index " + i + ": section='" + str + "' setting='" + setting + "'"); - } - if (section < 1) { - throw new IllegalArgumentException("Malformed setting. Illegal section at" - + " index " + i + ": section='" + str + "' setting='" + setting + "'"); - } - args.addSection(section); - } - - return args; - } } |