summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Powell <adamp@google.com>2014-05-06 20:24:23 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2014-05-06 20:24:23 +0000
commit5f97930fc5dd44fcf1864acd53401c00b4de3a24 (patch)
treea47f927897e43f49a977c9786d30a500bb94d0dc
parent55d47f6be8ba5aab8d9d9cc19e3549c354f08e4f (diff)
parentc41fa708271e204a7983aba291389ea1554227b2 (diff)
downloadframeworks_base-5f97930fc5dd44fcf1864acd53401c00b4de3a24.zip
frameworks_base-5f97930fc5dd44fcf1864acd53401c00b4de3a24.tar.gz
frameworks_base-5f97930fc5dd44fcf1864acd53401c00b4de3a24.tar.bz2
am c41fa708: am a0516e7a: Merge "onWindowDismissed API cleanup" into klp-modular-dev
* commit 'c41fa708271e204a7983aba291389ea1554227b2': onWindowDismissed API cleanup
-rw-r--r--api/current.txt4
-rw-r--r--core/java/android/app/Activity.java6
-rw-r--r--core/java/android/app/Dialog.java5
-rw-r--r--core/java/android/service/dreams/DreamService.java4
-rw-r--r--core/java/android/view/Window.java16
-rw-r--r--policy/src/com/android/internal/policy/impl/PhoneWindow.java10
6 files changed, 26 insertions, 19 deletions
diff --git a/api/current.txt b/api/current.txt
index 9acf72a..a711896 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -3306,7 +3306,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);
@@ -3862,7 +3861,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);
@@ -25032,7 +25030,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);
@@ -31551,7 +31548,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);
}
diff --git a/core/java/android/app/Activity.java b/core/java/android/app/Activity.java
index 5ec3117..af3a92c 100644
--- a/core/java/android/app/Activity.java
+++ b/core/java/android/app/Activity.java
@@ -655,7 +655,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;
@@ -2519,7 +2520,9 @@ public class Activity extends ContextThemeWrapper
/**
* Called when the main window associated with the activity has been dismissed.
+ * @hide
*/
+ @Override
public void onWindowDismissed() {
finish();
}
@@ -5437,6 +5440,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);
diff --git a/core/java/android/app/Dialog.java b/core/java/android/app/Dialog.java
index 07583fd..12d4513 100644
--- a/core/java/android/app/Dialog.java
+++ b/core/java/android/app/Dialog.java
@@ -79,7 +79,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;
@@ -165,6 +165,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);
@@ -708,6 +709,8 @@ public class Dialog implements DialogInterface, Window.Callback,
public void onDetachedFromWindow() {
}
+ /** @hide */
+ @Override
public void onWindowDismissed() {
dismiss();
}
diff --git a/core/java/android/service/dreams/DreamService.java b/core/java/android/service/dreams/DreamService.java
index 2303d65..b02a79d 100644
--- a/core/java/android/service/dreams/DreamService.java
+++ b/core/java/android/service/dreams/DreamService.java
@@ -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) {
diff --git a/core/java/android/view/Window.java b/core/java/android/view/Window.java
index 9c44bd1..375f5e3 100644
--- a/core/java/android/view/Window.java
+++ b/core/java/android/view/Window.java
@@ -147,6 +147,7 @@ public abstract class Window {
private TypedArray mWindowStyle;
private Callback mCallback;
+ private OnWindowDismissedCallback mOnWindowDismissedCallback;
private WindowManager mWindowManager;
private IBinder mAppToken;
private String mAppName;
@@ -405,7 +406,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.
@@ -586,6 +590,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
diff --git a/policy/src/com/android/internal/policy/impl/PhoneWindow.java b/policy/src/com/android/internal/policy/impl/PhoneWindow.java
index 50e2a2e..b1fea03 100644
--- a/policy/src/com/android/internal/policy/impl/PhoneWindow.java
+++ b/policy/src/com/android/internal/policy/impl/PhoneWindow.java
@@ -3560,15 +3560,7 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback {
swipeDismiss.setOnDismissedListener(new SwipeDismissLayout.OnDismissedListener() {
@Override
public void onDismissed(SwipeDismissLayout layout) {
- Callback cb = getCallback();
- if (cb != null) {
- try {
- cb.onWindowDismissed();
- } catch (AbstractMethodError e) {
- Log.e(TAG, "onWindowDismissed not implemented in " +
- cb.getClass().getSimpleName(), e);
- }
- }
+ dispatchOnWindowDismissed();
}
});
swipeDismiss.setOnSwipeProgressChangedListener(