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

Commit 5a726914 authored by Sumedh Sen's avatar Sumedh Sen Committed by Android (Google) Code Review
Browse files

Merge "Silently exit if Pia cant post notification" into main

parents 50e3809a 728ac98e
Loading
Loading
Loading
Loading
+15 −5
Original line number Diff line number Diff line
@@ -19,6 +19,8 @@ package com.android.packageinstaller;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.pm.InstallSourceInfo;
import android.content.pm.PackageManager;
import android.net.Uri;
import android.util.Log;

@@ -61,11 +63,19 @@ public class PackageInstalledReceiver extends BroadcastReceiver {
                return;
            }

            // TODO: Make sure the installer information here is accurate
            String installer =
                    context.getPackageManager().getInstallerPackageName(packageName);
            try {
                InstallSourceInfo installerInfo =
                        context.getPackageManager().getInstallSourceInfo(packageName);
                String installer = installerInfo.getInstallingPackageName();
                if (installer == null) {
                    Log.e(TAG, "No installer package name for: " + packageName);
                    return;
                }
                new PackageInstalledNotificationUtils(context, installer,
                        packageName).postAppInstalledNotification();
            } catch (PackageManager.NameNotFoundException e) {
                Log.e(TAG, "Cannot get source info for: " + packageName);
            }
        }
    }
}