DO NOT MERGE - Merge pi-platform-release (PPRL.190205.001) into stage-aosp-master
Bug: 124234733 Change-Id: I2a9c871f67bdb715e266d8b4de8d225d28168414
This commit is contained in:
@@ -165,6 +165,14 @@ public class UiFactory {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void onEnterAnimationComplete(Context context) {
|
||||||
|
// After the transition to home, enable the high-res thumbnail loader if it wasn't enabled
|
||||||
|
// as a part of quickstep/scrub, so that high-res thumbnails can load the next time we
|
||||||
|
// enter overview
|
||||||
|
RecentsModel.getInstance(context).getRecentsTaskLoader()
|
||||||
|
.getHighResThumbnailLoader().setVisible(true);
|
||||||
|
}
|
||||||
|
|
||||||
public static void onLauncherStateOrResumeChanged(Launcher launcher) {
|
public static void onLauncherStateOrResumeChanged(Launcher launcher) {
|
||||||
LauncherState state = launcher.getStateManager().getState();
|
LauncherState state = launcher.getStateManager().getState();
|
||||||
DeviceProfile profile = launcher.getDeviceProfile();
|
DeviceProfile profile = launcher.getDeviceProfile();
|
||||||
|
|||||||
@@ -294,6 +294,9 @@ public interface ActivityControlHelper<T extends BaseDraggingActivity> {
|
|||||||
private void playScaleDownAnim(AnimatorSet anim, Launcher launcher) {
|
private void playScaleDownAnim(AnimatorSet anim, Launcher launcher) {
|
||||||
RecentsView recentsView = launcher.getOverviewPanel();
|
RecentsView recentsView = launcher.getOverviewPanel();
|
||||||
TaskView v = recentsView.getTaskViewAt(recentsView.getCurrentPage());
|
TaskView v = recentsView.getTaskViewAt(recentsView.getCurrentPage());
|
||||||
|
if (v == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
ClipAnimationHelper clipHelper = new ClipAnimationHelper();
|
ClipAnimationHelper clipHelper = new ClipAnimationHelper();
|
||||||
clipHelper.fromTaskThumbnailView(v.getThumbnail(), (RecentsView) v.getParent(), null);
|
clipHelper.fromTaskThumbnailView(v.getThumbnail(), (RecentsView) v.getParent(), null);
|
||||||
if (!clipHelper.getSourceRect().isEmpty() && !clipHelper.getTargetRect().isEmpty()) {
|
if (!clipHelper.getSourceRect().isEmpty() && !clipHelper.getTargetRect().isEmpty()) {
|
||||||
|
|||||||
@@ -240,6 +240,12 @@ public class RecentsActivity extends BaseDraggingActivity {
|
|||||||
onTrimMemory(TRIM_MEMORY_UI_HIDDEN);
|
onTrimMemory(TRIM_MEMORY_UI_HIDDEN);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onEnterAnimationComplete() {
|
||||||
|
super.onEnterAnimationComplete();
|
||||||
|
UiFactory.onEnterAnimationComplete(this);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onTrimMemory(int level) {
|
public void onTrimMemory(int level) {
|
||||||
super.onTrimMemory(level);
|
super.onTrimMemory(level);
|
||||||
|
|||||||
@@ -232,7 +232,6 @@ public class RecentsModel extends TaskStackChangeListener {
|
|||||||
|
|
||||||
public void onStart() {
|
public void onStart() {
|
||||||
mRecentsTaskLoader.startLoader(mContext);
|
mRecentsTaskLoader.startLoader(mContext);
|
||||||
mRecentsTaskLoader.getHighResThumbnailLoader().setVisible(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onTrimMemory(int level) {
|
public void onTrimMemory(int level) {
|
||||||
|
|||||||
@@ -30,7 +30,6 @@ import android.os.UserHandle;
|
|||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
|
||||||
import com.android.launcher3.AbstractFloatingView;
|
|
||||||
import com.android.launcher3.BaseDraggingActivity;
|
import com.android.launcher3.BaseDraggingActivity;
|
||||||
import com.android.launcher3.DeviceProfile;
|
import com.android.launcher3.DeviceProfile;
|
||||||
import com.android.launcher3.ItemInfo;
|
import com.android.launcher3.ItemInfo;
|
||||||
@@ -270,9 +269,4 @@ public class TaskSystemShortcut<T extends SystemShortcut> extends SystemShortcut
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void dismissTaskMenuView(BaseDraggingActivity activity) {
|
|
||||||
AbstractFloatingView.closeOpenViews(activity, true,
|
|
||||||
AbstractFloatingView.TYPE_ALL & ~AbstractFloatingView.TYPE_REBIND_SAFE);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -483,6 +483,12 @@ public class WindowTransformSwipeHandler<T extends BaseDraggingActivity> {
|
|||||||
if (LatencyTrackerCompat.isEnabled(mContext)) {
|
if (LatencyTrackerCompat.isEnabled(mContext)) {
|
||||||
LatencyTrackerCompat.logToggleRecents((int) (mLauncherFrameDrawnTime - mTouchTimeMs));
|
LatencyTrackerCompat.logToggleRecents((int) (mLauncherFrameDrawnTime - mTouchTimeMs));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// This method is only called when STATE_GESTURE_STARTED_QUICKSTEP/
|
||||||
|
// STATE_GESTURE_STARTED_QUICKSCRUB is set, so we can enable the high-res thumbnail loader
|
||||||
|
// here once we are sure that we will end up in an overview state
|
||||||
|
RecentsModel.getInstance(mContext).getRecentsTaskLoader()
|
||||||
|
.getHighResThumbnailLoader().setVisible(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateInteractionType(@InteractionType int interactionType) {
|
public void updateInteractionType(@InteractionType int interactionType) {
|
||||||
|
|||||||
@@ -133,13 +133,13 @@
|
|||||||
launcher:name="Nexus 7"
|
launcher:name="Nexus 7"
|
||||||
launcher:minWidthDps="575"
|
launcher:minWidthDps="575"
|
||||||
launcher:minHeightDps="904"
|
launcher:minHeightDps="904"
|
||||||
launcher:numRows="5"
|
launcher:numRows="6"
|
||||||
launcher:numColumns="6"
|
launcher:numColumns="6"
|
||||||
launcher:numFolderRows="4"
|
launcher:numFolderRows="4"
|
||||||
launcher:numFolderColumns="5"
|
launcher:numFolderColumns="5"
|
||||||
launcher:iconSize="64"
|
launcher:iconSize="64"
|
||||||
launcher:iconTextSize="14.4"
|
launcher:iconTextSize="14.4"
|
||||||
launcher:numHotseatIcons="7"
|
launcher:numHotseatIcons="6"
|
||||||
launcher:defaultLayoutId="@xml/default_workspace_5x6"
|
launcher:defaultLayoutId="@xml/default_workspace_5x6"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
@@ -147,8 +147,8 @@
|
|||||||
launcher:name="Nexus 10"
|
launcher:name="Nexus 10"
|
||||||
launcher:minWidthDps="727"
|
launcher:minWidthDps="727"
|
||||||
launcher:minHeightDps="1207"
|
launcher:minHeightDps="1207"
|
||||||
launcher:numRows="5"
|
launcher:numRows="6"
|
||||||
launcher:numColumns="6"
|
launcher:numColumns="7"
|
||||||
launcher:numFolderRows="4"
|
launcher:numFolderRows="4"
|
||||||
launcher:numFolderColumns="5"
|
launcher:numFolderColumns="5"
|
||||||
launcher:iconSize="76"
|
launcher:iconSize="76"
|
||||||
|
|||||||
@@ -59,6 +59,9 @@ public class DeviceProfile {
|
|||||||
|
|
||||||
private static final float TALL_DEVICE_ASPECT_RATIO_THRESHOLD = 2.0f;
|
private static final float TALL_DEVICE_ASPECT_RATIO_THRESHOLD = 2.0f;
|
||||||
|
|
||||||
|
// To evenly space the icons, increase the left/right margins for tablets in portrait mode.
|
||||||
|
private static final int PORTRAIT_TABLET_LEFT_RIGHT_PADDING_MULTIPLIER = 4;
|
||||||
|
|
||||||
// Workspace
|
// Workspace
|
||||||
public final int desiredWorkspaceLeftRightMarginPx;
|
public final int desiredWorkspaceLeftRightMarginPx;
|
||||||
public final int cellLayoutPaddingLeftRightPx;
|
public final int cellLayoutPaddingLeftRightPx;
|
||||||
@@ -172,7 +175,9 @@ public class DeviceProfile {
|
|||||||
defaultWidgetPadding = AppWidgetHostView.getDefaultPaddingForWidget(context, cn, null);
|
defaultWidgetPadding = AppWidgetHostView.getDefaultPaddingForWidget(context, cn, null);
|
||||||
edgeMarginPx = res.getDimensionPixelSize(R.dimen.dynamic_grid_edge_margin);
|
edgeMarginPx = res.getDimensionPixelSize(R.dimen.dynamic_grid_edge_margin);
|
||||||
desiredWorkspaceLeftRightMarginPx = isVerticalBarLayout() ? 0 : edgeMarginPx;
|
desiredWorkspaceLeftRightMarginPx = isVerticalBarLayout() ? 0 : edgeMarginPx;
|
||||||
cellLayoutPaddingLeftRightPx =
|
int cellLayoutPaddingLeftRightMultiplier = !isVerticalBarLayout() && isTablet
|
||||||
|
? PORTRAIT_TABLET_LEFT_RIGHT_PADDING_MULTIPLIER : 1;
|
||||||
|
cellLayoutPaddingLeftRightPx = cellLayoutPaddingLeftRightMultiplier *
|
||||||
res.getDimensionPixelSize(R.dimen.dynamic_grid_cell_layout_padding);
|
res.getDimensionPixelSize(R.dimen.dynamic_grid_cell_layout_padding);
|
||||||
cellLayoutBottomPaddingPx =
|
cellLayoutBottomPaddingPx =
|
||||||
res.getDimensionPixelSize(R.dimen.dynamic_grid_cell_layout_bottom_padding);
|
res.getDimensionPixelSize(R.dimen.dynamic_grid_cell_layout_bottom_padding);
|
||||||
|
|||||||
@@ -347,6 +347,12 @@ public class Launcher extends BaseDraggingActivity implements LauncherExterns,
|
|||||||
TraceHelper.endSection("Launcher-onCreate");
|
TraceHelper.endSection("Launcher-onCreate");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onEnterAnimationComplete() {
|
||||||
|
super.onEnterAnimationComplete();
|
||||||
|
UiFactory.onEnterAnimationComplete(this);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onConfigurationChanged(Configuration newConfig) {
|
public void onConfigurationChanged(Configuration newConfig) {
|
||||||
int diff = newConfig.diff(mOldConfig);
|
int diff = newConfig.diff(mOldConfig);
|
||||||
|
|||||||
@@ -286,7 +286,9 @@ public class Workspace extends PagedView<WorkspacePageIndicator>
|
|||||||
mInsets.set(insets);
|
mInsets.set(insets);
|
||||||
|
|
||||||
DeviceProfile grid = mLauncher.getDeviceProfile();
|
DeviceProfile grid = mLauncher.getDeviceProfile();
|
||||||
mMaxDistanceForFolderCreation = (0.55f * grid.iconSizePx);
|
mMaxDistanceForFolderCreation = grid.isTablet
|
||||||
|
? 0.75f * grid.iconSizePx
|
||||||
|
: 0.55f * grid.iconSizePx;
|
||||||
mWorkspaceFadeInAdjacentScreens = grid.shouldFadeAdjacentWorkspaceScreens();
|
mWorkspaceFadeInAdjacentScreens = grid.shouldFadeAdjacentWorkspaceScreens();
|
||||||
|
|
||||||
Rect padding = grid.workspacePadding;
|
Rect padding = grid.workspacePadding;
|
||||||
|
|||||||
@@ -126,13 +126,13 @@ public class ShadowGenerator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Bitmap createPill(int width, int height) {
|
public Bitmap createPill(int width, int height) {
|
||||||
radius = height / 2;
|
radius = height / 2f;
|
||||||
|
|
||||||
int centerX = Math.round(width / 2 + shadowBlur);
|
int centerX = Math.round(width / 2f + shadowBlur);
|
||||||
int centerY = Math.round(radius + shadowBlur + keyShadowDistance);
|
int centerY = Math.round(radius + shadowBlur + keyShadowDistance);
|
||||||
int center = Math.max(centerX, centerY);
|
int center = Math.max(centerX, centerY);
|
||||||
bounds.set(0, 0, width, height);
|
bounds.set(0, 0, width, height);
|
||||||
bounds.offsetTo(center - width / 2, center - height / 2);
|
bounds.offsetTo(center - width / 2f, center - height / 2f);
|
||||||
|
|
||||||
int size = center * 2;
|
int size = center * 2;
|
||||||
Bitmap result = Bitmap.createBitmap(size, size, Config.ARGB_8888);
|
Bitmap result = Bitmap.createBitmap(size, size, Config.ARGB_8888);
|
||||||
|
|||||||
@@ -75,6 +75,7 @@ public abstract class SystemShortcut<T extends BaseDraggingActivity> extends Ite
|
|||||||
public View.OnClickListener getOnClickListener(
|
public View.OnClickListener getOnClickListener(
|
||||||
BaseDraggingActivity activity, ItemInfo itemInfo) {
|
BaseDraggingActivity activity, ItemInfo itemInfo) {
|
||||||
return (view) -> {
|
return (view) -> {
|
||||||
|
dismissTaskMenuView(activity);
|
||||||
Rect sourceBounds = activity.getViewBounds(view);
|
Rect sourceBounds = activity.getViewBounds(view);
|
||||||
Bundle opts = activity.getActivityLaunchOptionsAsBundle(view);
|
Bundle opts = activity.getActivityLaunchOptionsAsBundle(view);
|
||||||
new PackageManagerHelper(activity).startDetailsActivityForInfo(
|
new PackageManagerHelper(activity).startDetailsActivityForInfo(
|
||||||
@@ -117,4 +118,9 @@ public abstract class SystemShortcut<T extends BaseDraggingActivity> extends Ite
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected static void dismissTaskMenuView(BaseDraggingActivity activity) {
|
||||||
|
AbstractFloatingView.closeOpenViews(activity, true,
|
||||||
|
AbstractFloatingView.TYPE_ALL & ~AbstractFloatingView.TYPE_REBIND_SAFE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -162,7 +162,6 @@ public class QsbContainerView extends FrameLayout {
|
|||||||
.getAppWidgetOptions(widgetId), opts)) {
|
.getAppWidgetOptions(widgetId), opts)) {
|
||||||
mQsb.updateAppWidgetOptions(opts);
|
mQsb.updateAppWidgetOptions(opts);
|
||||||
}
|
}
|
||||||
mQsb.setPadding(0, 0, 0, 0);
|
|
||||||
mQsbWidgetHost.startListening();
|
mQsbWidgetHost.startListening();
|
||||||
return mQsb;
|
return mQsb;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -52,6 +52,11 @@ public class QsbWidgetHostView extends AppWidgetHostView {
|
|||||||
return mPreviousOrientation != orientation;
|
return mPreviousOrientation != orientation;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setPadding(int left, int top, int right, int bottom) {
|
||||||
|
// Prevent the base class from applying the default widget padding.
|
||||||
|
super.setPadding(0, 0, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
|
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
|
||||||
|
|||||||
@@ -21,37 +21,102 @@ import android.content.Context;
|
|||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.IntentFilter;
|
import android.content.IntentFilter;
|
||||||
import android.content.res.Configuration;
|
import android.content.res.Configuration;
|
||||||
|
import android.graphics.Point;
|
||||||
|
import android.hardware.display.DisplayManager;
|
||||||
|
import android.hardware.display.DisplayManager.DisplayListener;
|
||||||
|
import android.os.Handler;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
import android.view.Display;
|
||||||
|
import android.view.WindowManager;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@link BroadcastReceiver} which watches configuration changes and
|
* {@link BroadcastReceiver} which watches configuration changes and
|
||||||
* restarts the process in case changes which affect the device profile occur.
|
* restarts the process in case changes which affect the device profile occur.
|
||||||
*/
|
*/
|
||||||
public class ConfigMonitor extends BroadcastReceiver {
|
public class ConfigMonitor extends BroadcastReceiver implements DisplayListener {
|
||||||
|
|
||||||
|
private static final String TAG = "ConfigMonitor";
|
||||||
|
|
||||||
|
private final Point mTmpPoint1 = new Point();
|
||||||
|
private final Point mTmpPoint2 = new Point();
|
||||||
|
|
||||||
private final Context mContext;
|
private final Context mContext;
|
||||||
private final float mFontScale;
|
private final float mFontScale;
|
||||||
private final int mDensity;
|
private final int mDensity;
|
||||||
|
|
||||||
|
private final int mDisplayId;
|
||||||
|
private final Point mRealSize;
|
||||||
|
private final Point mSmallestSize, mLargestSize;
|
||||||
|
|
||||||
public ConfigMonitor(Context context) {
|
public ConfigMonitor(Context context) {
|
||||||
mContext = context;
|
mContext = context;
|
||||||
|
|
||||||
Configuration config = context.getResources().getConfiguration();
|
Configuration config = context.getResources().getConfiguration();
|
||||||
mFontScale = config.fontScale;
|
mFontScale = config.fontScale;
|
||||||
mDensity = config.densityDpi;
|
mDensity = config.densityDpi;
|
||||||
|
|
||||||
|
Display display = getDefaultDisplay(context);
|
||||||
|
mDisplayId = display.getDisplayId();
|
||||||
|
|
||||||
|
mRealSize = new Point();
|
||||||
|
display.getRealSize(mRealSize);
|
||||||
|
|
||||||
|
mSmallestSize = new Point();
|
||||||
|
mLargestSize = new Point();
|
||||||
|
display.getCurrentSizeRange(mSmallestSize, mLargestSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onReceive(Context context, Intent intent) {
|
public void onReceive(Context context, Intent intent) {
|
||||||
Configuration config = context.getResources().getConfiguration();
|
Configuration config = context.getResources().getConfiguration();
|
||||||
if (mFontScale != config.fontScale || mDensity != config.densityDpi) {
|
if (mFontScale != config.fontScale || mDensity != config.densityDpi) {
|
||||||
Log.d("ConfigMonitor", "Configuration changed, restarting launcher");
|
Log.d(TAG, "Configuration changed");
|
||||||
mContext.unregisterReceiver(this);
|
killProcess();
|
||||||
android.os.Process.killProcess(android.os.Process.myPid());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void register() {
|
public void register() {
|
||||||
mContext.registerReceiver(this, new IntentFilter(Intent.ACTION_CONFIGURATION_CHANGED));
|
mContext.registerReceiver(this, new IntentFilter(Intent.ACTION_CONFIGURATION_CHANGED));
|
||||||
|
mContext.getSystemService(DisplayManager.class)
|
||||||
|
.registerDisplayListener(this, new Handler(UiThreadHelper.getBackgroundLooper()));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDisplayAdded(int displayId) { }
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDisplayRemoved(int displayId) { }
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDisplayChanged(int displayId) {
|
||||||
|
if (displayId != mDisplayId) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Display display = getDefaultDisplay(mContext);
|
||||||
|
display.getRealSize(mTmpPoint1);
|
||||||
|
|
||||||
|
if (!mRealSize.equals(mTmpPoint1) && !mRealSize.equals(mTmpPoint1.y, mTmpPoint1.x)) {
|
||||||
|
Log.d(TAG, String.format("Display size changed from %s to %s", mRealSize, mTmpPoint1));
|
||||||
|
killProcess();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
display.getCurrentSizeRange(mTmpPoint1, mTmpPoint2);
|
||||||
|
if (!mSmallestSize.equals(mTmpPoint1) || !mLargestSize.equals(mTmpPoint2)) {
|
||||||
|
Log.d(TAG, String.format("Available size changed from [%s, %s] to [%s, %s]",
|
||||||
|
mSmallestSize, mLargestSize, mTmpPoint1, mTmpPoint2));
|
||||||
|
killProcess();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void killProcess() {
|
||||||
|
Log.d(TAG, "restarting launcher");
|
||||||
|
mContext.unregisterReceiver(this);
|
||||||
|
mContext.getSystemService(DisplayManager.class).unregisterDisplayListener(this);
|
||||||
|
android.os.Process.killProcess(android.os.Process.myPid());
|
||||||
|
}
|
||||||
|
|
||||||
|
private Display getDefaultDisplay(Context context) {
|
||||||
|
return context.getSystemService(WindowManager.class).getDefaultDisplay();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,6 +48,8 @@ public class UiFactory {
|
|||||||
|
|
||||||
public static void onStart(Launcher launcher) { }
|
public static void onStart(Launcher launcher) { }
|
||||||
|
|
||||||
|
public static void onEnterAnimationComplete(Context context) {}
|
||||||
|
|
||||||
public static void onLauncherStateOrResumeChanged(Launcher launcher) { }
|
public static void onLauncherStateOrResumeChanged(Launcher launcher) { }
|
||||||
|
|
||||||
public static void onTrimMemory(Launcher launcher, int level) { }
|
public static void onTrimMemory(Launcher launcher, int level) { }
|
||||||
|
|||||||
Reference in New Issue
Block a user