Merge "Check intent action in OMS.PackageReceiver for secure coding"

This commit is contained in:
Ryan Mitchell
2019-02-16 02:36:41 +00:00
committed by Gerrit Code Review

View File

@@ -344,6 +344,11 @@ public final class OverlayManagerService extends SystemService {
private final class PackageReceiver extends BroadcastReceiver {
@Override
public void onReceive(@NonNull final Context context, @NonNull final Intent intent) {
final String action = intent.getAction();
if (action == null) {
Slog.e(TAG, "Cannot handle package broadcast with null action");
return;
}
final Uri data = intent.getData();
if (data == null) {
Slog.e(TAG, "Cannot handle package broadcast with null data");
@@ -361,7 +366,7 @@ public final class OverlayManagerService extends SystemService {
userIds = new int[] { UserHandle.getUserId(extraUid) };
}
switch (intent.getAction()) {
switch (action) {
case ACTION_PACKAGE_ADDED:
if (replacing) {
onPackageUpgraded(packageName, userIds);