Merging from ub-launcher3-rvc-dev @ build 6617269
Bug: 150504032 Test: manual, presubmit on the source branch https://android-launcher.teams.x20web.corp.google.com/merge/ub-launcher3-rvc-dev_rvc-dev_6617269.html Change-Id: I7a13230553f9c42d5f67164234c33cf77efa9cf2 Merged-In: I2a168bfa8e3979ade26ab1d3cddbbae84cf79590
This commit is contained in:
commit
85d90a16bc
104 files changed
+2449
-1475
No files matched your search
@@ -83,6 +83,7 @@ public abstract class BaseQuickstepLauncher extends Launcher
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
SysUINavigationMode.INSTANCE.get(this).addModeChangeListener(this);
|
||||
addMultiWindowModeChangedListener(mDepthController);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -20,11 +20,15 @@ import static com.android.launcher3.anim.Interpolators.LINEAR;
|
||||
import static com.android.launcher3.states.StateAnimationConfig.ANIM_DEPTH;
|
||||
import static com.android.launcher3.states.StateAnimationConfig.SKIP_DEPTH_CONTROLLER;
|
||||
|
||||
import android.animation.Animator;
|
||||
import android.animation.AnimatorListenerAdapter;
|
||||
import android.animation.ObjectAnimator;
|
||||
import android.os.IBinder;
|
||||
import android.util.FloatProperty;
|
||||
import android.view.View;
|
||||
import android.view.ViewTreeObserver;
|
||||
|
||||
import com.android.launcher3.BaseActivity;
|
||||
import com.android.launcher3.Launcher;
|
||||
import com.android.launcher3.LauncherState;
|
||||
import com.android.launcher3.R;
|
||||
@@ -41,7 +45,8 @@ import com.android.systemui.shared.system.WallpaperManagerCompat;
|
||||
/**
|
||||
* Controls blur and wallpaper zoom, for the Launcher surface only.
|
||||
*/
|
||||
public class DepthController implements StateHandler<LauncherState> {
|
||||
public class DepthController implements StateHandler<LauncherState>,
|
||||
BaseActivity.MultiWindowModeChangedListener {
|
||||
|
||||
public static final FloatProperty<DepthController> DEPTH =
|
||||
new FloatProperty<DepthController>("depth") {
|
||||
@@ -104,6 +109,9 @@ public class DepthController implements StateHandler<LauncherState> {
|
||||
*/
|
||||
private float mDepth;
|
||||
|
||||
// Workaround for animating the depth when multiwindow mode changes.
|
||||
private boolean mIgnoreStateChangesDuringMultiWindowAnimation = false;
|
||||
|
||||
private View.OnAttachStateChangeListener mOnAttachListener;
|
||||
|
||||
public DepthController(Launcher l) {
|
||||
@@ -171,7 +179,7 @@ public class DepthController implements StateHandler<LauncherState> {
|
||||
|
||||
@Override
|
||||
public void setState(LauncherState toState) {
|
||||
if (mSurface == null) {
|
||||
if (mSurface == null || mIgnoreStateChangesDuringMultiWindowAnimation) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -186,7 +194,8 @@ public class DepthController implements StateHandler<LauncherState> {
|
||||
PendingAnimation animation) {
|
||||
if (mSurface == null
|
||||
|| config.onlyPlayAtomicComponent()
|
||||
|| config.hasAnimationFlag(SKIP_DEPTH_CONTROLLER)) {
|
||||
|| config.hasAnimationFlag(SKIP_DEPTH_CONTROLLER)
|
||||
|| mIgnoreStateChangesDuringMultiWindowAnimation) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -231,4 +240,21 @@ public class DepthController implements StateHandler<LauncherState> {
|
||||
.apply();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMultiWindowModeChanged(boolean isInMultiWindowMode) {
|
||||
mIgnoreStateChangesDuringMultiWindowAnimation = true;
|
||||
|
||||
ObjectAnimator mwAnimation = ObjectAnimator.ofFloat(this, DEPTH,
|
||||
mLauncher.getStateManager().getState().getDepth(mLauncher, isInMultiWindowMode))
|
||||
.setDuration(300);
|
||||
mwAnimation.addListener(new AnimatorListenerAdapter() {
|
||||
@Override
|
||||
public void onAnimationEnd(Animator animation) {
|
||||
mIgnoreStateChangesDuringMultiWindowAnimation = false;
|
||||
}
|
||||
});
|
||||
mwAnimation.setAutoCancel(true);
|
||||
mwAnimation.start();
|
||||
}
|
||||
}
|
||||
+3
-2
@@ -16,6 +16,8 @@
|
||||
package com.android.launcher3.uioverrides.touchcontrollers;
|
||||
|
||||
import static com.android.launcher3.AbstractFloatingView.TYPE_ACCESSIBLE;
|
||||
import static com.android.launcher3.AbstractFloatingView.TYPE_ALL_APPS_EDU;
|
||||
import static com.android.launcher3.AbstractFloatingView.getTopOpenViewWithType;
|
||||
import static com.android.launcher3.LauncherState.ALL_APPS;
|
||||
import static com.android.launcher3.LauncherState.NORMAL;
|
||||
import static com.android.launcher3.LauncherState.OVERVIEW;
|
||||
@@ -36,7 +38,6 @@ import android.util.Log;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.animation.Interpolator;
|
||||
|
||||
import com.android.launcher3.AbstractFloatingView;
|
||||
import com.android.launcher3.DeviceProfile;
|
||||
import com.android.launcher3.Launcher;
|
||||
import com.android.launcher3.LauncherState;
|
||||
@@ -124,7 +125,7 @@ public class PortraitStatesTouchController extends AbstractStateChangeTouchContr
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (AbstractFloatingView.getTopOpenViewWithType(mLauncher, TYPE_ACCESSIBLE) != null) {
|
||||
if (getTopOpenViewWithType(mLauncher, TYPE_ACCESSIBLE | TYPE_ALL_APPS_EDU) != null) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
||||
@@ -18,11 +18,11 @@ package com.android.quickstep.logging;
|
||||
|
||||
import static com.android.launcher3.logger.LauncherAtom.ContainerInfo.ContainerCase.FOLDER;
|
||||
import static com.android.launcher3.logger.LauncherAtom.ContainerInfo.ContainerCase.PREDICTED_HOTSEAT_CONTAINER;
|
||||
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_WORKSPACE_SNAPSHOT;
|
||||
import static com.android.systemui.shared.system.SysUiStatsLog.LAUNCHER_UICHANGED__DST_STATE__ALLAPPS;
|
||||
import static com.android.systemui.shared.system.SysUiStatsLog.LAUNCHER_UICHANGED__DST_STATE__BACKGROUND;
|
||||
import static com.android.systemui.shared.system.SysUiStatsLog.LAUNCHER_UICHANGED__DST_STATE__HOME;
|
||||
import static com.android.systemui.shared.system.SysUiStatsLog.LAUNCHER_UICHANGED__DST_STATE__OVERVIEW;
|
||||
import static com.android.systemui.shared.system.SysUiStatsLog.LAUNCHER_UICHANGED__SRC_STATE__HOME;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
@@ -30,9 +30,12 @@ import android.util.Log;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.android.launcher3.LauncherAppState;
|
||||
import com.android.launcher3.LauncherState;
|
||||
import com.android.launcher3.Utilities;
|
||||
import com.android.launcher3.logger.LauncherAtom;
|
||||
import com.android.launcher3.logger.LauncherAtom.ContainerInfo;
|
||||
import com.android.launcher3.logger.LauncherAtom.FolderIcon;
|
||||
import com.android.launcher3.logger.LauncherAtom.FromState;
|
||||
import com.android.launcher3.logger.LauncherAtom.ToState;
|
||||
import com.android.launcher3.logging.InstanceId;
|
||||
import com.android.launcher3.logging.InstanceIdSequence;
|
||||
import com.android.launcher3.logging.StatsLogManager;
|
||||
@@ -42,11 +45,15 @@ import com.android.launcher3.model.BgDataModel;
|
||||
import com.android.launcher3.model.data.FolderInfo;
|
||||
import com.android.launcher3.model.data.ItemInfo;
|
||||
import com.android.launcher3.model.data.LauncherAppWidgetInfo;
|
||||
import com.android.launcher3.model.data.WorkspaceItemInfo;
|
||||
import com.android.launcher3.util.Executors;
|
||||
import com.android.launcher3.util.IntSparseArrayMap;
|
||||
import com.android.launcher3.util.LogConfig;
|
||||
import com.android.systemui.shared.system.SysUiStatsLog;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Optional;
|
||||
import java.util.OptionalInt;
|
||||
|
||||
/**
|
||||
* This class calls StatsLog compile time generated methods.
|
||||
@@ -73,75 +80,9 @@ public class StatsLogCompatManager extends StatsLogManager {
|
||||
sContext = context;
|
||||
}
|
||||
|
||||
/**
|
||||
* Logs a {@link EventEnum}.
|
||||
*/
|
||||
@Override
|
||||
public void log(EventEnum event) {
|
||||
log(event, DEFAULT_INSTANCE_ID, (ItemInfo) null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Logs an event and accompanying {@link InstanceId}.
|
||||
*/
|
||||
@Override
|
||||
public void log(EventEnum event, InstanceId instanceId) {
|
||||
log(event, instanceId, (ItemInfo) null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Logs an event and accompanying {@link ItemInfo}.
|
||||
*/
|
||||
@Override
|
||||
public void log(EventEnum event, @Nullable ItemInfo info) {
|
||||
log(event, DEFAULT_INSTANCE_ID, info);
|
||||
}
|
||||
|
||||
/**
|
||||
* Logs an event.
|
||||
*
|
||||
* @param event an enum implementing EventEnum interface.
|
||||
* @param atomInfo item typically containing app or task launch related information.
|
||||
*/
|
||||
public void log(EventEnum event, InstanceId instanceId, LauncherAtom.ItemInfo atomInfo) {
|
||||
LauncherAppState.getInstance(sContext).getModel().enqueueModelUpdateTask(
|
||||
new BaseModelUpdateTask() {
|
||||
@Override
|
||||
public void execute(LauncherAppState app, BgDataModel dataModel,
|
||||
AllAppsList apps) {
|
||||
write(event, instanceId, atomInfo, null,
|
||||
LAUNCHER_UICHANGED__DST_STATE__HOME,
|
||||
LAUNCHER_UICHANGED__DST_STATE__BACKGROUND);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Logs an event.
|
||||
*
|
||||
* @param event an enum implementing EventEnum interface.
|
||||
* @param atomItemInfo item typically containing app or task launch related information.
|
||||
*/
|
||||
@Override
|
||||
public void log(EventEnum event, @Nullable LauncherAtom.ItemInfo atomItemInfo, int srcState,
|
||||
int dstState) {
|
||||
write(event, DEFAULT_INSTANCE_ID,
|
||||
atomItemInfo == null ? LauncherAtom.ItemInfo.getDefaultInstance() : atomItemInfo,
|
||||
null,
|
||||
srcState,
|
||||
dstState);
|
||||
}
|
||||
|
||||
/**
|
||||
* Logs an event and accompanying {@link InstanceId} and {@link LauncherAtom.ItemInfo}.
|
||||
*/
|
||||
@Override
|
||||
public void log(EventEnum event, InstanceId instanceId,
|
||||
@Nullable ItemInfo info) {
|
||||
logInternal(event, instanceId, info,
|
||||
LAUNCHER_UICHANGED__DST_STATE__HOME,
|
||||
LAUNCHER_UICHANGED__DST_STATE__BACKGROUND,
|
||||
DEFAULT_PAGE_INDEX);
|
||||
public StatsLogger logger() {
|
||||
return new StatsCompatLogger();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -157,102 +98,6 @@ public class StatsLogCompatManager extends StatsLogManager {
|
||||
position /* position_picked = 4; */);
|
||||
}
|
||||
|
||||
/**
|
||||
* Logs an event and accompanying {@link LauncherState}s. If either of the state refers
|
||||
* to workspace state, then use pageIndex to pass in index of workspace.
|
||||
*/
|
||||
@Override
|
||||
public void log(EventEnum event, int srcState, int dstState, int pageIndex) {
|
||||
logInternal(event, DEFAULT_INSTANCE_ID, null, srcState, dstState, pageIndex);
|
||||
}
|
||||
|
||||
/**
|
||||
* Logs an event and accompanying {@link InstanceId} and {@link ItemInfo}.
|
||||
*/
|
||||
private void logInternal(EventEnum event, InstanceId instanceId,
|
||||
@Nullable ItemInfo info, int srcState, int dstState, int pageIndex) {
|
||||
|
||||
LauncherAppState.getInstance(sContext).getModel().enqueueModelUpdateTask(
|
||||
new BaseModelUpdateTask() {
|
||||
@Override
|
||||
public void execute(LauncherAppState app, BgDataModel dataModel,
|
||||
AllAppsList apps) {
|
||||
writeEvent(event, instanceId, info, srcState, dstState, pageIndex,
|
||||
dataModel.folders);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private static void writeEvent(EventEnum event, InstanceId instanceId,
|
||||
@Nullable ItemInfo info, int srcState, int dstState, int pageIndex,
|
||||
IntSparseArrayMap<FolderInfo> folders) {
|
||||
|
||||
if (!Utilities.ATLEAST_R) {
|
||||
return;
|
||||
}
|
||||
LauncherAtom.ItemInfo atomInfo = LauncherAtom.ItemInfo.getDefaultInstance();
|
||||
if (info != null) {
|
||||
if (info.container >= 0) {
|
||||
atomInfo = info.buildProto(folders.get(info.container));
|
||||
} else {
|
||||
atomInfo = info.buildProto();
|
||||
}
|
||||
} else {
|
||||
if (srcState == LAUNCHER_UICHANGED__DST_STATE__HOME
|
||||
|| dstState == LAUNCHER_UICHANGED__SRC_STATE__HOME) {
|
||||
atomInfo = LauncherAtom.ItemInfo.newBuilder().setContainerInfo(
|
||||
LauncherAtom.ContainerInfo.newBuilder().setWorkspace(
|
||||
LauncherAtom.WorkspaceContainer.newBuilder().setPageIndex(pageIndex)
|
||||
)).build();
|
||||
}
|
||||
}
|
||||
write(event, instanceId, atomInfo, info, srcState, dstState);
|
||||
}
|
||||
|
||||
private static void write(EventEnum event, InstanceId instanceId,
|
||||
LauncherAtom.ItemInfo atomInfo,
|
||||
@Nullable ItemInfo info,
|
||||
int srcState, int dstState) {
|
||||
if (IS_VERBOSE) {
|
||||
String name = (event instanceof Enum) ? ((Enum) event).name() :
|
||||
event.getId() + "";
|
||||
|
||||
Log.d(TAG, instanceId == DEFAULT_INSTANCE_ID
|
||||
? String.format("\n%s (State:%s->%s) \n%s\n%s", name, getStateString(srcState),
|
||||
getStateString(dstState), info, atomInfo)
|
||||
: String.format("\n%s (State:%s->%s) (InstanceId:%s)\n%s\n%s", name,
|
||||
getStateString(srcState), getStateString(dstState), instanceId, info,
|
||||
atomInfo));
|
||||
}
|
||||
|
||||
SysUiStatsLog.write(
|
||||
SysUiStatsLog.LAUNCHER_EVENT,
|
||||
SysUiStatsLog.LAUNCHER_UICHANGED__ACTION__DEFAULT_ACTION /* deprecated */,
|
||||
srcState,
|
||||
dstState,
|
||||
null /* launcher extensions, deprecated */,
|
||||
false /* quickstep_enabled, deprecated */,
|
||||
event.getId() /* event_id */,
|
||||
atomInfo.getItemCase().getNumber() /* target_id */,
|
||||
instanceId.getId() /* instance_id TODO */,
|
||||
0 /* uid TODO */,
|
||||
getPackageName(atomInfo) /* package_name */,
|
||||
getComponentName(atomInfo) /* component_name */,
|
||||
getGridX(atomInfo, false) /* grid_x */,
|
||||
getGridY(atomInfo, false) /* grid_y */,
|
||||
getPageId(atomInfo, false) /* page_id */,
|
||||
getGridX(atomInfo, true) /* grid_x_parent */,
|
||||
getGridY(atomInfo, true) /* grid_y_parent */,
|
||||
getPageId(atomInfo, true) /* page_id_parent */,
|
||||
getHierarchy(atomInfo) /* hierarchy */,
|
||||
atomInfo.getIsWork() /* is_work_profile */,
|
||||
atomInfo.getRank() /* rank */,
|
||||
atomInfo.getFolderIcon().getFromLabelState().getNumber() /* fromState */,
|
||||
atomInfo.getFolderIcon().getToLabelState().getNumber() /* toState */,
|
||||
atomInfo.getFolderIcon().getLabelInfo() /* edittext */,
|
||||
getCardinality(atomInfo) /* cardinality */);
|
||||
}
|
||||
|
||||
/**
|
||||
* Logs the workspace layout information on the model thread.
|
||||
*/
|
||||
@@ -279,10 +124,14 @@ public class StatsLogCompatManager extends StatsLogManager {
|
||||
writeSnapshot(atomInfo, mInstanceId);
|
||||
}
|
||||
for (FolderInfo fInfo : folders) {
|
||||
for (ItemInfo info : fInfo.contents) {
|
||||
LauncherAtom.ItemInfo atomInfo = info.buildProto(fInfo);
|
||||
writeSnapshot(atomInfo, mInstanceId);
|
||||
}
|
||||
try {
|
||||
ArrayList<WorkspaceItemInfo> folderContents =
|
||||
(ArrayList) Executors.MAIN_EXECUTOR.submit(fInfo.contents::clone).get();
|
||||
for (ItemInfo info : folderContents) {
|
||||
LauncherAtom.ItemInfo atomInfo = info.buildProto(fInfo);
|
||||
writeSnapshot(atomInfo, mInstanceId);
|
||||
}
|
||||
} catch (Exception e) { }
|
||||
}
|
||||
for (ItemInfo info : appWidgets) {
|
||||
LauncherAtom.ItemInfo atomInfo = info.buildProto(null);
|
||||
@@ -299,7 +148,7 @@ public class StatsLogCompatManager extends StatsLogManager {
|
||||
return;
|
||||
}
|
||||
SysUiStatsLog.write(SysUiStatsLog.LAUNCHER_SNAPSHOT,
|
||||
0 /* event_id */,
|
||||
LAUNCHER_WORKSPACE_SNAPSHOT.getId() /* event_id */,
|
||||
info.getItemCase().getNumber() /* target_id */,
|
||||
instanceId.getId() /* instance_id */,
|
||||
0 /* uid */,
|
||||
@@ -319,6 +168,173 @@ public class StatsLogCompatManager extends StatsLogManager {
|
||||
info.getWidget().getSpanY());
|
||||
}
|
||||
|
||||
/**
|
||||
* Helps to construct and write statsd compatible log message.
|
||||
*/
|
||||
private static class StatsCompatLogger implements StatsLogger {
|
||||
|
||||
private static final ItemInfo DEFAULT_ITEM_INFO = new ItemInfo();
|
||||
private ItemInfo mItemInfo = DEFAULT_ITEM_INFO;
|
||||
private InstanceId mInstanceId = DEFAULT_INSTANCE_ID;
|
||||
private OptionalInt mRank = OptionalInt.empty();
|
||||
private Optional<ContainerInfo> mContainerInfo = Optional.empty();
|
||||
private int mSrcState = LAUNCHER_STATE_UNSPECIFIED;
|
||||
private int mDstState = LAUNCHER_STATE_UNSPECIFIED;
|
||||
private Optional<FromState> mFromState = Optional.empty();
|
||||
private Optional<ToState> mToState = Optional.empty();
|
||||
private Optional<String> mEditText = Optional.empty();
|
||||
|
||||
@Override
|
||||
public StatsLogger withItemInfo(ItemInfo itemInfo) {
|
||||
if (mContainerInfo.isPresent()) {
|
||||
throw new IllegalArgumentException(
|
||||
"ItemInfo and ContainerInfo are mutual exclusive; cannot log both.");
|
||||
}
|
||||
this.mItemInfo = itemInfo;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public StatsLogger withInstanceId(InstanceId instanceId) {
|
||||
this.mInstanceId = instanceId;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public StatsLogger withRank(int rank) {
|
||||
this.mRank = OptionalInt.of(rank);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public StatsLogger withSrcState(int srcState) {
|
||||
this.mSrcState = srcState;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public StatsLogger withDstState(int dstState) {
|
||||
this.mDstState = dstState;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public StatsLogger withContainerInfo(ContainerInfo containerInfo) {
|
||||
if (mItemInfo != DEFAULT_ITEM_INFO) {
|
||||
throw new IllegalArgumentException(
|
||||
"ItemInfo and ContainerInfo are mutual exclusive; cannot log both.");
|
||||
}
|
||||
this.mContainerInfo = Optional.of(containerInfo);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public StatsLogger withFromState(FromState fromState) {
|
||||
this.mFromState = Optional.of(fromState);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public StatsLogger withToState(ToState toState) {
|
||||
this.mToState = Optional.of(toState);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public StatsLogger withEditText(String editText) {
|
||||
this.mEditText = Optional.of(editText);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void log(EventEnum event) {
|
||||
if (!Utilities.ATLEAST_R) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (mItemInfo.container < 0) {
|
||||
// Item is not within a folder. Write to StatsLog in same thread.
|
||||
write(event, mInstanceId, applyOverwrites(mItemInfo.buildProto()), mSrcState,
|
||||
mDstState);
|
||||
} else {
|
||||
// Item is inside the folder, fetch folder info in a BG thread
|
||||
// and then write to StatsLog.
|
||||
LauncherAppState.getInstance(sContext).getModel().enqueueModelUpdateTask(
|
||||
new BaseModelUpdateTask() {
|
||||
@Override
|
||||
public void execute(LauncherAppState app, BgDataModel dataModel,
|
||||
AllAppsList apps) {
|
||||
FolderInfo folderInfo = dataModel.folders.get(mItemInfo.container);
|
||||
write(event, mInstanceId,
|
||||
applyOverwrites(mItemInfo.buildProto(folderInfo)),
|
||||
mSrcState, mDstState);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private LauncherAtom.ItemInfo applyOverwrites(LauncherAtom.ItemInfo atomInfo) {
|
||||
LauncherAtom.ItemInfo.Builder itemInfoBuilder =
|
||||
(LauncherAtom.ItemInfo.Builder) atomInfo.toBuilder();
|
||||
|
||||
mRank.ifPresent(itemInfoBuilder::setRank);
|
||||
mContainerInfo.ifPresent(itemInfoBuilder::setContainerInfo);
|
||||
|
||||
if (mFromState.isPresent() || mToState.isPresent() || mEditText.isPresent()) {
|
||||
FolderIcon.Builder folderIconBuilder = (FolderIcon.Builder) itemInfoBuilder
|
||||
.getFolderIcon()
|
||||
.toBuilder();
|
||||
mFromState.ifPresent(folderIconBuilder::setFromLabelState);
|
||||
mToState.ifPresent(folderIconBuilder::setToLabelState);
|
||||
mEditText.ifPresent(folderIconBuilder::setLabelInfo);
|
||||
itemInfoBuilder.setFolderIcon(folderIconBuilder);
|
||||
}
|
||||
return itemInfoBuilder.build();
|
||||
}
|
||||
|
||||
private void write(EventEnum event, InstanceId instanceId, LauncherAtom.ItemInfo atomInfo,
|
||||
int srcState, int dstState) {
|
||||
if (IS_VERBOSE) {
|
||||
String name = (event instanceof Enum) ? ((Enum) event).name() :
|
||||
event.getId() + "";
|
||||
|
||||
Log.d(TAG, instanceId == DEFAULT_INSTANCE_ID
|
||||
? String.format("\n%s (State:%s->%s)\n%s", name, getStateString(srcState),
|
||||
getStateString(dstState), atomInfo)
|
||||
: String.format("\n%s (State:%s->%s) (InstanceId:%s)\n%s", name,
|
||||
getStateString(srcState), getStateString(dstState), instanceId,
|
||||
atomInfo));
|
||||
}
|
||||
|
||||
SysUiStatsLog.write(
|
||||
SysUiStatsLog.LAUNCHER_EVENT,
|
||||
SysUiStatsLog.LAUNCHER_UICHANGED__ACTION__DEFAULT_ACTION /* deprecated */,
|
||||
srcState,
|
||||
dstState,
|
||||
null /* launcher extensions, deprecated */,
|
||||
false /* quickstep_enabled, deprecated */,
|
||||
event.getId() /* event_id */,
|
||||
atomInfo.getItemCase().getNumber() /* target_id */,
|
||||
instanceId.getId() /* instance_id TODO */,
|
||||
0 /* uid TODO */,
|
||||
getPackageName(atomInfo) /* package_name */,
|
||||
getComponentName(atomInfo) /* component_name */,
|
||||
getGridX(atomInfo, false) /* grid_x */,
|
||||
getGridY(atomInfo, false) /* grid_y */,
|
||||
getPageId(atomInfo, false) /* page_id */,
|
||||
getGridX(atomInfo, true) /* grid_x_parent */,
|
||||
getGridY(atomInfo, true) /* grid_y_parent */,
|
||||
getPageId(atomInfo, true) /* page_id_parent */,
|
||||
getHierarchy(atomInfo) /* hierarchy */,
|
||||
atomInfo.getIsWork() /* is_work_profile */,
|
||||
atomInfo.getRank() /* rank */,
|
||||
atomInfo.getFolderIcon().getFromLabelState().getNumber() /* fromState */,
|
||||
atomInfo.getFolderIcon().getToLabelState().getNumber() /* toState */,
|
||||
atomInfo.getFolderIcon().getLabelInfo() /* edittext */,
|
||||
getCardinality(atomInfo) /* cardinality */);
|
||||
}
|
||||
}
|
||||
|
||||
private static int getCardinality(LauncherAtom.ItemInfo info) {
|
||||
return info.getContainerInfo().getContainerCase().equals(PREDICTED_HOTSEAT_CONTAINER)
|
||||
? info.getContainerInfo().getPredictedHotseatContainer().getCardinality()
|
||||
|
||||
@@ -19,6 +19,7 @@ package com.android.quickstep.util;
|
||||
import static android.content.Intent.FLAG_ACTIVITY_NEW_TASK;
|
||||
import static android.content.Intent.FLAG_GRANT_READ_URI_PERMISSION;
|
||||
|
||||
import static com.android.launcher3.util.Executors.THREAD_POOL_EXECUTOR;
|
||||
import static com.android.launcher3.util.Executors.UI_HELPER_EXECUTOR;
|
||||
|
||||
import android.content.ClipData;
|
||||
@@ -55,6 +56,9 @@ import java.util.function.Supplier;
|
||||
public class ImageActionUtils {
|
||||
|
||||
private static final String AUTHORITY = BuildConfig.APPLICATION_ID + ".overview.fileprovider";
|
||||
private static final long FILE_LIFE = 1000L /*ms*/ * 60L /*s*/ * 60L /*m*/ * 24L /*h*/;
|
||||
private static final String SUB_FOLDER = "Overview";
|
||||
private static final String BASE_NAME = "overview_image_";
|
||||
|
||||
/**
|
||||
* Saves screenshot to location determine by SystemUiProxy
|
||||
@@ -88,8 +92,14 @@ public class ImageActionUtils {
|
||||
@WorkerThread
|
||||
public static void persistBitmapAndStartActivity(Context context, Bitmap bitmap, Rect crop,
|
||||
Intent intent, BiFunction<Uri, Intent, Intent[]> uriToIntentMap, String tag) {
|
||||
context.startActivities(
|
||||
uriToIntentMap.apply(getImageUri(bitmap, crop, context, tag), intent));
|
||||
Intent[] intents = uriToIntentMap.apply(getImageUri(bitmap, crop, context, tag), intent);
|
||||
|
||||
// Work around b/159412574
|
||||
if (intents.length == 1) {
|
||||
context.startActivity(intents[0]);
|
||||
} else {
|
||||
context.startActivities(intents);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -104,10 +114,13 @@ public class ImageActionUtils {
|
||||
*/
|
||||
@WorkerThread
|
||||
public static Uri getImageUri(Bitmap bitmap, Rect crop, Context context, String tag) {
|
||||
clearOldCacheFiles(context);
|
||||
Bitmap croppedBitmap = cropBitmap(bitmap, crop);
|
||||
int cropHash = crop == null ? 0 : crop.hashCode();
|
||||
String baseName = "image_" + bitmap.hashCode() + "_" + cropHash + ".png";
|
||||
File file = new File(context.getCacheDir(), baseName);
|
||||
String baseName = BASE_NAME + bitmap.hashCode() + "_" + cropHash + ".png";
|
||||
File parent = new File(context.getCacheDir(), SUB_FOLDER);
|
||||
parent.mkdir();
|
||||
File file = new File(parent, baseName);
|
||||
|
||||
try (FileOutputStream fos = new FileOutputStream(file)) {
|
||||
croppedBitmap.compress(Bitmap.CompressFormat.PNG, 100, fos);
|
||||
@@ -158,15 +171,30 @@ public class ImageActionUtils {
|
||||
intent = new Intent();
|
||||
}
|
||||
ClipData clipdata = new ClipData(new ClipDescription("content",
|
||||
new String[]{ClipDescription.MIMETYPE_TEXT_PLAIN}),
|
||||
new String[]{"image/png"}),
|
||||
new ClipData.Item(uri));
|
||||
intent.setAction(Intent.ACTION_SEND)
|
||||
.setComponent(null)
|
||||
.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
|
||||
.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
|
||||
.addFlags(FLAG_GRANT_READ_URI_PERMISSION)
|
||||
.setType("image/png")
|
||||
.setFlags(FLAG_GRANT_READ_URI_PERMISSION)
|
||||
.putExtra(Intent.EXTRA_STREAM, uri)
|
||||
.setClipData(clipdata);
|
||||
return new Intent[]{Intent.createChooser(intent, null).addFlags(FLAG_ACTIVITY_NEW_TASK)};
|
||||
}
|
||||
|
||||
private static void clearOldCacheFiles(Context context) {
|
||||
THREAD_POOL_EXECUTOR.execute(() -> {
|
||||
File parent = new File(context.getCacheDir(), SUB_FOLDER);
|
||||
File[] files = parent.listFiles((File f, String s) -> s.startsWith(BASE_NAME));
|
||||
if (files != null) {
|
||||
for (File file: files) {
|
||||
if (file.lastModified() + FILE_LIFE < System.currentTimeMillis()) {
|
||||
file.delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
@@ -57,34 +57,16 @@ public class LayoutUtils {
|
||||
return shelfHeight + spaceBetweenShelfAndRecents;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the scale that should be applied to the TaskView so that it matches the target
|
||||
* TODO: Remove this method
|
||||
*/
|
||||
public static float getTaskScale(RecentsOrientedState orientedState,
|
||||
float srcWidth, float srcHeight, float targetWidth, float targetHeight) {
|
||||
if (orientedState == null
|
||||
|| orientedState.isHomeRotationAllowed()
|
||||
|| orientedState.isDisplayPhoneNatural()) {
|
||||
return srcWidth / targetWidth;
|
||||
} else {
|
||||
return srcHeight / targetHeight;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Recursively sets view and all children enabled/disabled.
|
||||
* @param viewGroup Top most parent view to change.
|
||||
* @param view Top most parent view to change.
|
||||
* @param enabled True = enable, False = disable.
|
||||
*/
|
||||
public static void setViewEnabled(ViewGroup viewGroup, boolean enabled) {
|
||||
viewGroup.setEnabled(enabled);
|
||||
for (int i = 0; i < viewGroup.getChildCount(); i++) {
|
||||
View child = viewGroup.getChildAt(i);
|
||||
if (child instanceof ViewGroup) {
|
||||
setViewEnabled((ViewGroup) child, enabled);
|
||||
} else {
|
||||
child.setEnabled(enabled);
|
||||
public static void setViewEnabled(View view, boolean enabled) {
|
||||
view.setEnabled(enabled);
|
||||
if (view instanceof ViewGroup) {
|
||||
for (int i = 0; i < ((ViewGroup) view).getChildCount(); i++) {
|
||||
setViewEnabled(((ViewGroup) view).getChildAt(i), enabled);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -115,7 +115,7 @@ public class QuickstepOnboardingPrefs extends OnboardingPrefs<BaseQuickstepLaunc
|
||||
HotseatPredictionController client = mLauncher.getHotseatPredictionController();
|
||||
if (mFromAllApps && finalState == NORMAL && client.hasPredictions()) {
|
||||
if (incrementEventCount(HOTSEAT_DISCOVERY_TIP_COUNT)) {
|
||||
client.showDiscoveryTip();
|
||||
client.showEdu();
|
||||
stateManager.removeStateListener(this);
|
||||
}
|
||||
}
|
||||
@@ -144,7 +144,7 @@ public class QuickstepOnboardingPrefs extends OnboardingPrefs<BaseQuickstepLaunc
|
||||
@Override
|
||||
public void onStateTransitionComplete(LauncherState finalState) {
|
||||
if (finalState == NORMAL) {
|
||||
if (mCount == MAX_NUM_SWIPES_TO_TRIGGER_EDU) {
|
||||
if (mCount >= MAX_NUM_SWIPES_TO_TRIGGER_EDU) {
|
||||
if (getOpenView(mLauncher, TYPE_ALL_APPS_EDU) == null) {
|
||||
AllAppsEduView.show(launcher);
|
||||
}
|
||||
|
||||
@@ -33,6 +33,7 @@ import static java.lang.annotation.RetentionPolicy.SOURCE;
|
||||
import android.content.ContentResolver;
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.res.Configuration;
|
||||
import android.content.res.Resources;
|
||||
import android.database.ContentObserver;
|
||||
import android.graphics.Matrix;
|
||||
@@ -47,6 +48,7 @@ import android.view.Surface;
|
||||
|
||||
import androidx.annotation.IntDef;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.android.launcher3.DeviceProfile;
|
||||
import com.android.launcher3.InvariantDeviceProfile;
|
||||
@@ -56,6 +58,7 @@ import com.android.launcher3.touch.PagedOrientationHandler;
|
||||
import com.android.launcher3.util.WindowBounds;
|
||||
import com.android.quickstep.BaseActivityInterface;
|
||||
import com.android.quickstep.SysUINavigationMode;
|
||||
import com.android.systemui.shared.system.ConfigurationCompat;
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
import java.util.function.IntConsumer;
|
||||
@@ -87,7 +90,7 @@ public final class RecentsOrientedState implements SharedPreferences.OnSharedPre
|
||||
|
||||
private @SurfaceRotation int mTouchRotation = ROTATION_0;
|
||||
private @SurfaceRotation int mDisplayRotation = ROTATION_0;
|
||||
private @SurfaceRotation int mLauncherRotation = ROTATION_0;
|
||||
private @SurfaceRotation int mRecentsActivityRotation = ROTATION_0;
|
||||
|
||||
// Launcher activity supports multiple orientation, but fallback activity does not
|
||||
private static final int FLAG_MULTIPLE_ORIENTATION_SUPPORTED_BY_ACTIVITY = 1 << 0;
|
||||
@@ -105,6 +108,9 @@ public final class RecentsOrientedState implements SharedPreferences.OnSharedPre
|
||||
private static final int FLAG_ROTATION_WATCHER_ENABLED = 1 << 6;
|
||||
// Enable home rotation for UI tests, ignoring home rotation value from prefs
|
||||
private static final int FLAG_HOME_ROTATION_FORCE_ENABLED_FOR_TESTING = 1 << 7;
|
||||
// Whether the swipe gesture is running, so the recents would stay locked in the
|
||||
// current orientation
|
||||
private static final int FLAG_SWIPE_UP_NOT_RUNNING = 1 << 8;
|
||||
|
||||
private static final int MASK_MULTIPLE_ORIENTATION_SUPPORTED_BY_DEVICE =
|
||||
FLAG_MULTIPLE_ORIENTATION_SUPPORTED_BY_ACTIVITY
|
||||
@@ -114,22 +120,21 @@ public final class RecentsOrientedState implements SharedPreferences.OnSharedPre
|
||||
// multi-window is enabled as in that case, activity itself rotates.
|
||||
private static final int VALUE_ROTATION_WATCHER_ENABLED =
|
||||
MASK_MULTIPLE_ORIENTATION_SUPPORTED_BY_DEVICE | FLAG_SYSTEM_ROTATION_ALLOWED
|
||||
| FLAG_ROTATION_WATCHER_SUPPORTED | FLAG_ROTATION_WATCHER_ENABLED;
|
||||
|
||||
private SysUINavigationMode.NavigationModeChangeListener mNavModeChangeListener =
|
||||
newMode -> setFlag(FLAG_ROTATION_WATCHER_SUPPORTED, newMode != TWO_BUTTONS);
|
||||
| FLAG_ROTATION_WATCHER_SUPPORTED | FLAG_ROTATION_WATCHER_ENABLED
|
||||
| FLAG_SWIPE_UP_NOT_RUNNING;
|
||||
|
||||
private final Context mContext;
|
||||
private final ContentResolver mContentResolver;
|
||||
private final SharedPreferences mSharedPrefs;
|
||||
private final OrientationEventListener mOrientationListener;
|
||||
private final BaseActivityInterface mSizeStrategy;
|
||||
|
||||
private final Matrix mTmpMatrix = new Matrix();
|
||||
|
||||
private int mFlags;
|
||||
private int mPreviousRotation = ROTATION_0;
|
||||
|
||||
@Nullable private Configuration mActivityConfiguration;
|
||||
|
||||
/**
|
||||
* @param rotationChangeListener Callback for receiving rotation events when rotation watcher
|
||||
* is enabled
|
||||
@@ -140,7 +145,6 @@ public final class RecentsOrientedState implements SharedPreferences.OnSharedPre
|
||||
mContext = context;
|
||||
mContentResolver = context.getContentResolver();
|
||||
mSharedPrefs = Utilities.getPrefs(context);
|
||||
mSizeStrategy = sizeStrategy;
|
||||
mOrientationListener = new OrientationEventListener(context) {
|
||||
@Override
|
||||
public void onOrientationChanged(int degrees) {
|
||||
@@ -161,9 +165,19 @@ public final class RecentsOrientedState implements SharedPreferences.OnSharedPre
|
||||
if (originalSmallestWidth < 600) {
|
||||
mFlags |= FLAG_MULTIPLE_ORIENTATION_SUPPORTED_BY_DENSITY;
|
||||
}
|
||||
mFlags |= FLAG_SWIPE_UP_NOT_RUNNING;
|
||||
initFlags();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the configuration for the recents activity, which could affect the activity's rotation
|
||||
* @see #update(int, int)
|
||||
*/
|
||||
public boolean setActivityConfiguration(Configuration activityConfiguration) {
|
||||
mActivityConfiguration = activityConfiguration;
|
||||
return update(mTouchRotation, mDisplayRotation);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets if the host is in multi-window mode
|
||||
*/
|
||||
@@ -171,6 +185,13 @@ public final class RecentsOrientedState implements SharedPreferences.OnSharedPre
|
||||
setFlag(FLAG_MULTIWINDOW_ROTATION_ALLOWED, isMultiWindow);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets if the swipe up gesture is currently running or not
|
||||
*/
|
||||
public void setGestureActive(boolean isGestureActive) {
|
||||
setFlag(FLAG_SWIPE_UP_NOT_RUNNING, !isGestureActive);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the appropriate {@link PagedOrientationHandler} for {@link #mOrientationHandler}
|
||||
* @param touchRotation The rotation the nav bar region that is touched is in
|
||||
@@ -181,23 +202,19 @@ public final class RecentsOrientedState implements SharedPreferences.OnSharedPre
|
||||
*/
|
||||
public boolean update(
|
||||
@SurfaceRotation int touchRotation, @SurfaceRotation int displayRotation) {
|
||||
if (!isMultipleOrientationSupportedByDevice()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
int launcherRotation = inferLauncherRotation(displayRotation);
|
||||
int recentsActivityRotation = inferRecentsActivityRotation(displayRotation);
|
||||
if (mDisplayRotation == displayRotation
|
||||
&& mTouchRotation == touchRotation
|
||||
&& mLauncherRotation == launcherRotation) {
|
||||
&& mRecentsActivityRotation == recentsActivityRotation) {
|
||||
return false;
|
||||
}
|
||||
|
||||
mLauncherRotation = launcherRotation;
|
||||
mRecentsActivityRotation = recentsActivityRotation;
|
||||
mDisplayRotation = displayRotation;
|
||||
mTouchRotation = touchRotation;
|
||||
mPreviousRotation = touchRotation;
|
||||
|
||||
if (mLauncherRotation == mTouchRotation || canLauncherRotate()) {
|
||||
if (mRecentsActivityRotation == mTouchRotation || canRecentsActivityRotate()) {
|
||||
mOrientationHandler = PagedOrientationHandler.PORTRAIT;
|
||||
if (DEBUG) {
|
||||
Log.d(TAG, "current RecentsOrientedState: " + this);
|
||||
@@ -219,9 +236,11 @@ public final class RecentsOrientedState implements SharedPreferences.OnSharedPre
|
||||
}
|
||||
|
||||
@SurfaceRotation
|
||||
private int inferLauncherRotation(@SurfaceRotation int displayRotation) {
|
||||
if (!isMultipleOrientationSupportedByDevice() || isHomeRotationAllowed()) {
|
||||
return displayRotation;
|
||||
private int inferRecentsActivityRotation(@SurfaceRotation int displayRotation) {
|
||||
if (isRecentsActivityRotationAllowed()) {
|
||||
return mActivityConfiguration == null
|
||||
? displayRotation
|
||||
: ConfigurationCompat.getWindowConfigurationRotation(mActivityConfiguration);
|
||||
} else {
|
||||
return ROTATION_0;
|
||||
}
|
||||
@@ -229,7 +248,8 @@ public final class RecentsOrientedState implements SharedPreferences.OnSharedPre
|
||||
|
||||
private void setFlag(int mask, boolean enabled) {
|
||||
boolean wasRotationEnabled = !TestProtocol.sDisableSensorRotation
|
||||
&& (mFlags & VALUE_ROTATION_WATCHER_ENABLED) == VALUE_ROTATION_WATCHER_ENABLED;
|
||||
&& (mFlags & VALUE_ROTATION_WATCHER_ENABLED) == VALUE_ROTATION_WATCHER_ENABLED
|
||||
&& !canRecentsActivityRotate();
|
||||
if (enabled) {
|
||||
mFlags |= mask;
|
||||
} else {
|
||||
@@ -237,7 +257,8 @@ public final class RecentsOrientedState implements SharedPreferences.OnSharedPre
|
||||
}
|
||||
|
||||
boolean isRotationEnabled = !TestProtocol.sDisableSensorRotation
|
||||
&& (mFlags & VALUE_ROTATION_WATCHER_ENABLED) == VALUE_ROTATION_WATCHER_ENABLED;
|
||||
&& (mFlags & VALUE_ROTATION_WATCHER_ENABLED) == VALUE_ROTATION_WATCHER_ENABLED
|
||||
&& !canRecentsActivityRotate();
|
||||
if (wasRotationEnabled != isRotationEnabled) {
|
||||
UI_HELPER_EXECUTOR.execute(() -> {
|
||||
if (isRotationEnabled) {
|
||||
@@ -268,10 +289,9 @@ public final class RecentsOrientedState implements SharedPreferences.OnSharedPre
|
||||
|
||||
private void initFlags() {
|
||||
SysUINavigationMode.Mode currentMode = SysUINavigationMode.getMode(mContext);
|
||||
if (mOrientationListener.canDetectOrientation() &&
|
||||
currentMode != TWO_BUTTONS) {
|
||||
mFlags |= FLAG_ROTATION_WATCHER_SUPPORTED;
|
||||
}
|
||||
boolean rotationWatcherSupported = mOrientationListener.canDetectOrientation() &&
|
||||
currentMode != TWO_BUTTONS;
|
||||
setFlag(FLAG_ROTATION_WATCHER_SUPPORTED, rotationWatcherSupported);
|
||||
|
||||
// initialize external flags
|
||||
updateAutoRotateSetting();
|
||||
@@ -288,9 +308,6 @@ public final class RecentsOrientedState implements SharedPreferences.OnSharedPre
|
||||
mContentResolver.registerContentObserver(
|
||||
Settings.System.getUriFor(Settings.System.ACCELEROMETER_ROTATION),
|
||||
false, mSystemAutoRotateObserver);
|
||||
SysUINavigationMode.Mode currentMode =
|
||||
SysUINavigationMode.INSTANCE.get(mContext)
|
||||
.addModeChangeListener(mNavModeChangeListener);
|
||||
}
|
||||
initFlags();
|
||||
}
|
||||
@@ -302,8 +319,6 @@ public final class RecentsOrientedState implements SharedPreferences.OnSharedPre
|
||||
if (isMultipleOrientationSupportedByDevice()) {
|
||||
mSharedPrefs.unregisterOnSharedPreferenceChangeListener(this);
|
||||
mContentResolver.unregisterContentObserver(mSystemAutoRotateObserver);
|
||||
SysUINavigationMode.INSTANCE.get(mContext)
|
||||
.removeModeChangeListener(mNavModeChangeListener);
|
||||
}
|
||||
setRotationWatcherEnabled(false);
|
||||
}
|
||||
@@ -323,8 +338,8 @@ public final class RecentsOrientedState implements SharedPreferences.OnSharedPre
|
||||
}
|
||||
|
||||
@SurfaceRotation
|
||||
public int getLauncherRotation() {
|
||||
return mLauncherRotation;
|
||||
public int getRecentsActivityRotation() {
|
||||
return mRecentsActivityRotation;
|
||||
}
|
||||
|
||||
public boolean isMultipleOrientationSupportedByDevice() {
|
||||
@@ -332,14 +347,21 @@ public final class RecentsOrientedState implements SharedPreferences.OnSharedPre
|
||||
== MASK_MULTIPLE_ORIENTATION_SUPPORTED_BY_DEVICE;
|
||||
}
|
||||
|
||||
public boolean isHomeRotationAllowed() {
|
||||
return (mFlags & (FLAG_HOME_ROTATION_ALLOWED_IN_PREFS | FLAG_MULTIWINDOW_ROTATION_ALLOWED))
|
||||
!= 0 ||
|
||||
(mFlags & FLAG_HOME_ROTATION_FORCE_ENABLED_FOR_TESTING) != 0;
|
||||
public boolean isRecentsActivityRotationAllowed() {
|
||||
// Activity rotation is allowed if the multi-simulated-rotation is not supported
|
||||
// (fallback recents or tablets) or activity rotation is enabled by various settings.
|
||||
return ((mFlags & MASK_MULTIPLE_ORIENTATION_SUPPORTED_BY_DEVICE)
|
||||
!= MASK_MULTIPLE_ORIENTATION_SUPPORTED_BY_DEVICE)
|
||||
|| (mFlags & (FLAG_HOME_ROTATION_ALLOWED_IN_PREFS
|
||||
| FLAG_MULTIWINDOW_ROTATION_ALLOWED
|
||||
| FLAG_HOME_ROTATION_FORCE_ENABLED_FOR_TESTING)) != 0;
|
||||
}
|
||||
|
||||
public boolean canLauncherRotate() {
|
||||
return (mFlags & FLAG_SYSTEM_ROTATION_ALLOWED) != 0 && isHomeRotationAllowed();
|
||||
/**
|
||||
* Returns true if the activity can rotate, if allowed by system rotation settings
|
||||
*/
|
||||
public boolean canRecentsActivityRotate() {
|
||||
return (mFlags & FLAG_SYSTEM_ROTATION_ALLOWED) != 0 && isRecentsActivityRotationAllowed();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -349,20 +371,6 @@ public final class RecentsOrientedState implements SharedPreferences.OnSharedPre
|
||||
setFlag(FLAG_ROTATION_WATCHER_ENABLED, isEnabled);
|
||||
}
|
||||
|
||||
public int getTouchRotationDegrees() {
|
||||
switch (mTouchRotation) {
|
||||
case ROTATION_90:
|
||||
return 90;
|
||||
case ROTATION_180:
|
||||
return 180;
|
||||
case ROTATION_270:
|
||||
return 270;
|
||||
case ROTATION_0:
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the scale and pivot so that the provided taskRect can fit the provided full size
|
||||
*/
|
||||
@@ -521,8 +529,8 @@ public final class RecentsOrientedState implements SharedPreferences.OnSharedPre
|
||||
extractObjectNameAndAddress(mOrientationHandler.toString())
|
||||
+ " mDisplayRotation=" + mDisplayRotation
|
||||
+ " mTouchRotation=" + mTouchRotation
|
||||
+ " mLauncherRotation=" + mLauncherRotation
|
||||
+ " mHomeRotation=" + isHomeRotationAllowed()
|
||||
+ " mRecentsActivityRotation=" + mRecentsActivityRotation
|
||||
+ " isRecentsActivityRotationAllowed=" + isRecentsActivityRotationAllowed()
|
||||
+ " mSystemRotation=" + systemRotationOn
|
||||
+ " mFlags=" + mFlags
|
||||
+ "]";
|
||||
@@ -534,7 +542,8 @@ public final class RecentsOrientedState implements SharedPreferences.OnSharedPre
|
||||
public DeviceProfile getLauncherDeviceProfile() {
|
||||
InvariantDeviceProfile idp = InvariantDeviceProfile.INSTANCE.get(mContext);
|
||||
// TODO also check the natural orientation is landscape or portrait
|
||||
return (mLauncherRotation == ROTATION_90 || mLauncherRotation == ROTATION_270)
|
||||
return (mRecentsActivityRotation == ROTATION_90
|
||||
|| mRecentsActivityRotation == ROTATION_270)
|
||||
? idp.landscapeProfile
|
||||
: idp.portraitProfile;
|
||||
}
|
||||
|
||||
@@ -244,13 +244,17 @@ public class ShelfScrimView extends ScrimView<BaseQuickstepLauncher>
|
||||
|
||||
@Override
|
||||
protected void updateSysUiColors() {
|
||||
// Use a light system UI (dark icons) if all apps is behind at least half of the
|
||||
// status bar.
|
||||
boolean forceChange = mShelfTop <= mLauncher.getDeviceProfile().getInsets().top / 2f;
|
||||
if (forceChange) {
|
||||
mLauncher.getSystemUiController().updateUiState(UI_STATE_SCRIM_VIEW, !mIsScrimDark);
|
||||
if (mDrawingFlatColor) {
|
||||
super.updateSysUiColors();
|
||||
} else {
|
||||
mLauncher.getSystemUiController().updateUiState(UI_STATE_SCRIM_VIEW, 0);
|
||||
// Use a light system UI (dark icons) if all apps is behind at least half of the
|
||||
// status bar.
|
||||
boolean forceChange = mShelfTop <= mLauncher.getDeviceProfile().getInsets().top / 2f;
|
||||
if (forceChange) {
|
||||
mLauncher.getSystemUiController().updateUiState(UI_STATE_SCRIM_VIEW, !mIsScrimDark);
|
||||
} else {
|
||||
mLauncher.getSystemUiController().updateUiState(UI_STATE_SCRIM_VIEW, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user