Skip to content

Commit a4972e9

Browse files
author
Dianne Hackborn
committed
Add new "options" argument to all startActivity APIs.
This will be used to allow new features to be requested... such as, say, a special kind of animation. Right now there are no options defined. Change-Id: I4eb6f27275cdd4bf186f6da316ab93a2372ad4b7
1 parent 89ea4ca commit a4972e9

File tree

20 files changed

+871
-374
lines changed

20 files changed

+871
-374
lines changed

api/current.txt

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2688,13 +2688,20 @@ package android.app {
26882688
method public final deprecated boolean showDialog(int, android.os.Bundle);
26892689
method public android.view.ActionMode startActionMode(android.view.ActionMode.Callback);
26902690
method public void startActivityForResult(android.content.Intent, int);
2691+
method public void startActivityForResult(android.content.Intent, int, android.os.Bundle);
26912692
method public void startActivityFromChild(android.app.Activity, android.content.Intent, int);
2693+
method public void startActivityFromChild(android.app.Activity, android.content.Intent, int, android.os.Bundle);
26922694
method public void startActivityFromFragment(android.app.Fragment, android.content.Intent, int);
2695+
method public void startActivityFromFragment(android.app.Fragment, android.content.Intent, int, android.os.Bundle);
26932696
method public boolean startActivityIfNeeded(android.content.Intent, int);
2697+
method public boolean startActivityIfNeeded(android.content.Intent, int, android.os.Bundle);
26942698
method public void startIntentSenderForResult(android.content.IntentSender, int, android.content.Intent, int, int, int) throws android.content.IntentSender.SendIntentException;
2699+
method public void startIntentSenderForResult(android.content.IntentSender, int, android.content.Intent, int, int, int, android.os.Bundle) throws android.content.IntentSender.SendIntentException;
26952700
method public void startIntentSenderFromChild(android.app.Activity, android.content.IntentSender, int, android.content.Intent, int, int, int) throws android.content.IntentSender.SendIntentException;
2701+
method public void startIntentSenderFromChild(android.app.Activity, android.content.IntentSender, int, android.content.Intent, int, int, int, android.os.Bundle) throws android.content.IntentSender.SendIntentException;
26962702
method public deprecated void startManagingCursor(android.database.Cursor);
26972703
method public boolean startNextMatchingActivity(android.content.Intent);
2704+
method public boolean startNextMatchingActivity(android.content.Intent, android.os.Bundle);
26982705
method public void startSearch(java.lang.String, boolean, android.os.Bundle, boolean);
26992706
method public deprecated void stopManagingCursor(android.database.Cursor);
27002707
method public void takeKeyEvents(boolean);
@@ -3320,7 +3327,9 @@ package android.app {
33203327
method public void setTargetFragment(android.app.Fragment, int);
33213328
method public void setUserVisibleHint(boolean);
33223329
method public void startActivity(android.content.Intent);
3330+
method public void startActivity(android.content.Intent, android.os.Bundle);
33233331
method public void startActivityForResult(android.content.Intent, int);
3332+
method public void startActivityForResult(android.content.Intent, int, android.os.Bundle);
33243333
method public void unregisterForContextMenu(android.view.View);
33253334
}
33263335

@@ -5149,9 +5158,12 @@ package android.content {
51495158
method public abstract deprecated void setWallpaper(android.graphics.Bitmap) throws java.io.IOException;
51505159
method public abstract deprecated void setWallpaper(java.io.InputStream) throws java.io.IOException;
51515160
method public abstract void startActivities(android.content.Intent[]);
5161+
method public abstract void startActivities(android.content.Intent[], android.os.Bundle);
51525162
method public abstract void startActivity(android.content.Intent);
5163+
method public abstract void startActivity(android.content.Intent, android.os.Bundle);
51535164
method public abstract boolean startInstrumentation(android.content.ComponentName, java.lang.String, android.os.Bundle);
51545165
method public abstract void startIntentSender(android.content.IntentSender, android.content.Intent, int, int, int) throws android.content.IntentSender.SendIntentException;
5166+
method public abstract void startIntentSender(android.content.IntentSender, android.content.Intent, int, int, int, android.os.Bundle) throws android.content.IntentSender.SendIntentException;
51555167
method public abstract android.content.ComponentName startService(android.content.Intent);
51565168
method public abstract boolean stopService(android.content.Intent);
51575169
method public abstract void unbindService(android.content.ServiceConnection);
@@ -5274,9 +5286,12 @@ package android.content {
52745286
method public void setWallpaper(android.graphics.Bitmap) throws java.io.IOException;
52755287
method public void setWallpaper(java.io.InputStream) throws java.io.IOException;
52765288
method public void startActivities(android.content.Intent[]);
5289+
method public void startActivities(android.content.Intent[], android.os.Bundle);
52775290
method public void startActivity(android.content.Intent);
5291+
method public void startActivity(android.content.Intent, android.os.Bundle);
52785292
method public boolean startInstrumentation(android.content.ComponentName, java.lang.String, android.os.Bundle);
52795293
method public void startIntentSender(android.content.IntentSender, android.content.Intent, int, int, int) throws android.content.IntentSender.SendIntentException;
5294+
method public void startIntentSender(android.content.IntentSender, android.content.Intent, int, int, int, android.os.Bundle) throws android.content.IntentSender.SendIntentException;
52805295
method public android.content.ComponentName startService(android.content.Intent);
52815296
method public boolean stopService(android.content.Intent);
52825297
method public void unbindService(android.content.ServiceConnection);
@@ -19926,9 +19941,12 @@ package android.test.mock {
1992619941
method public void setWallpaper(android.graphics.Bitmap) throws java.io.IOException;
1992719942
method public void setWallpaper(java.io.InputStream) throws java.io.IOException;
1992819943
method public void startActivities(android.content.Intent[]);
19944+
method public void startActivities(android.content.Intent[], android.os.Bundle);
1992919945
method public void startActivity(android.content.Intent);
19946+
method public void startActivity(android.content.Intent, android.os.Bundle);
1993019947
method public boolean startInstrumentation(android.content.ComponentName, java.lang.String, android.os.Bundle);
1993119948
method public void startIntentSender(android.content.IntentSender, android.content.Intent, int, int, int) throws android.content.IntentSender.SendIntentException;
19949+
method public void startIntentSender(android.content.IntentSender, android.content.Intent, int, int, int, android.os.Bundle) throws android.content.IntentSender.SendIntentException;
1993219950
method public android.content.ComponentName startService(android.content.Intent);
1993319951
method public boolean stopService(android.content.Intent);
1993419952
method public void unbindService(android.content.ServiceConnection);

cmds/am/src/com/android/commands/am/Am.java

Lines changed: 17 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -57,16 +57,13 @@ public class Am {
5757
private int mNextArg;
5858
private String mCurArgData;
5959

60-
private boolean mDebugOption = false;
60+
private int mStartFlags = 0;
6161
private boolean mWaitOption = false;
6262
private boolean mStopOption = false;
6363

64-
private boolean mOpenglTraceOption = false;
65-
6664
private int mRepeat = 0;
6765

6866
private String mProfileFile;
69-
private boolean mProfileAutoStop;
7067

7168
// These are magic strings understood by the Eclipse plugin.
7269
private static final String FATAL_ERROR_CODE = "Error type 1";
@@ -150,10 +147,9 @@ private Intent makeIntent() throws URISyntaxException {
150147
Intent baseIntent = intent;
151148
boolean hasIntentInfo = false;
152149

153-
mDebugOption = false;
150+
mStartFlags = 0;
154151
mWaitOption = false;
155152
mStopOption = false;
156-
mOpenglTraceOption = false;
157153
mRepeat = 0;
158154
mProfileFile = null;
159155
Uri data = null;
@@ -297,21 +293,21 @@ private Intent makeIntent() throws URISyntaxException {
297293
intent.setDataAndType(data, type);
298294
intent = new Intent();
299295
} else if (opt.equals("-D")) {
300-
mDebugOption = true;
296+
mStartFlags |= ActivityManager.START_FLAG_DEBUG;
301297
} else if (opt.equals("-W")) {
302298
mWaitOption = true;
303299
} else if (opt.equals("-P")) {
304300
mProfileFile = nextArgRequired();
305-
mProfileAutoStop = true;
301+
mStartFlags |= ActivityManager.START_FLAG_AUTO_STOP_PROFILER;
306302
} else if (opt.equals("--start-profiler")) {
307303
mProfileFile = nextArgRequired();
308-
mProfileAutoStop = false;
304+
mStartFlags &= ~ActivityManager.START_FLAG_AUTO_STOP_PROFILER;
309305
} else if (opt.equals("-R")) {
310306
mRepeat = Integer.parseInt(nextArgRequired());
311307
} else if (opt.equals("-S")) {
312308
mStopOption = true;
313309
} else if (opt.equals("--opengl-trace")) {
314-
mOpenglTraceOption = true;
310+
mStartFlags |= ActivityManager.START_FLAG_OPENGL_TRACES;
315311
} else {
316312
System.err.println("Error: Unknown option: " + opt);
317313
showUsage();
@@ -450,64 +446,60 @@ private void runStart() throws Exception {
450446
int res;
451447
if (mWaitOption) {
452448
result = mAm.startActivityAndWait(null, intent, mimeType,
453-
null, 0, null, null, 0, false,
454-
mDebugOption, mOpenglTraceOption,
455-
mProfileFile, fd, mProfileAutoStop);
449+
null, null, 0, mStartFlags, mProfileFile, fd, null);
456450
res = result.result;
457451
} else {
458452
res = mAm.startActivity(null, intent, mimeType,
459-
null, 0, null, null, 0, false,
460-
mDebugOption, mOpenglTraceOption,
461-
mProfileFile, fd, mProfileAutoStop);
453+
null, null, 0, mStartFlags, mProfileFile, fd, null);
462454
}
463455
PrintStream out = mWaitOption ? System.out : System.err;
464456
boolean launched = false;
465457
switch (res) {
466-
case IActivityManager.START_SUCCESS:
458+
case ActivityManager.START_SUCCESS:
467459
launched = true;
468460
break;
469-
case IActivityManager.START_SWITCHES_CANCELED:
461+
case ActivityManager.START_SWITCHES_CANCELED:
470462
launched = true;
471463
out.println(
472464
"Warning: Activity not started because the "
473465
+ " current activity is being kept for the user.");
474466
break;
475-
case IActivityManager.START_DELIVERED_TO_TOP:
467+
case ActivityManager.START_DELIVERED_TO_TOP:
476468
launched = true;
477469
out.println(
478470
"Warning: Activity not started, intent has "
479471
+ "been delivered to currently running "
480472
+ "top-most instance.");
481473
break;
482-
case IActivityManager.START_RETURN_INTENT_TO_CALLER:
474+
case ActivityManager.START_RETURN_INTENT_TO_CALLER:
483475
launched = true;
484476
out.println(
485477
"Warning: Activity not started because intent "
486478
+ "should be handled by the caller");
487479
break;
488-
case IActivityManager.START_TASK_TO_FRONT:
480+
case ActivityManager.START_TASK_TO_FRONT:
489481
launched = true;
490482
out.println(
491483
"Warning: Activity not started, its current "
492484
+ "task has been brought to the front");
493485
break;
494-
case IActivityManager.START_INTENT_NOT_RESOLVED:
486+
case ActivityManager.START_INTENT_NOT_RESOLVED:
495487
out.println(
496488
"Error: Activity not started, unable to "
497489
+ "resolve " + intent.toString());
498490
break;
499-
case IActivityManager.START_CLASS_NOT_FOUND:
491+
case ActivityManager.START_CLASS_NOT_FOUND:
500492
out.println(NO_CLASS_ERROR_CODE);
501493
out.println("Error: Activity class " +
502494
intent.getComponent().toShortString()
503495
+ " does not exist.");
504496
break;
505-
case IActivityManager.START_FORWARD_AND_REQUEST_CONFLICT:
497+
case ActivityManager.START_FORWARD_AND_REQUEST_CONFLICT:
506498
out.println(
507499
"Error: Activity not started, you requested to "
508500
+ "both forward and receive its result");
509501
break;
510-
case IActivityManager.START_PERMISSION_DENIED:
502+
case ActivityManager.START_PERMISSION_DENIED:
511503
out.println(
512504
"Error: Activity not started, you do not "
513505
+ "have permission to access it.");

0 commit comments

Comments
 (0)