Create new window for Taskbar Nav Buttons when taskbar is focusable

Test: Open folder from taskbar, edit name, ensure back button displays above IME and that IME sends input to the taskbar folder name
Bug: 205803170
Change-Id: I36f6cfb835aa7da280f15ea4b0aed8923ce8a012
This commit is contained in:
Tony Wickham authored and Schneider Victor-tulias committed 2022-01-12 14:22:47 -08:00
1 parent c07fb08a1e
commit 66971f87e1
4 files changed
+137 -19

No files matched your search

@@ -15,17 +15,22 @@
*/
package com.android.launcher3.taskbar;
import static android.view.KeyEvent.ACTION_UP;
import static android.view.KeyEvent.KEYCODE_BACK;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Path;
import android.util.AttributeSet;
import android.view.KeyEvent;
import android.view.MotionEvent;
import android.view.View;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.android.launcher3.AbstractFloatingView;
import com.android.launcher3.R;
import com.android.launcher3.testing.TestLogging;
import com.android.launcher3.testing.TestProtocol;
@@ -187,4 +192,17 @@ public class TaskbarDragLayer extends BaseDragLayer<TaskbarActivityContext> {
TestLogging.recordMotionEvent(TestProtocol.SEQUENCE_MAIN, "Touch event", ev);
return super.dispatchTouchEvent(ev);
}
/** Called while Taskbar window is focusable, e.g. when pressing back while a folder is open */
@Override
public boolean dispatchKeyEvent(KeyEvent event) {
if (event.getAction() == ACTION_UP && event.getKeyCode() == KEYCODE_BACK) {
AbstractFloatingView topView = AbstractFloatingView.getTopOpenView(mActivity);
if (topView != null && topView.onBackPressed()) {
// Handled by the floating view.
return true;
}
}
return super.dispatchKeyEvent(event);
}
}