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

Commit b13bd0e9 authored by Matt Casey's avatar Matt Casey Committed by Android (Google) Code Review
Browse files

Merge changes I93d05034,Ic052133c into rvc-dev

* changes:
  Hide bubbles' IME after screenshot is taken.
  Add a public method to BubbleController to hide the IME.
parents 15f86c34 d56eaf68
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -406,6 +406,10 @@
        <receiver android:name=".screenshot.GlobalScreenshot$SmartActionsReceiver"
                  android:exported="false"/>

        <!-- Callback for performing sysui cleanup after screenshot has been taken. -->
        <receiver android:name=".screenshot.GlobalScreenshot$ScreenshotTakenReceiver"
                  android:exported="false"/>

        <!-- started from UsbDeviceSettingsManager -->
        <activity android:name=".usb.UsbConfirmActivity"
            android:exported="true"
+10 −0
Original line number Diff line number Diff line
@@ -419,6 +419,16 @@ public class BubbleController implements ConfigurationController.ConfigurationLi
        mCallbacks.add(callback);
    }

    /**
     * Dispatches a back press into the expanded Bubble's ActivityView if its IME is visible,
     * causing it to hide.
     */
    public void hideImeFromExpandedBubble() {
        if (mStackView != null) {
            mStackView.hideImeFromExpandedBubble();
        }
    }

    private void setupNEM() {
        mNotificationEntryManager.addNotificationEntryListener(
                new NotificationEntryListener() {
+9 −5
Original line number Diff line number Diff line
@@ -1690,6 +1690,14 @@ public class BubbleStackView extends FrameLayout
        }
    }

    void hideImeFromExpandedBubble() {
        if (mExpandedBubble != null && mExpandedBubble.getExpandedView() != null) {
            // Hide the currently expanded bubble's IME if it's visible before switching to a new
            // bubble.
            mExpandedBubble.getExpandedView().hideImeIfVisible();
        }
    }

    private void beforeExpandedViewAnimation() {
        mIsExpansionAnimating = true;
        hideFlyoutImmediate();
@@ -2405,11 +2413,7 @@ public class BubbleStackView extends FrameLayout
            Log.d(TAG, "updateExpandedBubble()");
        }

        if (mExpandedBubble != null && mExpandedBubble.getExpandedView() != null) {
            // Hide the currently expanded bubble's IME if it's visible before switching to a new
            // bubble.
            mExpandedBubble.getExpandedView().hideImeIfVisible();
        }
        hideImeFromExpandedBubble();

        mExpandedViewContainer.removeAllViews();
        if (mIsExpanded && mExpandedBubble != null
+19 −0
Original line number Diff line number Diff line
@@ -83,6 +83,7 @@ import android.widget.Toast;

import com.android.internal.logging.UiEventLogger;
import com.android.systemui.R;
import com.android.systemui.bubbles.BubbleController;
import com.android.systemui.dagger.qualifiers.Main;
import com.android.systemui.shared.system.ActivityManagerWrapper;
import com.android.systemui.statusbar.phone.StatusBar;
@@ -483,6 +484,8 @@ public class GlobalScreenshot implements ViewTreeObserver.OnComputeInternalInset
            return;
        }

        mContext.sendBroadcast(new Intent(mContext, ScreenshotTakenReceiver.class));

        // Optimizations
        mScreenBitmap.setHasAlpha(false);
        mScreenBitmap.prepareToDraw();
@@ -1089,4 +1092,20 @@ public class GlobalScreenshot implements ViewTreeObserver.OnComputeInternalInset
                    context, intent.getStringExtra(EXTRA_ID), actionType, true);
        }
    }

    /**
     * Called when a screenshot has been taken and animation / screenshot UI is about to begin.
     */
    public static class ScreenshotTakenReceiver extends BroadcastReceiver {
        private final Lazy<BubbleController> mBubbleController;

        public ScreenshotTakenReceiver(Lazy<BubbleController> bubbleController) {
            mBubbleController = bubbleController;
        }

        @Override
        public void onReceive(Context context, Intent intent) {
            mBubbleController.get().hideImeFromExpandedBubble();
        }
    }
}