Loading core/java/android/hardware/LegacySensorManager.java +3 −2 Original line number Diff line number Diff line Loading @@ -16,6 +16,8 @@ package android.hardware; import static android.view.Display.DEFAULT_DISPLAY; import android.os.RemoteException; import android.os.ServiceManager; import android.view.IRotationWatcher; Loading Loading @@ -57,8 +59,7 @@ final class LegacySensorManager { public void onRotationChanged(int rotation) { LegacySensorManager.onRotationChanged(rotation); } } ); }, DEFAULT_DISPLAY); } catch (RemoteException e) { } } Loading core/java/android/view/IWindowManager.aidl +2 −2 Original line number Diff line number Diff line Loading @@ -209,10 +209,10 @@ interface IWindowManager int getDefaultDisplayRotation(); /** * Watch the rotation of the screen. Returns the current rotation, * Watch the rotation of the specified screen. Returns the current rotation, * calls back when it changes. */ int watchRotation(IRotationWatcher watcher); int watchRotation(IRotationWatcher watcher, int displayId); /** * Remove a rotation watcher set using watchRotation. Loading core/java/com/android/internal/policy/PhoneWindow.java +2 −1 Original line number Diff line number Diff line Loading @@ -3585,7 +3585,8 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback { synchronized (mWindows) { if (!mIsWatching) { try { WindowManagerHolder.sWindowManager.watchRotation(this); WindowManagerHolder.sWindowManager.watchRotation(this, phoneWindow.getContext().getDisplay().getDisplayId()); mHandler = new Handler(); mIsWatching = true; } catch (RemoteException ex) { Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarFragment.java +1 −1 Original line number Diff line number Diff line Loading @@ -142,7 +142,7 @@ public class NavigationBarFragment extends Fragment implements Callbacks { try { WindowManagerGlobal.getWindowManagerService() .watchRotation(mRotationWatcher); .watchRotation(mRotationWatcher, getContext().getDisplay().getDisplayId()); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } Loading services/core/java/com/android/server/wm/WindowManagerService.java +23 −17 Original line number Diff line number Diff line Loading @@ -533,13 +533,17 @@ public class WindowManagerService extends IWindowManager.Stub } class RotationWatcher { IRotationWatcher watcher; IBinder.DeathRecipient deathRecipient; RotationWatcher(IRotationWatcher w, IBinder.DeathRecipient d) { watcher = w; deathRecipient = d; IRotationWatcher mWatcher; IBinder.DeathRecipient mDeathRecipient; int mDisplayId; RotationWatcher(IRotationWatcher watcher, IBinder.DeathRecipient deathRecipient, int displayId) { mWatcher = watcher; mDeathRecipient = deathRecipient; mDisplayId = displayId; } } ArrayList<RotationWatcher> mRotationWatchers = new ArrayList<>(); int mDeferredRotationPauseCount; Loading Loading @@ -4076,11 +4080,14 @@ public class WindowManagerService extends IWindowManager.Stub } for (int i = mRotationWatchers.size() - 1; i >= 0; i--) { final RotationWatcher rotationWatcher = mRotationWatchers.get(i); if (rotationWatcher.mDisplayId == displayId) { try { mRotationWatchers.get(i).watcher.onRotationChanged(rotation); rotationWatcher.mWatcher.onRotationChanged(rotation); } catch (RemoteException e) { } } } // TODO (multidisplay): Magnification is supported only for the default display. // Announce rotation only if we will not animate as we already have the Loading @@ -4106,16 +4113,16 @@ public class WindowManagerService extends IWindowManager.Stub } @Override public int watchRotation(IRotationWatcher watcher) { public int watchRotation(IRotationWatcher watcher, int displayId) { final IBinder watcherBinder = watcher.asBinder(); IBinder.DeathRecipient dr = new IBinder.DeathRecipient() { @Override public void binderDied() { synchronized (mWindowMap) { for (int i=0; i<mRotationWatchers.size(); i++) { if (watcherBinder == mRotationWatchers.get(i).watcher.asBinder()) { if (watcherBinder == mRotationWatchers.get(i).mWatcher.asBinder()) { RotationWatcher removed = mRotationWatchers.remove(i); IBinder binder = removed.watcher.asBinder(); IBinder binder = removed.mWatcher.asBinder(); if (binder != null) { binder.unlinkToDeath(this, 0); } Loading @@ -4129,12 +4136,11 @@ public class WindowManagerService extends IWindowManager.Stub synchronized (mWindowMap) { try { watcher.asBinder().linkToDeath(dr, 0); mRotationWatchers.add(new RotationWatcher(watcher, dr)); mRotationWatchers.add(new RotationWatcher(watcher, dr, displayId)); } catch (RemoteException e) { // Client died, no cleanup needed. } // TODO(multi-display): Modify rotation watchers to include display id. return getDefaultDisplayRotation(); } } Loading @@ -4145,11 +4151,11 @@ public class WindowManagerService extends IWindowManager.Stub synchronized (mWindowMap) { for (int i=0; i<mRotationWatchers.size(); i++) { RotationWatcher rotationWatcher = mRotationWatchers.get(i); if (watcherBinder == rotationWatcher.watcher.asBinder()) { if (watcherBinder == rotationWatcher.mWatcher.asBinder()) { RotationWatcher removed = mRotationWatchers.remove(i); IBinder binder = removed.watcher.asBinder(); IBinder binder = removed.mWatcher.asBinder(); if (binder != null) { binder.unlinkToDeath(removed.deathRecipient, 0); binder.unlinkToDeath(removed.mDeathRecipient, 0); } i--; } Loading Loading
core/java/android/hardware/LegacySensorManager.java +3 −2 Original line number Diff line number Diff line Loading @@ -16,6 +16,8 @@ package android.hardware; import static android.view.Display.DEFAULT_DISPLAY; import android.os.RemoteException; import android.os.ServiceManager; import android.view.IRotationWatcher; Loading Loading @@ -57,8 +59,7 @@ final class LegacySensorManager { public void onRotationChanged(int rotation) { LegacySensorManager.onRotationChanged(rotation); } } ); }, DEFAULT_DISPLAY); } catch (RemoteException e) { } } Loading
core/java/android/view/IWindowManager.aidl +2 −2 Original line number Diff line number Diff line Loading @@ -209,10 +209,10 @@ interface IWindowManager int getDefaultDisplayRotation(); /** * Watch the rotation of the screen. Returns the current rotation, * Watch the rotation of the specified screen. Returns the current rotation, * calls back when it changes. */ int watchRotation(IRotationWatcher watcher); int watchRotation(IRotationWatcher watcher, int displayId); /** * Remove a rotation watcher set using watchRotation. Loading
core/java/com/android/internal/policy/PhoneWindow.java +2 −1 Original line number Diff line number Diff line Loading @@ -3585,7 +3585,8 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback { synchronized (mWindows) { if (!mIsWatching) { try { WindowManagerHolder.sWindowManager.watchRotation(this); WindowManagerHolder.sWindowManager.watchRotation(this, phoneWindow.getContext().getDisplay().getDisplayId()); mHandler = new Handler(); mIsWatching = true; } catch (RemoteException ex) { Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarFragment.java +1 −1 Original line number Diff line number Diff line Loading @@ -142,7 +142,7 @@ public class NavigationBarFragment extends Fragment implements Callbacks { try { WindowManagerGlobal.getWindowManagerService() .watchRotation(mRotationWatcher); .watchRotation(mRotationWatcher, getContext().getDisplay().getDisplayId()); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } Loading
services/core/java/com/android/server/wm/WindowManagerService.java +23 −17 Original line number Diff line number Diff line Loading @@ -533,13 +533,17 @@ public class WindowManagerService extends IWindowManager.Stub } class RotationWatcher { IRotationWatcher watcher; IBinder.DeathRecipient deathRecipient; RotationWatcher(IRotationWatcher w, IBinder.DeathRecipient d) { watcher = w; deathRecipient = d; IRotationWatcher mWatcher; IBinder.DeathRecipient mDeathRecipient; int mDisplayId; RotationWatcher(IRotationWatcher watcher, IBinder.DeathRecipient deathRecipient, int displayId) { mWatcher = watcher; mDeathRecipient = deathRecipient; mDisplayId = displayId; } } ArrayList<RotationWatcher> mRotationWatchers = new ArrayList<>(); int mDeferredRotationPauseCount; Loading Loading @@ -4076,11 +4080,14 @@ public class WindowManagerService extends IWindowManager.Stub } for (int i = mRotationWatchers.size() - 1; i >= 0; i--) { final RotationWatcher rotationWatcher = mRotationWatchers.get(i); if (rotationWatcher.mDisplayId == displayId) { try { mRotationWatchers.get(i).watcher.onRotationChanged(rotation); rotationWatcher.mWatcher.onRotationChanged(rotation); } catch (RemoteException e) { } } } // TODO (multidisplay): Magnification is supported only for the default display. // Announce rotation only if we will not animate as we already have the Loading @@ -4106,16 +4113,16 @@ public class WindowManagerService extends IWindowManager.Stub } @Override public int watchRotation(IRotationWatcher watcher) { public int watchRotation(IRotationWatcher watcher, int displayId) { final IBinder watcherBinder = watcher.asBinder(); IBinder.DeathRecipient dr = new IBinder.DeathRecipient() { @Override public void binderDied() { synchronized (mWindowMap) { for (int i=0; i<mRotationWatchers.size(); i++) { if (watcherBinder == mRotationWatchers.get(i).watcher.asBinder()) { if (watcherBinder == mRotationWatchers.get(i).mWatcher.asBinder()) { RotationWatcher removed = mRotationWatchers.remove(i); IBinder binder = removed.watcher.asBinder(); IBinder binder = removed.mWatcher.asBinder(); if (binder != null) { binder.unlinkToDeath(this, 0); } Loading @@ -4129,12 +4136,11 @@ public class WindowManagerService extends IWindowManager.Stub synchronized (mWindowMap) { try { watcher.asBinder().linkToDeath(dr, 0); mRotationWatchers.add(new RotationWatcher(watcher, dr)); mRotationWatchers.add(new RotationWatcher(watcher, dr, displayId)); } catch (RemoteException e) { // Client died, no cleanup needed. } // TODO(multi-display): Modify rotation watchers to include display id. return getDefaultDisplayRotation(); } } Loading @@ -4145,11 +4151,11 @@ public class WindowManagerService extends IWindowManager.Stub synchronized (mWindowMap) { for (int i=0; i<mRotationWatchers.size(); i++) { RotationWatcher rotationWatcher = mRotationWatchers.get(i); if (watcherBinder == rotationWatcher.watcher.asBinder()) { if (watcherBinder == rotationWatcher.mWatcher.asBinder()) { RotationWatcher removed = mRotationWatchers.remove(i); IBinder binder = removed.watcher.asBinder(); IBinder binder = removed.mWatcher.asBinder(); if (binder != null) { binder.unlinkToDeath(removed.deathRecipient, 0); binder.unlinkToDeath(removed.mDeathRecipient, 0); } i--; } Loading