Merge "Add AppTransition type and remote animation for Dream in occluding Keyguard." into tm-qpr-dev am: f8e4efccda
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/19469267 Change-Id: I2219888527f5ddd3af3d79ea1db54caeade38ea1 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -285,11 +285,17 @@ public interface WindowManager extends ViewManager {
|
|||||||
int TRANSIT_OLD_KEYGUARD_GOING_AWAY_ON_WALLPAPER = 21;
|
int TRANSIT_OLD_KEYGUARD_GOING_AWAY_ON_WALLPAPER = 21;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Keyguard is being occluded.
|
* Keyguard is being occluded by non-Dream.
|
||||||
* @hide
|
* @hide
|
||||||
*/
|
*/
|
||||||
int TRANSIT_OLD_KEYGUARD_OCCLUDE = 22;
|
int TRANSIT_OLD_KEYGUARD_OCCLUDE = 22;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Keyguard is being occluded by Dream.
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
int TRANSIT_OLD_KEYGUARD_OCCLUDE_BY_DREAM = 33;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Keyguard is being unoccluded.
|
* Keyguard is being unoccluded.
|
||||||
* @hide
|
* @hide
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ import static android.view.WindowManager.TRANSIT_KEYGUARD_UNOCCLUDE;
|
|||||||
import static android.view.WindowManager.TRANSIT_OLD_KEYGUARD_GOING_AWAY;
|
import static android.view.WindowManager.TRANSIT_OLD_KEYGUARD_GOING_AWAY;
|
||||||
import static android.view.WindowManager.TRANSIT_OLD_KEYGUARD_GOING_AWAY_ON_WALLPAPER;
|
import static android.view.WindowManager.TRANSIT_OLD_KEYGUARD_GOING_AWAY_ON_WALLPAPER;
|
||||||
import static android.view.WindowManager.TRANSIT_OLD_KEYGUARD_OCCLUDE;
|
import static android.view.WindowManager.TRANSIT_OLD_KEYGUARD_OCCLUDE;
|
||||||
|
import static android.view.WindowManager.TRANSIT_OLD_KEYGUARD_OCCLUDE_BY_DREAM;
|
||||||
import static android.view.WindowManager.TRANSIT_OLD_KEYGUARD_UNOCCLUDE;
|
import static android.view.WindowManager.TRANSIT_OLD_KEYGUARD_UNOCCLUDE;
|
||||||
import static android.view.WindowManager.TRANSIT_OLD_NONE;
|
import static android.view.WindowManager.TRANSIT_OLD_NONE;
|
||||||
import static android.view.WindowManager.TRANSIT_OPEN;
|
import static android.view.WindowManager.TRANSIT_OPEN;
|
||||||
@@ -189,6 +190,9 @@ public class KeyguardService extends Service {
|
|||||||
return apps.length == 0 ? TRANSIT_OLD_KEYGUARD_GOING_AWAY_ON_WALLPAPER
|
return apps.length == 0 ? TRANSIT_OLD_KEYGUARD_GOING_AWAY_ON_WALLPAPER
|
||||||
: TRANSIT_OLD_KEYGUARD_GOING_AWAY;
|
: TRANSIT_OLD_KEYGUARD_GOING_AWAY;
|
||||||
} else if (type == TRANSIT_KEYGUARD_OCCLUDE) {
|
} else if (type == TRANSIT_KEYGUARD_OCCLUDE) {
|
||||||
|
boolean isOccludeByDream = apps.length > 0 && apps[0].taskInfo.topActivityType
|
||||||
|
== WindowConfiguration.ACTIVITY_TYPE_DREAM;
|
||||||
|
if (isOccludeByDream) return TRANSIT_OLD_KEYGUARD_OCCLUDE_BY_DREAM;
|
||||||
return TRANSIT_OLD_KEYGUARD_OCCLUDE;
|
return TRANSIT_OLD_KEYGUARD_OCCLUDE;
|
||||||
} else if (type == TRANSIT_KEYGUARD_UNOCCLUDE) {
|
} else if (type == TRANSIT_KEYGUARD_UNOCCLUDE) {
|
||||||
return TRANSIT_OLD_KEYGUARD_UNOCCLUDE;
|
return TRANSIT_OLD_KEYGUARD_UNOCCLUDE;
|
||||||
@@ -303,6 +307,12 @@ public class KeyguardService extends Service {
|
|||||||
definition.addRemoteAnimation(TRANSIT_OLD_KEYGUARD_OCCLUDE,
|
definition.addRemoteAnimation(TRANSIT_OLD_KEYGUARD_OCCLUDE,
|
||||||
occludeAnimationAdapter);
|
occludeAnimationAdapter);
|
||||||
|
|
||||||
|
final RemoteAnimationAdapter occludeByDreamAnimationAdapter =
|
||||||
|
new RemoteAnimationAdapter(
|
||||||
|
mKeyguardViewMediator.getOccludeByDreamAnimationRunner(), 0, 0);
|
||||||
|
definition.addRemoteAnimation(TRANSIT_OLD_KEYGUARD_OCCLUDE_BY_DREAM,
|
||||||
|
occludeByDreamAnimationAdapter);
|
||||||
|
|
||||||
final RemoteAnimationAdapter unoccludeAnimationAdapter =
|
final RemoteAnimationAdapter unoccludeAnimationAdapter =
|
||||||
new RemoteAnimationAdapter(
|
new RemoteAnimationAdapter(
|
||||||
mKeyguardViewMediator.getUnoccludeAnimationRunner(), 0, 0);
|
mKeyguardViewMediator.getUnoccludeAnimationRunner(), 0, 0);
|
||||||
|
|||||||
@@ -887,6 +887,86 @@ public class KeyguardViewMediator extends CoreStartable implements Dumpable,
|
|||||||
private IRemoteAnimationRunner mOccludeAnimationRunner =
|
private IRemoteAnimationRunner mOccludeAnimationRunner =
|
||||||
new OccludeActivityLaunchRemoteAnimationRunner(mOccludeAnimationController);
|
new OccludeActivityLaunchRemoteAnimationRunner(mOccludeAnimationController);
|
||||||
|
|
||||||
|
private final IRemoteAnimationRunner mOccludeByDreamAnimationRunner =
|
||||||
|
new IRemoteAnimationRunner.Stub() {
|
||||||
|
@Nullable private ValueAnimator mOccludeByDreamAnimator;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onAnimationCancelled(boolean isKeyguardOccluded) {
|
||||||
|
if (mOccludeByDreamAnimator != null) {
|
||||||
|
mOccludeByDreamAnimator.cancel();
|
||||||
|
}
|
||||||
|
setOccluded(isKeyguardOccluded /* isOccluded */, false /* animate */);
|
||||||
|
if (DEBUG) {
|
||||||
|
Log.d(TAG, "Occlude by Dream animation cancelled. Occluded state is now: "
|
||||||
|
+ mOccluded);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onAnimationStart(int transit, RemoteAnimationTarget[] apps,
|
||||||
|
RemoteAnimationTarget[] wallpapers, RemoteAnimationTarget[] nonApps,
|
||||||
|
IRemoteAnimationFinishedCallback finishedCallback) throws RemoteException {
|
||||||
|
setOccluded(true /* isOccluded */, true /* animate */);
|
||||||
|
|
||||||
|
if (apps == null || apps.length == 0 || apps[0] == null) {
|
||||||
|
if (DEBUG) {
|
||||||
|
Log.d(TAG, "No apps provided to the OccludeByDream runner; "
|
||||||
|
+ "skipping occluding animation.");
|
||||||
|
}
|
||||||
|
finishedCallback.onAnimationFinished();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
final RemoteAnimationTarget primary = apps[0];
|
||||||
|
final boolean isDream = (apps[0].taskInfo.topActivityType
|
||||||
|
== WindowConfiguration.ACTIVITY_TYPE_DREAM);
|
||||||
|
if (!isDream) {
|
||||||
|
Log.w(TAG, "The occluding app isn't Dream; "
|
||||||
|
+ "finishing up. Please check that the config is correct.");
|
||||||
|
finishedCallback.onAnimationFinished();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
final SyncRtSurfaceTransactionApplier applier =
|
||||||
|
new SyncRtSurfaceTransactionApplier(
|
||||||
|
mKeyguardViewControllerLazy.get().getViewRootImpl().getView());
|
||||||
|
|
||||||
|
mContext.getMainExecutor().execute(() -> {
|
||||||
|
if (mOccludeByDreamAnimator != null) {
|
||||||
|
mOccludeByDreamAnimator.cancel();
|
||||||
|
}
|
||||||
|
|
||||||
|
mOccludeByDreamAnimator = ValueAnimator.ofFloat(0f, 1f);
|
||||||
|
// Use the same duration as for the UNOCCLUDE.
|
||||||
|
mOccludeByDreamAnimator.setDuration(UNOCCLUDE_ANIMATION_DURATION);
|
||||||
|
mOccludeByDreamAnimator.setInterpolator(Interpolators.LINEAR);
|
||||||
|
mOccludeByDreamAnimator.addUpdateListener(
|
||||||
|
animation -> {
|
||||||
|
SyncRtSurfaceTransactionApplier.SurfaceParams.Builder
|
||||||
|
paramsBuilder =
|
||||||
|
new SyncRtSurfaceTransactionApplier.SurfaceParams
|
||||||
|
.Builder(primary.leash)
|
||||||
|
.withAlpha(animation.getAnimatedFraction());
|
||||||
|
applier.scheduleApply(paramsBuilder.build());
|
||||||
|
});
|
||||||
|
mOccludeByDreamAnimator.addListener(new AnimatorListenerAdapter() {
|
||||||
|
@Override
|
||||||
|
public void onAnimationEnd(Animator animation) {
|
||||||
|
try {
|
||||||
|
finishedCallback.onAnimationFinished();
|
||||||
|
mOccludeByDreamAnimator = null;
|
||||||
|
} catch (RemoteException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
mOccludeByDreamAnimator.start();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Animation controller for activities that unocclude the keyguard. This does not use the
|
* Animation controller for activities that unocclude the keyguard. This does not use the
|
||||||
* ActivityLaunchAnimator since we're just translating down, rather than emerging from a view
|
* ActivityLaunchAnimator since we're just translating down, rather than emerging from a view
|
||||||
@@ -1682,6 +1762,10 @@ public class KeyguardViewMediator extends CoreStartable implements Dumpable,
|
|||||||
return mOccludeAnimationRunner;
|
return mOccludeAnimationRunner;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public IRemoteAnimationRunner getOccludeByDreamAnimationRunner() {
|
||||||
|
return mOccludeByDreamAnimationRunner;
|
||||||
|
}
|
||||||
|
|
||||||
public IRemoteAnimationRunner getUnoccludeAnimationRunner() {
|
public IRemoteAnimationRunner getUnoccludeAnimationRunner() {
|
||||||
return mUnoccludeAnimationRunner;
|
return mUnoccludeAnimationRunner;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ import static android.view.WindowManager.TRANSIT_OLD_DREAM_ACTIVITY_OPEN;
|
|||||||
import static android.view.WindowManager.TRANSIT_OLD_KEYGUARD_GOING_AWAY;
|
import static android.view.WindowManager.TRANSIT_OLD_KEYGUARD_GOING_AWAY;
|
||||||
import static android.view.WindowManager.TRANSIT_OLD_KEYGUARD_GOING_AWAY_ON_WALLPAPER;
|
import static android.view.WindowManager.TRANSIT_OLD_KEYGUARD_GOING_AWAY_ON_WALLPAPER;
|
||||||
import static android.view.WindowManager.TRANSIT_OLD_KEYGUARD_OCCLUDE;
|
import static android.view.WindowManager.TRANSIT_OLD_KEYGUARD_OCCLUDE;
|
||||||
|
import static android.view.WindowManager.TRANSIT_OLD_KEYGUARD_OCCLUDE_BY_DREAM;
|
||||||
import static android.view.WindowManager.TRANSIT_OLD_KEYGUARD_UNOCCLUDE;
|
import static android.view.WindowManager.TRANSIT_OLD_KEYGUARD_UNOCCLUDE;
|
||||||
import static android.view.WindowManager.TRANSIT_OLD_NONE;
|
import static android.view.WindowManager.TRANSIT_OLD_NONE;
|
||||||
import static android.view.WindowManager.TRANSIT_OLD_TASK_CHANGE_WINDOWING_MODE;
|
import static android.view.WindowManager.TRANSIT_OLD_TASK_CHANGE_WINDOWING_MODE;
|
||||||
@@ -758,7 +759,8 @@ public class AppTransition implements Dump {
|
|||||||
if (isKeyguardGoingAwayTransitOld(transit) && enter) {
|
if (isKeyguardGoingAwayTransitOld(transit) && enter) {
|
||||||
a = mTransitionAnimation.loadKeyguardExitAnimation(mNextAppTransitionFlags,
|
a = mTransitionAnimation.loadKeyguardExitAnimation(mNextAppTransitionFlags,
|
||||||
transit == TRANSIT_OLD_KEYGUARD_GOING_AWAY_ON_WALLPAPER);
|
transit == TRANSIT_OLD_KEYGUARD_GOING_AWAY_ON_WALLPAPER);
|
||||||
} else if (transit == TRANSIT_OLD_KEYGUARD_OCCLUDE) {
|
} else if (transit == TRANSIT_OLD_KEYGUARD_OCCLUDE
|
||||||
|
|| transit == TRANSIT_OLD_KEYGUARD_OCCLUDE_BY_DREAM) {
|
||||||
a = null;
|
a = null;
|
||||||
} else if (transit == TRANSIT_OLD_KEYGUARD_UNOCCLUDE && !enter) {
|
} else if (transit == TRANSIT_OLD_KEYGUARD_UNOCCLUDE && !enter) {
|
||||||
a = mTransitionAnimation.loadKeyguardUnoccludeAnimation();
|
a = mTransitionAnimation.loadKeyguardUnoccludeAnimation();
|
||||||
@@ -1170,6 +1172,9 @@ public class AppTransition implements Dump {
|
|||||||
case TRANSIT_OLD_KEYGUARD_OCCLUDE: {
|
case TRANSIT_OLD_KEYGUARD_OCCLUDE: {
|
||||||
return "TRANSIT_OLD_KEYGUARD_OCCLUDE";
|
return "TRANSIT_OLD_KEYGUARD_OCCLUDE";
|
||||||
}
|
}
|
||||||
|
case TRANSIT_OLD_KEYGUARD_OCCLUDE_BY_DREAM: {
|
||||||
|
return "TRANSIT_OLD_KEYGUARD_OCCLUDE_BY_DREAM";
|
||||||
|
}
|
||||||
case TRANSIT_OLD_KEYGUARD_UNOCCLUDE: {
|
case TRANSIT_OLD_KEYGUARD_UNOCCLUDE: {
|
||||||
return "TRANSIT_OLD_KEYGUARD_UNOCCLUDE";
|
return "TRANSIT_OLD_KEYGUARD_UNOCCLUDE";
|
||||||
}
|
}
|
||||||
@@ -1425,6 +1430,7 @@ public class AppTransition implements Dump {
|
|||||||
|
|
||||||
static boolean isKeyguardOccludeTransitOld(@TransitionOldType int transit) {
|
static boolean isKeyguardOccludeTransitOld(@TransitionOldType int transit) {
|
||||||
return transit == TRANSIT_OLD_KEYGUARD_OCCLUDE
|
return transit == TRANSIT_OLD_KEYGUARD_OCCLUDE
|
||||||
|
|| transit == TRANSIT_OLD_KEYGUARD_OCCLUDE_BY_DREAM
|
||||||
|| transit == TRANSIT_OLD_KEYGUARD_UNOCCLUDE;
|
|| transit == TRANSIT_OLD_KEYGUARD_UNOCCLUDE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ import static android.view.WindowManager.TRANSIT_OLD_DREAM_ACTIVITY_OPEN;
|
|||||||
import static android.view.WindowManager.TRANSIT_OLD_KEYGUARD_GOING_AWAY;
|
import static android.view.WindowManager.TRANSIT_OLD_KEYGUARD_GOING_AWAY;
|
||||||
import static android.view.WindowManager.TRANSIT_OLD_KEYGUARD_GOING_AWAY_ON_WALLPAPER;
|
import static android.view.WindowManager.TRANSIT_OLD_KEYGUARD_GOING_AWAY_ON_WALLPAPER;
|
||||||
import static android.view.WindowManager.TRANSIT_OLD_KEYGUARD_OCCLUDE;
|
import static android.view.WindowManager.TRANSIT_OLD_KEYGUARD_OCCLUDE;
|
||||||
|
import static android.view.WindowManager.TRANSIT_OLD_KEYGUARD_OCCLUDE_BY_DREAM;
|
||||||
import static android.view.WindowManager.TRANSIT_OLD_KEYGUARD_UNOCCLUDE;
|
import static android.view.WindowManager.TRANSIT_OLD_KEYGUARD_UNOCCLUDE;
|
||||||
import static android.view.WindowManager.TRANSIT_OLD_NONE;
|
import static android.view.WindowManager.TRANSIT_OLD_NONE;
|
||||||
import static android.view.WindowManager.TRANSIT_OLD_TASK_CHANGE_WINDOWING_MODE;
|
import static android.view.WindowManager.TRANSIT_OLD_TASK_CHANGE_WINDOWING_MODE;
|
||||||
@@ -363,8 +364,14 @@ public class AppTransitionController {
|
|||||||
// When there is a closing app, the keyguard has already been occluded by an
|
// When there is a closing app, the keyguard has already been occluded by an
|
||||||
// activity, and another activity has started on top of that activity, so normal
|
// activity, and another activity has started on top of that activity, so normal
|
||||||
// app transition animation should be used.
|
// app transition animation should be used.
|
||||||
return closingApps.isEmpty() ? TRANSIT_OLD_KEYGUARD_OCCLUDE
|
if (!closingApps.isEmpty()) {
|
||||||
: TRANSIT_OLD_ACTIVITY_OPEN;
|
return TRANSIT_OLD_ACTIVITY_OPEN;
|
||||||
|
}
|
||||||
|
if (!openingApps.isEmpty() && openingApps.valueAt(0).getActivityType()
|
||||||
|
== ACTIVITY_TYPE_DREAM) {
|
||||||
|
return TRANSIT_OLD_KEYGUARD_OCCLUDE_BY_DREAM;
|
||||||
|
}
|
||||||
|
return TRANSIT_OLD_KEYGUARD_OCCLUDE;
|
||||||
case TRANSIT_KEYGUARD_UNOCCLUDE:
|
case TRANSIT_KEYGUARD_UNOCCLUDE:
|
||||||
return TRANSIT_OLD_KEYGUARD_UNOCCLUDE;
|
return TRANSIT_OLD_KEYGUARD_UNOCCLUDE;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user