Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
72 commits
Select commit Hold shift + click to select a range
dc93719
Add session management
camsim99 Jan 10, 2022
cd234ad
Handle receiving results
camsim99 Jan 10, 2022
f463846
Add framework logic, modify engine
camsim99 Jan 12, 2022
3dfae0a
Make engine build
camsim99 Jan 12, 2022
546692b
Add retrieving locale
camsim99 Jan 13, 2022
5f43ff5
Added comments for experimentation
camsim99 Jan 18, 2022
ee73219
Send string back temporarily, fix results representation
camsim99 Feb 2, 2022
624f68b
Formatting
camsim99 Feb 2, 2022
846b195
Merge branch 'main' of github.com:flutter/engine into issue_34688_dev
camsim99 Feb 28, 2022
b27704c
Merge remote-tracking branch 'upstream/main' into issue_34688_dev
camsim99 Mar 16, 2022
64f0ac7
Add new method channel
camsim99 Mar 18, 2022
0cc3776
Add platform setting for spell check
camsim99 Mar 18, 2022
33f2f40
Change method channel name
camsim99 Mar 21, 2022
eb3c731
Remove print statements
camsim99 Mar 22, 2022
1877242
Clean up
camsim99 Mar 23, 2022
5372aaa
Formatting
camsim99 Mar 24, 2022
d9adbdc
Clean PR
camsim99 Mar 28, 2022
34809db
Undo platform plugin changes
camsim99 Mar 28, 2022
10d154d
Clean up code
camsim99 Mar 30, 2022
00c228e
Begin adding tests
camsim99 Mar 30, 2022
e08171f
Formatting
camsim99 Mar 30, 2022
5ccc144
Correct sessions, remove unecessary line
camsim99 Mar 31, 2022
87ab60f
Add tests
camsim99 Mar 31, 2022
f4083d7
Formatting
camsim99 Mar 31, 2022
ce45427
Remove variable
camsim99 Mar 31, 2022
6972b0b
Begin fixing tests
camsim99 Apr 1, 2022
3eba4de
Address reviews
camsim99 Apr 7, 2022
963d9ae
Start fixing systesm setting
camsim99 Apr 8, 2022
6ea2ede
Continue addressing reviews
camsim99 Apr 8, 2022
32c7702
Continue addressing reviews
camsim99 Apr 8, 2022
e9ebd5b
Fix spell checkers check
camsim99 Apr 8, 2022
8298436
Begin fixing tests
camsim99 Apr 9, 2022
993b6c8
Reformat FlutterViewTest
camsim99 Apr 11, 2022
4179f42
Fixing tests
camsim99 Apr 11, 2022
f999488
Merge remote-tracking branch 'upstream/main' into issue_34688_dev
camsim99 Apr 11, 2022
ade72bc
Fix tests minus log errors
camsim99 Apr 11, 2022
c20b62c
Add context shadow to stub tsm request
camsim99 Apr 13, 2022
49583d4
Formatting
camsim99 Apr 13, 2022
49939aa
Fix np error
camsim99 Apr 14, 2022
0cf00f3
Add license
camsim99 Apr 14, 2022
48a4354
Update licenses file
camsim99 Apr 14, 2022
510f83a
Add nativeSpellCheckServiceDefined to other platform dispatchers
camsim99 Apr 15, 2022
d8e333b
Merge remote-tracking branch 'upstream/main' into issue_34688_dev
camsim99 Apr 15, 2022
61908d3
Remove setting
camsim99 Apr 15, 2022
29b095f
Fix typos
camsim99 Apr 15, 2022
ee28058
Update lib/ui/platform_dispatcher.dart
camsim99 Apr 18, 2022
4f0a074
Update lib/ui/window.dart
camsim99 Apr 18, 2022
6c4d437
Update shell/platform/android/io/flutter/embedding/android/FlutterVie…
camsim99 Apr 18, 2022
d73b915
Update shell/platform/android/io/flutter/embedding/engine/systemchann…
camsim99 Apr 18, 2022
66c24ed
Update shell/platform/android/io/flutter/embedding/engine/systemchann…
camsim99 Apr 18, 2022
04a2ce1
Update shell/platform/android/io/flutter/embedding/engine/systemchann…
camsim99 Apr 18, 2022
15d17f5
Update shell/platform/android/io/flutter/embedding/engine/systemchann…
camsim99 Apr 18, 2022
e6414b2
Update shell/platform/android/io/flutter/embedding/engine/systemchann…
camsim99 Apr 18, 2022
2882e3b
Update shell/platform/android/io/flutter/embedding/engine/systemchann…
camsim99 Apr 18, 2022
dfe4689
Update shell/platform/android/io/flutter/plugin/editing/SpellCheckPlu…
camsim99 Apr 18, 2022
cdc6b9c
Update shell/platform/android/io/flutter/plugin/editing/SpellCheckPlu…
camsim99 Apr 18, 2022
65b8850
Update shell/platform/android/io/flutter/plugin/editing/SpellCheckPlu…
camsim99 Apr 18, 2022
036b15b
Make review fixes
camsim99 Apr 18, 2022
188c2ad
Merge branch 'issue_34688_dev' of github.com:camsim99/engine into iss…
camsim99 Apr 18, 2022
8198d4e
Formatting
camsim99 Apr 18, 2022
a2b6c90
Fix spell check test
camsim99 Apr 18, 2022
2aac372
Address nits
camsim99 Apr 21, 2022
894f4e9
Send text to framework
camsim99 Apr 28, 2022
2a4ea66
Push for visibility
camsim99 May 4, 2022
c2a6550
Modify result response protocol
camsim99 May 6, 2022
6125e74
Merge branch 'main' into issue_34688_dev
camsim99 May 9, 2022
74d1477
Merge remote-tracking branch 'upstream/master' into issue_34688_dev
camsim99 May 10, 2022
cc8bf5e
Merge branch 'issue_34688_dev' of github.com:camsim99/engine into iss…
camsim99 May 10, 2022
5a175ec
Formatting and pull
camsim99 May 10, 2022
1c02784
Merge remote-tracking branch 'upstream/master' into issue_34688_dev
camsim99 May 12, 2022
3e74d61
Emulator fix
camsim99 May 13, 2022
975673c
Merge remote-tracking branch 'upstream/main' into issue_34688_dev
camsim99 May 13, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add new method channel
  • Loading branch information
camsim99 committed Mar 18, 2022
commit 64f0ac7e36cb7aaa37251d71b74a2502a3bc8c0a
2 changes: 2 additions & 0 deletions shell/platform/android/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,7 @@ android_java_sources = [
"io/flutter/embedding/engine/systemchannels/PlatformViewsChannel.java",
"io/flutter/embedding/engine/systemchannels/RestorationChannel.java",
"io/flutter/embedding/engine/systemchannels/SettingsChannel.java",
"io/flutter/embedding/engine/systemchannels/SpellCheckChannel.java",
"io/flutter/embedding/engine/systemchannels/SystemChannel.java",
"io/flutter/embedding/engine/systemchannels/TextInputChannel.java",
"io/flutter/plugin/common/ActivityLifecycleListener.java",
Expand All @@ -260,6 +261,7 @@ android_java_sources = [
"io/flutter/plugin/editing/ImeSyncDeferringInsetsCallback.java",
"io/flutter/plugin/editing/InputConnectionAdaptor.java",
"io/flutter/plugin/editing/ListenableEditingState.java",
"io/flutter/plugin/editing/SpellCheckPlugin.java",
"io/flutter/plugin/editing/TextEditingDelta.java",
"io/flutter/plugin/editing/TextInputPlugin.java",
"io/flutter/plugin/localization/LocalizationPlugin.java",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
import io.flutter.embedding.engine.renderer.FlutterUiDisplayListener;
import io.flutter.embedding.engine.renderer.RenderSurface;
import io.flutter.embedding.engine.systemchannels.SettingsChannel;
import io.flutter.plugin.editing.SpellCheckPlugin;
import io.flutter.plugin.editing.TextInputPlugin;
import io.flutter.plugin.localization.LocalizationPlugin;
import io.flutter.plugin.mouse.MouseCursorPlugin;
Expand Down Expand Up @@ -124,6 +125,7 @@ public class FlutterView extends FrameLayout implements MouseCursorPlugin.MouseC
// existing, stateless system channels, e.g., KeyEventChannel, TextInputChannel, etc.
@Nullable private MouseCursorPlugin mouseCursorPlugin;
@Nullable private TextInputPlugin textInputPlugin;
@Nullable private SpellCheckPlugin spellCheckPlugin;
@Nullable private LocalizationPlugin localizationPlugin;
@Nullable private KeyboardManager keyboardManager;
@Nullable private AndroidTouchProcessor androidTouchProcessor;
Expand Down Expand Up @@ -1120,6 +1122,7 @@ public void attachToFlutterEngine(@NonNull FlutterEngine flutterEngine) {
this,
this.flutterEngine.getTextInputChannel(),
this.flutterEngine.getPlatformViewsController());
spellCheckPlugin = new SpellCheckPlugin(this, this.flutterEngine.getSpellCheckChannel());
localizationPlugin = this.flutterEngine.getLocalizationPlugin();

keyboardManager =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import io.flutter.embedding.engine.systemchannels.PlatformChannel;
import io.flutter.embedding.engine.systemchannels.RestorationChannel;
import io.flutter.embedding.engine.systemchannels.SettingsChannel;
import io.flutter.embedding.engine.systemchannels.SpellCheckChannel;
import io.flutter.embedding.engine.systemchannels.SystemChannel;
import io.flutter.embedding.engine.systemchannels.TextInputChannel;
import io.flutter.plugin.localization.LocalizationPlugin;
Expand Down Expand Up @@ -95,6 +96,7 @@ public class FlutterEngine {
@NonNull private final RestorationChannel restorationChannel;
@NonNull private final PlatformChannel platformChannel;
@NonNull private final SettingsChannel settingsChannel;
@NonNull private final SpellCheckChannel spellCheckChannel;
@NonNull private final SystemChannel systemChannel;
@NonNull private final TextInputChannel textInputChannel;

Expand Down Expand Up @@ -309,6 +311,7 @@ public FlutterEngine(
platformChannel = new PlatformChannel(dartExecutor);
restorationChannel = new RestorationChannel(dartExecutor, waitForRestorationData);
settingsChannel = new SettingsChannel(dartExecutor);
spellCheckChannel = new SpellCheckChannel(dartExecutor);
systemChannel = new SystemChannel(dartExecutor);
textInputChannel = new TextInputChannel(dartExecutor);

Expand Down Expand Up @@ -559,6 +562,12 @@ public TextInputChannel getTextInputChannel() {
return textInputChannel;
}

/** System channel that sends and receives requests related to spell check. */
@NonNull
public SpellCheckChannel getSpellCheckChannel() {
return spellCheckChannel;
}

/**
* Plugin registry, which registers plugins that want to be applied to this {@code FlutterEngine}.
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
package io.flutter.embedding.engine.systemchannels;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.VisibleForTesting;
import io.flutter.Log;
import io.flutter.embedding.engine.dart.DartExecutor;
import io.flutter.plugin.common.JSONMethodCodec;
import io.flutter.plugin.common.MethodCall;
import io.flutter.plugin.common.MethodChannel;
import java.util.ArrayList;
import java.util.Arrays;
import org.json.JSONArray;
import org.json.JSONException;

public class SpellCheckChannel {
private static final String TAG = "SpellCheckChannel";

@NonNull public final MethodChannel channel;
@Nullable private SpellCheckMethodHandler spellCheckMethodHandler;
Copy link

@blasten blasten Apr 4, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just fyi. We use these annotations in many places, but they are only somewhat useful in public APIs in the case a consumer of these APIs is using Kotlin.


@NonNull @VisibleForTesting
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't see usages of parsingMethodHandler in the tests, is this annotation correct?

final MethodChannel.MethodCallHandler parsingMethodHandler =
new MethodChannel.MethodCallHandler() {
@Override
public void onMethodCall(@NonNull MethodCall call, @NonNull MethodChannel.Result result) {
if (spellCheckMethodHandler == null) {
// If no explicit SpellCheckMethodHandler has been registered then we don't
// need to forward this call to an API. Return.
return;
}
String method = call.method;
Object args = call.arguments;
Log.v(TAG, "Received '" + method + "' message.");
switch (method) {
case "SpellCheck.initiateSpellChecking":
System.out.println("-----------FETCH RECEIVED IN ENGINE------------------");
try {
final JSONArray argumentList = (JSONArray) args;
String locale = argumentList.getString(0);
String text = argumentList.getString(1);
spellCheckMethodHandler.initiateSpellChecking(locale, text);
result.success(null);
} catch (JSONException exception) {
result.error("error", exception.getMessage(), null);
}
break;
default:
System.out.println(
"-----------WRONG METHOD BEING CALLED IN ENGINE------------------");
result.notImplemented();
break;
}
}
};

public SpellCheckChannel(@NonNull DartExecutor dartExecutor) {
// TODO(camillesimon): Use JSON?
this.channel = new MethodChannel(dartExecutor, "flutter/spellcheck", JSONMethodCodec.INSTANCE);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: this could be avoided

channel.setMethodCallHandler(parsingMethodHandler);
}

/** Responsible for sending spell checker results across to the framework. */
public void updateSpellCheckerResults(
ArrayList<String> spellCheckerResults, String spellCheckedText) {
channel.invokeMethod(
"TextInputClient.updateSpellCheckerResults",
Arrays.asList(spellCheckerResults, spellCheckedText));
}

public void setSpellCheckMethodHandler(
@Nullable SpellCheckMethodHandler spellCheckMethodHandler) {
System.out.println("-------------------SPELL CHECK HANDLER SET-------------------");
this.spellCheckMethodHandler = spellCheckMethodHandler;
}

public interface SpellCheckMethodHandler {
/**
* Requests that spell checking is initiated for the inputted text recognized by the framework,
* which will automatically result in spell checking resutls being sent back to the framework.
*/
void initiateSpellChecking(String locale, String text);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
import io.flutter.plugin.common.MethodCall;
import io.flutter.plugin.common.MethodChannel;
import io.flutter.plugin.editing.TextEditingDelta;
//TODO(camillesimon): Remove, using for testing:
import io.flutter.plugin.editing.SpellCheckPlugin;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
Expand Down Expand Up @@ -44,6 +46,9 @@ public class TextInputChannel {
@NonNull public final MethodChannel channel;
@Nullable private TextInputMethodHandler textInputMethodHandler;

//TODO(camillesimon): Remove, using for testing:
@Nullable private SpellCheckMethodHandler spellCheckMethodHandler;

@NonNull @VisibleForTesting
final MethodChannel.MethodCallHandler parsingMethodHandler =
new MethodChannel.MethodCallHandler() {
Expand Down Expand Up @@ -150,7 +155,8 @@ public void onMethodCall(@NonNull MethodCall call, @NonNull MethodChannel.Result
final JSONArray argumentList = (JSONArray) args;
String locale = argumentList.getString(0);
String text = argumentList.getString(1);
textInputMethodHandler.initiateSpellChecking(locale, text);
//TODO(camillesimon): Remove, use for testing
spellCheckMethodHandler.initiateSpellChecking(locale, text);
result.success(null);
} catch (JSONException exception) {
result.error("error", exception.getMessage(), null);
Expand Down Expand Up @@ -372,7 +378,7 @@ public void updateSpellCheckerResults(
int inputClientId, ArrayList<String> spellCheckerResults, String spellCheckedText) {
channel.invokeMethod(
"TextInputClient.updateSpellCheckerResults",
Arrays.asList(inputClientId, spellCheckerResults, spellCheckedText));
Arrays.asList(0, spellCheckerResults, spellCheckedText));
}

/**
Expand All @@ -383,6 +389,19 @@ public void setTextInputMethodHandler(@Nullable TextInputMethodHandler textInput
this.textInputMethodHandler = textInputMethodHandler;
}

//TODO(camillesimon): Remove, using for testing
public void setSpellCheckMethodHandler(@Nullable SpellCheckMethodHandler spellCheckMethodHandler) {
this.spellCheckMethodHandler = spellCheckMethodHandler;
}

public interface SpellCheckMethodHandler {
/**
* Requests that spell checking is initiated for the inputted text recognized by the framework,
* which will automatically result in spell checking resutls being sent back to the framework.
*/
void initiateSpellChecking(String locale, String text);
}

public interface TextInputMethodHandler {
// TODO(mattcarroll): javadoc
void show();
Expand Down
121 changes: 121 additions & 0 deletions shell/platform/android/io/flutter/plugin/editing/SpellCheckPlugin.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
// Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

package io.flutter.plugin.editing;

import android.content.Context;
import android.view.View;
import android.view.textservice.SentenceSuggestionsInfo;
import android.view.textservice.SpellCheckerInfo;
import android.view.textservice.SpellCheckerSession;
import android.view.textservice.SuggestionsInfo;
import android.view.textservice.TextInfo;
import android.view.textservice.TextServicesManager;
import androidx.annotation.NonNull;
import io.flutter.embedding.engine.systemchannels.SpellCheckChannel;
import java.util.ArrayList;
import java.util.Locale;

public class SpellCheckPlugin implements SpellCheckerSession.SpellCheckerSessionListener {

@NonNull private final View mView;
@NonNull private final SpellCheckChannel mSpellCheckChannel;
@NonNull private final TextServicesManager tsm;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit maybe mTextManager?

private SpellCheckerSession mSpellCheckerSession;

// String of spell checked text for testing
private String currentSpellCheckedText;

public SpellCheckPlugin(@NonNull View view, @NonNull SpellCheckChannel spellCheckChannel) {
System.out.println("----------------SpellCheckPlugin INITIATED-------------");
mView = view;
mSpellCheckChannel = spellCheckChannel;
tsm =
(TextServicesManager)
view.getContext().getSystemService(Context.TEXT_SERVICES_MANAGER_SERVICE);

mSpellCheckChannel.setSpellCheckMethodHandler(
new SpellCheckChannel.SpellCheckMethodHandler() {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SpellCheckPlugin could implement this interface, so the wrapping isn't needed

@Override
public void initiateSpellChecking(String locale, String text) {
currentSpellCheckedText = text;
performSpellCheck(locale, text);
}
});
}

// Responsible for calling the Android spell checker API to retrieve spell
// checking results.
public void performSpellCheck(String locale, String text) {
String[] localeCodes = locale.split("-");
Locale localeToUse;

if (localeCodes.length == 3) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what does 3 mean, or 2? consider using constants, since constants can provide meaning to otherwise random values.

localeToUse = new Locale(localeCodes[0], localeCodes[1], localeCodes[2]);
} else if (localeCodes.length == 2) {
localeToUse = new Locale(localeCodes[0], localeCodes[1]);
} else {
localeToUse = new Locale(localeCodes[0]);
}

// Open a new spell checker session when a new text input client is set.
// Closes spell checker session if one previously in use.
// TODO(camillesimon): Figure out proper session management.
if (mSpellCheckerSession != null) {
mSpellCheckerSession.close();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this related to the bug we were looking at where the spell checker would give inconsistent results? So it seems like we start a new session every time the text changes. I think that's right by briefly looking at the android spell check docs. It seems like they want you to keep a session alive if you want to spell check multiple subsets of a larger piece of text? (Probably not a concern of Flutter's right now)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, this is related to that bug. I do agree that this agrees with the flow in this diagram if you are interacting with the Android spell check service directly.

When it comes to larger pieces of text, we can definitely play around with this! Although, by the time this becomes a concern for Flutter, it would probably be more preferable to no longer be spell checking the entirety of the inputted text each time anyways.

mSpellCheckerSession = tsm.newSpellCheckerSession(null, Locale.ENGLISH, this, true);
} else {
mSpellCheckerSession = tsm.newSpellCheckerSession(null, Locale.ENGLISH, this, true);
}
SpellCheckerInfo infoChecker = mSpellCheckerSession.getSpellChecker();

// Define TextInfo[] object (textInfos) based on the current input to be
// spell checked.
TextInfo[] textInfos = new TextInfo[] {new TextInfo(text)};

// Make API call. Maximum suggestions requested set to 3 for now.
System.out.println("----------------SpellCheckPlugin FETCH INITIATED-------------");
mSpellCheckerSession.getSentenceSuggestions(textInfos, 3);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what does 3 mean?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems to be suggestionsLimit (docs). Is that the most suggestions that can be displayed in the menu? If so does the native menu have the same restriction or does it have a way to scroll or overflow?

Maybe for now just make this 3 a constant and explain it in a comment.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, it seems to be 5 (see here). I'll leave a comment to explain!

}

// Responsible for decomposing spell checker results into an object that can
// then be sent to the framework.
@Override
public void onGetSentenceSuggestions(SentenceSuggestionsInfo[] results) {
ArrayList<String> spellCheckerSuggestionSpans = new ArrayList<String>();

for (int i = 0; i < results[0].getSuggestionsCount(); i++) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: check that results at least has a value. can results have more than 1?

SuggestionsInfo suggestionsInfo = results[0].getSuggestionsInfoAt(i);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: maybe results[0] should be a named variable, wdyt?

int suggestionsCount = suggestionsInfo.getSuggestionsCount();

if (suggestionsCount > 0) {
String spellCheckerSuggestionSpan = "";
int start = results[0].getOffsetAt(i);
int length = results[0].getLengthAt(i);

spellCheckerSuggestionSpan += (String.valueOf(start) + ".");
spellCheckerSuggestionSpan += (String.valueOf(start + (length - 1)) + ".");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider documenting the data format that's used here, if it's not already explained somewhere else.


for (int j = 0; j < suggestionsCount; j++) {
String key = "suggestion_" + String.valueOf(j);
spellCheckerSuggestionSpan += (suggestionsInfo.getSuggestionAt(j) + ",");
}

spellCheckerSuggestionSpans.add(
spellCheckerSuggestionSpan.substring(0, spellCheckerSuggestionSpan.length() - 1));
}
}

// Make call to update the spell checker results in the framework.
// Current text being passed for testing purposes.
// TODO(camillesimon): Don't pass text back to framework.
mSpellCheckChannel.updateSpellCheckerResults(
spellCheckerSuggestionSpans, currentSpellCheckedText);
}

@Override
public void onGetSuggestions(SuggestionsInfo[] results) {
// Callback for a deprecated method, so will not use.
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,9 @@ private void setSystemChromeSystemUIOverlayStyle(
WindowInsetsControllerCompat windowInsetsControllerCompat =
new WindowInsetsControllerCompat(window, view);

window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);

// SYSTEM STATUS BAR -------------------------------------------------------------------
// You can't change the color of the system status bar until SDK 21, and you can't change the
// color of the status icons until SDK 23. We only allow both starting at 23 to ensure buttons
Expand Down Expand Up @@ -433,8 +436,6 @@ private void setSystemChromeSystemUIOverlayStyle(
}
// You can't change the color of the navigation bar divider color until SDK 28.
if (systemChromeStyle.systemNavigationBarDividerColor != null && Build.VERSION.SDK_INT >= 28) {
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
window.setNavigationBarDividerColor(systemChromeStyle.systemNavigationBarDividerColor);
}

Expand Down