生活随笔
收集整理的這篇文章主要介紹了
Android 10 SystemUI 如何隐藏状态栏输入法图标
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
代碼路徑:
frameworks/base/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java
在InputMethodManagerService.java文件中updateStatusIcon方法中將mStatusBar.setIconVisibility(mSlotIme, true)的true改為false
@BinderThreadprivate void updateStatusIcon(@NonNull IBinder token, String packageName,@DrawableRes int iconId) {synchronized (mMethodMap) {if (!calledWithValidTokenLocked(token)) {return;}final long ident = Binder.clearCallingIdentity();try {if (iconId == 0) {if (DEBUG) Slog.d(TAG, "hide the small icon for the input method");if (mStatusBar != null) {mStatusBar.setIconVisibility(mSlotIme, false);}} else if (packageName != null) {if (DEBUG) Slog.d(TAG, "show a small icon for the input method");CharSequence contentDescription = null;try {// Use PackageManager to load labelfinal PackageManager packageManager = mContext.getPackageManager();contentDescription = packageManager.getApplicationLabel(mIPackageManager.getApplicationInfo(packageName, 0,mSettings.getCurrentUserId()));} catch (RemoteException e) {/* ignore */}if (mStatusBar != null) {mStatusBar.setIcon(mSlotIme, packageName, iconId, 0,contentDescription != null? contentDescription.toString() : null);mStatusBar.setIconVisibility(mSlotIme, true);}}} finally {Binder.restoreCallingIdentity(ident);}}}
總結
以上是生活随笔為你收集整理的Android 10 SystemUI 如何隐藏状态栏输入法图标的全部內容,希望文章能夠幫你解決所遇到的問題。
如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。