Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6369136f authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge changes I2ade7f48,I78485a16 into ub-launcher3-master

* changes:
  2/ Move device state logic to its own class
  1/ Renaming some classes for clarity
parents 86017c96 75eb0e0f
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -32,7 +32,7 @@ import android.util.Log;
import com.android.launcher3.BaseDraggingActivity;
import com.android.launcher3.LauncherAnimationRunner;
import com.android.quickstep.util.RemoteAnimationProvider;
import com.android.quickstep.util.RemoteAnimationTargetSet;
import com.android.quickstep.util.RemoteAnimationTargets;
import com.android.quickstep.views.IconRecentsView;
import com.android.systemui.shared.system.ActivityOptionsCompat;
import com.android.systemui.shared.system.RemoteAnimationAdapterCompat;
@@ -113,8 +113,8 @@ final class AppToOverviewAnimationProvider<T extends BaseDraggingActivity> imple
            return anim;
        }

        RemoteAnimationTargetSet targetSet =
                new RemoteAnimationTargetSet(appTargets, wallpaperTargets, MODE_CLOSING);
        RemoteAnimationTargets targetSet =
                new RemoteAnimationTargets(appTargets, wallpaperTargets, MODE_CLOSING);
        mRecentsView.setTransitionedFromApp(!targetSet.isAnimatingHome());

        RemoteAnimationTargetCompat recentsTarget = null;
+2 −2
Original line number Diff line number Diff line
@@ -27,7 +27,7 @@ import androidx.annotation.Nullable;
import com.android.launcher3.anim.AnimatorPlaybackController;
import com.android.launcher3.userevent.nano.LauncherLogProto;
import com.android.quickstep.util.ActivityInitListener;
import com.android.quickstep.util.RemoteAnimationTargetSet;
import com.android.quickstep.util.RemoteAnimationTargets;
import com.android.quickstep.views.IconRecentsView;

import java.util.function.BiPredicate;
@@ -59,7 +59,7 @@ public final class FallbackActivityControllerHelper extends
            boolean isAnimatingToRecents = false;

            @Override
            public void onRemoteAnimationReceived(RemoteAnimationTargetSet targets) {
            public void onRemoteAnimationReceived(RemoteAnimationTargets targets) {
                isAnimatingToRecents = targets != null && targets.isAnimatingHome();
                if (!isAnimatingToRecents) {
                    rv.setAlpha(1);
+13 −25
Original line number Diff line number Diff line
@@ -34,6 +34,8 @@ import android.view.MotionEvent;

import com.android.launcher3.Utilities;
import com.android.launcher3.compat.UserManagerCompat;
import com.android.launcher3.util.DefaultDisplay;
import com.android.quickstep.RecentsAnimationDeviceState;
import com.android.systemui.shared.recents.IOverviewProxy;
import com.android.systemui.shared.recents.ISystemUiProxy;

@@ -44,15 +46,6 @@ import com.android.systemui.shared.recents.ISystemUiProxy;
public class TouchInteractionService extends Service {

    private static final String TAG = "GoTouchInteractionService";
    private boolean mIsUserUnlocked;
    private BroadcastReceiver mUserUnlockedReceiver = new BroadcastReceiver() {
        @Override
        public void onReceive(Context context, Intent intent) {
            if (Intent.ACTION_USER_UNLOCKED.equals(intent.getAction())) {
                initWhenUserUnlocked();
            }
        }
    };

    private final IBinder mMyBinder = new IOverviewProxy.Stub() {

@@ -68,21 +61,21 @@ public class TouchInteractionService extends Service {

        @Override
        public void onOverviewToggle() {
            if (mIsUserUnlocked) {
            if (mDeviceState.isUserUnlocked()) {
                mOverviewCommandHelper.onOverviewToggle();
            }
        }

        @Override
        public void onOverviewShown(boolean triggeredFromAltTab) {
            if (mIsUserUnlocked) {
            if (mDeviceState.isUserUnlocked()) {
                mOverviewCommandHelper.onOverviewShown(triggeredFromAltTab);
            }
        }

        @Override
        public void onOverviewHidden(boolean triggeredFromAltTab, boolean triggeredFromHomeKey) {
            if (mIsUserUnlocked && triggeredFromAltTab && !triggeredFromHomeKey) {
            if (mDeviceState.isUserUnlocked() && triggeredFromAltTab && !triggeredFromHomeKey) {
                // onOverviewShownFromAltTab hides the overview and ends at the target app
                mOverviewCommandHelper.onOverviewHidden();
            }
@@ -90,7 +83,7 @@ public class TouchInteractionService extends Service {

        @Override
        public void onTip(int actionType, int viewType) {
            if (mIsUserUnlocked) {
            if (mDeviceState.isUserUnlocked()) {
                mOverviewCommandHelper.onTip(actionType, viewType);
            }
        }
@@ -140,35 +133,30 @@ public class TouchInteractionService extends Service {
    private RecentsModel mRecentsModel;
    private OverviewComponentObserver mOverviewComponentObserver;
    private OverviewCommandHelper mOverviewCommandHelper;
    private RecentsAnimationDeviceState mDeviceState;

    @Override
    public void onCreate() {
        super.onCreate();
        if (UserManagerCompat.getInstance(this).isUserUnlocked(Process.myUserHandle())) {
            initWhenUserUnlocked();
        } else {
            mIsUserUnlocked = false;
            registerReceiver(mUserUnlockedReceiver, new IntentFilter(Intent.ACTION_USER_UNLOCKED));
        }
        mDeviceState = new RecentsAnimationDeviceState(this);
        mDeviceState.runOnUserUnlocked(this::onUserUnlocked);

        sConnected = true;
    }

    private void initWhenUserUnlocked() {
    public void onUserUnlocked() {
        mRecentsModel = RecentsModel.INSTANCE.get(this);
        mOverviewComponentObserver = new OverviewComponentObserver(this);
        mOverviewComponentObserver = new OverviewComponentObserver(this, mDeviceState);
        mOverviewCommandHelper = new OverviewCommandHelper(this,
                mOverviewComponentObserver);
        mIsUserUnlocked = true;
        Utilities.unregisterReceiverSafely(this, mUserUnlockedReceiver);
    }

    @Override
    public void onDestroy() {
        if (mIsUserUnlocked) {
        if (mDeviceState.isUserUnlocked()) {
            mOverviewComponentObserver.onDestroy();
        }
        Utilities.unregisterReceiverSafely(this, mUserUnlockedReceiver);
        mDeviceState.destroy();
        sConnected = false;
        super.onDestroy();
    }
+2 −2
Original line number Diff line number Diff line
@@ -36,7 +36,7 @@ import androidx.annotation.Nullable;
import com.android.launcher3.anim.AnimatorPlaybackController;
import com.android.launcher3.anim.Interpolators;
import com.android.launcher3.anim.SpringAnimationBuilder;
import com.android.quickstep.util.ClipAnimationHelper;
import com.android.quickstep.util.AppWindowAnimationHelper;
import com.android.quickstep.views.RecentsView;
import com.android.quickstep.views.TaskView;
import com.android.systemui.shared.system.RemoteAnimationTargetCompat;
@@ -71,7 +71,7 @@ public final class LauncherAppTransitionManagerImpl extends QuickstepAppTransiti

        TaskView taskView = findTaskViewToLaunch(mLauncher, v, appTargets);

        ClipAnimationHelper helper = new ClipAnimationHelper(mLauncher);
        AppWindowAnimationHelper helper = new AppWindowAnimationHelper(mLauncher);
        anim.play(getRecentsWindowAnimator(taskView, skipLauncherChanges, appTargets,
                wallpaperTargets, helper).setDuration(RECENTS_LAUNCH_DURATION));

+1 −1
Original line number Diff line number Diff line
@@ -78,7 +78,7 @@ public class BackgroundAppState extends OverviewState {
        } else {
            dummyTask = recentsView.getTaskViewAt(0);
        }
        return recentsView.getTempClipAnimationHelper().updateForFullscreenOverview(dummyTask)
        return recentsView.getTempAppWindowAnimationHelper().updateForFullscreenOverview(dummyTask)
                .getScaleAndTranslation();
    }

Loading