Skip to content

Commit

Permalink
Merging ub-launcher3-rvc-qpr-dev to rvc-qpr-dev
Browse files Browse the repository at this point in the history
Bug: 162366734
Test: system image builds

Change-Id: I6675431b180976798afacc7a99251ae36764a50a
Merged-In: Ibff46b3ef7ff89accb459db323f31179adb4ef21
  • Loading branch information
Hyunyoung Song committed Jul 30, 2020
1 parent eeb497c commit 45c0918
Show file tree
Hide file tree
Showing 253 changed files with 4,276 additions and 1,309 deletions.
2 changes: 1 addition & 1 deletion AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
android:stateNotNeeded="true"
android:windowSoftInputMode="adjustPan"
android:screenOrientation="unspecified"
android:configChanges="keyboard|keyboardHidden|mcc|mnc|navigation|orientation|screenSize|screenLayout|smallestScreenSize"
android:configChanges="keyboard|keyboardHidden|mcc|mnc|navigation|orientation|screenSize|screenLayout|smallestScreenSize|uiMode"
android:resizeableActivity="true"
android:resumeWhilePausing="true"
android:taskAffinity=""
Expand Down
2 changes: 1 addition & 1 deletion quickstep/AndroidManifest-launcher.xml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
android:stateNotNeeded="true"
android:windowSoftInputMode="adjustPan"
android:screenOrientation="unspecified"
android:configChanges="keyboard|keyboardHidden|mcc|mnc|navigation|orientation|screenSize|screenLayout|smallestScreenSize"
android:configChanges="keyboard|keyboardHidden|mcc|mnc|navigation|orientation|screenSize|screenLayout|smallestScreenSize|uiMode"
android:resizeableActivity="true"
android:resumeWhilePausing="true"
android:taskAffinity=""
Expand Down
2 changes: 1 addition & 1 deletion quickstep/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
android:stateNotNeeded="true"
android:theme="@style/LauncherTheme"
android:screenOrientation="unspecified"
android:configChanges="keyboard|keyboardHidden|mcc|mnc|navigation|orientation|screenSize|screenLayout|smallestScreenSize"
android:configChanges="keyboard|keyboardHidden|mcc|mnc|navigation|orientation|screenSize|screenLayout|smallestScreenSize|uiMode"
android:resizeableActivity="true"
android:resumeWhilePausing="true"
android:taskAffinity="" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,9 @@ public void log(String tag, String msg) {
}

private PrintWriter getWriter() {
String fName = FILE_NAME_PREFIX + (LOG_DAYS % 10);
if (fName.equals(mFileName)) return mCurrentWriter;

Calendar cal = Calendar.getInstance();
String fName = FILE_NAME_PREFIX + (cal.get(Calendar.DAY_OF_YEAR) % 10);
if (fName.equals(mFileName)) return mCurrentWriter;

boolean append = false;
File logFile = new File(mLogsDir, fName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
*/
public class HotseatRestoreHelper {
private final Launcher mLauncher;
private boolean mBackupRestored = false;

HotseatRestoreHelper(Launcher context) {
mLauncher = context;
Expand Down Expand Up @@ -62,7 +61,6 @@ public void createBackup() {
* Finds and restores a previously saved snapshow of Favorites table
*/
public void restoreBackup() {
if (mBackupRestored) return;
MODEL_EXECUTOR.execute(() -> {
try (LauncherDbUtils.SQLiteTransaction transaction = (LauncherDbUtils.SQLiteTransaction)
LauncherSettings.Settings.call(
Expand All @@ -78,7 +76,6 @@ public void restoreBackup() {
idp.numRows);
backupTable.restoreFromCustomBackupTable(HYBRID_HOTSEAT_BACKUP_TABLE, true);
transaction.commit();
mBackupRestored = true;
mLauncher.getModel().forceReload();
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

import static android.view.View.VISIBLE;

import static com.android.launcher3.LauncherAnimUtils.SCALE_PROPERTY;
import static com.android.launcher3.LauncherState.BACKGROUND_APP;
import static com.android.launcher3.LauncherState.HINT_STATE;
import static com.android.launcher3.LauncherState.HOTSEAT_ICONS;
Expand Down Expand Up @@ -52,6 +51,7 @@
import static com.android.launcher3.states.StateAnimationConfig.ANIM_WORKSPACE_TRANSLATE;
import static com.android.quickstep.SysUINavigationMode.Mode.NO_BUTTON;
import static com.android.quickstep.SysUINavigationMode.removeShelfFromOverview;
import static com.android.quickstep.views.RecentsView.RECENTS_SCALE_PROPERTY;

import android.animation.Animator;
import android.animation.AnimatorSet;
Expand Down Expand Up @@ -212,7 +212,7 @@ public void prepareForAtomicAnimation(LauncherState fromState, LauncherState toS
// Scale up the recents, if it is not coming from the side
RecentsView overview = mActivity.getOverviewPanel();
if (overview.getVisibility() != VISIBLE || overview.getContentAlpha() == 0) {
SCALE_PROPERTY.set(overview, RECENTS_PREPARE_SCALE);
RECENTS_SCALE_PROPERTY.set(overview, RECENTS_PREPARE_SCALE);
}
}
config.setInterpolator(ANIM_WORKSPACE_FADE, OVERSHOOT_1_2);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
*/
package com.android.launcher3.uioverrides.touchcontrollers;

import static com.android.launcher3.LauncherAnimUtils.SCALE_PROPERTY;
import static com.android.launcher3.LauncherState.HOTSEAT_ICONS;
import static com.android.launcher3.LauncherState.NORMAL;
import static com.android.launcher3.LauncherState.OVERVIEW;
Expand Down Expand Up @@ -47,6 +46,7 @@
import static com.android.quickstep.util.ShelfPeekAnim.ShelfAnimState.PEEK;
import static com.android.quickstep.views.RecentsView.ADJACENT_PAGE_OFFSET;
import static com.android.quickstep.views.RecentsView.FULLSCREEN_PROGRESS;
import static com.android.quickstep.views.RecentsView.RECENTS_SCALE_PROPERTY;
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_OVERVIEW_DISABLED;

import android.animation.Animator;
Expand Down Expand Up @@ -244,7 +244,7 @@ private void setupOverviewAnimators() {
final LauncherState toState = OVERVIEW;

// Set RecentView's initial properties.
SCALE_PROPERTY.set(mRecentsView, fromState.getOverviewScaleAndOffset(mLauncher)[0]);
RECENTS_SCALE_PROPERTY.set(mRecentsView, fromState.getOverviewScaleAndOffset(mLauncher)[0]);
ADJACENT_PAGE_OFFSET.set(mRecentsView, 1f);
mRecentsView.setContentAlpha(1);
mRecentsView.setFullscreenProgress(fromState.getOverviewFullscreenProgress());
Expand All @@ -266,7 +266,8 @@ private void setupOverviewAnimators() {
// - RecentsView scale
// - RecentsView fullscreenProgress
PendingAnimation yAnim = new PendingAnimation((long) (mYRange * 2));
yAnim.setFloat(mRecentsView, SCALE_PROPERTY, scaleAndOffset[0], SCALE_DOWN_INTERPOLATOR);
yAnim.setFloat(mRecentsView, RECENTS_SCALE_PROPERTY, scaleAndOffset[0],
SCALE_DOWN_INTERPOLATOR);
yAnim.setFloat(mRecentsView, FULLSCREEN_PROGRESS,
toState.getOverviewFullscreenProgress(), SCALE_DOWN_INTERPOLATOR);
mYOverviewAnim = yAnim.createPlaybackController();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

import android.animation.Animator;
import android.animation.AnimatorSet;
import android.app.ActivityManager.RunningTaskInfo;
import android.util.Log;
import android.view.animation.Interpolator;

Expand Down Expand Up @@ -52,17 +53,17 @@ final class AppToOverviewAnimationProvider<T extends StatefulActivity<?>> extend

private final BaseActivityInterface<?, T> mActivityInterface;
// The id of the currently running task that is transitioning to overview.
private final int mTargetTaskId;
private final RunningTaskInfo mTargetTask;
private final RecentsAnimationDeviceState mDeviceState;

private T mActivity;
private RecentsView mRecentsView;

AppToOverviewAnimationProvider(
BaseActivityInterface<?, T> activityInterface, int targetTaskId,
BaseActivityInterface<?, T> activityInterface, RunningTaskInfo targetTask,
RecentsAnimationDeviceState deviceState) {
mActivityInterface = activityInterface;
mTargetTaskId = targetTaskId;
mTargetTask = targetTask;
mDeviceState = deviceState;
}

Expand All @@ -73,7 +74,7 @@ final class AppToOverviewAnimationProvider<T extends StatefulActivity<?>> extend
* @param wasVisible true if it was visible before
*/
boolean onActivityReady(T activity, Boolean wasVisible) {
activity.<RecentsView>getOverviewPanel().showCurrentTask(mTargetTaskId);
activity.<RecentsView>getOverviewPanel().showCurrentTask(mTargetTask);
AbstractFloatingView.closeAllOpenViews(activity, wasVisible);
BaseActivityInterface.AnimationFactory factory = mActivityInterface.prepareRecentsUI(
mDeviceState,
Expand Down Expand Up @@ -122,7 +123,8 @@ public void onAnimationSuccess(Animator animator) {
wallpaperTargets, MODE_CLOSING);

// Use the top closing app to determine the insets for the animation
RemoteAnimationTargetCompat runningTaskTarget = targets.findTask(mTargetTaskId);
RemoteAnimationTargetCompat runningTaskTarget = mTargetTask == null ? null
: targets.findTask(mTargetTask.taskId);
if (runningTaskTarget == null) {
Log.e(TAG, "No closing app");
return pa.buildAnim();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
*/
package com.android.quickstep;

import static android.widget.Toast.LENGTH_SHORT;

import static com.android.launcher3.config.FeatureFlags.ENABLE_QUICKSTEP_LIVE_TILE;
import static com.android.launcher3.util.Executors.MAIN_EXECUTOR;
import static com.android.launcher3.util.VibratorWrapper.OVERVIEW_HAPTIC;
Expand All @@ -27,11 +29,13 @@
import android.os.Build;
import android.util.Log;
import android.view.MotionEvent;
import android.widget.Toast;

import androidx.annotation.CallSuper;
import androidx.annotation.UiThread;

import com.android.launcher3.DeviceProfile;
import com.android.launcher3.R;
import com.android.launcher3.statemanager.StatefulActivity;
import com.android.launcher3.testing.TestProtocol;
import com.android.launcher3.util.VibratorWrapper;
Expand Down Expand Up @@ -140,10 +144,10 @@ protected void startNewTask(Consumer<Boolean> resultCallback) {
mRecentsView.getNextPageTaskView().launchTask(false /* animate */,
true /* freezeTaskList */);
} else {
int taskId = mRecentsView.getNextPageTaskView().getTask().key.id;
if (!mCanceled) {
TaskView nextTask = mRecentsView.getTaskView(taskId);
TaskView nextTask = mRecentsView.getNextPageTaskView();
if (nextTask != null) {
int taskId = nextTask.getTask().key.id;
mGestureState.updateLastStartedTaskId(taskId);
boolean hasTaskPreviouslyAppeared = mGestureState.getPreviouslyAppearedTaskIds()
.contains(taskId);
Expand All @@ -160,6 +164,10 @@ protected void startNewTask(Consumer<Boolean> resultCallback) {
mRecentsAnimationController.finish(true /* toRecents */, null);
}
}, MAIN_EXECUTOR.getHandler());
} else {
mActivityInterface.onLaunchTaskFailed();
Toast.makeText(mContext, R.string.activity_not_available, LENGTH_SHORT).show();
mRecentsAnimationController.finish(true /* toRecents */, null);
}
}
mCanceled = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -266,10 +266,6 @@ private void initStateCallbacks() {
mStateCallback.runOnceAtState(STATE_HANDLER_INVALIDATED | STATE_RESUME_LAST_TASK,
this::notifyTransitionCancelled);

mGestureState.runOnceAtState(STATE_END_TARGET_SET,
() -> mDeviceState.onEndTargetCalculated(mGestureState.getEndTarget(),
mActivityInterface));

if (!ENABLE_QUICKSTEP_LIVE_TILE.get()) {
mStateCallback.addChangeListener(STATE_APP_CONTROLLER_RECEIVED | STATE_LAUNCHER_PRESENT
| STATE_SCREENSHOT_VIEW_SHOWN | STATE_CAPTURE_SCREENSHOT,
Expand Down Expand Up @@ -337,7 +333,7 @@ private void onLauncherStart() {
if (mStateCallback.hasStates(STATE_HANDLER_INVALIDATED)) {
return;
}
mTaskViewSimulator.setRecentsConfiguration(mActivity.getResources().getConfiguration());
mTaskViewSimulator.setRecentsRotation(mActivity.getDisplay().getRotation());

// If we've already ended the gesture and are going home, don't prepare recents UI,
// as that will set the state as BACKGROUND_APP, overriding the animation to NORMAL.
Expand Down Expand Up @@ -400,6 +396,11 @@ private void onLauncherPresentAndGestureStarted() {
mGestureState.getActivityInterface().setOnDeferredActivityLaunchCallback(
mOnDeferredActivityLaunch);

mGestureState.runOnceAtState(STATE_END_TARGET_SET,
() -> mDeviceState.getRotationTouchHelper().
onEndTargetCalculated(mGestureState.getEndTarget(),
mActivityInterface));

notifyGestureStartedAsync();
}

Expand All @@ -423,7 +424,7 @@ private void setupRecentsViewUi() {
}

protected void notifyGestureAnimationStartToRecents() {
mRecentsView.onGestureAnimationStart(mGestureState.getRunningTaskId());
mRecentsView.onGestureAnimationStart(mGestureState.getRunningTask());
}

private void launcherFrameDrawn() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ public boolean deferStartingActivity(RecentsAnimationDeviceState deviceState, Mo
}

@Override
public void onExitOverview(RecentsAnimationDeviceState deviceState, Runnable exitRunnable) {
public void onExitOverview(RotationTouchHelper deviceState, Runnable exitRunnable) {
// no-op, fake landscape not supported for 3P
}

Expand Down
Loading

0 comments on commit 45c0918

Please sign in to comment.