Handle callingPackageName being null properly in checkStartActivity().
callingPackageName can actually be null when started via command line, etc. Previously the getApplicationInfo() call will fail if package name is null and we'll ignore it so there won't be a crash, but it's still better to handle it properly. Bug: 131204827 Test: presubmit Change-Id: I33ba43c28798226bed925940c2ffd09622372d09
This commit is contained in:
@@ -17,6 +17,7 @@
|
||||
package com.android.server.policy;
|
||||
|
||||
import android.annotation.NonNull;
|
||||
import android.annotation.Nullable;
|
||||
import android.content.Intent;
|
||||
|
||||
/**
|
||||
@@ -34,5 +35,5 @@ public abstract class PermissionPolicyInternal {
|
||||
* @return whether the activity should be started
|
||||
*/
|
||||
public abstract boolean checkStartActivity(@NonNull Intent intent, int callingUid,
|
||||
@NonNull String callingPackage);
|
||||
@Nullable String callingPackage);
|
||||
}
|
||||
|
||||
@@ -480,8 +480,9 @@ public final class PermissionPolicyService extends SystemService {
|
||||
|
||||
@Override
|
||||
public boolean checkStartActivity(@NonNull Intent intent, int callingUid,
|
||||
@NonNull String callingPackage) {
|
||||
if (isActionRemovedForCallingPackage(intent.getAction(), callingPackage)) {
|
||||
@Nullable String callingPackage) {
|
||||
if (callingPackage != null && isActionRemovedForCallingPackage(intent.getAction(),
|
||||
callingPackage)) {
|
||||
Slog.w(LOG_TAG, "Action Removed: starting " + intent.toString() + " from "
|
||||
+ callingPackage + " (uid=" + callingUid + ")");
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user