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

Commit ded74d35 authored by Taran Singh's avatar Taran Singh Committed by Android (Google) Code Review
Browse files

Merge changes I53808ec2,I6f1b8a93

* changes:
  Minimal test IME with Stylus HW support
  Fix IMS#onPrepareStylusHandwriting call
parents 7412dc8c 8f2ae0b7
Loading
Loading
Loading
Loading
+0 −7
Original line number Diff line number Diff line
@@ -102,11 +102,4 @@ final class InkWindow extends PhoneWindow {
        lp.token = token;
        setAttributes(lp);
    }

    /**
     * Returns {@code true} if Window was created and added to WM.
     */
    boolean isInitialized() {
        return mIsViewAdded;
    }
}
+6 −2
Original line number Diff line number Diff line
@@ -578,6 +578,7 @@ public class InputMethodService extends AbstractInputMethodService {
    private boolean mImeSurfaceScheduledForRemoval;
    private ImsConfigurationTracker mConfigTracker = new ImsConfigurationTracker();
    private boolean mDestroyed;
    private boolean mOnPreparedStylusHwCalled;

    /** Stylus handwriting Ink window.  */
    private InkWindow mInkWindow;
@@ -919,9 +920,10 @@ public class InputMethodService extends AbstractInputMethodService {
                Log.d(TAG, "Input should have started before starting Stylus handwriting.");
                return;
            }
            if (!mInkWindow.isInitialized()) {
            if (!mOnPreparedStylusHwCalled) {
                // prepare hasn't been called by Stylus HOVER.
                onPrepareStylusHandwriting();
                mOnPreparedStylusHwCalled = true;
            }
            if (onStartStylusHandwriting()) {
                mPrivOps.onStylusHandwritingReady(requestId);
@@ -976,6 +978,7 @@ public class InputMethodService extends AbstractInputMethodService {
        public void initInkWindow() {
            mInkWindow.initOnly();
            onPrepareStylusHandwriting();
            mOnPreparedStylusHwCalled = true;
        }

        /**
@@ -2354,7 +2357,7 @@ public class InputMethodService extends AbstractInputMethodService {

    /**
     * Called to prepare stylus handwriting.
     * The system calls this before the first {@link #onStartStylusHandwriting} request.
     * The system calls this before the {@link #onStartStylusHandwriting} request.
     *
     * <p>Note: The system tries to call this as early as possible, when it detects that
     * handwriting stylus input is imminent. However, that a subsequent call to
@@ -2438,6 +2441,7 @@ public class InputMethodService extends AbstractInputMethodService {
        mInkWindow.hide(false /* remove */);

        mPrivOps.finishStylusHandwriting(requestId);
        mOnPreparedStylusHwCalled = false;
        onFinishStylusHandwriting();
    }

+35 −0
Original line number Diff line number Diff line
// Copyright (C) 2022 The Android Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package {
    // See: http://go/android-license-faq
    // A large-scale-change added 'default_applicable_licenses' to import
    // all of the 'license_kinds' from "frameworks_base_license"
    // to get the below license kinds:
    //   SPDX-license-identifier-Apache-2.0
    default_applicable_licenses: ["frameworks_base_license"],
}

android_test {
    name: "HandwritingIme",
    srcs: ["src/**/*.java"],
    resource_dirs: ["res"],
    certificate: "platform",
    platform_apis: true,
    static_libs: [
        "androidx.core_core",
        "androidx.appcompat_appcompat",
        "com.google.android.material_material",
    ],
}
+35 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
  ~ Copyright (018C) 2022 The Android Open Source Project
  ~
  ~ Licensed under the Apache License, Version 2.0 (the "License");
  ~ you may not use this file except in compliance with the License.
  ~ You may obtain a copy of the License at
  ~
  ~      http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing, software
  ~ distributed under the License is distributed on an "AS IS" BASIS,
  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  ~ See the License for the specific language governing permissions and
  ~ limitations under the License
  -->

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.google.android.test.handwritingime">

    <application android:label="Handwriting IME">
        <service android:name=".HandwritingIme"
                 android:process=":HandwritingIme"
                 android:label="Handwriting IME"
                 android:permission="android.permission.BIND_INPUT_METHOD"
                 android:exported="true">
            <intent-filter>
                <action android:name="android.view.InputMethod"/>
            </intent-filter>
            <meta-data android:name="android.view.im"
                       android:resource="@xml/ime"/>
        </service>

    </application>
</manifest>
+20 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
  ~ Copyright (C) 2022 The Android Open Source Project
  ~
  ~ Licensed under the Apache License, Version 2.0 (the "License");
  ~ you may not use this file except in compliance with the License.
  ~ You may obtain a copy of the License at
  ~
  ~      http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing, software
  ~ distributed under the License is distributed on an "AS IS" BASIS,
  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  ~ See the License for the specific language governing permissions and
  ~ limitations under the License.
  -->

<!-- Configuration info for an input method -->
<input-method xmlns:android="http://schemas.android.com/apk/res/android"
              android:supportsStylusHandwriting="true"/>
 No newline at end of file
Loading