Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
platform_frameworks_base-old
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Farzin Kazemzadeh
platform_frameworks_base-old
Commits
a2e448b2
Commit
a2e448b2
authored
1 year ago
by
Wei Sheng Shih
Committed by
Android (Google) Code Review
1 year ago
Browse files
Options
Downloads
Plain Diff
Merge "Do not register OnBackInvokedCallback for SoftInputWindow." into udc-dev
parents
90c9dbf7
da6336c3
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
core/java/android/app/Dialog.java
+12
-3
12 additions, 3 deletions
core/java/android/app/Dialog.java
core/java/android/inputmethodservice/SoftInputWindow.java
+7
-0
7 additions, 0 deletions
core/java/android/inputmethodservice/SoftInputWindow.java
with
19 additions
and
3 deletions
core/java/android/app/Dialog.java
+
12
−
3
View file @
a2e448b2
...
...
@@ -454,12 +454,11 @@ public class Dialog implements DialogInterface, Window.Callback,
*/
protected
void
onStart
()
{
if
(
mActionBar
!=
null
)
mActionBar
.
setShowHideAnimationEnabled
(
true
);
if
(
mContext
!=
null
if
(
allowsRegisterDefaultOnBackInvokedCallback
()
&&
mContext
!=
null
&&
WindowOnBackInvokedDispatcher
.
isOnBackInvokedCallbackEnabled
(
mContext
))
{
// Add onBackPressed as default back behavior.
mDefaultBackCallback
=
this
::
onBackPressed
;
getOnBackInvokedDispatcher
().
registerSystemOnBackInvokedCallback
(
mDefaultBackCallback
);
mDefaultBackCallback
=
null
;
}
}
...
...
@@ -470,9 +469,18 @@ public class Dialog implements DialogInterface, Window.Callback,
if
(
mActionBar
!=
null
)
mActionBar
.
setShowHideAnimationEnabled
(
false
);
if
(
mDefaultBackCallback
!=
null
)
{
getOnBackInvokedDispatcher
().
unregisterOnBackInvokedCallback
(
mDefaultBackCallback
);
mDefaultBackCallback
=
null
;
}
}
/**
* Whether this dialog allows to register the default onBackInvokedCallback.
* @hide
*/
protected
boolean
allowsRegisterDefaultOnBackInvokedCallback
()
{
return
true
;
}
private
static
final
String
DIALOG_SHOWING_TAG
=
"android:dialogShowing"
;
private
static
final
String
DIALOG_HIERARCHY_TAG
=
"android:dialogHierarchy"
;
...
...
@@ -697,7 +705,8 @@ public class Dialog implements DialogInterface, Window.Callback,
if
((
keyCode
==
KeyEvent
.
KEYCODE_BACK
||
keyCode
==
KeyEvent
.
KEYCODE_ESCAPE
)
&&
event
.
isTracking
()
&&
!
event
.
isCanceled
()
&&
!
WindowOnBackInvokedDispatcher
.
isOnBackInvokedCallbackEnabled
(
mContext
))
{
&&
(!
WindowOnBackInvokedDispatcher
.
isOnBackInvokedCallbackEnabled
(
mContext
)
||
!
allowsRegisterDefaultOnBackInvokedCallback
()))
{
onBackPressed
();
return
true
;
}
...
...
This diff is collapsed.
Click to expand it.
core/java/android/inputmethodservice/SoftInputWindow.java
+
7
−
0
View file @
a2e448b2
...
...
@@ -79,6 +79,13 @@ final class SoftInputWindow extends Dialog {
@WindowState
private
int
mWindowState
=
WindowState
.
TOKEN_PENDING
;
@Override
protected
boolean
allowsRegisterDefaultOnBackInvokedCallback
()
{
// Do not register OnBackInvokedCallback from Dialog#onStart, InputMethodService will
// register CompatOnBackInvokedCallback for input method window.
return
false
;
}
/**
* Set {@link IBinder} window token to the window.
*
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment