Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2ddbd661 authored by Android Build Coastguard Worker's avatar Android Build Coastguard Worker
Browse files

Snap for 12854492 from 072f9d5f to 25Q2-release

Change-Id: Ie3f600e264814d39ed18e6c24712aeb76e0be629
parents 0cb49d54 072f9d5f
Loading
Loading
Loading
Loading
+13 −7
Original line number Diff line number Diff line
@@ -12676,21 +12676,27 @@ package android.security {
package android.security.advancedprotection {
  @FlaggedApi("android.security.aapm_api") public final class AdvancedProtectionFeature implements android.os.Parcelable {
    ctor public AdvancedProtectionFeature(int);
    ctor public AdvancedProtectionFeature(@NonNull String);
    method public int describeContents();
    method public int getId();
    method @NonNull public String getId();
    method public void writeToParcel(@NonNull android.os.Parcel, int);
    field @NonNull public static final android.os.Parcelable.Creator<android.security.advancedprotection.AdvancedProtectionFeature> CREATOR;
  }
  @FlaggedApi("android.security.aapm_api") public final class AdvancedProtectionManager {
    method @NonNull public android.content.Intent createSupportIntent(@NonNull String, @Nullable String);
    method @NonNull @RequiresPermission(android.Manifest.permission.MANAGE_ADVANCED_PROTECTION_MODE) public java.util.List<android.security.advancedprotection.AdvancedProtectionFeature> getAdvancedProtectionFeatures();
    method @RequiresPermission(android.Manifest.permission.MANAGE_ADVANCED_PROTECTION_MODE) public void setAdvancedProtectionEnabled(boolean);
    field public static final int FEATURE_ID_DISALLOW_CELLULAR_2G = 0; // 0x0
    field public static final int FEATURE_ID_DISALLOW_INSTALL_UNKNOWN_SOURCES = 1; // 0x1
    field public static final int FEATURE_ID_DISALLOW_USB = 2; // 0x2
    field public static final int FEATURE_ID_DISALLOW_WEP = 3; // 0x3
    field public static final int FEATURE_ID_ENABLE_MTE = 4; // 0x4
    field @FlaggedApi("android.security.aapm_api") public static final String ACTION_SHOW_ADVANCED_PROTECTION_SUPPORT_DIALOG = "android.security.advancedprotection.action.SHOW_ADVANCED_PROTECTION_SUPPORT_DIALOG";
    field public static final String EXTRA_SUPPORT_DIALOG_FEATURE = "android.security.advancedprotection.extra.SUPPORT_DIALOG_FEATURE";
    field public static final String EXTRA_SUPPORT_DIALOG_TYPE = "android.security.advancedprotection.extra.SUPPORT_DIALOG_TYPE";
    field public static final String FEATURE_ID_DISALLOW_CELLULAR_2G = "android.security.advancedprotection.feature_disallow_2g";
    field public static final String FEATURE_ID_DISALLOW_INSTALL_UNKNOWN_SOURCES = "android.security.advancedprotection.feature_disallow_install_unknown_sources";
    field public static final String FEATURE_ID_DISALLOW_USB = "android.security.advancedprotection.feature_disallow_usb";
    field public static final String FEATURE_ID_DISALLOW_WEP = "android.security.advancedprotection.feature_disallow_wep";
    field public static final String FEATURE_ID_ENABLE_MTE = "android.security.advancedprotection.feature_enable_mte";
    field public static final String SUPPORT_DIALOG_TYPE_BLOCKED_INTERACTION = "android.security.advancedprotection.type_blocked_interaction";
    field public static final String SUPPORT_DIALOG_TYPE_DISABLED_SETTING = "android.security.advancedprotection.type_disabled_setting";
  }
}
+1 −1
Original line number Diff line number Diff line
@@ -25,6 +25,6 @@ import android.app.ApplicationStartInfo;
 *
 * @hide
 */
interface IApplicationStartInfoCompleteListener {
oneway interface IApplicationStartInfoCompleteListener {
    void onApplicationStartInfoComplete(in ApplicationStartInfo applicationStartInfo);
}
+2 −2
Original line number Diff line number Diff line
@@ -270,6 +270,6 @@ interface INotificationManager

    int[] getAllowedAdjustmentKeyTypes();
    void setAssistantAdjustmentKeyTypeState(int type, boolean enabled);
    String[] getTypeAdjustmentDeniedPackages();
    void setTypeAdjustmentForPackageState(String pkg, boolean enabled);
    int[] getAllowedAdjustmentKeyTypesForPackage(String pkg);
    void setAssistantAdjustmentKeyTypeStateForPackage(String pkg, int type, boolean enabled);
}
+23 −153
Original line number Diff line number Diff line
@@ -17,7 +17,6 @@
package android.app;

import static android.Manifest.permission.POST_NOTIFICATIONS;
import static android.app.NotificationChannel.DEFAULT_CHANNEL_ID;
import static android.content.pm.PackageManager.PERMISSION_GRANTED;
import static android.service.notification.Flags.notificationClassification;

@@ -51,7 +50,6 @@ import android.os.Binder;
import android.os.Build;
import android.os.Bundle;
import android.os.IBinder;
import android.os.IpcDataCache;
import android.os.Parcel;
import android.os.Parcelable;
import android.os.RemoteException;
@@ -73,8 +71,6 @@ import android.util.LruCache;
import android.util.Slog;
import android.util.proto.ProtoOutputStream;

import com.android.internal.annotations.VisibleForTesting;

import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.time.InstantSource;
@@ -1206,13 +1202,6 @@ public class NotificationManager {
     * package (see {@link Context#createPackageContext(String, int)}).</p>
     */
    public NotificationChannel getNotificationChannel(String channelId) {
        if (Flags.nmBinderPerfCacheChannels()) {
            return getChannelFromList(channelId,
                    mNotificationChannelListCache.query(new NotificationChannelQuery(
                            mContext.getOpPackageName(),
                            mContext.getPackageName(),
                            mContext.getUserId())));
        } else {
        INotificationManager service = service();
        try {
            return service.getNotificationChannel(mContext.getOpPackageName(),
@@ -1221,7 +1210,6 @@ public class NotificationManager {
            throw e.rethrowFromSystemServer();
        }
    }
    }

    /**
     * Returns the notification channel settings for a given channel and
@@ -1234,13 +1222,6 @@ public class NotificationManager {
     */
    public @Nullable NotificationChannel getNotificationChannel(@NonNull String channelId,
            @NonNull String conversationId) {
        if (Flags.nmBinderPerfCacheChannels()) {
            return getConversationChannelFromList(channelId, conversationId,
                    mNotificationChannelListCache.query(new NotificationChannelQuery(
                            mContext.getOpPackageName(),
                            mContext.getPackageName(),
                            mContext.getUserId())));
        } else {
        INotificationManager service = service();
        try {
            return service.getConversationNotificationChannel(mContext.getOpPackageName(),
@@ -1250,7 +1231,6 @@ public class NotificationManager {
            throw e.rethrowFromSystemServer();
        }
    }
    }

    /**
     * Returns all notification channels belonging to the calling package.
@@ -1261,12 +1241,6 @@ public class NotificationManager {
     * {@link Context#createPackageContext(String, int)}).</p>
     */
    public List<NotificationChannel> getNotificationChannels() {
        if (Flags.nmBinderPerfCacheChannels()) {
            return mNotificationChannelListCache.query(new NotificationChannelQuery(
               mContext.getOpPackageName(),
               mContext.getPackageName(),
               mContext.getUserId()));
        } else {
        INotificationManager service = service();
        try {
            return service.getNotificationChannels(mContext.getOpPackageName(),
@@ -1275,47 +1249,6 @@ public class NotificationManager {
            throw e.rethrowFromSystemServer();
        }
    }
    }

    // channel list assumed to be associated with the appropriate package & user id already.
    private static NotificationChannel getChannelFromList(String channelId,
            List<NotificationChannel> channels) {
        if (channels == null) {
            return null;
        }
        if (channelId == null) {
            channelId = DEFAULT_CHANNEL_ID;
        }
        for (NotificationChannel channel : channels) {
            if (channelId.equals(channel.getId())) {
                return channel;
            }
        }
        return null;
    }

    private static NotificationChannel getConversationChannelFromList(String channelId,
            String conversationId, List<NotificationChannel> channels) {
        if (channels == null) {
            return null;
        }
        if (channelId == null) {
            channelId = DEFAULT_CHANNEL_ID;
        }
        if (conversationId == null) {
            return getChannelFromList(channelId, channels);
        }
        NotificationChannel parent = null;
        for (NotificationChannel channel : channels) {
            if (conversationId.equals(channel.getConversationId())
                    && channelId.equals(channel.getParentChannelId())) {
                return channel;
            } else if (channelId.equals(channel.getId())) {
                parent = channel;
            }
        }
        return parent;
    }

    /**
     * Deletes the given notification channel.
@@ -1395,71 +1328,6 @@ public class NotificationManager {
        }
    }

    private static final String NOTIFICATION_CHANNEL_CACHE_API = "getNotificationChannel";
    private static final String NOTIFICATION_CHANNEL_LIST_CACHE_NAME = "getNotificationChannels";
    private static final int NOTIFICATION_CHANNEL_CACHE_SIZE = 10;

    private final IpcDataCache.QueryHandler<NotificationChannelQuery, List<NotificationChannel>>
            mNotificationChannelListQueryHandler = new IpcDataCache.QueryHandler<>() {
                @Override
                public List<NotificationChannel> apply(NotificationChannelQuery query) {
                    INotificationManager service = service();
                    try {
                        return service.getNotificationChannels(query.callingPkg,
                                query.targetPkg, query.userId).getList();
                    } catch (RemoteException e) {
                        throw e.rethrowFromSystemServer();
                    }
                }

                @Override
                public boolean shouldBypassCache(@NonNull NotificationChannelQuery query) {
                    // Other locations should also not be querying the cache in the first place if
                    // the flag is not enabled, but this is an extra precaution.
                    if (!Flags.nmBinderPerfCacheChannels()) {
                        Log.wtf(TAG,
                                "shouldBypassCache called when nm_binder_perf_cache_channels off");
                        return true;
                    }
                    return false;
                }
            };

    private final IpcDataCache<NotificationChannelQuery, List<NotificationChannel>>
            mNotificationChannelListCache =
            new IpcDataCache<>(NOTIFICATION_CHANNEL_CACHE_SIZE, IpcDataCache.MODULE_SYSTEM,
                    NOTIFICATION_CHANNEL_CACHE_API, NOTIFICATION_CHANNEL_LIST_CACHE_NAME,
                    mNotificationChannelListQueryHandler);

    private record NotificationChannelQuery(
            String callingPkg,
            String targetPkg,
            int userId) {}

    /**
     * @hide
     */
    public static void invalidateNotificationChannelCache() {
        if (Flags.nmBinderPerfCacheChannels()) {
            IpcDataCache.invalidateCache(IpcDataCache.MODULE_SYSTEM,
                    NOTIFICATION_CHANNEL_CACHE_API);
        } else {
            // if we are here, we have failed to flag something
            Log.wtf(TAG, "invalidateNotificationChannelCache called without flag");
        }
    }

    /**
     * For testing only: running tests with a cache requires marking the cache's property for
     * testing, as test APIs otherwise cannot invalidate the cache. This must be called after
     * calling PropertyInvalidatedCache.setTestMode(true).
     * @hide
     */
    @VisibleForTesting
    public void setChannelCacheToTestMode() {
        mNotificationChannelListCache.testPropertyName();
    }

    /**
     * @hide
     */
@@ -2118,10 +1986,12 @@ public class NotificationManager {
     * @hide
     */
    @FlaggedApi(android.app.Flags.FLAG_NOTIFICATION_CLASSIFICATION_UI)
    public void setTypeAdjustmentForPackageState(@NonNull String pkg, boolean enabled) {
    public void setAssistantAdjustmentKeyTypeStateForPackage(@NonNull String pkg,
                                                             @Adjustment.Types int type,
                                                             boolean enabled) {
        INotificationManager service = service();
        try {
            service.setTypeAdjustmentForPackageState(pkg, enabled);
            service.setAssistantAdjustmentKeyTypeStateForPackage(pkg, type, enabled);
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
        }
+10 −0
Original line number Diff line number Diff line
@@ -210,6 +210,16 @@ flag {
  }
}

flag {
    name: "place_add_user_dialog_within_activity"
    namespace: "multiuser"
    description: "Display dialog within activity to make it traversable by Accessibility"
    bug: "383034393"
    metadata {
        purpose: PURPOSE_BUGFIX
  }
}

flag {
    name: "property_invalidated_cache_bypass_mismatched_uids"
    namespace: "multiuser"
Loading