Skip to content

Commit

Permalink
Revert "Reland: Fix first batch of warnings in the Android embedding (#…
Browse files Browse the repository at this point in the history
…31530)"

This reverts commit b5f48f5.
  • Loading branch information
Emmanuel Garcia authored Feb 23, 2022
1 parent fa29cf4 commit 36d509a
Show file tree
Hide file tree
Showing 40 changed files with 147 additions and 291 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -878,7 +878,7 @@ public InputConnection onCreateInputConnection(@NonNull EditorInfo outAttrs) {
* previous {@code keyCode} to generate a unicode combined character.
*/
@Override
public boolean dispatchKeyEvent(@NonNull KeyEvent event) {
public boolean dispatchKeyEvent(KeyEvent event) {
if (event.getAction() == KeyEvent.ACTION_DOWN && event.getRepeatCount() == 0) {
// Tell Android to start tracking this event.
getKeyDispatcherState().startTracking(event, this);
Expand Down Expand Up @@ -987,7 +987,6 @@ public AccessibilityNodeProvider getAccessibilityNodeProvider() {
* @return The view matching the accessibility id if any.
*/
@SuppressLint("SoonBlockedPrivateApi")
@Nullable
public View findViewByAccessibilityIdTraversal(int accessibilityId) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.Q) {
return findViewByAccessibilityIdRootedAtCurrentView(accessibilityId, this);
Expand Down Expand Up @@ -1334,7 +1333,7 @@ public void onFlutterUiNoLongerDisplayed() {
});
}

public void attachOverlaySurfaceToRender(@NonNull FlutterImageView view) {
public void attachOverlaySurfaceToRender(FlutterImageView view) {
if (flutterEngine != null) {
view.attachToRenderer(flutterEngine.getRenderer());
}
Expand Down Expand Up @@ -1435,13 +1434,13 @@ private void sendViewportMetricsToFlutter() {
}

@Override
public void onProvideAutofillVirtualStructure(@NonNull ViewStructure structure, int flags) {
public void onProvideAutofillVirtualStructure(ViewStructure structure, int flags) {
super.onProvideAutofillVirtualStructure(structure, flags);
textInputPlugin.onProvideAutofillVirtualStructure(structure, flags);
}

@Override
public void autofill(@NonNull SparseArray<AutofillValue> values) {
public void autofill(SparseArray<AutofillValue> values) {
textInputPlugin.autofill(values);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,7 @@ public class KeyboardManager {
* dispatched to.
*/
public KeyboardManager(
@NonNull View view,
@NonNull TextInputPlugin textInputPlugin,
@NonNull Responder[] responders) {
View view, @NonNull TextInputPlugin textInputPlugin, Responder[] responders) {
this.view = view;
this.textInputPlugin = textInputPlugin;
this.responders = responders;
Expand All @@ -105,7 +103,7 @@ public KeyboardManager(
*/
interface Responder {
interface OnKeyEventHandledCallback {
void onKeyEventHandled(boolean canHandleEvent);
void onKeyEventHandled(Boolean canHandleEvent);
}

/**
Expand All @@ -124,7 +122,7 @@ private class Callback implements OnKeyEventHandledCallback {
boolean isCalled = false;

@Override
public void onKeyEventHandled(boolean canHandleEvent) {
public void onKeyEventHandled(Boolean canHandleEvent) {
if (isCalled) {
throw new IllegalStateException(
"The onKeyEventHandledCallback should be called exactly once.");
Expand All @@ -142,7 +140,7 @@ public void onKeyEventHandled(boolean canHandleEvent) {
this.keyEvent = keyEvent;
}

final KeyEvent keyEvent;
@NonNull final KeyEvent keyEvent;
int unrepliedCount = responders.length;
boolean isEventHandled = false;

Expand All @@ -151,9 +149,9 @@ public OnKeyEventHandledCallback buildCallback() {
}
}

protected final Responder[] responders;
private final HashSet<KeyEvent> redispatchedEvents = new HashSet<>();
private final TextInputPlugin textInputPlugin;
@NonNull protected final Responder[] responders;
@NonNull private final HashSet<KeyEvent> redispatchedEvents = new HashSet<>();
@NonNull private final TextInputPlugin textInputPlugin;
private final View view;

public boolean handleEvent(@NonNull KeyEvent keyEvent) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import android.util.LongSparseArray;
import android.view.MotionEvent;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import java.util.PriorityQueue;
import java.util.concurrent.atomic.AtomicLong;
Expand All @@ -19,12 +18,10 @@ private MotionEventId(long id) {
this.id = id;
}

@NonNull
public static MotionEventId from(long id) {
return new MotionEventId(id);
}

@NonNull
public static MotionEventId createUnique() {
return MotionEventId.from(ID_COUNTER.incrementAndGet());
}
Expand All @@ -38,7 +35,6 @@ public long getId() {
private final PriorityQueue<Long> unusedEvents;
private static MotionEventTracker INSTANCE;

@NonNull
public static MotionEventTracker getInstance() {
if (INSTANCE == null) {
INSTANCE = new MotionEventTracker();
Expand All @@ -52,8 +48,7 @@ private MotionEventTracker() {
}

/** Tracks the event and returns a unique MotionEventId identifying the event. */
@NonNull
public MotionEventId track(@NonNull MotionEvent event) {
public MotionEventId track(MotionEvent event) {
MotionEventId eventId = MotionEventId.createUnique();
eventById.put(eventId.id, MotionEvent.obtain(event));
unusedEvents.add(eventId.id);
Expand All @@ -66,7 +61,7 @@ public MotionEventId track(@NonNull MotionEvent event) {
* popped or discarded.
*/
@Nullable
public MotionEvent pop(@NonNull MotionEventId eventId) {
public MotionEvent pop(MotionEventId eventId) {
// remove all the older events.
while (!unusedEvents.isEmpty() && unusedEvents.peek() < eventId.id) {
eventById.remove(unusedEvents.poll());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public class PlayStoreDeferredComponentManager implements DeferredComponentManag

private class FeatureInstallStateUpdatedListener implements SplitInstallStateUpdatedListener {
@SuppressLint("DefaultLocale")
public void onStateUpdate(@NonNull SplitInstallSessionState state) {
public void onStateUpdate(SplitInstallSessionState state) {
int sessionId = state.sessionId();
if (sessionIdToName.get(sessionId) != null) {
switch (state.status()) {
Expand Down Expand Up @@ -231,7 +231,7 @@ private boolean verifyJNI() {
return true;
}

public void setDeferredComponentChannel(@NonNull DeferredComponentChannel channel) {
public void setDeferredComponentChannel(DeferredComponentChannel channel) {
this.channel = channel;
}

Expand Down Expand Up @@ -288,7 +288,7 @@ private void initLoadingUnitMappingToComponentNames() {
}
}

public void installDeferredComponent(int loadingUnitId, @Nullable String componentName) {
public void installDeferredComponent(int loadingUnitId, String componentName) {
String resolvedComponentName =
componentName != null ? componentName : loadingUnitIdToComponentNames.get(loadingUnitId);
if (resolvedComponentName == null) {
Expand Down Expand Up @@ -357,9 +357,7 @@ public void installDeferredComponent(int loadingUnitId, @Nullable String compone
});
}

@NonNull
public String getDeferredComponentInstallState(
int loadingUnitId, @Nullable String componentName) {
public String getDeferredComponentInstallState(int loadingUnitId, String componentName) {
String resolvedComponentName =
componentName != null ? componentName : loadingUnitIdToComponentNames.get(loadingUnitId);
if (resolvedComponentName == null) {
Expand All @@ -377,7 +375,7 @@ public String getDeferredComponentInstallState(
return sessionIdToState.get(sessionId);
}

public void loadAssets(int loadingUnitId, @NonNull String componentName) {
public void loadAssets(int loadingUnitId, String componentName) {
if (!verifyJNI()) {
return;
}
Expand All @@ -395,7 +393,7 @@ public void loadAssets(int loadingUnitId, @NonNull String componentName) {
}
}

public void loadDartLibrary(int loadingUnitId, @NonNull String componentName) {
public void loadDartLibrary(int loadingUnitId, String componentName) {
if (!verifyJNI()) {
return;
}
Expand Down Expand Up @@ -480,7 +478,7 @@ public void loadDartLibrary(int loadingUnitId, @NonNull String componentName) {
loadingUnitId, searchPaths.toArray(new String[searchPaths.size()]));
}

public boolean uninstallDeferredComponent(int loadingUnitId, @Nullable String componentName) {
public boolean uninstallDeferredComponent(int loadingUnitId, String componentName) {
String resolvedComponentName =
componentName != null ? componentName : loadingUnitIdToComponentNames.get(loadingUnitId);
if (resolvedComponentName == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,7 @@ public ShimPluginRegistry(@NonNull FlutterEngine flutterEngine) {
}

@Override
@NonNull
public Registrar registrarFor(@NonNull String pluginKey) {
public Registrar registrarFor(String pluginKey) {
Log.v(TAG, "Creating plugin Registrar for '" + pluginKey + "'");
if (pluginMap.containsKey(pluginKey)) {
throw new IllegalStateException("Plugin key " + pluginKey + " is already in use");
Expand All @@ -61,13 +60,13 @@ public Registrar registrarFor(@NonNull String pluginKey) {
}

@Override
public boolean hasPlugin(@NonNull String pluginKey) {
public boolean hasPlugin(String pluginKey) {
return pluginMap.containsKey(pluginKey);
}

@Override
@SuppressWarnings("unchecked")
public <T> T valuePublishedByPlugin(@NonNull String pluginKey) {
public <T> T valuePublishedByPlugin(String pluginKey) {
return (T) pluginMap.get(pluginKey);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public void detachFromGLContext() {

// Called by native.
@SuppressWarnings("unused")
public void getTransformMatrix(@NonNull float[] mtx) {
public void getTransformMatrix(float[] mtx) {
surfaceTexture.getTransformMatrix(mtx);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,6 @@ public interface LocalizationMessageHandler {
* The Flutter application would like to obtain the string resource of given {@code key} in
* {@code locale}.
*/
@NonNull
String getStringResource(@NonNull String key, @NonNull String locale);
String getStringResource(@NonNull String key, String locale);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
package io.flutter.embedding.engine.systemchannels;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import io.flutter.Log;
import io.flutter.embedding.engine.dart.DartExecutor;
import io.flutter.plugin.common.MethodCall;
Expand Down Expand Up @@ -73,13 +72,12 @@ public RestorationChannel(
private boolean frameworkHasRequestedData = false;

/** Obtain the most current restoration data that the framework has provided. */
@Nullable
public byte[] getRestorationData() {
return restorationData;
}

/** Set the restoration data from which the framework will restore its state. */
public void setRestorationData(@NonNull byte[] data) {
public void setRestorationData(byte[] data) {
engineHasProvidedData = true;
if (pendingFrameworkRestorationChannelRequest != null) {
// If their is a pending request from the framework, answer it.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ private static HashMap<Object, Object> createEditingDeltaJSON(
*/
public void updateEditingState(
int inputClientId,
@NonNull String text,
String text,
int selectionStart,
int selectionEnd,
int composingStart,
Expand Down Expand Up @@ -233,7 +233,7 @@ public void updateEditingState(
}

public void updateEditingStateWithDeltas(
int inputClientId, @NonNull ArrayList<TextEditingDelta> batchDeltas) {
int inputClientId, ArrayList<TextEditingDelta> batchDeltas) {

Log.v(
TAG,
Expand All @@ -248,7 +248,7 @@ public void updateEditingStateWithDeltas(
}

public void updateEditingStateWithTag(
int inputClientId, @NonNull HashMap<String, TextEditState> editStates) {
int inputClientId, HashMap<String, TextEditState> editStates) {
Log.v(
TAG,
"Sending message to update editing state for "
Expand Down Expand Up @@ -323,8 +323,7 @@ public void unspecifiedAction(int inputClientId) {
Arrays.asList(inputClientId, "TextInputAction.unspecified"));
}

public void performPrivateCommand(
int inputClientId, @NonNull String action, @NonNull Bundle data) {
public void performPrivateCommand(int inputClientId, String action, Bundle data) {
HashMap<Object, Object> json = new HashMap<>();
json.put("action", action);
if (data != null) {
Expand Down Expand Up @@ -412,7 +411,7 @@ public interface TextInputMethodHandler {
* @param transform a 4x4 matrix that maps the local paint coordinate system to coordinate
* system of the FlutterView that owns the current client.
*/
void setEditableSizeAndTransform(double width, double height, @NonNull double[] transform);
void setEditableSizeAndTransform(double width, double height, double[] transform);

// TODO(mattcarroll): javadoc
void setEditingState(@NonNull TextEditState editingState);
Expand All @@ -429,12 +428,11 @@ public interface TextInputMethodHandler {
* commands.
* @param data Any data to include with the command.
*/
void sendAppPrivateCommand(@NonNull String action, @NonNull Bundle data);
void sendAppPrivateCommand(String action, Bundle data);
}

/** A text editing configuration. */
public static class Configuration {
@NonNull
public static Configuration fromJson(@NonNull JSONObject json)
throws JSONException, NoSuchFieldException {
final String inputActionName = json.getString("inputAction");
Expand Down Expand Up @@ -492,7 +490,6 @@ private static Integer inputActionFromTextInputAction(@NonNull String inputActio
}

public static class Autofill {
@NonNull
public static Autofill fromJson(@NonNull JSONObject json)
throws JSONException, NoSuchFieldException {
final String uniqueIdentifier = json.getString("uniqueIdentifier");
Expand Down Expand Up @@ -728,7 +725,6 @@ static TextCapitalization fromValue(@NonNull String encodedName) throws NoSuchFi

/** State of an on-going text editing session. */
public static class TextEditState {
@NonNull
public static TextEditState fromJson(@NonNull JSONObject textEditState) throws JSONException {
return new TextEditState(
textEditState.getString("text"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

package io.flutter.plugin.common;

import androidx.annotation.Nullable;
import java.nio.ByteBuffer;
import org.json.JSONException;
import org.json.JSONObject;
Expand All @@ -29,8 +28,7 @@ public final class JSONMessageCodec implements MessageCodec<Object> {
private JSONMessageCodec() {}

@Override
@Nullable
public ByteBuffer encodeMessage(@Nullable Object message) {
public ByteBuffer encodeMessage(Object message) {
if (message == null) {
return null;
}
Expand All @@ -43,8 +41,7 @@ public ByteBuffer encodeMessage(@Nullable Object message) {
}

@Override
@Nullable
public Object decodeMessage(@Nullable ByteBuffer message) {
public Object decodeMessage(ByteBuffer message) {
if (message == null) {
return null;
}
Expand Down
Loading

0 comments on commit 36d509a

Please sign in to comment.