Loading core/java/android/content/IntentFilter.java +10 −0 Original line number Diff line number Diff line Loading @@ -822,6 +822,16 @@ public class IntentFilter implements Parcelable { return mActions.size(); } /** * Returns the number of actions in the filter, or {@code 0} if there are no actions. * <p> This method provides a safe alternative to {@link #countActions()}, which * may throw an exception if there are no actions. * @hide */ public final int safeCountActions() { return mActions == null ? 0 : mActions.size(); } /** * Return an action in the filter. */ Loading services/core/java/com/android/server/am/ActivityManagerService.java +1 −1 Original line number Diff line number Diff line Loading @@ -14642,7 +14642,7 @@ public class ActivityManagerService extends IActivityManager.Stub final StringBuilder sb = new StringBuilder("registerReceiver: "); sb.append(Binder.getCallingUid()); sb.append('/'); sb.append(receiverId == null ? "null" : receiverId); sb.append('/'); final int actionsCount = filter.countActions(); final int actionsCount = filter.safeCountActions(); if (actionsCount > 0) { for (int i = 0; i < actionsCount; ++i) { sb.append(filter.getAction(i)); Loading
core/java/android/content/IntentFilter.java +10 −0 Original line number Diff line number Diff line Loading @@ -822,6 +822,16 @@ public class IntentFilter implements Parcelable { return mActions.size(); } /** * Returns the number of actions in the filter, or {@code 0} if there are no actions. * <p> This method provides a safe alternative to {@link #countActions()}, which * may throw an exception if there are no actions. * @hide */ public final int safeCountActions() { return mActions == null ? 0 : mActions.size(); } /** * Return an action in the filter. */ Loading
services/core/java/com/android/server/am/ActivityManagerService.java +1 −1 Original line number Diff line number Diff line Loading @@ -14642,7 +14642,7 @@ public class ActivityManagerService extends IActivityManager.Stub final StringBuilder sb = new StringBuilder("registerReceiver: "); sb.append(Binder.getCallingUid()); sb.append('/'); sb.append(receiverId == null ? "null" : receiverId); sb.append('/'); final int actionsCount = filter.countActions(); final int actionsCount = filter.safeCountActions(); if (actionsCount > 0) { for (int i = 0; i < actionsCount; ++i) { sb.append(filter.getAction(i));