Merge "[API Feedback] Rename DebugEventReporter" am: 3a6dcad0a3

am: e80b170949

Change-Id: I2c458c5a5fa2b1f47f9bc92e89a7385ca35d877d
This commit is contained in:
Nathan Harold
2019-03-12 16:12:08 -07:00
committed by android-build-merger
4 changed files with 36 additions and 36 deletions

View File

@@ -6434,7 +6434,7 @@ package android.telephony {
method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean switchSlots(int[]); method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean switchSlots(int[]);
method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void toggleRadioOnOff(); method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void toggleRadioOnOff();
method public void updateServiceLocation(); method public void updateServiceLocation();
field @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public static final String ACTION_DEBUG_EVENT = "android.telephony.action.DEBUG_EVENT"; field @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public static final String ACTION_ANOMALY_REPORTED = "android.telephony.action.ANOMALY_REPORTED";
field public static final String ACTION_SIM_APPLICATION_STATE_CHANGED = "android.telephony.action.SIM_APPLICATION_STATE_CHANGED"; field public static final String ACTION_SIM_APPLICATION_STATE_CHANGED = "android.telephony.action.SIM_APPLICATION_STATE_CHANGED";
field public static final String ACTION_SIM_CARD_STATE_CHANGED = "android.telephony.action.SIM_CARD_STATE_CHANGED"; field public static final String ACTION_SIM_CARD_STATE_CHANGED = "android.telephony.action.SIM_CARD_STATE_CHANGED";
field public static final String ACTION_SIM_SLOT_STATUS_CHANGED = "android.telephony.action.SIM_SLOT_STATUS_CHANGED"; field public static final String ACTION_SIM_SLOT_STATUS_CHANGED = "android.telephony.action.SIM_SLOT_STATUS_CHANGED";
@@ -6442,8 +6442,8 @@ package android.telephony {
field public static final int CARRIER_PRIVILEGE_STATUS_HAS_ACCESS = 1; // 0x1 field public static final int CARRIER_PRIVILEGE_STATUS_HAS_ACCESS = 1; // 0x1
field public static final int CARRIER_PRIVILEGE_STATUS_NO_ACCESS = 0; // 0x0 field public static final int CARRIER_PRIVILEGE_STATUS_NO_ACCESS = 0; // 0x0
field public static final int CARRIER_PRIVILEGE_STATUS_RULES_NOT_LOADED = -1; // 0xffffffff field public static final int CARRIER_PRIVILEGE_STATUS_RULES_NOT_LOADED = -1; // 0xffffffff
field public static final String EXTRA_DEBUG_EVENT_DESCRIPTION = "android.telephony.extra.DEBUG_EVENT_DESCRIPTION"; field public static final String EXTRA_ANOMALY_DESCRIPTION = "android.telephony.extra.ANOMALY_DESCRIPTION";
field public static final String EXTRA_DEBUG_EVENT_ID = "android.telephony.extra.DEBUG_EVENT_ID"; field public static final String EXTRA_ANOMALY_ID = "android.telephony.extra.ANOMALY_ID";
field public static final String EXTRA_SIM_STATE = "android.telephony.extra.SIM_STATE"; field public static final String EXTRA_SIM_STATE = "android.telephony.extra.SIM_STATE";
field public static final String EXTRA_VISUAL_VOICEMAIL_ENABLED_BY_USER_BOOL = "android.telephony.extra.VISUAL_VOICEMAIL_ENABLED_BY_USER_BOOL"; field public static final String EXTRA_VISUAL_VOICEMAIL_ENABLED_BY_USER_BOOL = "android.telephony.extra.VISUAL_VOICEMAIL_ENABLED_BY_USER_BOOL";
field public static final String EXTRA_VOICEMAIL_SCRAMBLED_PIN_STRING = "android.telephony.extra.VOICEMAIL_SCRAMBLED_PIN_STRING"; field public static final String EXTRA_VOICEMAIL_SCRAMBLED_PIN_STRING = "android.telephony.extra.VOICEMAIL_SCRAMBLED_PIN_STRING";

View File

@@ -29,7 +29,6 @@ import com.android.internal.util.IndentingPrintWriter;
import java.io.FileDescriptor; import java.io.FileDescriptor;
import java.io.PrintWriter; import java.io.PrintWriter;
import java.util.List; import java.util.List;
import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.UUID; import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
@@ -37,7 +36,7 @@ import java.util.concurrent.ConcurrentHashMap;
/** /**
* A Simple Surface for Telephony to notify a loosely-coupled debugger of particular issues. * A Simple Surface for Telephony to notify a loosely-coupled debugger of particular issues.
* *
* DebugEventReporter allows an optional external logging component to receive events detected by * AnomalyReporter allows an optional external logging component to receive events detected by
* the framework and take action. This log surface is designed to provide maximium flexibility * the framework and take action. This log surface is designed to provide maximium flexibility
* to the receiver of these events. Envisioned use cases of this include notifying a vendor * to the receiver of these events. Envisioned use cases of this include notifying a vendor
* component of: an event that necessitates (timely) log collection on non-AOSP components; * component of: an event that necessitates (timely) log collection on non-AOSP components;
@@ -49,8 +48,8 @@ import java.util.concurrent.ConcurrentHashMap;
* *
* @hide * @hide
*/ */
public final class DebugEventReporter { public final class AnomalyReporter {
private static final String TAG = "DebugEventReporter"; private static final String TAG = "AnomalyReporter";
private static Context sContext = null; private static Context sContext = null;
@@ -63,12 +62,12 @@ public final class DebugEventReporter {
*/ */
private static String sDebugPackageName = null; private static String sDebugPackageName = null;
private DebugEventReporter() {}; private AnomalyReporter() {};
/** /**
* If enabled, build and send an intent to a Debug Service for logging. * If enabled, build and send an intent to a Debug Service for logging.
* *
* This method sends the {@link TelephonyManager#DEBUG_EVENT DEBUG_EVENT} broadcast, which is * This method sends the {@link TelephonyManager#ACTION_ANOMALY_REPORTED} broadcast, which is
* system protected. Invoking this method unless you are the system will result in an error. * system protected. Invoking this method unless you are the system will result in an error.
* *
* @param eventId a fixed event ID that will be sent for each instance of the same event. This * @param eventId a fixed event ID that will be sent for each instance of the same event. This
@@ -77,9 +76,9 @@ public final class DebugEventReporter {
* identification and discussion of this event. This description should ideally be * identification and discussion of this event. This description should ideally be
* static and must not contain any sensitive information (especially PII). * static and must not contain any sensitive information (especially PII).
*/ */
public static void sendEvent(@NonNull UUID eventId, String description) { public static void reportAnomaly(@NonNull UUID eventId, String description) {
if (sContext == null) { if (sContext == null) {
Rlog.w(TAG, "DebugEventReporter not yet initialized, dropping event=" + eventId); Rlog.w(TAG, "AnomalyReporter not yet initialized, dropping event=" + eventId);
return; return;
} }
@@ -94,28 +93,28 @@ public final class DebugEventReporter {
// so drop these events silently. // so drop these events silently.
if (sDebugPackageName == null) return; if (sDebugPackageName == null) return;
Intent dbgIntent = new Intent(TelephonyManager.ACTION_DEBUG_EVENT); Intent dbgIntent = new Intent(TelephonyManager.ACTION_ANOMALY_REPORTED);
dbgIntent.putExtra(TelephonyManager.EXTRA_DEBUG_EVENT_ID, new ParcelUuid(eventId)); dbgIntent.putExtra(TelephonyManager.EXTRA_ANOMALY_ID, new ParcelUuid(eventId));
if (description != null) { if (description != null) {
dbgIntent.putExtra(TelephonyManager.EXTRA_DEBUG_EVENT_DESCRIPTION, description); dbgIntent.putExtra(TelephonyManager.EXTRA_ANOMALY_DESCRIPTION, description);
} }
dbgIntent.setPackage(sDebugPackageName); dbgIntent.setPackage(sDebugPackageName);
sContext.sendBroadcast(dbgIntent, android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE); sContext.sendBroadcast(dbgIntent, android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE);
} }
/** /**
* Initialize the DebugEventReporter with the current context. * Initialize the AnomalyReporter with the current context.
* *
* This method must be invoked before any calls to sendEvent() will succeed. This method should * This method must be invoked before any calls to reportAnomaly() will succeed. This method
* only be invoked at most once. * should only be invoked at most once.
* *
* @param context a Context object used to initialize this singleton DebugEventReporter in * @param context a Context object used to initialize this singleton AnomalyReporter in
* the current process. * the current process.
*/ */
@RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE)
public static void initialize(@NonNull Context context) { public static void initialize(@NonNull Context context) {
if (context == null) { if (context == null) {
throw new IllegalArgumentException("DebugEventReporter needs a non-null context."); throw new IllegalArgumentException("AnomalyReporter needs a non-null context.");
} }
// Ensure that this context has sufficient permissions to send debug events. // Ensure that this context has sufficient permissions to send debug events.
@@ -129,13 +128,13 @@ public final class DebugEventReporter {
PackageManager pm = sContext.getPackageManager(); PackageManager pm = sContext.getPackageManager();
if (pm == null) return; if (pm == null) return;
List<ResolveInfo> packages = pm.queryBroadcastReceivers( List<ResolveInfo> packages = pm.queryBroadcastReceivers(
new Intent(TelephonyManager.ACTION_DEBUG_EVENT), new Intent(TelephonyManager.ACTION_ANOMALY_REPORTED),
PackageManager.MATCH_SYSTEM_ONLY PackageManager.MATCH_SYSTEM_ONLY
| PackageManager.MATCH_DIRECT_BOOT_AWARE | PackageManager.MATCH_DIRECT_BOOT_AWARE
| PackageManager.MATCH_DIRECT_BOOT_UNAWARE); | PackageManager.MATCH_DIRECT_BOOT_UNAWARE);
if (packages == null || packages.isEmpty()) return; if (packages == null || packages.isEmpty()) return;
if (packages.size() > 1) { if (packages.size() > 1) {
Rlog.e(TAG, "Multiple DebugEvent Receivers installed."); Rlog.e(TAG, "Multiple Anomaly Receivers installed.");
} }
for (ResolveInfo r : packages) { for (ResolveInfo r : packages) {
@@ -156,14 +155,14 @@ public final class DebugEventReporter {
// Initialization may only be performed once. // Initialization may only be performed once.
} }
/** Dump the contents of the DebugEventReporter */ /** Dump the contents of the AnomalyReporter */
public static void dump(FileDescriptor fd, PrintWriter printWriter, String[] args) { public static void dump(FileDescriptor fd, PrintWriter printWriter, String[] args) {
if (sContext == null) return; if (sContext == null) return;
IndentingPrintWriter pw = new IndentingPrintWriter(printWriter, " "); IndentingPrintWriter pw = new IndentingPrintWriter(printWriter, " ");
sContext.enforceCallingOrSelfPermission(android.Manifest.permission.DUMP, "Requires DUMP"); sContext.enforceCallingOrSelfPermission(android.Manifest.permission.DUMP, "Requires DUMP");
pw.println("Initialized=" + (sContext != null ? "Yes" : "No")); pw.println("Initialized=" + (sContext != null ? "Yes" : "No"));
pw.println("Debug Package=" + sDebugPackageName); pw.println("Debug Package=" + sDebugPackageName);
pw.println("Event Counts:"); pw.println("Anomaly Counts:");
pw.increaseIndent(); pw.increaseIndent();
for (UUID event : sEvents.keySet()) { for (UUID event : sEvents.keySet()) {
pw.println(event + ": " + sEvents.get(event)); pw.println(event + ": " + sEvents.get(event));

View File

@@ -86,7 +86,7 @@ public abstract class CellIdentity implements Parcelable {
} }
if ((mMccStr != null && mMncStr == null) || (mMccStr == null && mMncStr != null)) { if ((mMccStr != null && mMncStr == null) || (mMccStr == null && mMncStr != null)) {
DebugEventReporter.sendEvent( AnomalyReporter.reportAnomaly(
UUID.fromString("a3ab0b9d-f2aa-4baf-911d-7096c0d4645a"), UUID.fromString("a3ab0b9d-f2aa-4baf-911d-7096c0d4645a"),
"CellIdentity Missing Half of PLMN ID"); "CellIdentity Missing Half of PLMN ID");
} }

View File

@@ -1370,41 +1370,42 @@ public class TelephonyManager {
* in the application manifest. For performance reasons, if no application to receive these * in the application manifest. For performance reasons, if no application to receive these
* events is detected at boot, then these events will not be sent. * events is detected at boot, then these events will not be sent.
* *
* <p>Each event will include an {@link EXTRA_DEBUG_EVENT_ID} that will uniquely identify the * <p>Each event will include an {@link EXTRA_ANOMALY_ID} that will uniquely identify the
* event that has occurred. Each event will be sent to the diagnostic monitor only once per * event that has occurred. Each event will be sent to the diagnostic monitor only once per
* boot cycle (as another optimization). * boot cycle (as another optimization).
* *
* @see #EXTRA_DEBUG_EVENT_ID * @see #EXTRA_ANOMALY_ID
* @see #EXTRA_DEBUG_EVENT_DESCRIPTION * @see #EXTRA_ANOMALY_DESCRIPTION
* @hide * @hide
*/ */
@SystemApi @SystemApi
@RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
public static final String ACTION_DEBUG_EVENT = "android.telephony.action.DEBUG_EVENT"; public static final String ACTION_ANOMALY_REPORTED =
"android.telephony.action.ANOMALY_REPORTED";
/** /**
* An arbitrary ParcelUuid which should be consistent for each occurrence of a DebugEvent. * An arbitrary ParcelUuid which should be consistent for each occurrence of a DebugEvent.
* *
* This field must be included in all {@link ACTION_DEBUG_EVENT} events. * This field must be included in all {@link ACTION_ANOMALY_REPORTED} events.
* *
* @see #ACTION_DEBUG_EVENT * @see #ACTION_ANOMALY_REPORTED
* @hide * @hide
*/ */
@SystemApi @SystemApi
public static final String EXTRA_DEBUG_EVENT_ID = "android.telephony.extra.DEBUG_EVENT_ID"; public static final String EXTRA_ANOMALY_ID = "android.telephony.extra.ANOMALY_ID";
/** /**
* A freeform string description of the DebugEvent. * A freeform string description of the Anomaly.
* *
* This field is optional for all {@link ACTION_DEBUG_EVENT}s, as a guideline should not * This field is optional for all {@link ACTION_ANOMALY_REPORTED}s, as a guideline should not
* exceed 80 characters, and should be as short as possible to convey the essence of the event. * exceed 80 characters, and should be as short as possible to convey the essence of the event.
* *
* @see #ACTION_DEBUG_EVENT * @see #ACTION_ANOMALY_REPORTED
* @hide * @hide
*/ */
@SystemApi @SystemApi
public static final String EXTRA_DEBUG_EVENT_DESCRIPTION = public static final String EXTRA_ANOMALY_DESCRIPTION =
"android.telephony.extra.DEBUG_EVENT_DESCRIPTION"; "android.telephony.extra.ANOMALY_DESCRIPTION";
// //
// //