Loading Android.bp +0 −1 Original line number Diff line number Diff line Loading @@ -322,7 +322,6 @@ java_defaults { libs: [ "app-compat-annotations", "ext", "framework-connectivity-annotations", "framework-updatable-stubs-module_libs_api", "unsupportedappusage", ], Loading core/java/android/app/ActivityManagerInternal.java +35 −0 Original line number Diff line number Diff line Loading @@ -48,6 +48,23 @@ import java.util.Set; */ public abstract class ActivityManagerInternal { public enum ServiceNotificationPolicy { /** * The Notification is not associated with any foreground service. */ NOT_FOREGROUND_SERVICE, /** * The Notification is associated with a foreground service, but the * notification system should handle it just like non-FGS notifications. */ SHOW_IMMEDIATELY, /** * The Notification is associated with a foreground service, and the * notification system should ignore it unless it has already been shown (in * which case it should be used to update the currently displayed UI). */ UPDATE_ONLY } // Access modes for handleIncomingUser. public static final int ALLOW_NON_FULL = 0; Loading Loading @@ -457,6 +474,24 @@ public abstract class ActivityManagerInternal { public abstract boolean hasForegroundServiceNotification(String pkg, @UserIdInt int userId, String channelId); /** * Tell the service lifecycle logic that the given Notification content is now * canonical for any foreground-service visibility policy purposes. * * Returns a description of any FGs-related policy around the given Notification: * not associated with an FGS; ensure display; or only update if already displayed. */ public abstract ServiceNotificationPolicy applyForegroundServiceNotification( Notification notification, int id, String pkg, @UserIdInt int userId); /** * Callback from the notification subsystem that the given FGS notification has * been shown or updated. This can happen after either Service.startForeground() * or NotificationManager.notify(). */ public abstract void onForegroundServiceNotificationUpdate(Notification notification, int id, String pkg, @UserIdInt int userId); /** * If the given app has any FGSs whose notifications are in the given channel, * stop them. Loading core/java/android/app/Notification.java +29 −7 Original line number Diff line number Diff line Loading @@ -450,10 +450,12 @@ public class Notification implements Parcelable STANDARD_LAYOUTS.add(R.layout.notification_template_material_big_text); STANDARD_LAYOUTS.add(R.layout.notification_template_material_inbox); STANDARD_LAYOUTS.add(R.layout.notification_template_material_messaging); STANDARD_LAYOUTS.add(R.layout.notification_template_material_big_messaging); STANDARD_LAYOUTS.add(R.layout.notification_template_material_conversation); STANDARD_LAYOUTS.add(R.layout.notification_template_material_media); STANDARD_LAYOUTS.add(R.layout.notification_template_material_big_media); STANDARD_LAYOUTS.add(R.layout.notification_template_material_call); STANDARD_LAYOUTS.add(R.layout.notification_template_material_big_call); STANDARD_LAYOUTS.add(R.layout.notification_template_header); } Loading Loading @@ -5817,7 +5819,7 @@ public class Notification implements Parcelable * @hide */ public RemoteViews createContentView(boolean increasedHeight) { if (mN.contentView != null && useExistingRemoteView()) { if (useExistingRemoteView(mN.contentView)) { return fullyCustomViewRequiresDecoration(false /* fromStyle */) ? minimallyDecoratedContentView(mN.contentView) : mN.contentView; } else if (mStyle != null) { Loading @@ -5833,8 +5835,24 @@ public class Notification implements Parcelable return applyStandardTemplate(getBaseLayoutResource(), p, null /* result */); } private boolean useExistingRemoteView() { return mStyle == null || !mStyle.displayCustomViewInline(); private boolean useExistingRemoteView(RemoteViews customContent) { if (customContent == null) { return false; } if (styleDisplaysCustomViewInline()) { // the provided custom view is intended to be wrapped by the style. return false; } if (fullyCustomViewRequiresDecoration(false) && STANDARD_LAYOUTS.contains(customContent.getLayoutId())) { // If the app's custom views are objects returned from Builder.create*ContentView() // then the app is most likely attempting to spoof the user. Even if they are not, // the result would be broken (b/189189308) so we will ignore it. Log.w(TAG, "For apps targeting S, a custom content view that is a modified " + "version of any standard layout is disallowed."); return false; } return true; } /** Loading @@ -5842,7 +5860,7 @@ public class Notification implements Parcelable */ public RemoteViews createBigContentView() { RemoteViews result = null; if (mN.bigContentView != null && useExistingRemoteView()) { if (useExistingRemoteView(mN.bigContentView)) { return fullyCustomViewRequiresDecoration(false /* fromStyle */) ? minimallyDecoratedBigContentView(mN.bigContentView) : mN.bigContentView; } Loading Loading @@ -5947,7 +5965,7 @@ public class Notification implements Parcelable * @hide */ public RemoteViews createHeadsUpContentView(boolean increasedHeight) { if (mN.headsUpContentView != null && useExistingRemoteView()) { if (useExistingRemoteView(mN.headsUpContentView)) { return fullyCustomViewRequiresDecoration(false /* fromStyle */) ? minimallyDecoratedHeadsUpContentView(mN.headsUpContentView) : mN.headsUpContentView; Loading Loading @@ -6396,7 +6414,7 @@ public class Notification implements Parcelable mN.reduceImageSizes(mContext); if (mContext.getApplicationInfo().targetSdkVersion < Build.VERSION_CODES.N && (useExistingRemoteView())) { && !styleDisplaysCustomViewInline()) { if (mN.contentView == null) { mN.contentView = createContentView(); mN.extras.putInt(EXTRA_REBUILD_CONTENT_VIEW_ACTION_COUNT, Loading Loading @@ -6427,6 +6445,10 @@ public class Notification implements Parcelable return mN; } private boolean styleDisplaysCustomViewInline() { return mStyle != null && mStyle.displayCustomViewInline(); } /** * Apply this Builder to an existing {@link Notification} object. * Loading Loading @@ -6576,7 +6598,7 @@ public class Notification implements Parcelable public boolean usesTemplate() { return (mN.contentView == null && mN.headsUpContentView == null && mN.bigContentView == null) || (mStyle != null && mStyle.displayCustomViewInline()); || styleDisplaysCustomViewInline(); } } Loading core/java/android/appwidget/AppWidgetManager.java +10 −0 Original line number Diff line number Diff line Loading @@ -963,6 +963,9 @@ public class AppWidgetManager { /** * Set the component for a given appWidgetId. * * If successful, the app widget provider will receive a {@link #ACTION_APPWIDGET_UPDATE} * broadcast. * * <p class="note">You need the BIND_APPWIDGET permission or the user must have enabled binding * widgets always for your component. Should be used by apps that host widgets; if this * method returns false, call {@link #ACTION_APPWIDGET_BIND} to request permission to Loading @@ -983,6 +986,9 @@ public class AppWidgetManager { /** * Set the component for a given appWidgetId. * * If successful, the app widget provider will receive a {@link #ACTION_APPWIDGET_UPDATE} * broadcast. * * <p class="note">You need the BIND_APPWIDGET permission or the user must have enabled binding * widgets always for your component. Should be used by apps that host widgets; if this * method returns false, call {@link #ACTION_APPWIDGET_BIND} to request permission to Loading @@ -1006,6 +1012,10 @@ public class AppWidgetManager { /** * Set the provider for a given appWidgetId if the caller has a permission. * * If successful, the app widget provider will receive a {@link #ACTION_APPWIDGET_UPDATE} * broadcast. * * <p> * <strong>Note:</strong> You need the {@link android.Manifest.permission#BIND_APPWIDGET} * permission or the user must have enabled binding widgets always for your component. Loading core/java/android/net/NetworkPolicyManager.java +0 −4 Original line number Diff line number Diff line Loading @@ -34,8 +34,6 @@ import android.content.Intent; import android.content.pm.PackageManager; import android.content.pm.PackageManager.NameNotFoundException; import android.content.pm.Signature; import android.net.ConnectivityAnnotations.MultipathPreference; import android.net.ConnectivityAnnotations.RestrictBackgroundStatus; import android.net.wifi.WifiConfiguration; import android.net.wifi.WifiInfo; import android.os.Build; Loading Loading @@ -465,7 +463,6 @@ public class NetworkPolicyManager { */ @SystemApi(client = SystemApi.Client.MODULE_LIBRARIES) @RequiresPermission(NetworkStack.PERMISSION_MAINLINE_NETWORK_STACK) @RestrictBackgroundStatus public int getRestrictBackgroundStatus(int uid) { try { return mService.getRestrictBackgroundStatus(uid); Loading Loading @@ -591,7 +588,6 @@ public class NetworkPolicyManager { */ @SystemApi(client = SystemApi.Client.MODULE_LIBRARIES) @RequiresPermission(NetworkStack.PERMISSION_MAINLINE_NETWORK_STACK) @MultipathPreference public int getMultipathPreference(@NonNull Network network) { try { return mService.getMultipathPreference(network); Loading Loading
Android.bp +0 −1 Original line number Diff line number Diff line Loading @@ -322,7 +322,6 @@ java_defaults { libs: [ "app-compat-annotations", "ext", "framework-connectivity-annotations", "framework-updatable-stubs-module_libs_api", "unsupportedappusage", ], Loading
core/java/android/app/ActivityManagerInternal.java +35 −0 Original line number Diff line number Diff line Loading @@ -48,6 +48,23 @@ import java.util.Set; */ public abstract class ActivityManagerInternal { public enum ServiceNotificationPolicy { /** * The Notification is not associated with any foreground service. */ NOT_FOREGROUND_SERVICE, /** * The Notification is associated with a foreground service, but the * notification system should handle it just like non-FGS notifications. */ SHOW_IMMEDIATELY, /** * The Notification is associated with a foreground service, and the * notification system should ignore it unless it has already been shown (in * which case it should be used to update the currently displayed UI). */ UPDATE_ONLY } // Access modes for handleIncomingUser. public static final int ALLOW_NON_FULL = 0; Loading Loading @@ -457,6 +474,24 @@ public abstract class ActivityManagerInternal { public abstract boolean hasForegroundServiceNotification(String pkg, @UserIdInt int userId, String channelId); /** * Tell the service lifecycle logic that the given Notification content is now * canonical for any foreground-service visibility policy purposes. * * Returns a description of any FGs-related policy around the given Notification: * not associated with an FGS; ensure display; or only update if already displayed. */ public abstract ServiceNotificationPolicy applyForegroundServiceNotification( Notification notification, int id, String pkg, @UserIdInt int userId); /** * Callback from the notification subsystem that the given FGS notification has * been shown or updated. This can happen after either Service.startForeground() * or NotificationManager.notify(). */ public abstract void onForegroundServiceNotificationUpdate(Notification notification, int id, String pkg, @UserIdInt int userId); /** * If the given app has any FGSs whose notifications are in the given channel, * stop them. Loading
core/java/android/app/Notification.java +29 −7 Original line number Diff line number Diff line Loading @@ -450,10 +450,12 @@ public class Notification implements Parcelable STANDARD_LAYOUTS.add(R.layout.notification_template_material_big_text); STANDARD_LAYOUTS.add(R.layout.notification_template_material_inbox); STANDARD_LAYOUTS.add(R.layout.notification_template_material_messaging); STANDARD_LAYOUTS.add(R.layout.notification_template_material_big_messaging); STANDARD_LAYOUTS.add(R.layout.notification_template_material_conversation); STANDARD_LAYOUTS.add(R.layout.notification_template_material_media); STANDARD_LAYOUTS.add(R.layout.notification_template_material_big_media); STANDARD_LAYOUTS.add(R.layout.notification_template_material_call); STANDARD_LAYOUTS.add(R.layout.notification_template_material_big_call); STANDARD_LAYOUTS.add(R.layout.notification_template_header); } Loading Loading @@ -5817,7 +5819,7 @@ public class Notification implements Parcelable * @hide */ public RemoteViews createContentView(boolean increasedHeight) { if (mN.contentView != null && useExistingRemoteView()) { if (useExistingRemoteView(mN.contentView)) { return fullyCustomViewRequiresDecoration(false /* fromStyle */) ? minimallyDecoratedContentView(mN.contentView) : mN.contentView; } else if (mStyle != null) { Loading @@ -5833,8 +5835,24 @@ public class Notification implements Parcelable return applyStandardTemplate(getBaseLayoutResource(), p, null /* result */); } private boolean useExistingRemoteView() { return mStyle == null || !mStyle.displayCustomViewInline(); private boolean useExistingRemoteView(RemoteViews customContent) { if (customContent == null) { return false; } if (styleDisplaysCustomViewInline()) { // the provided custom view is intended to be wrapped by the style. return false; } if (fullyCustomViewRequiresDecoration(false) && STANDARD_LAYOUTS.contains(customContent.getLayoutId())) { // If the app's custom views are objects returned from Builder.create*ContentView() // then the app is most likely attempting to spoof the user. Even if they are not, // the result would be broken (b/189189308) so we will ignore it. Log.w(TAG, "For apps targeting S, a custom content view that is a modified " + "version of any standard layout is disallowed."); return false; } return true; } /** Loading @@ -5842,7 +5860,7 @@ public class Notification implements Parcelable */ public RemoteViews createBigContentView() { RemoteViews result = null; if (mN.bigContentView != null && useExistingRemoteView()) { if (useExistingRemoteView(mN.bigContentView)) { return fullyCustomViewRequiresDecoration(false /* fromStyle */) ? minimallyDecoratedBigContentView(mN.bigContentView) : mN.bigContentView; } Loading Loading @@ -5947,7 +5965,7 @@ public class Notification implements Parcelable * @hide */ public RemoteViews createHeadsUpContentView(boolean increasedHeight) { if (mN.headsUpContentView != null && useExistingRemoteView()) { if (useExistingRemoteView(mN.headsUpContentView)) { return fullyCustomViewRequiresDecoration(false /* fromStyle */) ? minimallyDecoratedHeadsUpContentView(mN.headsUpContentView) : mN.headsUpContentView; Loading Loading @@ -6396,7 +6414,7 @@ public class Notification implements Parcelable mN.reduceImageSizes(mContext); if (mContext.getApplicationInfo().targetSdkVersion < Build.VERSION_CODES.N && (useExistingRemoteView())) { && !styleDisplaysCustomViewInline()) { if (mN.contentView == null) { mN.contentView = createContentView(); mN.extras.putInt(EXTRA_REBUILD_CONTENT_VIEW_ACTION_COUNT, Loading Loading @@ -6427,6 +6445,10 @@ public class Notification implements Parcelable return mN; } private boolean styleDisplaysCustomViewInline() { return mStyle != null && mStyle.displayCustomViewInline(); } /** * Apply this Builder to an existing {@link Notification} object. * Loading Loading @@ -6576,7 +6598,7 @@ public class Notification implements Parcelable public boolean usesTemplate() { return (mN.contentView == null && mN.headsUpContentView == null && mN.bigContentView == null) || (mStyle != null && mStyle.displayCustomViewInline()); || styleDisplaysCustomViewInline(); } } Loading
core/java/android/appwidget/AppWidgetManager.java +10 −0 Original line number Diff line number Diff line Loading @@ -963,6 +963,9 @@ public class AppWidgetManager { /** * Set the component for a given appWidgetId. * * If successful, the app widget provider will receive a {@link #ACTION_APPWIDGET_UPDATE} * broadcast. * * <p class="note">You need the BIND_APPWIDGET permission or the user must have enabled binding * widgets always for your component. Should be used by apps that host widgets; if this * method returns false, call {@link #ACTION_APPWIDGET_BIND} to request permission to Loading @@ -983,6 +986,9 @@ public class AppWidgetManager { /** * Set the component for a given appWidgetId. * * If successful, the app widget provider will receive a {@link #ACTION_APPWIDGET_UPDATE} * broadcast. * * <p class="note">You need the BIND_APPWIDGET permission or the user must have enabled binding * widgets always for your component. Should be used by apps that host widgets; if this * method returns false, call {@link #ACTION_APPWIDGET_BIND} to request permission to Loading @@ -1006,6 +1012,10 @@ public class AppWidgetManager { /** * Set the provider for a given appWidgetId if the caller has a permission. * * If successful, the app widget provider will receive a {@link #ACTION_APPWIDGET_UPDATE} * broadcast. * * <p> * <strong>Note:</strong> You need the {@link android.Manifest.permission#BIND_APPWIDGET} * permission or the user must have enabled binding widgets always for your component. Loading
core/java/android/net/NetworkPolicyManager.java +0 −4 Original line number Diff line number Diff line Loading @@ -34,8 +34,6 @@ import android.content.Intent; import android.content.pm.PackageManager; import android.content.pm.PackageManager.NameNotFoundException; import android.content.pm.Signature; import android.net.ConnectivityAnnotations.MultipathPreference; import android.net.ConnectivityAnnotations.RestrictBackgroundStatus; import android.net.wifi.WifiConfiguration; import android.net.wifi.WifiInfo; import android.os.Build; Loading Loading @@ -465,7 +463,6 @@ public class NetworkPolicyManager { */ @SystemApi(client = SystemApi.Client.MODULE_LIBRARIES) @RequiresPermission(NetworkStack.PERMISSION_MAINLINE_NETWORK_STACK) @RestrictBackgroundStatus public int getRestrictBackgroundStatus(int uid) { try { return mService.getRestrictBackgroundStatus(uid); Loading Loading @@ -591,7 +588,6 @@ public class NetworkPolicyManager { */ @SystemApi(client = SystemApi.Client.MODULE_LIBRARIES) @RequiresPermission(NetworkStack.PERMISSION_MAINLINE_NETWORK_STACK) @MultipathPreference public int getMultipathPreference(@NonNull Network network) { try { return mService.getMultipathPreference(network); Loading