summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author TreeHugger Robot <treehugger-gerrit@google.com> 2018-01-29 18:12:24 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2018-01-29 18:12:24 +0000
commitaf2397da51fbb83cef7a42547f2cb0efdcda417b (patch)
tree73cdd5a8492f7001b15e537577561acfd94a4fb2
parent1917ca9471b3a68f394e5aff60ae40945f114449 (diff)
parent83546a83edd5073d43de6fc1dd8400291ec0f7c0 (diff)
Merge "Defer cross profile animation is the activity is intercepted ... for work mode / work challenge"
-rw-r--r--services/core/java/com/android/server/am/ActivityStartInterceptor.java28
-rw-r--r--services/core/java/com/android/server/wm/AppTransition.java6
2 files changed, 24 insertions, 10 deletions
diff --git a/services/core/java/com/android/server/am/ActivityStartInterceptor.java b/services/core/java/com/android/server/am/ActivityStartInterceptor.java
index 0480646d4b0e..b86a8a6f2a8d 100644
--- a/services/core/java/com/android/server/am/ActivityStartInterceptor.java
+++ b/services/core/java/com/android/server/am/ActivityStartInterceptor.java
@@ -17,6 +17,7 @@
package com.android.server.am;
import static android.app.ActivityManager.INTENT_SENDER_ACTIVITY;
+import static android.app.ActivityOptions.ANIM_OPEN_CROSS_PROFILE_APPS;
import static android.app.PendingIntent.FLAG_CANCEL_CURRENT;
import static android.app.PendingIntent.FLAG_IMMUTABLE;
import static android.app.PendingIntent.FLAG_ONE_SHOT;
@@ -41,6 +42,7 @@ import android.content.pm.ActivityInfo;
import android.content.pm.ResolveInfo;
import android.content.pm.UserInfo;
import android.os.Binder;
+import android.os.Bundle;
import android.os.RemoteException;
import android.os.UserHandle;
import android.os.UserManager;
@@ -119,11 +121,12 @@ class ActivityStartInterceptor {
}
private IntentSender createIntentSenderForOriginalIntent(int callingUid, int flags) {
+ Bundle activityOptions = deferCrossProfileAppsAnimationIfNecessary();
final IIntentSender target = mService.getIntentSenderLocked(
INTENT_SENDER_ACTIVITY, mCallingPackage, callingUid, mUserId, null /*token*/,
null /*resultCode*/, 0 /*requestCode*/,
new Intent[] { mIntent }, new String[] { mResolvedType },
- flags, null /*bOptions*/);
+ flags, activityOptions);
return new IntentSender(target);
}
@@ -164,11 +167,27 @@ class ActivityStartInterceptor {
return interceptWorkProfileChallengeIfNeeded();
}
+ /**
+ * If the activity option is the {@link ActivityOptions#ANIM_OPEN_CROSS_PROFILE_APPS} one,
+ * defer the animation until the original intent is started.
+ *
+ * @return the activity option used to start the original intent.
+ */
+ private Bundle deferCrossProfileAppsAnimationIfNecessary() {
+ if (mActivityOptions != null
+ && mActivityOptions.getAnimationType() == ANIM_OPEN_CROSS_PROFILE_APPS) {
+ mActivityOptions = null;
+ return ActivityOptions.makeOpenCrossProfileAppsAnimation().toBundle();
+ }
+ return null;
+ }
+
private boolean interceptQuietProfileIfNeeded() {
// Do not intercept if the user has not turned off the profile
if (!mUserManager.isQuietModeEnabled(UserHandle.of(mUserId))) {
return false;
}
+
IntentSender target = createIntentSenderForOriginalIntent(mCallingUid,
FLAG_CANCEL_CURRENT | FLAG_ONE_SHOT);
@@ -210,8 +229,7 @@ class ActivityStartInterceptor {
}
private boolean interceptWorkProfileChallengeIfNeeded() {
- final Intent interceptingIntent = interceptWithConfirmCredentialsIfNeeded(mIntent,
- mResolvedType, mAInfo, mCallingPackage, mUserId);
+ final Intent interceptingIntent = interceptWithConfirmCredentialsIfNeeded(mAInfo, mUserId);
if (interceptingIntent == null) {
return false;
}
@@ -248,8 +266,7 @@ class ActivityStartInterceptor {
*
* @return The intercepting intent if needed.
*/
- private Intent interceptWithConfirmCredentialsIfNeeded(Intent intent, String resolvedType,
- ActivityInfo aInfo, String callingPackage, int userId) {
+ private Intent interceptWithConfirmCredentialsIfNeeded(ActivityInfo aInfo, int userId) {
if (!mUserController.shouldConfirmCredentials(userId)) {
return null;
}
@@ -296,5 +313,4 @@ class ActivityStartInterceptor {
mAInfo = mSupervisor.resolveActivity(mIntent, mRInfo, mStartFlags, null /*profilerInfo*/);
return true;
}
-
}
diff --git a/services/core/java/com/android/server/wm/AppTransition.java b/services/core/java/com/android/server/wm/AppTransition.java
index fc7ad09d5182..2bdaa1a66b7e 100644
--- a/services/core/java/com/android/server/wm/AppTransition.java
+++ b/services/core/java/com/android/server/wm/AppTransition.java
@@ -38,6 +38,7 @@ import static android.view.WindowManager.TRANSIT_WALLPAPER_CLOSE;
import static android.view.WindowManager.TRANSIT_WALLPAPER_INTRA_CLOSE;
import static android.view.WindowManager.TRANSIT_WALLPAPER_INTRA_OPEN;
import static android.view.WindowManager.TRANSIT_WALLPAPER_OPEN;
+
import static com.android.internal.R.styleable.WindowAnimation_activityCloseEnterAnimation;
import static com.android.internal.R.styleable.WindowAnimation_activityCloseExitAnimation;
import static com.android.internal.R.styleable.WindowAnimation_activityOpenEnterAnimation;
@@ -1647,10 +1648,7 @@ public class AppTransition implements Dump {
+ " transit=" + appTransitionToString(transit) + " isEntrance=" + enter
+ " Callers=" + Debug.getCallers(3));
}
- } else if (mNextAppTransitionType == NEXT_TRANSIT_TYPE_OPEN_CROSS_PROFILE_APPS
- && (transit == TRANSIT_ACTIVITY_OPEN
- || transit == TRANSIT_TASK_OPEN
- || transit == TRANSIT_TASK_TO_FRONT)) {
+ } else if (mNextAppTransitionType == NEXT_TRANSIT_TYPE_OPEN_CROSS_PROFILE_APPS && enter) {
a = loadAnimationRes("android", enter
? com.android.internal.R.anim.task_open_enter_cross_profile_apps