Merging from ub-launcher3-rvc-dev @ build 6595814
Bug:150504032 Test: manual, presubmit on the source branch x20/teams/android-launcher/merge/ub-launcher3-rvc-dev_rvc-dev_6595814.html Change-Id: I4be85d0e52cc3cb8801012a7313a269851680c8b
This commit is contained in:
commit
efdc4e2318
68 files changed
+1113
-497
No files matched your search
@@ -31,6 +31,7 @@ import android.os.Bundle;
|
||||
import android.os.CancellationSignal;
|
||||
|
||||
import com.android.launcher3.config.FeatureFlags;
|
||||
import com.android.launcher3.hybridhotseat.HotseatPredictionController;
|
||||
import com.android.launcher3.model.WellbeingModel;
|
||||
import com.android.launcher3.popup.SystemShortcut;
|
||||
import com.android.launcher3.proxy.ProxyActivityStarter;
|
||||
@@ -75,6 +76,7 @@ public abstract class BaseQuickstepLauncher extends Launcher
|
||||
private final ShelfPeekAnim mShelfPeekAnim = new ShelfPeekAnim(this);
|
||||
|
||||
private OverviewActionsView mActionsView;
|
||||
protected HotseatPredictionController mHotseatPredictionController;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
@@ -305,6 +307,13 @@ public abstract class BaseQuickstepLauncher extends Launcher
|
||||
return mShelfPeekAnim;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns Prediction controller for hybrid hotseat
|
||||
*/
|
||||
public HotseatPredictionController getHotseatPredictionController() {
|
||||
return mHotseatPredictionController;
|
||||
}
|
||||
|
||||
public void setHintUserWillBeActive() {
|
||||
addActivityFlags(ACTIVITY_STATE_USER_WILL_BE_ACTIVE);
|
||||
}
|
||||
|
||||
@@ -32,6 +32,7 @@ import com.android.launcher3.Utilities;
|
||||
import com.android.launcher3.anim.PendingAnimation;
|
||||
import com.android.launcher3.statemanager.StateManager.StateHandler;
|
||||
import com.android.launcher3.states.StateAnimationConfig;
|
||||
import com.android.systemui.shared.system.BlurUtils;
|
||||
import com.android.systemui.shared.system.RemoteAnimationTargetCompat;
|
||||
import com.android.systemui.shared.system.SurfaceControlCompat;
|
||||
import com.android.systemui.shared.system.TransactionCompat;
|
||||
@@ -110,6 +111,10 @@ public class DepthController implements StateHandler<LauncherState> {
|
||||
}
|
||||
|
||||
private void ensureDependencies() {
|
||||
if (mWallpaperManager == null) {
|
||||
mMaxBlurRadius = mLauncher.getResources().getInteger(R.integer.max_depth_blur_radius);
|
||||
mWallpaperManager = new WallpaperManagerCompat(mLauncher);
|
||||
}
|
||||
if (mLauncher.getRootView() != null && mOnAttachListener == null) {
|
||||
mOnAttachListener = new View.OnAttachStateChangeListener() {
|
||||
@Override
|
||||
@@ -127,11 +132,6 @@ public class DepthController implements StateHandler<LauncherState> {
|
||||
};
|
||||
mLauncher.getRootView().addOnAttachStateChangeListener(mOnAttachListener);
|
||||
}
|
||||
if (mWallpaperManager != null) {
|
||||
return;
|
||||
}
|
||||
mMaxBlurRadius = mLauncher.getResources().getInteger(R.integer.max_depth_blur_radius);
|
||||
mWallpaperManager = new WallpaperManagerCompat(mLauncher);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -205,7 +205,8 @@ public class DepthController implements StateHandler<LauncherState> {
|
||||
return;
|
||||
}
|
||||
|
||||
if (mSurface == null || !mSurface.isValid()) {
|
||||
boolean supportsBlur = BlurUtils.supportsBlursOnWindows();
|
||||
if (supportsBlur && (mSurface == null || !mSurface.isValid())) {
|
||||
return;
|
||||
}
|
||||
mDepth = depthF;
|
||||
@@ -214,17 +215,20 @@ public class DepthController implements StateHandler<LauncherState> {
|
||||
if (windowToken != null) {
|
||||
mWallpaperManager.setWallpaperZoomOut(windowToken, mDepth);
|
||||
}
|
||||
final int blur;
|
||||
if (mLauncher.isInState(LauncherState.ALL_APPS) && mDepth == 1) {
|
||||
// All apps has a solid background. We don't need to draw blurs after it's fully
|
||||
// visible. This will take us out of GPU composition, saving battery and increasing
|
||||
// performance.
|
||||
blur = 0;
|
||||
} else {
|
||||
blur = (int) (mDepth * mMaxBlurRadius);
|
||||
|
||||
if (supportsBlur) {
|
||||
final int blur;
|
||||
if (mLauncher.isInState(LauncherState.ALL_APPS) && mDepth == 1) {
|
||||
// All apps has a solid background. We don't need to draw blurs after it's fully
|
||||
// visible. This will take us out of GPU composition, saving battery and increasing
|
||||
// performance.
|
||||
blur = 0;
|
||||
} else {
|
||||
blur = (int) (mDepth * mMaxBlurRadius);
|
||||
}
|
||||
new TransactionCompat()
|
||||
.setBackgroundBlurRadius(mSurface, blur)
|
||||
.apply();
|
||||
}
|
||||
new TransactionCompat()
|
||||
.setBackgroundBlurRadius(mSurface, blur)
|
||||
.apply();
|
||||
}
|
||||
}
|
||||
@@ -30,6 +30,8 @@ import com.android.systemui.shared.system.RemoteAnimationTargetCompat;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* Manages the state for an active system gesture, listens for events from the system and Launcher,
|
||||
@@ -128,6 +130,7 @@ public class GestureState implements RecentsAnimationCallbacks.RecentsAnimationL
|
||||
private ActivityManager.RunningTaskInfo mRunningTask;
|
||||
private GestureEndTarget mEndTarget;
|
||||
private RemoteAnimationTargetCompat mLastAppearedTaskTarget;
|
||||
private Set<Integer> mPreviouslyAppearedTaskIds = new HashSet<>();
|
||||
private int mLastStartedTaskId = -1;
|
||||
|
||||
public GestureState(OverviewComponentObserver componentObserver, int gestureId) {
|
||||
@@ -147,6 +150,7 @@ public class GestureState implements RecentsAnimationCallbacks.RecentsAnimationL
|
||||
mRunningTask = other.mRunningTask;
|
||||
mEndTarget = other.mEndTarget;
|
||||
mLastAppearedTaskTarget = other.mLastAppearedTaskTarget;
|
||||
mPreviouslyAppearedTaskIds = other.mPreviouslyAppearedTaskIds;
|
||||
mLastStartedTaskId = other.mLastStartedTaskId;
|
||||
}
|
||||
|
||||
@@ -234,6 +238,9 @@ public class GestureState implements RecentsAnimationCallbacks.RecentsAnimationL
|
||||
*/
|
||||
public void updateLastAppearedTaskTarget(RemoteAnimationTargetCompat lastAppearedTaskTarget) {
|
||||
mLastAppearedTaskTarget = lastAppearedTaskTarget;
|
||||
if (lastAppearedTaskTarget != null) {
|
||||
mPreviouslyAppearedTaskIds.add(lastAppearedTaskTarget.taskId);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -243,6 +250,14 @@ public class GestureState implements RecentsAnimationCallbacks.RecentsAnimationL
|
||||
return mLastAppearedTaskTarget != null ? mLastAppearedTaskTarget.taskId : -1;
|
||||
}
|
||||
|
||||
public void updatePreviouslyAppearedTaskIds(Set<Integer> previouslyAppearedTaskIds) {
|
||||
mPreviouslyAppearedTaskIds = previouslyAppearedTaskIds;
|
||||
}
|
||||
|
||||
public Set<Integer> getPreviouslyAppearedTaskIds() {
|
||||
return mPreviouslyAppearedTaskIds;
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the last task that we started via startActivityFromRecents() during this gesture.
|
||||
*/
|
||||
|
||||
@@ -64,6 +64,9 @@ public class StatsLogCompatManager extends StatsLogManager {
|
||||
private static Context sContext;
|
||||
|
||||
private static final InstanceId DEFAULT_INSTANCE_ID = InstanceId.fakeInstanceId(0);
|
||||
// LauncherAtom.ItemInfo.getDefaultInstance() should be used but until launcher proto migrates
|
||||
// from nano to lite, bake constant to prevent robo test failure.
|
||||
private static final int DEFAULT_PAGE_INDEX = -2;
|
||||
private static final int FOLDER_HIERARCHY_OFFSET = 100;
|
||||
|
||||
public StatsLogCompatManager(Context context) {
|
||||
@@ -75,7 +78,7 @@ public class StatsLogCompatManager extends StatsLogManager {
|
||||
*/
|
||||
@Override
|
||||
public void log(EventEnum event) {
|
||||
log(event, DEFAULT_INSTANCE_ID, LauncherAtom.ItemInfo.getDefaultInstance());
|
||||
log(event, DEFAULT_INSTANCE_ID, (ItemInfo) null);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -83,26 +86,62 @@ public class StatsLogCompatManager extends StatsLogManager {
|
||||
*/
|
||||
@Override
|
||||
public void log(EventEnum event, InstanceId instanceId) {
|
||||
log(event, instanceId, LauncherAtom.ItemInfo.getDefaultInstance());
|
||||
log(event, instanceId, (ItemInfo) null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Logs an event and accompanying {@link ItemInfo}.
|
||||
*/
|
||||
@Override
|
||||
public void log(EventEnum event, @Nullable LauncherAtom.ItemInfo info) {
|
||||
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 LauncherAtom.ItemInfo info) {
|
||||
@Nullable ItemInfo info) {
|
||||
logInternal(event, instanceId, info,
|
||||
LAUNCHER_UICHANGED__DST_STATE__HOME,
|
||||
LAUNCHER_UICHANGED__DST_STATE__BACKGROUND);
|
||||
LAUNCHER_UICHANGED__DST_STATE__BACKGROUND,
|
||||
DEFAULT_PAGE_INDEX);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -124,38 +163,67 @@ public class StatsLogCompatManager extends StatsLogManager {
|
||||
*/
|
||||
@Override
|
||||
public void log(EventEnum event, int srcState, int dstState, int pageIndex) {
|
||||
LauncherAtom.ItemInfo info = LauncherAtom.ItemInfo.getDefaultInstance();
|
||||
if (srcState == LAUNCHER_UICHANGED__DST_STATE__HOME
|
||||
|| dstState == LAUNCHER_UICHANGED__SRC_STATE__HOME) {
|
||||
info = LauncherAtom.ItemInfo.newBuilder().setContainerInfo(
|
||||
LauncherAtom.ContainerInfo.newBuilder().setWorkspace(
|
||||
LauncherAtom.WorkspaceContainer.newBuilder().setPageIndex(pageIndex)
|
||||
)).build();
|
||||
}
|
||||
logInternal(event, DEFAULT_INSTANCE_ID, info, srcState, dstState);
|
||||
logInternal(event, DEFAULT_INSTANCE_ID, null, srcState, dstState, pageIndex);
|
||||
}
|
||||
|
||||
/**
|
||||
* Logs an event and accompanying {@link InstanceId} and {@link LauncherAtom.ItemInfo}.
|
||||
* Logs an event and accompanying {@link InstanceId} and {@link ItemInfo}.
|
||||
*/
|
||||
private void logInternal(EventEnum event, InstanceId instanceId,
|
||||
@Nullable LauncherAtom.ItemInfo info, int srcState, int dstState) {
|
||||
info = info == null ? LauncherAtom.ItemInfo.getDefaultInstance() : info;
|
||||
@Nullable ItemInfo info, int srcState, int dstState, int pageIndex) {
|
||||
|
||||
if (IS_VERBOSE) {
|
||||
String name = (event instanceof LauncherEvent) ? ((LauncherEvent) event).name() :
|
||||
event.getId() + "";
|
||||
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);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Log.d(TAG, instanceId == DEFAULT_INSTANCE_ID
|
||||
? String.format("\n%s (State:%s->%s) \n%s", name, getStateString(srcState),
|
||||
getStateString(dstState), info)
|
||||
: String.format("\n%s (State:%s->%s) (InstanceId:%s)\n%s", name, instanceId,
|
||||
getStateString(srcState), getStateString(dstState), info));
|
||||
}
|
||||
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,
|
||||
@@ -165,24 +233,24 @@ public class StatsLogCompatManager extends StatsLogManager {
|
||||
null /* launcher extensions, deprecated */,
|
||||
false /* quickstep_enabled, deprecated */,
|
||||
event.getId() /* event_id */,
|
||||
info.getItemCase().getNumber() /* target_id */,
|
||||
atomInfo.getItemCase().getNumber() /* target_id */,
|
||||
instanceId.getId() /* instance_id TODO */,
|
||||
0 /* uid TODO */,
|
||||
getPackageName(info) /* package_name */,
|
||||
getComponentName(info) /* component_name */,
|
||||
getGridX(info, false) /* grid_x */,
|
||||
getGridY(info, false) /* grid_y */,
|
||||
getPageId(info, false) /* page_id */,
|
||||
getGridX(info, true) /* grid_x_parent */,
|
||||
getGridY(info, true) /* grid_y_parent */,
|
||||
getPageId(info, true) /* page_id_parent */,
|
||||
getHierarchy(info) /* hierarchy */,
|
||||
info.getIsWork() /* is_work_profile */,
|
||||
info.getRank() /* rank */,
|
||||
info.getFolderIcon().getFromLabelState().getNumber() /* fromState */,
|
||||
info.getFolderIcon().getToLabelState().getNumber() /* toState */,
|
||||
info.getFolderIcon().getLabelInfo() /* edittext */,
|
||||
getCardinality(info) /* cardinality */);
|
||||
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 */);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -333,7 +401,7 @@ public class StatsLogCompatManager extends StatsLogManager {
|
||||
}
|
||||
|
||||
private static String getStateString(int state) {
|
||||
switch(state) {
|
||||
switch (state) {
|
||||
case LAUNCHER_UICHANGED__DST_STATE__BACKGROUND:
|
||||
return "BACKGROUND";
|
||||
case LAUNCHER_UICHANGED__DST_STATE__HOME:
|
||||
|
||||
@@ -31,6 +31,7 @@ import com.android.launcher3.BaseQuickstepLauncher;
|
||||
import com.android.launcher3.LauncherState;
|
||||
import com.android.launcher3.Workspace;
|
||||
import com.android.launcher3.config.FeatureFlags;
|
||||
import com.android.launcher3.hybridhotseat.HotseatPredictionController;
|
||||
import com.android.launcher3.statemanager.StateManager;
|
||||
import com.android.launcher3.statemanager.StateManager.StateListener;
|
||||
import com.android.launcher3.util.OnboardingPrefs;
|
||||
@@ -100,6 +101,28 @@ public class QuickstepOnboardingPrefs extends OnboardingPrefs<BaseQuickstepLaunc
|
||||
});
|
||||
}
|
||||
|
||||
if (!hasReachedMaxCount(HOTSEAT_DISCOVERY_TIP_COUNT)) {
|
||||
stateManager.addStateListener(new StateListener<LauncherState>() {
|
||||
boolean mFromAllApps = false;
|
||||
|
||||
@Override
|
||||
public void onStateTransitionStart(LauncherState toState) {
|
||||
mFromAllApps = mLauncher.getStateManager().getCurrentStableState() == ALL_APPS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStateTransitionComplete(LauncherState finalState) {
|
||||
HotseatPredictionController client = mLauncher.getHotseatPredictionController();
|
||||
if (mFromAllApps && finalState == NORMAL && client.hasPredictions()) {
|
||||
if (incrementEventCount(HOTSEAT_DISCOVERY_TIP_COUNT)) {
|
||||
client.showDiscoveryTip();
|
||||
stateManager.removeStateListener(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (SysUINavigationMode.getMode(launcher) == NO_BUTTON
|
||||
&& FeatureFlags.ENABLE_ALL_APPS_EDU.get()) {
|
||||
stateManager.addStateListener(new StateListener<LauncherState>() {
|
||||
|
||||
@@ -26,8 +26,8 @@ import static android.view.Surface.ROTATION_90;
|
||||
import static com.android.launcher3.logging.LoggerUtils.extractObjectNameAndAddress;
|
||||
import static com.android.launcher3.states.RotationHelper.ALLOW_ROTATION_PREFERENCE_KEY;
|
||||
import static com.android.launcher3.util.Executors.UI_HELPER_EXECUTOR;
|
||||
|
||||
import static com.android.quickstep.SysUINavigationMode.Mode.TWO_BUTTONS;
|
||||
|
||||
import static java.lang.annotation.RetentionPolicy.SOURCE;
|
||||
|
||||
import android.content.ContentResolver;
|
||||
@@ -49,6 +49,7 @@ import androidx.annotation.IntDef;
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.android.launcher3.DeviceProfile;
|
||||
import com.android.launcher3.InvariantDeviceProfile;
|
||||
import com.android.launcher3.Utilities;
|
||||
import com.android.launcher3.testing.TestProtocol;
|
||||
import com.android.launcher3.touch.PagedOrientationHandler;
|
||||
@@ -197,7 +198,7 @@ public final class RecentsOrientedState implements SharedPreferences.OnSharedPre
|
||||
mPreviousRotation = touchRotation;
|
||||
|
||||
if (mLauncherRotation == mTouchRotation || canLauncherRotate()) {
|
||||
mOrientationHandler = PagedOrientationHandler.HOME_ROTATED;
|
||||
mOrientationHandler = PagedOrientationHandler.PORTRAIT;
|
||||
if (DEBUG) {
|
||||
Log.d(TAG, "current RecentsOrientedState: " + this);
|
||||
}
|
||||
@@ -526,4 +527,15 @@ public final class RecentsOrientedState implements SharedPreferences.OnSharedPre
|
||||
+ " mFlags=" + mFlags
|
||||
+ "]";
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the device profile based on expected launcher rotation
|
||||
*/
|
||||
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)
|
||||
? idp.landscapeProfile
|
||||
: idp.portraitProfile;
|
||||
}
|
||||
}
|
||||
@@ -23,6 +23,7 @@ import static com.android.launcher3.anim.Interpolators.ACCEL;
|
||||
import static com.android.launcher3.anim.Interpolators.ACCEL_2;
|
||||
import static com.android.launcher3.anim.Interpolators.LINEAR;
|
||||
import static com.android.launcher3.icons.GraphicsUtils.setColorAlphaBound;
|
||||
import static com.android.launcher3.util.SystemUiController.UI_STATE_SCRIM_VIEW;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Canvas;
|
||||
@@ -187,6 +188,7 @@ public class ShelfScrimView extends ScrimView<BaseQuickstepLauncher>
|
||||
mShelfTopAtThreshold = mShiftRange * SCRIM_CATCHUP_THRESHOLD + mTopOffset;
|
||||
}
|
||||
updateColors();
|
||||
updateSysUiColors();
|
||||
updateDragHandleAlpha();
|
||||
invalidate();
|
||||
}
|
||||
@@ -240,6 +242,18 @@ 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);
|
||||
} else {
|
||||
mLauncher.getSystemUiController().updateUiState(UI_STATE_SCRIM_VIEW, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean shouldDragHandleBeVisible() {
|
||||
boolean needsAllAppsEdu = mIsTwoZoneSwipeModel
|
||||
|
||||
Reference in new issue
Block a user