Merge "Silently exit if Pia cant post notification" into main
This commit is contained in:
@@ -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);
|
||||
new PackageInstalledNotificationUtils(context, installer,
|
||||
packageName).postAppInstalledNotification();
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user