Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 235a0bf9 authored by Charles Chen's avatar Charles Chen Committed by Android (Google) Code Review
Browse files

Merge changes from topic "ime_migration" into sc-v2-dev

* changes:
  Move IME log to WindowTokenClient
  Migrate InputMethodService to WindowProviderService
parents 534ea6b9 79cb3c52
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -1270,6 +1270,12 @@ package android.hardware.soundtrigger {

package android.inputmethodservice {

  public abstract class AbstractInputMethodService extends android.window.WindowProviderService implements android.view.KeyEvent.Callback {
    method public final int getInitialDisplayId();
    method @Nullable public final android.os.Bundle getWindowContextOptions();
    method public final int getWindowType();
  }

  @UiContext public class InputMethodService extends android.inputmethodservice.AbstractInputMethodService {
    field public static final long FINISH_INPUT_NO_FALLBACK_CONNECTION = 156215187L; // 0x94fa793L
  }
@@ -3243,6 +3249,7 @@ package android.window {
  @UiContext public abstract class WindowProviderService extends android.app.Service {
    ctor public WindowProviderService();
    method public final void attachToWindowToken(@NonNull android.os.IBinder);
    method @NonNull public int getInitialDisplayId();
    method @Nullable public android.os.Bundle getWindowContextOptions();
    method public abstract int getWindowType();
  }
+0 −15
Original line number Diff line number Diff line
@@ -96,7 +96,6 @@ import android.graphics.Canvas;
import android.graphics.HardwareRenderer;
import android.graphics.Typeface;
import android.hardware.display.DisplayManagerGlobal;
import android.inputmethodservice.InputMethodService;
import android.media.MediaFrameworkInitializer;
import android.media.MediaFrameworkPlatformInitializer;
import android.media.MediaServiceManager;
@@ -5779,9 +5778,6 @@ public final class ActivityThread extends ClientTransactionHandler
            final int NSVC = mServices.size();
            for (int i=0; i<NSVC; i++) {
                final Service service = mServices.valueAt(i);
                if (service instanceof InputMethodService) {
                    mHasImeComponent = true;
                }
                // If {@code includeUiContext} is set to false, WindowProviderService should not be
                // collected because WindowProviderService is a UI Context.
                if (includeUiContexts || !(service instanceof WindowProviderService)) {
@@ -7524,12 +7520,6 @@ public final class ActivityThread extends ClientTransactionHandler

        ViewRootImpl.ConfigChangedCallback configChangedCallback = (Configuration globalConfig) -> {
            synchronized (mResourcesManager) {
                // TODO (b/135719017): Temporary log for debugging IME service.
                if (Build.IS_DEBUGGABLE && mHasImeComponent) {
                    Log.d(TAG, "ViewRootImpl.ConfigChangedCallback for IME, "
                            + "config=" + globalConfig);
                }

                // We need to apply this change to the resources immediately, because upon returning
                // the view hierarchy will be informed about it.
                if (mResourcesManager.applyConfigurationToResources(globalConfig,
@@ -7884,11 +7874,6 @@ public final class ActivityThread extends ClientTransactionHandler
        return mDensityCompatMode;
    }

    @Override
    public boolean hasImeComponent() {
        return mHasImeComponent;
    }

    // ------------------ Regular JNI ------------------------
    private native void nPurgePendingResources();
    private native void nDumpGraphicsInfo(FileDescriptor fd);
+0 −2
Original line number Diff line number Diff line
@@ -32,8 +32,6 @@ interface ActivityThreadInternal {

    boolean isInDensityCompatMode();

    boolean hasImeComponent();

    boolean isCachedProcessState();

    Application getApplication();
+0 −21
Original line number Diff line number Diff line
@@ -28,12 +28,9 @@ import android.content.res.Configuration;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.HardwareRenderer;
import android.inputmethodservice.InputMethodService;
import android.os.Build;
import android.os.LocaleList;
import android.os.Trace;
import android.util.DisplayMetrics;
import android.util.Log;
import android.util.Slog;
import android.view.ContextThemeWrapper;
import android.view.WindowManagerGlobal;
@@ -168,12 +165,7 @@ class ConfigurationController {
                mPendingConfiguration = null;
            }

            final boolean hasIme = mActivityThread.hasImeComponent();
            if (config == null) {
                // TODO (b/135719017): Temporary log for debugging IME service.
                if (Build.IS_DEBUGGABLE && hasIme) {
                    Log.w(TAG, "handleConfigurationChanged for IME app but config is null");
                }
                return;
            }

@@ -204,12 +196,6 @@ class ConfigurationController {
                mConfiguration = new Configuration();
            }
            if (!mConfiguration.isOtherSeqNewer(config) && compat == null) {
                // TODO (b/135719017): Temporary log for debugging IME service.
                if (Build.IS_DEBUGGABLE && hasIme) {
                    Log.w(TAG, "handleConfigurationChanged for IME app but config seq is obsolete "
                            + ", config=" + config
                            + ", mConfiguration=" + mConfiguration);
                }
                return;
            }

@@ -237,13 +223,6 @@ class ConfigurationController {
                ComponentCallbacks2 cb = callbacks.get(i);
                if (!equivalent) {
                    performConfigurationChanged(cb, config);
                } else {
                    // TODO (b/135719017): Temporary log for debugging IME service.
                    if (Build.IS_DEBUGGABLE && cb instanceof InputMethodService) {
                        Log.w(TAG, "performConfigurationChanged didn't callback to IME "
                                + ", configDiff=" + configDiff
                                + ", mConfiguration=" + mConfiguration);
                    }
                }
            }
        }
+0 −6
Original line number Diff line number Diff line
@@ -3194,12 +3194,6 @@ class ContextImpl extends Context {
    @UnsupportedAppUsage
    final void setOuterContext(@NonNull Context context) {
        mOuterContext = context;
        // TODO(b/149463653): check if we still need this method after migrating IMS to
        //  WindowContext.
        if (mOuterContext.isUiContext() && mContextType <= CONTEXT_TYPE_DISPLAY_CONTEXT) {
            mContextType = CONTEXT_TYPE_WINDOW_CONTEXT;
            mIsConfigurationBasedContext = true;
        }
    }

    @UnsupportedAppUsage
Loading