diff options
author | Chris Wren <cwren@android.com> | 2015-06-11 10:19:43 -0400 |
---|---|---|
committer | Chris Wren <cwren@android.com> | 2015-06-12 10:16:04 -0400 |
commit | 1ce4b6d3c6cb5b2eb9c9d00472be12245db92427 (patch) | |
tree | d8c7d63276de0a8609ff5bb2422a2e55bad1562a /services/core/java/com/android/server/InputMethodManagerService.java | |
parent | 08f247fe2e073a5ec62dc0469d83f514aab31c42 (diff) | |
download | frameworks_base-1ce4b6d3c6cb5b2eb9c9d00472be12245db92427.zip frameworks_base-1ce4b6d3c6cb5b2eb9c9d00472be12245db92427.tar.gz frameworks_base-1ce4b6d3c6cb5b2eb9c9d00472be12245db92427.tar.bz2 |
remove usage of deprecated method setLatestEventInfo
Bug: 18510449
Change-Id: I56a77991c729990e501f402e007dfa79ee57621e
Diffstat (limited to 'services/core/java/com/android/server/InputMethodManagerService.java')
-rw-r--r-- | services/core/java/com/android/server/InputMethodManagerService.java | 34 |
1 files changed, 15 insertions, 19 deletions
diff --git a/services/core/java/com/android/server/InputMethodManagerService.java b/services/core/java/com/android/server/InputMethodManagerService.java index 6e6fb7f..a5d536e 100644 --- a/services/core/java/com/android/server/InputMethodManagerService.java +++ b/services/core/java/com/android/server/InputMethodManagerService.java @@ -71,6 +71,7 @@ import android.graphics.drawable.Drawable; import android.inputmethodservice.InputMethodService; import android.net.Uri; import android.os.Binder; +import android.os.Bundle; import android.os.Environment; import android.os.Handler; import android.os.IBinder; @@ -212,7 +213,7 @@ public class InputMethodManagerService extends IInputMethodManager.Stub private NotificationManager mNotificationManager; private KeyguardManager mKeyguardManager; private StatusBarManagerService mStatusBar; - private Notification mImeSwitcherNotification; + private Notification.Builder mImeSwitcherNotification; private PendingIntent mImeSwitchPendingIntent; private boolean mShowOngoingImeSwitcherForPhones; private boolean mNotificationShown; @@ -798,18 +799,15 @@ public class InputMethodManagerService extends IInputMethodManager.Stub mHasFeature = context.getPackageManager().hasSystemFeature( PackageManager.FEATURE_INPUT_METHODS); - mImeSwitcherNotification = new Notification(); - mImeSwitcherNotification.icon = com.android.internal.R.drawable.ic_notification_ime_default; - mImeSwitcherNotification.when = 0; - mImeSwitcherNotification.flags = Notification.FLAG_ONGOING_EVENT; - mImeSwitcherNotification.tickerText = null; - mImeSwitcherNotification.defaults = 0; // please be quiet - mImeSwitcherNotification.sound = null; - mImeSwitcherNotification.vibrate = null; - - // Tag this notification specially so SystemUI knows it's important - mImeSwitcherNotification.extras.putBoolean(Notification.EXTRA_ALLOW_DURING_SETUP, true); - mImeSwitcherNotification.category = Notification.CATEGORY_SYSTEM; + Bundle extras = new Bundle(); + extras.putBoolean(Notification.EXTRA_ALLOW_DURING_SETUP, true); + mImeSwitcherNotification = new Notification.Builder(mContext) + .setSmallIcon(com.android.internal.R.drawable.ic_notification_ime_default) + .setWhen(0) + .setOngoing(true) + .addExtras(extras) + .setCategory(Notification.CATEGORY_SYSTEM) + .setColor(com.android.internal.R.color.system_notification_accent_color); Intent intent = new Intent(Settings.ACTION_SHOW_INPUT_METHOD_PICKER); mImeSwitchPendingIntent = PendingIntent.getBroadcast(mContext, 0, intent, 0); @@ -1766,11 +1764,9 @@ public class InputMethodManagerService extends IInputMethodManager.Stub com.android.internal.R.string.select_input_method); final CharSequence summary = InputMethodUtils.getImeAndSubtypeDisplayName( mContext, imi, mCurrentSubtype); - - mImeSwitcherNotification.color = mContext.getColor( - com.android.internal.R.color.system_notification_accent_color); - mImeSwitcherNotification.setLatestEventInfo( - mContext, title, summary, mImeSwitchPendingIntent); + mImeSwitcherNotification.setContentTitle(title) + .setContentText(summary) + .setContentIntent(mImeSwitchPendingIntent); if ((mNotificationManager != null) && !mWindowManagerService.hasNavigationBar()) { if (DEBUG) { @@ -1778,7 +1774,7 @@ public class InputMethodManagerService extends IInputMethodManager.Stub } mNotificationManager.notifyAsUser(null, com.android.internal.R.string.select_input_method, - mImeSwitcherNotification, UserHandle.ALL); + mImeSwitcherNotification.build(), UserHandle.ALL); mNotificationShown = true; } } else { |