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

Commit d1d0fb86 authored by Jagrut Desai's avatar Jagrut Desai Committed by Android (Google) Code Review
Browse files

Merge "Taskbar System Action with Broadcast Receiver." into tm-qpr-dev

parents e008411f d2140ba4
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -263,6 +263,13 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
        }
    }

    /**
     * Show Taskbar upon receiving broadcast
     */
    public void showTaskbarFromBroadcast() {
        mControllers.taskbarStashController.showTaskbarFromBroadcast();
    }

    @Override
    public DeviceProfile getDeviceProfile() {
        return mDeviceProfile;
+2 −1
Original line number Diff line number Diff line
@@ -154,7 +154,7 @@ public class TaskbarControllers {
        taskbarKeyguardController.init(navbarButtonsViewController);
        taskbarSpringOnStashController.init(this);
        stashedHandleViewController.init(this);
        taskbarStashController.init(this, sharedState.setupUIVisible);
        taskbarStashController.init(this, sharedState.setupUIVisible, mSharedState);
        taskbarEduController.init(this);
        taskbarPopupController.init(this);
        taskbarForceVisibleImmersiveController.init(this);
@@ -225,6 +225,7 @@ public class TaskbarControllers {
        voiceInteractionWindowController.onDestroy();
        taskbarRecentAppsController.onDestroy();
        keyboardQuickSwitchController.onDestroy();
        taskbarStashController.onDestroy();

        mControllersToLog = null;
        mBackgroundRendererControllers = null;
+2 −1
Original line number Diff line number Diff line
@@ -62,7 +62,8 @@ class TaskbarEduTooltipController(val activityContext: TaskbarActivityContext) :
        get() = !Utilities.isRunningInTestHarness() && ENABLE_TASKBAR_EDU_TOOLTIP.get()
    private val isOpen: Boolean
        get() = tooltip?.isOpen ?: false

    val isBeforeTooltipFeaturesStep: Boolean
        get() = isTooltipEnabled && tooltipStep <= TOOLTIP_STEP_FEATURES
    private lateinit var controllers: TaskbarControllers

    @TaskbarEduTooltipStep
+38 −1
Original line number Diff line number Diff line
@@ -15,17 +15,22 @@
 */
package com.android.launcher3.taskbar;

import static android.content.Context.RECEIVER_NOT_EXPORTED;
import static android.content.pm.PackageManager.FEATURE_PC;
import static android.view.Display.DEFAULT_DISPLAY;
import static android.view.WindowManager.LayoutParams.TYPE_NAVIGATION_BAR_PANEL;

import static com.android.launcher3.util.DisplayController.CHANGE_DENSITY;
import static com.android.launcher3.util.DisplayController.CHANGE_NAVIGATION_MODE;
import static com.android.launcher3.util.Executors.UI_HELPER_EXECUTOR;
import static com.android.launcher3.util.FlagDebugUtils.formatFlagChange;

import android.annotation.SuppressLint;
import android.app.PendingIntent;
import android.content.ComponentCallbacks;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.pm.ActivityInfo;
import android.content.res.Configuration;
import android.hardware.display.DisplayManager;
@@ -116,6 +121,17 @@ public class TaskbarManager {

    private boolean mUserUnlocked = false;

    public static final int SYSTEM_ACTION_ID_TASKBAR = 499;

    /**
     * For Taskbar broadcast intent filter.
     */
    public static final String ACTION_SHOW_TASKBAR = "ACTION_SHOW_TASKBAR";

    private final SimpleBroadcastReceiver mTaskbarBroadcastReceiver =
            new SimpleBroadcastReceiver(this::showTaskbarFromBroadcast);

    @SuppressLint("WrongConstant")
    public TaskbarManager(TouchInteractionService service) {
        mDisplayController = DisplayController.INSTANCE.get(service);
        Display display =
@@ -200,7 +216,17 @@ public class TaskbarManager {
                mNavBarKidsModeListener);
        mContext.registerComponentCallbacks(mComponentCallbacks);
        mShutdownReceiver.register(mContext, Intent.ACTION_SHUTDOWN);

        UI_HELPER_EXECUTOR.execute(() -> {
            mSharedState.taskbarSystemActionPendingIntent = PendingIntent.getBroadcast(
                    mContext,
                    SYSTEM_ACTION_ID_TASKBAR,
                    new Intent(ACTION_SHOW_TASKBAR).setPackage(mContext.getPackageName()),
                    PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_IMMUTABLE);
            mContext.registerReceiver(
                    mTaskbarBroadcastReceiver,
                    new IntentFilter(ACTION_SHOW_TASKBAR),
                    RECEIVER_NOT_EXPORTED);
        });
        recreateTaskbar();
    }

@@ -213,6 +239,15 @@ public class TaskbarManager {
        }
    }

    /**
     * Show Taskbar upon receiving broadcast
     */
    private void showTaskbarFromBroadcast(Intent intent) {
        if (ACTION_SHOW_TASKBAR.equals(intent.getAction()) && mTaskbarActivityContext != null) {
            mTaskbarActivityContext.showTaskbarFromBroadcast();
        }
    }

    /**
     * Displays a frame of the first Launcher reveal animation.
     *
@@ -405,6 +440,8 @@ public class TaskbarManager {
     * Called when the manager is no longer needed
     */
    public void destroy() {
        UI_HELPER_EXECUTOR.execute(
                () -> mTaskbarBroadcastReceiver.unregisterReceiverSafely(mContext));
        destroyExistingTaskbar();
        mDisplayController.removeChangeListener(mDispInfoChangeListener);
        SettingsCache.INSTANCE.get(mContext).unregister(USER_SETUP_COMPLETE_URI,
+5 −0
Original line number Diff line number Diff line
@@ -17,6 +17,8 @@ package com.android.launcher3.taskbar;

import static com.android.launcher3.taskbar.LauncherTaskbarUIController.DISPLAY_PROGRESS_COUNT;

import android.app.PendingIntent;

/**
 * State shared across different taskbar instance
 */
@@ -43,4 +45,7 @@ public class TaskbarSharedState {

    // LauncherTaskbarUIController#mTaskbarInAppDisplayProgressMultiProp
    public float[] inAppDisplayProgressMultiPropValues = new float[DISPLAY_PROGRESS_COUNT];

    // Taskbar System Action
    public PendingIntent taskbarSystemActionPendingIntent;
}
Loading