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

Commit 117b6952 authored by Adam Powell's avatar Adam Powell
Browse files

onWindowDismissed API cleanup

Move the window swipe to dismiss plumbing off of Window.Callback into
its own internal interface implemented by Activity and Dialog. Make it
internal API instead of public. Apps should control this via the
window feature setting.

Change-Id: I64cd237fa7eab08719b2c34e31dac7d34f02563a
parent e88097bd
Loading
Loading
Loading
Loading
+0 −4
Original line number Diff line number Diff line
@@ -2855,7 +2855,6 @@ package android.app {
    method public void onUserInteraction();
    method protected void onUserLeaveHint();
    method public void onWindowAttributesChanged(android.view.WindowManager.LayoutParams);
    method public void onWindowDismissed();
    method public void onWindowFocusChanged(boolean);
    method public android.view.ActionMode onWindowStartingActionMode(android.view.ActionMode.Callback);
    method public void openContextMenu(android.view.View);
@@ -3372,7 +3371,6 @@ package android.app {
    method public boolean onTouchEvent(android.view.MotionEvent);
    method public boolean onTrackballEvent(android.view.MotionEvent);
    method public void onWindowAttributesChanged(android.view.WindowManager.LayoutParams);
    method public void onWindowDismissed();
    method public void onWindowFocusChanged(boolean);
    method public android.view.ActionMode onWindowStartingActionMode(android.view.ActionMode.Callback);
    method public void openContextMenu(android.view.View);
@@ -22912,7 +22910,6 @@ package android.service.dreams {
    method public boolean onPreparePanel(int, android.view.View, android.view.Menu);
    method public boolean onSearchRequested();
    method public void onWindowAttributesChanged(android.view.WindowManager.LayoutParams);
    method public void onWindowDismissed();
    method public void onWindowFocusChanged(boolean);
    method public android.view.ActionMode onWindowStartingActionMode(android.view.ActionMode.Callback);
    method public void setContentView(int);
@@ -28920,7 +28917,6 @@ package android.view {
    method public abstract boolean onPreparePanel(int, android.view.View, android.view.Menu);
    method public abstract boolean onSearchRequested();
    method public abstract void onWindowAttributesChanged(android.view.WindowManager.LayoutParams);
    method public abstract void onWindowDismissed();
    method public abstract void onWindowFocusChanged(boolean);
    method public abstract android.view.ActionMode onWindowStartingActionMode(android.view.ActionMode.Callback);
  }
+5 −1
Original line number Diff line number Diff line
@@ -645,7 +645,8 @@ import java.util.HashMap;
public class Activity extends ContextThemeWrapper
        implements LayoutInflater.Factory2,
        Window.Callback, KeyEvent.Callback,
        OnCreateContextMenuListener, ComponentCallbacks2 {
        OnCreateContextMenuListener, ComponentCallbacks2,
        Window.OnWindowDismissedCallback {
    private static final String TAG = "Activity";
    private static final boolean DEBUG_LIFECYCLE = false;

@@ -2405,7 +2406,9 @@ public class Activity extends ContextThemeWrapper

    /**
     * Called when the main window associated with the activity has been dismissed.
     * @hide
     */
    @Override
    public void onWindowDismissed() {
        finish();
    }
@@ -5196,6 +5199,7 @@ public class Activity extends ContextThemeWrapper
        
        mWindow = PolicyManager.makeNewWindow(this);
        mWindow.setCallback(this);
        mWindow.setOnWindowDismissedCallback(this);
        mWindow.getLayoutInflater().setPrivateFactory(this);
        if (info.softInputMode != WindowManager.LayoutParams.SOFT_INPUT_STATE_UNSPECIFIED) {
            mWindow.setSoftInputMode(info.softInputMode);
+4 −1
Original line number Diff line number Diff line
@@ -80,7 +80,7 @@ import java.lang.ref.WeakReference;
 * </div>
 */
public class Dialog implements DialogInterface, Window.Callback,
        KeyEvent.Callback, OnCreateContextMenuListener {
        KeyEvent.Callback, OnCreateContextMenuListener, Window.OnWindowDismissedCallback {
    private static final String TAG = "Dialog";
    private Activity mOwnerActivity;
    
@@ -166,6 +166,7 @@ public class Dialog implements DialogInterface, Window.Callback,
        Window w = PolicyManager.makeNewWindow(mContext);
        mWindow = w;
        w.setCallback(this);
        w.setOnWindowDismissedCallback(this);
        w.setWindowManager(mWindowManager, null, null);
        w.setGravity(Gravity.CENTER);
        mListenersHandler = new ListenersHandler(this);
@@ -696,6 +697,8 @@ public class Dialog implements DialogInterface, Window.Callback,
    public void onDetachedFromWindow() {
    }

    /** @hide */
    @Override
    public void onWindowDismissed() {
        dismiss();
    }
+0 −4
Original line number Diff line number Diff line
@@ -300,10 +300,6 @@ public class DreamService extends Service implements Window.Callback {
    public void onDetachedFromWindow() {
    }

    @Override
    public void onWindowDismissed() {
    }

    /** {@inheritDoc} */
    @Override
    public void onPanelClosed(int featureId, Menu menu) {
+16 −0
Original line number Diff line number Diff line
@@ -134,6 +134,7 @@ public abstract class Window {
    
    private TypedArray mWindowStyle;
    private Callback mCallback;
    private OnWindowDismissedCallback mOnWindowDismissedCallback;
    private WindowManager mWindowManager;
    private IBinder mAppToken;
    private String mAppName;
@@ -390,7 +391,10 @@ public abstract class Window {
         * @param mode The mode that was just finished.
         */
        public void onActionModeFinished(ActionMode mode);
    }

    /** @hide */
    public interface OnWindowDismissedCallback {
        /**
         * Called when a window is dismissed. This informs the callback that the
         * window is gone, and it should finish itself.
@@ -571,6 +575,18 @@ public abstract class Window {
        return mCallback;
    }

    /** @hide */
    public final void setOnWindowDismissedCallback(OnWindowDismissedCallback dcb) {
        mOnWindowDismissedCallback = dcb;
    }

    /** @hide */
    public final void dispatchOnWindowDismissed() {
        if (mOnWindowDismissedCallback != null) {
            mOnWindowDismissedCallback.onWindowDismissed();
        }
    }

    /**
     * Take ownership of this window's surface.  The window's view hierarchy
     * will no longer draw into the surface, though it will otherwise continue
Loading