ActivityOptions.java revision cfbe9be5b3b701d95fb24fa0f7c8d9be43eec776
1/* 2 * Copyright (C) 2012 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17package android.app; 18 19import android.content.Context; 20import android.graphics.Bitmap; 21import android.os.Bundle; 22import android.os.Handler; 23import android.os.IRemoteCallback; 24import android.os.RemoteException; 25import android.text.TextUtils; 26import android.util.Log; 27import android.view.View; 28 29/** 30 * Helper class for building an options Bundle that can be used with 31 * {@link android.content.Context#startActivity(android.content.Intent, android.os.Bundle) 32 * Context.startActivity(Intent, Bundle)} and related methods. 33 */ 34public class ActivityOptions { 35 private static final String TAG = "ActivityOptions"; 36 37 /** 38 * The package name that created the options. 39 * @hide 40 */ 41 public static final String KEY_PACKAGE_NAME = "android:packageName"; 42 43 /** 44 * Type of animation that arguments specify. 45 * @hide 46 */ 47 public static final String KEY_ANIM_TYPE = "android:animType"; 48 49 /** 50 * Custom enter animation resource ID. 51 * @hide 52 */ 53 public static final String KEY_ANIM_ENTER_RES_ID = "android:animEnterRes"; 54 55 /** 56 * Custom exit animation resource ID. 57 * @hide 58 */ 59 public static final String KEY_ANIM_EXIT_RES_ID = "android:animExitRes"; 60 61 /** 62 * Bitmap for thumbnail animation. 63 * @hide 64 */ 65 public static final String KEY_ANIM_THUMBNAIL = "android:animThumbnail"; 66 67 /** 68 * Start X position of thumbnail animation. 69 * @hide 70 */ 71 public static final String KEY_ANIM_START_X = "android:animStartX"; 72 73 /** 74 * Start Y position of thumbnail animation. 75 * @hide 76 */ 77 public static final String KEY_ANIM_START_Y = "android:animStartY"; 78 79 /** 80 * Initial width of the animation. 81 * @hide 82 */ 83 public static final String KEY_ANIM_START_WIDTH = "android:animStartWidth"; 84 85 /** 86 * Initial height of the animation. 87 * @hide 88 */ 89 public static final String KEY_ANIM_START_HEIGHT = "android:animStartHeight"; 90 91 /** 92 * Callback for when animation is started. 93 * @hide 94 */ 95 public static final String KEY_ANIM_START_LISTENER = "android:animStartListener"; 96 97 /** 98 * A string array of names for the destination scene. This defines an API in the same 99 * way that intent action or extra names do and should follow a similar convention: 100 * "com.example.scene.FOO" 101 * 102 * @hide 103 */ 104 public static final String KEY_DEST_SCENE_NAMES = "android:destSceneNames"; 105 106 /** 107 * A string indicating the destination scene name that was chosen by the target. 108 * Used by {@link OnSceneTransitionStartedListener}. 109 * @hide 110 */ 111 public static final String KEY_DEST_SCENE_NAME_CHOSEN = "android:destSceneNameChosen"; 112 113 /** 114 * Callback for when scene transition is started. 115 * @hide 116 */ 117 public static final String KEY_SCENE_TRANSITION_START_LISTENER = 118 "android:sceneTransitionStartListener"; 119 120 /** 121 * Arguments for the scene transition about to begin. 122 * @hide 123 */ 124 public static final String KEY_SCENE_TRANSITION_ARGS = "android:sceneTransitionArgs"; 125 126 /** @hide */ 127 public static final int ANIM_NONE = 0; 128 /** @hide */ 129 public static final int ANIM_CUSTOM = 1; 130 /** @hide */ 131 public static final int ANIM_SCALE_UP = 2; 132 /** @hide */ 133 public static final int ANIM_THUMBNAIL_SCALE_UP = 3; 134 /** @hide */ 135 public static final int ANIM_THUMBNAIL_SCALE_DOWN = 4; 136 /** @hide */ 137 public static final int ANIM_SCENE_TRANSITION = 5; 138 139 private String mPackageName; 140 private int mAnimationType = ANIM_NONE; 141 private int mCustomEnterResId; 142 private int mCustomExitResId; 143 private Bitmap mThumbnail; 144 private int mStartX; 145 private int mStartY; 146 private int mStartWidth; 147 private int mStartHeight; 148 private String[] mDestSceneNames; 149 private Bundle mTransitionArgs; 150 private IRemoteCallback mAnimationStartedListener; 151 private IRemoteCallback mSceneTransitionStartedListener; 152 153 /** 154 * Create an ActivityOptions specifying a custom animation to run when 155 * the activity is displayed. 156 * 157 * @param context Who is defining this. This is the application that the 158 * animation resources will be loaded from. 159 * @param enterResId A resource ID of the animation resource to use for 160 * the incoming activity. Use 0 for no animation. 161 * @param exitResId A resource ID of the animation resource to use for 162 * the outgoing activity. Use 0 for no animation. 163 * @return Returns a new ActivityOptions object that you can use to 164 * supply these options as the options Bundle when starting an activity. 165 */ 166 public static ActivityOptions makeCustomAnimation(Context context, 167 int enterResId, int exitResId) { 168 return makeCustomAnimation(context, enterResId, exitResId, null, null); 169 } 170 171 /** 172 * Create an ActivityOptions specifying a custom animation to run when 173 * the activity is displayed. 174 * 175 * @param context Who is defining this. This is the application that the 176 * animation resources will be loaded from. 177 * @param enterResId A resource ID of the animation resource to use for 178 * the incoming activity. Use 0 for no animation. 179 * @param exitResId A resource ID of the animation resource to use for 180 * the outgoing activity. Use 0 for no animation. 181 * @param handler If <var>listener</var> is non-null this must be a valid 182 * Handler on which to dispatch the callback; otherwise it should be null. 183 * @param listener Optional OnAnimationStartedListener to find out when the 184 * requested animation has started running. If for some reason the animation 185 * is not executed, the callback will happen immediately. 186 * @return Returns a new ActivityOptions object that you can use to 187 * supply these options as the options Bundle when starting an activity. 188 * @hide 189 */ 190 public static ActivityOptions makeCustomAnimation(Context context, 191 int enterResId, int exitResId, Handler handler, OnAnimationStartedListener listener) { 192 ActivityOptions opts = new ActivityOptions(); 193 opts.mPackageName = context.getPackageName(); 194 opts.mAnimationType = ANIM_CUSTOM; 195 opts.mCustomEnterResId = enterResId; 196 opts.mCustomExitResId = exitResId; 197 opts.setOnAnimationStartedListener(handler, listener); 198 return opts; 199 } 200 201 private void setOnAnimationStartedListener(Handler handler, 202 OnAnimationStartedListener listener) { 203 if (listener != null) { 204 final Handler h = handler; 205 final OnAnimationStartedListener finalListener = listener; 206 mAnimationStartedListener = new IRemoteCallback.Stub() { 207 @Override public void sendResult(Bundle data) throws RemoteException { 208 h.post(new Runnable() { 209 @Override public void run() { 210 finalListener.onAnimationStarted(); 211 } 212 }); 213 } 214 }; 215 } 216 } 217 218 private void setOnSceneTransitionStartedListener(Handler handler, 219 OnSceneTransitionStartedListener listener) { 220 if (listener != null) { 221 final Handler h = handler; 222 final OnSceneTransitionStartedListener l = listener; 223 mSceneTransitionStartedListener = new IRemoteCallback.Stub() { 224 @Override public void sendResult(final Bundle data) throws RemoteException { 225 h.post(new Runnable() { 226 public void run() { 227 l.onSceneTransitionStarted(data != null ? 228 data.getString(KEY_DEST_SCENE_NAME_CHOSEN) : null); 229 } 230 }); 231 } 232 }; 233 } 234 } 235 236 /** 237 * Callback for use with {@link ActivityOptions#makeThumbnailScaleUpAnimation} 238 * to find out when the given animation has started running. 239 * @hide 240 */ 241 public interface OnAnimationStartedListener { 242 void onAnimationStarted(); 243 } 244 245 /** 246 * Callback for use with {@link ActivityOptions#makeSceneTransitionAnimation} 247 * to find out when a transition is about to begin. 248 * @hide 249 */ 250 public interface OnSceneTransitionStartedListener { 251 void onSceneTransitionStarted(String destSceneName); 252 } 253 254 /** 255 * Create an ActivityOptions specifying an animation where the new 256 * activity is scaled from a small originating area of the screen to 257 * its final full representation. 258 * 259 * <p>If the Intent this is being used with has not set its 260 * {@link android.content.Intent#setSourceBounds Intent.setSourceBounds}, 261 * those bounds will be filled in for you based on the initial 262 * bounds passed in here. 263 * 264 * @param source The View that the new activity is animating from. This 265 * defines the coordinate space for <var>startX</var> and <var>startY</var>. 266 * @param startX The x starting location of the new activity, relative to <var>source</var>. 267 * @param startY The y starting location of the activity, relative to <var>source</var>. 268 * @param startWidth The initial width of the new activity. 269 * @param startHeight The initial height of the new activity. 270 * @return Returns a new ActivityOptions object that you can use to 271 * supply these options as the options Bundle when starting an activity. 272 */ 273 public static ActivityOptions makeScaleUpAnimation(View source, 274 int startX, int startY, int startWidth, int startHeight) { 275 ActivityOptions opts = new ActivityOptions(); 276 opts.mPackageName = source.getContext().getPackageName(); 277 opts.mAnimationType = ANIM_SCALE_UP; 278 int[] pts = new int[2]; 279 source.getLocationOnScreen(pts); 280 opts.mStartX = pts[0] + startX; 281 opts.mStartY = pts[1] + startY; 282 opts.mStartWidth = startWidth; 283 opts.mStartHeight = startHeight; 284 return opts; 285 } 286 287 /** 288 * Create an ActivityOptions specifying an animation where a thumbnail 289 * is scaled from a given position to the new activity window that is 290 * being started. 291 * 292 * <p>If the Intent this is being used with has not set its 293 * {@link android.content.Intent#setSourceBounds Intent.setSourceBounds}, 294 * those bounds will be filled in for you based on the initial 295 * thumbnail location and size provided here. 296 * 297 * @param source The View that this thumbnail is animating from. This 298 * defines the coordinate space for <var>startX</var> and <var>startY</var>. 299 * @param thumbnail The bitmap that will be shown as the initial thumbnail 300 * of the animation. 301 * @param startX The x starting location of the bitmap, relative to <var>source</var>. 302 * @param startY The y starting location of the bitmap, relative to <var>source</var>. 303 * @return Returns a new ActivityOptions object that you can use to 304 * supply these options as the options Bundle when starting an activity. 305 */ 306 public static ActivityOptions makeThumbnailScaleUpAnimation(View source, 307 Bitmap thumbnail, int startX, int startY) { 308 return makeThumbnailScaleUpAnimation(source, thumbnail, startX, startY, null); 309 } 310 311 /** 312 * Create an ActivityOptions specifying an animation where a thumbnail 313 * is scaled from a given position to the new activity window that is 314 * being started. 315 * 316 * @param source The View that this thumbnail is animating from. This 317 * defines the coordinate space for <var>startX</var> and <var>startY</var>. 318 * @param thumbnail The bitmap that will be shown as the initial thumbnail 319 * of the animation. 320 * @param startX The x starting location of the bitmap, relative to <var>source</var>. 321 * @param startY The y starting location of the bitmap, relative to <var>source</var>. 322 * @param listener Optional OnAnimationStartedListener to find out when the 323 * requested animation has started running. If for some reason the animation 324 * is not executed, the callback will happen immediately. 325 * @return Returns a new ActivityOptions object that you can use to 326 * supply these options as the options Bundle when starting an activity. 327 * @hide 328 */ 329 public static ActivityOptions makeThumbnailScaleUpAnimation(View source, 330 Bitmap thumbnail, int startX, int startY, OnAnimationStartedListener listener) { 331 return makeThumbnailAnimation(source, thumbnail, startX, startY, listener, true); 332 } 333 334 /** 335 * Create an ActivityOptions specifying an animation where an activity window 336 * is scaled from a given position to a thumbnail at a specified location. 337 * 338 * @param source The View that this thumbnail is animating to. This 339 * defines the coordinate space for <var>startX</var> and <var>startY</var>. 340 * @param thumbnail The bitmap that will be shown as the final thumbnail 341 * of the animation. 342 * @param startX The x end location of the bitmap, relative to <var>source</var>. 343 * @param startY The y end location of the bitmap, relative to <var>source</var>. 344 * @param listener Optional OnAnimationStartedListener to find out when the 345 * requested animation has started running. If for some reason the animation 346 * is not executed, the callback will happen immediately. 347 * @return Returns a new ActivityOptions object that you can use to 348 * supply these options as the options Bundle when starting an activity. 349 * @hide 350 */ 351 public static ActivityOptions makeThumbnailScaleDownAnimation(View source, 352 Bitmap thumbnail, int startX, int startY, OnAnimationStartedListener listener) { 353 return makeThumbnailAnimation(source, thumbnail, startX, startY, listener, false); 354 } 355 356 private static ActivityOptions makeThumbnailAnimation(View source, 357 Bitmap thumbnail, int startX, int startY, OnAnimationStartedListener listener, 358 boolean scaleUp) { 359 ActivityOptions opts = new ActivityOptions(); 360 opts.mPackageName = source.getContext().getPackageName(); 361 opts.mAnimationType = scaleUp ? ANIM_THUMBNAIL_SCALE_UP : ANIM_THUMBNAIL_SCALE_DOWN; 362 opts.mThumbnail = thumbnail; 363 int[] pts = new int[2]; 364 source.getLocationOnScreen(pts); 365 opts.mStartX = pts[0] + startX; 366 opts.mStartY = pts[1] + startY; 367 opts.setOnAnimationStartedListener(source.getHandler(), listener); 368 return opts; 369 } 370 371 /** 372 * Create an ActivityOptions specifying an animation where an activity window is asked 373 * to perform animations within the window content. 374 * 375 * @hide 376 */ 377 public static ActivityOptions makeSceneTransitionAnimation(String[] destSceneNames, 378 Bundle args, OnSceneTransitionStartedListener listener, Handler handler) { 379 ActivityOptions opts = new ActivityOptions(); 380 opts.mAnimationType = ANIM_SCENE_TRANSITION; 381 opts.mDestSceneNames = destSceneNames; 382 opts.mTransitionArgs = args; 383 opts.setOnSceneTransitionStartedListener(handler, listener); 384 return opts; 385 } 386 387 private ActivityOptions() { 388 } 389 390 /** @hide */ 391 public ActivityOptions(Bundle opts) { 392 mPackageName = opts.getString(KEY_PACKAGE_NAME); 393 mAnimationType = opts.getInt(KEY_ANIM_TYPE); 394 switch (mAnimationType) { 395 case ANIM_CUSTOM: 396 mCustomEnterResId = opts.getInt(KEY_ANIM_ENTER_RES_ID, 0); 397 mCustomExitResId = opts.getInt(KEY_ANIM_EXIT_RES_ID, 0); 398 mAnimationStartedListener = IRemoteCallback.Stub.asInterface( 399 opts.getBinder(KEY_ANIM_START_LISTENER)); 400 break; 401 402 case ANIM_SCALE_UP: 403 mStartX = opts.getInt(KEY_ANIM_START_X, 0); 404 mStartY = opts.getInt(KEY_ANIM_START_Y, 0); 405 mStartWidth = opts.getInt(KEY_ANIM_START_WIDTH, 0); 406 mStartHeight = opts.getInt(KEY_ANIM_START_HEIGHT, 0); 407 break; 408 409 case ANIM_THUMBNAIL_SCALE_UP: 410 case ANIM_THUMBNAIL_SCALE_DOWN: 411 mThumbnail = (Bitmap)opts.getParcelable(KEY_ANIM_THUMBNAIL); 412 mStartX = opts.getInt(KEY_ANIM_START_X, 0); 413 mStartY = opts.getInt(KEY_ANIM_START_Y, 0); 414 mAnimationStartedListener = IRemoteCallback.Stub.asInterface( 415 opts.getBinder(KEY_ANIM_START_LISTENER)); 416 break; 417 418 case ANIM_SCENE_TRANSITION: 419 mDestSceneNames = opts.getStringArray(KEY_DEST_SCENE_NAMES); 420 mTransitionArgs = opts.getBundle(KEY_SCENE_TRANSITION_ARGS); 421 mSceneTransitionStartedListener = IRemoteCallback.Stub.asInterface( 422 opts.getBinder(KEY_SCENE_TRANSITION_START_LISTENER)); 423 break; 424 } 425 } 426 427 /** @hide */ 428 public String getPackageName() { 429 return mPackageName; 430 } 431 432 /** @hide */ 433 public int getAnimationType() { 434 return mAnimationType; 435 } 436 437 /** @hide */ 438 public int getCustomEnterResId() { 439 return mCustomEnterResId; 440 } 441 442 /** @hide */ 443 public int getCustomExitResId() { 444 return mCustomExitResId; 445 } 446 447 /** @hide */ 448 public Bitmap getThumbnail() { 449 return mThumbnail; 450 } 451 452 /** @hide */ 453 public int getStartX() { 454 return mStartX; 455 } 456 457 /** @hide */ 458 public int getStartY() { 459 return mStartY; 460 } 461 462 /** @hide */ 463 public int getStartWidth() { 464 return mStartWidth; 465 } 466 467 /** @hide */ 468 public int getStartHeight() { 469 return mStartHeight; 470 } 471 472 /** @hide */ 473 public String[] getDestSceneNames() { 474 return mDestSceneNames; 475 } 476 477 /** @hide */ 478 public Bundle getSceneTransitionArgs() { 479 return mTransitionArgs; 480 } 481 482 /** @hide */ 483 public IRemoteCallback getOnAnimationStartListener() { 484 return mAnimationStartedListener; 485 } 486 487 /** @hide */ 488 public void dispatchSceneTransitionStarted(String destScene) { 489 if (mSceneTransitionStartedListener != null) { 490 Bundle data = null; 491 if (!TextUtils.isEmpty(destScene)) { 492 data = new Bundle(); 493 data.putString(KEY_DEST_SCENE_NAME_CHOSEN, destScene); 494 } 495 try { 496 mSceneTransitionStartedListener.sendResult(data); 497 } catch (RemoteException e) { 498 Log.e(TAG, "Caught exception dispatching scene transition start", e); 499 } 500 } 501 } 502 503 /** @hide */ 504 public void abort() { 505 if (mAnimationStartedListener != null) { 506 try { 507 mAnimationStartedListener.sendResult(null); 508 } catch (RemoteException e) { 509 } 510 } 511 if (mSceneTransitionStartedListener != null) { 512 try { 513 mSceneTransitionStartedListener.sendResult(null); 514 } catch (RemoteException e) { 515 } 516 } 517 } 518 519 /** @hide */ 520 public static void abort(Bundle options) { 521 if (options != null) { 522 (new ActivityOptions(options)).abort(); 523 } 524 } 525 526 /** 527 * Update the current values in this ActivityOptions from those supplied 528 * in <var>otherOptions</var>. Any values 529 * defined in <var>otherOptions</var> replace those in the base options. 530 */ 531 public void update(ActivityOptions otherOptions) { 532 if (otherOptions.mPackageName != null) { 533 mPackageName = otherOptions.mPackageName; 534 } 535 switch (otherOptions.mAnimationType) { 536 case ANIM_CUSTOM: 537 mAnimationType = otherOptions.mAnimationType; 538 mCustomEnterResId = otherOptions.mCustomEnterResId; 539 mCustomExitResId = otherOptions.mCustomExitResId; 540 mThumbnail = null; 541 if (mAnimationStartedListener != null) { 542 try { 543 mAnimationStartedListener.sendResult(null); 544 } catch (RemoteException e) { 545 } 546 } 547 mAnimationStartedListener = otherOptions.mAnimationStartedListener; 548 mSceneTransitionStartedListener = null; 549 mTransitionArgs = null; 550 mDestSceneNames = null; 551 break; 552 case ANIM_SCALE_UP: 553 mAnimationType = otherOptions.mAnimationType; 554 mStartX = otherOptions.mStartX; 555 mStartY = otherOptions.mStartY; 556 mStartWidth = otherOptions.mStartWidth; 557 mStartHeight = otherOptions.mStartHeight; 558 if (mAnimationStartedListener != null) { 559 try { 560 mAnimationStartedListener.sendResult(null); 561 } catch (RemoteException e) { 562 } 563 } 564 mAnimationStartedListener = null; 565 mSceneTransitionStartedListener = null; 566 mTransitionArgs = null; 567 mDestSceneNames = null; 568 break; 569 case ANIM_THUMBNAIL_SCALE_UP: 570 case ANIM_THUMBNAIL_SCALE_DOWN: 571 mAnimationType = otherOptions.mAnimationType; 572 mThumbnail = otherOptions.mThumbnail; 573 mStartX = otherOptions.mStartX; 574 mStartY = otherOptions.mStartY; 575 if (mAnimationStartedListener != null) { 576 try { 577 mAnimationStartedListener.sendResult(null); 578 } catch (RemoteException e) { 579 } 580 } 581 mAnimationStartedListener = otherOptions.mAnimationStartedListener; 582 mSceneTransitionStartedListener = null; 583 mTransitionArgs = null; 584 mDestSceneNames = null; 585 break; 586 case ANIM_SCENE_TRANSITION: 587 mAnimationType = otherOptions.mAnimationType; 588 if (mSceneTransitionStartedListener != null) { 589 try { 590 mSceneTransitionStartedListener.sendResult(null); 591 } catch (RemoteException e) { 592 } 593 } 594 mSceneTransitionStartedListener = otherOptions.mSceneTransitionStartedListener; 595 mDestSceneNames = otherOptions.mDestSceneNames; 596 mTransitionArgs = otherOptions.mTransitionArgs; 597 mThumbnail = null; 598 mAnimationStartedListener = null; 599 break; 600 } 601 } 602 603 /** 604 * Returns the created options as a Bundle, which can be passed to 605 * {@link android.content.Context#startActivity(android.content.Intent, android.os.Bundle) 606 * Context.startActivity(Intent, Bundle)} and related methods. 607 * Note that the returned Bundle is still owned by the ActivityOptions 608 * object; you must not modify it, but can supply it to the startActivity 609 * methods that take an options Bundle. 610 */ 611 public Bundle toBundle() { 612 Bundle b = new Bundle(); 613 if (mPackageName != null) { 614 b.putString(KEY_PACKAGE_NAME, mPackageName); 615 } 616 switch (mAnimationType) { 617 case ANIM_CUSTOM: 618 b.putInt(KEY_ANIM_TYPE, mAnimationType); 619 b.putInt(KEY_ANIM_ENTER_RES_ID, mCustomEnterResId); 620 b.putInt(KEY_ANIM_EXIT_RES_ID, mCustomExitResId); 621 b.putBinder(KEY_ANIM_START_LISTENER, mAnimationStartedListener 622 != null ? mAnimationStartedListener.asBinder() : null); 623 break; 624 case ANIM_SCALE_UP: 625 b.putInt(KEY_ANIM_TYPE, mAnimationType); 626 b.putInt(KEY_ANIM_START_X, mStartX); 627 b.putInt(KEY_ANIM_START_Y, mStartY); 628 b.putInt(KEY_ANIM_START_WIDTH, mStartWidth); 629 b.putInt(KEY_ANIM_START_HEIGHT, mStartHeight); 630 break; 631 case ANIM_THUMBNAIL_SCALE_UP: 632 case ANIM_THUMBNAIL_SCALE_DOWN: 633 b.putInt(KEY_ANIM_TYPE, mAnimationType); 634 b.putParcelable(KEY_ANIM_THUMBNAIL, mThumbnail); 635 b.putInt(KEY_ANIM_START_X, mStartX); 636 b.putInt(KEY_ANIM_START_Y, mStartY); 637 b.putBinder(KEY_ANIM_START_LISTENER, mAnimationStartedListener 638 != null ? mAnimationStartedListener.asBinder() : null); 639 break; 640 case ANIM_SCENE_TRANSITION: 641 b.putInt(KEY_ANIM_TYPE, mAnimationType); 642 b.putStringArray(KEY_DEST_SCENE_NAMES, mDestSceneNames); 643 b.putBundle(KEY_SCENE_TRANSITION_ARGS, mTransitionArgs); 644 b.putBinder(KEY_SCENE_TRANSITION_START_LISTENER, mSceneTransitionStartedListener 645 != null ? mSceneTransitionStartedListener.asBinder() : null); 646 break; 647 } 648 return b; 649 } 650 651 /** 652 * Return the filtered options only meant to be seen by the target activity itself 653 * @hide 654 */ 655 public ActivityOptions forTargetActivity() { 656 if (mAnimationType == ANIM_SCENE_TRANSITION) { 657 final ActivityOptions result = new ActivityOptions(); 658 result.update(this); 659 return result; 660 } 661 662 return null; 663 } 664} 665