diff --git a/core/java/com/android/internal/notification/SystemNotificationChannels.java b/core/java/com/android/internal/notification/SystemNotificationChannels.java index 681b46a01c8db90bf04167e4c38c4d84d126b18f..0489dc812ab6e092956bf7bc9b596fc682bcaadd 100644 --- a/core/java/com/android/internal/notification/SystemNotificationChannels.java +++ b/core/java/com/android/internal/notification/SystemNotificationChannels.java @@ -35,7 +35,10 @@ import java.util.List; // Manages the NotificationChannels used by the frameworks itself. public class SystemNotificationChannels { - public static String VIRTUAL_KEYBOARD = "VIRTUAL_KEYBOARD"; + /** + * @deprecated Legacy system channel, which is no longer used, + */ + @Deprecated public static String VIRTUAL_KEYBOARD = "VIRTUAL_KEYBOARD"; public static String PHYSICAL_KEYBOARD = "PHYSICAL_KEYBOARD"; public static String SECURITY = "SECURITY"; public static String CAR_MODE = "CAR_MODE"; @@ -72,13 +75,6 @@ public class SystemNotificationChannels { public static void createAll(Context context) { final NotificationManager nm = context.getSystemService(NotificationManager.class); List<NotificationChannel> channelsList = new ArrayList<NotificationChannel>(); - final NotificationChannel keyboard = new NotificationChannel( - VIRTUAL_KEYBOARD, - context.getString(R.string.notification_channel_virtual_keyboard), - NotificationManager.IMPORTANCE_LOW); - keyboard.setBlockable(true); - channelsList.add(keyboard); - final NotificationChannel physicalKeyboardChannel = new NotificationChannel( PHYSICAL_KEYBOARD, context.getString(R.string.notification_channel_physical_keyboard), @@ -237,6 +233,7 @@ public class SystemNotificationChannels { /** Remove notification channels which are no longer used */ public static void removeDeprecated(Context context) { final NotificationManager nm = context.getSystemService(NotificationManager.class); + nm.deleteNotificationChannel(VIRTUAL_KEYBOARD); nm.deleteNotificationChannel(DEVICE_ADMIN_DEPRECATED); nm.deleteNotificationChannel(SYSTEM_CHANGES_DEPRECATED); } diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml index 1f23eb6a86d634baaa16e53f74296dab563b3bdc..6ce31fc13f8596f97e951b9408acd99d7dbc29b4 100644 --- a/core/res/AndroidManifest.xml +++ b/core/res/AndroidManifest.xml @@ -668,7 +668,6 @@ <protected-broadcast android:name="android.media.tv.action.PREVIEW_PROGRAM_BROWSABLE_DISABLED" /> <protected-broadcast android:name="android.media.tv.action.WATCH_NEXT_PROGRAM_BROWSABLE_DISABLED" /> <protected-broadcast android:name="android.media.tv.action.CHANNEL_BROWSABLE_REQUESTED" /> - <protected-broadcast android:name="com.android.server.inputmethod.InputMethodManagerService.SHOW_INPUT_METHOD_PICKER" /> <!-- Time zone rules update intents fired by the system server --> <protected-broadcast android:name="com.android.intent.action.timezone.RULES_UPDATE_OPERATION" /> diff --git a/core/res/res/drawable-hdpi/ic_notification_ime_default.png b/core/res/res/drawable-hdpi/ic_notification_ime_default.png deleted file mode 100644 index 369c88d317077da652b1bfe3414e97c0ef5114c4..0000000000000000000000000000000000000000 Binary files a/core/res/res/drawable-hdpi/ic_notification_ime_default.png and /dev/null differ diff --git a/core/res/res/drawable-mdpi/ic_notification_ime_default.png b/core/res/res/drawable-mdpi/ic_notification_ime_default.png deleted file mode 100644 index 7d97eb575f2a88418617eb47307ef45621f9dc2c..0000000000000000000000000000000000000000 Binary files a/core/res/res/drawable-mdpi/ic_notification_ime_default.png and /dev/null differ diff --git a/core/res/res/drawable-xhdpi/ic_notification_ime_default.png b/core/res/res/drawable-xhdpi/ic_notification_ime_default.png deleted file mode 100644 index 900801a4d3d70770be92a21c71f59d0534d14790..0000000000000000000000000000000000000000 Binary files a/core/res/res/drawable-xhdpi/ic_notification_ime_default.png and /dev/null differ diff --git a/core/res/res/drawable-xxhdpi/ic_notification_ime_default.png b/core/res/res/drawable-xxhdpi/ic_notification_ime_default.png deleted file mode 100644 index 6c8222ec50b7273ad4902efa914af497c28203cc..0000000000000000000000000000000000000000 Binary files a/core/res/res/drawable-xxhdpi/ic_notification_ime_default.png and /dev/null differ diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml index 5f99113589213341d07d4e4f41c347f5ebd62e85..d0fca8b0a7bb67f39a9fb2fa9c8de9c94a57f3c6 100644 --- a/core/res/res/values/strings.xml +++ b/core/res/res/values/strings.xml @@ -741,9 +741,6 @@ <!-- Text shown in place of notification contents when the notification is hidden on a secure lockscreen --> <string name="notification_hidden_text">New notification</string> - <!-- Text shown when viewing channel settings for notifications related to the virtual keyboard --> - <string name="notification_channel_virtual_keyboard">Virtual keyboard</string> - <!-- Text shown when viewing channel settings for notifications related to the hardware keyboard --> <string name="notification_channel_physical_keyboard">Physical keyboard</string> diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml index b94d7990b394b6a34ef55fd3fbcc613fa5a32f6c..fc55ed2fe443557a90d4a69761f1f1eea719a4bf 100644 --- a/core/res/res/values/symbols.xml +++ b/core/res/res/values/symbols.xml @@ -1992,7 +1992,6 @@ <java-symbol type="color" name="config_defaultNotificationColor" /> <java-symbol type="color" name="decor_view_status_guard" /> <java-symbol type="color" name="decor_view_status_guard_light" /> - <java-symbol type="drawable" name="ic_notification_ime_default" /> <java-symbol type="drawable" name="ic_menu_refresh" /> <java-symbol type="drawable" name="ic_settings" /> <java-symbol type="drawable" name="ic_voice_search" /> diff --git a/proto/src/system_messages.proto b/proto/src/system_messages.proto index a94bfe281be131f5554441b86e3addc109d3a8b2..12e722601e2546e47ac0f2bd5cc9445b380b8c8f 100644 --- a/proto/src/system_messages.proto +++ b/proto/src/system_messages.proto @@ -61,7 +61,7 @@ message SystemMessage { // Notify the user that they should select an input method // Package: android - NOTE_SELECT_INPUT_METHOD = 8; + NOTE_SELECT_INPUT_METHOD = 8 [deprecated = true]; // Notify the user about limited functionality before decryption // Package: android diff --git a/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java b/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java index 76331fd6089c6bd7b21190db74665f74455cdea5..76495b17c984d60d35952575f9368989326ffd33 100644 --- a/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java +++ b/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java @@ -58,7 +58,6 @@ import android.Manifest; import android.accessibilityservice.AccessibilityService; import android.annotation.AnyThread; import android.annotation.BinderThread; -import android.annotation.ColorInt; import android.annotation.DrawableRes; import android.annotation.DurationMillisLong; import android.annotation.EnforcePermission; @@ -69,9 +68,6 @@ import android.annotation.UiThread; import android.annotation.UserIdInt; import android.app.ActivityManager; import android.app.ActivityManagerInternal; -import android.app.Notification; -import android.app.NotificationManager; -import android.app.PendingIntent; import android.content.BroadcastReceiver; import android.content.ComponentName; import android.content.ContentProvider; @@ -94,7 +90,6 @@ import android.inputmethodservice.InputMethodService; import android.media.AudioManagerInternal; import android.net.Uri; import android.os.Binder; -import android.os.Bundle; import android.os.Debug; import android.os.Handler; import android.os.IBinder; @@ -170,8 +165,6 @@ import com.android.internal.inputmethod.SoftInputShowHideReason; import com.android.internal.inputmethod.StartInputFlags; import com.android.internal.inputmethod.StartInputReason; import com.android.internal.inputmethod.UnbindReason; -import com.android.internal.messages.nano.SystemMessageProto.SystemMessage; -import com.android.internal.notification.SystemNotificationChannels; import com.android.internal.os.TransferPipe; import com.android.internal.util.ArrayUtils; import com.android.internal.util.ConcurrentUtils; @@ -254,13 +247,6 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub private static final String TAG_TRY_SUPPRESSING_IME_SWITCHER = "TrySuppressingImeSwitcher"; private static final String HANDLER_THREAD_NAME = "android.imms"; - /** - * A protected broadcast intent action for internal use for {@link PendingIntent} in - * the notification. - */ - private static final String ACTION_SHOW_INPUT_METHOD_PICKER = - "com.android.server.inputmethod.InputMethodManagerService.SHOW_INPUT_METHOD_PICKER"; - /** * When set, {@link #startInputUncheckedLocked} will return * {@link InputBindResult#NO_EDITOR} instead of starting an IME connection @@ -334,13 +320,8 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub @GuardedBy("ImfLock.class") private int mDisplayIdToShowIme = INVALID_DISPLAY; - // Ongoing notification - private NotificationManager mNotificationManager; @Nullable private StatusBarManagerInternal mStatusBarManagerInternal; - private final Notification.Builder mImeSwitcherNotification; - private final PendingIntent mImeSwitchPendingIntent; private boolean mShowOngoingImeSwitcherForPhones; - private boolean mNotificationShown; @GuardedBy("ImfLock.class") private final HandwritingModeController mHwController; @GuardedBy("ImfLock.class") @@ -1253,17 +1234,6 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub return; } else if (Intent.ACTION_LOCALE_CHANGED.equals(action)) { onActionLocaleChanged(); - } else if (ACTION_SHOW_INPUT_METHOD_PICKER.equals(action)) { - // ACTION_SHOW_INPUT_METHOD_PICKER action is a protected-broadcast and it is - // guaranteed to be send only from the system, so that there is no need for extra - // security check such as - // {@link #canShowInputMethodPickerLocked(IInputMethodClient)}. - mHandler.obtainMessage( - MSG_SHOW_IM_SUBTYPE_PICKER, - // TODO(b/120076400): Design and implement IME switcher for heterogeneous - // navbar configuration. - InputMethodManager.SHOW_IM_PICKER_MODE_INCLUDE_AUXILIARY_SUBTYPES, - DEFAULT_DISPLAY).sendToTarget(); } else { Slog.w(TAG, "Unexpected intent " + intent); } @@ -1720,27 +1690,8 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub mSlotIme = mContext.getString(com.android.internal.R.string.status_bar_ime); - Bundle extras = new Bundle(); - extras.putBoolean(Notification.EXTRA_ALLOW_DURING_SETUP, true); - @ColorInt final int accentColor = mContext.getColor( - com.android.internal.R.color.system_notification_accent_color); - mImeSwitcherNotification = - new Notification.Builder(mContext, SystemNotificationChannels.VIRTUAL_KEYBOARD) - .setSmallIcon(com.android.internal.R.drawable.ic_notification_ime_default) - .setWhen(0) - .setOngoing(true) - .addExtras(extras) - .setCategory(Notification.CATEGORY_SYSTEM) - .setColor(accentColor); - - Intent intent = new Intent(ACTION_SHOW_INPUT_METHOD_PICKER) - .setPackage(mContext.getPackageName()); - mImeSwitchPendingIntent = PendingIntent.getBroadcast(mContext, 0, intent, - PendingIntent.FLAG_IMMUTABLE); - mShowOngoingImeSwitcherForPhones = false; - mNotificationShown = false; final int userId = mActivityManagerInternal.getCurrentUserId(); mLastSwitchUserId = userId; @@ -1939,7 +1890,6 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub final int currentUserId = mSettings.getCurrentUserId(); mSettings.switchCurrentUser(currentUserId, !mUserManagerInternal.isUserUnlockingOrUnlocked(currentUserId)); - mNotificationManager = mContext.getSystemService(NotificationManager.class); mStatusBarManagerInternal = LocalServices.getService(StatusBarManagerInternal.class); hideStatusBarIconLocked(); @@ -1977,7 +1927,6 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub broadcastFilterForSystemUser.addAction(Intent.ACTION_USER_ADDED); broadcastFilterForSystemUser.addAction(Intent.ACTION_USER_REMOVED); broadcastFilterForSystemUser.addAction(Intent.ACTION_LOCALE_CHANGED); - broadcastFilterForSystemUser.addAction(ACTION_SHOW_INPUT_METHOD_PICKER); mContext.registerReceiver(new ImmsBroadcastReceiverForSystemUser(), broadcastFilterForSystemUser); @@ -3159,41 +3108,6 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub mStatusBarManagerInternal.setImeWindowStatus(mCurTokenDisplayId, getCurTokenLocked(), vis, backDisposition, needsToShowImeSwitcher); } - final InputMethodInfo imi = mMethodMap.get(getSelectedMethodIdLocked()); - if (imi != null && needsToShowImeSwitcher) { - // Used to load label - final CharSequence title = mRes.getText( - com.android.internal.R.string.select_input_method); - final int currentUserId = mSettings.getCurrentUserId(); - final Context userAwareContext = mContext.getUserId() == currentUserId - ? mContext - : mContext.createContextAsUser(UserHandle.of(currentUserId), 0 /* flags */); - final CharSequence summary = InputMethodUtils.getImeAndSubtypeDisplayName( - userAwareContext, imi, mCurrentSubtype); - mImeSwitcherNotification.setContentTitle(title) - .setContentText(summary) - .setContentIntent(mImeSwitchPendingIntent); - // TODO(b/120076400): Figure out what is the best behavior - if ((mNotificationManager != null) - && !mWindowManagerInternal.hasNavigationBar(DEFAULT_DISPLAY)) { - if (DEBUG) { - Slog.d(TAG, "--- show notification: label = " + summary); - } - mNotificationManager.notifyAsUser(null, - SystemMessage.NOTE_SELECT_INPUT_METHOD, - mImeSwitcherNotification.build(), UserHandle.ALL); - mNotificationShown = true; - } - } else { - if (mNotificationShown && mNotificationManager != null) { - if (DEBUG) { - Slog.d(TAG, "--- hide notification"); - } - mNotificationManager.cancelAsUser(null, - SystemMessage.NOTE_SELECT_INPUT_METHOD, UserHandle.ALL); - mNotificationShown = false; - } - } } finally { Binder.restoreCallingIdentity(ident); } diff --git a/services/core/java/com/android/server/inputmethod/InputMethodUtils.java b/services/core/java/com/android/server/inputmethod/InputMethodUtils.java index c7ff8caf176b3acdc7814460e7e30021cd85c8a3..ebf9237d61ea065e98cb4f78ee55cd63484907c1 100644 --- a/services/core/java/com/android/server/inputmethod/InputMethodUtils.java +++ b/services/core/java/com/android/server/inputmethod/InputMethodUtils.java @@ -179,16 +179,6 @@ final class InputMethodUtils { } } - static CharSequence getImeAndSubtypeDisplayName(Context context, InputMethodInfo imi, - InputMethodSubtype subtype) { - final CharSequence imiLabel = imi.loadLabel(context.getPackageManager()); - return subtype != null - ? TextUtils.concat(subtype.getDisplayName(context, - imi.getPackageName(), imi.getServiceInfo().applicationInfo), - (TextUtils.isEmpty(imiLabel) ? "" : " - " + imiLabel)) - : imiLabel; - } - /** * Returns true if a package name belongs to a UID. * diff --git a/services/core/java/com/android/server/wm/WindowManagerInternal.java b/services/core/java/com/android/server/wm/WindowManagerInternal.java index 32feb6c98b241526a6037dc7e10d3237cfc6a871..c206a15503debd734cc751950c37da436658a719 100644 --- a/services/core/java/com/android/server/wm/WindowManagerInternal.java +++ b/services/core/java/com/android/server/wm/WindowManagerInternal.java @@ -612,15 +612,6 @@ public abstract class WindowManagerInternal { public abstract void updateInputMethodTargetWindow(@NonNull IBinder imeToken, @NonNull IBinder imeTargetWindowToken); - /** - * Returns the presence of a software navigation bar on the specified display. - * - * @param displayId the id of display to check if there is a software navigation bar. - * @return {@code true} if there is a software navigation. {@code false} otherwise, including - * the case when the specified display does not exist. - */ - public abstract boolean hasNavigationBar(int displayId); - /** * Returns true when the hardware keyboard is available. */ diff --git a/services/core/java/com/android/server/wm/WindowManagerService.java b/services/core/java/com/android/server/wm/WindowManagerService.java index c17af3093e516a1e746cfb11d262237400e7347e..a5cd8a92003cd253b35120ae53b16304ec5f5734 100644 --- a/services/core/java/com/android/server/wm/WindowManagerService.java +++ b/services/core/java/com/android/server/wm/WindowManagerService.java @@ -7916,11 +7916,6 @@ public class WindowManagerService extends IWindowManager.Stub } } - @Override - public boolean hasNavigationBar(int displayId) { - return WindowManagerService.this.hasNavigationBar(displayId); - } - @Override public boolean isHardKeyboardAvailable() { synchronized (mGlobalLock) {