Construct ActivityOptions near top level
This saves some duplicate constructions of the ActivityOptions
object from Bundle.
Bug: 23755120
Change-Id: Ie8be54a2e4e84a6a1f3c51e4f2966f7fb0bf1c28
diff --git a/core/java/android/app/ActivityManagerNative.java b/core/java/android/app/ActivityManagerNative.java
index da743f8..7c3fcc3 100644
--- a/core/java/android/app/ActivityManagerNative.java
+++ b/core/java/android/app/ActivityManagerNative.java
@@ -1763,7 +1763,7 @@
} else {
bundle = data.readBundle();
}
- final ActivityOptions options = bundle == null ? null : new ActivityOptions(bundle);
+ final ActivityOptions options = ActivityOptions.fromBundle(bundle);
boolean converted = convertToTranslucent(token, options);
reply.writeNoException();
reply.writeInt(converted ? 1 : 0);
@@ -2504,7 +2504,7 @@
} else {
bundle = data.readBundle();
}
- final ActivityOptions options = bundle == null ? null : new ActivityOptions(bundle);
+ final ActivityOptions options = ActivityOptions.fromBundle(bundle);
startInPlaceAnimationOnFrontMostApplication(options);
reply.writeNoException();
return true;
@@ -4922,8 +4922,7 @@
data.writeStrongBinder(token);
mRemote.transact(GET_ACTIVITY_OPTIONS_TRANSACTION, data, reply, 0);
reply.readException();
- Bundle bundle = reply.readBundle();
- ActivityOptions options = bundle == null ? null : new ActivityOptions(bundle);
+ ActivityOptions options = ActivityOptions.fromBundle(reply.readBundle());
data.recycle();
reply.recycle();
return options;