summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSunny Goyal <sunnygoyal@google.com>2018-04-10 17:20:39 -0700
committerSunny Goyal <sunnygoyal@google.com>2018-04-10 17:20:46 -0700
commiteeb084cb4b5fe19841289e8b3adf56e0a13ce614 (patch)
tree706b5b7e52fd26e3b3eb83ea5a754a548caf4ce5
parentf62a69b43babd482f30668b17270b7ba78931d0b (diff)
downloadandroid_packages_apps_Trebuchet-eeb084cb4b5fe19841289e8b3adf56e0a13ce614.tar.gz
android_packages_apps_Trebuchet-eeb084cb4b5fe19841289e8b3adf56e0a13ce614.tar.bz2
android_packages_apps_Trebuchet-eeb084cb4b5fe19841289e8b3adf56e0a13ce614.zip
Handle configuration changes in fallback activity
Change-Id: I1b6dd28ab3766948a7613192d0283689707c73a4
-rw-r--r--quickstep/src/com/android/quickstep/RecentsActivity.java45
-rw-r--r--quickstep/src/com/android/quickstep/fallback/RecentsRootView.java4
2 files changed, 49 insertions, 0 deletions
diff --git a/quickstep/src/com/android/quickstep/RecentsActivity.java b/quickstep/src/com/android/quickstep/RecentsActivity.java
index eb0be8912..9ec9f52c4 100644
--- a/quickstep/src/com/android/quickstep/RecentsActivity.java
+++ b/quickstep/src/com/android/quickstep/RecentsActivity.java
@@ -15,6 +15,9 @@
*/
package com.android.quickstep;
+import static android.content.pm.ActivityInfo.CONFIG_ORIENTATION;
+import static android.content.pm.ActivityInfo.CONFIG_SCREEN_SIZE;
+
import static com.android.launcher3.LauncherAppTransitionManagerImpl.RECENTS_LAUNCH_DURATION;
import static com.android.launcher3.LauncherAppTransitionManagerImpl.STATUS_BAR_TRANSITION_DURATION;
import static com.android.quickstep.TaskUtils.getRecentsWindowAnimator;
@@ -26,11 +29,14 @@ import android.animation.AnimatorListenerAdapter;
import android.animation.AnimatorSet;
import android.app.ActivityOptions;
import android.content.Intent;
+import android.content.pm.ActivityInfo;
+import android.content.res.Configuration;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.view.View;
+import com.android.launcher3.AbstractFloatingView;
import com.android.launcher3.BaseDraggingActivity;
import com.android.launcher3.InvariantDeviceProfile;
import com.android.launcher3.ItemInfo;
@@ -60,10 +66,13 @@ public class RecentsActivity extends BaseDraggingActivity {
private RecentsRootView mRecentsRootView;
private FallbackRecentsView mFallbackRecentsView;
+ private Configuration mOldConfig;
+
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
+ mOldConfig = new Configuration(getResources().getConfiguration());
// In case we are reusing IDP, create a copy so that we dont conflict with Launcher
// activity.
LauncherAppState appState = LauncherAppState.getInstanceNoCreate();
@@ -83,6 +92,42 @@ public class RecentsActivity extends BaseDraggingActivity {
}
@Override
+ public void onConfigurationChanged(Configuration newConfig) {
+ int diff = newConfig.diff(mOldConfig);
+ if ((diff & (CONFIG_ORIENTATION | CONFIG_SCREEN_SIZE)) != 0) {
+ onHandleConfigChanged();
+ }
+ mOldConfig.setTo(newConfig);
+ super.onConfigurationChanged(newConfig);
+ }
+
+ @Override
+ public void onMultiWindowModeChanged(boolean isInMultiWindowMode, Configuration newConfig) {
+ mOldConfig.setTo(newConfig);
+ onHandleConfigChanged();
+ super.onMultiWindowModeChanged(isInMultiWindowMode, newConfig);
+ }
+
+ private void onHandleConfigChanged() {
+ mUserEventDispatcher = null;
+
+ // In case we are reusing IDP, create a copy so that we dont conflict with Launcher
+ // activity.
+ LauncherAppState appState = LauncherAppState.getInstanceNoCreate();
+ setDeviceProfile(appState != null
+ ? appState.getInvariantDeviceProfile().getDeviceProfile(this).copy(this)
+ : new InvariantDeviceProfile(this).getDeviceProfile(this));
+
+ AbstractFloatingView.closeOpenViews(this, true,
+ AbstractFloatingView.TYPE_ALL & ~AbstractFloatingView.TYPE_REBIND_SAFE);
+ dispatchDeviceProfileChanged();
+
+ mRecentsRootView.setup();
+ mRecentsRootView.dispatchInsets();
+ mRecentsRootView.requestLayout();
+ }
+
+ @Override
public BaseDragLayer getDragLayer() {
return mRecentsRootView;
}
diff --git a/quickstep/src/com/android/quickstep/fallback/RecentsRootView.java b/quickstep/src/com/android/quickstep/fallback/RecentsRootView.java
index 7aaa88c38..1dc6fcff1 100644
--- a/quickstep/src/com/android/quickstep/fallback/RecentsRootView.java
+++ b/quickstep/src/com/android/quickstep/fallback/RecentsRootView.java
@@ -62,4 +62,8 @@ public class RecentsRootView extends BaseDragLayer<RecentsActivity> {
setBackground(insets.top == 0 ? null
: Themes.getAttrDrawable(getContext(), R.attr.workspaceStatusBarScrim));
}
+
+ public void dispatchInsets() {
+ super.setInsets(mInsets);
+ }
} \ No newline at end of file