Merge "Handle configuration changes in floating rotation button" into sc-v2-dev

This commit is contained in:
TreeHugger Robot 2021-11-29 19:41:26 +00:00 committed by Android (Google) Code Review
commit ed05712f04
4 changed files with 23 additions and 0 deletions

View File

@ -37,6 +37,7 @@ import android.animation.ObjectAnimator;
import android.annotation.DrawableRes; import android.annotation.DrawableRes;
import android.annotation.IdRes; import android.annotation.IdRes;
import android.annotation.LayoutRes; import android.annotation.LayoutRes;
import android.content.pm.ActivityInfo.Config;
import android.content.res.ColorStateList; import android.content.res.ColorStateList;
import android.graphics.Rect; import android.graphics.Rect;
import android.graphics.Region; import android.graphics.Region;
@ -445,6 +446,12 @@ public class NavbarButtonsViewController {
return mFloatingRotationButtonBounds.contains((int) ev.getX(), (int) ev.getY()); return mFloatingRotationButtonBounds.contains((int) ev.getX(), (int) ev.getY());
} }
public void onConfigurationChanged(@Config int configChanges) {
if (mFloatingRotationButton != null) {
mFloatingRotationButton.onConfigurationChanged(configChanges);
}
}
public void onDestroy() { public void onDestroy() {
mPropertyHolders.clear(); mPropertyHolders.clear();
mControllers.rotationButtonController.unregisterListeners(); mControllers.rotationButtonController.unregisterListeners();

View File

@ -30,6 +30,7 @@ import android.app.ActivityOptions;
import android.content.ActivityNotFoundException; import android.content.ActivityNotFoundException;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.pm.ActivityInfo.Config;
import android.content.pm.LauncherApps; import android.content.pm.LauncherApps;
import android.graphics.Insets; import android.graphics.Insets;
import android.graphics.PixelFormat; import android.graphics.PixelFormat;
@ -205,6 +206,10 @@ public class TaskbarActivityContext extends ContextThemeWrapper implements Activ
mWindowManager.addView(mDragLayer, mWindowLayoutParams); mWindowManager.addView(mDragLayer, mWindowLayoutParams);
} }
public void onConfigurationChanged(@Config int configChanges) {
mControllers.onConfigurationChanged(configChanges);
}
public boolean isThreeButtonNav() { public boolean isThreeButtonNav() {
return mNavMode == Mode.THREE_BUTTONS; return mNavMode == Mode.THREE_BUTTONS;
} }

View File

@ -15,6 +15,8 @@
*/ */
package com.android.launcher3.taskbar; package com.android.launcher3.taskbar;
import android.content.pm.ActivityInfo.Config;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import com.android.systemui.shared.rotation.RotationButtonController; import com.android.systemui.shared.rotation.RotationButtonController;
@ -108,6 +110,10 @@ public class TaskbarControllers {
mPostInitCallbacks.clear(); mPostInitCallbacks.clear();
} }
public void onConfigurationChanged(@Config int configChanges) {
navbarButtonsViewController.onConfigurationChanged(configChanges);
}
/** /**
* Cleans up all controllers. * Cleans up all controllers.
*/ */

View File

@ -106,6 +106,11 @@ public class TaskbarManager implements DisplayController.DisplayInfoChangeListen
if ((configDiff & configsRequiringRecreate) != 0) { if ((configDiff & configsRequiringRecreate) != 0) {
// Color has changed, recreate taskbar to reload background color & icons. // Color has changed, recreate taskbar to reload background color & icons.
recreateTaskbar(); recreateTaskbar();
} else {
// Config change might be handled without re-creating the taskbar
if (mTaskbarActivityContext != null) {
mTaskbarActivityContext.onConfigurationChanged(configDiff);
}
} }
mOldConfig = newConfig; mOldConfig = newConfig;
} }