Loading packages/SystemUI/shared/src/com/android/systemui/shared/recents/ISystemUiProxy.aidl +6 −1 Original line number Diff line number Diff line Loading @@ -134,5 +134,10 @@ interface ISystemUiProxy { */ void expandNotificationPanel() = 29; // Next id = 44 /** * Notifies SystemUI to invoke Back. */ void onBackPressed() = 44; // Next id = 45 } packages/SystemUI/src/com/android/systemui/recents/OverviewProxyService.java +33 −0 Original line number Diff line number Diff line Loading @@ -58,9 +58,12 @@ import android.os.IBinder; import android.os.Looper; import android.os.PatternMatcher; import android.os.RemoteException; import android.os.SystemClock; import android.os.UserHandle; import android.util.Log; import android.view.InputDevice; import android.view.InputMonitor; import android.view.KeyCharacterMap; import android.view.KeyEvent; import android.view.MotionEvent; import android.view.Surface; Loading Loading @@ -239,6 +242,36 @@ public class OverviewProxyService extends CurrentUserTracker implements } } @Override public void onBackPressed() throws RemoteException { if (!verifyCaller("onBackPressed")) { return; } final long token = Binder.clearCallingIdentity(); try { mHandler.post(() -> { sendEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_BACK); sendEvent(KeyEvent.ACTION_UP, KeyEvent.KEYCODE_BACK); notifyBackAction(true, -1, -1, true, false); }); } finally { Binder.restoreCallingIdentity(token); } } private boolean sendEvent(int action, int code) { long when = SystemClock.uptimeMillis(); final KeyEvent ev = new KeyEvent(when, when, action, code, 0 /* repeat */, 0 /* metaState */, KeyCharacterMap.VIRTUAL_KEYBOARD, 0 /* scancode */, KeyEvent.FLAG_FROM_SYSTEM | KeyEvent.FLAG_VIRTUAL_HARD_KEY, InputDevice.SOURCE_KEYBOARD); ev.setDisplayId(mContext.getDisplay().getDisplayId()); return InputManager.getInstance() .injectInputEvent(ev, InputManager.INJECT_INPUT_EVENT_MODE_ASYNC); } @Override public void onOverviewShown(boolean fromHome) { if (!verifyCaller("onOverviewShown")) { Loading Loading
packages/SystemUI/shared/src/com/android/systemui/shared/recents/ISystemUiProxy.aidl +6 −1 Original line number Diff line number Diff line Loading @@ -134,5 +134,10 @@ interface ISystemUiProxy { */ void expandNotificationPanel() = 29; // Next id = 44 /** * Notifies SystemUI to invoke Back. */ void onBackPressed() = 44; // Next id = 45 }
packages/SystemUI/src/com/android/systemui/recents/OverviewProxyService.java +33 −0 Original line number Diff line number Diff line Loading @@ -58,9 +58,12 @@ import android.os.IBinder; import android.os.Looper; import android.os.PatternMatcher; import android.os.RemoteException; import android.os.SystemClock; import android.os.UserHandle; import android.util.Log; import android.view.InputDevice; import android.view.InputMonitor; import android.view.KeyCharacterMap; import android.view.KeyEvent; import android.view.MotionEvent; import android.view.Surface; Loading Loading @@ -239,6 +242,36 @@ public class OverviewProxyService extends CurrentUserTracker implements } } @Override public void onBackPressed() throws RemoteException { if (!verifyCaller("onBackPressed")) { return; } final long token = Binder.clearCallingIdentity(); try { mHandler.post(() -> { sendEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_BACK); sendEvent(KeyEvent.ACTION_UP, KeyEvent.KEYCODE_BACK); notifyBackAction(true, -1, -1, true, false); }); } finally { Binder.restoreCallingIdentity(token); } } private boolean sendEvent(int action, int code) { long when = SystemClock.uptimeMillis(); final KeyEvent ev = new KeyEvent(when, when, action, code, 0 /* repeat */, 0 /* metaState */, KeyCharacterMap.VIRTUAL_KEYBOARD, 0 /* scancode */, KeyEvent.FLAG_FROM_SYSTEM | KeyEvent.FLAG_VIRTUAL_HARD_KEY, InputDevice.SOURCE_KEYBOARD); ev.setDisplayId(mContext.getDisplay().getDisplayId()); return InputManager.getInstance() .injectInputEvent(ev, InputManager.INJECT_INPUT_EVENT_MODE_ASYNC); } @Override public void onOverviewShown(boolean fromHome) { if (!verifyCaller("onOverviewShown")) { Loading