summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Powell <adamp@google.com>2014-05-06 20:20:40 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2014-05-06 20:20:40 +0000
commitc41fa708271e204a7983aba291389ea1554227b2 (patch)
tree0ce242e8e6dc02b74c6c919fd00a34ae14c42f4d
parentf7330ac754d02089dedef5d7191bde9a75b91c2c (diff)
parenta0516e7ad12a647cc40fb5651e8d14cd39571c7a (diff)
downloadframeworks_base-c41fa708271e204a7983aba291389ea1554227b2.zip
frameworks_base-c41fa708271e204a7983aba291389ea1554227b2.tar.gz
frameworks_base-c41fa708271e204a7983aba291389ea1554227b2.tar.bz2
am a0516e7a: Merge "onWindowDismissed API cleanup" into klp-modular-dev
* commit 'a0516e7ad12a647cc40fb5651e8d14cd39571c7a': 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 fcb6005..3edc121 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -2854,7 +2854,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);
@@ -3371,7 +3370,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);
@@ -22756,7 +22754,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);
@@ -28760,7 +28757,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 63c9fec..e8b3bb9 100644
--- a/core/java/android/app/Activity.java
+++ b/core/java/android/app/Activity.java
@@ -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);
diff --git a/core/java/android/app/Dialog.java b/core/java/android/app/Dialog.java
index a8277b5..7a362df 100644
--- a/core/java/android/app/Dialog.java
+++ b/core/java/android/app/Dialog.java
@@ -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();
}
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 c450f3c..59d8fbc 100644
--- a/core/java/android/view/Window.java
+++ b/core/java/android/view/Window.java
@@ -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
diff --git a/policy/src/com/android/internal/policy/impl/PhoneWindow.java b/policy/src/com/android/internal/policy/impl/PhoneWindow.java
index fb4466d..78020e9 100644
--- a/policy/src/com/android/internal/policy/impl/PhoneWindow.java
+++ b/policy/src/com/android/internal/policy/impl/PhoneWindow.java
@@ -3429,15 +3429,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(