Merge "Add logs for starting the home activity directly" into main

This commit is contained in:
Winson Chung
2023-11-02 18:18:00 +00:00
committed by Android (Google) Code Review
9 changed files with 28 additions and 13 deletions

View File

@@ -66,6 +66,7 @@ import com.android.launcher3.states.StateAnimationConfig;
import com.android.launcher3.util.DisplayController;
import com.android.quickstep.fallback.FallbackRecentsView;
import com.android.quickstep.fallback.RecentsState;
import com.android.quickstep.util.ActiveGestureLog;
import com.android.quickstep.util.RectFSpringAnim;
import com.android.quickstep.util.SurfaceTransaction.SurfaceProperties;
import com.android.quickstep.util.TransformParams;
@@ -151,19 +152,20 @@ public class FallbackSwipeHandler extends
return new FallbackPipToHomeAnimationFactory();
}
mActiveAnimationFactory = new FallbackHomeAnimationFactory(duration);
startHomeIntent(mActiveAnimationFactory, runningTaskTarget);
startHomeIntent(mActiveAnimationFactory, runningTaskTarget, "FallbackSwipeHandler-home");
return mActiveAnimationFactory;
}
private void startHomeIntent(
@Nullable FallbackHomeAnimationFactory gestureContractAnimationFactory,
@Nullable RemoteAnimationTarget runningTaskTarget) {
@Nullable RemoteAnimationTarget runningTaskTarget,
@NonNull String reason) {
ActivityOptions options = ActivityOptions.makeCustomAnimation(mContext, 0, 0);
Intent intent = new Intent(mGestureState.getHomeIntent());
if (gestureContractAnimationFactory != null && runningTaskTarget != null) {
gestureContractAnimationFactory.addGestureContract(intent, runningTaskTarget.taskInfo);
}
startHomeIntentSafely(mContext, intent, options.toBundle());
startHomeIntentSafely(mContext, intent, options.toBundle(), reason);
}
@Override
@@ -185,8 +187,8 @@ public class FallbackSwipeHandler extends
// the PiP task appearing.
recentsCallback = () -> {
callback.run();
startHomeIntent(
null /* gestureContractAnimationFactory */, null /* runningTaskTarget */);
startHomeIntent(null /* gestureContractAnimationFactory */,
null /* runningTaskTarget */, "FallbackSwipeHandler-resumeLauncher");
};
} else {
recentsCallback = callback;

View File

@@ -37,6 +37,7 @@ import com.android.launcher3.statemanager.StatefulActivity;
import com.android.launcher3.taskbar.TaskbarUIController;
import com.android.launcher3.util.RunnableList;
import com.android.quickstep.RecentsAnimationCallbacks.RecentsAnimationListener;
import com.android.quickstep.util.ActiveGestureLog;
import com.android.quickstep.views.RecentsView;
import com.android.quickstep.views.TaskView;
import com.android.systemui.shared.recents.model.ThumbnailData;
@@ -220,6 +221,7 @@ public class OverviewCommandHelper {
return true;
}
if (cmd.type == TYPE_HOME) {
ActiveGestureLog.INSTANCE.addLog("OverviewCommandHelper.executeCommand(TYPE_HOME)");
mService.startActivity(mOverviewComponentObserver.getHomeIntent());
return true;
}

View File

@@ -39,6 +39,7 @@ import androidx.annotation.Nullable;
import com.android.launcher3.R;
import com.android.launcher3.util.SimpleBroadcastReceiver;
import com.android.quickstep.util.ActiveGestureLog;
import com.android.systemui.shared.system.PackageManagerWrapper;
import java.io.PrintWriter;
@@ -276,20 +277,24 @@ public final class OverviewComponentObserver {
/**
* Starts the intent for the current home activity.
*/
public static void startHomeIntentSafely(@NonNull Context context, @Nullable Bundle options) {
public static void startHomeIntentSafely(@NonNull Context context, @Nullable Bundle options,
@NonNull String reason) {
RecentsAnimationDeviceState deviceState = new RecentsAnimationDeviceState(context);
OverviewComponentObserver observer = new OverviewComponentObserver(context, deviceState);
Intent intent = observer.getHomeIntent();
observer.onDestroy();
deviceState.destroy();
startHomeIntentSafely(context, intent, options);
startHomeIntentSafely(context, intent, options, reason);
}
/**
* Starts the intent for the current home activity.
*/
public static void startHomeIntentSafely(
@NonNull Context context, @NonNull Intent homeIntent, @Nullable Bundle options) {
@NonNull Context context, @NonNull Intent homeIntent, @Nullable Bundle options,
@NonNull String reason) {
ActiveGestureLog.INSTANCE.addLog(new ActiveGestureLog.CompoundString(
"OverviewComponentObserver.startHomeIntent: ").append(reason));
try {
context.startActivity(homeIntent, options);
} catch (NullPointerException | ActivityNotFoundException | SecurityException e) {

View File

@@ -94,6 +94,7 @@ import java.util.List;
* See {@link com.android.quickstep.views.RecentsView}.
*/
public final class RecentsActivity extends StatefulActivity<RecentsState> {
private static final String TAG = "RecentsActivity";
public static final ActivityTracker<RecentsActivity> ACTIVITY_TRACKER =
new ActivityTracker<>();
@@ -427,7 +428,7 @@ public final class RecentsActivity extends StatefulActivity<RecentsState> {
new RemoteAnimationAdapter(runner, HOME_APPEAR_DURATION, 0),
new RemoteTransition(runner.toRemoteTransition(), getIApplicationThread(),
"StartHomeFromRecents"));
startHomeIntentSafely(this, options.toBundle());
startHomeIntentSafely(this, options.toBundle(), TAG);
}
private final RemoteAnimationFactory mAnimationToHomeFactory =

View File

@@ -1299,6 +1299,7 @@ public class TouchInteractionService extends Service {
Log.i(TAG, "preloadOverview: forSUWAllSet=" + forSUWAllSet
+ ", isHomeAndOverviewSame=" + mOverviewComponentObserver.isHomeAndOverviewSame());
ActiveGestureLog.INSTANCE.addLog("preloadRecentsAnimation");
mTaskAnimationManager.preloadRecentsAnimation(overviewIntent);
}

View File

@@ -68,6 +68,7 @@ import java.util.HashMap;
*/
public class DeviceLockedInputConsumer implements InputConsumer,
RecentsAnimationCallbacks.RecentsAnimationListener, BuilderProxy {
private final String TAG = "DeviceLockedInputConsumer";
private static final String[] STATE_NAMES = DEBUG_STATES ? new String[2] : null;
private static int getFlagForIndex(int index, String name) {
@@ -220,7 +221,7 @@ public class DeviceLockedInputConsumer implements InputConsumer,
} else if (dismissTask) {
// For now, just start the home intent so user is prompted to
// unlock the device.
startHomeIntentSafely(mContext, mGestureState.getHomeIntent(), null);
startHomeIntentSafely(mContext, mGestureState.getHomeIntent(), null, TAG);
mHomeLaunched = true;
}
mStateCallback.setState(STATE_HANDLER_INVALIDATED);

View File

@@ -37,6 +37,7 @@ import com.android.systemui.shared.system.InputMonitorCompat;
public class OverviewWithoutFocusInputConsumer implements InputConsumer,
TriggerSwipeUpTouchTracker.OnSwipeUpListener {
private static final String TAG = "OverviewWithoutFocusInputConsumer";
private final Context mContext;
private final InputMonitorCompat mInputMonitor;
@@ -77,7 +78,7 @@ public class OverviewWithoutFocusInputConsumer implements InputConsumer,
@Override
public void onSwipeUp(boolean wasFling, PointF finalVelocity) {
startHomeIntentSafely(mContext, mGestureState.getHomeIntent(), null);
startHomeIntentSafely(mContext, mGestureState.getHomeIntent(), null, TAG);
BaseActivity activity = BaseDraggingActivity.fromContext(mContext);
int state = (mGestureState != null && mGestureState.getEndTarget() != null)
? mGestureState.getEndTarget().containerType

View File

@@ -53,6 +53,7 @@ import java.util.HashMap;
public class ProgressDelegateInputConsumer implements InputConsumer,
RecentsAnimationCallbacks.RecentsAnimationListener,
SingleAxisSwipeDetector.Listener {
private static final String TAG = "ProgressDelegateInputConsumer";
private static final float SWIPE_DISTANCE_THRESHOLD = 0.2f;
@@ -165,7 +166,7 @@ public class ProgressDelegateInputConsumer implements InputConsumer,
mRecentsAnimationController.finishController(endToRecents /* toRecents */,
null /* callback */, false /* sendUserLeaveHint */);
} else if (endToRecents) {
startHomeIntentSafely(mContext, null);
startHomeIntentSafely(mContext, null, TAG);
}
}

View File

@@ -78,6 +78,7 @@ import java.util.Map;
* for the gestural system navigation.
*/
public class AllSetActivity extends Activity {
private static final String TAG = "AllSetActivity";
private static final String LOG_TAG = "AllSetActivity";
private static final String URI_SYSTEM_NAVIGATION_SETTING =
@@ -356,7 +357,7 @@ public class AllSetActivity extends Activity {
@Override
public boolean performAccessibilityAction(View host, int action, Bundle args) {
if (action == AccessibilityAction.ACTION_CLICK.getId()) {
startHomeIntentSafely(AllSetActivity.this, null);
startHomeIntentSafely(AllSetActivity.this, null, TAG);
finish();
return true;
}