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

Commit 317ee507 authored by Winson Chung's avatar Winson Chung
Browse files

Revert "Nav icons and quick step states are determined by service enabled"

This reverts commit 8a7c97a1.

Reason for revert: b/77566214

Bug: 77566214

Change-Id: Iba3ef20a304e3a47f1affe0b38598c7d7f0daef7
parent 8a7c97a1
Loading
Loading
Loading
Loading
+4 −31
Original line number Diff line number Diff line
@@ -22,7 +22,6 @@ import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.ServiceConnection;
import android.content.pm.PackageManager;
import android.graphics.Rect;
import android.os.Binder;
import android.os.Handler;
@@ -40,7 +39,6 @@ import com.android.systemui.recents.events.activity.DockedFirstAnimationFrameEve
import com.android.systemui.recents.misc.SystemServicesProxy;
import com.android.systemui.shared.recents.IOverviewProxy;
import com.android.systemui.shared.recents.ISystemUiProxy;
import com.android.systemui.shared.system.ActivityManagerWrapper;
import com.android.systemui.shared.system.GraphicBufferCompat;
import com.android.systemui.statusbar.phone.StatusBar;
import com.android.systemui.statusbar.policy.CallbackController;
@@ -73,13 +71,11 @@ public class OverviewProxyService implements CallbackController<OverviewProxyLis
    private final DeviceProvisionedController mDeviceProvisionedController
            = Dependency.get(DeviceProvisionedController.class);
    private final List<OverviewProxyListener> mConnectionCallbacks = new ArrayList<>();
    private final Intent mQuickStepIntent;

    private IOverviewProxy mOverviewProxy;
    private int mConnectionBackoffAttempts;
    private CharSequence mOnboardingText;
    private @InteractionType int mInteractionFlags;
    private boolean mIsEnabled;

    private ISystemUiProxy mSysUiProxy = new ISystemUiProxy.Stub() {

@@ -134,23 +130,14 @@ public class OverviewProxyService implements CallbackController<OverviewProxyLis
                    });
                }
            } finally {
                Prefs.putInt(mContext, Prefs.Key.QUICK_STEP_INTERACTION_FLAGS, mInteractionFlags);
                Binder.restoreCallingIdentity(token);
            }
        }
    };

    private final BroadcastReceiver mLauncherStateChangedReceiver = new BroadcastReceiver() {
    private final BroadcastReceiver mLauncherAddedReceiver = new BroadcastReceiver() {
        @Override
        public void onReceive(Context context, Intent intent) {
            updateEnabledState();

            // When launcher service is disabled, reset interaction flags because it is inactive
            if (!isEnabled()) {
                mInteractionFlags = 0;
                Prefs.remove(mContext, Prefs.Key.QUICK_STEP_INTERACTION_FLAGS);
            }

            // Reconnect immediately, instead of waiting for resume to arrive.
            startConnectionToCurrentUser();
        }
@@ -209,21 +196,17 @@ public class OverviewProxyService implements CallbackController<OverviewProxyLis
        mConnectionBackoffAttempts = 0;
        mRecentsComponentName = ComponentName.unflattenFromString(context.getString(
                com.android.internal.R.string.config_recentsComponentName));
        mQuickStepIntent = new Intent(ACTION_QUICKSTEP)
                .setPackage(mRecentsComponentName.getPackageName());
        mInteractionFlags = Prefs.getInt(mContext, Prefs.Key.QUICK_STEP_INTERACTION_FLAGS, 0);

        // Listen for the package update changes.
        if (SystemServicesProxy.getInstance(context)
                .isSystemUser(mDeviceProvisionedController.getCurrentUser())) {
            updateEnabledState();
            mDeviceProvisionedController.addCallback(mDeviceProvisionedCallback);
            IntentFilter filter = new IntentFilter(Intent.ACTION_PACKAGE_ADDED);
            filter.addDataScheme("package");
            filter.addDataSchemeSpecificPart(mRecentsComponentName.getPackageName(),
                    PatternMatcher.PATTERN_LITERAL);
            filter.addAction(Intent.ACTION_PACKAGE_CHANGED);
            mContext.registerReceiver(mLauncherStateChangedReceiver, filter);
            mContext.registerReceiver(mLauncherAddedReceiver, filter);
        }
    }

@@ -239,7 +222,7 @@ public class OverviewProxyService implements CallbackController<OverviewProxyLis
        disconnectFromLauncherService();

        // If user has not setup yet or already connected, do not try to connect
        if (!mDeviceProvisionedController.isCurrentUserSetup() || !isEnabled()) {
        if (!mDeviceProvisionedController.isCurrentUserSetup()) {
            return;
        }
        mHandler.removeCallbacks(mConnectionRunnable);
@@ -265,7 +248,6 @@ public class OverviewProxyService implements CallbackController<OverviewProxyLis
    public void addCallback(OverviewProxyListener listener) {
        mConnectionCallbacks.add(listener);
        listener.onConnectionChanged(mOverviewProxy != null);
        listener.onInteractionFlagsChanged(mInteractionFlags);
    }

    @Override
@@ -274,11 +256,7 @@ public class OverviewProxyService implements CallbackController<OverviewProxyLis
    }

    public boolean shouldShowSwipeUpUI() {
        return isEnabled() && ((mInteractionFlags & FLAG_DISABLE_SWIPE_UP) == 0);
    }

    public boolean isEnabled() {
        return mIsEnabled;
        return getProxy() != null && ((mInteractionFlags & FLAG_DISABLE_SWIPE_UP) == 0);
    }

    public IOverviewProxy getProxy() {
@@ -314,11 +292,6 @@ public class OverviewProxyService implements CallbackController<OverviewProxyLis
        }
    }

    private void updateEnabledState() {
        mIsEnabled = mContext.getPackageManager().resolveServiceAsUser(mQuickStepIntent, 0,
                ActivityManagerWrapper.getInstance().getCurrentUserId()) != null;
    }

    @Override
    public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
        pw.println(TAG_OPS + " state:");
+1 −3
Original line number Diff line number Diff line
@@ -54,8 +54,7 @@ public final class Prefs {
            Key.HAS_SEEN_RECENTS_ONBOARDING,
            Key.SEEN_RINGER_GUIDANCE_COUNT,
            Key.QS_HAS_TURNED_OFF_MOBILE_DATA,
            Key.TOUCHED_RINGER_TOGGLE,
            Key.QUICK_STEP_INTERACTION_FLAGS
            Key.TOUCHED_RINGER_TOGGLE
    })
    public @interface Key {
        @Deprecated
@@ -94,7 +93,6 @@ public final class Prefs {
        String QS_TILE_SPECS_REVEALED = "QsTileSpecsRevealed";
        String QS_HAS_TURNED_OFF_MOBILE_DATA = "QsHasTurnedOffMobileData";
        String TOUCHED_RINGER_TOGGLE = "TouchedRingerToggle";
        String QUICK_STEP_INTERACTION_FLAGS = "QuickStepInteractionFlags";
    }

    public static boolean getBoolean(Context context, @Key String key, boolean defaultValue) {
+2 −2
Original line number Diff line number Diff line
@@ -126,7 +126,7 @@ public class RecentsImpl implements ActivityOptions.OnAnimationFinishedListener
        @Override
        public void onTaskStackChangedBackground() {
            // Skip background preloading recents in SystemUI if the overview services is bound
            if (Dependency.get(OverviewProxyService.class).isEnabled()) {
            if (Dependency.get(OverviewProxyService.class).getProxy() != null) {
                return;
            }

@@ -300,7 +300,7 @@ public class RecentsImpl implements ActivityOptions.OnAnimationFinishedListener

    public void onBootCompleted() {
        // Skip preloading tasks if we are already bound to the service
        if (Dependency.get(OverviewProxyService.class).isEnabled()) {
        if (Dependency.get(OverviewProxyService.class).getProxy() != null) {
            return;
        }

+2 −2
Original line number Diff line number Diff line
@@ -389,7 +389,7 @@ public class NavigationBarView extends FrameLayout implements PluginListener<Nav

    public boolean isQuickScrubEnabled() {
        return SystemProperties.getBoolean("persist.quickstep.scrub.enabled", true)
                && mOverviewProxyService.isEnabled() && isOverviewEnabled()
                && mOverviewProxyService.getProxy() != null && isOverviewEnabled()
                && ((mOverviewProxyService.getInteractionFlags() & FLAG_DISABLE_QUICK_SCRUB) == 0);
    }

@@ -587,7 +587,7 @@ public class NavigationBarView extends FrameLayout implements PluginListener<Nav
        // recents buttons when disconnected from launcher service in screen pinning mode,
        // as they are used for exiting.
        final boolean pinningActive = ActivityManagerWrapper.getInstance().isScreenPinningActive();
        if (mOverviewProxyService.isEnabled()) {
        if (mOverviewProxyService.getProxy() != null) {
            // Use interaction flags to show/hide navigation buttons but will be shown if required
            // to exit screen pinning.
            final int flags = mOverviewProxyService.getInteractionFlags();
+2 −2
Original line number Diff line number Diff line
@@ -168,8 +168,8 @@ public class QuickStepController implements GestureHelper {
    }

    private boolean handleTouchEvent(MotionEvent event) {
        if (mOverviewEventSender.getProxy() == null || (!mNavigationBarView.isQuickScrubEnabled()
                && !mNavigationBarView.isQuickStepSwipeUpEnabled())) {
        if (!mNavigationBarView.isQuickScrubEnabled()
                && !mNavigationBarView.isQuickStepSwipeUpEnabled()) {
            mNavigationBarView.getHomeButton().setDelayTouchFeedback(false /* delay */);
            return false;
        }
Loading