diff options
44 files changed, 373 insertions, 147 deletions
diff --git a/apex/media/framework/java/android/media/MediaSession2.java b/apex/media/framework/java/android/media/MediaSession2.java index 081e76ab0215..6560afedab0f 100644 --- a/apex/media/framework/java/android/media/MediaSession2.java +++ b/apex/media/framework/java/android/media/MediaSession2.java @@ -404,7 +404,7 @@ public class MediaSession2 implements AutoCloseable { mCallback.onPostConnect(MediaSession2.this, controllerInfo); connected = true; } finally { - if (!connected) { + if (!connected || isClosed()) { if (DEBUG) { Log.d(TAG, "Rejecting connection or notifying that session is closed" + ", controllerInfo=" + controllerInfo); diff --git a/cmds/statsd/src/atoms.proto b/cmds/statsd/src/atoms.proto index 12e428ce5674..7a016522d597 100644 --- a/cmds/statsd/src/atoms.proto +++ b/cmds/statsd/src/atoms.proto @@ -587,6 +587,8 @@ message Atom { BytesTransferByTagAndMetered bytes_transfer_by_tag_and_metered = 10083 [(module) = "framework"]; DNDModeProto dnd_mode_rule = 10084 [(module) = "framework"]; + GeneralExternalStorageAccessStats general_external_storage_access_stats = + 10085 [(module) = "mediaprovider"]; } // DO NOT USE field numbers above 100,000 in AOSP. @@ -4553,6 +4555,31 @@ message VmsClientConnectionStateChanged { optional State state = 2; } +message MimeTypes { + repeated string mime_types = 1; +} + +/** + * Logs statistics regarding accesses to external storage. + * All stats are normalized for one day period. + * + * Logged from: + * packages/providers/MediaProvider/src/com/android/providers/media/MediaProvider.java + */ +message GeneralExternalStorageAccessStats { + optional int32 uid = 1 [(is_uid) = true]; + // Total number of accesses like creation, open, delete and rename/update. + // Includes file path and ContentResolver accesses + optional uint32 total_accesses = 2; + // Number of file path accesses, as opposed to file path and ContentResolver. + optional uint32 file_path_accesses = 3; + // Number of accesses on secondary volumes like SD cards. + // Includes file path and ContentResolver accesses + optional uint32 secondary_storage_accesses = 4; + // Comma-separated list of mime types that were accessed. + optional MimeTypes mime_types_accessed = 5; +} + /** * Logs when MediaProvider has successfully finished scanning a storage volume. * diff --git a/cmds/statsd/tools/localtools/src/com/android/statsd/shelltools/testdrive/TestDrive.java b/cmds/statsd/tools/localtools/src/com/android/statsd/shelltools/testdrive/TestDrive.java index 6384fb12ca68..51bcad115cc5 100644 --- a/cmds/statsd/tools/localtools/src/com/android/statsd/shelltools/testdrive/TestDrive.java +++ b/cmds/statsd/tools/localtools/src/com/android/statsd/shelltools/testdrive/TestDrive.java @@ -342,6 +342,9 @@ public class TestDrive { .addPullAtomPackages(PullAtomPackages.newBuilder() .setAtomId(Atom.TRAIN_INFO_FIELD_NUMBER) .addPackages("AID_STATSD")) + .addPullAtomPackages(PullAtomPackages.newBuilder() + .setAtomId(Atom.GENERAL_EXTERNAL_STORAGE_ACCESS_STATS_FIELD_NUMBER) + .addPackages("com.google.android.providers.media.module")) .setHashStringsInMetricReport(false); } } diff --git a/core/java/android/app/ContextImpl.java b/core/java/android/app/ContextImpl.java index 86a3579effe1..a828aac78ded 100644 --- a/core/java/android/app/ContextImpl.java +++ b/core/java/android/app/ContextImpl.java @@ -1900,11 +1900,13 @@ class ContextImpl extends Context { @Override public Object getSystemService(String name) { + // We may override this API from outer context. + final boolean isUiContext = isUiContext() || getOuterContext().isUiContext(); // Check incorrect Context usage. - if (isUiComponent(name) && !isUiContext() && vmIncorrectContextUseEnabled()) { + if (isUiComponent(name) && !isUiContext && vmIncorrectContextUseEnabled()) { final String errorMessage = "Tried to access visual service " + SystemServiceRegistry.getSystemServiceClassName(name) - + " from a non-visual Context. "; + + " from a non-visual Context:" + getOuterContext(); final String message = "Visual services, such as WindowManager, WallpaperService or " + "LayoutInflater should be accessed from Activity or other visual Context. " + "Use an Activity or a Context created with " @@ -2369,6 +2371,7 @@ class ContextImpl extends Context { context.setResources(createResources(mToken, mPackageInfo, mSplitName, displayId, overrideConfiguration, getDisplayAdjustments(displayId).getCompatibilityInfo(), mResources.getLoaders())); + context.mIsUiContext = isUiContext() || getOuterContext().isUiContext(); return context; } diff --git a/core/java/android/view/ViewConfiguration.java b/core/java/android/view/ViewConfiguration.java index 0d2d4d13eb38..ffeeb806ba54 100644 --- a/core/java/android/view/ViewConfiguration.java +++ b/core/java/android/view/ViewConfiguration.java @@ -500,12 +500,13 @@ public class ViewConfiguration { */ public static ViewConfiguration get(Context context) { if (!context.isUiContext() && vmIncorrectContextUseEnabled()) { - final String errorMessage = "Tried to access UI constants from a non-visual Context."; + final String errorMessage = "Tried to access UI constants from a non-visual Context:" + + context; final String message = "UI constants, such as display metrics or window metrics, " + "must be accessed from Activity or other visual Context. " + "Use an Activity or a Context created with " + "Context#createWindowContext(int, Bundle), which are adjusted to the " - + "configuration and visual bounds of an area on screen."; + + "configuration and visual bounds of an area on screen"; final Exception exception = new IllegalArgumentException(errorMessage); StrictMode.onIncorrectContextUsed(message, exception); Log.e(TAG, errorMessage + message, exception); diff --git a/data/etc/services.core.protolog.json b/data/etc/services.core.protolog.json index 33ab16de7905..67a64ac592f2 100644 --- a/data/etc/services.core.protolog.json +++ b/data/etc/services.core.protolog.json @@ -757,6 +757,12 @@ "group": "WM_DEBUG_BOOT", "at": "com\/android\/server\/wm\/WindowManagerService.java" }, + "-547111355": { + "message": "hideIme Control target: %s ", + "level": "DEBUG", + "group": "WM_DEBUG_IME", + "at": "com\/android\/server\/wm\/WindowManagerService.java" + }, "-545190927": { "message": "<<< CLOSE TRANSACTION animate", "level": "INFO", @@ -1087,6 +1093,12 @@ "group": "WM_ERROR", "at": "com\/android\/server\/wm\/WindowManagerService.java" }, + "95216706": { + "message": "hideIme target: %s ", + "level": "DEBUG", + "group": "WM_DEBUG_IME", + "at": "com\/android\/server\/wm\/WindowManagerService.java" + }, "95281111": { "message": "Attempted to get IME flag of a display that does not exist: %d", "level": "WARN", diff --git a/media/java/android/media/MediaCodecInfo.java b/media/java/android/media/MediaCodecInfo.java index 197786f42490..c2168f12a351 100644 --- a/media/java/android/media/MediaCodecInfo.java +++ b/media/java/android/media/MediaCodecInfo.java @@ -654,6 +654,9 @@ public final class MediaCodecInfo { * <p> * * The following table summarizes the format keys considered by this method. + * This is especially important to consider when targeting a higher SDK version than the + * minimum SDK version, as this method will disregard some keys on devices below the target + * SDK version. * * <table style="width: 0%"> * <thead> @@ -668,7 +671,7 @@ public final class MediaCodecInfo { * </thead> * <tbody> * <tr> - * <td>{@link android.os.Build.VERSION_CODES#LOLLIPOP}</th> + * <td>{@link android.os.Build.VERSION_CODES#LOLLIPOP}</td> * <td rowspan=3>{@link MediaFormat#KEY_MIME}<sup>*</sup>,<br> * {@link MediaFormat#KEY_SAMPLE_RATE},<br> * {@link MediaFormat#KEY_CHANNEL_COUNT},</td> @@ -679,30 +682,51 @@ public final class MediaCodecInfo { * {@link MediaFormat#KEY_WIDTH},<br> * {@link MediaFormat#KEY_HEIGHT},<br> * <strong>no</strong> {@code KEY_FRAME_RATE}</td> - * <td rowspan=4>{@link MediaFormat#KEY_BITRATE_MODE},<br> + * <td rowspan=10>as to the left, plus<br> + * {@link MediaFormat#KEY_BITRATE_MODE},<br> * {@link MediaFormat#KEY_PROFILE} * (and/or {@link MediaFormat#KEY_AAC_PROFILE}<sup>~</sup>),<br> * <!-- {link MediaFormat#KEY_QUALITY},<br> --> * {@link MediaFormat#KEY_COMPLEXITY} * (and/or {@link MediaFormat#KEY_FLAC_COMPRESSION_LEVEL}<sup>~</sup>)</td> * </tr><tr> - * <td>{@link android.os.Build.VERSION_CODES#LOLLIPOP_MR1}</th> + * <td>{@link android.os.Build.VERSION_CODES#LOLLIPOP_MR1}</td> * <td rowspan=2>as above, plus<br> * {@link MediaFormat#KEY_FRAME_RATE}</td> * </tr><tr> - * <td>{@link android.os.Build.VERSION_CODES#M}</th> + * <td>{@link android.os.Build.VERSION_CODES#M}</td> * </tr><tr> - * <td>{@link android.os.Build.VERSION_CODES#N}</th> - * <td>as above, plus<br> + * <td>{@link android.os.Build.VERSION_CODES#N}</td> + * <td rowspan=2>as above, plus<br> * {@link MediaFormat#KEY_PROFILE},<br> * <!-- {link MediaFormat#KEY_MAX_BIT_RATE},<br> --> * {@link MediaFormat#KEY_BIT_RATE}</td> - * <td>as above, plus<br> + * <td rowspan=2>as above, plus<br> * {@link MediaFormat#KEY_PROFILE},<br> * {@link MediaFormat#KEY_LEVEL}<sup>+</sup>,<br> * <!-- {link MediaFormat#KEY_MAX_BIT_RATE},<br> --> * {@link MediaFormat#KEY_BIT_RATE},<br> * {@link CodecCapabilities#FEATURE_IntraRefresh}<sup>E</sup></td> + * </tr><tr> + * <td>{@link android.os.Build.VERSION_CODES#N_MR1}</td> + * </tr><tr> + * <td>{@link android.os.Build.VERSION_CODES#O}</td> + * <td rowspan=3 colspan=2>as above, plus<br> + * {@link CodecCapabilities#FEATURE_PartialFrame}<sup>D</sup></td> + * </tr><tr> + * <td>{@link android.os.Build.VERSION_CODES#O_MR1}</td> + * </tr><tr> + * <td>{@link android.os.Build.VERSION_CODES#P}</td> + * </tr><tr> + * <td>{@link android.os.Build.VERSION_CODES#Q}</td> + * <td colspan=2>as above, plus<br> + * {@link CodecCapabilities#FEATURE_FrameParsing}<sup>D</sup>,<br> + * {@link CodecCapabilities#FEATURE_MultipleFrames},<br> + * {@link CodecCapabilities#FEATURE_DynamicTimestamp}</td> + * </tr><tr> + * <td>{@link android.os.Build.VERSION_CODES#R}</td> + * <td colspan=2>as above, plus<br> + * {@link CodecCapabilities#FEATURE_LowLatency}<sup>D</sup></td> * </tr> * <tr> * <td colspan=4> diff --git a/media/java/android/media/MediaRoute2Info.java b/media/java/android/media/MediaRoute2Info.java index fad25e071f90..7e9d2d809fdd 100644 --- a/media/java/android/media/MediaRoute2Info.java +++ b/media/java/android/media/MediaRoute2Info.java @@ -313,6 +313,14 @@ public final class MediaRoute2Info implements Parcelable { public static final String FEATURE_REMOTE_VIDEO_PLAYBACK = "android.media.route.feature.REMOTE_VIDEO_PLAYBACK"; + /** + * Route feature: Remote group playback. + * <p> + * @hide + */ + public static final String FEATURE_REMOTE_GROUP_PLAYBACK = + "android.media.route.feature.REMOTE_GROUP_PLAYBACK"; + final String mId; final CharSequence mName; final List<String> mFeatures; diff --git a/packages/SystemUI/res/values-ar/strings.xml b/packages/SystemUI/res/values-ar/strings.xml index df2169624b37..ec1e076f8f67 100644 --- a/packages/SystemUI/res/values-ar/strings.xml +++ b/packages/SystemUI/res/values-ar/strings.xml @@ -721,7 +721,7 @@ <string name="inline_turn_off_notifications" msgid="8543989584403106071">"إيقاف الإشعارات"</string> <string name="inline_keep_showing_app" msgid="4393429060390649757">"هل تريد الاستمرار في تلقي إشعارات من هذا التطبيق؟"</string> <string name="notification_silence_title" msgid="8608090968400832335">"صامتة"</string> - <string name="notification_alert_title" msgid="3656229781017543655">"تلقائي"</string> + <string name="notification_alert_title" msgid="3656229781017543655">"تلقائية"</string> <string name="notification_bubble_title" msgid="8330481035191903164">"فقاعة"</string> <string name="notification_channel_summary_low" msgid="4860617986908931158">"بدون صوت أو اهتزاز"</string> <string name="notification_conversation_summary_low" msgid="1734433426085468009">"بدون صوت أو اهتزاز وتظهر في موضع أسفل في قسم المحادثات"</string> @@ -1045,7 +1045,7 @@ <string name="magnification_overlay_title" msgid="6584179429612427958">"نافذة تراكب التكبير"</string> <string name="magnification_window_title" msgid="4863914360847258333">"نافذة التكبير"</string> <string name="magnification_controls_title" msgid="8421106606708891519">"عناصر التحكم في نافذة التكبير"</string> - <string name="quick_controls_title" msgid="6839108006171302273">"أدوات التحكم بالجهاز"</string> + <string name="quick_controls_title" msgid="6839108006171302273">"أدوات التحكم بالأجهزة"</string> <string name="quick_controls_subtitle" msgid="1667408093326318053">"إضافة عناصر تحكّم لأجهزتك المتصلة"</string> <string name="quick_controls_setup_title" msgid="8901436655997849822">"إعداد أدوات التحكم بالجهاز"</string> <string name="quick_controls_setup_subtitle" msgid="1681506617879773824">"اضغط مع الاستمرار على زر التشغيل للوصول إلى عناصر التحكّم"</string> diff --git a/packages/SystemUI/res/values-as/strings.xml b/packages/SystemUI/res/values-as/strings.xml index 949852802b2c..289efd5c7f52 100644 --- a/packages/SystemUI/res/values-as/strings.xml +++ b/packages/SystemUI/res/values-as/strings.xml @@ -1046,8 +1046,7 @@ <string name="controls_favorite_rearrange" msgid="5616952398043063519">"নিয়ন্ত্ৰণসমূহ পুনৰ সজাবলৈ ধৰি ৰাখক আৰু টানি আনি এৰক"</string> <string name="controls_favorite_removed" msgid="5276978408529217272">"সকলো নিয়ন্ত্ৰণ আঁতৰোৱা হৈছে"</string> <string name="controls_favorite_toast_no_changes" msgid="7094494210840877931">"সালসলনিসমূহ ছেভ নহ’ল"</string> - <!-- no translation found for controls_favorite_see_other_apps (7709087332255283460) --> - <skip /> + <string name="controls_favorite_see_other_apps" msgid="7709087332255283460">"অন্য এপ্সমূহ চাওক"</string> <string name="controls_favorite_load_error" msgid="5126216176144877419">"নিয়ন্ত্ৰণসমূহ ল’ড কৰিবপৰা নগ’ল। এপ্টোৰ ছেটিংসমূহ সলনি কৰা হোৱা নাই বুলি নিশ্চিত কৰিবলৈ <xliff:g id="APP">%s</xliff:g> এপ্টো পৰীক্ষা কৰক।"</string> <string name="controls_favorite_load_none" msgid="7687593026725357775">"সমিল নিয়ন্ত্ৰণসমূহ উপলব্ধ নহয়"</string> <string name="controls_favorite_other_zone_header" msgid="9089613266575525252">"অন্য"</string> diff --git a/packages/SystemUI/res/values-bs/strings.xml b/packages/SystemUI/res/values-bs/strings.xml index 9dbb82cbfa86..34f4b9fbc3e2 100644 --- a/packages/SystemUI/res/values-bs/strings.xml +++ b/packages/SystemUI/res/values-bs/strings.xml @@ -628,9 +628,7 @@ <string name="volume_ringer_status_silent" msgid="3691324657849880883">"Isključi zvuk"</string> <string name="qs_status_phone_vibrate" msgid="7055409506885541979">"Na telefonu je uključena vibracija"</string> <string name="qs_status_phone_muted" msgid="3763664791309544103">"Zvuk na telefonu je isključen"</string> - <!-- String.format failed for translation --> - <!-- no translation found for volume_stream_content_description_unmute (7729576371406792977) --> - <skip /> + <string name="volume_stream_content_description_unmute" msgid="7729576371406792977">"%1$s. Dodirnite da uključite zvukove."</string> <string name="volume_stream_content_description_vibrate" msgid="4858111994183089761">"%1$s. Dodirnite za postavljanje vibracije. Zvukovi usluga pristupačnosti mogu biti isključeni."</string> <string name="volume_stream_content_description_mute" msgid="4079046784917920984">"%1$s. Dodirnite da isključite zvuk. Zvukovi usluga pristupačnosti mogu biti isključeni."</string> <string name="volume_stream_content_description_vibrate_a11y" msgid="2742330052979397471">"%1$s. Dodirnite da postavite vibraciju."</string> diff --git a/packages/SystemUI/res/values-gu/strings.xml b/packages/SystemUI/res/values-gu/strings.xml index ee286266ef28..54f45ea652e9 100644 --- a/packages/SystemUI/res/values-gu/strings.xml +++ b/packages/SystemUI/res/values-gu/strings.xml @@ -1046,8 +1046,7 @@ <string name="controls_favorite_rearrange" msgid="5616952398043063519">"નિયંત્રણોને ફરીથી ગોઠવવા માટે તેમને હોલ્ડ કરીને ખેંચો"</string> <string name="controls_favorite_removed" msgid="5276978408529217272">"બધા નિયંત્રણો કાઢી નાખ્યા"</string> <string name="controls_favorite_toast_no_changes" msgid="7094494210840877931">"ફેરફારો સાચવ્યા નથી"</string> - <!-- no translation found for controls_favorite_see_other_apps (7709087332255283460) --> - <skip /> + <string name="controls_favorite_see_other_apps" msgid="7709087332255283460">"અન્ય બધી ઍપ જુઓ"</string> <string name="controls_favorite_load_error" msgid="5126216176144877419">"નિયંત્રણો લોડ કરી શકાયા નથી. ઍપના સેટિંગ બદલાયા નથી તેની ખાતરી કરવા માટે <xliff:g id="APP">%s</xliff:g> ઍપ ચેક કરો."</string> <string name="controls_favorite_load_none" msgid="7687593026725357775">"સુસંગત નિયંત્રણો ઉપલબ્ધ નથી"</string> <string name="controls_favorite_other_zone_header" msgid="9089613266575525252">"અન્ય"</string> diff --git a/packages/SystemUI/res/values-hi/strings.xml b/packages/SystemUI/res/values-hi/strings.xml index 96d837fe77cb..1f6000b4f49d 100644 --- a/packages/SystemUI/res/values-hi/strings.xml +++ b/packages/SystemUI/res/values-hi/strings.xml @@ -1048,7 +1048,7 @@ <string name="controls_favorite_rearrange" msgid="5616952398043063519">"कंट्रोल का क्रम फिर से बदलने के लिए उन्हें दबाकर रखें और खींचें"</string> <string name="controls_favorite_removed" msgid="5276978408529217272">"सभी कंट्रोल हटा दिए गए"</string> <string name="controls_favorite_toast_no_changes" msgid="7094494210840877931">"बदलाव सेव नहीं किए गए"</string> - <string name="controls_favorite_see_other_apps" msgid="7709087332255283460">"अन्य ऐप्लिकेशन देखें"</string> + <string name="controls_favorite_see_other_apps" msgid="7709087332255283460">"दूसरे ऐप्लिकेशन देखें"</string> <string name="controls_favorite_load_error" msgid="5126216176144877419">"कंट्रोल लोड नहीं किए जा सके. <xliff:g id="APP">%s</xliff:g> ऐप्लिकेशन देखें, ताकि यह पक्का किया जा सके कि ऐप्लिकेशन की सेटिंग में कोई बदलाव नहीं हुआ है."</string> <string name="controls_favorite_load_none" msgid="7687593026725357775">"इस सेटिंग के साथ काम करने वाले कंट्रोल उपलब्ध नहीं हैं"</string> <string name="controls_favorite_other_zone_header" msgid="9089613266575525252">"अन्य"</string> diff --git a/packages/SystemUI/res/values-iw/strings.xml b/packages/SystemUI/res/values-iw/strings.xml index 7a5b446a6b52..cb4fade417f2 100644 --- a/packages/SystemUI/res/values-iw/strings.xml +++ b/packages/SystemUI/res/values-iw/strings.xml @@ -1058,8 +1058,7 @@ <string name="controls_favorite_rearrange" msgid="5616952398043063519">"יש ללחוץ לחיצה ארוכה ולגרור כדי לארגן מחדש את הפקדים"</string> <string name="controls_favorite_removed" msgid="5276978408529217272">"כל הפקדים הוסרו"</string> <string name="controls_favorite_toast_no_changes" msgid="7094494210840877931">"השינויים לא נשמרו"</string> - <!-- no translation found for controls_favorite_see_other_apps (7709087332255283460) --> - <skip /> + <string name="controls_favorite_see_other_apps" msgid="7709087332255283460">"הצגת אפליקציות אחרות"</string> <string name="controls_favorite_load_error" msgid="5126216176144877419">"לא ניתן היה לטעון את הפקדים. יש לבדוק את האפליקציה <xliff:g id="APP">%s</xliff:g> כדי לוודא שהגדרות האפליקציה לא השתנו."</string> <string name="controls_favorite_load_none" msgid="7687593026725357775">"פקדים תואמים לא זמינים"</string> <string name="controls_favorite_other_zone_header" msgid="9089613266575525252">"אחר"</string> diff --git a/packages/SystemUI/res/values-kn/strings.xml b/packages/SystemUI/res/values-kn/strings.xml index 58633e67656a..d545e3123f21 100644 --- a/packages/SystemUI/res/values-kn/strings.xml +++ b/packages/SystemUI/res/values-kn/strings.xml @@ -1046,8 +1046,7 @@ <string name="controls_favorite_rearrange" msgid="5616952398043063519">"ನಿಯಂತ್ರಣಗಳನ್ನು ಮರುಹೊಂದಿಸಲು ಹೋಲ್ಡ್ ಮಾಡಿ ಮತ್ತು ಡ್ರ್ಯಾಗ್ ಮಾಡಿ"</string> <string name="controls_favorite_removed" msgid="5276978408529217272">"ಎಲ್ಲಾ ನಿಯಂತ್ರಣಗಳನ್ನು ತೆಗೆದುಹಾಕಲಾಗಿದೆ"</string> <string name="controls_favorite_toast_no_changes" msgid="7094494210840877931">"ಬದಲಾವಣೆಗಳನ್ನು ಉಳಿಸಲಾಗಿಲ್ಲ"</string> - <!-- no translation found for controls_favorite_see_other_apps (7709087332255283460) --> - <skip /> + <string name="controls_favorite_see_other_apps" msgid="7709087332255283460">"ಇತರ ಆ್ಯಪ್ಗಳನ್ನು ವೀಕ್ಷಿಸಿ"</string> <string name="controls_favorite_load_error" msgid="5126216176144877419">"ನಿಯಂತ್ರಣಗಳನ್ನು ಲೋಡ್ ಮಾಡಲು ಸಾಧ್ಯವಾಗಲಿಲ್ಲ. ಆ್ಯಪ್ ಸೆಟ್ಟಿಂಗ್ಗಳು ಬದಲಾಗಿಲ್ಲ ಎಂದು ಖಚಿತಪಡಿಸಿಕೊಳ್ಳಲು <xliff:g id="APP">%s</xliff:g> ಆ್ಯಪ್ ಅನ್ನು ಪರಿಶೀಲಿಸಿ."</string> <string name="controls_favorite_load_none" msgid="7687593026725357775">"ಹೊಂದಾಣಿಕೆಯ ನಿಯಂತ್ರಣಗಳು ಲಭ್ಯವಿಲ್ಲ"</string> <string name="controls_favorite_other_zone_header" msgid="9089613266575525252">"ಇತರ"</string> diff --git a/packages/SystemUI/res/values-ml/strings.xml b/packages/SystemUI/res/values-ml/strings.xml index 280c0c43ac6a..2a3ce7460f20 100644 --- a/packages/SystemUI/res/values-ml/strings.xml +++ b/packages/SystemUI/res/values-ml/strings.xml @@ -1046,8 +1046,7 @@ <string name="controls_favorite_rearrange" msgid="5616952398043063519">"നിയന്ത്രണങ്ങൾ പുനഃക്രമീകരിക്കാൻ അമർത്തിപ്പിടിച്ച് വലിച്ചിടുക"</string> <string name="controls_favorite_removed" msgid="5276978408529217272">"എല്ലാ നിയന്ത്രണങ്ങളും നീക്കം ചെയ്തു"</string> <string name="controls_favorite_toast_no_changes" msgid="7094494210840877931">"മാറ്റങ്ങൾ സംരക്ഷിച്ചിട്ടില്ല"</string> - <!-- no translation found for controls_favorite_see_other_apps (7709087332255283460) --> - <skip /> + <string name="controls_favorite_see_other_apps" msgid="7709087332255283460">"മറ്റ് ആപ്പുകൾ കാണുക"</string> <string name="controls_favorite_load_error" msgid="5126216176144877419">"നിയന്ത്രണങ്ങൾ ലോഡ് ചെയ്യാനായില്ല. ആപ്പ് ക്രമീകരണം മാറ്റിയിട്ടില്ലെന്ന് ഉറപ്പാക്കാൻ <xliff:g id="APP">%s</xliff:g> ആപ്പ് പരിശോധിക്കുക."</string> <string name="controls_favorite_load_none" msgid="7687593026725357775">"അനുയോജ്യമായ നിയന്ത്രണങ്ങൾ ലഭ്യമല്ല"</string> <string name="controls_favorite_other_zone_header" msgid="9089613266575525252">"മറ്റുള്ളവ"</string> diff --git a/packages/SystemUI/res/values-mr/strings.xml b/packages/SystemUI/res/values-mr/strings.xml index 1c4ff5aabe84..850ef28a021f 100644 --- a/packages/SystemUI/res/values-mr/strings.xml +++ b/packages/SystemUI/res/values-mr/strings.xml @@ -1046,8 +1046,7 @@ <string name="controls_favorite_rearrange" msgid="5616952398043063519">"नियंत्रणांची पुनर्रचना करण्यासाठी धरून ठेवा आणि ड्रॅग करा"</string> <string name="controls_favorite_removed" msgid="5276978408529217272">"सर्व नियंत्रणे काढून टाकली आहेत"</string> <string name="controls_favorite_toast_no_changes" msgid="7094494210840877931">"बदल सेव्ह केले गेले नाहीत"</string> - <!-- no translation found for controls_favorite_see_other_apps (7709087332255283460) --> - <skip /> + <string name="controls_favorite_see_other_apps" msgid="7709087332255283460">"इतर अॅप्स पहा"</string> <string name="controls_favorite_load_error" msgid="5126216176144877419">"नियंत्रणे लोड करता अली नाहीत. ॲपची सेटिंग्ज बदलली नसल्याची खात्री करण्यासाठी <xliff:g id="APP">%s</xliff:g> ॲप तपासा."</string> <string name="controls_favorite_load_none" msgid="7687593026725357775">"कंपॅटिबल नियंत्रणे उपलब्ध नाहीत"</string> <string name="controls_favorite_other_zone_header" msgid="9089613266575525252">"इतर"</string> diff --git a/packages/SystemUI/res/values-ne/strings.xml b/packages/SystemUI/res/values-ne/strings.xml index 811d9d272cce..daa5f365aadb 100644 --- a/packages/SystemUI/res/values-ne/strings.xml +++ b/packages/SystemUI/res/values-ne/strings.xml @@ -1046,8 +1046,7 @@ <string name="controls_favorite_rearrange" msgid="5616952398043063519">"नियन्त्रणहरूको क्रम मिलाउन तिनलाई थिचेर ड्र्याग गर्नुहोस्"</string> <string name="controls_favorite_removed" msgid="5276978408529217272">"सबै नियन्त्रणहरू हटाइए"</string> <string name="controls_favorite_toast_no_changes" msgid="7094494210840877931">"परिवर्तनहरू सुरक्षित गरिएका छैनन्"</string> - <!-- no translation found for controls_favorite_see_other_apps (7709087332255283460) --> - <skip /> + <string name="controls_favorite_see_other_apps" msgid="7709087332255283460">"अन्य एपहरू हेर्नुहोस्"</string> <string name="controls_favorite_load_error" msgid="5126216176144877419">"नियन्त्रण सुविधाहरू लोड गर्न सकिएन। <xliff:g id="APP">%s</xliff:g> एपका सेटिङ परिवर्तन गरिएका छैनन् भन्ने कुरा सुनिश्चित गर्न उक्त एप जाँच्नुहोस्।"</string> <string name="controls_favorite_load_none" msgid="7687593026725357775">"मिल्दा नियन्त्रण सुविधाहरू उपलब्ध छैनन्"</string> <string name="controls_favorite_other_zone_header" msgid="9089613266575525252">"अन्य"</string> diff --git a/packages/SystemUI/res/values-pa/strings.xml b/packages/SystemUI/res/values-pa/strings.xml index 25cfb9c14cf9..e1d4a634eeb6 100644 --- a/packages/SystemUI/res/values-pa/strings.xml +++ b/packages/SystemUI/res/values-pa/strings.xml @@ -1046,8 +1046,7 @@ <string name="controls_favorite_rearrange" msgid="5616952398043063519">"ਕੰਟਰੋਲਾਂ ਨੂੰ ਮੁੜ-ਵਿਵਸਥਿਤ ਕਰਨ ਲਈ ਫੜ੍ਹ ਕੇ ਘਸੀਟੋ"</string> <string name="controls_favorite_removed" msgid="5276978408529217272">"ਸਾਰੇ ਕੰਟਰੋਲ ਹਟਾਏ ਗਏ"</string> <string name="controls_favorite_toast_no_changes" msgid="7094494210840877931">"ਤਬਦੀਲੀਆਂ ਨੂੰ ਰੱਖਿਅਤ ਨਹੀਂ ਕੀਤਾ ਗਿਆ"</string> - <!-- no translation found for controls_favorite_see_other_apps (7709087332255283460) --> - <skip /> + <string name="controls_favorite_see_other_apps" msgid="7709087332255283460">"ਹੋਰ ਐਪਾਂ ਦੇਖੋ"</string> <string name="controls_favorite_load_error" msgid="5126216176144877419">"ਕੰਟਰੋਲਾਂ ਨੂੰ ਲੋਡ ਨਹੀਂ ਕੀਤਾ ਜਾ ਸਕਿਆ। ਇਹ ਪੱਕਾ ਕਰਨ ਲਈ <xliff:g id="APP">%s</xliff:g> ਐਪ ਦੀ ਜਾਂਚ ਕਰੋ ਕਿ ਐਪ ਸੈਟਿੰਗਾਂ ਨਹੀਂ ਬਦਲੀਆਂ ਹਨ।"</string> <string name="controls_favorite_load_none" msgid="7687593026725357775">"ਕੋਈ ਅਨੁਰੂਪ ਕੰਟਰੋਲ ਉਪਲਬਧ ਨਹੀਂ ਹੈ"</string> <string name="controls_favorite_other_zone_header" msgid="9089613266575525252">"ਹੋਰ"</string> diff --git a/packages/SystemUI/res/values-te/strings.xml b/packages/SystemUI/res/values-te/strings.xml index 368e4e57787b..addc1b432e86 100644 --- a/packages/SystemUI/res/values-te/strings.xml +++ b/packages/SystemUI/res/values-te/strings.xml @@ -1046,8 +1046,7 @@ <string name="controls_favorite_rearrange" msgid="5616952398043063519">"నియంత్రణల క్రమం మార్చడానికి దేనినైనా పట్టుకుని, లాగి వదిలేయండి"</string> <string name="controls_favorite_removed" msgid="5276978408529217272">"అన్ని నియంత్రణలు తీసివేయబడ్డాయి"</string> <string name="controls_favorite_toast_no_changes" msgid="7094494210840877931">"మార్పులు సేవ్ చేయబడలేదు"</string> - <!-- no translation found for controls_favorite_see_other_apps (7709087332255283460) --> - <skip /> + <string name="controls_favorite_see_other_apps" msgid="7709087332255283460">"ఇతర యాప్లను చూడండి"</string> <string name="controls_favorite_load_error" msgid="5126216176144877419">"కంట్రోల్లను లోడ్ చేయడం సాధ్యపడలేదు. యాప్ సెట్టింగ్లు మారలేదని నిర్ధారించడానికి <xliff:g id="APP">%s</xliff:g> యాప్ను చెక్ చేయండి."</string> <string name="controls_favorite_load_none" msgid="7687593026725357775">"అనుకూల కంట్రోల్లు అందుబాటులో లేవు"</string> <string name="controls_favorite_other_zone_header" msgid="9089613266575525252">"ఇతరం"</string> diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/Bubble.java b/packages/SystemUI/src/com/android/systemui/bubbles/Bubble.java index 6dc8322a5cf3..c6d128631930 100644 --- a/packages/SystemUI/src/com/android/systemui/bubbles/Bubble.java +++ b/packages/SystemUI/src/com/android/systemui/bubbles/Bubble.java @@ -124,8 +124,26 @@ class Bubble implements BubbleViewProvider { private int mNotificationId; private int mAppUid = -1; + /** + * A bubble is created and can be updated. This intent is updated until the user first + * expands the bubble. Once the user has expanded the contents, we ignore the intent updates + * to prevent restarting the intent & possibly altering UI state in the activity in front of + * the user. + * + * Once the bubble is overflowed, the activity is finished and updates to the + * notification are respected. Typically an update to an overflowed bubble would result in + * that bubble being added back to the stack anyways. + */ @Nullable private PendingIntent mIntent; + private boolean mIntentActive; + @Nullable + private PendingIntent.CancelListener mIntentCancelListener; + + /** + * Sent when the bubble & notification are no longer visible to the user (i.e. no + * notification in the shade, no bubble in the stack or overflow). + */ @Nullable private PendingIntent mDeleteIntent; @@ -150,13 +168,19 @@ class Bubble implements BubbleViewProvider { mShowBubbleUpdateDot = false; } - /** Used in tests when no UI is required. */ @VisibleForTesting(visibility = PRIVATE) Bubble(@NonNull final NotificationEntry e, - @Nullable final BubbleController.NotificationSuppressionChangedListener listener) { + @Nullable final BubbleController.NotificationSuppressionChangedListener listener, + final BubbleController.PendingIntentCanceledListener intentCancelListener) { Objects.requireNonNull(e); mKey = e.getKey(); mSuppressionListener = listener; + mIntentCancelListener = intent -> { + if (mIntent != null) { + mIntent.unregisterCancelListener(mIntentCancelListener); + } + intentCancelListener.onPendingIntentCanceled(this); + }; setEntry(e); } @@ -238,6 +262,10 @@ class Bubble implements BubbleViewProvider { mExpandedView = null; } mIconView = null; + if (mIntent != null) { + mIntent.unregisterCancelListener(mIntentCancelListener); + } + mIntentActive = false; } void setPendingIntentCanceled() { @@ -371,11 +399,24 @@ class Bubble implements BubbleViewProvider { mDesiredHeight = entry.getBubbleMetadata().getDesiredHeight(); mDesiredHeightResId = entry.getBubbleMetadata().getDesiredHeightResId(); mIcon = entry.getBubbleMetadata().getIcon(); - mIntent = entry.getBubbleMetadata().getIntent(); + + if (!mIntentActive || mIntent == null) { + if (mIntent != null) { + mIntent.unregisterCancelListener(mIntentCancelListener); + } + mIntent = entry.getBubbleMetadata().getIntent(); + if (mIntent != null) { + mIntent.registerCancelListener(mIntentCancelListener); + } + } else if (mIntent != null && entry.getBubbleMetadata().getIntent() == null) { + // Was an intent bubble now it's a shortcut bubble... still unregister the listener + mIntent.unregisterCancelListener(mIntentCancelListener); + mIntent = null; + } mDeleteIntent = entry.getBubbleMetadata().getDeleteIntent(); } mIsImportantConversation = - entry.getChannel() == null ? false : entry.getChannel().isImportantConversation(); + entry.getChannel() != null && entry.getChannel().isImportantConversation(); } @Nullable @@ -395,10 +436,15 @@ class Bubble implements BubbleViewProvider { } /** - * @return if the bubble was ever expanded + * Sets if the intent used for this bubble is currently active (i.e. populating an + * expanded view, expanded or not). */ - boolean getWasAccessed() { - return mLastAccessed != 0L; + void setIntentActive() { + mIntentActive = true; + } + + boolean isIntentActive() { + return mIntentActive; } /** diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java index 6ea0cde44282..6f103b020814 100644 --- a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java +++ b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java @@ -263,6 +263,16 @@ public class BubbleController implements ConfigurationController.ConfigurationLi } /** + * Listener to be notified when a pending intent has been canceled for a bubble. + */ + public interface PendingIntentCanceledListener { + /** + * Called when the pending intent for a bubble has been canceled. + */ + void onPendingIntentCanceled(Bubble bubble); + } + + /** * Callback for when the BubbleController wants to interact with the notification pipeline to: * - Remove a previously bubbled notification * - Update the notification shade since bubbled notification should/shouldn't be showing @@ -390,6 +400,18 @@ public class BubbleController implements ConfigurationController.ConfigurationLi } } }); + mBubbleData.setPendingIntentCancelledListener(bubble -> { + if (bubble.getBubbleIntent() == null) { + return; + } + if (bubble.isIntentActive()) { + bubble.setPendingIntentCanceled(); + return; + } + mHandler.post( + () -> removeBubble(bubble.getKey(), + BubbleController.DISMISS_INVALID_INTENT)); + }); mNotificationEntryManager = entryManager; mNotificationGroupManager = groupManager; @@ -1101,23 +1123,7 @@ public class BubbleController implements ConfigurationController.ConfigurationLi // Lazy init stack view when a bubble is created ensureStackViewCreated(); bubble.setInflateSynchronously(mInflateSynchronously); - bubble.inflate( - b -> { - mBubbleData.notificationEntryUpdated(b, suppressFlyout, - showInShade); - if (bubble.getBubbleIntent() == null) { - return; - } - bubble.getBubbleIntent().registerCancelListener(pendingIntent -> { - if (bubble.getWasAccessed()) { - bubble.setPendingIntentCanceled(); - return; - } - mHandler.post( - () -> removeBubble(bubble.getKey(), - BubbleController.DISMISS_INVALID_INTENT)); - }); - }, + bubble.inflate(b -> mBubbleData.notificationEntryUpdated(b, suppressFlyout, showInShade), mContext, mStackView, mBubbleIconFactory, false /* skipInflation */); } diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleData.java b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleData.java index ec4304f184f9..d2dc506c8e5c 100644 --- a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleData.java +++ b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleData.java @@ -59,7 +59,7 @@ import javax.inject.Singleton; @Singleton public class BubbleData { - BubbleLogger mLogger = new BubbleLoggerImpl(); + private BubbleLogger mLogger = new BubbleLoggerImpl(); private static final String TAG = TAG_WITH_CLASS_NAME ? "BubbleData" : TAG_BUBBLES; @@ -137,6 +137,7 @@ public class BubbleData { @Nullable private BubbleController.NotificationSuppressionChangedListener mSuppressionListener; + private BubbleController.PendingIntentCanceledListener mCancelledListener; /** * We track groups with summaries that aren't visibly displayed but still kept around because @@ -167,6 +168,11 @@ public class BubbleData { mSuppressionListener = listener; } + public void setPendingIntentCancelledListener( + BubbleController.PendingIntentCanceledListener listener) { + mCancelledListener = listener; + } + public boolean hasBubbles() { return !mBubbles.isEmpty(); } @@ -236,7 +242,7 @@ public class BubbleData { bubbleToReturn = mPendingBubbles.get(key); } else if (entry != null) { // New bubble - bubbleToReturn = new Bubble(entry, mSuppressionListener); + bubbleToReturn = new Bubble(entry, mSuppressionListener, mCancelledListener); } else { // Persisted bubble being promoted bubbleToReturn = persistedBubble; diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleExpandedView.java b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleExpandedView.java index 1211fb491ced..3d3171208b15 100644 --- a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleExpandedView.java +++ b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleExpandedView.java @@ -183,6 +183,9 @@ public class BubbleExpandedView extends LinearLayout { // Apply flags to make behaviour match documentLaunchMode=always. fillInIntent.addFlags(FLAG_ACTIVITY_NEW_DOCUMENT); fillInIntent.addFlags(FLAG_ACTIVITY_MULTIPLE_TASK); + if (mBubble != null) { + mBubble.setIntentActive(); + } mActivityView.startActivity(mPendingIntent, fillInIntent, options); } } catch (RuntimeException e) { diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java index 6b5c8807fbd4..75f4809d752f 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java +++ b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java @@ -589,7 +589,7 @@ public class KeyguardViewMediator extends SystemUI implements Dumpable { if (targetUserId != ActivityManager.getCurrentUser()) { return; } - + if (DEBUG) Log.d(TAG, "keyguardDone"); tryKeyguardDone(); } @@ -608,6 +608,7 @@ public class KeyguardViewMediator extends SystemUI implements Dumpable { @Override public void keyguardDonePending(boolean strongAuth, int targetUserId) { Trace.beginSection("KeyguardViewMediator.mViewMediatorCallback#keyguardDonePending"); + if (DEBUG) Log.d(TAG, "keyguardDonePending"); if (targetUserId != ActivityManager.getCurrentUser()) { Trace.endSection(); return; @@ -626,6 +627,7 @@ public class KeyguardViewMediator extends SystemUI implements Dumpable { @Override public void keyguardGone() { Trace.beginSection("KeyguardViewMediator.mViewMediatorCallback#keyguardGone"); + if (DEBUG) Log.d(TAG, "keyguardGone"); mKeyguardViewControllerLazy.get().setKeyguardGoingAwayState(false); mKeyguardDisplayManager.hide(); Trace.endSection(); @@ -1690,9 +1692,14 @@ public class KeyguardViewMediator extends SystemUI implements Dumpable { }; private void tryKeyguardDone() { + if (DEBUG) { + Log.d(TAG, "tryKeyguardDone: pending - " + mKeyguardDonePending + ", animRan - " + + mHideAnimationRun + " animRunning - " + mHideAnimationRunning); + } if (!mKeyguardDonePending && mHideAnimationRun && !mHideAnimationRunning) { handleKeyguardDone(); } else if (!mHideAnimationRun) { + if (DEBUG) Log.d(TAG, "tryKeyguardDone: starting pre-hide animation"); mHideAnimationRun = true; mHideAnimationRunning = true; mKeyguardViewControllerLazy.get() @@ -1919,6 +1926,7 @@ public class KeyguardViewMediator extends SystemUI implements Dumpable { }; private final Runnable mHideAnimationFinishedRunnable = () -> { + Log.e(TAG, "mHideAnimationFinishedRunnable#run"); mHideAnimationRunning = false; tryKeyguardDone(); }; diff --git a/packages/SystemUI/src/com/android/systemui/media/MediaDataCombineLatest.kt b/packages/SystemUI/src/com/android/systemui/media/MediaDataCombineLatest.kt index 0904ebccd414..e8f0e069c98d 100644 --- a/packages/SystemUI/src/com/android/systemui/media/MediaDataCombineLatest.kt +++ b/packages/SystemUI/src/com/android/systemui/media/MediaDataCombineLatest.kt @@ -62,9 +62,9 @@ class MediaDataCombineLatest @Inject constructor( */ fun getData(): Map<String, MediaData> { return entries.filter { - (key, pair) -> pair.first != null + (key, pair) -> pair.first != null && pair.second != null }.mapValues { - (key, pair) -> pair.first!! + (key, pair) -> pair.first!!.copy(device = pair.second) } } diff --git a/packages/SystemUI/src/com/android/systemui/media/MediaHierarchyManager.kt b/packages/SystemUI/src/com/android/systemui/media/MediaHierarchyManager.kt index 3d2b72d8fd83..fc33391a9ad1 100644 --- a/packages/SystemUI/src/com/android/systemui/media/MediaHierarchyManager.kt +++ b/packages/SystemUI/src/com/android/systemui/media/MediaHierarchyManager.kt @@ -40,6 +40,28 @@ import javax.inject.Inject import javax.inject.Singleton /** + * Similarly to isShown but also excludes views that have 0 alpha + */ +val View.isShownNotFaded: Boolean + get() { + var current: View = this + while (true) { + if (current.visibility != View.VISIBLE) { + return false + } + if (current.alpha == 0.0f) { + return false + } + val parent = current.parent ?: return false // We are not attached to the view root + if (parent !is View) { + // we reached the viewroot, hurray + return true + } + current = parent + } + } + +/** * This manager is responsible for placement of the unique media view between the different hosts * and animate the positions of the views to achieve seamless transitions. */ @@ -368,7 +390,7 @@ class MediaHierarchyManager @Inject constructor( // non-trivial reattaching logic happening that will make the view not-shown earlier return true } - return mediaFrame.isShown || animator.isRunning || animationPending + return mediaFrame.isShownNotFaded || animator.isRunning || animationPending } private fun adjustAnimatorForTransition(desiredLocation: Int, previousLocation: Int) { diff --git a/packages/SystemUI/src/com/android/systemui/qs/QuickStatusBarHeader.java b/packages/SystemUI/src/com/android/systemui/qs/QuickStatusBarHeader.java index b5afe771926c..b07b1a9561ff 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/QuickStatusBarHeader.java +++ b/packages/SystemUI/src/com/android/systemui/qs/QuickStatusBarHeader.java @@ -44,6 +44,7 @@ import android.view.DisplayCutout; import android.view.View; import android.view.ViewGroup; import android.view.WindowInsets; +import android.widget.FrameLayout; import android.widget.ImageView; import android.widget.RelativeLayout; import android.widget.TextView; @@ -146,6 +147,7 @@ public class QuickStatusBarHeader extends RelativeLayout implements private final LifecycleRegistry mLifecycle = new LifecycleRegistry(this); private boolean mHasTopCutout = false; + private int mStatusBarPaddingTop = 0; private int mRoundedCornerPadding = 0; private int mContentMarginStart; private int mContentMarginEnd; @@ -339,6 +341,7 @@ public class QuickStatusBarHeader extends RelativeLayout implements mRoundedCornerPadding = resources.getDimensionPixelSize( R.dimen.rounded_corner_content_padding); + mStatusBarPaddingTop = resources.getDimensionPixelSize(R.dimen.status_bar_padding_top); // Update height for a few views, especially due to landscape mode restricting space. mHeaderTextContainerView.getLayoutParams().height = @@ -460,6 +463,11 @@ public class QuickStatusBarHeader extends RelativeLayout implements private void updateClockPadding() { int clockPaddingLeft = 0; int clockPaddingRight = 0; + + FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) getLayoutParams(); + int leftMargin = lp.leftMargin; + int rightMargin = lp.rightMargin; + // The clock might collide with cutouts, let's shift it out of the way. // We only do that if the inset is bigger than our own padding, since it's nicer to // align with @@ -467,16 +475,19 @@ public class QuickStatusBarHeader extends RelativeLayout implements // if there's a cutout, let's use at least the rounded corner inset int cutoutPadding = Math.max(mCutOutPaddingLeft, mRoundedCornerPadding); int contentMarginLeft = isLayoutRtl() ? mContentMarginEnd : mContentMarginStart; - clockPaddingLeft = Math.max(cutoutPadding - contentMarginLeft, 0); + clockPaddingLeft = Math.max(cutoutPadding - contentMarginLeft - leftMargin, 0); } if (mCutOutPaddingRight > 0) { // if there's a cutout, let's use at least the rounded corner inset int cutoutPadding = Math.max(mCutOutPaddingRight, mRoundedCornerPadding); int contentMarginRight = isLayoutRtl() ? mContentMarginStart : mContentMarginEnd; - clockPaddingRight = Math.max(cutoutPadding - contentMarginRight, 0); + clockPaddingRight = Math.max(cutoutPadding - contentMarginRight - rightMargin, 0); } - mSystemIconsView.setPadding(clockPaddingLeft, mWaterfallTopInset, clockPaddingRight, 0); + mSystemIconsView.setPadding(clockPaddingLeft, + mWaterfallTopInset + mStatusBarPaddingTop, + clockPaddingRight, + 0); } @Override diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java index 39949c82661f..b6a284c5e3c4 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java @@ -26,7 +26,6 @@ import android.os.UserHandle; import android.os.UserManager; import android.util.Log; import android.util.MathUtils; -import android.util.Slog; import android.view.KeyEvent; import android.view.LayoutInflater; import android.view.View; @@ -169,7 +168,7 @@ public class KeyguardBouncer { // This condition may indicate an error on Android, so log it. if (!allowDismissKeyguard) { - Slog.w(TAG, "User can't dismiss keyguard: " + activeUserId + " != " + keyguardUserId); + Log.w(TAG, "User can't dismiss keyguard: " + activeUserId + " != " + keyguardUserId); } mShowingSoon = true; diff --git a/packages/SystemUI/tests/src/com/android/systemui/bubbles/BubbleDataTest.java b/packages/SystemUI/tests/src/com/android/systemui/bubbles/BubbleDataTest.java index ed4e6865e508..315caeebe0e9 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/bubbles/BubbleDataTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/bubbles/BubbleDataTest.java @@ -107,6 +107,9 @@ public class BubbleDataTest extends SysuiTestCase { @Mock private BubbleController.NotificationSuppressionChangedListener mSuppressionListener; + @Mock + private BubbleController.PendingIntentCanceledListener mPendingIntentCanceledListener; + @Before public void setUp() throws Exception { mNotificationTestHelper = new NotificationTestHelper( @@ -127,20 +130,20 @@ public class BubbleDataTest extends SysuiTestCase { modifyRanking(mEntryInterruptive) .setVisuallyInterruptive(true) .build(); - mBubbleInterruptive = new Bubble(mEntryInterruptive, mSuppressionListener); + mBubbleInterruptive = new Bubble(mEntryInterruptive, mSuppressionListener, null); ExpandableNotificationRow row = mNotificationTestHelper.createBubble(); mEntryDismissed = createBubbleEntry(1, "dismissed", "package.d"); mEntryDismissed.setRow(row); - mBubbleDismissed = new Bubble(mEntryDismissed, mSuppressionListener); + mBubbleDismissed = new Bubble(mEntryDismissed, mSuppressionListener, null); - mBubbleA1 = new Bubble(mEntryA1, mSuppressionListener); - mBubbleA2 = new Bubble(mEntryA2, mSuppressionListener); - mBubbleA3 = new Bubble(mEntryA3, mSuppressionListener); - mBubbleB1 = new Bubble(mEntryB1, mSuppressionListener); - mBubbleB2 = new Bubble(mEntryB2, mSuppressionListener); - mBubbleB3 = new Bubble(mEntryB3, mSuppressionListener); - mBubbleC1 = new Bubble(mEntryC1, mSuppressionListener); + mBubbleA1 = new Bubble(mEntryA1, mSuppressionListener, mPendingIntentCanceledListener); + mBubbleA2 = new Bubble(mEntryA2, mSuppressionListener, mPendingIntentCanceledListener); + mBubbleA3 = new Bubble(mEntryA3, mSuppressionListener, mPendingIntentCanceledListener); + mBubbleB1 = new Bubble(mEntryB1, mSuppressionListener, mPendingIntentCanceledListener); + mBubbleB2 = new Bubble(mEntryB2, mSuppressionListener, mPendingIntentCanceledListener); + mBubbleB3 = new Bubble(mEntryB3, mSuppressionListener, mPendingIntentCanceledListener); + mBubbleC1 = new Bubble(mEntryC1, mSuppressionListener, mPendingIntentCanceledListener); mBubbleData = new BubbleData(getContext()); @@ -847,14 +850,6 @@ public class BubbleDataTest extends SysuiTestCase { when(entry.getSbn().getPostTime()).thenReturn(postTime); } - private void setOngoing(NotificationEntry entry, boolean ongoing) { - if (ongoing) { - entry.getSbn().getNotification().flags |= Notification.FLAG_FOREGROUND_SERVICE; - } else { - entry.getSbn().getNotification().flags &= ~Notification.FLAG_FOREGROUND_SERVICE; - } - } - /** * No ExpandableNotificationRow is required to test BubbleData. This setup is all that is * required for BubbleData functionality and verification. NotificationTestHelper is used only diff --git a/packages/SystemUI/tests/src/com/android/systemui/bubbles/BubbleTest.java b/packages/SystemUI/tests/src/com/android/systemui/bubbles/BubbleTest.java index be03923e7264..2bcc22c4b99e 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/bubbles/BubbleTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/bubbles/BubbleTest.java @@ -71,7 +71,7 @@ public class BubbleTest extends SysuiTestCase { .setNotification(mNotif) .build(); - mBubble = new Bubble(mEntry, mSuppressionListener); + mBubble = new Bubble(mEntry, mSuppressionListener, null); Intent target = new Intent(mContext, BubblesTestActivity.class); Notification.BubbleMetadata metadata = new Notification.BubbleMetadata.Builder( diff --git a/packages/SystemUI/tests/src/com/android/systemui/media/MediaDataCombineLatestTest.java b/packages/SystemUI/tests/src/com/android/systemui/media/MediaDataCombineLatestTest.java index 5d4693d3ccf8..dbc5596d9f4e 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/media/MediaDataCombineLatestTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/media/MediaDataCombineLatestTest.java @@ -39,6 +39,7 @@ import org.mockito.ArgumentCaptor; import org.mockito.Mock; import java.util.ArrayList; +import java.util.Map; @SmallTest @RunWith(AndroidTestingRunner.class) @@ -159,6 +160,18 @@ public class MediaDataCombineLatestTest extends SysuiTestCase { verify(mListener).onMediaDataLoaded(eq("NEW_KEY"), any(), captor.capture()); } + @Test + public void getDataIncludesDevice() { + // GIVEN that device and media events have been received + mDeviceListener.onMediaDeviceChanged(KEY, mDeviceData); + mDataListener.onMediaDataLoaded(KEY, null, mMediaData); + + // THEN the result of getData includes device info + Map<String, MediaData> results = mManager.getData(); + assertThat(results.get(KEY)).isNotNull(); + assertThat(results.get(KEY).getDevice()).isEqualTo(mDeviceData); + } + private MediaDataManager.Listener captureDataListener() { ArgumentCaptor<MediaDataManager.Listener> captor = ArgumentCaptor.forClass( MediaDataManager.Listener.class); diff --git a/services/core/java/com/android/server/StorageManagerService.java b/services/core/java/com/android/server/StorageManagerService.java index 6e8eca3f46cf..678387c540ed 100644 --- a/services/core/java/com/android/server/StorageManagerService.java +++ b/services/core/java/com/android/server/StorageManagerService.java @@ -4736,7 +4736,7 @@ class StorageManagerService extends IStorageManager.Stub return true; } - private void killAppForOpChange(int code, int uid, String packageName) { + private void killAppForOpChange(int code, int uid) { final IActivityManager am = ActivityManager.getService(); try { am.killUid(UserHandle.getAppId(uid), UserHandle.USER_ALL, @@ -4753,7 +4753,7 @@ class StorageManagerService extends IStorageManager.Stub switch(code) { case OP_REQUEST_INSTALL_PACKAGES: // Always kill regardless of op change, to remount apps /storage - killAppForOpChange(code, uid, packageName); + killAppForOpChange(code, uid); return; case OP_MANAGE_EXTERNAL_STORAGE: if (mode != MODE_ALLOWED) { @@ -4762,12 +4762,7 @@ class StorageManagerService extends IStorageManager.Stub // results in a bad UX, especially since the gid only gives access // to unreliable volumes, USB OTGs that are rarely mounted. The app // will get the external_storage gid on next organic restart. - if (packageName != null) { - killAppForOpChange(code, uid, packageName); - } else { - // TODO(b/158283222) this can happen, figure out if we need - // to kill in this case as well. - } + killAppForOpChange(code, uid); } return; case OP_LEGACY_STORAGE: diff --git a/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java b/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java index 9acb47538043..15e8a92ba0e4 100644 --- a/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java +++ b/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java @@ -4047,7 +4047,9 @@ public class InputMethodManagerService extends IInputMethodManager.Stub // Send it to window manager to hide IME from IME target window. // TODO(b/139861270): send to mCurClient.client once IMMS is aware of // actual IME target. - mWindowManagerInternal.hideIme(mHideRequestWindowMap.get(windowToken)); + mWindowManagerInternal.hideIme( + mHideRequestWindowMap.get(windowToken), + mCurClient.selfReportedDisplayId); } } else { // Send to window manager to show IME after IME layout finishes. diff --git a/services/core/java/com/android/server/media/MediaSessionService.java b/services/core/java/com/android/server/media/MediaSessionService.java index b45d450cd200..9b356f0e8eef 100644 --- a/services/core/java/com/android/server/media/MediaSessionService.java +++ b/services/core/java/com/android/server/media/MediaSessionService.java @@ -2099,7 +2099,7 @@ public class MediaSessionService extends SystemService implements Monitor { boolean asSystemService, KeyEvent keyEvent, boolean needWakeLock) { if (mCurrentFullUserRecord.getMediaButtonSessionLocked() instanceof MediaSession2Record) { - // TODO(jaewan): Implement + // TODO(jaewan): Make MediaSession2 to receive media key event return; } MediaSessionRecord session = null; diff --git a/services/core/java/com/android/server/media/MediaSessionStack.java b/services/core/java/com/android/server/media/MediaSessionStack.java index 402355a0161a..b678c8962a21 100644 --- a/services/core/java/com/android/server/media/MediaSessionStack.java +++ b/services/core/java/com/android/server/media/MediaSessionStack.java @@ -244,6 +244,10 @@ class MediaSessionStack { private MediaSessionRecordImpl findMediaButtonSession(int uid) { MediaSessionRecordImpl mediaButtonSession = null; for (MediaSessionRecordImpl session : mSessions) { + if (session instanceof MediaSession2Record) { + // TODO(jaewan): Make MediaSession2 to receive media key event + continue; + } if (uid == session.getUid()) { if (session.checkPlaybackActiveState( mAudioPlayerStateMonitor.isPlaybackActive(session.getUid()))) { diff --git a/services/core/java/com/android/server/notification/ShortcutHelper.java b/services/core/java/com/android/server/notification/ShortcutHelper.java index 94b690a4dfce..9c3d6d352c89 100644 --- a/services/core/java/com/android/server/notification/ShortcutHelper.java +++ b/services/core/java/com/android/server/notification/ShortcutHelper.java @@ -102,9 +102,13 @@ public class ShortcutHelper { HashMap<String, String> shortcutBubbles = mActiveShortcutBubbles.get(packageName); ArrayList<String> bubbleKeysToRemove = new ArrayList<>(); if (shortcutBubbles != null) { + // Copy to avoid a concurrent modification exception when we remove bubbles from + // shortcutBubbles. + final Set<String> shortcutIds = new HashSet<>(shortcutBubbles.keySet()); + // If we can't find one of our bubbles in the shortcut list, that bubble needs // to be removed. - for (String shortcutId : shortcutBubbles.keySet()) { + for (String shortcutId : shortcutIds) { boolean foundShortcut = false; for (int i = 0; i < shortcuts.size(); i++) { if (shortcuts.get(i).getId().equals(shortcutId)) { diff --git a/services/core/java/com/android/server/pm/PackageInstallerService.java b/services/core/java/com/android/server/pm/PackageInstallerService.java index f827721be3b7..91b2ea1853fa 100644 --- a/services/core/java/com/android/server/pm/PackageInstallerService.java +++ b/services/core/java/com/android/server/pm/PackageInstallerService.java @@ -522,7 +522,9 @@ public class PackageInstallerService extends IPackageInstaller.Stub implements if ((callingUid == Process.SHELL_UID) || (callingUid == Process.ROOT_UID)) { params.installFlags |= PackageManager.INSTALL_FROM_ADB; - + // adb installs can override the installingPackageName, but not the + // initiatingPackageName + installerPackageName = null; } else { if (callingUid != Process.SYSTEM_UID) { // The supplied installerPackageName must always belong to the calling app. diff --git a/services/core/java/com/android/server/pm/PackageManagerService.java b/services/core/java/com/android/server/pm/PackageManagerService.java index 670b88e4a0c9..f533eb2cf2be 100644 --- a/services/core/java/com/android/server/pm/PackageManagerService.java +++ b/services/core/java/com/android/server/pm/PackageManagerService.java @@ -11083,6 +11083,21 @@ public class PackageManagerService extends IPackageManager.Stub pkgSetting.forceQueryableOverride = true; } + // If this is part of a standard install, set the initiating package name, else rely on + // previous device state. + if (reconciledPkg.installArgs != null) { + InstallSource installSource = reconciledPkg.installArgs.installSource; + if (installSource.initiatingPackageName != null) { + final PackageSetting ips = mSettings.mPackages.get( + installSource.initiatingPackageName); + if (ips != null) { + installSource = installSource.setInitiatingPackageSignatures( + ips.signatures); + } + } + pkgSetting.setInstallSource(installSource); + } + // TODO(toddke): Consider a method specifically for modifying the Package object // post scan; or, moving this stuff out of the Package object since it has nothing // to do with the package on disk. @@ -16089,16 +16104,7 @@ public class PackageManagerService extends IPackageManager.Stub ps.setEnabled(COMPONENT_ENABLED_STATE_DEFAULT, userId, installerPackageName); } - if (installSource.initiatingPackageName != null) { - final PackageSetting ips = mSettings.mPackages.get( - installSource.initiatingPackageName); - if (ips != null) { - installSource = installSource.setInitiatingPackageSignatures( - ips.signatures); - } - } - ps.setInstallSource(installSource); - mSettings.addInstallerPackageNames(installSource); + mSettings.addInstallerPackageNames(ps.installSource); // When replacing an existing package, preserve the original install reason for all // users that had the package installed before. Similarly for uninstall reasons. @@ -19159,9 +19165,7 @@ public class PackageManagerService extends IPackageManager.Stub final boolean systemApp = isSystemApp(ps); final int userId = user == null ? UserHandle.USER_ALL : user.getIdentifier(); - if (ps.getPermissionsState().hasPermission(Manifest.permission.SUSPEND_APPS, userId)) { - unsuspendForSuspendingPackage(packageName, userId); - } + if ((!systemApp || (flags & PackageManager.DELETE_SYSTEM_APP) != 0) && userId != UserHandle.USER_ALL) { // The caller is asking that the package only be deleted for a single @@ -19219,6 +19223,20 @@ public class PackageManagerService extends IPackageManager.Stub outInfo, writeSettings); } + // If the package removed had SUSPEND_APPS, unset any restrictions that might have been in + // place for all affected users. + int[] affectedUserIds = (outInfo != null) ? outInfo.removedUsers : null; + if (affectedUserIds == null) { + affectedUserIds = resolveUserIds(userId); + } + for (final int affectedUserId : affectedUserIds) { + if (ps.getPermissionsState().hasPermission(Manifest.permission.SUSPEND_APPS, + affectedUserId)) { + unsuspendForSuspendingPackage(packageName, affectedUserId); + removeAllDistractingPackageRestrictions(affectedUserId); + } + } + // Take a note whether we deleted the package for all users if (outInfo != null) { outInfo.removedForAllUsers = mPackages.get(ps.name) == null; diff --git a/services/core/java/com/android/server/pm/PackageManagerShellCommand.java b/services/core/java/com/android/server/pm/PackageManagerShellCommand.java index 1a7490e8b327..8bbe9cc01ada 100644 --- a/services/core/java/com/android/server/pm/PackageManagerShellCommand.java +++ b/services/core/java/com/android/server/pm/PackageManagerShellCommand.java @@ -125,7 +125,6 @@ import java.util.Base64; import java.util.Collection; import java.util.Collections; import java.util.Comparator; -import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.Objects; @@ -291,7 +290,8 @@ class PackageManagerShellCommand extends ShellCommand { case "get-stagedsessions": return runListStagedSessions(); case "uninstall-system-updates": - return uninstallSystemUpdates(); + String packageName = getNextArg(); + return uninstallSystemUpdates(packageName); case "rollback-app": return runRollbackApp(); case "get-moduleinfo": @@ -409,15 +409,22 @@ class PackageManagerShellCommand extends ShellCommand { } } - private int uninstallSystemUpdates() { + private int uninstallSystemUpdates(String packageName) { final PrintWriter pw = getOutPrintWriter(); - List<String> failedUninstalls = new LinkedList<>(); + boolean failedUninstalls = false; try { - final ParceledListSlice<ApplicationInfo> packages = - mInterface.getInstalledApplications( - PackageManager.MATCH_SYSTEM_ONLY, UserHandle.USER_SYSTEM); final IPackageInstaller installer = mInterface.getPackageInstaller(); - List<ApplicationInfo> list = packages.getList(); + final List<ApplicationInfo> list; + if (packageName == null) { + final ParceledListSlice<ApplicationInfo> packages = + mInterface.getInstalledApplications( + PackageManager.MATCH_SYSTEM_ONLY, UserHandle.USER_SYSTEM); + list = packages.getList(); + } else { + list = new ArrayList<>(1); + list.add(mInterface.getApplicationInfo(packageName, + PackageManager.MATCH_SYSTEM_ONLY, UserHandle.USER_SYSTEM)); + } for (ApplicationInfo info : list) { if (info.isUpdatedSystemApp()) { pw.println("Uninstalling updates to " + info.packageName + "..."); @@ -430,7 +437,8 @@ class PackageManagerShellCommand extends ShellCommand { final int status = result.getIntExtra(PackageInstaller.EXTRA_STATUS, PackageInstaller.STATUS_FAILURE); if (status != PackageInstaller.STATUS_SUCCESS) { - failedUninstalls.add(info.packageName); + failedUninstalls = true; + pw.println("Couldn't uninstall package: " + info.packageName); } } } @@ -440,10 +448,7 @@ class PackageManagerShellCommand extends ShellCommand { + e.getMessage() + "]"); return 0; } - if (!failedUninstalls.isEmpty()) { - pw.println("Failure [Couldn't uninstall packages: " - + TextUtils.join(", ", failedUninstalls) - + "]"); + if (failedUninstalls) { return 0; } pw.println("Success"); @@ -3824,9 +3829,10 @@ class PackageManagerShellCommand extends ShellCommand { pw.println(" get-harmful-app-warning [--user <USER_ID>] <PACKAGE>"); pw.println(" Return the harmful app warning message for the given app, if present"); pw.println(); - pw.println(" uninstall-system-updates"); - pw.println(" Remove updates to all system applications and fall back to their /system " + - "version."); + pw.println(" uninstall-system-updates [<PACKAGE>]"); + pw.println(" Removes updates to the given system application and falls back to its"); + pw.println(" /system version. Does nothing if the given package is not a system app."); + pw.println(" If no package is specified, removes updates to all system applications."); pw.println(""); pw.println(" get-moduleinfo [--all | --installed] [module-name]"); pw.println(" Displays module info. If module-name is specified only that info is shown"); diff --git a/services/core/java/com/android/server/wm/TaskSnapshotController.java b/services/core/java/com/android/server/wm/TaskSnapshotController.java index 51cf858715b4..c2021303c11c 100644 --- a/services/core/java/com/android/server/wm/TaskSnapshotController.java +++ b/services/core/java/com/android/server/wm/TaskSnapshotController.java @@ -40,6 +40,7 @@ import android.util.ArraySet; import android.util.Slog; import android.view.InsetsSource; import android.view.InsetsState; +import android.view.InsetsState.InternalInsetsType; import android.view.SurfaceControl; import android.view.ThreadedRenderer; import android.view.WindowInsets; @@ -480,7 +481,9 @@ class TaskSnapshotController { task.getTaskDescription().getBackgroundColor(), 255); final LayoutParams attrs = mainWindow.getAttrs(); final InsetsPolicy insetsPolicy = mainWindow.getDisplayContent().getInsetsPolicy(); - final InsetsState insetsState = insetsPolicy.getInsetsForDispatch(mainWindow); + final InsetsState insetsState = + new InsetsState(insetsPolicy.getInsetsForDispatch(mainWindow)); + mergeInsetsSources(insetsState, mainWindow.getRequestedInsetsState()); final Rect systemBarInsets = getSystemBarInsets(mainWindow.getFrameLw(), insetsState); final SystemBarBackgroundPainter decorPainter = new SystemBarBackgroundPainter(attrs.flags, attrs.privateFlags, attrs.systemUiVisibility, task.getTaskDescription(), @@ -600,6 +603,15 @@ class TaskSnapshotController { return 0; } + static void mergeInsetsSources(InsetsState base, InsetsState other) { + for (@InternalInsetsType int type = 0; type < InsetsState.SIZE; type++) { + final InsetsSource source = other.peekSource(type); + if (source != null) { + base.addSource(source); + } + } + } + static Rect getSystemBarInsets(Rect frame, InsetsState state) { return state.calculateInsets(frame, null /* ignoringVisibilityState */, false /* isScreenRound */, false /* alwaysConsumeSystemBars */, diff --git a/services/core/java/com/android/server/wm/TaskSnapshotSurface.java b/services/core/java/com/android/server/wm/TaskSnapshotSurface.java index 3fc09c93550c..448b4aae7a88 100644 --- a/services/core/java/com/android/server/wm/TaskSnapshotSurface.java +++ b/services/core/java/com/android/server/wm/TaskSnapshotSurface.java @@ -42,6 +42,7 @@ import static com.android.internal.policy.DecorView.STATUS_BAR_COLOR_VIEW_ATTRIB import static com.android.internal.policy.DecorView.getNavigationBarRect; import static com.android.server.wm.ProtoLogGroup.WM_DEBUG_STARTING_WINDOW; import static com.android.server.wm.TaskSnapshotController.getSystemBarInsets; +import static com.android.server.wm.TaskSnapshotController.mergeInsetsSources; import static com.android.server.wm.WindowManagerDebugConfig.TAG_WITH_CLASS_NAME; import static com.android.server.wm.WindowManagerDebugConfig.TAG_WM; @@ -243,7 +244,9 @@ class TaskSnapshotSurface implements StartingSurface { final InsetsPolicy insetsPolicy = topFullscreenOpaqueWindow.getDisplayContent() .getInsetsPolicy(); - insetsState = insetsPolicy.getInsetsForDispatch(topFullscreenOpaqueWindow); + insetsState = + new InsetsState(insetsPolicy.getInsetsForDispatch(topFullscreenOpaqueWindow)); + mergeInsetsSources(insetsState, topFullscreenOpaqueWindow.getRequestedInsetsState()); } try { final int res = session.addToDisplay(window, window.mSeq, layoutParams, diff --git a/services/core/java/com/android/server/wm/WindowManagerInternal.java b/services/core/java/com/android/server/wm/WindowManagerInternal.java index c605e3e1ea60..315014c1b248 100644 --- a/services/core/java/com/android/server/wm/WindowManagerInternal.java +++ b/services/core/java/com/android/server/wm/WindowManagerInternal.java @@ -528,8 +528,9 @@ public abstract class WindowManagerInternal { * Hide IME using imeTargetWindow when requested. * * @param imeTargetWindowToken token of the (IME target) window on which IME should be hidden. + * @param displayId the id of the display the IME is on. */ - public abstract void hideIme(IBinder imeTargetWindowToken); + public abstract void hideIme(IBinder imeTargetWindowToken, int displayId); /** * Tell window manager about a package that should not be running with high refresh rate diff --git a/services/core/java/com/android/server/wm/WindowManagerService.java b/services/core/java/com/android/server/wm/WindowManagerService.java index f4281fc0cafd..0b50c1cd496a 100644 --- a/services/core/java/com/android/server/wm/WindowManagerService.java +++ b/services/core/java/com/android/server/wm/WindowManagerService.java @@ -90,6 +90,7 @@ import static com.android.server.wm.ProtoLogGroup.WM_DEBUG_ADD_REMOVE; import static com.android.server.wm.ProtoLogGroup.WM_DEBUG_BOOT; import static com.android.server.wm.ProtoLogGroup.WM_DEBUG_FOCUS; import static com.android.server.wm.ProtoLogGroup.WM_DEBUG_FOCUS_LIGHT; +import static com.android.server.wm.ProtoLogGroup.WM_DEBUG_IME; import static com.android.server.wm.ProtoLogGroup.WM_DEBUG_KEEP_SCREEN_ON; import static com.android.server.wm.ProtoLogGroup.WM_DEBUG_ORIENTATION; import static com.android.server.wm.ProtoLogGroup.WM_DEBUG_SCREEN_ON; @@ -7616,24 +7617,26 @@ public class WindowManagerService extends IWindowManager.Stub } @Override - public void hideIme(IBinder imeTargetWindowToken) { + public void hideIme(IBinder imeTargetWindowToken, int displayId) { synchronized (mGlobalLock) { WindowState imeTarget = mWindowMap.get(imeTargetWindowToken); - if (imeTarget == null) { - // The target window no longer exists. - return; + ProtoLog.d(WM_DEBUG_IME, "hideIme target: %s ", imeTarget); + DisplayContent dc = mRoot.getDisplayContent(displayId); + if (imeTarget != null) { + imeTarget = imeTarget.getImeControlTarget().getWindow(); + if (imeTarget != null) { + dc = imeTarget.getDisplayContent(); + } + // If there was a pending IME show(), reset it as IME has been + // requested to be hidden. + dc.getInsetsStateController().getImeSourceProvider().abortShowImePostLayout(); } - imeTarget = imeTarget.getImeControlTarget().getWindow(); - final DisplayContent dc = imeTarget != null - ? imeTarget.getDisplayContent() : getDefaultDisplayContentLocked(); - // If there was a pending IME show(), reset it as IME has been - // requested to be hidden. - dc.getInsetsStateController().getImeSourceProvider().abortShowImePostLayout(); - if (dc.mInputMethodControlTarget == null) { - return; + if (dc != null && dc.mInputMethodControlTarget != null) { + ProtoLog.d(WM_DEBUG_IME, "hideIme Control target: %s ", + dc.mInputMethodControlTarget); + dc.mInputMethodControlTarget.hideInsets( + WindowInsets.Type.ime(), true /* fromIme */); } - dc.mInputMethodControlTarget.hideInsets( - WindowInsets.Type.ime(), true /* fromIme */); } } |