Merge "Do not re-define remote bugreport constants defined in DevicePolicyManager" into nyc-dev

This commit is contained in:
Michal Karpinski
2016-03-07 11:02:18 +00:00
committed by Android (Google) Code Review
2 changed files with 5 additions and 8 deletions

View File

@@ -121,8 +121,6 @@ public class BugreportProgressService extends Service {
static final String INTENT_BUGREPORT_FINISHED = "android.intent.action.BUGREPORT_FINISHED";
static final String INTENT_REMOTE_BUGREPORT_FINISHED =
"android.intent.action.REMOTE_BUGREPORT_FINISHED";
static final String INTENT_REMOTE_BUGREPORT_DISPATCH =
"android.intent.action.REMOTE_BUGREPORT_DISPATCH";
// Internal intents used on notification actions.
static final String INTENT_BUGREPORT_CANCEL = "android.intent.action.BUGREPORT_CANCEL";

View File

@@ -18,13 +18,13 @@ package com.android.shell;
import static com.android.shell.BugreportProgressService.EXTRA_BUGREPORT;
import static com.android.shell.BugreportProgressService.INTENT_REMOTE_BUGREPORT_FINISHED;
import static com.android.shell.BugreportProgressService.INTENT_REMOTE_BUGREPORT_DISPATCH;
import static com.android.shell.BugreportProgressService.getFileExtra;
import static com.android.shell.BugreportProgressService.getUri;
import static com.android.shell.BugreportReceiver.cleanupOldFiles;
import java.io.File;
import android.app.admin.DevicePolicyManager;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
@@ -41,8 +41,6 @@ import android.text.format.DateUtils;
public class RemoteBugreportReceiver extends BroadcastReceiver {
private static final String BUGREPORT_MIMETYPE = "application/vnd.android.bugreport";
private static final String EXTRA_REMOTE_BUGREPORT_HASH =
"android.intent.extra.REMOTE_BUGREPORT_HASH";
/** Always keep just the last remote bugreport's files around. */
private static final int REMOTE_BUGREPORT_FILES_AMOUNT = 3;
@@ -57,11 +55,12 @@ public class RemoteBugreportReceiver extends BroadcastReceiver {
final File bugreportFile = getFileExtra(intent, EXTRA_BUGREPORT);
final Uri bugreportUri = getUri(context, bugreportFile);
final String bugreportHash = intent.getStringExtra(EXTRA_REMOTE_BUGREPORT_HASH);
final String bugreportHash = intent.getStringExtra(
DevicePolicyManager.EXTRA_REMOTE_BUGREPORT_HASH);
final Intent newIntent = new Intent(INTENT_REMOTE_BUGREPORT_DISPATCH);
final Intent newIntent = new Intent(DevicePolicyManager.ACTION_REMOTE_BUGREPORT_DISPATCH);
newIntent.setDataAndType(bugreportUri, BUGREPORT_MIMETYPE);
newIntent.putExtra(EXTRA_REMOTE_BUGREPORT_HASH, bugreportHash);
newIntent.putExtra(DevicePolicyManager.EXTRA_REMOTE_BUGREPORT_HASH, bugreportHash);
context.sendBroadcastAsUser(newIntent, UserHandle.SYSTEM,
android.Manifest.permission.DUMP);
}