summaryrefslogtreecommitdiffstats
path: root/cmds
diff options
context:
space:
mode:
authorDianne Hackborn <hackbod@google.com>2009-06-24 16:25:26 -0700
committerThe Android Open Source Project <initial-contribution@android.com>2009-06-24 16:25:26 -0700
commitafed82bca9e173cabe2c2f25314b202e5c1ccbca (patch)
tree1179ebc7b545a1f51de557dc78fc2d141c8f1e74 /cmds
parent465913c7ef4aac6124a281449c857106db3dd0a5 (diff)
parent9c8dd55a9d829c29a3feee9469d8c2f27a9f5516 (diff)
downloadframeworks_base-afed82bca9e173cabe2c2f25314b202e5c1ccbca.zip
frameworks_base-afed82bca9e173cabe2c2f25314b202e5c1ccbca.tar.gz
frameworks_base-afed82bca9e173cabe2c2f25314b202e5c1ccbca.tar.bz2
am 9c8dd55a: Fix bug 1829561 ("am profile" with bad filename kills process).
Merge commit '9c8dd55a9d829c29a3feee9469d8c2f27a9f5516' * commit '9c8dd55a9d829c29a3feee9469d8c2f27a9f5516': Fix bug 1829561 ("am profile" with bad filename kills process).
Diffstat (limited to 'cmds')
-rw-r--r--cmds/am/src/com/android/commands/am/Am.java19
1 files changed, 17 insertions, 2 deletions
diff --git a/cmds/am/src/com/android/commands/am/Am.java b/cmds/am/src/com/android/commands/am/Am.java
index 2a4a672..3782136 100644
--- a/cmds/am/src/com/android/commands/am/Am.java
+++ b/cmds/am/src/com/android/commands/am/Am.java
@@ -26,10 +26,13 @@ import android.content.ComponentName;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
+import android.os.ParcelFileDescriptor;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.view.IWindowManager;
+import java.io.File;
+import java.io.FileNotFoundException;
import java.util.Iterator;
import java.util.Set;
@@ -446,6 +449,8 @@ public class Am {
return;
}
+ ParcelFileDescriptor fd = null;
+
String cmd = nextArg();
if ("start".equals(cmd)) {
start = true;
@@ -455,6 +460,16 @@ public class Am {
showUsage();
return;
}
+ try {
+ fd = ParcelFileDescriptor.open(
+ new File(profileFile),
+ ParcelFileDescriptor.MODE_CREATE |
+ ParcelFileDescriptor.MODE_TRUNCATE |
+ ParcelFileDescriptor.MODE_READ_WRITE);
+ } catch (FileNotFoundException e) {
+ System.err.println("Error: Unable to open file: " + profileFile);
+ return;
+ }
} else if (!"stop".equals(cmd)) {
System.err.println("Error: Profile command " + cmd + " not valid");
showUsage();
@@ -462,8 +477,8 @@ public class Am {
}
try {
- if (!mAm.profileControl(process, start, profileFile)) {
- System.out.println("PROFILE FAILED on process " + process);
+ if (!mAm.profileControl(process, start, profileFile, fd)) {
+ System.err.println("PROFILE FAILED on process " + process);
return;
}
} catch (IllegalArgumentException e) {