Merge "Initial implementation of logging metrics for bugreport." into nyc-dev
This commit is contained in:
@@ -41,6 +41,8 @@ import java.util.zip.ZipOutputStream;
|
|||||||
import libcore.io.Streams;
|
import libcore.io.Streams;
|
||||||
|
|
||||||
import com.android.internal.annotations.VisibleForTesting;
|
import com.android.internal.annotations.VisibleForTesting;
|
||||||
|
import com.android.internal.logging.MetricsLogger;
|
||||||
|
import com.android.internal.logging.MetricsProto.MetricsEvent;
|
||||||
import com.google.android.collect.Lists;
|
import com.google.android.collect.Lists;
|
||||||
|
|
||||||
import android.accounts.Account;
|
import android.accounts.Account;
|
||||||
@@ -506,6 +508,7 @@ public class BugreportProgressService extends Service {
|
|||||||
* Cancels a bugreport upon user's request.
|
* Cancels a bugreport upon user's request.
|
||||||
*/
|
*/
|
||||||
private void cancel(int id) {
|
private void cancel(int id) {
|
||||||
|
MetricsLogger.action(this, MetricsEvent.ACTION_BUGREPORT_NOTIFICATION_ACTION_CANCEL);
|
||||||
Log.v(TAG, "cancel: ID=" + id);
|
Log.v(TAG, "cancel: ID=" + id);
|
||||||
final BugreportInfo info = getInfo(id);
|
final BugreportInfo info = getInfo(id);
|
||||||
if (info != null && !info.finished) {
|
if (info != null && !info.finished) {
|
||||||
@@ -582,6 +585,7 @@ public class BugreportProgressService extends Service {
|
|||||||
* change its values.
|
* change its values.
|
||||||
*/
|
*/
|
||||||
private void launchBugreportInfoDialog(int id) {
|
private void launchBugreportInfoDialog(int id) {
|
||||||
|
MetricsLogger.action(this, MetricsEvent.ACTION_BUGREPORT_NOTIFICATION_ACTION_DETAILS);
|
||||||
// Copy values so it doesn't lock mProcesses while UI is being updated
|
// Copy values so it doesn't lock mProcesses while UI is being updated
|
||||||
final String name, title, description;
|
final String name, title, description;
|
||||||
final BugreportInfo info = getInfo(id);
|
final BugreportInfo info = getInfo(id);
|
||||||
@@ -610,6 +614,7 @@ public class BugreportProgressService extends Service {
|
|||||||
* upon receiving a {@link #INTENT_BUGREPORT_STARTED}.
|
* upon receiving a {@link #INTENT_BUGREPORT_STARTED}.
|
||||||
*/
|
*/
|
||||||
private void takeScreenshot(int id, boolean delayed) {
|
private void takeScreenshot(int id, boolean delayed) {
|
||||||
|
MetricsLogger.action(this, MetricsEvent.ACTION_BUGREPORT_NOTIFICATION_ACTION_SCREENSHOT);
|
||||||
if (getInfo(id) == null) {
|
if (getInfo(id) == null) {
|
||||||
// Most likely am killed Shell before user tapped the notification. Since system might
|
// Most likely am killed Shell before user tapped the notification. Since system might
|
||||||
// be too busy anwyays, it's better to ignore the notification and switch back to the
|
// be too busy anwyays, it's better to ignore the notification and switch back to the
|
||||||
@@ -859,6 +864,7 @@ public class BugreportProgressService extends Service {
|
|||||||
* intent, but issuing a warning dialog the first time.
|
* intent, but issuing a warning dialog the first time.
|
||||||
*/
|
*/
|
||||||
private void shareBugreport(int id, BugreportInfo sharedInfo) {
|
private void shareBugreport(int id, BugreportInfo sharedInfo) {
|
||||||
|
MetricsLogger.action(this, MetricsEvent.ACTION_BUGREPORT_NOTIFICATION_ACTION_SHARE);
|
||||||
BugreportInfo info = getInfo(id);
|
BugreportInfo info = getInfo(id);
|
||||||
if (info == null) {
|
if (info == null) {
|
||||||
// Service was terminated but notification persisted
|
// Service was terminated but notification persisted
|
||||||
@@ -1139,9 +1145,16 @@ public class BugreportProgressService extends Service {
|
|||||||
if (info == null) {
|
if (info == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (title != null && !title.equals(info.title)) {
|
||||||
|
MetricsLogger.action(this, MetricsEvent.ACTION_BUGREPORT_DETAILS_TITLE_CHANGED);
|
||||||
|
}
|
||||||
info.title = title;
|
info.title = title;
|
||||||
|
if (description != null && !description.equals(info.description)) {
|
||||||
|
MetricsLogger.action(this, MetricsEvent.ACTION_BUGREPORT_DETAILS_DESCRIPTION_CHANGED);
|
||||||
|
}
|
||||||
info.description = description;
|
info.description = description;
|
||||||
if (name != null && !name.equals(info.name)) {
|
if (name != null && !name.equals(info.name)) {
|
||||||
|
MetricsLogger.action(this, MetricsEvent.ACTION_BUGREPORT_DETAILS_NAME_CHANGED);
|
||||||
info.name = name;
|
info.name = name;
|
||||||
updateProgress(info);
|
updateProgress(info);
|
||||||
}
|
}
|
||||||
@@ -1229,7 +1242,7 @@ public class BugreportProgressService extends Service {
|
|||||||
/**
|
/**
|
||||||
* Sets its internal state and displays the dialog.
|
* Sets its internal state and displays the dialog.
|
||||||
*/
|
*/
|
||||||
private void initialize(Context context, BugreportInfo info) {
|
private void initialize(final Context context, BugreportInfo info) {
|
||||||
// First initializes singleton.
|
// First initializes singleton.
|
||||||
if (mDialog == null) {
|
if (mDialog == null) {
|
||||||
@SuppressLint("InflateParams")
|
@SuppressLint("InflateParams")
|
||||||
@@ -1263,6 +1276,8 @@ public class BugreportProgressService extends Service {
|
|||||||
@Override
|
@Override
|
||||||
public void onClick(DialogInterface dialog, int id)
|
public void onClick(DialogInterface dialog, int id)
|
||||||
{
|
{
|
||||||
|
MetricsLogger.action(context,
|
||||||
|
MetricsEvent.ACTION_BUGREPORT_DETAILS_CANCELED);
|
||||||
if (!mTempName.equals(mSavedName)) {
|
if (!mTempName.equals(mSavedName)) {
|
||||||
// Must restore dumpstate's name since it was changed
|
// Must restore dumpstate's name since it was changed
|
||||||
// before user clicked OK.
|
// before user clicked OK.
|
||||||
@@ -1307,6 +1322,7 @@ public class BugreportProgressService extends Service {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
|
MetricsLogger.action(context, MetricsEvent.ACTION_BUGREPORT_DETAILS_SAVED);
|
||||||
sanitizeName();
|
sanitizeName();
|
||||||
final String name = mInfoName.getText().toString();
|
final String name = mInfoName.getText().toString();
|
||||||
final String title = mInfoTitle.getText().toString();
|
final String title = mInfoTitle.getText().toString();
|
||||||
|
|||||||
@@ -369,5 +369,44 @@ message MetricsEvent {
|
|||||||
// Logged when the user saves a modification to notification importance. Negative numbers
|
// Logged when the user saves a modification to notification importance. Negative numbers
|
||||||
// indicate the user lowered the importance; positive means they increased it.
|
// indicate the user lowered the importance; positive means they increased it.
|
||||||
ACTION_SAVE_IMPORTANCE = 291;
|
ACTION_SAVE_IMPORTANCE = 291;
|
||||||
|
|
||||||
|
// Interactive bug report initiated from power menu.
|
||||||
|
ACTION_BUGREPORT_FROM_POWER_MENU_INTERACTIVE = 292;
|
||||||
|
|
||||||
|
// Full bug report initiated from power menu.
|
||||||
|
ACTION_BUGREPORT_FROM_POWER_MENU_FULL = 293;
|
||||||
|
|
||||||
|
// Interactive bug report initiated from Settings.
|
||||||
|
ACTION_BUGREPORT_FROM_SETTINGS_INTERACTIVE = 294;
|
||||||
|
|
||||||
|
// Full bug report initiated from Settings.
|
||||||
|
ACTION_BUGREPORT_FROM_SETTINGS_FULL = 295;
|
||||||
|
|
||||||
|
// Bug report canceled using system notification.
|
||||||
|
ACTION_BUGREPORT_NOTIFICATION_ACTION_CANCEL = 296;
|
||||||
|
|
||||||
|
// Bug report details screen open using system notification.
|
||||||
|
ACTION_BUGREPORT_NOTIFICATION_ACTION_DETAILS = 297;
|
||||||
|
|
||||||
|
// Additional Bug report screen shot taken using system notification.
|
||||||
|
ACTION_BUGREPORT_NOTIFICATION_ACTION_SCREENSHOT = 298;
|
||||||
|
|
||||||
|
// Bug report shared by user using system notification.
|
||||||
|
ACTION_BUGREPORT_NOTIFICATION_ACTION_SHARE = 299;
|
||||||
|
|
||||||
|
// User changed bug report name using the details screen.
|
||||||
|
ACTION_BUGREPORT_DETAILS_NAME_CHANGED = 300;
|
||||||
|
|
||||||
|
// User changed bug report title using the details screen.
|
||||||
|
ACTION_BUGREPORT_DETAILS_TITLE_CHANGED = 301;
|
||||||
|
|
||||||
|
// User changed bug report description using the details screen.
|
||||||
|
ACTION_BUGREPORT_DETAILS_DESCRIPTION_CHANGED = 302;
|
||||||
|
|
||||||
|
// Changes made on bug report details screen were saved by user.
|
||||||
|
ACTION_BUGREPORT_DETAILS_SAVED = 303;
|
||||||
|
|
||||||
|
// Changes made on bug report details screen were canceled by user.
|
||||||
|
ACTION_BUGREPORT_DETAILS_CANCELED = 304;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -388,6 +388,8 @@ class GlobalActions implements DialogInterface.OnDismissListener, DialogInterfac
|
|||||||
public void run() {
|
public void run() {
|
||||||
try {
|
try {
|
||||||
// Take an "interactive" bugreport.
|
// Take an "interactive" bugreport.
|
||||||
|
MetricsLogger.visible(this,
|
||||||
|
MetricsEvent.ACTION_BUGREPORT_FROM_POWER_MENU_INTERACTIVE);
|
||||||
ActivityManagerNative.getDefault().requestBugReport(
|
ActivityManagerNative.getDefault().requestBugReport(
|
||||||
ActivityManager.BUGREPORT_OPTION_INTERACTIVE);
|
ActivityManager.BUGREPORT_OPTION_INTERACTIVE);
|
||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
@@ -405,6 +407,8 @@ class GlobalActions implements DialogInterface.OnDismissListener, DialogInterfac
|
|||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
// Take a "full" bugreport.
|
// Take a "full" bugreport.
|
||||||
|
MetricsLogger.visible(this,
|
||||||
|
MetricsEvent.ACTION_BUGREPORT_FROM_POWER_MENU_FULL);
|
||||||
ActivityManagerNative.getDefault().requestBugReport(
|
ActivityManagerNative.getDefault().requestBugReport(
|
||||||
ActivityManager.BUGREPORT_OPTION_FULL);
|
ActivityManager.BUGREPORT_OPTION_FULL);
|
||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
|
|||||||
Reference in New Issue
Block a user