diff options
26 files changed, 184 insertions, 295 deletions
diff --git a/core/java/android/app/INotificationManager.aidl b/core/java/android/app/INotificationManager.aidl index b3c2429004b8..e57738fbbfdd 100644 --- a/core/java/android/app/INotificationManager.aidl +++ b/core/java/android/app/INotificationManager.aidl @@ -102,7 +102,6 @@ interface INotificationManager NotificationChannelGroup getNotificationChannelGroup(String pkg, String channelGroupId); ParceledListSlice getNotificationChannelGroups(String pkg); boolean onlyHasDefaultChannel(String pkg, int uid); - ParceledListSlice getRecentNotifyingAppsForUser(int userId); int getBlockedAppCount(int userId); boolean areChannelsBypassingDnd(); int getAppsBypassingDndCount(int uid); diff --git a/core/java/android/app/Notification.java b/core/java/android/app/Notification.java index 15b571ffcd72..a869d85f7322 100644 --- a/core/java/android/app/Notification.java +++ b/core/java/android/app/Notification.java @@ -618,11 +618,13 @@ public class Notification implements Parcelable public static final int FLAG_CAN_COLORIZE = 0x00000800; /** - * Bit to be bitswised-ored into the {@link #flags} field that should be set if this - * notification is showing as a bubble. This will be set by the system if it is determined - * that your notification is allowed to be a bubble. + * Bit to be bitswised-ored into the {@link #flags} field that should be + * set by the system if this notification is showing as a bubble. * - * @see {@link Notification.Builder#setBubbleMetadata(BubbleMetadata)} + * Applications cannot set this flag directly; they should instead call + * {@link Notification.Builder#setBubbleMetadata(BubbleMetadata)} to + * request that a notification be displayed as a bubble, and then check + * this flag to see whether that request was honored by the system. */ public static final int FLAG_BUBBLE = 0x00001000; @@ -6253,7 +6255,7 @@ public class Notification implements Parcelable } /** - * @return true if this is a notification that can show as a bubble. + * @return true if this notification is showing as a bubble * * @hide */ diff --git a/core/java/android/service/notification/NotifyingApp.java b/core/java/android/service/notification/NotifyingApp.java index a56062340709..a4fc5fde3bc2 100644 --- a/core/java/android/service/notification/NotifyingApp.java +++ b/core/java/android/service/notification/NotifyingApp.java @@ -26,27 +26,27 @@ import java.util.Objects; */ public final class NotifyingApp implements Parcelable, Comparable<NotifyingApp> { - private int mUid; + private int mUserId; private String mPkg; private long mLastNotified; public NotifyingApp() {} protected NotifyingApp(Parcel in) { - mUid = in.readInt(); + mUserId = in.readInt(); mPkg = in.readString(); mLastNotified = in.readLong(); } - public int getUid() { - return mUid; + public int getUserId() { + return mUserId; } /** - * Sets the uid of the package that sent the notification. Returns self. + * Sets the userid of the package that sent the notification. Returns self. */ - public NotifyingApp setUid(int mUid) { - this.mUid = mUid; + public NotifyingApp setUserId(int mUserId) { + this.mUserId = mUserId; return this; } @@ -74,7 +74,7 @@ public final class NotifyingApp implements Parcelable, Comparable<NotifyingApp> return this; } - public static final @android.annotation.NonNull Creator<NotifyingApp> CREATOR = new Creator<NotifyingApp>() { + public static final @NonNull Creator<NotifyingApp> CREATOR = new Creator<NotifyingApp>() { @Override public NotifyingApp createFromParcel(Parcel in) { return new NotifyingApp(in); @@ -93,7 +93,7 @@ public final class NotifyingApp implements Parcelable, Comparable<NotifyingApp> @Override public void writeToParcel(Parcel dest, int flags) { - dest.writeInt(mUid); + dest.writeInt(mUserId); dest.writeString(mPkg); dest.writeLong(mLastNotified); } @@ -103,14 +103,14 @@ public final class NotifyingApp implements Parcelable, Comparable<NotifyingApp> if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; NotifyingApp that = (NotifyingApp) o; - return getUid() == that.getUid() + return getUserId() == that.getUserId() && getLastNotified() == that.getLastNotified() && Objects.equals(mPkg, that.mPkg); } @Override public int hashCode() { - return Objects.hash(getUid(), mPkg, getLastNotified()); + return Objects.hash(getUserId(), mPkg, getLastNotified()); } /** @@ -119,10 +119,10 @@ public final class NotifyingApp implements Parcelable, Comparable<NotifyingApp> @Override public int compareTo(NotifyingApp o) { if (getLastNotified() == o.getLastNotified()) { - if (getUid() == o.getUid()) { + if (getUserId() == o.getUserId()) { return getPackage().compareTo(o.getPackage()); } - return Integer.compare(getUid(), o.getUid()); + return Integer.compare(getUserId(), o.getUserId()); } return -Long.compare(getLastNotified(), o.getLastNotified()); @@ -131,7 +131,7 @@ public final class NotifyingApp implements Parcelable, Comparable<NotifyingApp> @Override public String toString() { return "NotifyingApp{" - + "mUid=" + mUid + + "mUserId=" + mUserId + ", mPkg='" + mPkg + '\'' + ", mLastNotified=" + mLastNotified + '}'; diff --git a/packages/PrintSpooler/res/values-mr/strings.xml b/packages/PrintSpooler/res/values-mr/strings.xml index b055d82eea1d..10dec8ecd341 100644 --- a/packages/PrintSpooler/res/values-mr/strings.xml +++ b/packages/PrintSpooler/res/values-mr/strings.xml @@ -56,8 +56,8 @@ <string name="print_select_printer" msgid="7388760939873368698">"प्रिंटर निवडा"</string> <string name="print_forget_printer" msgid="5035287497291910766">"प्रिंटर विसरा"</string> <plurals name="print_search_result_count_utterance" formatted="false" msgid="6997663738361080868"> - <item quantity="one"><xliff:g id="COUNT_1">%1$s</xliff:g> प्रिंटर आढळला</item> <item quantity="other"><xliff:g id="COUNT_1">%1$s</xliff:g> प्रिंटर आढळले</item> + <item quantity="one"><xliff:g id="COUNT_0">%1$s</xliff:g> प्रिंटर आढळला</item> </plurals> <string name="printer_extended_description_template" msgid="1366699227703381874">"<xliff:g id="PRINT_SERVICE_LABEL">%1$s</xliff:g> - <xliff:g id="PRINTER_DESCRIPTION">%2$s</xliff:g>"</string> <string name="printer_info_desc" msgid="7181988788991581654">"या प्रिंटर विषयी अधिक माहिती"</string> @@ -76,8 +76,8 @@ <string name="disabled_services_title" msgid="7313253167968363211">"अक्षम केलल्या सेवा"</string> <string name="all_services_title" msgid="5578662754874906455">"सर्व सेवा"</string> <plurals name="print_services_recommendation_subtitle" formatted="false" msgid="5678487708807185138"> - <item quantity="one"><xliff:g id="COUNT_1">%1$s</xliff:g> प्रिंटर शोधण्यासाठी इंस्टॉल करा</item> <item quantity="other"><xliff:g id="COUNT_1">%1$s</xliff:g> प्रिंटर शोधण्यासाठी इंस्टॉल करा</item> + <item quantity="one"><xliff:g id="COUNT_0">%1$s</xliff:g> प्रिंटर शोधण्यासाठी इंस्टॉल करा</item> </plurals> <string name="printing_notification_title_template" msgid="295903957762447362">"<xliff:g id="PRINT_JOB_NAME">%1$s</xliff:g> प्रिंट करत आहे"</string> <string name="cancelling_notification_title_template" msgid="1821759594704703197">"<xliff:g id="PRINT_JOB_NAME">%1$s</xliff:g> रद्द करत आहे"</string> diff --git a/packages/PrintSpooler/res/values-pa/strings.xml b/packages/PrintSpooler/res/values-pa/strings.xml index 4ce8f97315e3..1cacc1015a38 100644 --- a/packages/PrintSpooler/res/values-pa/strings.xml +++ b/packages/PrintSpooler/res/values-pa/strings.xml @@ -84,7 +84,7 @@ <string name="failed_notification_title_template" msgid="2256217208186530973">"ਪ੍ਰਿੰਟਰ ਅਸ਼ੁੱਧੀ <xliff:g id="PRINT_JOB_NAME">%1$s</xliff:g>"</string> <string name="blocked_notification_title_template" msgid="1175435827331588646">"ਪ੍ਰਿੰਟਰ ਬਲੌਕ ਕੀਤਾ <xliff:g id="PRINT_JOB_NAME">%1$s</xliff:g>"</string> <string name="cancel" msgid="4373674107267141885">"ਰੱਦ ਕਰੋ"</string> - <string name="restart" msgid="2472034227037808749">"ਰੀਸਟਾਰਟ ਕਰੋ"</string> + <string name="restart" msgid="2472034227037808749">"ਮੁੜ-ਸ਼ੁਰੂ ਕਰੋ"</string> <string name="no_connection_to_printer" msgid="2159246915977282728">"ਪ੍ਰਿੰਟਰ ਲਈ ਕੋਈ ਕਨੈਕਸ਼ਨ ਨਹੀਂ"</string> <string name="reason_unknown" msgid="5507940196503246139">"ਅਗਿਆਤ"</string> <string name="print_service_security_warning_title" msgid="2160752291246775320">"ਕੀ <xliff:g id="SERVICE">%1$s</xliff:g> ਵਰਤਣੀ ਹੈ?"</string> diff --git a/packages/PrintSpooler/res/values-sw/strings.xml b/packages/PrintSpooler/res/values-sw/strings.xml index 12f5b6002211..6550ba11d11d 100644 --- a/packages/PrintSpooler/res/values-sw/strings.xml +++ b/packages/PrintSpooler/res/values-sw/strings.xml @@ -107,5 +107,5 @@ <string name="print_error_retry" msgid="1426421728784259538">"Jaribu tena"</string> <string name="print_error_printer_unavailable" msgid="8985614415253203381">"Printa hii haipatikani kwa sasa."</string> <string name="print_cannot_load_page" msgid="6179560924492912009">"Haiwezi kupakia onyesho la kuchungulia"</string> - <string name="print_preparing_preview" msgid="3939930735671364712">"Inaandaa onyesho la kuchungulia..."</string> + <string name="print_preparing_preview" msgid="3939930735671364712">"Inaandaa onyesho ili ukague kwanza..."</string> </resources> diff --git a/packages/PrintSpooler/res/values-ta/strings.xml b/packages/PrintSpooler/res/values-ta/strings.xml index dbc1aea0154b..77737183452e 100644 --- a/packages/PrintSpooler/res/values-ta/strings.xml +++ b/packages/PrintSpooler/res/values-ta/strings.xml @@ -33,7 +33,7 @@ <string name="pages_range_example" msgid="8558694453556945172">"எ.கா. 1—5,8,11—13"</string> <string name="print_preview" msgid="8010217796057763343">"அச்சு மாதிரிக்காட்சி"</string> <string name="install_for_print_preview" msgid="6366303997385509332">"முன்னோட்டத்திற்காக PDF வியூவரை நிறுவுக"</string> - <string name="printing_app_crashed" msgid="854477616686566398">"அச்சிடல் பயன்பாடு சிதைவடைந்தது"</string> + <string name="printing_app_crashed" msgid="854477616686566398">"அச்சிடல் ஆப்ஸ் சிதைவடைந்தது"</string> <string name="generating_print_job" msgid="3119608742651698916">"அச்சுப் பணியைத் தொடங்குகிறது"</string> <string name="save_as_pdf" msgid="5718454119847596853">"PDF ஆக சேமி"</string> <string name="all_printers" msgid="5018829726861876202">"எல்லா அச்சுப்பொறிகளும்…"</string> diff --git a/packages/SystemUI/src/com/android/keyguard/CarrierTextController.java b/packages/SystemUI/src/com/android/keyguard/CarrierTextController.java index 12d1f7c3118d..c407ba8abf22 100644 --- a/packages/SystemUI/src/com/android/keyguard/CarrierTextController.java +++ b/packages/SystemUI/src/com/android/keyguard/CarrierTextController.java @@ -174,6 +174,9 @@ public class CarrierTextController { mSimSlotsNumber = ((TelephonyManager) context.getSystemService( Context.TELEPHONY_SERVICE)).getPhoneCount(); mSimErrorState = new boolean[mSimSlotsNumber]; + updateDisplayOpportunisticSubscriptionCarrierText(SystemProperties.getBoolean( + TelephonyProperties.DISPLAY_OPPORTUNISTIC_SUBSCRIPTION_CARRIER_TEXT_PROPERTY_NAME, + false)); } /** @@ -282,10 +285,8 @@ public class CarrierTextController { * */ @VisibleForTesting - public void updateDisplayOpportunisticSubscriptionCarrierText() { - mDisplayOpportunisticSubscriptionCarrierText = SystemProperties - .getBoolean(TelephonyProperties - .DISPLAY_OPPORTUNISTIC_SUBSCRIPTION_CARRIER_TEXT_PROPERTY_NAME, false); + public void updateDisplayOpportunisticSubscriptionCarrierText(boolean isEnable) { + mDisplayOpportunisticSubscriptionCarrierText = isEnable; } protected List<SubscriptionInfo> getSubscriptionInfo() { diff --git a/packages/SystemUI/src/com/android/systemui/assist/AssistManager.java b/packages/SystemUI/src/com/android/systemui/assist/AssistManager.java index 4ed28f92d5cb..68cf15d262de 100644 --- a/packages/SystemUI/src/com/android/systemui/assist/AssistManager.java +++ b/packages/SystemUI/src/com/android/systemui/assist/AssistManager.java @@ -15,6 +15,7 @@ import android.content.res.Configuration; import android.content.res.Resources; import android.graphics.PixelFormat; import android.graphics.Rect; +import android.metrics.LogMaker; import android.os.AsyncTask; import android.os.Binder; import android.os.Bundle; @@ -35,6 +36,8 @@ import android.widget.ImageView; import com.android.internal.app.AssistUtils; import com.android.internal.app.IVoiceInteractionSessionListener; import com.android.internal.app.IVoiceInteractionSessionShowCallback; +import com.android.internal.logging.MetricsLogger; +import com.android.internal.logging.nano.MetricsProto.MetricsEvent; import com.android.keyguard.KeyguardUpdateMonitor; import com.android.settingslib.applications.InterestingConfigChanges; import com.android.systemui.ConfigurationChangedReceiver; @@ -185,6 +188,10 @@ public class AssistManager implements ConfigurationChangedReceiver { args = new Bundle(); } args.putLong(INVOCATION_TIME_MS_KEY, SystemClock.uptimeMillis()); + // Logs assistant start with invocation type. + MetricsLogger.action( + new LogMaker(MetricsEvent.ASSISTANT) + .setType(MetricsEvent.TYPE_OPEN).setSubtype(args.getInt(INVOCATION_TYPE_KEY))); startAssistInternal(args, assistComponent, isService); } diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/BadgedImageView.java b/packages/SystemUI/src/com/android/systemui/bubbles/BadgedImageView.java index 98f446dea9b1..f15e8e47649c 100644 --- a/packages/SystemUI/src/com/android/systemui/bubbles/BadgedImageView.java +++ b/packages/SystemUI/src/com/android/systemui/bubbles/BadgedImageView.java @@ -23,6 +23,7 @@ import android.graphics.Rect; import android.util.AttributeSet; import android.widget.ImageView; +import com.android.internal.graphics.ColorUtils; import com.android.systemui.R; /** @@ -101,7 +102,7 @@ public class BadgedImageView extends ImageView { * The colour to use for the dot. */ public void setDotColor(int color) { - mUpdateDotColor = color; + mUpdateDotColor = ColorUtils.setAlphaComponent(color, 255 /* alpha */); invalidate(); } diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java index 9ecc6f448f17..cff03c9b4b9b 100644 --- a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java +++ b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java @@ -27,7 +27,7 @@ import static android.view.View.VISIBLE; import static android.view.ViewGroup.LayoutParams.MATCH_PARENT; import static com.android.systemui.statusbar.StatusBarState.SHADE; -import static com.android.systemui.statusbar.notification.NotificationAlertingManager.alertAgain; +import static com.android.systemui.statusbar.notification.NotificationEntryManager.UNDEFINED_DISMISS_REASON; import static java.lang.annotation.RetentionPolicy.SOURCE; @@ -464,7 +464,7 @@ public class BubbleController implements ConfigurationController.ConfigurationLi if (!shouldBubble && mBubbleData.hasBubbleWithKey(entry.key)) { // It was previously a bubble but no longer a bubble -- lets remove it removeBubble(entry.key, DISMISS_NO_LONGER_BUBBLE); - } else if (shouldBubble && alertAgain(entry, entry.notification.getNotification())) { + } else if (shouldBubble) { updateShowInShadeForSuppressNotification(entry); entry.setBubbleDismissed(false); // updates come back as bubbles even if dismissed updateBubble(entry); @@ -490,7 +490,7 @@ public class BubbleController implements ConfigurationController.ConfigurationLi && !bubble.entry.showInShadeWhenBubble()) { // The bubble is gone & the notification is gone, time to actually remove it mNotificationEntryManager.performRemoveNotification(bubble.entry.notification, - 0 /* reason */); + UNDEFINED_DISMISS_REASON); } else { // The notification is still in the shade but we've removed the bubble so // lets make sure NoMan knows it's not a bubble anymore diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationListener.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationListener.java index d59a5e8593cc..9d5871eb595c 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationListener.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationListener.java @@ -17,6 +17,7 @@ package com.android.systemui.statusbar; import static com.android.systemui.statusbar.RemoteInputController.processForRemoteInput; +import static com.android.systemui.statusbar.notification.NotificationEntryManager.UNDEFINED_DISMISS_REASON; import static com.android.systemui.statusbar.phone.StatusBar.DEBUG; import static com.android.systemui.statusbar.phone.StatusBar.ENABLE_CHILD_NOTIFICATIONS; @@ -104,7 +105,7 @@ public class NotificationListener extends NotificationListenerWithPlugins { // Remove existing notification to avoid stale data. if (isUpdate) { - mEntryManager.removeNotification(key, rankingMap, 0 /* reason */); + mEntryManager.removeNotification(key, rankingMap, UNDEFINED_DISMISS_REASON); } else { mEntryManager.getNotificationData() .updateRanking(rankingMap); @@ -134,7 +135,7 @@ public class NotificationListener extends NotificationListenerWithPlugins { @Override public void onNotificationRemoved(StatusBarNotification sbn, RankingMap rankingMap) { - onNotificationRemoved(sbn, rankingMap, 0 /* reason */); + onNotificationRemoved(sbn, rankingMap, UNDEFINED_DISMISS_REASON); } @Override diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationEntryManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationEntryManager.java index d926f88d9f60..3ac5768f091a 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationEntryManager.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationEntryManager.java @@ -67,6 +67,13 @@ public class NotificationEntryManager implements private static final String TAG = "NotificationEntryMgr"; private static final boolean DEBUG = Log.isLoggable(TAG, Log.DEBUG); + /** + * Used when a notification is removed and it doesn't have a reason that maps to one of the + * reasons defined in NotificationListenerService + * (e.g. {@link NotificationListenerService.REASON_CANCEL}) + */ + public static final int UNDEFINED_DISMISS_REASON = 0; + @VisibleForTesting protected final HashMap<String, NotificationEntry> mPendingNotifications = new HashMap<>(); @@ -156,7 +163,8 @@ public class NotificationEntryManager implements /** Adds a {@link NotificationLifetimeExtender}. */ public void addNotificationLifetimeExtender(NotificationLifetimeExtender extender) { mNotificationLifetimeExtenders.add(extender); - extender.setCallback(key -> removeNotification(key, mLatestRankingMap, 0)); + extender.setCallback(key -> removeNotification(key, mLatestRankingMap, + UNDEFINED_DISMISS_REASON)); } public NotificationData getNotificationData() { diff --git a/packages/SystemUI/tests/src/com/android/keyguard/CarrierTextControllerTest.java b/packages/SystemUI/tests/src/com/android/keyguard/CarrierTextControllerTest.java index e312990c7f8e..db45ad788bfc 100644 --- a/packages/SystemUI/tests/src/com/android/keyguard/CarrierTextControllerTest.java +++ b/packages/SystemUI/tests/src/com/android/keyguard/CarrierTextControllerTest.java @@ -118,6 +118,7 @@ public class CarrierTextControllerTest extends SysuiTestCase { mKeyguardUpdateMonitor); // This should not start listening on any of the real dependencies mCarrierTextController.setListening(mCarrierTextCallback); + mCarrierTextController.updateDisplayOpportunisticSubscriptionCarrierText(false); } @Test @@ -358,7 +359,7 @@ public class CarrierTextControllerTest extends SysuiTestCase { .thenReturn(IccCardConstants.State.READY); mKeyguardUpdateMonitor.mServiceStates = new HashMap<>(); - mCarrierTextController.updateDisplayOpportunisticSubscriptionCarrierText(); + mCarrierTextController.updateDisplayOpportunisticSubscriptionCarrierText(true); when(mSubscriptionManager.getActiveSubscriptionInfoList(anyBoolean())).thenReturn(list); ArgumentCaptor<CarrierTextController.CarrierTextCallbackInfo> captor = @@ -386,10 +387,5 @@ public class CarrierTextControllerTest extends SysuiTestCase { super.setListening(callback); mKeyguardUpdateMonitor = mKUM; } - - @Override - public void updateDisplayOpportunisticSubscriptionCarrierText() { - mDisplayOpportunisticSubscriptionCarrierText = true; - } } } diff --git a/packages/SystemUI/tests/src/com/android/systemui/bubbles/BubbleControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/bubbles/BubbleControllerTest.java index ec8dae27809a..2d697e34c626 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/bubbles/BubbleControllerTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/bubbles/BubbleControllerTest.java @@ -22,6 +22,8 @@ import static android.service.notification.NotificationListenerService.REASON_AP import static android.service.notification.NotificationListenerService.REASON_CANCEL; import static android.service.notification.NotificationListenerService.REASON_CANCEL_ALL; +import static com.android.systemui.statusbar.notification.NotificationEntryManager.UNDEFINED_DISMISS_REASON; + import static com.google.common.truth.Truth.assertThat; import static org.junit.Assert.assertEquals; @@ -228,7 +230,7 @@ public class BubbleControllerTest extends SysuiTestCase { // Since the notif is dismissed, once the bubble is removed, performRemoveNotification gets // called to really remove the notif verify(mNotificationEntryManager, times(1)).performRemoveNotification( - mRow.getEntry().notification, 0); + mRow.getEntry().notification, UNDEFINED_DISMISS_REASON); assertFalse(mBubbleController.hasBubbles()); } diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/NotificationEntryManagerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/NotificationEntryManagerTest.java index 70941d3a602b..4d593c101706 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/NotificationEntryManagerTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/NotificationEntryManagerTest.java @@ -18,6 +18,8 @@ package com.android.systemui.statusbar.notification; import static android.service.notification.NotificationListenerService.REASON_CANCEL; +import static com.android.systemui.statusbar.notification.NotificationEntryManager.UNDEFINED_DISMISS_REASON; + import static junit.framework.Assert.assertNotNull; import static junit.framework.Assert.assertNull; import static junit.framework.Assert.assertTrue; @@ -350,7 +352,7 @@ public class NotificationEntryManagerTest extends SysuiTestCase { mEntry.setRow(mRow); mEntryManager.getNotificationData().add(mEntry); - mEntryManager.removeNotification(mSbn.getKey(), mRankingMap, 0 /* reason */); + mEntryManager.removeNotification(mSbn.getKey(), mRankingMap, UNDEFINED_DISMISS_REASON); verify(mEntryListener, never()).onInflationError(any(), any()); @@ -366,7 +368,7 @@ public class NotificationEntryManagerTest extends SysuiTestCase { public void testRemoveNotification_onEntryRemoveNotFiredIfEntryDoesntExist() { com.android.systemui.util.Assert.isNotMainThread(); - mEntryManager.removeNotification("not_a_real_key", mRankingMap, 0 /* reason */); + mEntryManager.removeNotification("not_a_real_key", mRankingMap, UNDEFINED_DISMISS_REASON); verify(mEntryListener, never()).onEntryRemoved( eq(mEntry), any(), eq(false) /* removedByUser */); @@ -379,7 +381,7 @@ public class NotificationEntryManagerTest extends SysuiTestCase { mEntryManager.setRowBinder(mMockedRowBinder); mEntryManager.addNotification(mSbn, mRankingMap); - mEntryManager.removeNotification(mSbn.getKey(), mRankingMap, 0 /* reason */); + mEntryManager.removeNotification(mSbn.getKey(), mRankingMap, UNDEFINED_DISMISS_REASON); verify(mEntryListener, never()).onEntryRemoved( eq(mEntry), any(), eq(false /* removedByUser */)); @@ -458,7 +460,7 @@ public class NotificationEntryManagerTest extends SysuiTestCase { mEntryManager.addNotificationLifetimeExtender(extender); // WHEN the notification is removed - mEntryManager.removeNotification(mEntry.key, mRankingMap, 0 /* reason */); + mEntryManager.removeNotification(mEntry.key, mRankingMap, UNDEFINED_DISMISS_REASON); // THEN the extender is asked to manage the lifetime verify(extender).setShouldManageLifetime(mEntry, true); @@ -474,7 +476,7 @@ public class NotificationEntryManagerTest extends SysuiTestCase { mEntryManager.getNotificationData().add(mEntry); final FakeNotificationLifetimeExtender extender = new FakeNotificationLifetimeExtender(); mEntryManager.addNotificationLifetimeExtender(extender); - mEntryManager.removeNotification(mEntry.key, mRankingMap, 0 /* reason */); + mEntryManager.removeNotification(mEntry.key, mRankingMap, UNDEFINED_DISMISS_REASON); assertTrue(extender.isManaging(mEntry.key)); // WHEN the extender finishes its extension @@ -494,7 +496,7 @@ public class NotificationEntryManagerTest extends SysuiTestCase { NotificationLifetimeExtender extender = mock(NotificationLifetimeExtender.class); when(extender.shouldExtendLifetime(mEntry)).thenReturn(true); mEntryManager.addNotificationLifetimeExtender(extender); - mEntryManager.removeNotification(mEntry.key, mRankingMap, 0 /* reason */); + mEntryManager.removeNotification(mEntry.key, mRankingMap, UNDEFINED_DISMISS_REASON); // WHEN the notification is updated mEntryManager.updateNotification(mEntry.notification, mRankingMap); @@ -519,13 +521,13 @@ public class NotificationEntryManagerTest extends SysuiTestCase { mEntryManager.addNotificationLifetimeExtender(extender2); // GIVEN a notification was lifetime-extended and extender2 is managing it - mEntryManager.removeNotification(mEntry.key, mRankingMap, 0 /* reason */); + mEntryManager.removeNotification(mEntry.key, mRankingMap, UNDEFINED_DISMISS_REASON); verify(extender1, never()).setShouldManageLifetime(mEntry, true); verify(extender2).setShouldManageLifetime(mEntry, true); // WHEN the extender1 changes its mind and wants to extend the lifetime of the notif when(extender1.shouldExtendLifetime(mEntry)).thenReturn(true); - mEntryManager.removeNotification(mEntry.key, mRankingMap, 0 /* reason */); + mEntryManager.removeNotification(mEntry.key, mRankingMap, UNDEFINED_DISMISS_REASON); // THEN extender2 stops managing the notif and extender1 starts managing it verify(extender1).setShouldManageLifetime(mEntry, true); @@ -553,7 +555,7 @@ public class NotificationEntryManagerTest extends SysuiTestCase { .thenReturn(true); // WHEN the notification is removed - mEntryManager.removeNotification(mEntry.key, mRankingMap, 0 /* reason */); + mEntryManager.removeNotification(mEntry.key, mRankingMap, UNDEFINED_DISMISS_REASON); // THEN the interceptor intercepts & the entry is not removed & no listeners are called assertNotNull(mEntryManager.getNotificationData().get(mEntry.key)); @@ -572,7 +574,7 @@ public class NotificationEntryManagerTest extends SysuiTestCase { .thenReturn(false); // WHEN the notification is removed - mEntryManager.removeNotification(mEntry.key, mRankingMap, 0 /* reason */); + mEntryManager.removeNotification(mEntry.key, mRankingMap, UNDEFINED_DISMISS_REASON); // THEN the interceptor intercepts & the entry is not removed & no listeners are called assertNull(mEntryManager.getNotificationData().get(mEntry.key)); diff --git a/packages/VpnDialogs/res/values-mr/strings.xml b/packages/VpnDialogs/res/values-mr/strings.xml index 318f854340e2..41d74290815d 100644 --- a/packages/VpnDialogs/res/values-mr/strings.xml +++ b/packages/VpnDialogs/res/values-mr/strings.xml @@ -17,7 +17,7 @@ <resources xmlns:android="http://schemas.android.com/apk/res/android" xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> <string name="prompt" msgid="3183836924226407828">"कनेक्शन विनंती"</string> - <string name="warning" msgid="809658604548412033">"<xliff:g id="APP">%s</xliff:g> नेटवर्क रहदारीचे परीक्षण करण्यासाठी त्यास अनुमती देणारे VPN कनेक्शन सेट करू इच्छितो. तुम्हाला स्त्रोत विश्वसनीय वाटत असेल तरच स्वीकार करा. <br /> <br /> <img src=vpn_icon /> VPN सक्रिय असताना आपल्या स्क्रीनच्या शीर्षावर दिसते."</string> + <string name="warning" msgid="809658604548412033">"<xliff:g id="APP">%s</xliff:g> नेटवर्क रहदारीचे परीक्षण करण्यासाठी त्यास अनुमती देणारे VPN कनेक्शन सेट करू इच्छितो. तुम्हाला स्रोत विश्वसनीय वाटत असेल तरच स्वीकार करा. <br /> <br /> <img src=vpn_icon /> VPN सक्रिय असताना आपल्या स्क्रीनच्या शीर्षावर दिसते."</string> <string name="legacy_title" msgid="192936250066580964">"VPN कनेक्ट केले"</string> <string name="session" msgid="6470628549473641030">"सत्र:"</string> <string name="duration" msgid="3584782459928719435">"कालावधी:"</string> diff --git a/packages/VpnDialogs/res/values-zh-rHK/strings.xml b/packages/VpnDialogs/res/values-zh-rHK/strings.xml index f70cd5115e72..49605b08cdee 100644 --- a/packages/VpnDialogs/res/values-zh-rHK/strings.xml +++ b/packages/VpnDialogs/res/values-zh-rHK/strings.xml @@ -24,7 +24,7 @@ <string name="data_transmitted" msgid="7988167672982199061">"已傳送:"</string> <string name="data_received" msgid="4062776929376067820">"已接收:"</string> <string name="data_value_format" msgid="2192466557826897580">"<xliff:g id="NUMBER_0">%1$s</xliff:g> 位元組 / <xliff:g id="NUMBER_1">%2$s</xliff:g> 封包"</string> - <string name="always_on_disconnected_title" msgid="1906740176262776166">"無法連線至永遠開啟的 VPN"</string> + <string name="always_on_disconnected_title" msgid="1906740176262776166">"無法連線至保持開啟的 VPN"</string> <string name="always_on_disconnected_message" msgid="555634519845992917">"<xliff:g id="VPN_APP_0">%1$s</xliff:g> 已設定為隨時保持連線,但目前無法連線。在重新連線至 <xliff:g id="VPN_APP_1">%1$s</xliff:g> 前,您的手機將會使用公共網絡。"</string> <string name="always_on_disconnected_message_lockdown" msgid="4232225539869452120">"<xliff:g id="VPN_APP">%1$s</xliff:g> 已設定為隨時保持連線,但目前無法連線。在重新連線至 VPN 前,您將無法連線至網絡。"</string> <string name="always_on_disconnected_message_separator" msgid="3310614409322581371">" "</string> diff --git a/proto/src/metrics_constants/metrics_constants.proto b/proto/src/metrics_constants/metrics_constants.proto index 10387f10615f..65338cb2126f 100644 --- a/proto/src/metrics_constants/metrics_constants.proto +++ b/proto/src/metrics_constants/metrics_constants.proto @@ -7216,6 +7216,12 @@ message MetricsEvent { // Settings > Apps and notifications > Notifications > Gentle notifications GENTLE_NOTIFICATIONS_SCREEN = 1715; + // Assistant + // TYPE: OPEN, CLOSE or UPDATE. + // For OPEN, the subtype is the innovation type for the assistant. + // OS: Q + ASSISTANT = 1716; + // ---- End Q Constants, all Q constants go above this line ---- // Add new aosp constants above this line. // END OF AOSP CONSTANTS diff --git a/services/core/java/com/android/server/location/GnssLocationProvider.java b/services/core/java/com/android/server/location/GnssLocationProvider.java index d93dddfcffb8..c91f66b78a32 100644 --- a/services/core/java/com/android/server/location/GnssLocationProvider.java +++ b/services/core/java/com/android/server/location/GnssLocationProvider.java @@ -180,9 +180,10 @@ public class GnssLocationProvider extends AbstractLocationProvider implements private static final int SET_REQUEST = 3; private static final int INJECT_NTP_TIME = 5; - private static final int DOWNLOAD_XTRA_DATA = 6; + // PSDS stands for Predicted Satellite Data Service + private static final int DOWNLOAD_PSDS_DATA = 6; private static final int UPDATE_LOCATION = 7; // Handle external location from network listener - private static final int DOWNLOAD_XTRA_DATA_FINISHED = 11; + private static final int DOWNLOAD_PSDS_DATA_FINISHED = 11; private static final int SUBSCRIPTION_OR_CARRIER_CONFIG_CHANGED = 12; private static final int INITIALIZE_HANDLER = 13; private static final int REQUEST_LOCATION = 16; @@ -295,19 +296,19 @@ public class GnssLocationProvider extends AbstractLocationProvider implements // Typical hot TTTF is ~5 seconds, so 10 seconds seems sane. private static final int GPS_POLLING_THRESHOLD_INTERVAL = 10 * 1000; - // how long to wait if we have a network error in NTP or XTRA downloading + // how long to wait if we have a network error in NTP or PSDS downloading // the initial value of the exponential backoff // current setting - 5 minutes private static final long RETRY_INTERVAL = 5 * 60 * 1000; - // how long to wait if we have a network error in NTP or XTRA downloading + // how long to wait if we have a network error in NTP or PSDS downloading // the max value of the exponential backoff // current setting - 4 hours private static final long MAX_RETRY_INTERVAL = 4 * 60 * 60 * 1000; - // Timeout when holding wakelocks for downloading XTRA data. - private static final long DOWNLOAD_XTRA_DATA_TIMEOUT_MS = 60 * 1000; + // Timeout when holding wakelocks for downloading PSDS data. + private static final long DOWNLOAD_PSDS_DATA_TIMEOUT_MS = 60 * 1000; - private final ExponentialBackOff mXtraBackOff = new ExponentialBackOff(RETRY_INTERVAL, + private final ExponentialBackOff mPsdsBackOff = new ExponentialBackOff(RETRY_INTERVAL, MAX_RETRY_INTERVAL); // true if we are enabled, protected by this @@ -315,14 +316,14 @@ public class GnssLocationProvider extends AbstractLocationProvider implements private boolean mShutdown; - // states for injecting ntp and downloading xtra data + // states for injecting ntp and downloading psds data private static final int STATE_PENDING_NETWORK = 0; private static final int STATE_DOWNLOADING = 1; private static final int STATE_IDLE = 2; - // flags to trigger NTP or XTRA data download when network becomes available - // initialized to true so we do NTP and XTRA when the network comes up after booting - private int mDownloadXtraDataPending = STATE_PENDING_NETWORK; + // flags to trigger NTP or PSDS data download when network becomes available + // initialized to true so we do NTP and PSDS when the network comes up after booting + private int mDownloadPsdsDataPending = STATE_PENDING_NETWORK; // true if GPS is navigating private boolean mNavigating; @@ -346,8 +347,8 @@ public class GnssLocationProvider extends AbstractLocationProvider implements // capabilities reported through the top level IGnssCallback.hal private volatile int mTopHalCapabilities; - // true if XTRA is supported - private boolean mSupportsXtra; + // true if PSDS is supported + private boolean mSupportsPsds; // for calculating time to first fix private long mFixRequestTime = 0; @@ -404,8 +405,8 @@ public class GnssLocationProvider extends AbstractLocationProvider implements // Wakelocks private final static String WAKELOCK_KEY = "GnssLocationProvider"; private final PowerManager.WakeLock mWakeLock; - private static final String DOWNLOAD_EXTRA_WAKELOCK_KEY = "GnssLocationProviderXtraDownload"; - private final PowerManager.WakeLock mDownloadXtraWakeLock; + private static final String DOWNLOAD_EXTRA_WAKELOCK_KEY = "GnssLocationProviderPsdsDownload"; + private final PowerManager.WakeLock mDownloadPsdsWakeLock; // Alarms private final static String ALARM_WAKEUP = "com.android.internal.location.ALARM_WAKEUP"; @@ -592,10 +593,10 @@ public class GnssLocationProvider extends AbstractLocationProvider implements mWakeLock = mPowerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, WAKELOCK_KEY); mWakeLock.setReferenceCounted(true); - // Create a separate wake lock for xtra downloader as it may be released due to timeout. - mDownloadXtraWakeLock = mPowerManager.newWakeLock( + // Create a separate wake lock for psds downloader as it may be released due to timeout. + mDownloadPsdsWakeLock = mPowerManager.newWakeLock( PowerManager.PARTIAL_WAKE_LOCK, DOWNLOAD_EXTRA_WAKELOCK_KEY); - mDownloadXtraWakeLock.setReferenceCounted(true); + mDownloadPsdsWakeLock.setReferenceCounted(true); mAlarmManager = (AlarmManager) mContext.getSystemService(Context.ALARM_SERVICE); mWakeupIntent = PendingIntent.getBroadcast(mContext, 0, new Intent(ALARM_WAKEUP), 0); @@ -701,10 +702,10 @@ public class GnssLocationProvider extends AbstractLocationProvider implements */ private void onNetworkAvailable() { mNtpTimeHelper.onNetworkAvailable(); - if (mDownloadXtraDataPending == STATE_PENDING_NETWORK) { - if (mSupportsXtra) { + if (mDownloadPsdsDataPending == STATE_PENDING_NETWORK) { + if (mSupportsPsds) { // Download only if supported, (prevents an unnecessary on-boot download) - xtraDownloadRequest(); + psdsDownloadRequest(); } } } @@ -811,61 +812,61 @@ public class GnssLocationProvider extends AbstractLocationProvider implements return false; } - private void handleDownloadXtraData() { - if (!mSupportsXtra) { - // native code reports xtra not supported, don't try - Log.d(TAG, "handleDownloadXtraData() called when Xtra not supported"); + private void handleDownloadPsdsData() { + if (!mSupportsPsds) { + // native code reports psds not supported, don't try + Log.d(TAG, "handleDownloadPsdsData() called when PSDS not supported"); return; } - if (mDownloadXtraDataPending == STATE_DOWNLOADING) { + if (mDownloadPsdsDataPending == STATE_DOWNLOADING) { // already downloading data return; } if (!mNetworkConnectivityHandler.isDataNetworkConnected()) { // try again when network is up - mDownloadXtraDataPending = STATE_PENDING_NETWORK; + mDownloadPsdsDataPending = STATE_PENDING_NETWORK; return; } - mDownloadXtraDataPending = STATE_DOWNLOADING; + mDownloadPsdsDataPending = STATE_DOWNLOADING; // hold wake lock while task runs - mDownloadXtraWakeLock.acquire(DOWNLOAD_XTRA_DATA_TIMEOUT_MS); - Log.i(TAG, "WakeLock acquired by handleDownloadXtraData()"); + mDownloadPsdsWakeLock.acquire(DOWNLOAD_PSDS_DATA_TIMEOUT_MS); + Log.i(TAG, "WakeLock acquired by handleDownloadPsdsData()"); AsyncTask.THREAD_POOL_EXECUTOR.execute(() -> { - GpsXtraDownloader xtraDownloader = new GpsXtraDownloader( + GpsPsdsDownloader psdsDownloader = new GpsPsdsDownloader( mGnssConfiguration.getProperties()); - byte[] data = xtraDownloader.downloadXtraData(); + byte[] data = psdsDownloader.downloadPsdsData(); if (data != null) { - if (DEBUG) Log.d(TAG, "calling native_inject_xtra_data"); - native_inject_xtra_data(data, data.length); - mXtraBackOff.reset(); + if (DEBUG) Log.d(TAG, "calling native_inject_psds_data"); + native_inject_psds_data(data, data.length); + mPsdsBackOff.reset(); } - sendMessage(DOWNLOAD_XTRA_DATA_FINISHED, 0, null); + sendMessage(DOWNLOAD_PSDS_DATA_FINISHED, 0, null); if (data == null) { // try again later // since this is delayed and not urgent we do not hold a wake lock here - mHandler.sendEmptyMessageDelayed(DOWNLOAD_XTRA_DATA, - mXtraBackOff.nextBackoffMillis()); + mHandler.sendEmptyMessageDelayed(DOWNLOAD_PSDS_DATA, + mPsdsBackOff.nextBackoffMillis()); } // Release wake lock held by task, synchronize on mLock in case multiple // download tasks overrun. synchronized (mLock) { - if (mDownloadXtraWakeLock.isHeld()) { + if (mDownloadPsdsWakeLock.isHeld()) { // This wakelock may have time-out, if a timeout was specified. // Catch (and ignore) any timeout exceptions. try { - mDownloadXtraWakeLock.release(); - if (DEBUG) Log.d(TAG, "WakeLock released by handleDownloadXtraData()"); + mDownloadPsdsWakeLock.release(); + if (DEBUG) Log.d(TAG, "WakeLock released by handleDownloadPsdsData()"); } catch (Exception e) { Log.i(TAG, "Wakelock timeout & release race exception in " - + "handleDownloadXtraData()", e); + + "handleDownloadPsdsData()", e); } } else { Log.e(TAG, "WakeLock expired before release in " - + "handleDownloadXtraData()"); + + "handleDownloadPsdsData()"); } } }); @@ -920,7 +921,7 @@ public class GnssLocationProvider extends AbstractLocationProvider implements if (inited) { mEnabled = true; - mSupportsXtra = native_supports_xtra(); + mSupportsPsds = native_supports_psds(); // TODO: remove the following native calls if we can make sure they are redundant. if (mSuplServerHost != null) { @@ -1162,9 +1163,9 @@ public class GnssLocationProvider extends AbstractLocationProvider implements deleteAidingData(extras); } else if ("force_time_injection".equals(command)) { requestUtcTime(); - } else if ("force_xtra_injection".equals(command)) { - if (mSupportsXtra) { - xtraDownloadRequest(); + } else if ("force_psds_injection".equals(command)) { + if (mSupportsPsds) { + psdsDownloadRequest(); } } else { Log.w(TAG, "sendExtraCommand: unknown command " + command); @@ -1677,9 +1678,9 @@ public class GnssLocationProvider extends AbstractLocationProvider implements } @NativeEntryPoint - private void xtraDownloadRequest() { - if (DEBUG) Log.d(TAG, "xtraDownloadRequest"); - sendMessage(DOWNLOAD_XTRA_DATA, 0, null); + private void psdsDownloadRequest() { + if (DEBUG) Log.d(TAG, "psdsDownloadRequest"); + sendMessage(DOWNLOAD_PSDS_DATA, 0, null); } /** @@ -2012,11 +2013,11 @@ public class GnssLocationProvider extends AbstractLocationProvider implements case REQUEST_LOCATION: handleRequestLocation(msg.arg1 == 1, (boolean) msg.obj); break; - case DOWNLOAD_XTRA_DATA: - handleDownloadXtraData(); + case DOWNLOAD_PSDS_DATA: + handleDownloadPsdsData(); break; - case DOWNLOAD_XTRA_DATA_FINISHED: - mDownloadXtraDataPending = STATE_IDLE; + case DOWNLOAD_PSDS_DATA_FINISHED: + mDownloadPsdsDataPending = STATE_IDLE; break; case UPDATE_LOCATION: handleUpdateLocation((Location) msg.obj); @@ -2166,10 +2167,10 @@ public class GnssLocationProvider extends AbstractLocationProvider implements return "INJECT_NTP_TIME"; case REQUEST_LOCATION: return "REQUEST_LOCATION"; - case DOWNLOAD_XTRA_DATA: - return "DOWNLOAD_XTRA_DATA"; - case DOWNLOAD_XTRA_DATA_FINISHED: - return "DOWNLOAD_XTRA_DATA_FINISHED"; + case DOWNLOAD_PSDS_DATA: + return "DOWNLOAD_PSDS_DATA"; + case DOWNLOAD_PSDS_DATA_FINISHED: + return "DOWNLOAD_PSDS_DATA_FINISHED"; case UPDATE_LOCATION: return "UPDATE_LOCATION"; case SUBSCRIPTION_OR_CARRIER_CONFIG_CHANGED: @@ -2266,12 +2267,12 @@ public class GnssLocationProvider extends AbstractLocationProvider implements private native void native_inject_location(double latitude, double longitude, float accuracy); - // XTRA Support + // PSDS Support private native void native_inject_time(long time, long timeReference, int uncertainty); - private native boolean native_supports_xtra(); + private native boolean native_supports_psds(); - private native void native_inject_xtra_data(byte[] data, int length); + private native void native_inject_psds_data(byte[] data, int length); // DEBUG Support private native String native_get_internal_state(); diff --git a/services/core/java/com/android/server/location/GpsXtraDownloader.java b/services/core/java/com/android/server/location/GpsPsdsDownloader.java index 7dffcb4c32a9..6fcb7d1af2ce 100644 --- a/services/core/java/com/android/server/location/GpsXtraDownloader.java +++ b/services/core/java/com/android/server/location/GpsPsdsDownloader.java @@ -32,26 +32,26 @@ import java.util.Random; import java.util.concurrent.TimeUnit; /** - * A class for downloading GPS XTRA data. + * A class for downloading GPS PSDS data. * * {@hide} */ -public class GpsXtraDownloader { +public class GpsPsdsDownloader { - private static final String TAG = "GpsXtraDownloader"; + private static final String TAG = "GpsPsdsDownloader"; private static final boolean DEBUG = Log.isLoggable(TAG, Log.DEBUG); private static final long MAXIMUM_CONTENT_LENGTH_BYTES = 1000000; // 1MB. private static final String DEFAULT_USER_AGENT = "Android"; private static final int CONNECTION_TIMEOUT_MS = (int) TimeUnit.SECONDS.toMillis(30); private static final int READ_TIMEOUT_MS = (int) TimeUnit.SECONDS.toMillis(60); - private final String[] mXtraServers; + private final String[] mPsdsServers; // to load balance our server requests private int mNextServerIndex; private final String mUserAgent; - GpsXtraDownloader(Properties properties) { - // read XTRA servers from the Properties object + GpsPsdsDownloader(Properties properties) { + // read PSDS servers from the Properties object int count = 0; String server1 = properties.getProperty("XTRA_SERVER_1"); String server2 = properties.getProperty("XTRA_SERVER_2"); @@ -69,14 +69,14 @@ public class GpsXtraDownloader { } if (count == 0) { - Log.e(TAG, "No XTRA servers were specified in the GPS configuration"); - mXtraServers = null; + Log.e(TAG, "No PSDS servers were specified in the GPS configuration"); + mPsdsServers = null; } else { - mXtraServers = new String[count]; + mPsdsServers = new String[count]; count = 0; - if (server1 != null) mXtraServers[count++] = server1; - if (server2 != null) mXtraServers[count++] = server2; - if (server3 != null) mXtraServers[count++] = server3; + if (server1 != null) mPsdsServers[count++] = server1; + if (server2 != null) mPsdsServers[count++] = server2; + if (server3 != null) mPsdsServers[count++] = server3; // randomize first server Random random = new Random(); @@ -84,11 +84,11 @@ public class GpsXtraDownloader { } } - byte[] downloadXtraData() { + byte[] downloadPsdsData() { byte[] result = null; int startIndex = mNextServerIndex; - if (mXtraServers == null) { + if (mPsdsServers == null) { return null; } @@ -97,14 +97,14 @@ public class GpsXtraDownloader { final int oldTag = TrafficStats.getAndSetThreadStatsTag( TrafficStatsConstants.TAG_SYSTEM_GPS); try { - result = doDownload(mXtraServers[mNextServerIndex]); + result = doDownload(mPsdsServers[mNextServerIndex]); } finally { TrafficStats.setThreadStatsTag(oldTag); } // increment mNextServerIndex and wrap around if necessary mNextServerIndex++; - if (mNextServerIndex == mXtraServers.length) { + if (mNextServerIndex == mPsdsServers.length) { mNextServerIndex = 0; } // break if we have tried all the servers @@ -115,7 +115,7 @@ public class GpsXtraDownloader { } protected byte[] doDownload(String url) { - if (DEBUG) Log.d(TAG, "Downloading XTRA data from " + url); + if (DEBUG) Log.d(TAG, "Downloading PSDS data from " + url); HttpURLConnection connection = null; try { @@ -132,7 +132,7 @@ public class GpsXtraDownloader { connection.connect(); int statusCode = connection.getResponseCode(); if (statusCode != HttpURLConnection.HTTP_OK) { - if (DEBUG) Log.d(TAG, "HTTP error downloading gps XTRA: " + statusCode); + if (DEBUG) Log.d(TAG, "HTTP error downloading gps PSDS: " + statusCode); return null; } @@ -143,14 +143,14 @@ public class GpsXtraDownloader { while ((count = in.read(buffer)) != -1) { bytes.write(buffer, 0, count); if (bytes.size() > MAXIMUM_CONTENT_LENGTH_BYTES) { - if (DEBUG) Log.d(TAG, "XTRA file too large"); + if (DEBUG) Log.d(TAG, "PSDS file too large"); return null; } } return bytes.toByteArray(); } } catch (IOException ioe) { - if (DEBUG) Log.d(TAG, "Error downloading gps XTRA: ", ioe); + if (DEBUG) Log.d(TAG, "Error downloading gps PSDS: ", ioe); } finally { if (connection != null) { connection.disconnect(); diff --git a/services/core/java/com/android/server/notification/NotificationManagerService.java b/services/core/java/com/android/server/notification/NotificationManagerService.java index 907502e6a809..3e26e013a0a5 100644 --- a/services/core/java/com/android/server/notification/NotificationManagerService.java +++ b/services/core/java/com/android/server/notification/NotificationManagerService.java @@ -121,6 +121,8 @@ import android.app.backup.BackupManager; import android.app.role.OnRoleHoldersChangedListener; import android.app.role.RoleManager; import android.app.usage.UsageEvents; +import android.app.usage.UsageStats; +import android.app.usage.UsageStatsManager; import android.app.usage.UsageStatsManagerInternal; import android.companion.ICompanionDeviceManager; import android.content.BroadcastReceiver; @@ -258,6 +260,8 @@ import java.nio.charset.StandardCharsets; import java.util.ArrayDeque; import java.util.ArrayList; import java.util.Arrays; +import java.util.Calendar; +import java.util.GregorianCalendar; import java.util.Iterator; import java.util.List; import java.util.Map.Entry; @@ -413,7 +417,6 @@ public class NotificationManagerService extends SystemService { final ArrayMap<Integer, ArrayMap<String, String>> mAutobundledSummaries = new ArrayMap<>(); final ArrayList<ToastRecord> mToastQueue = new ArrayList<>(); final ArrayMap<String, NotificationRecord> mSummaryByGroupKey = new ArrayMap<>(); - final ArrayMap<Integer, ArrayList<NotifyingApp>> mRecentApps = new ArrayMap<>(); // The last key in this list owns the hardware. ArrayList<String> mLights = new ArrayList<>(); @@ -2209,7 +2212,6 @@ public class NotificationManagerService extends SystemService { mAppUsageStats.reportInterruptiveNotification(r.sbn.getPackageName(), r.getChannel().getId(), getRealUserId(r.sbn.getUserId())); - logRecentLocked(r); r.setRecordedInterruption(true); } } @@ -2830,16 +2832,6 @@ public class NotificationManagerService extends SystemService { } @Override - public ParceledListSlice<NotifyingApp> getRecentNotifyingAppsForUser(int userId) { - checkCallerIsSystem(); - synchronized (mNotificationLock) { - List<NotifyingApp> apps = new ArrayList<>( - mRecentApps.getOrDefault(userId, new ArrayList<>())); - return new ParceledListSlice<>(apps); - } - } - - @Override public int getBlockedAppCount(int userId) { checkCallerIsSystem(); return mPreferencesHelper.getBlockedAppCount(userId); @@ -5527,38 +5519,6 @@ public class NotificationManagerService extends SystemService { } /** - * Keeps the last 5 packages that have notified, by user. - */ - @GuardedBy("mNotificationLock") - @VisibleForTesting - protected void logRecentLocked(NotificationRecord r) { - if (r.isUpdate) { - return; - } - ArrayList<NotifyingApp> recentAppsForUser = - mRecentApps.getOrDefault(r.getUser().getIdentifier(), new ArrayList<>(6)); - NotifyingApp na = new NotifyingApp() - .setPackage(r.sbn.getPackageName()) - .setUid(r.sbn.getUid()) - .setLastNotified(r.sbn.getPostTime()); - // A new notification gets an app moved to the front of the list - for (int i = recentAppsForUser.size() - 1; i >= 0; i--) { - NotifyingApp naExisting = recentAppsForUser.get(i); - if (na.getPackage().equals(naExisting.getPackage()) - && na.getUid() == naExisting.getUid()) { - recentAppsForUser.remove(i); - break; - } - } - // time is always increasing, so always add to the front of the list - recentAppsForUser.add(0, na); - if (recentAppsForUser.size() > 5) { - recentAppsForUser.remove(recentAppsForUser.size() -1); - } - mRecentApps.put(r.getUser().getIdentifier(), recentAppsForUser); - } - - /** * Ensures that grouped notification receive their special treatment. * * <p>Cancels group children if the new notification causes a group to lose diff --git a/services/core/java/com/android/server/pm/PackageManagerService.java b/services/core/java/com/android/server/pm/PackageManagerService.java index a64ae9c5fe85..c20172d0599a 100644 --- a/services/core/java/com/android/server/pm/PackageManagerService.java +++ b/services/core/java/com/android/server/pm/PackageManagerService.java @@ -20062,6 +20062,7 @@ public class PackageManagerService extends IPackageManager.Stub final Intent intent = new Intent(Intent.ACTION_PREFERRED_ACTIVITY_CHANGED); intent.putExtra(Intent.EXTRA_USER_HANDLE, userId); + intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT); try { am.broadcastIntent(null, intent, null, null, 0, null, null, null, android.app.AppOpsManager.OP_NONE, diff --git a/services/core/jni/com_android_server_location_GnssLocationProvider.cpp b/services/core/jni/com_android_server_location_GnssLocationProvider.cpp index 98c620c50f54..89a1ec8507d6 100644 --- a/services/core/jni/com_android_server_location_GnssLocationProvider.cpp +++ b/services/core/jni/com_android_server_location_GnssLocationProvider.cpp @@ -62,7 +62,7 @@ static jmethodID method_reportNmea; static jmethodID method_setTopHalCapabilities; static jmethodID method_setGnssYearOfHardware; static jmethodID method_setGnssHardwareModelName; -static jmethodID method_xtraDownloadRequest; +static jmethodID method_psdsDownloadRequest; static jmethodID method_reportNiNotification; static jmethodID method_requestLocation; static jmethodID method_requestRefLocation; @@ -802,7 +802,7 @@ class GnssXtraCallback : public IGnssXtraCallback { */ Return<void> GnssXtraCallback::downloadRequestCb() { JNIEnv* env = getJniEnv(); - env->CallVoidMethod(mCallbacksObj, method_xtraDownloadRequest); + env->CallVoidMethod(mCallbacksObj, method_psdsDownloadRequest); checkAndClearExceptionFromCallback(env, __FUNCTION__); return Void(); } @@ -1525,7 +1525,7 @@ static void android_location_GnssLocationProvider_init_once(JNIEnv* env, jclass method_setGnssYearOfHardware = env->GetMethodID(clazz, "setGnssYearOfHardware", "(I)V"); method_setGnssHardwareModelName = env->GetMethodID(clazz, "setGnssHardwareModelName", "(Ljava/lang/String;)V"); - method_xtraDownloadRequest = env->GetMethodID(clazz, "xtraDownloadRequest", "()V"); + method_psdsDownloadRequest = env->GetMethodID(clazz, "psdsDownloadRequest", "()V"); method_reportNiNotification = env->GetMethodID(clazz, "reportNiNotification", "(IIIIILjava/lang/String;Ljava/lang/String;II)V"); method_requestLocation = env->GetMethodID(clazz, "requestLocation", "(ZZ)V"); @@ -2190,12 +2190,12 @@ static void android_location_GnssLocationProvider_inject_location(JNIEnv* /* env } } -static jboolean android_location_GnssLocationProvider_supports_xtra( +static jboolean android_location_GnssLocationProvider_supports_psds( JNIEnv* /* env */, jobject /* obj */) { return (gnssXtraIface != nullptr) ? JNI_TRUE : JNI_FALSE; } -static void android_location_GnssLocationProvider_inject_xtra_data(JNIEnv* env, jobject /* obj */, +static void android_location_GnssLocationProvider_inject_psds_data(JNIEnv* env, jobject /* obj */, jbyteArray data, jint length) { if (gnssXtraIface == nullptr) { ALOGE("XTRA Interface not supported"); @@ -3047,10 +3047,10 @@ static const JNINativeMethod sMethods[] = { android_location_GnssLocationProvider_inject_best_location)}, {"native_inject_location", "(DDF)V", reinterpret_cast<void *>( android_location_GnssLocationProvider_inject_location)}, - {"native_supports_xtra", "()Z", reinterpret_cast<void *>( - android_location_GnssLocationProvider_supports_xtra)}, - {"native_inject_xtra_data", "([BI)V", reinterpret_cast<void *>( - android_location_GnssLocationProvider_inject_xtra_data)}, + {"native_supports_psds", "()Z", reinterpret_cast<void *>( + android_location_GnssLocationProvider_supports_psds)}, + {"native_inject_psds_data", "([BI)V", reinterpret_cast<void *>( + android_location_GnssLocationProvider_inject_psds_data)}, {"native_agps_set_id", "(ILjava/lang/String;)V", reinterpret_cast<void *>( android_location_GnssLocationProvider_agps_set_id)}, {"native_agps_set_ref_location_cellid", "(IIIII)V", reinterpret_cast<void *>( diff --git a/services/tests/uiservicestests/src/com/android/server/notification/NotificationManagerServiceTest.java b/services/tests/uiservicestests/src/com/android/server/notification/NotificationManagerServiceTest.java index 8d56bc400d14..d2332bf86e95 100644 --- a/services/tests/uiservicestests/src/com/android/server/notification/NotificationManagerServiceTest.java +++ b/services/tests/uiservicestests/src/com/android/server/notification/NotificationManagerServiceTest.java @@ -3026,104 +3026,6 @@ public class NotificationManagerServiceTest extends UiServiceTestCase { } @Test - public void testRecents() throws Exception { - Set<NotifyingApp> expected = new HashSet<>(); - - final NotificationRecord oldest = new NotificationRecord(mContext, - generateSbn("p", 1000, 9, 0), mTestNotificationChannel); - mService.logRecentLocked(oldest); - for (int i = 1; i <= 5; i++) { - NotificationRecord r = new NotificationRecord(mContext, - generateSbn("p" + i, i, i*100, 0), mTestNotificationChannel); - expected.add(new NotifyingApp() - .setPackage(r.sbn.getPackageName()) - .setUid(r.sbn.getUid()) - .setLastNotified(r.sbn.getPostTime())); - mService.logRecentLocked(r); - } - - List<NotifyingApp> apps = mBinderService.getRecentNotifyingAppsForUser(0).getList(); - assertTrue(apps.size() == 5); - for (NotifyingApp actual : apps) { - assertTrue("got unexpected result: " + actual, expected.contains(actual)); - } - } - - @Test - public void testRecentsNoDuplicatePackages() throws Exception { - final NotificationRecord p1 = new NotificationRecord(mContext, generateSbn("p", 1, 1000, 0), - mTestNotificationChannel); - final NotificationRecord p2 = new NotificationRecord(mContext, generateSbn("p", 1, 2000, 0), - mTestNotificationChannel); - - mService.logRecentLocked(p1); - mService.logRecentLocked(p2); - - List<NotifyingApp> apps = mBinderService.getRecentNotifyingAppsForUser(0).getList(); - assertTrue(apps.size() == 1); - NotifyingApp expected = new NotifyingApp().setPackage("p").setUid(1).setLastNotified(2000); - assertEquals(expected, apps.get(0)); - } - - @Test - public void testRecentsWithDuplicatePackage() throws Exception { - Set<NotifyingApp> expected = new HashSet<>(); - - final NotificationRecord oldest = new NotificationRecord(mContext, - generateSbn("p", 1000, 9, 0), mTestNotificationChannel); - mService.logRecentLocked(oldest); - for (int i = 1; i <= 5; i++) { - NotificationRecord r = new NotificationRecord(mContext, - generateSbn("p" + i, i, i*100, 0), mTestNotificationChannel); - expected.add(new NotifyingApp() - .setPackage(r.sbn.getPackageName()) - .setUid(r.sbn.getUid()) - .setLastNotified(r.sbn.getPostTime())); - mService.logRecentLocked(r); - } - NotificationRecord r = new NotificationRecord(mContext, - generateSbn("p" + 3, 3, 300000, 0), mTestNotificationChannel); - expected.remove(new NotifyingApp() - .setPackage(r.sbn.getPackageName()) - .setUid(3) - .setLastNotified(300)); - NotifyingApp newest = new NotifyingApp() - .setPackage(r.sbn.getPackageName()) - .setUid(r.sbn.getUid()) - .setLastNotified(r.sbn.getPostTime()); - expected.add(newest); - mService.logRecentLocked(r); - - List<NotifyingApp> apps = mBinderService.getRecentNotifyingAppsForUser(0).getList(); - assertTrue(apps.size() == 5); - for (NotifyingApp actual : apps) { - assertTrue("got unexpected result: " + actual, expected.contains(actual)); - } - assertEquals(newest, apps.get(0)); - } - - @Test - public void testRecentsMultiuser() throws Exception { - final NotificationRecord user1 = new NotificationRecord(mContext, - generateSbn("p", 1000, 9, 1), mTestNotificationChannel); - mService.logRecentLocked(user1); - - final NotificationRecord user2 = new NotificationRecord(mContext, - generateSbn("p2", 100000, 9999, 2), mTestNotificationChannel); - mService.logRecentLocked(user2); - - assertEquals(0, mBinderService.getRecentNotifyingAppsForUser(0).getList().size()); - assertEquals(1, mBinderService.getRecentNotifyingAppsForUser(1).getList().size()); - assertEquals(1, mBinderService.getRecentNotifyingAppsForUser(2).getList().size()); - - assertTrue(mBinderService.getRecentNotifyingAppsForUser(2).getList().contains( - new NotifyingApp() - .setPackage(user2.sbn.getPackageName()) - .setUid(user2.sbn.getUid()) - .setLastNotified(user2.sbn.getPostTime()))); - } - - @Test public void testRestore() throws Exception { int systemChecks = mService.countSystemChecks; mBinderService.applyRestore(null, UserHandle.USER_SYSTEM); diff --git a/services/tests/uiservicestests/src/com/android/server/notification/NotifyingAppTest.java b/services/tests/uiservicestests/src/com/android/server/notification/NotifyingAppTest.java index 25e10d0740da..0c6283116594 100644 --- a/services/tests/uiservicestests/src/com/android/server/notification/NotifyingAppTest.java +++ b/services/tests/uiservicestests/src/com/android/server/notification/NotifyingAppTest.java @@ -36,7 +36,7 @@ public class NotifyingAppTest extends UiServiceTestCase { @Test public void testConstructor() { NotifyingApp na = new NotifyingApp(); - assertEquals(0, na.getUid()); + assertEquals(0, na.getUserId()); assertEquals(0, na.getLastNotified()); assertEquals(null, na.getPackage()); } @@ -49,10 +49,10 @@ public class NotifyingAppTest extends UiServiceTestCase { } @Test - public void testUid() { + public void testUserId() { NotifyingApp na = new NotifyingApp(); - na.setUid(90); - assertEquals(90, na.getUid()); + na.setUserId(90); + assertEquals(90, na.getUserId()); } @Test @@ -66,7 +66,7 @@ public class NotifyingAppTest extends UiServiceTestCase { public void testWriteToParcel() { NotifyingApp na = new NotifyingApp(); na.setPackage("package"); - na.setUid(200); + na.setUserId(200); na.setLastNotified(4000); Parcel parcel = Parcel.obtain(); @@ -75,19 +75,19 @@ public class NotifyingAppTest extends UiServiceTestCase { NotifyingApp na1 = NotifyingApp.CREATOR.createFromParcel(parcel); assertEquals(na.getLastNotified(), na1.getLastNotified()); assertEquals(na.getPackage(), na1.getPackage()); - assertEquals(na.getUid(), na1.getUid()); + assertEquals(na.getUserId(), na1.getUserId()); } @Test public void testCompareTo() { NotifyingApp na1 = new NotifyingApp(); na1.setPackage("pkg1"); - na1.setUid(1000); + na1.setUserId(1000); na1.setLastNotified(6); NotifyingApp na2 = new NotifyingApp(); na2.setPackage("a"); - na2.setUid(999); + na2.setUserId(999); na2.setLastNotified(1); assertTrue(na1.compareTo(na2) < 0); |