Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9737454d authored by Jon Miranda's avatar Jon Miranda
Browse files

Merging from ub-launcher3-master @ build 6852432

Test: manual, presubmit on the source branch
x20/teams/android-launcher/merge/ub-launcher3-master_master_6852432.html

Change-Id: I91066d6c55e88355a10a61281ad0d9b38b43f166
parents b28d2541 c28fd0e9
Loading
Loading
Loading
Loading
+11 −14
Original line number Diff line number Diff line
@@ -63,7 +63,6 @@ import com.android.launcher3.util.SimpleBroadcastReceiver;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.function.Consumer;

/**
 * Data model for digital wellbeing status of apps.
@@ -222,9 +221,8 @@ public final class WellbeingModel {
            reloadLauncherInNormalMode(context);
            return;
        }
        runWithMinimalDeviceConfigs((bundle) -> {
            if (bundle.getInt(EXTRA_MINIMAL_DEVICE_STATE, UNKNOWN_MINIMAL_DEVICE_STATE)
                    == IN_MINIMAL_DEVICE) {
        mWorkerHandler.post(() -> {
            if (isInMinimalDeviceMode()) {
                reloadLauncherInMinimalMode(context);
            } else {
                reloadLauncherInNormalMode(context);
@@ -253,31 +251,30 @@ public final class WellbeingModel {
                .authority(mWellbeingProviderPkg + ".api");
    }

    /**
     * Fetch most up-to-date minimal device config.
     */
    @WorkerThread
    private void runWithMinimalDeviceConfigs(Consumer<Bundle> consumer) {
    private boolean isInMinimalDeviceMode() {
        if (!FeatureFlags.ENABLE_MINIMAL_DEVICE.get()) {
            return;
            return false;
        }
        if (DEBUG || mIsInTest) {
            Log.d(TAG, "runWithMinimalDeviceConfigs() called");
            Log.d(TAG, "isInMinimalDeviceMode() called");
        }
        Preconditions.assertNonUiThread();

        final Uri contentUri = apiBuilder().build();
        final Bundle remoteBundle;
        try (ContentProviderClient client = mContext.getContentResolver()
                .acquireUnstableContentProviderClient(contentUri)) {
            remoteBundle = client.call(
            final Bundle remoteBundle = client == null ? null : client.call(
                    METHOD_GET_MINIMAL_DEVICE_CONFIG, null /* args */, null /* extras */);
            consumer.accept(remoteBundle);
            return remoteBundle != null
                    && remoteBundle.getInt(EXTRA_MINIMAL_DEVICE_STATE,
                    UNKNOWN_MINIMAL_DEVICE_STATE) == IN_MINIMAL_DEVICE;
        } catch (Exception e) {
            Log.e(TAG, "Failed to retrieve data from " + contentUri + ": " + e);
            if (mIsInTest) throw new RuntimeException(e);
        }
        if (DEBUG || mIsInTest) Log.i(TAG, "runWithMinimalDeviceConfigs(): finished");
        if (DEBUG || mIsInTest) Log.i(TAG, "isInMinimalDeviceMode(): finished");
        return false;
    }

    private boolean updateActions(String... packageNames) {
+2 −0
Original line number Diff line number Diff line
@@ -170,6 +170,8 @@ public class NavBarToHomeTouchController implements TouchController,
            if (ENABLE_QUICKSTEP_LIVE_TILE.get()) {
                builder.addOnFrameCallback(recentsView::redrawLiveTile);
            }

            AbstractFloatingView.closeOpenContainer(mLauncher, AbstractFloatingView.TYPE_TASK_MENU);
        } else if (mStartState == ALL_APPS) {
            AllAppsTransitionController allAppsController = mLauncher.getAllAppsController();
            builder.setFloat(allAppsController, ALL_APPS_PROGRESS,
+1 −1
Original line number Diff line number Diff line
@@ -246,7 +246,7 @@ public class TaskMenuView extends AbstractFloatingView {
        setScaleX(taskView.getScaleX());
        setScaleY(taskView.getScaleY());
        boolean canActivityRotate = taskView.getRecentsView()
            .mOrientationState.canRecentsActivityRotate();
            .mOrientationState.isRecentsActivityRotationAllowed();
        mOptionLayout.setOrientation(orientationHandler
                .getTaskMenuLayoutOrientation(canActivityRotate, mOptionLayout));
        setPosition(sTempRect.left - insets.left, sTempRect.top - insets.top,
+6 −0
Original line number Diff line number Diff line
@@ -201,6 +201,12 @@ public class TaplTestsQuickstep extends AbstractQuickStepTest {
    @PortraitLandscape
    public void testOverviewActions() throws Exception {
        if (mLauncher.getNavigationModel() != NavigationModel.TWO_BUTTON) {
            // Experimenting for b/165029151:
            final Overview overview = mLauncher.pressHome().switchToOverview();
            if (overview.hasTasks()) overview.dismissAllTasks();
            mLauncher.pressHome();
            //

            startTestAppsWithCheck();
            OverviewActions actionsView =
                    mLauncher.pressHome().switchToOverview().getOverviewActions();
+2 −2
Original line number Diff line number Diff line
@@ -177,8 +177,8 @@ public final class FeatureFlags {
            "SEPARATE_RECENTS_ACTIVITY", false,
            "Uses a separate recents activity instead of using the integrated recents+Launcher UI");

    public static final BooleanFlag ENABLE_MINIMAL_DEVICE = new DeviceFlag(
            "ENABLE_MINIMAL_DEVICE", false,
    public static final BooleanFlag ENABLE_MINIMAL_DEVICE = getDebugFlag(
            "ENABLE_MINIMAL_DEVICE", true,
            "Allow user to toggle minimal device mode in launcher.");

    public static void initialize(Context context) {
Loading