Merge commit '975ecddc9e72b8217d36e653fb9deabb9fd5b859' * commit '975ecddc9e72b8217d36e653fb9deabb9fd5b859': Adding focus change notification
This commit is contained in:
@@ -494,6 +494,7 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
|
||||
public interface WindowChangeListener {
|
||||
public void windowsChanged();
|
||||
public void focusChanged();
|
||||
}
|
||||
|
||||
final Configuration mTempConfiguration = new Configuration();
|
||||
@@ -4829,6 +4830,21 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
}
|
||||
}
|
||||
|
||||
private void notifyFocusChanged() {
|
||||
WindowChangeListener[] windowChangeListeners;
|
||||
synchronized(mWindowMap) {
|
||||
if(mWindowChangeListeners.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
windowChangeListeners = new WindowChangeListener[mWindowChangeListeners.size()];
|
||||
windowChangeListeners = mWindowChangeListeners.toArray(windowChangeListeners);
|
||||
}
|
||||
int N = windowChangeListeners.length;
|
||||
for(int i = 0; i < N; i++) {
|
||||
windowChangeListeners[i].focusChanged();
|
||||
}
|
||||
}
|
||||
|
||||
private WindowState findWindow(int hashCode) {
|
||||
if (hashCode == -1) {
|
||||
return getFocusedWindow();
|
||||
@@ -7716,7 +7732,7 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
public static final int ENABLE_SCREEN = 16;
|
||||
public static final int APP_FREEZE_TIMEOUT = 17;
|
||||
public static final int SEND_NEW_CONFIGURATION = 18;
|
||||
public static final int WINDOWS_CHANGED = 19;
|
||||
public static final int REPORT_WINDOWS_CHANGE = 19;
|
||||
|
||||
private Session mLastReportedHold;
|
||||
|
||||
@@ -7768,6 +7784,7 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
// Ignore if process has died.
|
||||
}
|
||||
}
|
||||
notifyFocusChanged();
|
||||
}
|
||||
} break;
|
||||
|
||||
@@ -8048,7 +8065,7 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
break;
|
||||
}
|
||||
|
||||
case WINDOWS_CHANGED: {
|
||||
case REPORT_WINDOWS_CHANGE: {
|
||||
if (mWindowsChanged) {
|
||||
synchronized (mWindowMap) {
|
||||
mWindowsChanged = false;
|
||||
@@ -8279,8 +8296,8 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
}
|
||||
}
|
||||
if (mWindowsChanged && !mWindowChangeListeners.isEmpty()) {
|
||||
mH.removeMessages(H.WINDOWS_CHANGED);
|
||||
mH.sendMessage(mH.obtainMessage(H.WINDOWS_CHANGED));
|
||||
mH.removeMessages(H.REPORT_WINDOWS_CHANGE);
|
||||
mH.sendMessage(mH.obtainMessage(H.REPORT_WINDOWS_CHANGE));
|
||||
}
|
||||
} catch (RuntimeException e) {
|
||||
mInLayout = false;
|
||||
|
||||
Reference in New Issue
Block a user