Loading packages/SystemUI/shared/src/com/android/systemui/shared/recents/ISystemUiProxy.aidl +9 −3 Original line number Diff line number Diff line Loading @@ -103,9 +103,10 @@ interface ISystemUiProxy { oneway void expandNotificationPanel() = 29; /** * Notifies SystemUI of a back KeyEvent. * Notifies SystemUI of KEYCODE_BACK. If the passed KeyEvent is not null, SystemUI may use it to * show a predictive back animation, otherwise it will send a ACTION_DOWN followed by ACTION_UP. */ oneway void onBackEvent(in KeyEvent keyEvent) = 44; oneway void onBackEvent(in KeyEvent keyEvent, int displayId) = 44; /** Sets home rotation enabled. */ oneway void setHomeRotationEnabled(boolean enabled) = 45; Loading Loading @@ -183,5 +184,10 @@ interface ISystemUiProxy { */ oneway void notifyRecentsButtonPositionChanged(in Rect position) = 59; // Next id = 60 /** * Notifies SystemUI of a KeyEvent of the specified type (e.g. KEYCODE_BACK, KEYCODE_HOME). */ oneway void onKeyEvent(int keycode, int displayId) = 60; // Next id = 61 } packages/SystemUI/src/com/android/systemui/LauncherProxyService.java +13 −7 Original line number Diff line number Diff line Loading @@ -19,7 +19,7 @@ package com.android.systemui; import static android.content.Intent.ACTION_PACKAGE_ADDED; import static android.content.Intent.EXTRA_CHANGED_COMPONENT_NAME_LIST; import static android.content.pm.PackageManager.MATCH_SYSTEM_ONLY; import static android.view.Display.INVALID_DISPLAY; import static android.view.KeyEvent.KEYCODE_BACK; import static android.view.MotionEvent.ACTION_CANCEL; import static android.view.MotionEvent.ACTION_DOWN; import static android.view.MotionEvent.ACTION_UP; Loading Loading @@ -343,18 +343,24 @@ public class LauncherProxyService implements CallbackController<LauncherProxyLis } @Override public void onBackEvent(@Nullable KeyEvent keyEvent) throws RemoteException { final int displayId = keyEvent == null ? INVALID_DISPLAY : keyEvent.getDisplayId(); public void onBackEvent(@Nullable KeyEvent keyEvent, int displayId) throws RemoteException { if (predictiveBackSwipeEdgeNoneApi() && mBackAnimation != null && keyEvent != null) { mBackAnimation.setTriggerBack(!keyEvent.isCanceled()); mBackAnimation.onBackMotion(/* touchX */ 0, /* touchY */ 0, keyEvent.getAction(), EDGE_NONE, displayId); } else { verifyCallerAndClearCallingIdentityPostMain("onBackPressed", () -> { sendEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_BACK, displayId); sendEvent(KeyEvent.ACTION_UP, KeyEvent.KEYCODE_BACK, displayId); }); onKeyEvent(KEYCODE_BACK, displayId); } } @Override public void onKeyEvent(int keycode, int displayId) { verifyCallerAndClearCallingIdentityPostMain( "onKeyEvent " + KeyEvent.keyCodeToString(keycode) + " displayId=" + displayId, () -> { sendEvent(KeyEvent.ACTION_DOWN, keycode, displayId); sendEvent(KeyEvent.ACTION_UP, keycode, displayId); }); } @Override Loading Loading
packages/SystemUI/shared/src/com/android/systemui/shared/recents/ISystemUiProxy.aidl +9 −3 Original line number Diff line number Diff line Loading @@ -103,9 +103,10 @@ interface ISystemUiProxy { oneway void expandNotificationPanel() = 29; /** * Notifies SystemUI of a back KeyEvent. * Notifies SystemUI of KEYCODE_BACK. If the passed KeyEvent is not null, SystemUI may use it to * show a predictive back animation, otherwise it will send a ACTION_DOWN followed by ACTION_UP. */ oneway void onBackEvent(in KeyEvent keyEvent) = 44; oneway void onBackEvent(in KeyEvent keyEvent, int displayId) = 44; /** Sets home rotation enabled. */ oneway void setHomeRotationEnabled(boolean enabled) = 45; Loading Loading @@ -183,5 +184,10 @@ interface ISystemUiProxy { */ oneway void notifyRecentsButtonPositionChanged(in Rect position) = 59; // Next id = 60 /** * Notifies SystemUI of a KeyEvent of the specified type (e.g. KEYCODE_BACK, KEYCODE_HOME). */ oneway void onKeyEvent(int keycode, int displayId) = 60; // Next id = 61 }
packages/SystemUI/src/com/android/systemui/LauncherProxyService.java +13 −7 Original line number Diff line number Diff line Loading @@ -19,7 +19,7 @@ package com.android.systemui; import static android.content.Intent.ACTION_PACKAGE_ADDED; import static android.content.Intent.EXTRA_CHANGED_COMPONENT_NAME_LIST; import static android.content.pm.PackageManager.MATCH_SYSTEM_ONLY; import static android.view.Display.INVALID_DISPLAY; import static android.view.KeyEvent.KEYCODE_BACK; import static android.view.MotionEvent.ACTION_CANCEL; import static android.view.MotionEvent.ACTION_DOWN; import static android.view.MotionEvent.ACTION_UP; Loading Loading @@ -343,18 +343,24 @@ public class LauncherProxyService implements CallbackController<LauncherProxyLis } @Override public void onBackEvent(@Nullable KeyEvent keyEvent) throws RemoteException { final int displayId = keyEvent == null ? INVALID_DISPLAY : keyEvent.getDisplayId(); public void onBackEvent(@Nullable KeyEvent keyEvent, int displayId) throws RemoteException { if (predictiveBackSwipeEdgeNoneApi() && mBackAnimation != null && keyEvent != null) { mBackAnimation.setTriggerBack(!keyEvent.isCanceled()); mBackAnimation.onBackMotion(/* touchX */ 0, /* touchY */ 0, keyEvent.getAction(), EDGE_NONE, displayId); } else { verifyCallerAndClearCallingIdentityPostMain("onBackPressed", () -> { sendEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_BACK, displayId); sendEvent(KeyEvent.ACTION_UP, KeyEvent.KEYCODE_BACK, displayId); }); onKeyEvent(KEYCODE_BACK, displayId); } } @Override public void onKeyEvent(int keycode, int displayId) { verifyCallerAndClearCallingIdentityPostMain( "onKeyEvent " + KeyEvent.keyCodeToString(keycode) + " displayId=" + displayId, () -> { sendEvent(KeyEvent.ACTION_DOWN, keycode, displayId); sendEvent(KeyEvent.ACTION_UP, keycode, displayId); }); } @Override Loading