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

Commit 18dd2008 authored by Brian Isganitis's avatar Brian Isganitis Committed by Android (Google) Code Review
Browse files

Merge "Launch Taskbar All Apps with Meta key when it's available." into udc-qpr-dev

parents 8648f5f7 a8ad7e44
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -335,6 +335,11 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
        mControllers.taskbarStashController.showTaskbarFromBroadcast();
    }

    /** Toggles Taskbar All Apps overlay. */
    public void toggleAllApps() {
        mControllers.taskbarAllAppsController.toggle();
    }

    @Override
    public DeviceProfile getDeviceProfile() {
        return mDeviceProfile;
+20 −0
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@ import static android.view.WindowManager.LayoutParams.TYPE_NAVIGATION_BAR_PANEL;

import static com.android.launcher3.LauncherPrefs.TASKBAR_PINNING;
import static com.android.launcher3.LauncherPrefs.TASKBAR_PINNING_KEY;
import static com.android.launcher3.LauncherState.OVERVIEW;
import static com.android.launcher3.util.DisplayController.TASKBAR_NOT_DESTROYED_TAG;
import static com.android.launcher3.util.Executors.UI_HELPER_EXECUTOR;
import static com.android.launcher3.util.FlagDebugUtils.formatFlagChange;
@@ -270,6 +271,25 @@ public class TaskbarManager {
        }
    }

    /**
     * Toggles All Apps for Taskbar or Launcher depending on the current state.
     *
     * @param homeAllAppsIntent Intent used if Taskbar is not enabled or Launcher is resumed.
     */
    public void toggleAllApps(Intent homeAllAppsIntent) {
        if (mTaskbarActivityContext == null) {
            mContext.startActivity(homeAllAppsIntent);
            return;
        }

        if (mActivity != null && mActivity.isResumed() && !mActivity.isInState(OVERVIEW)) {
            mContext.startActivity(homeAllAppsIntent);
            return;
        }

        mTaskbarActivityContext.toggleAllApps();
    }

    /**
     * Displays a frame of the first Launcher reveal animation.
     *
+32 −9
Original line number Diff line number Diff line
@@ -56,6 +56,8 @@ import android.annotation.TargetApi;
import android.app.PendingIntent;
import android.app.RemoteAction;
import android.app.Service;
import android.content.IIntentReceiver;
import android.content.IIntentSender;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.res.Configuration;
@@ -571,15 +573,7 @@ public class TouchInteractionService extends Service {
        AccessibilityManager am = getSystemService(AccessibilityManager.class);

        if (isHomeAndOverviewSame) {
            Intent intent = new Intent(mOverviewComponentObserver.getHomeIntent())
                    .setAction(INTENT_ACTION_ALL_APPS_TOGGLE);
            RemoteAction allAppsAction = new RemoteAction(
                    Icon.createWithResource(this, R.drawable.ic_apps),
                    getString(R.string.all_apps_label),
                    getString(R.string.all_apps_label),
                    PendingIntent.getActivity(this, GLOBAL_ACTION_ACCESSIBILITY_ALL_APPS, intent,
                            PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_IMMUTABLE));
            am.registerSystemAction(allAppsAction, GLOBAL_ACTION_ACCESSIBILITY_ALL_APPS);
            am.registerSystemAction(createAllAppsAction(), GLOBAL_ACTION_ACCESSIBILITY_ALL_APPS);
        } else {
            am.unregisterSystemAction(GLOBAL_ACTION_ACCESSIBILITY_ALL_APPS);
        }
@@ -592,6 +586,35 @@ public class TouchInteractionService extends Service {
        mTISBinder.onOverviewTargetChange();
    }

    private RemoteAction createAllAppsAction() {
        final Intent homeIntent = new Intent(mOverviewComponentObserver.getHomeIntent())
                .setAction(INTENT_ACTION_ALL_APPS_TOGGLE);
        final PendingIntent actionPendingIntent;

        if (FeatureFlags.ENABLE_ALL_APPS_SEARCH_IN_TASKBAR.get()) {
            actionPendingIntent = new PendingIntent(new IIntentSender.Stub() {
                @Override
                public void send(int code, Intent intent, String resolvedType,
                        IBinder allowlistToken, IIntentReceiver finishedReceiver,
                        String requiredPermission, Bundle options) {
                    MAIN_EXECUTOR.execute(() -> mTaskbarManager.toggleAllApps(homeIntent));
                }
            });
        } else {
            actionPendingIntent = PendingIntent.getActivity(
                    this,
                    GLOBAL_ACTION_ACCESSIBILITY_ALL_APPS,
                    homeIntent,
                    PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_IMMUTABLE);
        }

        return new RemoteAction(
                Icon.createWithResource(this, R.drawable.ic_apps),
                getString(R.string.all_apps_label),
                getString(R.string.all_apps_label),
                actionPendingIntent);
    }

    @UiThread
    private void onSystemUiFlagsChanged(int lastSysUIFlags) {
        if (LockedUserState.get(this).isUserUnlocked()) {