summaryrefslogtreecommitdiffstats
path: root/core/java/com
diff options
context:
space:
mode:
Diffstat (limited to 'core/java/com')
-rw-r--r--core/java/com/android/internal/app/IAssistScreenshotReceiver.aidl24
-rw-r--r--core/java/com/android/internal/app/WindowDecorActionBar.java1
-rw-r--r--core/java/com/android/internal/inputmethod/InputMethodUtils.java71
-rw-r--r--core/java/com/android/internal/view/ActionModeWrapper.java211
4 files changed, 31 insertions, 276 deletions
diff --git a/core/java/com/android/internal/app/IAssistScreenshotReceiver.aidl b/core/java/com/android/internal/app/IAssistScreenshotReceiver.aidl
new file mode 100644
index 0000000..a987a16
--- /dev/null
+++ b/core/java/com/android/internal/app/IAssistScreenshotReceiver.aidl
@@ -0,0 +1,24 @@
+/*
+ * Copyright (C) 2015 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 com.android.internal.app;
+
+import android.graphics.Bitmap;
+
+/** @hide */
+oneway interface IAssistScreenshotReceiver {
+ void send(in Bitmap screenshot);
+}
diff --git a/core/java/com/android/internal/app/WindowDecorActionBar.java b/core/java/com/android/internal/app/WindowDecorActionBar.java
index 2bf02f1..7ae7d0f 100644
--- a/core/java/com/android/internal/app/WindowDecorActionBar.java
+++ b/core/java/com/android/internal/app/WindowDecorActionBar.java
@@ -23,7 +23,6 @@ import android.widget.Toolbar;
import com.android.internal.R;
import com.android.internal.view.ActionBarPolicy;
-import com.android.internal.view.ActionModeWrapper;
import com.android.internal.view.menu.MenuBuilder;
import com.android.internal.view.menu.MenuPopupHelper;
import com.android.internal.view.menu.SubMenuBuilder;
diff --git a/core/java/com/android/internal/inputmethod/InputMethodUtils.java b/core/java/com/android/internal/inputmethod/InputMethodUtils.java
index 29326d3a..57fcf57 100644
--- a/core/java/com/android/internal/inputmethod/InputMethodUtils.java
+++ b/core/java/com/android/internal/inputmethod/InputMethodUtils.java
@@ -120,18 +120,6 @@ public class InputMethodUtils {
& ApplicationInfo.FLAG_SYSTEM) != 0;
}
- /**
- * @deprecated Use {@link #isSystemImeThatHasSubtypeOf(InputMethodInfo, Context, boolean,
- * Locale, boolean, String)} instead.
- */
- @Deprecated
- public static boolean isSystemImeThatHasEnglishKeyboardSubtype(InputMethodInfo imi) {
- if (!isSystemIme(imi)) {
- return false;
- }
- return containsSubtypeOf(imi, ENGLISH_LOCALE.getLanguage(), SUBTYPE_MODE_KEYBOARD);
- }
-
public static boolean isSystemImeThatHasSubtypeOf(final InputMethodInfo imi,
final Context context, final boolean checkDefaultAttribute,
@Nullable final Locale requiredLocale, final boolean checkCountry,
@@ -382,35 +370,6 @@ public class InputMethodUtils {
.build();
}
- /**
- * @deprecated Use {@link #isSystemImeThatHasSubtypeOf(InputMethodInfo, Context, boolean,
- * Locale, boolean, String)} instead.
- */
- @Deprecated
- public static boolean isValidSystemDefaultIme(
- boolean isSystemReady, InputMethodInfo imi, Context context) {
- if (!isSystemReady) {
- return false;
- }
- if (!isSystemIme(imi)) {
- return false;
- }
- if (imi.getIsDefaultResourceId() != 0) {
- try {
- if (imi.isDefault(context) && containsSubtypeOf(
- imi, context.getResources().getConfiguration().locale.getLanguage(),
- SUBTYPE_MODE_ANY)) {
- return true;
- }
- } catch (Resources.NotFoundException ex) {
- }
- }
- if (imi.getSubtypeCount() == 0) {
- Slog.w(TAG, "Found no subtypes in a system IME: " + imi.getPackageName());
- }
- return false;
- }
-
public static Locale constructLocaleFromString(String localeStr) {
if (TextUtils.isEmpty(localeStr)) {
return null;
@@ -459,25 +418,6 @@ public class InputMethodUtils {
return false;
}
- /**
- * @deprecated Use {@link #containsSubtypeOf(InputMethodInfo, Locale, boolean, String)} instead.
- */
- @Deprecated
- public static boolean containsSubtypeOf(InputMethodInfo imi, String language, String mode) {
- final int N = imi.getSubtypeCount();
- for (int i = 0; i < N; ++i) {
- final InputMethodSubtype subtype = imi.getSubtypeAt(i);
- if (!subtype.getLocale().startsWith(language)) {
- continue;
- }
- if (mode == SUBTYPE_MODE_ANY || TextUtils.isEmpty(mode) ||
- mode.equalsIgnoreCase(subtype.getMode())) {
- return true;
- }
- }
- return false;
- }
-
public static ArrayList<InputMethodSubtype> getSubtypes(InputMethodInfo imi) {
ArrayList<InputMethodSubtype> subtypes = new ArrayList<InputMethodSubtype>();
final int subtypeCount = imi.getSubtypeCount();
@@ -510,12 +450,15 @@ public class InputMethodUtils {
while (i > 0) {
i--;
final InputMethodInfo imi = enabledImes.get(i);
- if (InputMethodUtils.isSystemImeThatHasEnglishKeyboardSubtype(imi)
- && !imi.isAuxiliaryIme()) {
+ if (imi.isAuxiliaryIme()) {
+ continue;
+ }
+ if (InputMethodUtils.isSystemIme(imi)
+ && containsSubtypeOf(imi, ENGLISH_LOCALE, false /* checkCountry */,
+ SUBTYPE_MODE_KEYBOARD)) {
return imi;
}
- if (firstFoundSystemIme < 0 && InputMethodUtils.isSystemIme(imi)
- && !imi.isAuxiliaryIme()) {
+ if (firstFoundSystemIme < 0 && InputMethodUtils.isSystemIme(imi)) {
firstFoundSystemIme = i;
}
}
diff --git a/core/java/com/android/internal/view/ActionModeWrapper.java b/core/java/com/android/internal/view/ActionModeWrapper.java
deleted file mode 100644
index d98617d..0000000
--- a/core/java/com/android/internal/view/ActionModeWrapper.java
+++ /dev/null
@@ -1,211 +0,0 @@
-/*
- * Copyright (C) 2015 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 com.android.internal.view;
-
-import android.content.Context;
-import android.view.ActionMode;
-import android.view.Menu;
-import android.view.MenuInflater;
-import android.view.MenuItem;
-import android.view.View;
-
-import com.android.internal.view.menu.MenuBuilder;
-
-/**
- * ActionMode implementation that wraps several actions modes and creates them on the fly depending
- * on the ActionMode type chosen by the client.
- */
-public class ActionModeWrapper extends ActionMode {
-
- /**
- * Interface to defer the ActionMode creation until the type is chosen.
- */
- public interface ActionModeProvider {
- /**
- * Create the desired ActionMode, that will immediately be used as the current active mode
- * in the decorator.
- *
- * @param callback The {@link ActionMode.Callback} to be used.
- * @param menuBuilder The {@link MenuBuilder} that should be used by the created
- * {@link ActionMode}. This will already have been populated.
- * @return A new {@link ActionMode} ready to be used that uses menuBuilder as its menu.
- */
- ActionMode createActionMode(ActionMode.Callback callback, MenuBuilder menuBuilder);
- }
-
- private ActionMode mActionMode;
- private final Context mContext;
- private MenuBuilder mMenu;
- private final ActionMode.Callback mCallback;
- private boolean mTypeLocked = false;
-
- private CharSequence mTitle;
- private CharSequence mSubtitle;
- private View mCustomView;
-
- private final ActionModeProvider mActionModeProvider;
-
- public ActionModeWrapper(
- Context context, ActionMode.Callback callback, ActionModeProvider actionModeProvider) {
- mContext = context;
- mMenu = new MenuBuilder(context).setDefaultShowAsAction(
- MenuItem.SHOW_AS_ACTION_IF_ROOM);
- mCallback = callback;
- mActionModeProvider = actionModeProvider;
- }
-
- @Override
- public void setTitle(CharSequence title) {
- if (mActionMode != null) {
- mActionMode.setTitle(title);
- } else {
- mTitle = title;
- }
- }
-
- @Override
- public void setTitle(int resId) {
- if (mActionMode != null) {
- mActionMode.setTitle(resId);
- } else {
- mTitle = resId != 0 ? mContext.getString(resId) : null;
- }
- }
-
- @Override
- public void setSubtitle(CharSequence subtitle) {
- if (mActionMode != null) {
- mActionMode.setSubtitle(subtitle);
- } else {
- mSubtitle = subtitle;
- }
- }
-
- @Override
- public void setSubtitle(int resId) {
- if (mActionMode != null) {
- mActionMode.setSubtitle(resId);
- } else {
- mSubtitle = resId != 0 ? mContext.getString(resId) : null;
- }
- }
-
- @Override
- public void setCustomView(View view) {
- if (mActionMode != null) {
- mActionMode.setCustomView(view);
- } else {
- mCustomView = view;
- }
- }
-
- public ActionMode getWrappedActionMode() {
- return mActionMode;
- }
-
- /**
- * Set the current type as final and create the necessary ActionMode. After this call, any
- * changes to the ActionMode type will be ignored.
- */
- public void lockType() {
- mTypeLocked = true;
- switch (getType()) {
- case ActionMode.TYPE_PRIMARY:
- default:
- mActionMode = mActionModeProvider.createActionMode(mCallback, mMenu);
- break;
- case ActionMode.TYPE_FLOATING:
- // Not implemented yet.
- break;
- }
-
- if (mActionMode == null) {
- return;
- }
-
- mActionMode.setTitle(mTitle);
- mActionMode.setSubtitle(mSubtitle);
- if (mCustomView != null) {
- mActionMode.setCustomView(mCustomView);
- }
-
- mTitle = null;
- mSubtitle = null;
- mCustomView = null;
- }
-
- @Override
- public void setType(int type) {
- if (!mTypeLocked) {
- super.setType(type);
- } else {
- throw new IllegalStateException(
- "You can't change the ActionMode's type after onCreateActionMode.");
- }
- }
-
- @Override
- public void invalidate() {
- if (mActionMode != null) {
- mActionMode.invalidate();
- }
- }
-
- @Override
- public void finish() {
- if (mActionMode != null) {
- mActionMode.finish();
- } else {
- mCallback.onDestroyActionMode(this);
- }
- }
-
- @Override
- public Menu getMenu() {
- return mMenu;
- }
-
- @Override
- public CharSequence getTitle() {
- if (mActionMode != null) {
- return mActionMode.getTitle();
- }
- return mTitle;
- }
-
- @Override
- public CharSequence getSubtitle() {
- if (mActionMode != null) {
- return mActionMode.getSubtitle();
- }
- return mSubtitle;
- }
-
- @Override
- public View getCustomView() {
- if (mActionMode != null) {
- return mActionMode.getCustomView();
- }
- return mCustomView;
- }
-
- @Override
- public MenuInflater getMenuInflater() {
- return new MenuInflater(mContext);
- }
-
-}