Snap for 11367679 from 64af5ca348 to 24Q2-release
Change-Id: I90788a85fcb4b72a09ed2506e096ad44d3addb99
This commit is contained in:
+1
-1
@@ -20,7 +20,7 @@
|
||||
<manifest
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.android.launcher3">
|
||||
<uses-sdk android:targetSdkVersion="33" android:minSdkVersion="26"/>
|
||||
<uses-sdk android:targetSdkVersion="33" android:minSdkVersion="30"/>
|
||||
<!--
|
||||
Manifest entries specific to Launcher3. This is merged with AndroidManifest-common.xml.
|
||||
Refer comments around specific entries on how to extend individual components.
|
||||
|
||||
+2
-2
@@ -20,8 +20,8 @@ android {
|
||||
buildToolsVersion BUILD_TOOLS_VERSION
|
||||
|
||||
defaultConfig {
|
||||
minSdkVersion 26
|
||||
targetSdkVersion 30
|
||||
minSdkVersion 30
|
||||
targetSdkVersion 33
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
|
||||
|
||||
@@ -230,6 +230,7 @@
|
||||
<string name="action_split">Split</string>
|
||||
<!-- Label for toast with instructions for split screen selection mode. [CHAR_LIMIT=50] -->
|
||||
<string name="toast_split_select_app">Tap another app to use split screen</string>
|
||||
<string name="toast_contextual_split_select_app">Choose another app to use split screen</string>
|
||||
<string name="toast_split_select_app_cancel"><b>Cancel</b></string>
|
||||
<string name="toast_split_select_cont_desc">Exit split screen selection</string>
|
||||
<!-- Label for toast when app selected for split isn't supported. [CHAR_LIMIT=50] -->
|
||||
|
||||
@@ -24,9 +24,7 @@ import static com.android.systemui.shared.recents.utilities.Utilities.postAtFron
|
||||
import android.animation.Animator;
|
||||
import android.animation.AnimatorListenerAdapter;
|
||||
import android.animation.AnimatorSet;
|
||||
import android.annotation.TargetApi;
|
||||
import android.content.Context;
|
||||
import android.os.Build;
|
||||
import android.os.Handler;
|
||||
import android.os.RemoteException;
|
||||
import android.view.IRemoteAnimationFinishedCallback;
|
||||
@@ -57,7 +55,6 @@ import java.lang.ref.WeakReference;
|
||||
* the runner implementation. When this animation manager is destroyed, we remove the Launcher
|
||||
* reference to the runner, leaving only the weak ref from the runner.
|
||||
*/
|
||||
@TargetApi(Build.VERSION_CODES.P)
|
||||
public class LauncherAnimationRunner extends RemoteAnimationRunnerCompat {
|
||||
|
||||
private static final RemoteAnimationFactory DEFAULT_FACTORY =
|
||||
|
||||
@@ -15,14 +15,10 @@
|
||||
*/
|
||||
package com.android.launcher3;
|
||||
|
||||
import android.annotation.TargetApi;
|
||||
import android.os.Build;
|
||||
|
||||
import com.android.quickstep.util.ActivityInitListener;
|
||||
|
||||
import java.util.function.BiPredicate;
|
||||
|
||||
@TargetApi(Build.VERSION_CODES.P)
|
||||
public class LauncherInitListener extends ActivityInitListener<Launcher> {
|
||||
|
||||
/**
|
||||
|
||||
@@ -64,6 +64,7 @@ import static com.android.launcher3.views.FloatingIconView.SHAPE_PROGRESS_DURATI
|
||||
import static com.android.launcher3.views.FloatingIconView.getFloatingIconView;
|
||||
import static com.android.quickstep.TaskAnimationManager.ENABLE_SHELL_TRANSITIONS;
|
||||
import static com.android.quickstep.TaskViewUtils.findTaskViewToLaunch;
|
||||
import static com.android.quickstep.util.AnimUtils.completeRunnableListCallback;
|
||||
import static com.android.systemui.shared.system.QuickStepContract.getWindowCornerRadius;
|
||||
import static com.android.systemui.shared.system.QuickStepContract.supportsRoundedCornersOnWindows;
|
||||
|
||||
@@ -88,6 +89,7 @@ import android.graphics.drawable.ColorDrawable;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Handler;
|
||||
import android.os.IBinder;
|
||||
import android.os.IRemoteCallback;
|
||||
import android.os.Looper;
|
||||
import android.os.SystemProperties;
|
||||
import android.os.UserHandle;
|
||||
@@ -351,6 +353,9 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
|
||||
new RemoteAnimationAdapter(runner, duration, statusBarTransitionDelay),
|
||||
new RemoteTransition(runner.toRemoteTransition(),
|
||||
mLauncher.getIApplicationThread(), "QuickstepLaunch"));
|
||||
IRemoteCallback endCallback = completeRunnableListCallback(onEndCallback);
|
||||
options.setOnAnimationAbortListener(endCallback);
|
||||
options.setOnAnimationFinishedListener(endCallback);
|
||||
return new ActivityOptionsWrapper(options, onEndCallback);
|
||||
}
|
||||
|
||||
@@ -1663,14 +1668,20 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
|
||||
? Cuj.CUJ_LAUNCHER_APP_CLOSE_TO_HOME_FALLBACK
|
||||
: Cuj.CUJ_LAUNCHER_APP_CLOSE_TO_HOME);
|
||||
|
||||
anim.addListener(new AnimatorListenerAdapter() {
|
||||
AnimatorListenerAdapter endListener = new AnimatorListenerAdapter() {
|
||||
@Override
|
||||
public void onAnimationEnd(Animator animation) {
|
||||
super.onAnimationEnd(animation);
|
||||
AccessibilityManagerCompat.sendTestProtocolEventToTest(
|
||||
mLauncher, WALLPAPER_OPEN_ANIMATION_FINISHED_MESSAGE);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
if (fromPredictiveBack) {
|
||||
rectFSpringAnim.addAnimatorListener(endListener);
|
||||
} else {
|
||||
anim.addListener(endListener);
|
||||
}
|
||||
|
||||
// Only register the content animation for cancellation when state changes
|
||||
mLauncher.getStateManager().setCurrentAnimation(anim);
|
||||
|
||||
@@ -16,10 +16,8 @@
|
||||
|
||||
package com.android.launcher3.appprediction;
|
||||
|
||||
import android.annotation.TargetApi;
|
||||
import android.content.Context;
|
||||
import android.graphics.Canvas;
|
||||
import android.os.Build;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
@@ -50,7 +48,6 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@TargetApi(Build.VERSION_CODES.P)
|
||||
public class PredictionRowView<T extends Context & ActivityContext>
|
||||
extends LinearLayout implements OnDeviceProfileChangeListener, FloatingHeaderRow {
|
||||
|
||||
|
||||
@@ -45,14 +45,12 @@ import static com.android.launcher3.model.PredictionHelper.isTrackedForHotseatPr
|
||||
import static com.android.launcher3.model.PredictionHelper.isTrackedForWidgetPrediction;
|
||||
import static com.android.launcher3.util.Executors.MODEL_EXECUTOR;
|
||||
|
||||
import android.annotation.TargetApi;
|
||||
import android.app.prediction.AppTarget;
|
||||
import android.app.prediction.AppTargetEvent;
|
||||
import android.app.prediction.AppTargetId;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.pm.ShortcutInfo;
|
||||
import android.os.Build;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.os.Process;
|
||||
@@ -84,7 +82,6 @@ import java.util.function.ObjIntConsumer;
|
||||
/**
|
||||
* Utility class to track stats log and emit corresponding app events
|
||||
*/
|
||||
@TargetApi(Build.VERSION_CODES.R)
|
||||
public class AppEventProducer implements StatsLogConsumer {
|
||||
|
||||
private static final int MSG_LAUNCH = 0;
|
||||
|
||||
@@ -20,7 +20,6 @@ import static android.content.ContentResolver.SCHEME_CONTENT;
|
||||
|
||||
import static com.android.launcher3.util.SimpleBroadcastReceiver.getPackageFilter;
|
||||
|
||||
import android.annotation.TargetApi;
|
||||
import android.app.RemoteAction;
|
||||
import android.content.ContentProviderClient;
|
||||
import android.content.ContentResolver;
|
||||
@@ -30,7 +29,6 @@ import android.content.IntentFilter;
|
||||
import android.content.pm.LauncherApps;
|
||||
import android.database.ContentObserver;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.DeadObjectException;
|
||||
import android.os.Handler;
|
||||
@@ -63,7 +61,6 @@ import java.util.Map;
|
||||
/**
|
||||
* Data model for digital wellbeing status of apps.
|
||||
*/
|
||||
@TargetApi(Build.VERSION_CODES.Q)
|
||||
public final class WellbeingModel extends BgObjectWithLooper {
|
||||
private static final String TAG = "WellbeingModel";
|
||||
private static final int[] RETRY_TIMES_MS = {5000, 15000, 30000};
|
||||
|
||||
@@ -104,13 +104,6 @@ public class FallbackTaskbarUIController extends TaskbarUIController {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isInOverview() {
|
||||
TopTaskTracker.CachedTaskInfo topTask = TopTaskTracker.INSTANCE
|
||||
.get(mControllers.taskbarActivityContext).getCachedTopTask(true);
|
||||
return topTask.isRecentsTask();
|
||||
}
|
||||
|
||||
@Override
|
||||
public RecentsView getRecentsView() {
|
||||
return mRecentsActivity.getOverviewPanel();
|
||||
|
||||
@@ -37,24 +37,23 @@ import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCH
|
||||
import static com.android.launcher3.taskbar.TaskbarAutohideSuspendController.FLAG_AUTOHIDE_SUSPEND_DRAGGING;
|
||||
import static com.android.launcher3.taskbar.TaskbarAutohideSuspendController.FLAG_AUTOHIDE_SUSPEND_FULLSCREEN;
|
||||
import static com.android.launcher3.testing.shared.ResourceUtils.getBoolByName;
|
||||
import static com.android.quickstep.util.AnimUtils.completeRunnableListCallback;
|
||||
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_NOTIFICATION_PANEL_VISIBLE;
|
||||
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_VOICE_INTERACTION_WINDOW_SHOWING;
|
||||
|
||||
import android.animation.AnimatorSet;
|
||||
import android.animation.ValueAnimator;
|
||||
import android.app.ActivityManager.RunningTaskInfo;
|
||||
import android.app.ActivityOptions;
|
||||
import android.app.ActivityTaskManager;
|
||||
import android.content.ActivityNotFoundException;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.ActivityInfo.Config;
|
||||
import android.content.pm.LauncherApps;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.PixelFormat;
|
||||
import android.graphics.Rect;
|
||||
import android.hardware.display.DisplayManager;
|
||||
import android.os.IRemoteCallback;
|
||||
import android.os.Process;
|
||||
import android.os.Trace;
|
||||
import android.provider.Settings;
|
||||
@@ -66,7 +65,6 @@ import android.view.Surface;
|
||||
import android.view.View;
|
||||
import android.view.WindowInsets;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
@@ -134,13 +132,10 @@ import com.android.systemui.unfold.updates.RotationChangeProvider;
|
||||
import com.android.systemui.unfold.util.ScopedUnfoldTransitionProgressProvider;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* The {@link ActivityContext} with which we inflate Taskbar-related Views. This allows UI elements
|
||||
@@ -744,13 +739,14 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
|
||||
@Override
|
||||
public ActivityOptionsWrapper makeDefaultActivityOptions(int splashScreenStyle) {
|
||||
RunnableList callbacks = new RunnableList();
|
||||
ActivityOptions options = ActivityOptions.makeCustomAnimation(
|
||||
this, 0, 0, Color.TRANSPARENT,
|
||||
Executors.MAIN_EXECUTOR.getHandler(), null,
|
||||
elapsedRealTime -> callbacks.executeAllAndDestroy());
|
||||
ActivityOptions options = ActivityOptions.makeCustomAnimation(this, 0, 0);
|
||||
options.setSplashScreenStyle(splashScreenStyle);
|
||||
options.setPendingIntentBackgroundActivityStartMode(
|
||||
ActivityOptions.MODE_BACKGROUND_ACTIVITY_START_ALLOWED);
|
||||
IRemoteCallback endCallback = completeRunnableListCallback(callbacks);
|
||||
options.setOnAnimationAbortListener(endCallback);
|
||||
options.setOnAnimationFinishedListener(endCallback);
|
||||
|
||||
return new ActivityOptionsWrapper(options, callbacks);
|
||||
}
|
||||
|
||||
@@ -1179,25 +1175,15 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
|
||||
@Nullable Task foundTask = foundTasks[0];
|
||||
if (foundTask != null) {
|
||||
TaskView foundTaskView = recents.getTaskViewByTaskId(foundTask.key.id);
|
||||
if (foundTaskView != null) {
|
||||
// The foundTaskView contains the 1-2 taskIds we are looking for.
|
||||
// If we are already in-app and running the correct tasks, no need
|
||||
// to do anything.
|
||||
if (FeatureFlags.enableAppPairs()
|
||||
&& isAlreadyInApp(foundTaskView.getTaskIds())) {
|
||||
return;
|
||||
}
|
||||
// If we are in Overview and the TaskView tile is visible, expand that
|
||||
// tile.
|
||||
if (foundTaskView.isVisibleToUser()) {
|
||||
TestLogging.recordEvent(
|
||||
TestProtocol.SEQUENCE_MAIN, "start: taskbarAppIcon");
|
||||
foundTaskView.launchTasks();
|
||||
return;
|
||||
}
|
||||
if (foundTaskView != null
|
||||
&& foundTaskView.isVisibleToUser()) {
|
||||
TestLogging.recordEvent(
|
||||
TestProtocol.SEQUENCE_MAIN, "start: taskbarAppIcon");
|
||||
foundTaskView.launchTasks();
|
||||
return;
|
||||
}
|
||||
}
|
||||
// If none of the above cases apply, launch a new app or app pair.
|
||||
|
||||
if (findExactPairMatch) {
|
||||
// We did not find the app pair we were looking for, so launch one.
|
||||
recents.getSplitSelectController().getAppPairsController().launchAppPair(
|
||||
@@ -1209,27 +1195,6 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a given list of taskIds are all already running in-app.
|
||||
*/
|
||||
private boolean isAlreadyInApp(int[] ids) {
|
||||
if (mControllers.uiController.isInOverview()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
RunningTaskInfo[] currentlyRunningTasks = ActivityManagerWrapper.getInstance()
|
||||
.getRunningTasks(false /* filterOnlyVisibleRecents */);
|
||||
Set<Integer> currentlyRunningIds = Arrays.stream(currentlyRunningTasks)
|
||||
.map(task -> task.taskId).collect(Collectors.toSet());
|
||||
|
||||
for (int id : ids) {
|
||||
if (id != ActivityTaskManager.INVALID_TASK_ID && !currentlyRunningIds.contains(id)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private void startItemInfoActivity(ItemInfo info) {
|
||||
Intent intent = new Intent(info.getIntent())
|
||||
.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
|
||||
@@ -54,6 +54,7 @@ import static com.android.launcher3.testing.shared.TestProtocol.QUICK_SWITCH_STA
|
||||
import static com.android.launcher3.util.DisplayController.CHANGE_ACTIVE_SCREEN;
|
||||
import static com.android.launcher3.util.DisplayController.CHANGE_NAVIGATION_MODE;
|
||||
import static com.android.launcher3.util.Executors.UI_HELPER_EXECUTOR;
|
||||
import static com.android.quickstep.util.AnimUtils.completeRunnableListCallback;
|
||||
import static com.android.quickstep.util.SplitAnimationTimings.TABLET_HOME_TO_SPLIT;
|
||||
import static com.android.quickstep.views.DesktopTaskView.isDesktopModeSupported;
|
||||
import static com.android.systemui.shared.system.ActivityManagerWrapper.CLOSE_SYSTEM_WINDOWS_REASON_HOME_KEY;
|
||||
@@ -67,7 +68,6 @@ import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentSender;
|
||||
import android.content.res.Configuration;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.RectF;
|
||||
import android.hardware.display.DisplayManager;
|
||||
@@ -75,6 +75,7 @@ import android.media.permission.SafeCloseable;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.IBinder;
|
||||
import android.os.IRemoteCallback;
|
||||
import android.os.SystemProperties;
|
||||
import android.os.Trace;
|
||||
import android.util.AttributeSet;
|
||||
@@ -145,7 +146,6 @@ import com.android.launcher3.uioverrides.touchcontrollers.TransposedQuickSwitchT
|
||||
import com.android.launcher3.uioverrides.touchcontrollers.TwoButtonNavbarTouchController;
|
||||
import com.android.launcher3.util.ActivityOptionsWrapper;
|
||||
import com.android.launcher3.util.DisplayController;
|
||||
import com.android.launcher3.util.Executors;
|
||||
import com.android.launcher3.util.IntSet;
|
||||
import com.android.launcher3.util.NavigationMode;
|
||||
import com.android.launcher3.util.ObjectWrapper;
|
||||
@@ -1140,13 +1140,14 @@ public class QuickstepLauncher extends Launcher {
|
||||
@Override
|
||||
public ActivityOptionsWrapper makeDefaultActivityOptions(int splashScreenStyle) {
|
||||
RunnableList callbacks = new RunnableList();
|
||||
ActivityOptions options = ActivityOptions.makeCustomAnimation(
|
||||
this, 0, 0, Color.TRANSPARENT,
|
||||
Executors.MAIN_EXECUTOR.getHandler(), null,
|
||||
elapsedRealTime -> callbacks.executeAllAndDestroy());
|
||||
ActivityOptions options = ActivityOptions.makeCustomAnimation(this, 0, 0);
|
||||
options.setSplashScreenStyle(splashScreenStyle);
|
||||
options.setPendingIntentBackgroundActivityStartMode(
|
||||
ActivityOptions.MODE_BACKGROUND_ACTIVITY_START_ALLOWED);
|
||||
|
||||
IRemoteCallback endCallback = completeRunnableListCallback(callbacks);
|
||||
options.setOnAnimationAbortListener(endCallback);
|
||||
options.setOnAnimationFinishedListener(endCallback);
|
||||
return new ActivityOptionsWrapper(options, callbacks);
|
||||
}
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@ package com.android.launcher3.uioverrides;
|
||||
|
||||
import static com.android.app.animation.Interpolators.LINEAR;
|
||||
import static com.android.launcher3.LauncherState.CLEAR_ALL_BUTTON;
|
||||
import static com.android.launcher3.LauncherState.OVERVIEW;
|
||||
import static com.android.launcher3.LauncherState.OVERVIEW_ACTIONS;
|
||||
import static com.android.launcher3.LauncherState.OVERVIEW_SPLIT_SELECT;
|
||||
import static com.android.launcher3.states.StateAnimationConfig.ANIM_OVERVIEW_ACTIONS_FADE;
|
||||
@@ -27,6 +28,7 @@ import static com.android.quickstep.views.RecentsView.TASK_MODALNESS;
|
||||
import static com.android.quickstep.views.RecentsView.TASK_PRIMARY_SPLIT_TRANSLATION;
|
||||
import static com.android.quickstep.views.RecentsView.TASK_SECONDARY_SPLIT_TRANSLATION;
|
||||
import static com.android.quickstep.views.TaskView.FLAG_UPDATE_ALL;
|
||||
import static com.android.wm.shell.Flags.enableSplitContextual;
|
||||
|
||||
import android.animation.AnimatorSet;
|
||||
import android.annotation.TargetApi;
|
||||
@@ -120,7 +122,9 @@ public final class RecentsViewStateController extends
|
||||
*/
|
||||
private void handleSplitSelectionState(@NonNull LauncherState toState,
|
||||
@NonNull PendingAnimation builder, boolean animate) {
|
||||
if (toState != OVERVIEW_SPLIT_SELECT) {
|
||||
boolean goingToOverviewFromWorkspaceContextual = enableSplitContextual() &&
|
||||
toState == OVERVIEW && mLauncher.isSplitSelectionActive();
|
||||
if (toState != OVERVIEW_SPLIT_SELECT && !goingToOverviewFromWorkspaceContextual) {
|
||||
// Not going to split
|
||||
return;
|
||||
}
|
||||
@@ -135,9 +139,11 @@ public final class RecentsViewStateController extends
|
||||
|
||||
SplitAnimationTimings timings =
|
||||
AnimUtils.getDeviceOverviewToSplitTimings(mLauncher.getDeviceProfile().isTablet);
|
||||
|
||||
mRecentsView.createSplitSelectInitAnimation(builder,
|
||||
toState.getTransitionDuration(mLauncher, true /* isToState */));
|
||||
if (!goingToOverviewFromWorkspaceContextual) {
|
||||
// This animation is already done for the contextual case, don't redo it
|
||||
mRecentsView.createSplitSelectInitAnimation(builder,
|
||||
toState.getTransitionDuration(mLauncher, true /* isToState */));
|
||||
}
|
||||
// Shift tasks vertically downward to get out of placeholder view
|
||||
builder.setFloat(mRecentsView, taskViewsFloat.first,
|
||||
toState.getSplitSelectTranslation(mLauncher),
|
||||
|
||||
@@ -17,6 +17,7 @@ package com.android.launcher3.uioverrides.states;
|
||||
|
||||
import static com.android.app.animation.Interpolators.DECELERATE_2;
|
||||
import static com.android.launcher3.logging.StatsLogManager.LAUNCHER_STATE_OVERVIEW;
|
||||
import static com.android.wm.shell.Flags.enableSplitContextual;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Rect;
|
||||
@@ -120,9 +121,21 @@ public class OverviewState extends LauncherState {
|
||||
if (showFloatingSearch) {
|
||||
elements |= FLOATING_SEARCH_BAR;
|
||||
}
|
||||
if (enableSplitContextual() && launcher.isSplitSelectionActive()) {
|
||||
elements &= ~CLEAR_ALL_BUTTON;
|
||||
}
|
||||
return elements;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getSplitSelectTranslation(Launcher launcher) {
|
||||
if (!enableSplitContextual() || !launcher.isSplitSelectionActive()) {
|
||||
return 0f;
|
||||
}
|
||||
RecentsView recentsView = launcher.getOverviewPanel();
|
||||
return recentsView.getSplitSelectTranslation();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFloatingSearchBarRestingMarginBottom(Launcher launcher) {
|
||||
return areElementsVisible(launcher, FLOATING_SEARCH_BAR) ? 0
|
||||
|
||||
+1
-1
@@ -59,7 +59,7 @@ public abstract class TaskViewTouchController<T extends BaseDraggingActivity>
|
||||
private static final long MAX_TASK_DISMISS_ANIMATION_DURATION = 600;
|
||||
|
||||
public static final int TASK_DISMISS_VIBRATION_PRIMITIVE =
|
||||
Utilities.ATLEAST_R ? VibrationEffect.Composition.PRIMITIVE_TICK : -1;
|
||||
VibrationEffect.Composition.PRIMITIVE_TICK;
|
||||
public static final float TASK_DISMISS_VIBRATION_PRIMITIVE_SCALE = 1f;
|
||||
public static final VibrationEffect TASK_DISMISS_VIBRATION_FALLBACK =
|
||||
VibrationConstants.EFFECT_TEXTURE_TICK;
|
||||
|
||||
@@ -64,7 +64,6 @@ import android.animation.Animator;
|
||||
import android.animation.AnimatorListenerAdapter;
|
||||
import android.animation.AnimatorSet;
|
||||
import android.animation.ValueAnimator;
|
||||
import android.annotation.TargetApi;
|
||||
import android.app.ActivityManager;
|
||||
import android.app.TaskInfo;
|
||||
import android.app.WindowConfiguration;
|
||||
@@ -75,7 +74,6 @@ import android.graphics.Matrix;
|
||||
import android.graphics.PointF;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.RectF;
|
||||
import android.os.Build;
|
||||
import android.os.IBinder;
|
||||
import android.os.SystemClock;
|
||||
import android.util.Log;
|
||||
@@ -161,7 +159,6 @@ import java.util.function.Consumer;
|
||||
/**
|
||||
* Handles the navigation gestures when Launcher is the default home activity.
|
||||
*/
|
||||
@TargetApi(Build.VERSION_CODES.R)
|
||||
public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>,
|
||||
Q extends RecentsView, S extends BaseState<S>>
|
||||
extends SwipeUpAnimationLogic implements OnApplyWindowInsetsListener,
|
||||
|
||||
@@ -35,13 +35,11 @@ import android.animation.Animator;
|
||||
import android.animation.AnimatorListenerAdapter;
|
||||
import android.animation.AnimatorSet;
|
||||
import android.animation.ObjectAnimator;
|
||||
import android.annotation.TargetApi;
|
||||
import android.content.Context;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.PointF;
|
||||
import android.graphics.Rect;
|
||||
import android.os.Build;
|
||||
import android.view.Gravity;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.RemoteAnimationTarget;
|
||||
@@ -77,7 +75,6 @@ import java.util.function.Predicate;
|
||||
/**
|
||||
* Utility class which abstracts out the logical differences between Launcher and RecentsActivity.
|
||||
*/
|
||||
@TargetApi(Build.VERSION_CODES.P)
|
||||
public abstract class BaseActivityInterface<STATE_TYPE extends BaseState<STATE_TYPE>,
|
||||
ACTIVITY_TYPE extends StatefulActivity<STATE_TYPE>> {
|
||||
|
||||
|
||||
@@ -29,7 +29,6 @@ import static com.android.launcher3.anim.AnimatorListeners.forEndCallback;
|
||||
import static com.android.quickstep.OverviewComponentObserver.startHomeIntentSafely;
|
||||
|
||||
import android.animation.ObjectAnimator;
|
||||
import android.annotation.TargetApi;
|
||||
import android.app.ActivityManager.RunningTaskInfo;
|
||||
import android.app.ActivityOptions;
|
||||
import android.content.Context;
|
||||
@@ -37,7 +36,6 @@ import android.content.Intent;
|
||||
import android.graphics.Matrix;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.RectF;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.IBinder;
|
||||
@@ -66,7 +64,6 @@ import com.android.launcher3.states.StateAnimationConfig;
|
||||
import com.android.launcher3.util.DisplayController;
|
||||
import com.android.quickstep.fallback.FallbackRecentsView;
|
||||
import com.android.quickstep.fallback.RecentsState;
|
||||
import com.android.quickstep.util.ActiveGestureLog;
|
||||
import com.android.quickstep.util.RectFSpringAnim;
|
||||
import com.android.quickstep.util.SurfaceTransaction.SurfaceProperties;
|
||||
import com.android.quickstep.util.TransformParams;
|
||||
@@ -82,7 +79,6 @@ import java.util.function.Consumer;
|
||||
/**
|
||||
* Handles the navigation gestures when a 3rd party launcher is the default home activity.
|
||||
*/
|
||||
@TargetApi(Build.VERSION_CODES.R)
|
||||
public class FallbackSwipeHandler extends
|
||||
AbsSwipeUpHandler<RecentsActivity, FallbackRecentsView, RecentsState> {
|
||||
|
||||
|
||||
@@ -29,9 +29,7 @@ import static com.android.quickstep.util.ActiveGestureErrorDetector.GestureEvent
|
||||
import static com.android.quickstep.util.ActiveGestureErrorDetector.GestureEvent.SET_END_TARGET_HOME;
|
||||
import static com.android.quickstep.util.ActiveGestureErrorDetector.GestureEvent.SET_END_TARGET_NEW_TASK;
|
||||
|
||||
import android.annotation.TargetApi;
|
||||
import android.content.Intent;
|
||||
import android.os.Build;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.RemoteAnimationTarget;
|
||||
|
||||
@@ -58,7 +56,6 @@ import java.util.function.Predicate;
|
||||
* Manages the state for an active system gesture, listens for events from the system and Launcher,
|
||||
* and fires events when the states change.
|
||||
*/
|
||||
@TargetApi(Build.VERSION_CODES.R)
|
||||
public class GestureState implements RecentsAnimationCallbacks.RecentsAnimationListener {
|
||||
|
||||
final Predicate<RemoteAnimationTarget> mLastStartedTaskIdPredicate = new Predicate<>() {
|
||||
|
||||
@@ -18,10 +18,8 @@ package com.android.quickstep;
|
||||
import static com.android.launcher3.util.Executors.MAIN_EXECUTOR;
|
||||
import static com.android.quickstep.util.ActiveGestureLog.INTENT_EXTRA_LOG_TRACE_ID;
|
||||
|
||||
import android.annotation.TargetApi;
|
||||
import android.content.Intent;
|
||||
import android.graphics.PointF;
|
||||
import android.os.Build;
|
||||
import android.os.SystemClock;
|
||||
import android.os.Trace;
|
||||
import android.view.View;
|
||||
@@ -51,7 +49,6 @@ import java.util.HashMap;
|
||||
/**
|
||||
* Helper class to handle various atomic commands for switching between Overview.
|
||||
*/
|
||||
@TargetApi(Build.VERSION_CODES.P)
|
||||
public class OverviewCommandHelper {
|
||||
|
||||
public static final int TYPE_SHOW = 1;
|
||||
|
||||
@@ -15,10 +15,8 @@
|
||||
*/
|
||||
package com.android.quickstep;
|
||||
|
||||
import android.annotation.TargetApi;
|
||||
import android.content.Context;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.os.Build;
|
||||
import android.os.Looper;
|
||||
import android.os.Trace;
|
||||
import android.os.UserManager;
|
||||
@@ -30,7 +28,6 @@ import com.android.launcher3.MainProcessInitializer;
|
||||
import com.android.systemui.shared.system.InteractionJankMonitorWrapper;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
@TargetApi(Build.VERSION_CODES.R)
|
||||
public class QuickstepProcessInitializer extends MainProcessInitializer {
|
||||
|
||||
private static final String TAG = "QuickstepProcessInitializer";
|
||||
|
||||
@@ -23,12 +23,10 @@ import static com.android.quickstep.util.SplitScreenUtils.convertShellSplitBound
|
||||
import static com.android.quickstep.views.DesktopTaskView.isDesktopModeSupported;
|
||||
import static com.android.wm.shell.util.GroupedRecentTaskInfo.TYPE_FREEFORM;
|
||||
|
||||
import android.annotation.TargetApi;
|
||||
import android.app.ActivityManager;
|
||||
import android.app.KeyguardManager;
|
||||
import android.app.TaskInfo;
|
||||
import android.content.ComponentName;
|
||||
import android.os.Build;
|
||||
import android.os.Process;
|
||||
import android.os.RemoteException;
|
||||
import android.util.SparseBooleanArray;
|
||||
@@ -53,7 +51,6 @@ import java.util.stream.Collectors;
|
||||
/**
|
||||
* Manages the recent task list from the system, caching it as necessary.
|
||||
*/
|
||||
@TargetApi(Build.VERSION_CODES.R)
|
||||
public class RecentTasksList {
|
||||
|
||||
private static final TaskLoadResult INVALID_RESULT = new TaskLoadResult(-1, false, 0);
|
||||
|
||||
@@ -43,14 +43,12 @@ import android.animation.Animator;
|
||||
import android.animation.AnimatorListenerAdapter;
|
||||
import android.animation.AnimatorSet;
|
||||
import android.animation.ValueAnimator;
|
||||
import android.annotation.TargetApi;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.graphics.Matrix;
|
||||
import android.graphics.Matrix.ScaleToFit;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.RectF;
|
||||
import android.os.Build;
|
||||
import android.view.RemoteAnimationTarget;
|
||||
import android.view.SurfaceControl;
|
||||
import android.view.View;
|
||||
@@ -94,7 +92,6 @@ import java.util.function.Consumer;
|
||||
/**
|
||||
* Utility class for helpful methods related to {@link TaskView} objects and their tasks.
|
||||
*/
|
||||
@TargetApi(Build.VERSION_CODES.R)
|
||||
public final class TaskViewUtils {
|
||||
|
||||
private TaskViewUtils() {}
|
||||
|
||||
@@ -56,7 +56,6 @@ import static com.android.wm.shell.sysui.ShellSharedConstants.KEY_EXTRA_SHELL_SH
|
||||
import static com.android.wm.shell.sysui.ShellSharedConstants.KEY_EXTRA_SHELL_SPLIT_SCREEN;
|
||||
import static com.android.wm.shell.sysui.ShellSharedConstants.KEY_EXTRA_SHELL_STARTING_WINDOW;
|
||||
|
||||
import android.annotation.TargetApi;
|
||||
import android.app.PendingIntent;
|
||||
import android.app.RemoteAction;
|
||||
import android.app.Service;
|
||||
@@ -66,7 +65,6 @@ import android.content.Intent;
|
||||
import android.content.res.Configuration;
|
||||
import android.graphics.Region;
|
||||
import android.graphics.drawable.Icon;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.IBinder;
|
||||
import android.os.Looper;
|
||||
@@ -152,7 +150,6 @@ import java.util.function.Function;
|
||||
/**
|
||||
* Service connected by system-UI for handling touch interaction.
|
||||
*/
|
||||
@TargetApi(Build.VERSION_CODES.R)
|
||||
public class TouchInteractionService extends Service {
|
||||
|
||||
private static final String SUBSTRING_PREFIX = "; ";
|
||||
|
||||
@@ -24,9 +24,7 @@ import static com.android.quickstep.fallback.RecentsState.MODAL_TASK;
|
||||
import static com.android.quickstep.fallback.RecentsState.OVERVIEW_SPLIT_SELECT;
|
||||
|
||||
import android.animation.AnimatorSet;
|
||||
import android.annotation.TargetApi;
|
||||
import android.content.Context;
|
||||
import android.os.Build;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.MotionEvent;
|
||||
|
||||
@@ -55,7 +53,6 @@ import com.android.systemui.shared.recents.model.Task;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
@TargetApi(Build.VERSION_CODES.R)
|
||||
public class FallbackRecentsView extends RecentsView<RecentsActivity, RecentsState>
|
||||
implements StateListener<RecentsState> {
|
||||
|
||||
|
||||
@@ -31,12 +31,10 @@ import static com.android.launcher3.util.Executors.MAIN_EXECUTOR;
|
||||
import static com.android.launcher3.util.VelocityUtils.PX_PER_MS;
|
||||
import static com.android.quickstep.util.ActiveGestureLog.INTENT_EXTRA_LOG_TRACE_ID;
|
||||
|
||||
import android.annotation.TargetApi;
|
||||
import android.content.Context;
|
||||
import android.content.ContextWrapper;
|
||||
import android.content.Intent;
|
||||
import android.graphics.PointF;
|
||||
import android.os.Build;
|
||||
import android.util.Log;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.VelocityTracker;
|
||||
@@ -71,7 +69,6 @@ import java.util.function.Consumer;
|
||||
/**
|
||||
* Input consumer for handling events originating from an activity other than Launcher
|
||||
*/
|
||||
@TargetApi(Build.VERSION_CODES.P)
|
||||
public class OtherActivityInputConsumer extends ContextWrapper implements InputConsumer {
|
||||
|
||||
public static final String DOWN_EVT = "OtherActivityInputConsumer.DOWN";
|
||||
|
||||
@@ -17,9 +17,7 @@ package com.android.quickstep.interaction;
|
||||
|
||||
import static com.android.launcher3.config.FeatureFlags.ENABLE_NEW_GESTURE_NAV_TUTORIAL;
|
||||
|
||||
import android.annotation.TargetApi;
|
||||
import android.graphics.PointF;
|
||||
import android.os.Build;
|
||||
|
||||
import com.android.launcher3.R;
|
||||
import com.android.launcher3.Utilities;
|
||||
@@ -30,7 +28,6 @@ import com.android.quickstep.util.LottieAnimationColorUtils;
|
||||
import java.util.Map;
|
||||
|
||||
/** A {@link TutorialController} for the Home tutorial. */
|
||||
@TargetApi(Build.VERSION_CODES.R)
|
||||
final class HomeGestureTutorialController extends SwipeUpGestureTutorialController {
|
||||
|
||||
HomeGestureTutorialController(HomeGestureTutorialFragment fragment, TutorialType tutorialType) {
|
||||
|
||||
@@ -21,9 +21,7 @@ import static com.android.launcher3.config.FeatureFlags.ENABLE_NEW_GESTURE_NAV_T
|
||||
import android.animation.Animator;
|
||||
import android.animation.AnimatorListenerAdapter;
|
||||
import android.animation.AnimatorSet;
|
||||
import android.annotation.TargetApi;
|
||||
import android.graphics.PointF;
|
||||
import android.os.Build;
|
||||
import android.os.Handler;
|
||||
|
||||
import androidx.annotation.ColorInt;
|
||||
@@ -42,7 +40,6 @@ import java.util.ArrayList;
|
||||
import java.util.Map;
|
||||
|
||||
/** A {@link TutorialController} for the Overview tutorial. */
|
||||
@TargetApi(Build.VERSION_CODES.R)
|
||||
final class OverviewGestureTutorialController extends SwipeUpGestureTutorialController {
|
||||
|
||||
private static final float LAUNCHER_COLOR_BLENDING_RATIO = 0.4f;
|
||||
|
||||
@@ -29,13 +29,11 @@ import android.animation.Animator;
|
||||
import android.animation.AnimatorListenerAdapter;
|
||||
import android.animation.AnimatorSet;
|
||||
import android.animation.ValueAnimator;
|
||||
import android.annotation.TargetApi;
|
||||
import android.content.Context;
|
||||
import android.graphics.Outline;
|
||||
import android.graphics.PointF;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.RectF;
|
||||
import android.os.Build;
|
||||
import android.view.View;
|
||||
import android.view.ViewOutlineProvider;
|
||||
|
||||
@@ -63,7 +61,6 @@ import com.android.quickstep.util.SurfaceTransaction;
|
||||
import com.android.quickstep.util.SurfaceTransaction.MockProperties;
|
||||
import com.android.quickstep.util.TransformParams;
|
||||
|
||||
@TargetApi(Build.VERSION_CODES.R)
|
||||
abstract class SwipeUpGestureTutorialController extends TutorialController {
|
||||
|
||||
private static final int FAKE_PREVIOUS_TASK_MARGIN = Utilities.dpToPx(24);
|
||||
|
||||
@@ -139,7 +139,7 @@ public class StatsLogCompatManager extends StatsLogManager {
|
||||
if (IS_VERBOSE) {
|
||||
Log.d(TAG, String.format("\nwriteSnapshot(%d):\n%s", instanceId.getId(), info));
|
||||
}
|
||||
if (!Utilities.ATLEAST_R || Utilities.isRunningInTestHarness()) {
|
||||
if (Utilities.isRunningInTestHarness()) {
|
||||
return;
|
||||
}
|
||||
SysUiStatsLog.write(SysUiStatsLog.LAUNCHER_SNAPSHOT,
|
||||
@@ -342,9 +342,6 @@ public class StatsLogCompatManager extends StatsLogManager {
|
||||
|
||||
@Override
|
||||
public void log(EventEnum event) {
|
||||
if (!Utilities.ATLEAST_R) {
|
||||
return;
|
||||
}
|
||||
if (DEBUG) {
|
||||
String name = (event instanceof Enum) ? ((Enum) event).name() :
|
||||
event.getId() + "";
|
||||
|
||||
@@ -16,6 +16,13 @@
|
||||
|
||||
package com.android.quickstep.util;
|
||||
|
||||
import static com.android.launcher3.util.Executors.MAIN_EXECUTOR;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.os.IRemoteCallback;
|
||||
|
||||
import com.android.launcher3.util.RunnableList;
|
||||
|
||||
/**
|
||||
* Utility class containing methods to help manage animations, interpolators, and timings.
|
||||
*/
|
||||
@@ -48,4 +55,16 @@ public class AnimUtils {
|
||||
? SplitAnimationTimings.TABLET_APP_PAIR_LAUNCH
|
||||
: SplitAnimationTimings.PHONE_APP_PAIR_LAUNCH;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a IRemoteCallback which completes the provided list as a result
|
||||
*/
|
||||
public static IRemoteCallback completeRunnableListCallback(RunnableList list) {
|
||||
return new IRemoteCallback.Stub() {
|
||||
@Override
|
||||
public void sendResult(Bundle bundle) {
|
||||
MAIN_EXECUTOR.execute(list::executeAllAndDestroy);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,8 +15,6 @@
|
||||
*/
|
||||
package com.android.quickstep.util;
|
||||
|
||||
import android.annotation.TargetApi;
|
||||
import android.os.Build;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.view.SurfaceControl;
|
||||
@@ -34,7 +32,6 @@ import com.android.quickstep.RemoteAnimationTargets.ReleaseCheck;
|
||||
* android.view.SyncRtSurfaceTransactionApplier
|
||||
* with some Launcher specific utility methods
|
||||
*/
|
||||
@TargetApi(Build.VERSION_CODES.R)
|
||||
public class SurfaceTransactionApplier extends ReleaseCheck {
|
||||
|
||||
private static final int MSG_UPDATE_SEQUENCE_NUMBER = 0;
|
||||
|
||||
@@ -21,7 +21,6 @@ import static android.provider.Settings.ACTION_APP_USAGE_SETTINGS;
|
||||
import static com.android.launcher3.Utilities.prefixTextWithIcon;
|
||||
import static com.android.launcher3.util.Executors.THREAD_POOL_EXECUTOR;
|
||||
|
||||
import android.annotation.TargetApi;
|
||||
import android.app.ActivityOptions;
|
||||
import android.content.ActivityNotFoundException;
|
||||
import android.content.Intent;
|
||||
@@ -33,7 +32,6 @@ import android.icu.text.MeasureFormat;
|
||||
import android.icu.text.MeasureFormat.FormatWidth;
|
||||
import android.icu.util.Measure;
|
||||
import android.icu.util.MeasureUnit;
|
||||
import android.os.Build;
|
||||
import android.os.UserHandle;
|
||||
import android.util.Log;
|
||||
import android.util.Pair;
|
||||
@@ -61,7 +59,6 @@ import java.lang.annotation.RetentionPolicy;
|
||||
import java.time.Duration;
|
||||
import java.util.Locale;
|
||||
|
||||
@TargetApi(Build.VERSION_CODES.Q)
|
||||
public final class DigitalWellBeingToast {
|
||||
|
||||
private static final float THRESHOLD_LEFT_ICON_ONLY = 0.4f;
|
||||
|
||||
@@ -81,7 +81,6 @@ import android.animation.ObjectAnimator;
|
||||
import android.animation.PropertyValuesHolder;
|
||||
import android.animation.ValueAnimator;
|
||||
import android.annotation.SuppressLint;
|
||||
import android.annotation.TargetApi;
|
||||
import android.app.WindowConfiguration;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
@@ -98,7 +97,6 @@ import android.graphics.Rect;
|
||||
import android.graphics.RectF;
|
||||
import android.graphics.Typeface;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.SystemClock;
|
||||
import android.os.UserHandle;
|
||||
@@ -231,7 +229,6 @@ import java.util.stream.Collectors;
|
||||
/**
|
||||
* A list of recent tasks.
|
||||
*/
|
||||
@TargetApi(Build.VERSION_CODES.R)
|
||||
public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_TYPE>,
|
||||
STATE_TYPE extends BaseState<STATE_TYPE>> extends PagedView implements Insettable,
|
||||
TaskThumbnailCache.HighResLoadingState.HighResLoadingStateChangedCallback,
|
||||
|
||||
@@ -120,10 +120,12 @@ public class SplitInstructionsView extends LinearLayout {
|
||||
|
||||
private void init() {
|
||||
TextView cancelTextView = findViewById(R.id.split_instructions_text_cancel);
|
||||
TextView instructionTextView = findViewById(R.id.split_instructions_text);
|
||||
|
||||
if (FeatureFlags.enableSplitContextually()) {
|
||||
cancelTextView.setVisibility(VISIBLE);
|
||||
cancelTextView.setOnClickListener((v) -> exitSplitSelection());
|
||||
instructionTextView.setText(R.string.toast_contextual_split_select_app);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -57,7 +57,6 @@ import android.graphics.Rect;
|
||||
import android.graphics.RectF;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.FloatProperty;
|
||||
import android.util.Log;
|
||||
@@ -119,8 +118,6 @@ import com.android.systemui.shared.recents.model.ThumbnailData;
|
||||
import com.android.systemui.shared.system.ActivityManagerWrapper;
|
||||
import com.android.systemui.shared.system.QuickStepContract;
|
||||
|
||||
import kotlin.Unit;
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
@@ -129,6 +126,8 @@ import java.util.List;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import kotlin.Unit;
|
||||
|
||||
/**
|
||||
* A task in the Recents view.
|
||||
*/
|
||||
@@ -969,20 +968,6 @@ public class TaskView extends FrameLayout implements Reusable {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns ActivityOptions for overriding task transition animation.
|
||||
*/
|
||||
private ActivityOptions makeCustomAnimation(Context context, int enterResId,
|
||||
int exitResId, final Runnable callback, final Handler callbackHandler) {
|
||||
return ActivityOptions.makeCustomTaskAnimation(context, enterResId, exitResId,
|
||||
callbackHandler,
|
||||
elapsedRealTime -> {
|
||||
if (callback != null) {
|
||||
callbackHandler.post(callback);
|
||||
}
|
||||
}, null /* finishedListener */);
|
||||
}
|
||||
|
||||
/**
|
||||
* Launch of the current task (both live and inactive tasks) with an animation.
|
||||
*/
|
||||
@@ -1339,10 +1324,8 @@ public class TaskView extends FrameLayout implements Reusable {
|
||||
setPivotX((right - left) * 0.5f);
|
||||
setPivotY(mSnapshotView.getTop() + mSnapshotView.getHeight() * 0.5f);
|
||||
}
|
||||
if (Utilities.ATLEAST_Q) {
|
||||
SYSTEM_GESTURE_EXCLUSION_RECT.get(0).set(0, 0, getWidth(), getHeight());
|
||||
setSystemGestureExclusionRects(SYSTEM_GESTURE_EXCLUSION_RECT);
|
||||
}
|
||||
SYSTEM_GESTURE_EXCLUSION_RECT.get(0).set(0, 0, getWidth(), getHeight());
|
||||
setSystemGestureExclusionRects(SYSTEM_GESTURE_EXCLUSION_RECT);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="utf-8"?><!--
|
||||
~ Copyright (C) 2023 The Android Open Source Project
|
||||
~
|
||||
~ Licensed under the Apache License, Version 2.0 (the "License");
|
||||
~ you may not use this file except in compliance with the License.
|
||||
~ You may obtain a copy of the License at
|
||||
~
|
||||
~ http://www.apache.org/licenses/LICENSE-2.0
|
||||
~
|
||||
~ Unless required by applicable law or agreed to in writing, software
|
||||
~ distributed under the License is distributed on an "AS IS" BASIS,
|
||||
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
~ See the License for the specific language governing permissions and
|
||||
~ limitations under the License.
|
||||
-->
|
||||
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<solid android:color="?attr/materialColorOutlineVariant"/>
|
||||
<size android:height="1dp" />
|
||||
</shape>
|
||||
@@ -0,0 +1,25 @@
|
||||
<?xml version="1.0" encoding="utf-8"?><!--
|
||||
~ Copyright (C) 2024 The Android Open Source Project
|
||||
~
|
||||
~ Licensed under the Apache License, Version 2.0 (the "License");
|
||||
~ you may not use this file except in compliance with the License.
|
||||
~ You may obtain a copy of the License at
|
||||
~
|
||||
~ http://www.apache.org/licenses/LICENSE-2.0
|
||||
~
|
||||
~ Unless required by applicable law or agreed to in writing, software
|
||||
~ distributed under the License is distributed on an "AS IS" BASIS,
|
||||
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
~ See the License for the specific language governing permissions and
|
||||
~ limitations under the License.
|
||||
-->
|
||||
<ImageView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/private_space_divider"
|
||||
android:importantForAccessibility="no"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="@dimen/ps_app_divider_padding"
|
||||
android:paddingRight="@dimen/ps_app_divider_padding"
|
||||
android:src="@drawable/private_space_app_divider"
|
||||
android:scaleType="fitXY"
|
||||
android:focusable="false" />
|
||||
@@ -487,4 +487,5 @@
|
||||
<dimen name="ps_button_height">36dp</dimen>
|
||||
<dimen name="ps_button_width">36dp</dimen>
|
||||
<dimen name="ps_lock_button_width">89dp</dimen>
|
||||
<dimen name="ps_app_divider_padding">16dp</dimen>
|
||||
</resources>
|
||||
|
||||
@@ -191,14 +191,12 @@ public class AppWidgetResizeFrame extends AbstractFloatingView implements View.O
|
||||
@Override
|
||||
protected void onLayout(boolean changed, int l, int t, int r, int b) {
|
||||
super.onLayout(changed, l, t, r, b);
|
||||
if (Utilities.ATLEAST_Q) {
|
||||
for (int i = 0; i < HANDLE_COUNT; i++) {
|
||||
View dragHandle = mDragHandles[i];
|
||||
mSystemGestureExclusionRects.get(i).set(dragHandle.getLeft(), dragHandle.getTop(),
|
||||
dragHandle.getRight(), dragHandle.getBottom());
|
||||
}
|
||||
setSystemGestureExclusionRects(mSystemGestureExclusionRects);
|
||||
for (int i = 0; i < HANDLE_COUNT; i++) {
|
||||
View dragHandle = mDragHandles[i];
|
||||
mSystemGestureExclusionRects.get(i).set(dragHandle.getLeft(), dragHandle.getTop(),
|
||||
dragHandle.getRight(), dragHandle.getBottom());
|
||||
}
|
||||
setSystemGestureExclusionRects(mSystemGestureExclusionRects);
|
||||
}
|
||||
|
||||
public static void showForWidget(LauncherAppWidgetHostView widget, CellLayout cellLayout) {
|
||||
|
||||
@@ -20,11 +20,8 @@ import static com.android.launcher3.util.DisplayController.CHANGE_ROTATION;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.Configuration;
|
||||
import android.graphics.Point;
|
||||
import android.graphics.Rect;
|
||||
import android.os.Bundle;
|
||||
import android.view.ActionMode;
|
||||
import android.view.Display;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.annotation.MainThread;
|
||||
@@ -165,15 +162,7 @@ public abstract class BaseDraggingActivity extends BaseActivity
|
||||
protected abstract void reapplyUi();
|
||||
|
||||
protected WindowBounds getMultiWindowDisplaySize() {
|
||||
if (Utilities.ATLEAST_R) {
|
||||
return WindowBounds.fromWindowMetrics(getWindowManager().getCurrentWindowMetrics());
|
||||
}
|
||||
// Note: Calls to getSize() can't rely on our cached DefaultDisplay since it can return
|
||||
// the app window size
|
||||
Display display = getWindowManager().getDefaultDisplay();
|
||||
Point mwSize = new Point();
|
||||
display.getSize(mwSize);
|
||||
return new WindowBounds(new Rect(0, 0, mwSize.x, mwSize.y), new Rect());
|
||||
return WindowBounds.fromWindowMetrics(getWindowManager().getCurrentWindowMetrics());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -15,8 +15,6 @@
|
||||
*/
|
||||
package com.android.launcher3;
|
||||
|
||||
import static com.android.launcher3.logging.KeyboardStateManager.KeyboardState.SHOW;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Rect;
|
||||
import android.text.TextUtils;
|
||||
@@ -93,7 +91,6 @@ public class ExtendedEditText extends EditText {
|
||||
* @return true if the keyboard is shown correctly and focus is given to this view.
|
||||
*/
|
||||
public boolean showKeyboard() {
|
||||
onKeyboardShown();
|
||||
return requestFocus() && showSoftInputInternal();
|
||||
}
|
||||
|
||||
@@ -120,11 +117,6 @@ public class ExtendedEditText extends EditText {
|
||||
}
|
||||
}
|
||||
|
||||
protected void onKeyboardShown() {
|
||||
ActivityContext.lookupContext(getContext()).getStatsLogManager()
|
||||
.keyboardStateManager().setKeyboardState(SHOW);
|
||||
}
|
||||
|
||||
private boolean showSoftInputInternal() {
|
||||
boolean result = false;
|
||||
InputMethodManager imm = getContext().getSystemService(InputMethodManager.class);
|
||||
|
||||
@@ -20,11 +20,9 @@ import static android.content.Intent.EXTRA_USER;
|
||||
|
||||
import static com.android.launcher3.AbstractFloatingView.TYPE_ICON_SURFACE;
|
||||
|
||||
import android.annotation.TargetApi;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Intent;
|
||||
import android.graphics.RectF;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
@@ -69,7 +67,6 @@ public class GestureNavContract {
|
||||
/**
|
||||
* Sends the position information to the receiver
|
||||
*/
|
||||
@TargetApi(Build.VERSION_CODES.R)
|
||||
public void sendEndPosition(RectF position, ActivityContext context,
|
||||
@Nullable SurfaceControl surfaceControl) {
|
||||
Bundle result = new Bundle();
|
||||
@@ -95,9 +92,6 @@ public class GestureNavContract {
|
||||
* Clears and returns the GestureNavContract if it was present in the intent.
|
||||
*/
|
||||
public static GestureNavContract fromIntent(Intent intent) {
|
||||
if (!Utilities.ATLEAST_R) {
|
||||
return null;
|
||||
}
|
||||
Bundle extras = intent.getBundleExtra(EXTRA_GESTURE_CONTRACT);
|
||||
if (extras == null) {
|
||||
return null;
|
||||
|
||||
@@ -19,6 +19,7 @@ package com.android.launcher3;
|
||||
import static android.app.PendingIntent.FLAG_IMMUTABLE;
|
||||
import static android.app.PendingIntent.FLAG_UPDATE_CURRENT;
|
||||
import static android.content.pm.ActivityInfo.CONFIG_UI_MODE;
|
||||
import static android.view.WindowInsetsAnimation.Callback.DISPATCH_MODE_CONTINUE_ON_SUBTREE;
|
||||
import static android.view.accessibility.AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED;
|
||||
|
||||
import static com.android.app.animation.Interpolators.EMPHASIZED;
|
||||
@@ -66,6 +67,8 @@ import static com.android.launcher3.Utilities.postAsyncCallback;
|
||||
import static com.android.launcher3.config.FeatureFlags.ENABLE_SMARTSPACE_REMOVAL;
|
||||
import static com.android.launcher3.config.FeatureFlags.FOLDABLE_SINGLE_PAGE;
|
||||
import static com.android.launcher3.config.FeatureFlags.MULTI_SELECT_EDIT_MODE;
|
||||
import static com.android.launcher3.logging.KeyboardStateManager.KeyboardState.HIDE;
|
||||
import static com.android.launcher3.logging.KeyboardStateManager.KeyboardState.SHOW;
|
||||
import static com.android.launcher3.logging.StatsLogManager.EventEnum;
|
||||
import static com.android.launcher3.logging.StatsLogManager.LAUNCHER_STATE_BACKGROUND;
|
||||
import static com.android.launcher3.logging.StatsLogManager.LAUNCHER_STATE_HOME;
|
||||
@@ -138,6 +141,8 @@ import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.ViewTreeObserver.OnPreDrawListener;
|
||||
import android.view.WindowInsets;
|
||||
import android.view.WindowInsetsAnimation;
|
||||
import android.view.WindowManager.LayoutParams;
|
||||
import android.view.accessibility.AccessibilityEvent;
|
||||
import android.view.animation.OvershootInterpolator;
|
||||
@@ -575,9 +580,7 @@ public class Launcher extends StatefulActivity<LauncherState>
|
||||
mRotationHelper.initialize();
|
||||
TraceHelper.INSTANCE.endSection();
|
||||
|
||||
if (Utilities.ATLEAST_R) {
|
||||
getWindow().setSoftInputMode(LayoutParams.SOFT_INPUT_ADJUST_NOTHING);
|
||||
}
|
||||
getWindow().setSoftInputMode(LayoutParams.SOFT_INPUT_ADJUST_NOTHING);
|
||||
setTitle(R.string.home_screen);
|
||||
mStartupLatencyLogger.logEnd(LAUNCHER_LATENCY_STARTUP_ACTIVITY_ON_CREATE);
|
||||
|
||||
@@ -1083,6 +1086,25 @@ public class Launcher extends StatefulActivity<LauncherState>
|
||||
|
||||
DiscoveryBounce.showForHomeIfNeeded(this);
|
||||
mAppWidgetHolder.setActivityResumed(true);
|
||||
|
||||
// Listen for IME changes to keep state up to date.
|
||||
getRootView().setWindowInsetsAnimationCallback(
|
||||
new WindowInsetsAnimation.Callback(DISPATCH_MODE_CONTINUE_ON_SUBTREE) {
|
||||
@Override
|
||||
public WindowInsets onProgress(WindowInsets windowInsets,
|
||||
List<WindowInsetsAnimation> windowInsetsAnimations) {
|
||||
return windowInsets;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEnd(WindowInsetsAnimation animation) {
|
||||
WindowInsets insets = getRootView().getRootWindowInsets();
|
||||
boolean isImeVisible =
|
||||
insets != null && insets.isVisible(WindowInsets.Type.ime());
|
||||
getStatsLogManager().keyboardStateManager().setKeyboardState(
|
||||
isImeVisible ? SHOW : HIDE);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void logStopAndResume(boolean isResume) {
|
||||
|
||||
@@ -2,11 +2,9 @@ package com.android.launcher3;
|
||||
|
||||
import static com.android.launcher3.config.FeatureFlags.SEPARATE_RECENTS_ACTIVITY;
|
||||
|
||||
import android.annotation.TargetApi;
|
||||
import android.content.Context;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Rect;
|
||||
import android.os.Build;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.ViewDebug;
|
||||
import android.view.WindowInsets;
|
||||
@@ -112,15 +110,13 @@ public class LauncherRootView extends InsettableFrameLayout {
|
||||
mSysUiScrim.setSize(r - l, b - t);
|
||||
}
|
||||
|
||||
@TargetApi(Build.VERSION_CODES.Q)
|
||||
public void setForceHideBackArrow(boolean forceHideBackArrow) {
|
||||
this.mForceHideBackArrow = forceHideBackArrow;
|
||||
setDisallowBackGesture(mDisallowBackGesture);
|
||||
}
|
||||
|
||||
@TargetApi(Build.VERSION_CODES.Q)
|
||||
public void setDisallowBackGesture(boolean disallowBackGesture) {
|
||||
if (!Utilities.ATLEAST_Q || SEPARATE_RECENTS_ACTIVITY.get()) {
|
||||
if (SEPARATE_RECENTS_ACTIVITY.get()) {
|
||||
return;
|
||||
}
|
||||
mDisallowBackGesture = disallowBackGesture;
|
||||
|
||||
@@ -121,15 +121,6 @@ public final class Utilities {
|
||||
public static final String[] EMPTY_STRING_ARRAY = new String[0];
|
||||
public static final Person[] EMPTY_PERSON_ARRAY = new Person[0];
|
||||
|
||||
@ChecksSdkIntAtLeast(api = VERSION_CODES.P)
|
||||
public static final boolean ATLEAST_P = Build.VERSION.SDK_INT >= Build.VERSION_CODES.P;
|
||||
|
||||
@ChecksSdkIntAtLeast(api = VERSION_CODES.Q)
|
||||
public static final boolean ATLEAST_Q = Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q;
|
||||
|
||||
@ChecksSdkIntAtLeast(api = VERSION_CODES.R)
|
||||
public static final boolean ATLEAST_R = Build.VERSION.SDK_INT >= Build.VERSION_CODES.R;
|
||||
|
||||
@ChecksSdkIntAtLeast(api = VERSION_CODES.S)
|
||||
public static final boolean ATLEAST_S = Build.VERSION.SDK_INT >= Build.VERSION_CODES.S;
|
||||
|
||||
|
||||
@@ -35,6 +35,7 @@ import com.android.launcher3.views.ActivityContext;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.TreeMap;
|
||||
import java.util.function.Predicate;
|
||||
@@ -269,10 +270,10 @@ public class AlphabeticalAppsList<T extends Context & ActivityContext> implement
|
||||
addApps = mWorkProviderManager.shouldShowWorkApps();
|
||||
}
|
||||
if (addApps) {
|
||||
addAppsWithSections(mApps, position);
|
||||
position = addAppsWithSections(mApps, position);
|
||||
}
|
||||
if (Flags.enablePrivateSpace()) {
|
||||
addPrivateSpaceItems(position);
|
||||
position = addPrivateSpaceItems(position);
|
||||
}
|
||||
}
|
||||
mAccessibilityResultsCount = (int) mAdapterItems.stream()
|
||||
@@ -287,7 +288,8 @@ public class AlphabeticalAppsList<T extends Context & ActivityContext> implement
|
||||
for (AdapterItem item : mAdapterItems) {
|
||||
item.rowIndex = 0;
|
||||
if (BaseAllAppsAdapter.isDividerViewType(item.viewType)
|
||||
|| BaseAllAppsAdapter.isPrivateSpaceHeaderView(item.viewType)) {
|
||||
|| BaseAllAppsAdapter.isPrivateSpaceHeaderView(item.viewType)
|
||||
|| BaseAllAppsAdapter.isPrivateSpaceSysAppsDividerView(item.viewType)) {
|
||||
numAppsInSection = 0;
|
||||
} else if (BaseAllAppsAdapter.isIconViewType(item.viewType)) {
|
||||
if (numAppsInSection % mNumAppsPerRowAllApps == 0) {
|
||||
@@ -309,12 +311,12 @@ public class AlphabeticalAppsList<T extends Context & ActivityContext> implement
|
||||
}
|
||||
}
|
||||
|
||||
void addPrivateSpaceItems(int position) {
|
||||
int addPrivateSpaceItems(int position) {
|
||||
if (mPrivateProviderManager != null
|
||||
&& !mPrivateProviderManager.isPrivateSpaceHidden()
|
||||
&& !mPrivateApps.isEmpty()) {
|
||||
// Always add PS Header if Space is present and visible.
|
||||
position += mPrivateProviderManager.addPrivateSpaceHeader(mAdapterItems);
|
||||
position = mPrivateProviderManager.addPrivateSpaceHeader(mAdapterItems);
|
||||
int privateSpaceState = mPrivateProviderManager.getCurrentState();
|
||||
switch (privateSpaceState) {
|
||||
case PrivateProfileManager.STATE_DISABLED:
|
||||
@@ -322,15 +324,37 @@ public class AlphabeticalAppsList<T extends Context & ActivityContext> implement
|
||||
break;
|
||||
case PrivateProfileManager.STATE_ENABLED:
|
||||
// Add PS Apps only in Enabled State.
|
||||
mPrivateProviderManager.addPrivateSpaceInstallAppButton(mAdapterItems);
|
||||
position++;
|
||||
addAppsWithSections(mPrivateApps, position);
|
||||
position = addPrivateSpaceApps(position);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return position;
|
||||
}
|
||||
|
||||
private void addAppsWithSections(List<AppInfo> appList, int startPosition) {
|
||||
private int addPrivateSpaceApps(int position) {
|
||||
// Add Install Apps Button first.
|
||||
if (Flags.privateSpaceAppInstallerButton()) {
|
||||
mPrivateProviderManager.addPrivateSpaceInstallAppButton(mAdapterItems);
|
||||
position++;
|
||||
}
|
||||
|
||||
// Split of private space apps into user-installed and system apps.
|
||||
Map<Boolean, List<AppInfo>> split = mPrivateApps.stream()
|
||||
.collect(Collectors.partitioningBy(mPrivateProviderManager
|
||||
.splitIntoUserInstalledAndSystemApps()));
|
||||
// Add user installed apps
|
||||
position = addAppsWithSections(split.get(true), position);
|
||||
// Add system apps separator.
|
||||
if (Flags.privateSpaceSysAppsSeparation()) {
|
||||
position = mPrivateProviderManager.addSystemAppsDivider(mAdapterItems);
|
||||
}
|
||||
// Add system apps.
|
||||
position = addAppsWithSections(split.get(false), position);
|
||||
|
||||
return position;
|
||||
}
|
||||
|
||||
private int addAppsWithSections(List<AppInfo> appList, int startPosition) {
|
||||
String lastSectionName = null;
|
||||
boolean hasPrivateApps = false;
|
||||
if (mPrivateProviderManager != null) {
|
||||
@@ -357,6 +381,7 @@ public class AlphabeticalAppsList<T extends Context & ActivityContext> implement
|
||||
}
|
||||
startPosition++;
|
||||
}
|
||||
return startPosition;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -17,6 +17,7 @@ package com.android.launcher3.allapps;
|
||||
|
||||
import static com.android.launcher3.allapps.SectionDecorationInfo.ROUND_BOTTOM_LEFT;
|
||||
import static com.android.launcher3.allapps.SectionDecorationInfo.ROUND_BOTTOM_RIGHT;
|
||||
import static com.android.launcher3.allapps.SectionDecorationInfo.ROUND_NOTHING;
|
||||
import static com.android.launcher3.allapps.SectionDecorationInfo.ROUND_TOP_LEFT;
|
||||
import static com.android.launcher3.allapps.SectionDecorationInfo.ROUND_TOP_RIGHT;
|
||||
import static com.android.launcher3.allapps.UserProfileManager.STATE_DISABLED;
|
||||
@@ -61,7 +62,8 @@ public abstract class BaseAllAppsAdapter<T extends Context & ActivityContext> ex
|
||||
public static final int VIEW_TYPE_WORK_EDU_CARD = 1 << 4;
|
||||
public static final int VIEW_TYPE_WORK_DISABLED_CARD = 1 << 5;
|
||||
public static final int VIEW_TYPE_PRIVATE_SPACE_HEADER = 1 << 6;
|
||||
public static final int NEXT_ID = 7;
|
||||
public static final int VIEW_TYPE_PRIVATE_SPACE_SYS_APPS_DIVIDER = 1 << 7;
|
||||
public static final int NEXT_ID = 8;
|
||||
|
||||
// Common view type masks
|
||||
public static final int VIEW_TYPE_MASK_DIVIDER = VIEW_TYPE_ALL_APPS_DIVIDER;
|
||||
@@ -69,6 +71,8 @@ public abstract class BaseAllAppsAdapter<T extends Context & ActivityContext> ex
|
||||
|
||||
public static final int VIEW_TYPE_MASK_PRIVATE_SPACE_HEADER =
|
||||
VIEW_TYPE_PRIVATE_SPACE_HEADER;
|
||||
public static final int VIEW_TYPE_MASK_PRIVATE_SPACE_SYS_APPS_DIVIDER =
|
||||
VIEW_TYPE_PRIVATE_SPACE_SYS_APPS_DIVIDER;
|
||||
|
||||
protected final SearchAdapterProvider<?> mAdapterProvider;
|
||||
|
||||
@@ -199,6 +203,11 @@ public abstract class BaseAllAppsAdapter<T extends Context & ActivityContext> ex
|
||||
return isViewType(viewType, VIEW_TYPE_MASK_PRIVATE_SPACE_HEADER);
|
||||
}
|
||||
|
||||
/** Checks if the passed viewType represents private space system apps divider. */
|
||||
public static boolean isPrivateSpaceSysAppsDividerView(int viewType) {
|
||||
return isViewType(viewType, VIEW_TYPE_MASK_PRIVATE_SPACE_SYS_APPS_DIVIDER);
|
||||
}
|
||||
|
||||
public void setIconFocusListener(OnFocusChangeListener focusListener) {
|
||||
mIconFocusListener = focusListener;
|
||||
}
|
||||
@@ -227,9 +236,9 @@ public abstract class BaseAllAppsAdapter<T extends Context & ActivityContext> ex
|
||||
case VIEW_TYPE_EMPTY_SEARCH:
|
||||
return new ViewHolder(mLayoutInflater.inflate(R.layout.all_apps_empty_search,
|
||||
parent, false));
|
||||
case VIEW_TYPE_ALL_APPS_DIVIDER:
|
||||
case VIEW_TYPE_ALL_APPS_DIVIDER, VIEW_TYPE_PRIVATE_SPACE_SYS_APPS_DIVIDER:
|
||||
return new ViewHolder(mLayoutInflater.inflate(
|
||||
R.layout.all_apps_divider, parent, false));
|
||||
R.layout.private_space_divider, parent, false));
|
||||
case VIEW_TYPE_WORK_EDU_CARD:
|
||||
return new ViewHolder(mLayoutInflater.inflate(
|
||||
R.layout.work_apps_edu, parent, false));
|
||||
@@ -282,6 +291,11 @@ public abstract class BaseAllAppsAdapter<T extends Context & ActivityContext> ex
|
||||
new SectionDecorationInfo(mActivityContext, roundRegions,
|
||||
false /* decorateTogether */);
|
||||
break;
|
||||
case VIEW_TYPE_PRIVATE_SPACE_SYS_APPS_DIVIDER:
|
||||
adapterItem = mApps.getAdapterItems().get(position);
|
||||
adapterItem.decorationInfo = new SectionDecorationInfo(mActivityContext,
|
||||
ROUND_NOTHING, true /* decorateTogether */);
|
||||
break;
|
||||
case VIEW_TYPE_ALL_APPS_DIVIDER:
|
||||
case VIEW_TYPE_WORK_DISABLED_CARD:
|
||||
// nothing to do
|
||||
|
||||
@@ -21,7 +21,6 @@ import android.view.WindowInsets;
|
||||
|
||||
import com.android.launcher3.Launcher;
|
||||
import com.android.launcher3.LauncherState;
|
||||
import com.android.launcher3.Utilities;
|
||||
import com.android.launcher3.statemanager.StateManager;
|
||||
|
||||
/**
|
||||
@@ -43,11 +42,7 @@ public class LauncherAllAppsContainerView extends ActivityAllAppsContainerView<L
|
||||
|
||||
@Override
|
||||
protected int computeNavBarScrimHeight(WindowInsets insets) {
|
||||
if (Utilities.ATLEAST_Q) {
|
||||
return insets.getTappableElementInsets().bottom;
|
||||
} else {
|
||||
return insets.getStableInsetBottom();
|
||||
}
|
||||
return insets.getTappableElementInsets().bottom;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -19,6 +19,7 @@ package com.android.launcher3.allapps;
|
||||
import static com.android.launcher3.allapps.ActivityAllAppsContainerView.AdapterHolder.MAIN;
|
||||
import static com.android.launcher3.allapps.BaseAllAppsAdapter.VIEW_TYPE_ICON;
|
||||
import static com.android.launcher3.allapps.BaseAllAppsAdapter.VIEW_TYPE_PRIVATE_SPACE_HEADER;
|
||||
import static com.android.launcher3.allapps.BaseAllAppsAdapter.VIEW_TYPE_PRIVATE_SPACE_SYS_APPS_DIVIDER;
|
||||
import static com.android.launcher3.allapps.SectionDecorationInfo.ROUND_NOTHING;
|
||||
import static com.android.launcher3.model.BgDataModel.Callbacks.FLAG_PRIVATE_PROFILE_QUIET_MODE_ENABLED;
|
||||
import static com.android.launcher3.model.data.ItemInfoWithIcon.FLAG_PRIVATE_SPACE_INSTALL_APP;
|
||||
@@ -45,10 +46,11 @@ import com.android.launcher3.pm.UserCache;
|
||||
import com.android.launcher3.uioverrides.ApiWrapper;
|
||||
import com.android.launcher3.util.Preconditions;
|
||||
import com.android.launcher3.util.SettingsCache;
|
||||
import com.android.launcher3.util.UserIconInfo;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
/**
|
||||
@@ -62,6 +64,8 @@ public class PrivateProfileManager extends UserProfileManager {
|
||||
private static final String PS_SETTINGS_FRAGMENT_VALUE = "AndroidPrivateSpace_personal";
|
||||
private final ActivityAllAppsContainerView<?> mAllApps;
|
||||
private final Predicate<UserHandle> mPrivateProfileMatcher;
|
||||
private Set<String> mPreInstalledSystemPackages = new HashSet<>();
|
||||
private Intent mAppInstallerIntent = new Intent();
|
||||
private PrivateAppsSectionDecorator mPrivateAppsSectionDecorator;
|
||||
private boolean mPrivateSpaceSettingsAvailable;
|
||||
private Runnable mUnlockRunnable;
|
||||
@@ -73,7 +77,7 @@ public class PrivateProfileManager extends UserProfileManager {
|
||||
super(userManager, statsLogManager, userCache);
|
||||
mAllApps = allApps;
|
||||
mPrivateProfileMatcher = (user) -> userCache.getUserInfo(user).isPrivate();
|
||||
UI_HELPER_EXECUTOR.post(this::setPrivateSpaceSettingsAvailable);
|
||||
UI_HELPER_EXECUTOR.post(this::initializeInBackgroundThread);
|
||||
}
|
||||
|
||||
/** Adds Private Space Header to the layout. */
|
||||
@@ -83,18 +87,17 @@ public class PrivateProfileManager extends UserProfileManager {
|
||||
return adapterItems.size();
|
||||
}
|
||||
|
||||
/** Adds Private Space System Apps Divider to the layout. */
|
||||
public int addSystemAppsDivider(List<BaseAllAppsAdapter.AdapterItem> adapterItems) {
|
||||
adapterItems.add(new BaseAllAppsAdapter
|
||||
.AdapterItem(VIEW_TYPE_PRIVATE_SPACE_SYS_APPS_DIVIDER));
|
||||
mAllApps.mAH.get(MAIN).mAdapter.notifyItemInserted(adapterItems.size() - 1);
|
||||
return adapterItems.size();
|
||||
}
|
||||
|
||||
/** Adds Private Space install app button to the layout. */
|
||||
public void addPrivateSpaceInstallAppButton(List<BaseAllAppsAdapter.AdapterItem> adapterItems) {
|
||||
Context context = mAllApps.getContext();
|
||||
// Prepare intent
|
||||
UserCache userCache = UserCache.getInstance(context);
|
||||
UserHandle userHandle = userCache.getUserProfiles().stream()
|
||||
.filter(user -> userCache.getUserInfo(user).type == UserIconInfo.TYPE_PRIVATE)
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
Intent intent = ApiWrapper.getAppMarketActivityIntent(context,
|
||||
BuildConfig.APPLICATION_ID, userHandle);
|
||||
|
||||
// Prepare bitmapInfo
|
||||
Intent.ShortcutIconResource shortcut = Intent.ShortcutIconResource.fromContext(
|
||||
context, com.android.launcher3.R.drawable.private_space_install_app_icon);
|
||||
@@ -102,7 +105,7 @@ public class PrivateProfileManager extends UserProfileManager {
|
||||
|
||||
AppInfo itemInfo = new AppInfo();
|
||||
itemInfo.title = context.getResources().getString(R.string.ps_add_button_label);
|
||||
itemInfo.intent = intent;
|
||||
itemInfo.intent = mAppInstallerIntent;
|
||||
itemInfo.bitmap = bitmapInfo;
|
||||
itemInfo.contentDescription = context.getResources().getString(
|
||||
com.android.launcher3.R.string.ps_add_button_content_description);
|
||||
@@ -166,6 +169,22 @@ public class PrivateProfileManager extends UserProfileManager {
|
||||
return mPrivateSpaceSettingsAvailable;
|
||||
}
|
||||
|
||||
/** Initializes binder call based properties in non-main thread.
|
||||
* <p>
|
||||
* This can cause the Private Space container items to not load/respond correctly sometimes,
|
||||
* when the All Apps Container loads for the first time (device restarts, new profiles
|
||||
* added/removed, etc.), as the properties are being set in non-ui thread whereas the container
|
||||
* loads in the ui thread.
|
||||
* This case should still be ok, as locking the Private Space container and unlocking it,
|
||||
* reloads the values, fixing the incorrect UI.
|
||||
*/
|
||||
private void initializeInBackgroundThread() {
|
||||
Preconditions.assertNonUiThread();
|
||||
setPreInstalledSystemPackages();
|
||||
setAppInstallerIntent();
|
||||
setPrivateSpaceSettingsAvailable();
|
||||
}
|
||||
|
||||
private void setPrivateSpaceSettingsAvailable() {
|
||||
if (mPrivateSpaceSettingsAvailable) {
|
||||
return;
|
||||
@@ -178,6 +197,22 @@ public class PrivateProfileManager extends UserProfileManager {
|
||||
mPrivateSpaceSettingsAvailable = resolveInfo != null;
|
||||
}
|
||||
|
||||
private void setPreInstalledSystemPackages() {
|
||||
Preconditions.assertNonUiThread();
|
||||
if (getProfileUser() != null) {
|
||||
mPreInstalledSystemPackages = new HashSet<>(ApiWrapper
|
||||
.getPreInstalledSystemPackages(mAllApps.getContext(), getProfileUser()));
|
||||
}
|
||||
}
|
||||
|
||||
private void setAppInstallerIntent() {
|
||||
Preconditions.assertNonUiThread();
|
||||
if (getProfileUser() != null) {
|
||||
mAppInstallerIntent = ApiWrapper.getAppMarketActivityIntent(mAllApps.getContext(),
|
||||
BuildConfig.APPLICATION_ID, getProfileUser());
|
||||
}
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
void resetPrivateSpaceDecorator(int updatedState) {
|
||||
ActivityAllAppsContainerView<?>.AdapterHolder mainAdapterHolder = mAllApps.mAH.get(MAIN);
|
||||
@@ -225,4 +260,14 @@ public class PrivateProfileManager extends UserProfileManager {
|
||||
public Predicate<UserHandle> getUserMatcher() {
|
||||
return mPrivateProfileMatcher;
|
||||
}
|
||||
|
||||
/**
|
||||
* Splits private apps into user installed and system apps.
|
||||
* When the list of system apps is empty, all apps are treated as system.
|
||||
*/
|
||||
public Predicate<AppInfo> splitIntoUserInstalledAndSystemApps() {
|
||||
return appInfo -> !mPreInstalledSystemPackages.isEmpty()
|
||||
&& (appInfo.componentName == null
|
||||
|| !(mPreInstalledSystemPackages.contains(appInfo.componentName.getPackageName())));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,6 @@ import android.os.UserManager;
|
||||
|
||||
import androidx.annotation.IntDef;
|
||||
|
||||
import com.android.launcher3.Utilities;
|
||||
import com.android.launcher3.logging.StatsLogManager;
|
||||
import com.android.launcher3.model.data.ItemInfo;
|
||||
import com.android.launcher3.pm.UserCache;
|
||||
@@ -70,16 +69,13 @@ public abstract class UserProfileManager {
|
||||
|
||||
/** Sets quiet mode as enabled/disabled for the profile type. */
|
||||
protected void setQuietMode(boolean enabled) {
|
||||
if (Utilities.ATLEAST_P) {
|
||||
UI_HELPER_EXECUTOR.post(() -> {
|
||||
UI_HELPER_EXECUTOR.post(() ->
|
||||
mUserCache.getUserProfiles()
|
||||
.stream()
|
||||
.filter(getUserMatcher())
|
||||
.findFirst()
|
||||
.ifPresent(userHandle ->
|
||||
mUserManager.requestQuietModeEnabled(enabled, userHandle));
|
||||
});
|
||||
}
|
||||
mUserManager.requestQuietModeEnabled(enabled, userHandle)));
|
||||
}
|
||||
|
||||
/** Sets current state for the profile type. */
|
||||
|
||||
@@ -83,11 +83,9 @@ public class WorkModeSwitch extends LinearLayout implements Insettable,
|
||||
mIcon = findViewById(R.id.work_icon);
|
||||
mTextView = findViewById(R.id.pause_text);
|
||||
setSelected(true);
|
||||
if (Utilities.ATLEAST_R) {
|
||||
KeyboardInsetAnimationCallback keyboardInsetAnimationCallback =
|
||||
new KeyboardInsetAnimationCallback(this);
|
||||
setWindowInsetsAnimationCallback(keyboardInsetAnimationCallback);
|
||||
}
|
||||
KeyboardInsetAnimationCallback keyboardInsetAnimationCallback =
|
||||
new KeyboardInsetAnimationCallback(this);
|
||||
setWindowInsetsAnimationCallback(keyboardInsetAnimationCallback);
|
||||
|
||||
setInsets(mActivityContext.getDeviceProfile().getInsets());
|
||||
updateStringFromCache();
|
||||
|
||||
@@ -26,7 +26,6 @@ import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.android.launcher3.R;
|
||||
import com.android.launcher3.Utilities;
|
||||
import com.android.launcher3.model.StringCache;
|
||||
import com.android.launcher3.views.ActivityContext;
|
||||
|
||||
@@ -80,11 +79,9 @@ public class WorkPausedCard extends LinearLayout implements View.OnClickListener
|
||||
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
if (Utilities.ATLEAST_P) {
|
||||
setEnabled(false);
|
||||
mActivityContext.getAppsView().getWorkManager().setWorkProfileEnabled(true);
|
||||
mActivityContext.getStatsLogManager().logger().log(LAUNCHER_TURN_ON_WORK_APPS_TAP);
|
||||
}
|
||||
setEnabled(false);
|
||||
mActivityContext.getAppsView().getWorkManager().setWorkProfileEnabled(true);
|
||||
mActivityContext.getStatsLogManager().logger().log(LAUNCHER_TURN_ON_WORK_APPS_TAP);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -199,8 +199,7 @@ public class WorkProfileManager extends UserProfileManager
|
||||
}
|
||||
|
||||
private void onWorkFabClicked(View view) {
|
||||
if (Utilities.ATLEAST_P && getCurrentState() == STATE_ENABLED
|
||||
&& mWorkModeSwitch.isEnabled()) {
|
||||
if (getCurrentState() == STATE_ENABLED && mWorkModeSwitch.isEnabled()) {
|
||||
logEvents(LAUNCHER_TURN_OFF_WORK_APPS_TAP);
|
||||
setWorkProfileEnabled(false);
|
||||
}
|
||||
|
||||
@@ -25,7 +25,6 @@ import android.animation.ValueAnimator;
|
||||
import android.os.Trace;
|
||||
import android.util.FloatProperty;
|
||||
|
||||
import com.android.launcher3.Utilities;
|
||||
import com.android.launcher3.anim.AnimatorPlaybackController.Holder;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -86,7 +85,7 @@ public class PendingAnimation extends AnimatedPropertySetter {
|
||||
|
||||
/** If trace is enabled, add counter to trace animation progress. */
|
||||
public void logAnimationProgressToTrace(String counterName) {
|
||||
if (Utilities.ATLEAST_Q && Trace.isEnabled()) {
|
||||
if (Trace.isEnabled()) {
|
||||
super.addOnFrameListener(
|
||||
animation -> Trace.setCounter(
|
||||
counterName, (long) (animation.getAnimatedFraction() * 100)));
|
||||
|
||||
@@ -110,9 +110,6 @@ public class AccessibilityManagerCompat {
|
||||
}
|
||||
|
||||
public static int getRecommendedTimeoutMillis(Context context, int originalTimeout, int flags) {
|
||||
if (Utilities.ATLEAST_Q) {
|
||||
return getManager(context).getRecommendedTimeoutMillis(originalTimeout, flags);
|
||||
}
|
||||
return originalTimeout;
|
||||
return getManager(context).getRecommendedTimeoutMillis(originalTimeout, flags);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,8 +16,6 @@
|
||||
|
||||
package com.android.launcher3.dragndrop;
|
||||
|
||||
import static com.android.launcher3.Utilities.ATLEAST_Q;
|
||||
|
||||
import android.graphics.Point;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.drawable.Drawable;
|
||||
@@ -404,9 +402,7 @@ public abstract class DragController<T extends ActivityContext>
|
||||
mMotionDown.set(dragLayerPos.x, dragLayerPos.y);
|
||||
}
|
||||
|
||||
if (ATLEAST_Q) {
|
||||
mLastTouchClassification = ev.getClassification();
|
||||
}
|
||||
mLastTouchClassification = ev.getClassification();
|
||||
return mDragDriver != null && mDragDriver.onInterceptTouchEvent(ev);
|
||||
}
|
||||
|
||||
@@ -441,7 +437,7 @@ public abstract class DragController<T extends ActivityContext>
|
||||
mLastTouch.set(x, y);
|
||||
|
||||
int distanceDragged = mDistanceSinceScroll;
|
||||
if (ATLEAST_Q && mLastTouchClassification == MotionEvent.CLASSIFICATION_DEEP_PRESS) {
|
||||
if (mLastTouchClassification == MotionEvent.CLASSIFICATION_DEEP_PRESS) {
|
||||
distanceDragged /= DEEP_PRESS_DISTANCE_FACTOR;
|
||||
}
|
||||
if (mIsInPreDrag && mOptions.preDragCondition != null
|
||||
|
||||
@@ -37,7 +37,6 @@ import android.util.Log;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.annotation.UiThread;
|
||||
|
||||
import com.android.launcher3.Utilities;
|
||||
import com.android.launcher3.folder.FolderIcon;
|
||||
import com.android.launcher3.folder.PreviewBackground;
|
||||
import com.android.launcher3.icons.BitmapRenderer;
|
||||
@@ -74,13 +73,9 @@ public class FolderAdaptiveIcon extends AdaptiveIconDrawable {
|
||||
return mBadge;
|
||||
}
|
||||
|
||||
@TargetApi(Build.VERSION_CODES.P)
|
||||
public static @Nullable FolderAdaptiveIcon createFolderAdaptiveIcon(
|
||||
ActivityContext activity, int folderId, Point size) {
|
||||
Preconditions.assertNonUiThread();
|
||||
if (!Utilities.ATLEAST_P) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// assume square
|
||||
if (size.x != size.y) {
|
||||
|
||||
@@ -297,10 +297,8 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo
|
||||
mFooter = findViewById(R.id.folder_footer);
|
||||
mFooterHeight = dp.folderFooterHeightPx;
|
||||
|
||||
if (Utilities.ATLEAST_R) {
|
||||
mKeyboardInsetAnimationCallback = new KeyboardInsetAnimationCallback(this);
|
||||
setWindowInsetsAnimationCallback(mKeyboardInsetAnimationCallback);
|
||||
}
|
||||
mKeyboardInsetAnimationCallback = new KeyboardInsetAnimationCallback(this);
|
||||
setWindowInsetsAnimationCallback(mKeyboardInsetAnimationCallback);
|
||||
}
|
||||
|
||||
public boolean onLongClick(View v) {
|
||||
@@ -422,18 +420,16 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo
|
||||
|
||||
@Override
|
||||
public WindowInsets onApplyWindowInsets(WindowInsets windowInsets) {
|
||||
if (Utilities.ATLEAST_R) {
|
||||
this.setTranslationY(0);
|
||||
this.setTranslationY(0);
|
||||
|
||||
if (windowInsets.isVisible(WindowInsets.Type.ime())) {
|
||||
Insets keyboardInsets = windowInsets.getInsets(WindowInsets.Type.ime());
|
||||
int folderHeightFromBottom = getHeightFromBottom();
|
||||
if (windowInsets.isVisible(WindowInsets.Type.ime())) {
|
||||
Insets keyboardInsets = windowInsets.getInsets(WindowInsets.Type.ime());
|
||||
int folderHeightFromBottom = getHeightFromBottom();
|
||||
|
||||
if (keyboardInsets.bottom > folderHeightFromBottom) {
|
||||
// Translate this folder above the keyboard, then add the folder name's padding
|
||||
this.setTranslationY(folderHeightFromBottom - keyboardInsets.bottom
|
||||
- mFolderName.getPaddingBottom());
|
||||
}
|
||||
if (keyboardInsets.bottom > folderHeightFromBottom) {
|
||||
// Translate this folder above the keyboard, then add the folder name's padding
|
||||
this.setTranslationY(folderHeightFromBottom - keyboardInsets.bottom
|
||||
- mFolderName.getPaddingBottom());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -812,15 +808,13 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo
|
||||
a.addListener(new AnimatorListenerAdapter() {
|
||||
@Override
|
||||
public void onAnimationStart(Animator animation) {
|
||||
if (Utilities.ATLEAST_R) {
|
||||
setWindowInsetsAnimationCallback(null);
|
||||
}
|
||||
setWindowInsetsAnimationCallback(null);
|
||||
mIsAnimatingClosed = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAnimationEnd(Animator animation) {
|
||||
if (Utilities.ATLEAST_R && mKeyboardInsetAnimationCallback != null) {
|
||||
if (mKeyboardInsetAnimationCallback != null) {
|
||||
setWindowInsetsAnimationCallback(mKeyboardInsetAnimationCallback);
|
||||
}
|
||||
closeComplete(true);
|
||||
|
||||
@@ -19,7 +19,6 @@ import static com.android.launcher3.LauncherPrefs.THEMED_ICONS;
|
||||
import static com.android.launcher3.util.Executors.UI_HELPER_EXECUTOR;
|
||||
import static com.android.launcher3.util.Themes.isThemedIconEnabled;
|
||||
|
||||
import android.annotation.TargetApi;
|
||||
import android.content.ContentProvider;
|
||||
import android.content.ContentValues;
|
||||
import android.content.pm.PackageManager;
|
||||
@@ -27,7 +26,6 @@ import android.database.Cursor;
|
||||
import android.database.MatrixCursor;
|
||||
import android.net.Uri;
|
||||
import android.os.Binder;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.IBinder;
|
||||
@@ -41,7 +39,6 @@ import android.util.Pair;
|
||||
import com.android.launcher3.InvariantDeviceProfile;
|
||||
import com.android.launcher3.InvariantDeviceProfile.GridOption;
|
||||
import com.android.launcher3.LauncherPrefs;
|
||||
import com.android.launcher3.Utilities;
|
||||
import com.android.launcher3.util.Executors;
|
||||
|
||||
/**
|
||||
@@ -184,13 +181,12 @@ public class GridCustomizationsProvider extends ContentProvider {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!Utilities.ATLEAST_R || !METHOD_GET_PREVIEW.equals(method)) {
|
||||
if (!METHOD_GET_PREVIEW.equals(method)) {
|
||||
return null;
|
||||
}
|
||||
return getPreview(extras);
|
||||
}
|
||||
|
||||
@TargetApi(Build.VERSION_CODES.R)
|
||||
private synchronized Bundle getPreview(Bundle request) {
|
||||
PreviewLifecycleObserver observer = null;
|
||||
try {
|
||||
|
||||
@@ -26,7 +26,6 @@ import static com.android.launcher3.config.FeatureFlags.shouldShowFirstPageWidge
|
||||
import static com.android.launcher3.model.ModelUtils.filterCurrentWorkspaceItems;
|
||||
import static com.android.launcher3.model.ModelUtils.getMissingHotseatRanks;
|
||||
|
||||
import android.annotation.TargetApi;
|
||||
import android.app.Fragment;
|
||||
import android.app.WallpaperColors;
|
||||
import android.app.WallpaperManager;
|
||||
@@ -39,7 +38,6 @@ import android.content.res.Configuration;
|
||||
import android.content.res.TypedArray;
|
||||
import android.graphics.PointF;
|
||||
import android.graphics.Rect;
|
||||
import android.os.Build;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.util.AttributeSet;
|
||||
@@ -121,7 +119,6 @@ import java.util.concurrent.ConcurrentLinkedQueue;
|
||||
* 3) Place appropriate elements like icons and first-page qsb
|
||||
* 4) Measure and draw the view on a canvas
|
||||
*/
|
||||
@TargetApi(Build.VERSION_CODES.R)
|
||||
public class LauncherPreviewRenderer extends ContextWrapper
|
||||
implements ActivityContext, WorkspaceLayoutManager, LayoutInflater.Factory2 {
|
||||
|
||||
|
||||
@@ -49,7 +49,6 @@ import com.android.launcher3.DeviceProfile;
|
||||
import com.android.launcher3.InvariantDeviceProfile;
|
||||
import com.android.launcher3.LauncherAppState;
|
||||
import com.android.launcher3.LauncherSettings;
|
||||
import com.android.launcher3.Utilities;
|
||||
import com.android.launcher3.Workspace;
|
||||
import com.android.launcher3.graphics.LauncherPreviewRenderer.PreviewContext;
|
||||
import com.android.launcher3.model.BgDataModel;
|
||||
@@ -211,10 +210,7 @@ public class PreviewSurfaceRenderer {
|
||||
return new ContextThemeWrapper(context,
|
||||
Themes.getActivityThemeRes(context));
|
||||
}
|
||||
if (Utilities.ATLEAST_R) {
|
||||
context = context.createWindowContext(
|
||||
LayoutParams.TYPE_APPLICATION_OVERLAY, null);
|
||||
}
|
||||
context = context.createWindowContext(LayoutParams.TYPE_APPLICATION_OVERLAY, null);
|
||||
LocalColorExtractor.newInstance(context)
|
||||
.applyColorsOverride(context, mWallpaperColors);
|
||||
return new ContextThemeWrapper(context,
|
||||
|
||||
@@ -458,7 +458,7 @@ public class ModelDbController {
|
||||
LauncherWidgetHolder widgetHolder) {
|
||||
ContentResolver cr = mContext.getContentResolver();
|
||||
String blobHandlerDigest = Settings.Secure.getString(cr, LAYOUT_DIGEST_KEY);
|
||||
if (Utilities.ATLEAST_R && !TextUtils.isEmpty(blobHandlerDigest)) {
|
||||
if (!TextUtils.isEmpty(blobHandlerDigest)) {
|
||||
BlobStoreManager blobManager = mContext.getSystemService(BlobStoreManager.class);
|
||||
try (InputStream in = new ParcelFileDescriptor.AutoCloseInputStream(
|
||||
blobManager.openBlob(BlobHandle.createWithSha256(
|
||||
|
||||
@@ -189,8 +189,7 @@ public class WorkspaceItemInfo extends ItemInfoWithIcon {
|
||||
runtimeStatusFlags |= FLAG_DISABLED_BY_PUBLISHER;
|
||||
}
|
||||
disabledMessage = shortcutInfo.getDisabledMessage();
|
||||
if (Utilities.ATLEAST_P
|
||||
&& shortcutInfo.getDisabledReason() == ShortcutInfo.DISABLED_REASON_VERSION_LOWER) {
|
||||
if (shortcutInfo.getDisabledReason() == ShortcutInfo.DISABLED_REASON_VERSION_LOWER) {
|
||||
runtimeStatusFlags |= FLAG_DISABLED_VERSION_LOWER;
|
||||
} else {
|
||||
runtimeStatusFlags &= ~FLAG_DISABLED_VERSION_LOWER;
|
||||
|
||||
@@ -24,7 +24,6 @@ import android.content.pm.LauncherApps;
|
||||
import android.content.pm.PackageInstaller;
|
||||
import android.content.pm.PackageInstaller.SessionInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.os.Process;
|
||||
import android.os.UserHandle;
|
||||
import android.text.TextUtils;
|
||||
|
||||
@@ -34,7 +33,6 @@ import androidx.annotation.WorkerThread;
|
||||
|
||||
import com.android.launcher3.LauncherPrefs;
|
||||
import com.android.launcher3.SessionCommitReceiver;
|
||||
import com.android.launcher3.Utilities;
|
||||
import com.android.launcher3.logging.FileLog;
|
||||
import com.android.launcher3.model.ItemInstallQueue;
|
||||
import com.android.launcher3.util.IntArray;
|
||||
@@ -132,7 +130,7 @@ public class InstallSessionHelper {
|
||||
public SessionInfo getActiveSessionInfo(UserHandle user, String pkg) {
|
||||
for (SessionInfo info : getAllVerifiedSessions()) {
|
||||
boolean match = pkg.equals(info.getAppPackageName());
|
||||
if (Utilities.ATLEAST_Q && !user.equals(getUserHandle(info))) {
|
||||
if (!user.equals(getUserHandle(info))) {
|
||||
match = false;
|
||||
}
|
||||
if (match) {
|
||||
@@ -180,9 +178,8 @@ public class InstallSessionHelper {
|
||||
|
||||
@NonNull
|
||||
public List<SessionInfo> getAllVerifiedSessions() {
|
||||
List<SessionInfo> list = new ArrayList<>(Utilities.ATLEAST_Q
|
||||
? Objects.requireNonNull(mLauncherApps).getAllPackageInstallerSessions()
|
||||
: mInstaller.getAllSessions());
|
||||
List<SessionInfo> list = new ArrayList<>(
|
||||
Objects.requireNonNull(mLauncherApps).getAllPackageInstallerSessions());
|
||||
Iterator<SessionInfo> it = list.iterator();
|
||||
while (it.hasNext()) {
|
||||
if (verify(it.next()) == null) {
|
||||
@@ -252,6 +249,6 @@ public class InstallSessionHelper {
|
||||
}
|
||||
|
||||
public static UserHandle getUserHandle(@NonNull final SessionInfo info) {
|
||||
return Utilities.ATLEAST_Q ? info.getUser() : Process.myUserHandle();
|
||||
return info.getUser();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
package com.android.launcher3.popup;
|
||||
|
||||
import static com.android.launcher3.LauncherSettings.Favorites.CONTAINER_SHORTCUTS;
|
||||
import static com.android.launcher3.Utilities.ATLEAST_P;
|
||||
import static com.android.launcher3.Utilities.squaredHypot;
|
||||
import static com.android.launcher3.Utilities.squaredTouchSlop;
|
||||
import static com.android.launcher3.popup.PopupPopulator.MAX_SHORTCUTS;
|
||||
@@ -248,10 +247,7 @@ public class PopupContainerWithArrow<T extends Context & ActivityContext>
|
||||
* Animates and loads shortcuts on background thread for this popup container
|
||||
*/
|
||||
private void loadAppShortcuts(ItemInfo originalItemInfo) {
|
||||
|
||||
if (ATLEAST_P) {
|
||||
setAccessibilityPaneTitle(getTitleForAccessibility());
|
||||
}
|
||||
setAccessibilityPaneTitle(getTitleForAccessibility());
|
||||
mOriginalIcon.setForceHideDot(true);
|
||||
// All views are added. Animate layout from now on.
|
||||
setLayoutTransition(new LayoutTransition());
|
||||
|
||||
@@ -20,13 +20,11 @@ import static com.android.launcher3.Utilities.allowBGLaunch;
|
||||
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_SYSTEM_SHORTCUT_PAUSE_TAP;
|
||||
import static com.android.launcher3.util.Executors.MAIN_EXECUTOR;
|
||||
|
||||
import android.annotation.TargetApi;
|
||||
import android.app.ActivityOptions;
|
||||
import android.app.PendingIntent;
|
||||
import android.app.RemoteAction;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Build;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.view.accessibility.AccessibilityNodeInfo;
|
||||
@@ -42,7 +40,6 @@ import com.android.launcher3.model.data.ItemInfo;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
|
||||
@TargetApi(Build.VERSION_CODES.Q)
|
||||
public class RemoteActionShortcut extends SystemShortcut<BaseDraggingActivity> {
|
||||
private static final String TAG = "RemoteActionShortcut";
|
||||
private static final boolean DEBUG = Utilities.IS_DEBUG_DEVICE;
|
||||
|
||||
@@ -326,9 +326,6 @@ public class RestoreDbTask {
|
||||
*/
|
||||
private UserHandle getUserForAncestralSerialNumber(BackupManager backupManager,
|
||||
long ancestralSerialNumber) {
|
||||
if (!Utilities.ATLEAST_Q) {
|
||||
return null;
|
||||
}
|
||||
return backupManager.getUserForAncestralSerialNumber(ancestralSerialNumber);
|
||||
}
|
||||
|
||||
|
||||
@@ -52,7 +52,6 @@ import androidx.recyclerview.widget.RecyclerView;
|
||||
import com.android.launcher3.BuildConfig;
|
||||
import com.android.launcher3.LauncherFiles;
|
||||
import com.android.launcher3.R;
|
||||
import com.android.launcher3.Utilities;
|
||||
import com.android.launcher3.model.WidgetsModel;
|
||||
import com.android.launcher3.states.RotationHelper;
|
||||
import com.android.launcher3.uioverrides.flags.DeveloperOptionsUI;
|
||||
@@ -120,7 +119,7 @@ public class SettingsActivity extends FragmentActivity
|
||||
}
|
||||
|
||||
private boolean startPreference(String fragment, Bundle args, String key) {
|
||||
if (Utilities.ATLEAST_P && getSupportFragmentManager().isStateSaved()) {
|
||||
if (getSupportFragmentManager().isStateSaved()) {
|
||||
// Sometimes onClick can come after onPause because of being posted on the handler.
|
||||
// Skip starting new preferences in that case.
|
||||
return false;
|
||||
|
||||
@@ -15,19 +15,17 @@
|
||||
*/
|
||||
package com.android.launcher3.testing;
|
||||
|
||||
import static com.android.launcher3.allapps.AllAppsStore.DEFER_UPDATES_TEST;
|
||||
import static com.android.launcher3.Flags.enableGridOnlyOverview;
|
||||
import static com.android.launcher3.allapps.AllAppsStore.DEFER_UPDATES_TEST;
|
||||
import static com.android.launcher3.config.FeatureFlags.FOLDABLE_SINGLE_PAGE;
|
||||
import static com.android.launcher3.util.Executors.MAIN_EXECUTOR;
|
||||
|
||||
import android.annotation.TargetApi;
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.Insets;
|
||||
import android.graphics.Point;
|
||||
import android.graphics.Rect;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.view.WindowInsets;
|
||||
|
||||
@@ -60,7 +58,6 @@ import java.util.function.Supplier;
|
||||
/**
|
||||
* Class to handle requests from tests
|
||||
*/
|
||||
@TargetApi(Build.VERSION_CODES.Q)
|
||||
public class TestInformationHandler implements ResourceBasedOverride {
|
||||
|
||||
public static TestInformationHandler newInstance(Context context) {
|
||||
|
||||
@@ -190,16 +190,12 @@ public class ItemClickHandler {
|
||||
boolean downloadStarted) {
|
||||
ItemInfo item = (ItemInfo) v.getTag();
|
||||
CompletableFuture<SessionInfo> siFuture;
|
||||
if (Utilities.ATLEAST_Q) {
|
||||
siFuture = CompletableFuture.supplyAsync(() ->
|
||||
InstallSessionHelper.INSTANCE.get(launcher)
|
||||
.getActiveSessionInfo(item.user, packageName),
|
||||
UI_HELPER_EXECUTOR);
|
||||
} else {
|
||||
siFuture = CompletableFuture.completedFuture(null);
|
||||
}
|
||||
siFuture = CompletableFuture.supplyAsync(() ->
|
||||
InstallSessionHelper.INSTANCE.get(launcher)
|
||||
.getActiveSessionInfo(item.user, packageName),
|
||||
UI_HELPER_EXECUTOR);
|
||||
Consumer<SessionInfo> marketLaunchAction = sessionInfo -> {
|
||||
if (sessionInfo != null && Utilities.ATLEAST_Q) {
|
||||
if (sessionInfo != null) {
|
||||
LauncherApps launcherApps = launcher.getSystemService(LauncherApps.class);
|
||||
try {
|
||||
launcherApps.startPackageInstallerSessionDetailsActivity(sessionInfo, null,
|
||||
|
||||
@@ -19,7 +19,6 @@ package com.android.launcher3.util;
|
||||
import android.os.FileUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import com.android.launcher3.Utilities;
|
||||
import com.android.launcher3.config.FeatureFlags;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
@@ -51,17 +50,7 @@ public class IOUtils {
|
||||
}
|
||||
|
||||
public static long copy(InputStream from, OutputStream to) throws IOException {
|
||||
if (Utilities.ATLEAST_Q) {
|
||||
return FileUtils.copy(from, to);
|
||||
}
|
||||
byte[] buf = new byte[BUF_SIZE];
|
||||
long total = 0;
|
||||
int r;
|
||||
while ((r = from.read(buf)) != -1) {
|
||||
to.write(buf, 0, r);
|
||||
total += r;
|
||||
}
|
||||
return total;
|
||||
return FileUtils.copy(from, to);
|
||||
}
|
||||
|
||||
public static void closeSilently(Closeable c) {
|
||||
|
||||
@@ -20,12 +20,10 @@ import android.os.Trace;
|
||||
|
||||
import androidx.annotation.MainThread;
|
||||
|
||||
import com.android.launcher3.Utilities;
|
||||
import kotlin.random.Random;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import kotlin.random.Random;
|
||||
|
||||
/**
|
||||
* A wrapper around {@link Trace} to allow better testing.
|
||||
*
|
||||
@@ -67,9 +65,6 @@ public class TraceHelper {
|
||||
@SuppressWarnings("NewApi")
|
||||
@SuppressLint("NewApi")
|
||||
public SafeCloseable beginAsyncSection(String sectionName) {
|
||||
if (!Utilities.ATLEAST_Q) {
|
||||
return () -> { };
|
||||
}
|
||||
int cookie = Random.Default.nextInt();
|
||||
Trace.beginAsyncSection(sectionName, cookie);
|
||||
return () -> Trace.endAsyncSection(sectionName, cookie);
|
||||
@@ -81,9 +76,6 @@ public class TraceHelper {
|
||||
@SuppressWarnings("NewApi")
|
||||
@SuppressLint("NewApi")
|
||||
public SafeCloseable allowIpcs(String rpcName) {
|
||||
if (!Utilities.ATLEAST_Q) {
|
||||
return () -> { };
|
||||
}
|
||||
int cookie = Random.Default.nextInt();
|
||||
Trace.beginAsyncSection(rpcName, cookie);
|
||||
return () -> Trace.endAsyncSection(rpcName, cookie);
|
||||
|
||||
@@ -28,12 +28,10 @@ import static com.android.launcher3.util.Executors.MAIN_EXECUTOR;
|
||||
import static com.android.launcher3.util.Executors.UI_HELPER_EXECUTOR;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.annotation.TargetApi;
|
||||
import android.content.ContentResolver;
|
||||
import android.content.Context;
|
||||
import android.database.ContentObserver;
|
||||
import android.media.AudioAttributes;
|
||||
import android.os.Build;
|
||||
import android.os.SystemClock;
|
||||
import android.os.VibrationEffect;
|
||||
import android.os.Vibrator;
|
||||
@@ -48,7 +46,6 @@ import com.android.launcher3.config.FeatureFlags;
|
||||
/**
|
||||
* Wrapper around {@link Vibrator} to easily perform haptic feedback where necessary.
|
||||
*/
|
||||
@TargetApi(Build.VERSION_CODES.Q)
|
||||
public class VibratorWrapper {
|
||||
|
||||
public static final MainThreadInitializedObject<VibratorWrapper> INSTANCE =
|
||||
@@ -138,7 +135,7 @@ public class VibratorWrapper {
|
||||
mThresholdUntilNextDragCallMillis = 0;
|
||||
}
|
||||
|
||||
if (Utilities.ATLEAST_R && mVibrator.areAllPrimitivesSupported(
|
||||
if (mVibrator.areAllPrimitivesSupported(
|
||||
VibrationEffect.Composition.PRIMITIVE_QUICK_RISE,
|
||||
VibrationEffect.Composition.PRIMITIVE_TICK)) {
|
||||
if (FeatureFlags.ENABLE_SEARCH_HAPTIC_HINT.get()) {
|
||||
@@ -226,8 +223,7 @@ public class VibratorWrapper {
|
||||
public void vibrate(int primitiveId, float primitiveScale, VibrationEffect fallbackEffect) {
|
||||
if (mHasVibrator && mIsHapticFeedbackEnabled) {
|
||||
UI_HELPER_EXECUTOR.execute(() -> {
|
||||
if (Utilities.ATLEAST_R && primitiveId >= 0
|
||||
&& mVibrator.areAllPrimitivesSupported(primitiveId)) {
|
||||
if (primitiveId >= 0 && mVibrator.areAllPrimitivesSupported(primitiveId)) {
|
||||
mVibrator.vibrate(VibrationEffect.startComposition()
|
||||
.addPrimitive(primitiveId, primitiveScale)
|
||||
.compose(), VIBRATION_ATTRS);
|
||||
|
||||
@@ -105,24 +105,7 @@ public class WindowManagerProxy implements ResourceBasedOverride {
|
||||
/**
|
||||
* Returns the real bounds for the provided display after applying any insets normalization
|
||||
*/
|
||||
@TargetApi(Build.VERSION_CODES.R)
|
||||
public WindowBounds getRealBounds(Context displayInfoContext, CachedDisplayInfo info) {
|
||||
if (!Utilities.ATLEAST_R) {
|
||||
Point smallestSize = new Point();
|
||||
Point largestSize = new Point();
|
||||
getDisplay(displayInfoContext).getCurrentSizeRange(smallestSize, largestSize);
|
||||
|
||||
if (info.size.y > info.size.x) {
|
||||
// Portrait
|
||||
return new WindowBounds(info.size.x, info.size.y, smallestSize.x, largestSize.y,
|
||||
info.rotation);
|
||||
} else {
|
||||
// Landscape
|
||||
return new WindowBounds(info.size.x, info.size.y, largestSize.x, smallestSize.y,
|
||||
info.rotation);
|
||||
}
|
||||
}
|
||||
|
||||
WindowMetrics windowMetrics = displayInfoContext.getSystemService(WindowManager.class)
|
||||
.getMaximumWindowMetrics();
|
||||
Rect insets = new Rect();
|
||||
@@ -133,10 +116,9 @@ public class WindowManagerProxy implements ResourceBasedOverride {
|
||||
/**
|
||||
* Returns an updated insets, accounting for various Launcher UI specific overrides like taskbar
|
||||
*/
|
||||
@TargetApi(Build.VERSION_CODES.R)
|
||||
public WindowInsets normalizeWindowInsets(Context context, WindowInsets oldInsets,
|
||||
Rect outInsets) {
|
||||
if (!Utilities.ATLEAST_R || !mTaskbarDrawnInProcess) {
|
||||
if (!mTaskbarDrawnInProcess) {
|
||||
outInsets.set(oldInsets.getSystemWindowInsetLeft(), oldInsets.getSystemWindowInsetTop(),
|
||||
oldInsets.getSystemWindowInsetRight(), oldInsets.getSystemWindowInsetBottom());
|
||||
return oldInsets;
|
||||
@@ -220,8 +202,7 @@ public class WindowManagerProxy implements ResourceBasedOverride {
|
||||
}
|
||||
|
||||
boolean isTablet = swDp >= MIN_TABLET_WIDTH;
|
||||
boolean isTabletOrGesture = isTablet
|
||||
|| (Utilities.ATLEAST_R && isGestureNav(context));
|
||||
boolean isTabletOrGesture = isTablet || isGestureNav(context);
|
||||
|
||||
// Use the status bar height resources because current system API to get the status bar
|
||||
// height doesn't allow to do this for an arbitrary display, it returns value only
|
||||
@@ -360,17 +341,14 @@ public class WindowManagerProxy implements ResourceBasedOverride {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Returns the display associated with the context, or DEFAULT_DISPLAY if the context isn't
|
||||
* associated with a display.
|
||||
*/
|
||||
protected Display getDisplay(Context displayInfoContext) {
|
||||
if (Utilities.ATLEAST_R) {
|
||||
try {
|
||||
return displayInfoContext.getDisplay();
|
||||
} catch (UnsupportedOperationException e) {
|
||||
// Ignore
|
||||
}
|
||||
try {
|
||||
return displayInfoContext.getDisplay();
|
||||
} catch (UnsupportedOperationException e) {
|
||||
// Ignore
|
||||
}
|
||||
return displayInfoContext.getSystemService(DisplayManager.class).getDisplay(
|
||||
DEFAULT_DISPLAY);
|
||||
|
||||
@@ -19,7 +19,6 @@ import static android.window.SplashScreen.SPLASH_SCREEN_STYLE_SOLID_COLOR;
|
||||
|
||||
import static com.android.launcher3.LauncherSettings.Animation.DEFAULT_NO_ICON;
|
||||
import static com.android.launcher3.Utilities.allowBGLaunch;
|
||||
import static com.android.launcher3.logging.KeyboardStateManager.KeyboardState.HIDE;
|
||||
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_ALLAPPS_KEYBOARD_CLOSED;
|
||||
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_APP_LAUNCH_PENDING_INTENT;
|
||||
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_APP_LAUNCH_TAP;
|
||||
@@ -266,32 +265,26 @@ public interface ActivityContext {
|
||||
if (root == null) {
|
||||
return;
|
||||
}
|
||||
if (Utilities.ATLEAST_R) {
|
||||
Preconditions.assertUIThread();
|
||||
// Hide keyboard with WindowInsetsController if could. In case
|
||||
// hideSoftInputFromWindow may get ignored by input connection being finished
|
||||
// when the screen is off.
|
||||
//
|
||||
// In addition, inside IMF, the keyboards are closed asynchronously that launcher no
|
||||
// longer need to post to the message queue.
|
||||
final WindowInsetsController wic = root.getWindowInsetsController();
|
||||
WindowInsets insets = root.getRootWindowInsets();
|
||||
boolean isImeShown = insets != null && insets.isVisible(WindowInsets.Type.ime());
|
||||
if (wic != null) {
|
||||
// Only hide the keyboard if it is actually showing.
|
||||
if (isImeShown) {
|
||||
StatsLogManager slm = getStatsLogManager();
|
||||
slm.keyboardStateManager().setKeyboardState(HIDE);
|
||||
|
||||
// this method cannot be called cross threads
|
||||
wic.hide(WindowInsets.Type.ime());
|
||||
slm.logger().log(LAUNCHER_ALLAPPS_KEYBOARD_CLOSED);
|
||||
}
|
||||
|
||||
// If the WindowInsetsController is not null, we end here regardless of whether we
|
||||
// hid the keyboard or not.
|
||||
return;
|
||||
Preconditions.assertUIThread();
|
||||
// Hide keyboard with WindowInsetsController if could. In case hideSoftInputFromWindow may
|
||||
// get ignored by input connection being finished when the screen is off.
|
||||
//
|
||||
// In addition, inside IMF, the keyboards are closed asynchronously that launcher no longer
|
||||
// need to post to the message queue.
|
||||
final WindowInsetsController wic = root.getWindowInsetsController();
|
||||
WindowInsets insets = root.getRootWindowInsets();
|
||||
boolean isImeShown = insets != null && insets.isVisible(WindowInsets.Type.ime());
|
||||
if (wic != null) {
|
||||
// Only hide the keyboard if it is actually showing.
|
||||
if (isImeShown) {
|
||||
// this method cannot be called cross threads
|
||||
wic.hide(WindowInsets.Type.ime());
|
||||
getStatsLogManager().logger().log(LAUNCHER_ALLAPPS_KEYBOARD_CLOSED);
|
||||
}
|
||||
|
||||
// If the WindowInsetsController is not null, we end here regardless of whether we hid
|
||||
// the keyboard or not.
|
||||
return;
|
||||
}
|
||||
|
||||
InputMethodManager imm = root.getContext().getSystemService(InputMethodManager.class);
|
||||
|
||||
@@ -551,25 +551,21 @@ public abstract class BaseDragLayer<T extends Context & ActivityContext>
|
||||
|
||||
@Override
|
||||
public WindowInsets dispatchApplyWindowInsets(WindowInsets insets) {
|
||||
if (Utilities.ATLEAST_Q) {
|
||||
Insets gestureInsets = insets.getMandatorySystemGestureInsets();
|
||||
int gestureInsetBottom = gestureInsets.bottom;
|
||||
Insets imeInset = Utilities.ATLEAST_R
|
||||
? insets.getInsets(WindowInsets.Type.ime())
|
||||
: Insets.NONE;
|
||||
DeviceProfile dp = mActivity.getDeviceProfile();
|
||||
if (dp.isTaskbarPresent) {
|
||||
// Ignore taskbar gesture insets to avoid interfering with TouchControllers.
|
||||
gestureInsetBottom = ResourceUtils.getNavbarSize(
|
||||
ResourceUtils.NAVBAR_BOTTOM_GESTURE_SIZE, getResources());
|
||||
}
|
||||
mSystemGestureRegion.set(
|
||||
Math.max(gestureInsets.left, imeInset.left),
|
||||
Math.max(gestureInsets.top, imeInset.top),
|
||||
Math.max(gestureInsets.right, imeInset.right),
|
||||
Math.max(gestureInsetBottom, imeInset.bottom)
|
||||
);
|
||||
Insets gestureInsets = insets.getMandatorySystemGestureInsets();
|
||||
int gestureInsetBottom = gestureInsets.bottom;
|
||||
Insets imeInset = insets.getInsets(WindowInsets.Type.ime());
|
||||
DeviceProfile dp = mActivity.getDeviceProfile();
|
||||
if (dp.isTaskbarPresent) {
|
||||
// Ignore taskbar gesture insets to avoid interfering with TouchControllers.
|
||||
gestureInsetBottom = ResourceUtils.getNavbarSize(
|
||||
ResourceUtils.NAVBAR_BOTTOM_GESTURE_SIZE, getResources());
|
||||
}
|
||||
mSystemGestureRegion.set(
|
||||
Math.max(gestureInsets.left, imeInset.left),
|
||||
Math.max(gestureInsets.top, imeInset.top),
|
||||
Math.max(gestureInsets.right, imeInset.right),
|
||||
Math.max(gestureInsetBottom, imeInset.bottom)
|
||||
);
|
||||
return super.dispatchApplyWindowInsets(insets);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,7 +25,6 @@ import static java.lang.Math.max;
|
||||
import android.animation.Animator;
|
||||
import android.animation.AnimatorListenerAdapter;
|
||||
import android.animation.ValueAnimator;
|
||||
import android.annotation.TargetApi;
|
||||
import android.content.Context;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Color;
|
||||
@@ -36,7 +35,6 @@ import android.graphics.RectF;
|
||||
import android.graphics.drawable.AdaptiveIconDrawable;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Build;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup.MarginLayoutParams;
|
||||
@@ -55,7 +53,6 @@ import com.android.launcher3.graphics.IconShape;
|
||||
* Supports springing just the foreground layer.
|
||||
* Supports clipping the icon to/from its icon shape.
|
||||
*/
|
||||
@TargetApi(Build.VERSION_CODES.Q)
|
||||
public class ClipIconView extends View implements ClipPathView {
|
||||
|
||||
private static final Rect sTmpRect = new Rect();
|
||||
|
||||
@@ -24,14 +24,12 @@ import static com.android.launcher3.util.Executors.MODEL_EXECUTOR;
|
||||
import static com.android.launcher3.views.IconLabelDotView.setIconAndDotVisible;
|
||||
|
||||
import android.animation.Animator;
|
||||
import android.annotation.TargetApi;
|
||||
import android.content.Context;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.RectF;
|
||||
import android.graphics.drawable.AdaptiveIconDrawable;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Build;
|
||||
import android.os.CancellationSignal;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.Log;
|
||||
@@ -67,7 +65,6 @@ import java.util.function.Supplier;
|
||||
/**
|
||||
* A view that is created to look like another view with the purpose of creating fluid animations.
|
||||
*/
|
||||
@TargetApi(Build.VERSION_CODES.Q)
|
||||
public class FloatingIconView extends FrameLayout implements
|
||||
Animator.AnimatorListener, OnGlobalLayoutListener, FloatingView {
|
||||
|
||||
|
||||
@@ -18,14 +18,12 @@ package com.android.launcher3.views;
|
||||
import static com.android.launcher3.views.FloatingIconView.getLocationBoundsForView;
|
||||
import static com.android.launcher3.views.IconLabelDotView.setIconAndDotVisible;
|
||||
|
||||
import android.annotation.TargetApi;
|
||||
import android.content.Context;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Picture;
|
||||
import android.graphics.PixelFormat;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.RectF;
|
||||
import android.os.Build;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.SurfaceHolder;
|
||||
@@ -47,7 +45,6 @@ import com.android.launcher3.util.window.RefreshRateTracker;
|
||||
* Similar to {@link FloatingIconView} but displays a surface with the targetIcon. It then passes
|
||||
* the surfaceHandle to the {@link GestureNavContract}.
|
||||
*/
|
||||
@TargetApi(Build.VERSION_CODES.R)
|
||||
public class FloatingSurfaceView extends AbstractFloatingView implements
|
||||
OnGlobalLayoutListener, Insettable, SurfaceHolder.Callback2 {
|
||||
|
||||
|
||||
@@ -30,7 +30,6 @@ import android.graphics.Paint;
|
||||
import android.graphics.Point;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.RectF;
|
||||
import android.os.Build;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.Log;
|
||||
import android.util.Property;
|
||||
@@ -40,7 +39,6 @@ import android.view.ViewConfiguration;
|
||||
import android.view.WindowInsets;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.RequiresApi;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.android.launcher3.FastScrollRecyclerView;
|
||||
@@ -352,26 +350,21 @@ public class RecyclerViewFastScroller extends View {
|
||||
float r = getScrollThumbRadius();
|
||||
mThumbBounds.set(-halfW, 0, halfW, mThumbHeight);
|
||||
canvas.drawRoundRect(mThumbBounds, r, r, mThumbPaint);
|
||||
if (Utilities.ATLEAST_Q) {
|
||||
mThumbBounds.roundOut(SYSTEM_GESTURE_EXCLUSION_RECT.get(0));
|
||||
// swiping very close to the thumb area (not just within it's bound)
|
||||
// will also prevent back gesture
|
||||
SYSTEM_GESTURE_EXCLUSION_RECT.get(0).offset(mThumbDrawOffset.x, mThumbDrawOffset.y);
|
||||
if (Utilities.ATLEAST_Q && mSystemGestureInsets != null) {
|
||||
SYSTEM_GESTURE_EXCLUSION_RECT.get(0).left =
|
||||
SYSTEM_GESTURE_EXCLUSION_RECT.get(0).right - mSystemGestureInsets.right;
|
||||
}
|
||||
setSystemGestureExclusionRects(SYSTEM_GESTURE_EXCLUSION_RECT);
|
||||
mThumbBounds.roundOut(SYSTEM_GESTURE_EXCLUSION_RECT.get(0));
|
||||
// swiping very close to the thumb area (not just within it's bound)
|
||||
// will also prevent back gesture
|
||||
SYSTEM_GESTURE_EXCLUSION_RECT.get(0).offset(mThumbDrawOffset.x, mThumbDrawOffset.y);
|
||||
if (mSystemGestureInsets != null) {
|
||||
SYSTEM_GESTURE_EXCLUSION_RECT.get(0).left =
|
||||
SYSTEM_GESTURE_EXCLUSION_RECT.get(0).right - mSystemGestureInsets.right;
|
||||
}
|
||||
setSystemGestureExclusionRects(SYSTEM_GESTURE_EXCLUSION_RECT);
|
||||
canvas.restoreToCount(saveCount);
|
||||
}
|
||||
|
||||
@Override
|
||||
@RequiresApi(Build.VERSION_CODES.Q)
|
||||
public WindowInsets onApplyWindowInsets(WindowInsets insets) {
|
||||
if (Utilities.ATLEAST_Q) {
|
||||
mSystemGestureInsets = insets.getSystemGestureInsets();
|
||||
}
|
||||
mSystemGestureInsets = insets.getSystemGestureInsets();
|
||||
return super.onApplyWindowInsets(insets);
|
||||
}
|
||||
|
||||
|
||||
@@ -16,8 +16,6 @@
|
||||
|
||||
package com.android.launcher3.widget;
|
||||
|
||||
import static com.android.launcher3.Utilities.ATLEAST_R;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.graphics.Insets;
|
||||
@@ -153,17 +151,10 @@ public class AddItemWidgetsBottomSheet extends AbstractSlideInView<AddItemActivi
|
||||
@SuppressLint("NewApi") // Already added API check.
|
||||
@Override
|
||||
public WindowInsets onApplyWindowInsets(View view, WindowInsets windowInsets) {
|
||||
if (ATLEAST_R) {
|
||||
Insets insets = windowInsets.getInsets(WindowInsets.Type.systemBars());
|
||||
mInsets.set(insets.left, insets.top, insets.right, insets.bottom);
|
||||
} else {
|
||||
mInsets.set(windowInsets.getSystemWindowInsetLeft(),
|
||||
windowInsets.getSystemWindowInsetTop(),
|
||||
windowInsets.getSystemWindowInsetRight(),
|
||||
windowInsets.getSystemWindowInsetBottom());
|
||||
}
|
||||
mContent.setPadding(mContent.getPaddingStart(),
|
||||
mContent.getPaddingTop(), mContent.getPaddingEnd(), mInsets.bottom);
|
||||
Insets insets = windowInsets.getInsets(WindowInsets.Type.systemBars());
|
||||
mInsets.set(insets.left, insets.top, insets.right, insets.bottom);
|
||||
mContent.setPadding(mContent.getPaddingStart(), mContent.getPaddingTop(),
|
||||
mContent.getPaddingEnd(), mInsets.bottom);
|
||||
|
||||
int contentHorizontalMarginInPx = getResources().getDimensionPixelSize(
|
||||
R.dimen.widget_list_horizontal_margin);
|
||||
|
||||
@@ -158,10 +158,8 @@ public abstract class BaseWidgetSheet extends AbstractSlideInView<BaseActivity>
|
||||
private int getNavBarScrimHeight(WindowInsets insets) {
|
||||
if (mDisableNavBarScrim) {
|
||||
return 0;
|
||||
} else if (Utilities.ATLEAST_Q) {
|
||||
return insets.getTappableElementInsets().bottom;
|
||||
} else {
|
||||
return insets.getStableInsetBottom();
|
||||
return insets.getTappableElementInsets().bottom;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -16,11 +16,9 @@
|
||||
|
||||
package com.android.launcher3.widget;
|
||||
|
||||
import android.annotation.TargetApi;
|
||||
import android.appwidget.AppWidgetProviderInfo;
|
||||
import android.content.Context;
|
||||
import android.graphics.Rect;
|
||||
import android.os.Build;
|
||||
import android.os.Handler;
|
||||
import android.os.Parcelable;
|
||||
import android.os.SystemClock;
|
||||
@@ -44,7 +42,6 @@ import com.android.launcher3.CheckLongPressHelper;
|
||||
import com.android.launcher3.Flags;
|
||||
import com.android.launcher3.Launcher;
|
||||
import com.android.launcher3.R;
|
||||
import com.android.launcher3.Utilities;
|
||||
import com.android.launcher3.dragndrop.DragLayer;
|
||||
import com.android.launcher3.model.data.ItemInfo;
|
||||
import com.android.launcher3.model.data.LauncherAppWidgetInfo;
|
||||
@@ -105,7 +102,7 @@ public class LauncherAppWidgetHostView extends BaseLauncherAppWidgetHostView
|
||||
setDefaultFocusHighlightEnabled(false);
|
||||
}
|
||||
|
||||
if (Utilities.ATLEAST_Q && Themes.getAttrBoolean(mLauncher, R.attr.isWorkspaceDarkText)) {
|
||||
if (Themes.getAttrBoolean(mLauncher, R.attr.isWorkspaceDarkText)) {
|
||||
setOnLightBackground(true);
|
||||
}
|
||||
mColorExtractor = new LocalColorExtractor(); // no-op
|
||||
@@ -131,10 +128,9 @@ public class LauncherAppWidgetHostView extends BaseLauncherAppWidgetHostView
|
||||
}
|
||||
|
||||
@Override
|
||||
@TargetApi(Build.VERSION_CODES.Q)
|
||||
public void setAppWidget(int appWidgetId, AppWidgetProviderInfo info) {
|
||||
super.setAppWidget(appWidgetId, info);
|
||||
if (!mTrackingWidgetUpdate && Utilities.ATLEAST_Q) {
|
||||
if (!mTrackingWidgetUpdate) {
|
||||
mTrackingWidgetUpdate = true;
|
||||
Trace.beginAsyncSection(TRACE_METHOD_NAME + info.provider, appWidgetId);
|
||||
Log.i(TAG, "App widget created with id: " + appWidgetId);
|
||||
@@ -142,9 +138,8 @@ public class LauncherAppWidgetHostView extends BaseLauncherAppWidgetHostView
|
||||
}
|
||||
|
||||
@Override
|
||||
@TargetApi(Build.VERSION_CODES.Q)
|
||||
public void updateAppWidget(RemoteViews remoteViews) {
|
||||
if (mTrackingWidgetUpdate && remoteViews != null && Utilities.ATLEAST_Q) {
|
||||
if (mTrackingWidgetUpdate && remoteViews != null) {
|
||||
Log.i(TAG, "App widget with id: " + getAppWidgetId() + " loaded");
|
||||
Trace.endAsyncSection(
|
||||
TRACE_METHOD_NAME + getAppWidgetInfo().provider, getAppWidgetId());
|
||||
@@ -288,8 +283,7 @@ public class LauncherAppWidgetHostView extends BaseLauncherAppWidgetHostView
|
||||
super.onLayout(changed, left, top, right, bottom);
|
||||
mIsScrollable = checkScrollableRecursively(this);
|
||||
|
||||
if (!mIsInDragMode && getTag() instanceof LauncherAppWidgetInfo) {
|
||||
LauncherAppWidgetInfo info = (LauncherAppWidgetInfo) getTag();
|
||||
if (!mIsInDragMode && getTag() instanceof LauncherAppWidgetInfo info) {
|
||||
mTempRect.set(left, top, right, bottom);
|
||||
mColorExtractor.setWorkspaceLocation(mTempRect, (View) getParent(), info.screenId);
|
||||
}
|
||||
@@ -425,8 +419,7 @@ public class LauncherAppWidgetHostView extends BaseLauncherAppWidgetHostView
|
||||
|
||||
@Override
|
||||
protected boolean shouldAllowDirectClick() {
|
||||
if (getTag() instanceof ItemInfo) {
|
||||
ItemInfo item = (ItemInfo) getTag();
|
||||
if (getTag() instanceof ItemInfo item) {
|
||||
return item.spanX == 1 && item.spanY == 1;
|
||||
}
|
||||
return false;
|
||||
|
||||
@@ -15,7 +15,6 @@ import android.os.UserHandle;
|
||||
import com.android.launcher3.DeviceProfile;
|
||||
import com.android.launcher3.InvariantDeviceProfile;
|
||||
import com.android.launcher3.LauncherAppState;
|
||||
import com.android.launcher3.Utilities;
|
||||
import com.android.launcher3.icons.ComponentWithLabelAndIcon;
|
||||
import com.android.launcher3.icons.IconCache;
|
||||
import com.android.launcher3.model.data.LauncherAppWidgetInfo;
|
||||
@@ -206,11 +205,7 @@ public class LauncherAppWidgetProviderInfo extends AppWidgetProviderInfo
|
||||
}
|
||||
|
||||
public int getWidgetFeatures() {
|
||||
if (Utilities.ATLEAST_P) {
|
||||
return widgetFeatures;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
return widgetFeatures;
|
||||
}
|
||||
|
||||
public boolean isReconfigurable() {
|
||||
|
||||
@@ -88,6 +88,14 @@
|
||||
android:resource="@xml/appwidget_dynamic_colors"/>
|
||||
</receiver>
|
||||
|
||||
<receiver android:name="com.android.launcher3.testcomponent.UnarchiveBroadcastReceiver"
|
||||
android:enabled="true"
|
||||
android:exported="true">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.UNARCHIVE_PACKAGE"/>
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
|
||||
<activity
|
||||
android:name="com.android.launcher3.testcomponent.WidgetConfigActivity"
|
||||
android:exported="true">
|
||||
|
||||
@@ -23,14 +23,6 @@
|
||||
|
||||
<application android:debuggable="true">
|
||||
<uses-library android:name="android.test.runner" />
|
||||
|
||||
<receiver android:name="com.android.launcher3.compat.TaplPromiseIconUiTest$UnarchiveBroadcastReceiver"
|
||||
android:enabled="true"
|
||||
android:exported="true">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.UNARCHIVE_PACKAGE"/>
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
</application>
|
||||
|
||||
<instrumentation
|
||||
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* Copyright (C) 2024 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.android.launcher3.testcomponent;
|
||||
|
||||
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
|
||||
/**
|
||||
* Broadcast Receiver to receive app unarchival broadcast. It is used to fulfill archiving
|
||||
* platform requirements.
|
||||
*/
|
||||
public class UnarchiveBroadcastReceiver extends BroadcastReceiver {
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
}
|
||||
}
|
||||
@@ -19,6 +19,7 @@ package com.android.launcher3.allapps;
|
||||
import static androidx.test.core.app.ApplicationProvider.getApplicationContext;
|
||||
|
||||
import static com.android.launcher3.allapps.BaseAllAppsAdapter.VIEW_TYPE_PRIVATE_SPACE_HEADER;
|
||||
import static com.android.launcher3.allapps.BaseAllAppsAdapter.VIEW_TYPE_PRIVATE_SPACE_SYS_APPS_DIVIDER;
|
||||
import static com.android.launcher3.allapps.SectionDecorationInfo.ROUND_BOTTOM_LEFT;
|
||||
import static com.android.launcher3.allapps.SectionDecorationInfo.ROUND_BOTTOM_RIGHT;
|
||||
import static com.android.launcher3.allapps.SectionDecorationInfo.ROUND_NOTHING;
|
||||
@@ -63,9 +64,10 @@ public class AlphabeticalAppsListTest {
|
||||
|
||||
private static final int PRIVATE_SPACE_HEADER_ITEM_COUNT = 1;
|
||||
private static final int MAIN_USER_APP_COUNT = 2;
|
||||
private static final int PRIVATE_USER_APP_COUNT = 1;
|
||||
private static final int PRIVATE_USER_APP_COUNT = 2;
|
||||
private static final int NUM_APP_COLS = 4;
|
||||
private static final int NUM_APP_ROWS = 3;
|
||||
private static final int PRIVATE_SPACE_SYS_APP_SEPARATOR_ITEM_COUNT = 1;
|
||||
|
||||
private AlphabeticalAppsList<?> mAlphabeticalAppsList;
|
||||
@Mock
|
||||
@@ -96,6 +98,10 @@ public class AlphabeticalAppsListTest {
|
||||
when(mPrivateProfileManager.addPrivateSpaceHeader(any()))
|
||||
.thenAnswer(answer(this::addPrivateSpaceHeader));
|
||||
when(mPrivateProfileManager.getCurrentState()).thenReturn(STATE_ENABLED);
|
||||
when(mPrivateProfileManager.splitIntoUserInstalledAndSystemApps())
|
||||
.thenReturn(iteminfo -> iteminfo.componentName == null
|
||||
|| !iteminfo.componentName.getPackageName()
|
||||
.equals("com.android.launcher3.tests.camera"));
|
||||
|
||||
mAlphabeticalAppsList.updateItemFilter(info -> info != null
|
||||
&& info.user.equals(MAIN_HANDLE));
|
||||
@@ -111,6 +117,44 @@ public class AlphabeticalAppsListTest {
|
||||
&& item.itemInfo.user.equals(PRIVATE_HANDLE)).toList().size());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void privateProfileEnabled_privateProfileAppsShownWithSeparator() {
|
||||
mSetFlagsRule.enableFlags(Flags.FLAG_ENABLE_PRIVATE_SPACE);
|
||||
mSetFlagsRule.enableFlags(Flags.FLAG_PRIVATE_SPACE_SYS_APPS_SEPARATION);
|
||||
when(mAllAppsStore.getApps()).thenReturn(createAppInfoListForMainAndPrivateUser());
|
||||
when(mPrivateProfileManager.addPrivateSpaceHeader(any()))
|
||||
.thenAnswer(answer(this::addPrivateSpaceHeader));
|
||||
when(mPrivateProfileManager.addSystemAppsDivider(any()))
|
||||
.thenAnswer(answer(this::addSystemAppsDivider));
|
||||
when(mPrivateProfileManager.getCurrentState()).thenReturn(STATE_ENABLED);
|
||||
when(mPrivateProfileManager.splitIntoUserInstalledAndSystemApps())
|
||||
.thenReturn(iteminfo -> iteminfo.componentName == null
|
||||
|| !iteminfo.componentName.getPackageName()
|
||||
.equals("com.android.launcher3.tests.camera"));
|
||||
|
||||
mAlphabeticalAppsList.updateItemFilter(info -> info != null
|
||||
&& info.user.equals(MAIN_HANDLE));
|
||||
|
||||
assertEquals(MAIN_USER_APP_COUNT + PRIVATE_SPACE_HEADER_ITEM_COUNT
|
||||
+ PRIVATE_SPACE_SYS_APP_SEPARATOR_ITEM_COUNT
|
||||
+ PRIVATE_USER_APP_COUNT, mAlphabeticalAppsList.getAdapterItems().size());
|
||||
assertEquals(PRIVATE_SPACE_HEADER_ITEM_COUNT,
|
||||
mAlphabeticalAppsList.getAdapterItems().stream().filter(item ->
|
||||
item.viewType == VIEW_TYPE_PRIVATE_SPACE_HEADER).toList().size());
|
||||
assertEquals(PRIVATE_SPACE_SYS_APP_SEPARATOR_ITEM_COUNT,
|
||||
mAlphabeticalAppsList.getAdapterItems().stream().filter(item ->
|
||||
item.viewType == VIEW_TYPE_PRIVATE_SPACE_SYS_APPS_DIVIDER).toList().size());
|
||||
List<BaseAllAppsAdapter.AdapterItem> psApps = mAlphabeticalAppsList.getAdapterItems()
|
||||
.stream()
|
||||
.filter(item -> item.itemInfo != null && item.itemInfo.user.equals(PRIVATE_HANDLE))
|
||||
.toList();
|
||||
assertEquals(PRIVATE_USER_APP_COUNT, psApps.size());
|
||||
assert psApps.get(0).itemInfo.title != null;
|
||||
assertEquals("Private Messenger", psApps.get(0).itemInfo.title.toString());
|
||||
assert psApps.get(1).itemInfo.title != null;
|
||||
assertEquals("Private Camera", psApps.get(1).itemInfo.title.toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void privateProfileDisabled_onlyPrivateProfileHeaderViewIsPresent() {
|
||||
mSetFlagsRule.enableFlags(Flags.FLAG_ENABLE_PRIVATE_SPACE);
|
||||
@@ -281,6 +325,12 @@ public class AlphabeticalAppsListTest {
|
||||
return adapterItemList.size();
|
||||
}
|
||||
|
||||
private int addSystemAppsDivider(List<BaseAllAppsAdapter.AdapterItem> adapterItemList) {
|
||||
adapterItemList.add(new BaseAllAppsAdapter
|
||||
.AdapterItem(VIEW_TYPE_PRIVATE_SPACE_SYS_APPS_DIVIDER));
|
||||
return adapterItemList.size();
|
||||
}
|
||||
|
||||
private AppInfo[] createAppInfoListForMainUser() {
|
||||
ComponentName gmailComponentName = new ComponentName(mContext,
|
||||
"com.android.launcher3.tests.Activity" + "Gmail");
|
||||
@@ -298,7 +348,11 @@ public class AlphabeticalAppsListTest {
|
||||
"com.android.launcher3.tests.Activity" + "PrivateMessenger");
|
||||
AppInfo privateMessengerAppInfo = new AppInfo(privateMessengercomponentName,
|
||||
"Private Messenger", PRIVATE_HANDLE, new Intent());
|
||||
return new AppInfo[]{privateMessengerAppInfo};
|
||||
ComponentName privateCameraComponentName = new ComponentName(
|
||||
"com.android.launcher3.tests.camera", "CameraActivity");
|
||||
AppInfo privateCameraAppInfo = new AppInfo(privateCameraComponentName,
|
||||
"Private Camera", PRIVATE_HANDLE, new Intent());
|
||||
return new AppInfo[]{privateMessengerAppInfo, privateCameraAppInfo};
|
||||
}
|
||||
|
||||
private AppInfo[] createAppInfoListForMainAndPrivateUser() {
|
||||
|
||||
@@ -16,6 +16,8 @@
|
||||
|
||||
package com.android.launcher3.allapps;
|
||||
|
||||
import static androidx.test.core.app.ApplicationProvider.getApplicationContext;
|
||||
|
||||
import static com.android.launcher3.allapps.UserProfileManager.STATE_DISABLED;
|
||||
import static com.android.launcher3.allapps.UserProfileManager.STATE_ENABLED;
|
||||
import static com.android.launcher3.model.BgDataModel.Callbacks.FLAG_PRIVATE_PROFILE_QUIET_MODE_ENABLED;
|
||||
@@ -31,8 +33,10 @@ import static org.mockito.Mockito.doNothing;
|
||||
import static org.mockito.Mockito.spy;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
import android.app.PendingIntent;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.LauncherApps;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.pm.ResolveInfo;
|
||||
import android.os.Process;
|
||||
@@ -43,6 +47,7 @@ import androidx.test.runner.AndroidJUnit4;
|
||||
|
||||
import com.android.launcher3.logging.StatsLogManager;
|
||||
import com.android.launcher3.pm.UserCache;
|
||||
import com.android.launcher3.util.ActivityContextWrapper;
|
||||
import com.android.launcher3.util.UserIconInfo;
|
||||
import com.android.launcher3.util.rule.TestStabilityRule;
|
||||
|
||||
@@ -56,6 +61,7 @@ import org.mockito.Mock;
|
||||
import org.mockito.Mockito;
|
||||
import org.mockito.MockitoAnnotations;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
|
||||
@RunWith(AndroidJUnit4.class)
|
||||
@@ -89,6 +95,8 @@ public class PrivateProfileManagerTest {
|
||||
private AllAppsStore mAllAppsStore;
|
||||
@Mock
|
||||
private PackageManager mPackageManager;
|
||||
@Mock
|
||||
private LauncherApps mLauncherApps;
|
||||
|
||||
private boolean mRunnableCalled = false;
|
||||
|
||||
@@ -103,6 +111,13 @@ public class PrivateProfileManagerTest {
|
||||
when(mActivityAllAppsContainerView.getAppsStore()).thenReturn(mAllAppsStore);
|
||||
when(mContext.getPackageManager()).thenReturn(mPackageManager);
|
||||
when(mPackageManager.resolveActivity(any(), any())).thenReturn(new ResolveInfo());
|
||||
when(mContext.getSystemService(LauncherApps.class)).thenReturn(mLauncherApps);
|
||||
when(mLauncherApps.getAppMarketActivityIntent(any(), any())).thenReturn(PendingIntent
|
||||
.getActivity(new ActivityContextWrapper(getApplicationContext()), 0,
|
||||
new Intent(), PendingIntent.FLAG_IMMUTABLE).getIntentSender());
|
||||
when(mContext.getPackageName())
|
||||
.thenReturn("com.android.launcher3.tests.privateProfileManager");
|
||||
when(mLauncherApps.getPreInstalledSystemPackages(any())).thenReturn(new ArrayList<>());
|
||||
mPrivateProfileManager = new PrivateProfileManager(mUserManager,
|
||||
mActivityAllAppsContainerView, mStatsLogManager, mUserCache);
|
||||
}
|
||||
|
||||
@@ -19,9 +19,6 @@ import static com.android.launcher3.Flags.FLAG_ENABLE_SUPPORT_FOR_ARCHIVING;
|
||||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageInstaller.SessionParams;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.graphics.Bitmap;
|
||||
@@ -170,13 +167,6 @@ public class TaplPromiseIconUiTest extends AbstractLauncherUiTest {
|
||||
mSessionId = -1;
|
||||
}
|
||||
|
||||
// Dummy receiver to fulfill archiving platform requirements, unused in reality.
|
||||
public static class UnarchiveBroadcastReceiver extends BroadcastReceiver {
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
}
|
||||
}
|
||||
|
||||
private void installDummyAppAndWaitForUIUpdate() throws IOException {
|
||||
TestUtil.installDummyApp();
|
||||
mLauncher.waitForModelQueueCleared();
|
||||
|
||||
Reference in New Issue
Block a user