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

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

Merge "Add support for VR InputMethod."

parents f92ace0a 89a6c48a
Loading
Loading
Loading
Loading
+19 −0
Original line number Diff line number Diff line
@@ -4,6 +4,7 @@ import android.annotation.NonNull;
import android.annotation.RequiresPermission;
import android.annotation.SystemApi;
import android.annotation.SystemService;
import android.annotation.TestApi;
import android.content.ComponentName;
import android.content.Context;
import android.os.Handler;
@@ -214,4 +215,22 @@ public class VrManager {
            e.rethrowFromSystemServer();
        }
    }

    /**
     * Start VR Input method for the packageName in {@link ComponentName}.
     * This method notifies InputMethodManagerService to use VR IME instead of
     * regular phone IME.
     * @param componentName ComponentName of a VR InputMethod that should be set as selected
     * input by InputMethodManagerService.
     * @hide
     */
    @TestApi
    @RequiresPermission(android.Manifest.permission.RESTRICTED_VR_ACCESS)
    public void setVrInputMethod(ComponentName componentName) {
        try {
            mService.setVrInputMethod(componentName);
        } catch (RemoteException e) {
            e.rethrowFromSystemServer();
        }
    }
}
+9 −0
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package android.service.vr;

import android.app.Vr2dDisplayProperties;
import android.content.ComponentName;
import android.service.vr.IVrStateCallbacks;
import android.service.vr.IPersistentVrStateCallbacks;

@@ -109,5 +110,13 @@ interface IVrManager {
     * @param standy True if the device is entering standby, false if it's exiting standby.
     */
    void setStandbyEnabled(boolean standby);

    /**
     * Start VR Input method for the given packageName in {@param componentName}.
     * This method notifies InputMethodManagerService to use VR IME instead of
     * regular phone IME.
     */
    void setVrInputMethod(in ComponentName componentName);

}
+13 −0
Original line number Diff line number Diff line
@@ -697,6 +697,19 @@ public final class InputMethodManager {
        }
    }

    /**
     * Returns a list of VR InputMethod currently installed.
     * @hide
     */
    @RequiresPermission(android.Manifest.permission.RESTRICTED_VR_ACCESS)
    public List<InputMethodInfo> getVrInputMethodList() {
        try {
            return mService.getVrInputMethodList();
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
        }
    }

    public List<InputMethodInfo> getEnabledInputMethodList() {
        try {
            return mService.getEnabledInputMethodList();
+7 −0
Original line number Diff line number Diff line
@@ -16,6 +16,8 @@

package android.view.inputmethod;

import android.content.ComponentName;

/**
 * Input method manager local system service interface.
 *
@@ -37,4 +39,9 @@ public interface InputMethodManagerInternal {
     * Hides the current input method, if visible.
     */
    void hideCurrentInputMethod();

    /**
     * Switches to VR InputMethod defined in the packageName of {@param componentName}.
     */
    void startVrInputMethodNoCheck(ComponentName componentName);
}
+1 −3
Original line number Diff line number Diff line
@@ -836,7 +836,6 @@ public class InputMethodUtils {
        private final Resources mRes;
        private final ContentResolver mResolver;
        private final HashMap<String, InputMethodInfo> mMethodMap;
        private final ArrayList<InputMethodInfo> mMethodList;

        /**
         * On-memory data store to emulate when {@link #mCopyOnWrite} is {@code true}.
@@ -906,7 +905,6 @@ public class InputMethodUtils {
            mRes = res;
            mResolver = resolver;
            mMethodMap = methodMap;
            mMethodList = methodList;
            switchCurrentUser(userId, copyOnWrite);
        }

@@ -1087,7 +1085,7 @@ public class InputMethodUtils {
            final ArrayList<InputMethodInfo> res = new ArrayList<>();
            for (Pair<String, ArrayList<String>> ims: imsList) {
                InputMethodInfo info = mMethodMap.get(ims.first);
                if (info != null) {
                if (info != null && !info.isVrOnly()) {
                    res.add(info);
                }
            }
Loading