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

Commit 378f7fa9 authored by Jin Seok Park's avatar Jin Seok Park Committed by Android (Google) Code Review
Browse files

Merge "Revise PendingIntent.queryIntentComponents API" into sc-dev

parents d5e15db2 8a228cf1
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -35,7 +35,7 @@ package android.app {
  }

  public final class PendingIntent implements android.os.Parcelable {
    method @Nullable @RequiresPermission(android.Manifest.permission.GET_INTENT_SENDER_INTENT) public java.util.List<android.content.pm.ResolveInfo> queryIntentComponents(int);
    method @NonNull @RequiresPermission(android.Manifest.permission.GET_INTENT_SENDER_INTENT) public java.util.List<android.content.pm.ResolveInfo> queryIntentComponents(int);
  }

  public class StatusBarManager {
+1 −1
Original line number Diff line number Diff line
@@ -298,7 +298,7 @@ package android.app {
  }

  public final class PendingIntent implements android.os.Parcelable {
    method @Nullable @RequiresPermission("android.permission.GET_INTENT_SENDER_INTENT") public java.util.List<android.content.pm.ResolveInfo> queryIntentComponents(int);
    method @NonNull @RequiresPermission("android.permission.GET_INTENT_SENDER_INTENT") public java.util.List<android.content.pm.ResolveInfo> queryIntentComponents(int);
    field @Deprecated public static final int FLAG_MUTABLE_UNAUDITED = 33554432; // 0x2000000
  }

+1 −1
Original line number Diff line number Diff line
@@ -706,7 +706,7 @@ interface IActivityManager {
    boolean stopProfile(int userId);

    /** Called by PendingIntent.queryIntentComponents() */
    List<ResolveInfo> queryIntentComponentsForIntentSender(in IIntentSender sender, int matchFlags);
    ParceledListSlice queryIntentComponentsForIntentSender(in IIntentSender sender, int matchFlags);

    int getUidProcessCapabilities(int uid, in String callingPackage);
}
+8 −4
Original line number Diff line number Diff line
@@ -26,7 +26,6 @@ import android.annotation.IntDef;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.RequiresPermission;
import android.annotation.SuppressLint;
import android.annotation.SystemApi;
import android.annotation.SystemApi.Client;
import android.annotation.TestApi;
@@ -41,6 +40,7 @@ import android.content.IIntentSender;
import android.content.Intent;
import android.content.IntentSender;
import android.content.pm.PackageManager.ResolveInfoFlags;
import android.content.pm.ParceledListSlice;
import android.content.pm.ResolveInfo;
import android.os.Build;
import android.os.Bundle;
@@ -60,6 +60,7 @@ import com.android.internal.os.IResultReceiver;

import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.util.Collections;
import java.util.List;
import java.util.Objects;

@@ -1239,14 +1240,17 @@ public final class PendingIntent implements Parcelable {
     * @param flags MATCH_* flags from {@link android.content.pm.PackageManager}.
     * @hide
     */
    @SuppressLint("NullableCollection")
    @RequiresPermission(permission.GET_INTENT_SENDER_INTENT)
    @SystemApi(client = Client.MODULE_LIBRARIES)
    @TestApi
    public @Nullable List<ResolveInfo> queryIntentComponents(@ResolveInfoFlags int flags) {
    public @NonNull List<ResolveInfo> queryIntentComponents(@ResolveInfoFlags int flags) {
        try {
            return ActivityManager.getService()
            ParceledListSlice<ResolveInfo> parceledList = ActivityManager.getService()
                    .queryIntentComponentsForIntentSender(mTarget, flags);
            if (parceledList == null) {
                return Collections.emptyList();
            }
            return parceledList.getList();
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
        }
+8 −8
Original line number Diff line number Diff line
@@ -92,6 +92,7 @@ import static android.text.format.DateUtils.DAY_IN_MILLIS;
import static com.android.internal.protolog.ProtoLogGroup.WM_DEBUG_CONFIGURATION;
import static com.android.server.am.ActivityManagerDebugConfig.DEBUG_ALL;
import static com.android.server.am.ActivityManagerDebugConfig.DEBUG_ALLOWLISTS;
import static com.android.server.am.ActivityManagerDebugConfig.DEBUG_ANR;
import static com.android.server.am.ActivityManagerDebugConfig.DEBUG_BACKGROUND_CHECK;
import static com.android.server.am.ActivityManagerDebugConfig.DEBUG_BACKUP;
@@ -104,7 +105,6 @@ import static com.android.server.am.ActivityManagerDebugConfig.DEBUG_OOM_ADJ;
import static com.android.server.am.ActivityManagerDebugConfig.DEBUG_POWER;
import static com.android.server.am.ActivityManagerDebugConfig.DEBUG_PROCESSES;
import static com.android.server.am.ActivityManagerDebugConfig.DEBUG_SERVICE;
import static com.android.server.am.ActivityManagerDebugConfig.DEBUG_ALLOWLISTS;
import static com.android.server.am.ActivityManagerDebugConfig.POSTFIX_BACKUP;
import static com.android.server.am.ActivityManagerDebugConfig.POSTFIX_BROADCAST;
import static com.android.server.am.ActivityManagerDebugConfig.POSTFIX_CLEANUP;
@@ -4968,7 +4968,7 @@ public class ActivityManagerService extends IActivityManager.Stub
    }
    @Override
    public List<ResolveInfo> queryIntentComponentsForIntentSender(
    public ParceledListSlice<ResolveInfo> queryIntentComponentsForIntentSender(
            IIntentSender pendingResult, int matchFlags) {
        enforceCallingPermission(Manifest.permission.GET_INTENT_SENDER_INTENT,
                "queryIntentComponentsForIntentSender()");
@@ -4986,15 +4986,15 @@ public class ActivityManagerService extends IActivityManager.Stub
        final int userId = res.key.userId;
        switch (res.key.type) {
            case ActivityManager.INTENT_SENDER_ACTIVITY:
                return mContext.getPackageManager().queryIntentActivitiesAsUser(
                        intent, matchFlags, userId);
                return new ParceledListSlice<>(mContext.getPackageManager()
                        .queryIntentActivitiesAsUser(intent, matchFlags, userId));
            case ActivityManager.INTENT_SENDER_SERVICE:
            case ActivityManager.INTENT_SENDER_FOREGROUND_SERVICE:
                return mContext.getPackageManager().queryIntentServicesAsUser(
                        intent, matchFlags, userId);
                return new ParceledListSlice<>(mContext.getPackageManager()
                        .queryIntentServicesAsUser(intent, matchFlags, userId));
            case ActivityManager.INTENT_SENDER_BROADCAST:
                return mContext.getPackageManager().queryBroadcastReceiversAsUser(
                        intent, matchFlags, userId);
                return new ParceledListSlice<>(mContext.getPackageManager()
                        .queryBroadcastReceiversAsUser(intent, matchFlags, userId));
            default: // ActivityManager.INTENT_SENDER_ACTIVITY_RESULT
                throw new IllegalStateException("Unsupported intent sender type: " + res.key.type);
        }