am 6918d9f9: Merge "Remove Dream windows immediately." into jb-mr1-dev
* commit '6918d9f970989f1e5ca5a03b04d10a4c890721e9': Remove Dream windows immediately.
This commit is contained in:
@@ -37,6 +37,7 @@ import android.view.View;
|
|||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.view.Window;
|
import android.view.Window;
|
||||||
import android.view.WindowManager;
|
import android.view.WindowManager;
|
||||||
|
import android.view.WindowManagerGlobal;
|
||||||
import android.view.WindowManager.LayoutParams;
|
import android.view.WindowManager.LayoutParams;
|
||||||
import android.view.accessibility.AccessibilityEvent;
|
import android.view.accessibility.AccessibilityEvent;
|
||||||
|
|
||||||
@@ -510,8 +511,12 @@ public class DreamService extends Service implements Window.Callback {
|
|||||||
@Override
|
@Override
|
||||||
public void onDestroy() {
|
public void onDestroy() {
|
||||||
if (mDebug) Slog.v(TAG, "onDestroy()");
|
if (mDebug) Slog.v(TAG, "onDestroy()");
|
||||||
super.onDestroy();
|
|
||||||
// hook for subclasses
|
// hook for subclasses
|
||||||
|
|
||||||
|
// Just in case destroy came in before detach, let's take care of that now
|
||||||
|
detach();
|
||||||
|
|
||||||
|
super.onDestroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
// end public api
|
// end public api
|
||||||
@@ -521,13 +526,13 @@ public class DreamService extends Service implements Window.Callback {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when the Dream is about to be unbound and destroyed.
|
* Called by DreamController.stopDream() when the Dream is about to be unbound and destroyed.
|
||||||
*
|
*
|
||||||
* Must run on mHandler.
|
* Must run on mHandler.
|
||||||
*/
|
*/
|
||||||
private final void detach() {
|
private final void detach() {
|
||||||
if (mWindow == null) {
|
if (mWindow == null) {
|
||||||
Slog.e(TAG, "detach() called when not attached");
|
// already detached!
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -540,7 +545,11 @@ public class DreamService extends Service implements Window.Callback {
|
|||||||
|
|
||||||
if (mDebug) Slog.v(TAG, "detach(): Removing window from window manager");
|
if (mDebug) Slog.v(TAG, "detach(): Removing window from window manager");
|
||||||
try {
|
try {
|
||||||
mWindowManager.removeView(mWindow.getDecorView());
|
// force our window to be removed synchronously
|
||||||
|
mWindowManager.removeViewImmediate(mWindow.getDecorView());
|
||||||
|
// the following will print a log message if it finds any other leaked windows
|
||||||
|
WindowManagerGlobal.getInstance().closeAll(mWindowToken,
|
||||||
|
this.getClass().getName(), "Dream");
|
||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
Slog.w(TAG, "Crashed removing window view", t);
|
Slog.w(TAG, "Crashed removing window view", t);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user