summaryrefslogtreecommitdiff
path: root/core/java
diff options
context:
space:
mode:
authorTony Mak <tonymak@google.com>2017-12-18 20:34:14 +0000
committerTony Mak <tonymak@google.com>2017-12-20 17:04:15 +0000
commit089c35e9311386844332dbe2ca09076f845a604c (patch)
tree10edc35bd71ac49860015ca6c558f42805345a47 /core/java
parent5c9d80199e48322ab9939bc78d3ffeb224817a4c (diff)
Enforce platform level animation in CrossProfileApps.startMainActivity
With this change, whenever apps start an activity in another profile using CrossProfileApps.startMainActivity, an animation will be enforced. For now, we are showing the "open task" animation. We may put something fancier if we have time in P. Test: cts-tradefed run cts-dev --module DevicePolicyManager --test - com.android.cts.devicepolicy.CrossProfileAppsHostsideTest Test: atest services/tests/servicestests/src/com/android/server/pm/crossprofile/CrossProfileAppsServiceImplTest.java Bug: 70799822 Change-Id: I03525080151c6112633108419d69d64e76a511f3
Diffstat (limited to 'core/java')
-rw-r--r--core/java/android/app/ActivityOptions.java16
-rw-r--r--core/java/android/content/pm/crossprofile/CrossProfileApps.java10
-rw-r--r--core/java/android/content/pm/crossprofile/ICrossProfileApps.aidl3
3 files changed, 20 insertions, 9 deletions
diff --git a/core/java/android/app/ActivityOptions.java b/core/java/android/app/ActivityOptions.java
index 4a21f5c424d5..e61c5b7c78a1 100644
--- a/core/java/android/app/ActivityOptions.java
+++ b/core/java/android/app/ActivityOptions.java
@@ -36,6 +36,7 @@ import android.os.IRemoteCallback;
import android.os.Parcelable;
import android.os.RemoteException;
import android.os.ResultReceiver;
+import android.os.UserHandle;
import android.transition.Transition;
import android.transition.TransitionListenerAdapter;
import android.transition.TransitionManager;
@@ -265,6 +266,8 @@ public class ActivityOptions {
public static final int ANIM_CUSTOM_IN_PLACE = 10;
/** @hide */
public static final int ANIM_CLIP_REVEAL = 11;
+ /** @hide */
+ public static final int ANIM_OPEN_CROSS_PROFILE_APPS = 12;
private String mPackageName;
private Rect mLaunchBounds;
@@ -486,6 +489,19 @@ public class ActivityOptions {
}
/**
+ * Creates an {@link ActivityOptions} object specifying an animation where the new activity
+ * is started in another user profile by calling {@link
+ * android.content.pm.crossprofile.CrossProfileApps#startMainActivity(ComponentName, UserHandle)
+ * }.
+ * @hide
+ */
+ public static ActivityOptions makeOpenCrossProfileAppsAnimation() {
+ ActivityOptions options = new ActivityOptions();
+ options.mAnimationType = ANIM_OPEN_CROSS_PROFILE_APPS;
+ return options;
+ }
+
+ /**
* Create an ActivityOptions specifying an animation where a thumbnail
* is scaled from a given position to the new activity window that is
* being started.
diff --git a/core/java/android/content/pm/crossprofile/CrossProfileApps.java b/core/java/android/content/pm/crossprofile/CrossProfileApps.java
index c9f184a7da53..414c13894f80 100644
--- a/core/java/android/content/pm/crossprofile/CrossProfileApps.java
+++ b/core/java/android/content/pm/crossprofile/CrossProfileApps.java
@@ -16,7 +16,6 @@
package android.content.pm.crossprofile;
import android.annotation.NonNull;
-import android.annotation.Nullable;
import android.content.ComponentName;
import android.content.Context;
import android.content.res.Resources;
@@ -61,15 +60,10 @@ public class CrossProfileApps {
* @param user The UserHandle of the profile, must be one of the users returned by
* {@link #getTargetUserProfiles()}, otherwise a {@link SecurityException} will
* be thrown.
- * @param sourceBounds The Rect containing the source bounds of the clicked icon, see
- * {@link android.content.Intent#setSourceBounds(Rect)}.
- * @param startActivityOptions Options to pass to startActivity
*/
- public void startMainActivity(@NonNull ComponentName component, @NonNull UserHandle user,
- @Nullable Rect sourceBounds, @Nullable Bundle startActivityOptions) {
+ public void startMainActivity(@NonNull ComponentName component, @NonNull UserHandle user) {
try {
- mService.startActivityAsUser(mContext.getPackageName(),
- component, sourceBounds, startActivityOptions, user);
+ mService.startActivityAsUser(mContext.getPackageName(), component, user);
} catch (RemoteException ex) {
throw ex.rethrowFromSystemServer();
}
diff --git a/core/java/android/content/pm/crossprofile/ICrossProfileApps.aidl b/core/java/android/content/pm/crossprofile/ICrossProfileApps.aidl
index dd8d04f6cf0e..227f91f5d3e1 100644
--- a/core/java/android/content/pm/crossprofile/ICrossProfileApps.aidl
+++ b/core/java/android/content/pm/crossprofile/ICrossProfileApps.aidl
@@ -26,6 +26,7 @@ import android.os.UserHandle;
* @hide
*/
interface ICrossProfileApps {
- void startActivityAsUser(in String callingPackage, in ComponentName component, in Rect sourceBounds, in Bundle startActivityOptions, in UserHandle user);
+ void startActivityAsUser(in String callingPackage, in ComponentName component,
+ in UserHandle user);
List<UserHandle> getTargetUserProfiles(in String callingPackage);
} \ No newline at end of file