summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Treehugger Robot <android-test-infra-autosubmit@system.gserviceaccount.com> 2025-01-27 09:24:21 -0800
committer Android (Google) Code Review <android-gerrit@google.com> 2025-01-27 09:24:21 -0800
commit78d84698d47b256ab6da48682774023862f360d4 (patch)
tree10c05b7b04e0fc1e9919f7ee60bb45ecce1dfea0
parent5cecb7f64b5da2db6a629b3ccdb713cbf7d9e2f8 (diff)
parent9f765b7e7f0e700913de8a0a23a353f1ab015900 (diff)
Merge changes from topic "revert-31356655-ZFWTJUPGDA" into main
* changes: Revert "[Improve fill dialog] Get IME updates to autofill" Revert "[Fill Dialog Improvements] Using Ime animation updats"
-rw-r--r--core/java/android/view/IWindowManager.aidl8
-rw-r--r--core/java/android/view/InsetsController.java23
-rw-r--r--core/java/android/view/ViewRootImpl.java53
-rw-r--r--core/java/android/view/ViewRootInsetsControllerHost.java7
-rw-r--r--core/tests/coretests/src/android/view/ViewRootImplTest.java3
-rw-r--r--services/autofill/java/com/android/server/autofill/AutofillManagerService.java76
-rw-r--r--services/autofill/java/com/android/server/autofill/AutofillManagerServiceImpl.java45
-rw-r--r--services/core/java/com/android/server/wm/InsetsPolicy.java4
-rw-r--r--services/core/java/com/android/server/wm/WindowManagerInternal.java19
-rw-r--r--services/core/java/com/android/server/wm/WindowManagerService.java31
10 files changed, 25 insertions, 244 deletions
diff --git a/core/java/android/view/IWindowManager.aidl b/core/java/android/view/IWindowManager.aidl
index 2ec5dbc5612a..f58baffb1367 100644
--- a/core/java/android/view/IWindowManager.aidl
+++ b/core/java/android/view/IWindowManager.aidl
@@ -1146,14 +1146,6 @@ interface IWindowManager
*/
KeyboardShortcutGroup getApplicationLaunchKeyboardShortcuts(int deviceId);
- /*
- * Notifies about IME insets animation.
- *
- * @param running Indicates the insets animation state.
- * @param animationType Indicates the {@link InsetsController.AnimationType}
- */
- oneway void notifyImeInsetsAnimationStateChanged(boolean running, int animationType);
-
/**
* Returns whether the display with {@code displayId} ignores orientation request.
*/
diff --git a/core/java/android/view/InsetsController.java b/core/java/android/view/InsetsController.java
index e097a0764512..c174fbe0bbcd 100644
--- a/core/java/android/view/InsetsController.java
+++ b/core/java/android/view/InsetsController.java
@@ -214,14 +214,9 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation
* Notifies when the state of running animation is changed. The state is either "running" or
* "idle".
*
- * @param running {@code true} if the given insets types start running
- * {@code false} otherwise.
- * @param animationType {@link AnimationType}
- * @param insetsTypes {@link Type}.
+ * @param running {@code true} if there is any animation running; {@code false} otherwise.
*/
- default void notifyAnimationRunningStateChanged(boolean running,
- @AnimationType int animationType, @InsetsType int insetsTypes) {
- }
+ default void notifyAnimationRunningStateChanged(boolean running) {}
/** @see ViewRootImpl#isHandlingPointerEvent */
default boolean isHandlingPointerEvent() {
@@ -749,8 +744,9 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation
final InsetsAnimationControlRunner runner = new InsetsResizeAnimationRunner(
mFrame, mFromState, mToState, RESIZE_INTERPOLATOR,
ANIMATION_DURATION_RESIZE, mTypes, InsetsController.this);
- mHost.notifyAnimationRunningStateChanged(true,
- runner.getAnimationType(), mTypes);
+ if (mRunningAnimations.isEmpty()) {
+ mHost.notifyAnimationRunningStateChanged(true);
+ }
mRunningAnimations.add(new RunningAnimation(runner, runner.getAnimationType()));
}
};
@@ -1564,7 +1560,9 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation
}
}
ImeTracker.forLogging().onProgress(statsToken, ImeTracker.PHASE_CLIENT_ANIMATION_RUNNING);
- mHost.notifyAnimationRunningStateChanged(true, animationType, types);
+ if (mRunningAnimations.isEmpty()) {
+ mHost.notifyAnimationRunningStateChanged(true);
+ }
mRunningAnimations.add(new RunningAnimation(runner, animationType));
if (DEBUG) Log.d(TAG, "Animation added to runner. useInsetsAnimationThread: "
+ useInsetsAnimationThread);
@@ -1844,8 +1842,9 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation
break;
}
}
- mHost.notifyAnimationRunningStateChanged(
- false, control.getAnimationType(), removedTypes);
+ if (mRunningAnimations.isEmpty()) {
+ mHost.notifyAnimationRunningStateChanged(false);
+ }
onAnimationStateChanged(removedTypes, false /* running */);
}
diff --git a/core/java/android/view/ViewRootImpl.java b/core/java/android/view/ViewRootImpl.java
index 7c5b300e9d24..cd8a85a66c1a 100644
--- a/core/java/android/view/ViewRootImpl.java
+++ b/core/java/android/view/ViewRootImpl.java
@@ -24,7 +24,6 @@ import static android.graphics.HardwareRenderer.SYNC_CONTEXT_IS_STOPPED;
import static android.graphics.HardwareRenderer.SYNC_LOST_SURFACE_REWARD_IF_FOUND;
import static android.os.IInputConstants.INVALID_INPUT_EVENT_ID;
import static android.os.Trace.TRACE_TAG_VIEW;
-import static android.service.autofill.Flags.improveFillDialogAconfig;
import static android.util.SequenceUtils.getInitSeq;
import static android.util.SequenceUtils.isIncomingSeqStale;
import static android.view.Display.DEFAULT_DISPLAY;
@@ -923,8 +922,6 @@ public final class ViewRootImpl implements ViewParent,
private boolean mInsetsAnimationRunning;
- private int mInsetsAnimatingTypes = 0;
-
private long mPreviousFrameDrawnTime = -1;
// The largest view size percentage to the display size. Used on trace to collect metric.
private float mLargestChildPercentage = 0.0f;
@@ -2523,49 +2520,17 @@ public final class ViewRootImpl implements ViewParent,
* Notify the when the running state of a insets animation changed.
*/
@VisibleForTesting
- public void notifyInsetsAnimationRunningStateChanged(boolean running,
- @InsetsController.AnimationType int animationType,
- @InsetsType int insetsTypes) {
- @InsetsType int previousInsetsType = mInsetsAnimatingTypes;
- // If improveFillDialogAconfig is disabled, we notify WindowSession of all the updates we
- // receive here
- boolean notifyWindowSession = !improveFillDialogAconfig();
- if (running) {
- mInsetsAnimatingTypes |= insetsTypes;
- } else {
- mInsetsAnimatingTypes &= ~insetsTypes;
- }
+ public void notifyInsetsAnimationRunningStateChanged(boolean running) {
if (sToolkitSetFrameRateReadOnlyFlagValue) {
- mInsetsAnimationRunning = running;
- // If improveFillDialogAconfig is enabled, we need to confirm other animations aren't
- // running to maintain the existing behavior. System server were notified previously
- // only when animation started running or stopped when there were no running animations.
- if (improveFillDialogAconfig()) {
- if ((previousInsetsType == 0 && mInsetsAnimatingTypes != 0)
- || (previousInsetsType != 0 && mInsetsAnimatingTypes == 0)) {
- notifyWindowSession = true;
- }
- }
- if (notifyWindowSession) {
- if (Trace.isTagEnabled(Trace.TRACE_TAG_VIEW)) {
- Trace.instant(Trace.TRACE_TAG_VIEW,
- TextUtils.formatSimple("notifyInsetsAnimationRunningStateChanged(%s)",
- Boolean.toString(running)));
- }
- try {
- mWindowSession.notifyInsetsAnimationRunningStateChanged(mWindow, running);
- } catch (RemoteException e) {
- }
+ if (Trace.isTagEnabled(Trace.TRACE_TAG_VIEW)) {
+ Trace.instant(Trace.TRACE_TAG_VIEW,
+ TextUtils.formatSimple("notifyInsetsAnimationRunningStateChanged(%s)",
+ Boolean.toString(running)));
}
- }
- if (improveFillDialogAconfig()) {
- // Update WindowManager for ImeAnimation
- if ((insetsTypes & WindowInsets.Type.ime()) != 0) {
- try {
- WindowManagerGlobal.getWindowManagerService()
- .notifyImeInsetsAnimationStateChanged(running, animationType);
- } catch (RemoteException e) {
- }
+ mInsetsAnimationRunning = running;
+ try {
+ mWindowSession.notifyInsetsAnimationRunningStateChanged(mWindow, running);
+ } catch (RemoteException e) {
}
}
}
diff --git a/core/java/android/view/ViewRootInsetsControllerHost.java b/core/java/android/view/ViewRootInsetsControllerHost.java
index f1666dbebd7b..889acca4b8b1 100644
--- a/core/java/android/view/ViewRootInsetsControllerHost.java
+++ b/core/java/android/view/ViewRootInsetsControllerHost.java
@@ -275,12 +275,9 @@ public class ViewRootInsetsControllerHost implements InsetsController.Host {
}
@Override
- public void notifyAnimationRunningStateChanged(boolean running,
- @InsetsController.AnimationType int animationType,
- @WindowInsets.Type.InsetsType int insetsTypes) {
+ public void notifyAnimationRunningStateChanged(boolean running) {
if (mViewRoot != null) {
- mViewRoot.notifyInsetsAnimationRunningStateChanged(
- running, animationType, insetsTypes);
+ mViewRoot.notifyInsetsAnimationRunningStateChanged(running);
}
}
diff --git a/core/tests/coretests/src/android/view/ViewRootImplTest.java b/core/tests/coretests/src/android/view/ViewRootImplTest.java
index cef6970ba25a..c40137f1bd34 100644
--- a/core/tests/coretests/src/android/view/ViewRootImplTest.java
+++ b/core/tests/coretests/src/android/view/ViewRootImplTest.java
@@ -1054,8 +1054,7 @@ public class ViewRootImplTest {
ViewRootImpl viewRootImpl = mView.getViewRootImpl();
sInstrumentation.runOnMainSync(() -> {
mView.invalidate();
- viewRootImpl.notifyInsetsAnimationRunningStateChanged(true, 0 /* animationType */,
- 0 /* insetsTypes */ /* areOtherAnimationsRunning */);
+ viewRootImpl.notifyInsetsAnimationRunningStateChanged(true);
mView.invalidate();
});
sInstrumentation.waitForIdleSync();
diff --git a/services/autofill/java/com/android/server/autofill/AutofillManagerService.java b/services/autofill/java/com/android/server/autofill/AutofillManagerService.java
index 25494fce9fbf..c68e54956c99 100644
--- a/services/autofill/java/com/android/server/autofill/AutofillManagerService.java
+++ b/services/autofill/java/com/android/server/autofill/AutofillManagerService.java
@@ -19,7 +19,6 @@ package com.android.server.autofill;
import static android.Manifest.permission.MANAGE_AUTO_FILL;
import static android.content.Context.AUTOFILL_MANAGER_SERVICE;
import static android.service.autofill.Flags.fixGetAutofillComponent;
-import static android.service.autofill.Flags.improveFillDialogAconfig;
import static android.view.autofill.AutofillManager.MAX_TEMP_AUGMENTED_SERVICE_DURATION_MS;
import static android.view.autofill.AutofillManager.getSmartSuggestionModeToString;
@@ -71,7 +70,6 @@ import android.util.Slog;
import android.util.SparseArray;
import android.util.SparseBooleanArray;
import android.util.TimeUtils;
-import android.view.InsetsController;
import android.view.autofill.AutofillFeatureFlags;
import android.view.autofill.AutofillId;
import android.view.autofill.AutofillManager;
@@ -98,7 +96,6 @@ import com.android.server.autofill.ui.AutoFillUI;
import com.android.server.infra.AbstractMasterSystemService;
import com.android.server.infra.FrameworkResourcesServiceNameResolver;
import com.android.server.infra.SecureSettingsServiceNameResolver;
-import com.android.server.wm.WindowManagerInternal;
import java.io.FileDescriptor;
import java.io.PrintWriter;
@@ -246,8 +243,6 @@ public final class AutofillManagerService
private static final boolean DEFAULT_PCC_USE_FALLBACK = true;
- private static final boolean DBG = false;
-
public AutofillManagerService(Context context) {
super(context,
new SecureSettingsServiceNameResolver(context, Settings.Secure.AUTOFILL_SERVICE),
@@ -306,79 +301,8 @@ public final class AutofillManagerService
mCredentialAutofillService = null;
Slog.w(TAG, "Invalid CredentialAutofillService");
}
-
- if (improveFillDialogAconfig()) {
- WindowManagerInternal windowManagerInternal = LocalServices.getService(
- WindowManagerInternal.class);
- WindowManagerInternal.ImeInsetsAnimationChangeListener
- imeInsetsAnimationChangeListener =
- new WindowManagerInternal.ImeInsetsAnimationChangeListener() {
- @Override
- public void onAnimationStart(
- @InsetsController.AnimationType int animationType, int userId) {
- if (DBG) {
- Slog.e(TAG,
- "onAnimationStart() notifyImeAnimationStart() "
- + "animationType:"
- + String.valueOf(animationType));
- }
- synchronized (mLock) {
-
- // We are mostly interested in animations that show up the IME
- if (animationType == InsetsController.ANIMATION_TYPE_HIDE) {
- // IME is going away
- mIsImeShowing = false;
- }
- if (animationType != InsetsController.ANIMATION_TYPE_SHOW) {
- return;
- }
- mIsImeShowing = true;
- mImeAnimatingWhileShowingUp = true;
- final AutofillManagerServiceImpl service =
- peekServiceForUserWithLocalBinderIdentityLocked(userId);
- if (service != null) {
- service.notifyImeAnimationStart();
- } else if (sVerbose) {
- Slog.v(TAG,
- "notifyImeAnimationStart(): no service for " + userId);
- }
- }
- }
-
- @Override
- public void onAnimationEnd(
- @InsetsController.AnimationType int animationType, int userId) {
- if (DBG) {
- Slog.e(TAG,
- "onAnimationEnd() notifyImeAnimationEnd() "
- + "animationType:"
- + String.valueOf(animationType));
- }
- // We are only interested in animations that show up the IME
- if (animationType != InsetsController.ANIMATION_TYPE_SHOW) {
- return;
- }
- mImeAnimatingWhileShowingUp = false;
- synchronized (mLock) {
- final AutofillManagerServiceImpl service =
- peekServiceForUserWithLocalBinderIdentityLocked(userId);
- if (service != null) {
- service.notifyImeAnimationEnd();
- } else if (sVerbose) {
- Slog.v(TAG, "notifyImeAnimationEnd(): no service for "
- + userId);
- }
- }
- }
- };
- windowManagerInternal.setImeInsetsAnimationChangeListener(
- imeInsetsAnimationChangeListener);
- }
}
- public boolean mImeAnimatingWhileShowingUp = false;
- public boolean mIsImeShowing = false;
-
@Override // from AbstractMasterSystemService
protected String getServiceSettingsProperty() {
return Settings.Secure.AUTOFILL_SERVICE;
diff --git a/services/autofill/java/com/android/server/autofill/AutofillManagerServiceImpl.java b/services/autofill/java/com/android/server/autofill/AutofillManagerServiceImpl.java
index eda62334ff39..b39b5b1a7660 100644
--- a/services/autofill/java/com/android/server/autofill/AutofillManagerServiceImpl.java
+++ b/services/autofill/java/com/android/server/autofill/AutofillManagerServiceImpl.java
@@ -209,11 +209,6 @@ final class AutofillManagerServiceImpl
private final DisabledInfoCache mDisabledInfoCache;
- // Tracks active session id. There is no guarantee that such a session exists. For eg, if the
- // session is destroyed, the id may no longer be valid. We don't update the state in all the
- // cases.
- private int mActiveSessionId = NO_SESSION;
-
AutofillManagerServiceImpl(AutofillManagerService master, Object lock,
LocalLog uiLatencyHistory, LocalLog wtfHistory, int userId, AutoFillUI ui,
AutofillCompatState autofillCompatState,
@@ -392,7 +387,6 @@ final class AutofillManagerServiceImpl
@NonNull Rect virtualBounds, @Nullable AutofillValue value, boolean hasCallback,
@NonNull ComponentName clientActivity, boolean compatMode,
boolean bindInstantServiceAllowed, int flags) {
- mActiveSessionId = NO_SESSION;
// FLAG_AUGMENTED_AUTOFILL_REQUEST is set in the flags when standard autofill is disabled
// but the package is allowlisted for augmented autofill
boolean forAugmentedAutofillOnly = (flags
@@ -451,7 +445,6 @@ final class AutofillManagerServiceImpl
if (newSession == null) {
return NO_SESSION;
}
- mActiveSessionId = newSession.id;
// Service can be null when it's only for augmented autofill
String servicePackageName = mInfo == null ? null : mInfo.getServiceInfo().packageName;
@@ -755,7 +748,6 @@ final class AutofillManagerServiceImpl
Slog.d(TAG, "restarting session " + sessionId + " due to manual request on "
+ autofillId);
}
- mActiveSessionId = sessionId;
return true;
}
if (sVerbose) {
@@ -765,8 +757,6 @@ final class AutofillManagerServiceImpl
return false;
}
-
- mActiveSessionId = sessionId;
session.updateLocked(autofillId, virtualBounds, value, action, flags);
return false;
}
@@ -886,54 +876,21 @@ final class AutofillManagerServiceImpl
}
@GuardedBy("mLock")
- public void notifyImeAnimationStart() {
- if (!isEnabledLocked()) {
- Slog.wtf(TAG, "Service not enabled");
- return;
- }
- final Session session = mSessions.get(mActiveSessionId);
- if (session == null) {
- Slog.v(TAG, "notifyImeAnimationEnd(): no session for " + mActiveSessionId);
- return;
- }
- session.notifyImeAnimationStart(SystemClock.elapsedRealtime());
- }
-
- @GuardedBy("mLock")
public void notifyImeAnimationEnd(int sessionId, long endTimeMs, int uid) {
if (!isEnabledLocked()) {
Slog.wtf(TAG, "Service not enabled");
return;
}
final Session session = mSessions.get(sessionId);
- if (session == null) {
+ if (session == null || uid != session.uid) {
Slog.v(TAG, "notifyImeAnimationEnd(): no session for "
+ sessionId + "(" + uid + ")");
return;
}
- if (uid != session.uid) {
- Slog.v(TAG, "notifyImeAnimationEnd(): Mismatched session id's "
- + sessionId + "(" + uid + ")");
- return;
- }
session.notifyImeAnimationEnd(endTimeMs);
}
@GuardedBy("mLock")
- public void notifyImeAnimationEnd() {
- if (!isEnabledLocked()) {
- Slog.wtf(TAG, "Service not enabled");
- return;
- }
- final Session session = mSessions.get(mActiveSessionId);
- if (session == null) {
- Slog.v(TAG, "notifyImeAnimationEnd(): no session for " + mActiveSessionId);
- return;
- }
- session.notifyImeAnimationEnd(SystemClock.elapsedRealtime());
- }
-
- @GuardedBy("mLock")
@Override // from PerUserSystemService
protected void handlePackageUpdateLocked(@NonNull String packageName) {
final ServiceInfo serviceInfo = mFieldClassificationStrategy.getServiceInfo();
diff --git a/services/core/java/com/android/server/wm/InsetsPolicy.java b/services/core/java/com/android/server/wm/InsetsPolicy.java
index f465c95addb7..4bcba13448e9 100644
--- a/services/core/java/com/android/server/wm/InsetsPolicy.java
+++ b/services/core/java/com/android/server/wm/InsetsPolicy.java
@@ -899,9 +899,7 @@ class InsetsPolicy {
}
@Override
- public void notifyAnimationRunningStateChanged(boolean running,
- @InsetsController.AnimationType int animationType,
- @InsetsType int insetsTypes) {
+ public void notifyAnimationRunningStateChanged(boolean running) {
mInsetsAnimationRunning = running;
}
}
diff --git a/services/core/java/com/android/server/wm/WindowManagerInternal.java b/services/core/java/com/android/server/wm/WindowManagerInternal.java
index 7a8230f1f963..c77b1d9a7bcf 100644
--- a/services/core/java/com/android/server/wm/WindowManagerInternal.java
+++ b/services/core/java/com/android/server/wm/WindowManagerInternal.java
@@ -41,7 +41,6 @@ import android.view.Display;
import android.view.IInputFilter;
import android.view.IRemoteAnimationFinishedCallback;
import android.view.IWindow;
-import android.view.InsetsController;
import android.view.MagnificationSpec;
import android.view.RemoteAnimationTarget;
import android.view.Surface;
@@ -470,24 +469,6 @@ public abstract class WindowManagerInternal {
public abstract void getMagnificationRegion(int displayId, @NonNull Region magnificationRegion);
/**
- * Set by the autofill service to observe changes in the ime animations.
- *
- * @param listener The callbacks to invoke.
- */
- public abstract void setImeInsetsAnimationChangeListener(
- @Nullable ImeInsetsAnimationChangeListener listener);
-
- /** Listener for changes in ime insets animation */
- public interface ImeInsetsAnimationChangeListener {
-
- /** Notify on start of animation */
- void onAnimationStart(@InsetsController.AnimationType int animationType, int userId);
-
- /** Notify on end of animation */
- void onAnimationEnd(@InsetsController.AnimationType int animationType, int userId);
- }
-
- /**
* Sets a callback for observing which windows are touchable for the purposes
* of accessibility on specified display.
*
diff --git a/services/core/java/com/android/server/wm/WindowManagerService.java b/services/core/java/com/android/server/wm/WindowManagerService.java
index 28ea3b0bf6ba..3a1d652f82d4 100644
--- a/services/core/java/com/android/server/wm/WindowManagerService.java
+++ b/services/core/java/com/android/server/wm/WindowManagerService.java
@@ -16,7 +16,6 @@
package com.android.server.wm;
-import static android.service.autofill.Flags.improveFillDialogAconfig;
import static android.Manifest.permission.ACCESS_SURFACE_FLINGER;
import static android.Manifest.permission.CONTROL_REMOTE_APP_TRANSITION_ANIMATIONS;
import static android.Manifest.permission.INPUT_CONSUMER;
@@ -278,7 +277,6 @@ import android.view.InputApplicationHandle;
import android.view.InputChannel;
import android.view.InputDevice;
import android.view.InputWindowHandle;
-import android.view.InsetsController;
import android.view.InsetsFrameProvider;
import android.view.InsetsSourceControl;
import android.view.InsetsState;
@@ -795,9 +793,6 @@ public class WindowManagerService extends IWindowManager.Stub
final TrustedPresentationListenerController mTrustedPresentationListenerController =
new TrustedPresentationListenerController();
- private WindowManagerInternal.ImeInsetsAnimationChangeListener
- mImeInsetsAnimationChangeListener;
-
@VisibleForTesting
final class SettingsObserver extends ContentObserver {
private final Uri mDisplayInversionEnabledUri =
@@ -8627,14 +8622,6 @@ public class WindowManagerService extends IWindowManager.Stub
// WMS.takeAssistScreenshot takes care of the locking.
return WindowManagerService.this.takeAssistScreenshot(windowTypesToExclude);
}
-
- @Override
- public void setImeInsetsAnimationChangeListener(
- @Nullable WindowManagerInternal.ImeInsetsAnimationChangeListener listener) {
- synchronized (mGlobalLock) {
- mImeInsetsAnimationChangeListener = listener;
- }
- }
}
private final class ImeTargetVisibilityPolicyImpl extends ImeTargetVisibilityPolicy {
@@ -10192,24 +10179,6 @@ public class WindowManagerService extends IWindowManager.Stub
}
}
- @Override
- public void notifyImeInsetsAnimationStateChanged(
- boolean running, @InsetsController.AnimationType int animationType) {
- if (improveFillDialogAconfig()) {
- synchronized (mGlobalLock) {
- if (mImeInsetsAnimationChangeListener == null) {
- return;
- }
- if (running) {
- mImeInsetsAnimationChangeListener.onAnimationStart(
- animationType, mCurrentUserId);
- } else {
- mImeInsetsAnimationChangeListener.onAnimationEnd(animationType, mCurrentUserId);
- }
- }
- }
- }
-
boolean getDisableSecureWindows() {
return mDisableSecureWindows;
}