Loading core/java/android/window/WindowProviderService.java +2 −3 Original line number Diff line number Diff line Loading @@ -165,11 +165,10 @@ public abstract class WindowProviderService extends Service implements WindowPro } } // Suppress the lint because ths is overridden from Context. @SuppressLint("OnNameExpected") @Override @Nullable public Object getSystemService(@NonNull String name) { // Suppress the lint because ths is overridden from Context. public @Nullable Object getSystemService(@NonNull String name) { if (WINDOW_SERVICE.equals(name)) { return mWindowManager; } Loading core/java/android/window/WindowTokenClient.java +4 −4 Original line number Diff line number Diff line Loading @@ -91,6 +91,7 @@ public class WindowTokenClient extends IWindowToken.Stub { throw new IllegalStateException("Context is already attached."); } mContextRef = new WeakReference<>(context); mConfiguration.setTo(context.getResources().getConfiguration()); mShouldDumpConfigForIme = Build.IS_DEBUGGABLE && context instanceof AbstractInputMethodService; } Loading @@ -111,8 +112,7 @@ public class WindowTokenClient extends IWindowToken.Stub { if (configuration == null) { return false; } mHandler.runWithScissors(() -> onConfigurationChanged(configuration, displayId, false /* shouldReportConfigChange */), 0 /* timeout */); onConfigurationChanged(configuration, displayId, false /* shouldReportConfigChange */); mAttachToWindowContainer = true; return true; } catch (RemoteException e) { Loading @@ -137,8 +137,8 @@ public class WindowTokenClient extends IWindowToken.Stub { if (configuration == null) { return false; } mHandler.runWithScissors(() -> onConfigurationChanged(configuration, displayId, false /* shouldReportConfigChange */), 0 /* timeout */); mHandler.post(() -> onConfigurationChanged(configuration, displayId, false /* shouldReportConfigChange */)); mAttachToWindowContainer = true; return true; } catch (RemoteException e) { Loading services/core/java/com/android/server/wm/ConfigurationContainer.java +2 −9 Original line number Diff line number Diff line Loading @@ -637,20 +637,13 @@ public abstract class ConfigurationContainer<E extends ConfigurationContainer> { } void registerConfigurationChangeListener(ConfigurationContainerListener listener) { registerConfigurationChangeListener(listener, true /* shouldDispatchConfig */); } void registerConfigurationChangeListener(ConfigurationContainerListener listener, boolean shouldDispatchConfig) { if (mChangeListeners.contains(listener)) { return; } mChangeListeners.add(listener); if (shouldDispatchConfig) { listener.onRequestedOverrideConfigurationChanged(mResolvedOverrideConfiguration); listener.onMergedOverrideConfigurationChanged(mMergedOverrideConfiguration); } } void unregisterConfigurationChangeListener(ConfigurationContainerListener listener) { mChangeListeners.remove(listener); Loading services/core/java/com/android/server/wm/WindowContainer.java +2 −9 Original line number Diff line number Diff line Loading @@ -3747,21 +3747,14 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer< } void registerWindowContainerListener(WindowContainerListener listener) { registerWindowContainerListener(listener, true /* shouldPropConfig */); } void registerWindowContainerListener(WindowContainerListener listener, boolean shouldDispatchConfig) { if (mListeners.contains(listener)) { return; } mListeners.add(listener); // Also register to ConfigurationChangeListener to receive configuration changes. registerConfigurationChangeListener(listener, shouldDispatchConfig); if (shouldDispatchConfig) { registerConfigurationChangeListener(listener); listener.onDisplayChanged(getDisplayContent()); } } void unregisterWindowContainerListener(WindowContainerListener listener) { mListeners.remove(listener); Loading services/core/java/com/android/server/wm/WindowContextListenerController.java +3 −20 Original line number Diff line number Diff line Loading @@ -68,16 +68,6 @@ class WindowContextListenerController { @VisibleForTesting final ArrayMap<IBinder, WindowContextListenerImpl> mListeners = new ArrayMap<>(); /** * @see #registerWindowContainerListener(IBinder, WindowContainer, int, int, Bundle, boolean) */ void registerWindowContainerListener(@NonNull IBinder clientToken, @NonNull WindowContainer<?> container, int ownerUid, @WindowType int type, @Nullable Bundle options) { registerWindowContainerListener(clientToken, container, ownerUid, type, options, true /* shouDispatchConfigWhenRegistering */); } /** * Registers the listener to a {@code container} which is associated with * a {@code clientToken}, which is a {@link android.window.WindowContext} representation. If the Loading @@ -90,18 +80,15 @@ class WindowContextListenerController { * @param ownerUid the caller UID * @param type the window type * @param options a bundle used to pass window-related options. * @param shouDispatchConfigWhenRegistering {@code true} to indicate the current * {@code container}'s config will dispatch to the client side when * registering the {@link WindowContextListenerImpl} */ void registerWindowContainerListener(@NonNull IBinder clientToken, @NonNull WindowContainer<?> container, int ownerUid, @WindowType int type, @Nullable Bundle options, boolean shouDispatchConfigWhenRegistering) { @Nullable Bundle options) { WindowContextListenerImpl listener = mListeners.get(clientToken); if (listener == null) { listener = new WindowContextListenerImpl(clientToken, container, ownerUid, type, options); listener.register(shouDispatchConfigWhenRegistering); listener.register(); } else { listener.updateContainer(container); } Loading Loading @@ -241,16 +228,12 @@ class WindowContextListenerController { } private void register() { register(true /* shouldDispatchConfig */); } private void register(boolean shouldDispatchConfig) { final IBinder token = mClientToken.asBinder(); if (mDeathRecipient == null) { throw new IllegalStateException("Invalid client token: " + token); } mListeners.putIfAbsent(token, this); mContainer.registerWindowContainerListener(this, shouldDispatchConfig); mContainer.registerWindowContainerListener(this); } private void unregister() { Loading Loading
core/java/android/window/WindowProviderService.java +2 −3 Original line number Diff line number Diff line Loading @@ -165,11 +165,10 @@ public abstract class WindowProviderService extends Service implements WindowPro } } // Suppress the lint because ths is overridden from Context. @SuppressLint("OnNameExpected") @Override @Nullable public Object getSystemService(@NonNull String name) { // Suppress the lint because ths is overridden from Context. public @Nullable Object getSystemService(@NonNull String name) { if (WINDOW_SERVICE.equals(name)) { return mWindowManager; } Loading
core/java/android/window/WindowTokenClient.java +4 −4 Original line number Diff line number Diff line Loading @@ -91,6 +91,7 @@ public class WindowTokenClient extends IWindowToken.Stub { throw new IllegalStateException("Context is already attached."); } mContextRef = new WeakReference<>(context); mConfiguration.setTo(context.getResources().getConfiguration()); mShouldDumpConfigForIme = Build.IS_DEBUGGABLE && context instanceof AbstractInputMethodService; } Loading @@ -111,8 +112,7 @@ public class WindowTokenClient extends IWindowToken.Stub { if (configuration == null) { return false; } mHandler.runWithScissors(() -> onConfigurationChanged(configuration, displayId, false /* shouldReportConfigChange */), 0 /* timeout */); onConfigurationChanged(configuration, displayId, false /* shouldReportConfigChange */); mAttachToWindowContainer = true; return true; } catch (RemoteException e) { Loading @@ -137,8 +137,8 @@ public class WindowTokenClient extends IWindowToken.Stub { if (configuration == null) { return false; } mHandler.runWithScissors(() -> onConfigurationChanged(configuration, displayId, false /* shouldReportConfigChange */), 0 /* timeout */); mHandler.post(() -> onConfigurationChanged(configuration, displayId, false /* shouldReportConfigChange */)); mAttachToWindowContainer = true; return true; } catch (RemoteException e) { Loading
services/core/java/com/android/server/wm/ConfigurationContainer.java +2 −9 Original line number Diff line number Diff line Loading @@ -637,20 +637,13 @@ public abstract class ConfigurationContainer<E extends ConfigurationContainer> { } void registerConfigurationChangeListener(ConfigurationContainerListener listener) { registerConfigurationChangeListener(listener, true /* shouldDispatchConfig */); } void registerConfigurationChangeListener(ConfigurationContainerListener listener, boolean shouldDispatchConfig) { if (mChangeListeners.contains(listener)) { return; } mChangeListeners.add(listener); if (shouldDispatchConfig) { listener.onRequestedOverrideConfigurationChanged(mResolvedOverrideConfiguration); listener.onMergedOverrideConfigurationChanged(mMergedOverrideConfiguration); } } void unregisterConfigurationChangeListener(ConfigurationContainerListener listener) { mChangeListeners.remove(listener); Loading
services/core/java/com/android/server/wm/WindowContainer.java +2 −9 Original line number Diff line number Diff line Loading @@ -3747,21 +3747,14 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer< } void registerWindowContainerListener(WindowContainerListener listener) { registerWindowContainerListener(listener, true /* shouldPropConfig */); } void registerWindowContainerListener(WindowContainerListener listener, boolean shouldDispatchConfig) { if (mListeners.contains(listener)) { return; } mListeners.add(listener); // Also register to ConfigurationChangeListener to receive configuration changes. registerConfigurationChangeListener(listener, shouldDispatchConfig); if (shouldDispatchConfig) { registerConfigurationChangeListener(listener); listener.onDisplayChanged(getDisplayContent()); } } void unregisterWindowContainerListener(WindowContainerListener listener) { mListeners.remove(listener); Loading
services/core/java/com/android/server/wm/WindowContextListenerController.java +3 −20 Original line number Diff line number Diff line Loading @@ -68,16 +68,6 @@ class WindowContextListenerController { @VisibleForTesting final ArrayMap<IBinder, WindowContextListenerImpl> mListeners = new ArrayMap<>(); /** * @see #registerWindowContainerListener(IBinder, WindowContainer, int, int, Bundle, boolean) */ void registerWindowContainerListener(@NonNull IBinder clientToken, @NonNull WindowContainer<?> container, int ownerUid, @WindowType int type, @Nullable Bundle options) { registerWindowContainerListener(clientToken, container, ownerUid, type, options, true /* shouDispatchConfigWhenRegistering */); } /** * Registers the listener to a {@code container} which is associated with * a {@code clientToken}, which is a {@link android.window.WindowContext} representation. If the Loading @@ -90,18 +80,15 @@ class WindowContextListenerController { * @param ownerUid the caller UID * @param type the window type * @param options a bundle used to pass window-related options. * @param shouDispatchConfigWhenRegistering {@code true} to indicate the current * {@code container}'s config will dispatch to the client side when * registering the {@link WindowContextListenerImpl} */ void registerWindowContainerListener(@NonNull IBinder clientToken, @NonNull WindowContainer<?> container, int ownerUid, @WindowType int type, @Nullable Bundle options, boolean shouDispatchConfigWhenRegistering) { @Nullable Bundle options) { WindowContextListenerImpl listener = mListeners.get(clientToken); if (listener == null) { listener = new WindowContextListenerImpl(clientToken, container, ownerUid, type, options); listener.register(shouDispatchConfigWhenRegistering); listener.register(); } else { listener.updateContainer(container); } Loading Loading @@ -241,16 +228,12 @@ class WindowContextListenerController { } private void register() { register(true /* shouldDispatchConfig */); } private void register(boolean shouldDispatchConfig) { final IBinder token = mClientToken.asBinder(); if (mDeathRecipient == null) { throw new IllegalStateException("Invalid client token: " + token); } mListeners.putIfAbsent(token, this); mContainer.registerWindowContainerListener(this, shouldDispatchConfig); mContainer.registerWindowContainerListener(this); } private void unregister() { Loading